shish 4 년 전
부모
커밋
70b4de4997
4개의 변경된 파일57개의 추가작업 그리고 172개의 파일을 삭제
  1. 19 132
      hdApp/src/admin/home/workbench.vue
  2. 31 20
      hdApp/src/mixins/globalMixins.js
  3. 2 20
      hdApp/src/plugins/luch-request_0.0.7/request.js
  4. 5 0
      hdApp/src/utils/auth.js

+ 19 - 132
hdApp/src/admin/home/workbench.vue

@@ -1,6 +1,5 @@
 <template>
 <template>
   <div class="app-main app-content">
   <div class="app-main app-content">
-
     <div class="user-wrap" :style="{ backgroundImage: `url(${constant.imgUrl}/home/bg_hd_home.png)` }">
     <div class="user-wrap" :style="{ backgroundImage: `url(${constant.imgUrl}/home/bg_hd_home.png)` }">
       <div class="user-top">
       <div class="user-top">
         <div class="app-size-28">今日概况</div>
         <div class="app-size-28">今日概况</div>
@@ -22,10 +21,7 @@
             {{ $util.numberFormat(data.todayData.visit) || 0 }}
             {{ $util.numberFormat(data.todayData.visit) || 0 }}
           </div>
           </div>
         </div>
         </div>
-        <div
-          class="info-list"
-          @click="goNewStudent"
-        >
+        <div class="info-list" @click="goNewStudent" >
           <div class="info-list-name">新学员</div>
           <div class="info-list-name">新学员</div>
           <div class="info-list-value">
           <div class="info-list-value">
             {{ $util.numberFormat(data.todayData.newStudent) || 0 }}
             {{ $util.numberFormat(data.todayData.newStudent) || 0 }}
@@ -34,12 +30,7 @@
       </div>
       </div>
     </div>
     </div>
     <div class="module-com news-wrap">
     <div class="module-com news-wrap">
-      <div
-        class="news-list"
-        v-for="(item, index) in data.notice"
-        :key="index"
-        @click="pageToFn(item.page)"
-      >
+      <div class="news-list" v-for="(item, index) in data.notice" :key="index" @click="pageToFn(item.page)" >
         <div class="news-left">
         <div class="news-left">
           <i class="iconfont iconxiaoxi2 ling"></i>
           <i class="iconfont iconxiaoxi2 ling"></i>
           <span>{{ item.title }}</span>
           <span>{{ item.title }}</span>
@@ -50,70 +41,33 @@
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
-
-    <!-- 客户按钮 -->
     <view class="module-com">
     <view class="module-com">
       <view class="tabs-head_bx">
       <view class="tabs-head_bx">
 				<image @click="pageTo({ url: '/admin/billing/index' })" :src="kdSrc" mode="widthFix" ></image>
 				<image @click="pageTo({ url: '/admin/billing/index' })" :src="kdSrc" mode="widthFix" ></image>
 				<image @click="pageTo({ url: '/pagesPurchase/order' })" :src="cgSrc" mode="widthFix"></image>
 				<image @click="pageTo({ url: '/pagesPurchase/order' })" :src="cgSrc" mode="widthFix"></image>
       </view>
       </view>
       <div class="tabs-wrap">
       <div class="tabs-wrap">
-        <div
-          class="tabs-list"
-          v-for="(item, index) in tabsData"
-          :key="index"
-        >
+        <div class="tabs-list" v-for="(item, index) in tabsData" :key="index" >
           <div @click="goPage(item)">
           <div @click="goPage(item)">
             <div class="tabs-img">
             <div class="tabs-img">
-              <img
-                :src="item.img"
-                alt
-                mode="widthFix"
-              />
+              <img :src="item.img" alt mode="widthFix" />
             </div>
             </div>
             <div class="tabs-name">{{ item.name }}</div>
             <div class="tabs-name">{{ item.name }}</div>
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
     </view>
     </view>
-
-    <!-- 总览 -->
     <div class="module-com total-wrap">
     <div class="module-com total-wrap">
       <div class="total-tit">总览</div>
       <div class="total-tit">总览</div>
       <div class="total-blo">
       <div class="total-blo">
