diff --git a/components/ProductWindow.vue b/components/ProductWindow.vue
index 240cb39..6aca291 100644
--- a/components/ProductWindow.vue
+++ b/components/ProductWindow.vue
@@ -58,7 +58,7 @@ export default {
default: () => {}
},
cartNum: {
- type: String,
+ type: Number,
default: () => 1
}
},
diff --git a/main.js b/main.js
index df3c7a4..6409666 100644
--- a/main.js
+++ b/main.js
@@ -33,8 +33,6 @@ Vue.prototype.$validator = function(rule) {
return new schema(rule);
};
-Vue.prototype.$dialog = dialog;
-
const CACHE_KEY = "clear_0.0.1";
if (!cookie.has(CACHE_KEY)) {
@@ -54,6 +52,7 @@ Vue.mixin({
const {
$mp
} = this.$root
+ console.log($mp)
this._route = parseRoute($mp)
// this.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL;
this._data.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL;
@@ -78,25 +77,29 @@ Object.defineProperty(Vue.prototype, '$yroute', {
Vue.prototype.$VUE_APP_RESOURCES_URL = VUE_APP_RESOURCES_URL
Vue.prototype.$VUE_APP_API_URL = VUE_APP_API_URL
-
-// #ifdef APP-PLUS
-// App平台编译的代码
-Vue.prototype.$deviceType = 'App'
-Vue.prototype.$platform = uni.getSystemInfoSync().platform
-// #endif
-// #ifndef H5
-// H5编译的代码
+
+
+// #ifdef H5
+// H5编译的代码
Vue.prototype.$deviceType = 'H5'
// #endif
+// #ifdef APP-PLUS
+// App平台编译的代码
+Vue.prototype.$deviceType = 'App'
+Vue.prototype.$platform = uni.getSystemInfoSync().platform
+// #endif
+
// #ifdef MP-WEIXIN
// 微信小程序编译的代码
Vue.prototype.$deviceType = 'Weixin'
-// #endif
-
-if(wx){
- Vue.prototype.$deviceType = 'Weixin'
-}
+// #endif
+
+console.log(wx,121212)
+console.log(Vue.prototype.$deviceType)
+// if(wx){
+// Vue.prototype.$deviceType = 'Weixin'
+// }
-app.$mount()
+app.$mount()
diff --git a/pages/Loading/index.vue b/pages/Loading/index.vue
index 75a62eb..5532b08 100644
--- a/pages/Loading/index.vue
+++ b/pages/Loading/index.vue
@@ -1,77 +1,97 @@
-
-
-
+
+
+
+
+
diff --git a/pages/activity/GoodsGroup/index.vue b/pages/activity/GoodsGroup/index.vue
index 93275b8..787429b 100644
--- a/pages/activity/GoodsGroup/index.vue
+++ b/pages/activity/GoodsGroup/index.vue
@@ -10,6 +10,7 @@
:key="combinationListIndex"
@click="link(item.id)"
>
+ {{item.id}}
diff --git a/pages/activity/GroupDetails/index.vue b/pages/activity/GroupDetails/index.vue
index aa3817a..f1a65b6 100644
--- a/pages/activity/GroupDetails/index.vue
+++ b/pages/activity/GroupDetails/index.vue
@@ -114,7 +114,7 @@
单独购买
立即开团
-
+
-
+ login({
+ username: account,
+ password,
+ spread: cookie.get("spread")
+ })
+ .then(({
+ data
+ }) => {
+ this.$store.commit("LOGIN", data.token, dayjs(data.expires_time));
+ handleGetUserInfo()
+ // let replace=this.$yroute.query.replace
+ // if(replace){
+
+ // }
+ // this.$yrouter.replace({
+ // path: this.$yroute.query.replace || '/pages/home/index'
+ // });
+ })
+ .catch(err => {
+ uni.showToast({
+ title: err.msg || err.response.data.msg,
+ icon: "none",
+ duration: 2000
+ });
+ });
+ }
+ }
+ };
+
diff --git a/pages/user/Register/index.vue b/pages/user/Register/index.vue
index 530f60d..fa6feea 100644
--- a/pages/user/Register/index.vue
+++ b/pages/user/Register/index.vue
@@ -10,17 +10,17 @@
-
-
待付款
@@ -142,11 +142,11 @@
By@意象
-
+ > -->
@@ -310,7 +310,7 @@ export default {
},
onShow() {
console.log(this.userInfo);
- if (this.userInfo.uid) {
+ if (this.$store.getters.token) {
this.User();
this.MenuUser();
this.isWeixin = isWeixin();
diff --git a/store/index.js b/store/index.js
index 4384ce8..d509251 100644
--- a/store/index.js
+++ b/store/index.js
@@ -17,7 +17,7 @@ const vuexStore = new Vuex.Store({
// 是否授权
isAuthorization: false,
token: store.get(LOGIN_KEY) || null,
- userInfo: null
+ userInfo: store.get('userInfo')
},
mutations: {
SHOW_FOOTER(state) {
@@ -81,8 +81,13 @@ const vuexStore = new Vuex.Store({
changeLogin({ state, commit }, data, date) {
commit("LOGIN", data, date);
},
- changeUserInfo({ state, commit }, user) {
- commit("UPDATE_USERINFO", user.user);
+ setUserInfo({ state, commit }, user) {
+ commit("UPDATE_USERINFO", user);
+ if (user) {
+ store.set('userInfo', user)
+ } else {
+ store.set('userInfo', null)
+ }
},
changeAuthorizationPage({ state, commit }, index) {
commit("UPDATE_AUTHORIZATIONPAGE", index);
diff --git a/utils/index.js b/utils/index.js
index 7ce7820..de944f8 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -120,7 +120,7 @@ export const replaceLogin = (msg) => {
console.log(Vue.prototype.$deviceType)
// 这里代表已经失去登录状态以及401强制推出登录了
store.commit('LOGOUT')
-
+ console.log(uni, 989)
if (Vue.prototype.$deviceType == 'Weixin') {
// 如果是微信小程序,跳转到授权页
replace({
@@ -132,9 +132,9 @@ export const replaceLogin = (msg) => {
})
} else {
// 如果不是小程序跳转到登录页
- replace({
+ push({
path: '/pages/user/Login/index',
- query: query || {
+ query: {
redirect: `/${getCurrentPageUrl()}`,
...parseQuery()
}
@@ -220,52 +220,7 @@ export const login = (option) => {
store.commit("LOGIN", data.token, dayjs(data.expires_time));
console.log('登录成功5')
- getUser().then(res => {
- store.dispatch('changeUserInfo', {
- user: res.data
- })
- console.log('登录成功6')
- console.log(option)
- // option && option.success ? option.success() : null
- var pages = getCurrentPages() //获取加载的页面
- console.log('登录成功7')
-
- var currentPage = pages[pages.length - 1] //获取当前页面的对象
- let url = "/pages/home/index"
- let query = {}
- console.log('登录成功8')
- console.log(currentPage)
-
- if (currentPage) {
- // 获取到最后一个页面
- if (
- currentPage.route != 'pages/Loading/index'
- &&
- currentPage.route != 'pages/user/Login/index'
- ) {
- url = currentPage.route
- }
- if (currentPage.route == 'pages/authorization/index') {
- const {
- redirect,
- ...querys
- } = currentPage.options
- url = redirect
- query = {
- ...querys
- }
- }
- }
- console.log('登录成功9')
- console.log({
- path: url,
- query
- })
- switchTab({
- path: `${url}`,
- query
- });
- })
+ handleGetUserInfo()
}).catch(error => {
reject()
@@ -304,6 +259,51 @@ export const login = (option) => {
})
}
+export const handleGetUserInfo = () => {
+ getUser().then(res => {
+ console.log(res.data, '登录后的样式')
+ store.dispatch('setUserInfo', res.data)
+ console.log('登录成功6')
+ var pages = getCurrentPages() //获取加载的页面
+ console.log('登录成功7')
+
+ var currentPage = pages[pages.length - 1] //获取当前页面的对象
+ let url = "/pages/home/index"
+ let query = {}
+ console.log('登录成功8')
+ console.log(currentPage)
+
+ if (currentPage) {
+ // 获取到最后一个页面
+ if (
+ currentPage.route != 'pages/Loading/index' &&
+ currentPage.route != 'pages/user/Login/index'
+ ) {
+ url = currentPage.route
+ }
+ if (currentPage.route == 'pages/authorization/index') {
+ const {
+ redirect,
+ ...querys
+ } = currentPage.options
+ url = redirect
+ query = {
+ ...querys
+ }
+ }
+ }
+ console.log('登录成功9')
+ console.log({
+ path: url,
+ query
+ })
+ switchTab({
+ path: `${url}`,
+ query
+ });
+ })
+}
+
const handleFail = (option, msg) => {
// 此处是处理登录失效的问题的
@@ -332,11 +332,11 @@ export function parseRoute($mp) {
return {
path: `/${path}`,
params: {},
- query: _$mp.query,
+ query: _$mp.query || _$mp.page.options,
hash: '',
fullPath: parseUrl({
path: `/${path}`,
- query: _$mp.query
+ query: _$mp.query || _$mp.page.options
}),
name: path && path.replace(/\/(\w)/g, ($0, $1) => $1.toUpperCase())
}
@@ -376,7 +376,7 @@ export const handleLoginStatus = (location, complete, fail, success) => {
}
console.log(store.getters.userInfo, '用户信息')
- if (!store.getters.userInfo.uid) {
+ if (!store.getters.token) {
page.map((item) => {
console.log(item.path == path)
if (item.path == path) {