Przeglądaj źródła

优化供货商和零售端登录

jiangfeng 5 lat temu
rodzic
commit
2de8dc4b6e

+ 1 - 27
ghsApp/src/App.vue

@@ -42,33 +42,7 @@ export default {
 		const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
 		uni.setStorageSync('account', extConfig.account)
 		// #endif
-		wxLoginFn(true)
-			.then(res => {
-				//客户可以访问的页面
-				var urlArr = ['admin/shopAdmin/bind', 'pagesClient/official','pagesClient/member/bind','pagesShare/pay'];
-				var redirectPage = res.redirectPage;
-				var needRedirect = true;
-				urlArr.forEach((item, index, array) => {
-					if (redirectPage.indexOf(item) != -1) {
-						needRedirect = false;
-					}
-				})
-				if (needRedirect === true) {
-					//客户访问不能查看的页面跳转去官网
-					if (res.data.shopAdminId == '0') {
-						this.$util.pageTo({
-							url: "/pagesClient/official/index",
-							type: 2,
-							query: {
-								...this.option
-							}
-						});
-					}
-				}
-				getUser(true)
-				//获取门店信息
-				this.setUserShopAll()
-			})
+
 	},
 	onLoad(){
 		// const pages = getCurrentPages();

+ 28 - 39
ghsApp/src/admin/home/workbench.vue

@@ -302,47 +302,36 @@ export default {
 	},
 	methods: {
 		init() {
-			/*延迟监听token*/
-			if(!uni.getStorageSync('token')){
-				setTimeout(()=>{
-					this.init();
-				},100);
-			}else{
-				// 获取小程序的APPID
-				getWeixinId().then(res => {
-					this.getappIdList = res.data
-				});
-				getUser().then(res => {
-					uni.setNavigationBarTitle({
-						title: res.name
-					});
-
-					let nowTime = getDataTimestamp(new Date(), true);
-					if (nowTime > res.setDeadline) {
-						this.renewMask = true;
-					}
-				});
-				consoleIndex().then(res => {
-					this.data = res.data;
-					const { asset, todayData } = res.data;
-					if (!this.$util.isEmpty(asset)) {
-						// 订单总览
-						this.orderData[0].value = asset.unPayOrder;
-						this.orderData[1].value = asset.unSendOrder;
-						this.orderData[2].value = asset.sendingOrder;
-						// 总览数据
-						this.totalData[0].value = asset.totalUser;
-						this.totalData[1].value = asset.totalView;
-						this.totalData[2].value = asset.finishOrder;
-						this.totalData[3].value = asset.totalIncome;
-						this.totalData[4].value = asset.totalExpend;
-						this.totalData[5].value = asset.totalPurchase;
-					}
+			getWeixinId().then(res => {
+				this.getappIdList = res.data
+			});
+			getUser().then(res => {
+				uni.setNavigationBarTitle({
+					title: res.name
 				});
-			}
-
-
 
+				let nowTime = getDataTimestamp(new Date(), true);
+				if (nowTime > res.setDeadline) {
+					this.renewMask = true;
+				}
+			});
+			consoleIndex().then(res => {
+				this.data = res.data;
+				const { asset, todayData } = res.data;
+				if (!this.$util.isEmpty(asset)) {
+					// 订单总览
+					this.orderData[0].value = asset.unPayOrder;
+					this.orderData[1].value = asset.unSendOrder;
+					this.orderData[2].value = asset.sendingOrder;
+					// 总览数据
+					this.totalData[0].value = asset.totalUser;
+					this.totalData[1].value = asset.totalView;
+					this.totalData[2].value = asset.finishOrder;
+					this.totalData[3].value = asset.totalIncome;
+					this.totalData[4].value = asset.totalExpend;
+					this.totalData[5].value = asset.totalPurchase;
+				}
+			});
 		},
 		goPage (item) {
 			if (item.url === '/admin/my-mall') {

+ 41 - 4
ghsApp/src/mixins/globalMixins.js

@@ -1,4 +1,4 @@
-import { mapGetters } from 'vuex'
+import { mapGetters,mapActions } from 'vuex'
 import { pageTo, getCheckLogin, isLogin } from '@/utils/util.js'
 import { getUser, wxLoginFn } from '@/utils/auth'
 import constant from '@/constant'
@@ -28,9 +28,46 @@ export default {
 			uni.setStorageSync('account', option.account)
 		}
 		uni.setStorageSync('currentQuery', JSON.stringify(option))
-		if (this.init) {
-			this.init()
-		}
+		// if (isLogin()) {
+		// 	if (this.init) {
+		// 		this.init()
+		// 	}
+		// }else{}
+			wxLoginFn(true)
+				.then(res => {
+					//客户可以访问的页面
+					var urlArr = ['admin/shopAdmin/bind', 'pagesClient/official','pagesClient/member/bind','pagesShare/pay'];
+					var redirectPage = res.redirectPage;
+					var needRedirect = true;
+					urlArr.forEach((item, index, array) => {
+						if (redirectPage.indexOf(item) != -1) {
+							needRedirect = false;
+						}
+					})
+					if (needRedirect === true) {
+						//客户访问不能查看的页面跳转去官网
+						if (res.data.shopAdminId == '0') {
+							this.$util.pageTo({
+								url: "/pagesClient/official/index",
+								type: 2,
+								query: {
+									...this.option
+								}
+							});
+						}
+					}
+					getUser(true)
+					//获取门店信息
+					this.setUserShopAll()
+					if (this.init) {
+						this.init()
+					}
+				})
+
+
+	},
+	methods: {
+		...mapActions(['setUserShopAll'])
 	},
 	mounted() {
 		if (this.mInit) {

+ 1 - 5
ghsApp/src/pagesPurchase/add.vue

@@ -142,11 +142,7 @@
 			padding="30rpx 30rpx"
 		>
 		</modal-module> -->
-		<FooterCart
-			:price="allPrice"
-			:count="allCount"
-			@confirm="confirmSelectEvent"
-		></FooterCart>
+		<FooterCart :price="allPrice" :count="allCount" @confirm="confirmSelectEvent"></FooterCart>
     <kd-entrance></kd-entrance>
 	</view>
 </template>

+ 1 - 27
hdApp/src/App.vue

@@ -45,33 +45,7 @@ export default {
     uni.setStorageSync('account', extConfig.account)
 
     // #endif
-    wxLoginFn(true)
-      .then(res => {
-        //客户可以访问的地址
-        var urlArr = ['admin/shopAdmin/bind', 'pagesClient/official', 'pagesClient/member/bind', 'pagesShare/pay','pagesPurchase/ghsProduct'];
-        var redirectPage = res.redirectPage;
-        var needRedirect = true;
-        urlArr.forEach((item, index, array) => {
-          if (redirectPage.indexOf(item) != -1) {
-            needRedirect = false;
-          }
-        })
-        if (needRedirect === true) {
-          //客户访问不能查看的页面跳转去官网
-          if (res.data.shopAdminId == '0') {
-            this.$util.pageTo({
-              url: "/pagesClient/official/index",
-              type: 2,
-              query: {
-                ...this.option
-              }
-            });
-          }
-        }
-        getUser(true)
-        //获取门店信息
-        this.setUserShopAll()
-      })
+
   },
   onLoad () {
     // const pages = getCurrentPages();

+ 35 - 4
hdApp/src/mixins/globalMixins.js

@@ -1,4 +1,4 @@
-import { mapGetters } from 'vuex'
+import { mapGetters,mapActions } from 'vuex'
 import { pageTo, getCheckLogin, isLogin } from '@/utils/util.js'
 import { getUser, wxLoginFn } from '@/utils/auth'
 import constant from '@/constant'
@@ -28,9 +28,40 @@ export default {
 			uni.setStorageSync('account', option.account)
 		}
 		uni.setStorageSync('currentQuery', JSON.stringify(option))
-		if (this.init) {
-			this.init()
-		}
+
+		wxLoginFn(true)
+			.then(res => {
+				//客户可以访问的地址
+				var urlArr = ['admin/shopAdmin/bind', 'pagesClient/official', 'pagesClient/member/bind', 'pagesShare/pay','pagesPurchase/ghsProduct'];
+				var redirectPage = res.redirectPage;
+				var needRedirect = true;
+				urlArr.forEach((item, index, array) => {
+					if (redirectPage.indexOf(item) != -1) {
+						needRedirect = false;
+					}
+				})
+				if (needRedirect === true) {
+					//客户访问不能查看的页面跳转去官网
+					if (res.data.shopAdminId == '0') {
+						this.$util.pageTo({
+							url: "/pagesClient/official/index",
+							type: 2,
+							query: {
+								...this.option
+							}
+						});
+					}
+				}
+				getUser(true)
+				//获取门店信息
+				this.setUserShopAll()
+				if (this.init) {
+					this.init()
+				}
+			})
+	},
+	methods: {
+		...mapActions(['setUserShopAll'])
 	},
 	mounted() {
 		if (this.mInit) {