-        <div
-          class="total-list"
-          v-for="(item, index) in totalData"
-          :key="index"
-        >
+        <div class="total-list" v-for="(item, index) in totalData" :key="index" >
           <div class="list-num">{{ $util.numberFormat(item.value) }}</div>
           <div class="list-num">{{ $util.numberFormat(item.value) }}</div>
           <div class="app-color-3">{{ item.name }}</div>
           <div class="app-color-3">{{ item.name }}</div>
         </div>
         </div>
       </div>
       </div>
     </div>
     </div>
-
-    <!-- 续费遮罩 -->
-    <modal-module
-      :show="renewMask"
-      :custom="true"
-      :maskClosable="true"
-      padding="30upx 30upx"
-    >
-      <template>
-        <div class="renew-wrap">
-          <div class="renew-wrap-text">你的账号已到期</div>
-          <button
-            class="admin-button-com middle"
-            @click="renewFn()"
-          >
-            立即续费
-          </button>
-        </div>
-      </template>
-    </modal-module>
   </div>
   </div>
 </template>
 </template>
-
 <script>
 <script>
 import { mapGetters, mapState } from "vuex";
 import { mapGetters, mapState } from "vuex";
 import FabModule from "@/components/plugin/fab";
 import FabModule from "@/components/plugin/fab";
@@ -133,47 +87,17 @@ export default {
   data () {
   data () {
     return {
     return {
       constant: this.$constant,
       constant: this.$constant,
-      renewMask: false,
       getappIdList: {},
       getappIdList: {},
       data: {
       data: {
         admin: {},
         admin: {},
         asset: {},
         asset: {},
         notice: {},
         notice: {},
-        todayData: {
-					income:0.00,
-					order:0,
-					custom:0,
-					expend:0.00
-        }
+        todayData: { income:0.00, order:0, custom:0, expend:0.00 }
       },
       },
       orderData: [
       orderData: [
-        {
-          name: "待配送",
-          value: 0,
-          url: "/admin/home/order",
-          type: 4,
-          query: {
-            tabIndex: 2
-          }
-        },
-        {
-          name: "配送中",
-          value: 0,
-          url: "/admin/home/order",
-          type: 4,
-          query: {
-            tabIndex: 3
-          }
-        },
-        {
-          name: "已完成",
-          url: "/admin/home/order",
-          type: 4,
-          query: {
-            tabIndex: 0
-          },
-          value: 0
-        }
+        { name: "待配送", value: 0, url: "/admin/home/order", type: 4, query: { tabIndex: 2 } },
+        { name: "配送中", value: 0, url: "/admin/home/order", type: 4, query: { tabIndex: 3 } },
+        { name: "已完成", url: "/admin/home/order", type: 4, query: { tabIndex: 0 }, value: 0 }
       ],
       ],
       tabsData: [
       tabsData: [
         {
         {
@@ -218,30 +142,12 @@ export default {
         }
         }
       ],
       ],
       totalData: [
       totalData: [
-        {
-          name: "客户数",
-          value: 0
-        },
-        {
-          name: "总访客",
-          value: 0
-        },
-        {
-          name: "总订单",
-          value: 0
-        },
-        {
-          name: "总收入(元)",
-          value: 0
-        },
-        {
-          name: "总支出(元)",
-          value: 0
-        },
-        {
-          name: "总采购(元)",
-          value: 0
-        }
+        { name: "客户数", value: 0 },
+        { name: "总访客", value: 0 },
+        { name: "总订单", value: 0 },
+        { name: "总收入(元)", value: 0 },
+        { name: "总支出(元)", value: 0 },
+        { name: "总采购(元)", value: 0 }
       ],
       ],
       cgSrc: `${this.$constant.imgUrl}/ghs/home/cg.png`,
       cgSrc: `${this.$constant.imgUrl}/ghs/home/cg.png`,
       kdSrc: `${this.$constant.imgUrl}/ghs/home/kd.png`
       kdSrc: `${this.$constant.imgUrl}/ghs/home/kd.png`
@@ -259,8 +165,7 @@ export default {
     ...mapGetters({ userInfo: "getUser" }),
     ...mapGetters({ userInfo: "getUser" }),
     ...mapGetters({ loginInfo: "getLoginInfo" })
     ...mapGetters({ loginInfo: "getLoginInfo" })
   },
   },
-  onLoad (option) {
-    console.log(this.$constant)
+  onLoad () {
    },
    },
   onPullDownRefresh () {
   onPullDownRefresh () {
     this.init();
     this.init();
@@ -288,11 +193,6 @@ export default {
 						uni.setNavigationBarTitle({
 						uni.setNavigationBarTitle({
 							title: res.name
 							title: res.name
 						});
 						});
-
-						let nowTime = getDataTimestamp(new Date(), true);
-						if (nowTime > res.setDeadline) {
-							this.renewMask = true;
-						}
 					});
 					});
 					consoleIndex().then(res => {
 					consoleIndex().then(res => {
 						this.data = res.data;
 						this.data = res.data;
@@ -314,29 +214,18 @@ export default {
     },
     },
     // 跳转
     // 跳转
     pageToFn (page) {
     pageToFn (page) {
-      this.$util.pageTo({
-        url: page
-      });
+      this.$util.pageTo({ url: page })
     },
     },
     // 新学员列表
     // 新学员列表
     goNewStudent () {
     goNewStudent () {
-      uni.navigateTo({
-        url: '/admin/student/newStudent'
-      })
+      uni.navigateTo({ url: '/admin/student/newStudent' })
     },
     },
     // 续费
     // 续费
     renewFn () {
     renewFn () {
-      this.$util.pageTo({
-        url: "/pagesClient/official/index",
-        query: {
-          pay: 1
-        },
-        type: 2
-      });
+      this.$util.pageTo({ url: "/pagesClient/official/index", query: { pay: 1 }, type: 2 })
     },
     },
     goToMallPt (url) {
     goToMallPt (url) {
       let self = this
       let self = this
-      console.log(url + '?account=' + self.loginInfo.shopId)
         uni.navigateToMiniProgram({
         uni.navigateToMiniProgram({
           appId: this.getappIdList.mall.miniAppId,
           appId: this.getappIdList.mall.miniAppId,
           path: url + '?account=' + self.loginInfo.shopId,
           path: url + '?account=' + self.loginInfo.shopId,
@@ -352,7 +241,6 @@ export default {
   }
   }
 };
 };
 </script>
 </script>
-
 <style lang="scss" scoped>
 <style lang="scss" scoped>
 .app-content {
 .app-content {
   padding-bottom: 10upx;
   padding-bottom: 10upx;
@@ -489,7 +377,6 @@ export default {
   align-items: center;
   align-items: center;
   padding: 20upx 15upx;
   padding: 20upx 15upx;
 }
 }
-// tabs
 .tabs-wrap {
 .tabs-wrap {
   padding: 20upx 10upx;
   padding: 20upx 10upx;
   @include disFlex(center, flex-start);
   @include disFlex(center, flex-start);

+ 31 - 20
hdApp/src/mixins/globalMixins.js

@@ -14,19 +14,18 @@ export default {
 			// 全局混入,插入全局工具函数
 			// 全局混入,插入全局工具函数
 			$util: this.$util,
 			$util: this.$util,
 			// 全局混入,插入全局跳转函数
 			// 全局混入,插入全局跳转函数
-      pageTo: pageTo,
-      AUTHORITY_SHOW: false,
-      shopAdminId: null,
-      MODEL_TITLE: '',
-      EXPER_AUTH_SHOW: false
+			pageTo: pageTo,
+			AUTHORITY_SHOW: false,
+			shopAdminId: null,
+			MODEL_TITLE: '',
+			EXPER_AUTH_SHOW: false
 		}
 		}
 	},
 	},
 	computed: {
 	computed: {
 		...mapGetters({ loginInfo: "getLoginInfo" }),
 		...mapGetters({ loginInfo: "getLoginInfo" }),
-    ...mapGetters(["getLoginInfo"])
+    	...mapGetters(["getLoginInfo"])
 	},
 	},
-	// 页面生命周期才触发
-  onLoad: function (option) {
+  	onLoad: function (option) {
 		this.option = option || null
 		this.option = option || null
 		if (option.token) {
 		if (option.token) {
 			uni.setStorageSync('token', option.token)
 			uni.setStorageSync('token', option.token)
@@ -34,19 +33,31 @@ export default {
 		if (option.account) {
 		if (option.account) {
 			uni.setStorageSync('account', option.account)
 			uni.setStorageSync('account', option.account)
 		}
 		}
-    uni.setStorageSync('currentQuery', JSON.stringify(option))
+    	uni.setStorageSync('currentQuery', JSON.stringify(option))
+		if (this.$util.isEmpty(this.getLoginInfo)) {
+			// #ifdef MP-WEIXIN
+			//微信小程序第一次打开小程序时尝试登录一次
+			var pages = getCurrentPages()
+			let currentRoute  = pages[pages.length-1].route;
+			let token = uni.getStorageSync('token')
+			if(this.$util.isEmpty(token)){
+				if(currentRoute == 'admin/home/workbench'){
+					wxLoginFn(true).then(res => {
+						let token = res.token || ''
+						if (!this.$util.isEmpty(token)) {
+							getUser(true)
+							this.setUserShopAll()
+						}
+						if (this.init) {
+							this.init()
+						}
+					})
+				}
+			}else{
 
 
-    if (this.$util.isEmpty(this.getLoginInfo)) {
-      // #ifdef MP-WEIXIN
-      wxLoginFn(true).then(res => {
-        getUser(true)
-        this.setUserShopAll()
-        if (this.init) {
-          this.init()
-        }
-      })
-      // #endif
-    }
+			}
+			// #endif
+		}
 	},
 	},
 	onShow(){
 	onShow(){
     if (this.init) {
     if (this.init) {

+ 2 - 20
hdApp/src/plugins/luch-request_0.0.7/request.js

@@ -152,7 +152,6 @@ class Request {
 						// 返回错误信息
 						// 返回错误信息
 						if (response.data.code == 0) {
 						if (response.data.code == 0) {
 							if (!config.hideError) {
 							if (!config.hideError) {
-								// this.$msg(response.data.msg)
 								uni.showToast({
 								uni.showToast({
 									title: response.data.msg,
 									title: response.data.msg,
 									icon: 'none',
 									icon: 'none',
@@ -162,19 +161,7 @@ class Request {
 							}
 							}
 							reject(response.data)
 							reject(response.data)
 						} else if (response.data.code && response.data.code == -1) {
 						} else if (response.data.code && response.data.code == -1) {
-							// 无权限或者登录过期
-							uni.removeStorageSync('token')
-							uni.showToast({
-								title: '登录过期,正在重新登录...',
-								icon: 'none',
-								mask: true
-							})
-							setTimeout(() => {
-								getCheckLogin()
-								// uni.reLaunch({
-								// 	url: `/pages/page/login/index`
-								// })
-							}, 1000)
+							//登录过期,正在重新登录
 						} else if (response.data.code == 2) {
 						} else if (response.data.code == 2) {
 							uni.removeStorageSync('token')
 							uni.removeStorageSync('token')
 							uni.removeStorageSync('shopUser')
 							uni.removeStorageSync('shopUser')
@@ -184,12 +171,7 @@ class Request {
 								icon: 'none',
 								icon: 'none',
 								mask: true
 								mask: true
 							})
 							})
-							setTimeout(() => {
-								getCheckLogin()
-								// uni.reLaunch({
-								// 	url: `/pages/page/login/index`
-								// })
-							}, 1000)
+							setTimeout(() => { getCheckLogin() }, 1000)
 						} else {
 						} else {
 							console.log('response.data', response.data)
 							console.log('response.data', response.data)
 							if (!config.hideError) {
 							if (!config.hideError) {

+ 5 - 0
hdApp/src/utils/auth.js

@@ -96,6 +96,11 @@ export async function wxLoginFn(update) {
 					var page = (pages[pages.length - 1]).route;
 					var page = (pages[pages.length - 1]).route;
 					resolve({ redirectPage: page, ...subRes })
 					resolve({ redirectPage: page, ...subRes })
 
 
+					let token = subRes.data.token || '';
+					if (util.isEmpty(token)) {
+						return false
+					}
+
 					uni.setStorageSync('token', subRes.data.token)
 					uni.setStorageSync('token', subRes.data.token)
 					uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
 					uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
 					getDictionaries({ token: subRes.data.token }).then(res => {
 					getDictionaries({ token: subRes.data.token }).then(res => {