shish 5 лет назад
Родитель
Сommit
146a9c9065
2 измененных файлов с 16 добавлено и 30 удалено
  1. 5 24
      mallApp/src/mixins/globalMixins.js
  2. 11 6
      mallApp/src/pages/home/user.vue

+ 5 - 24
mallApp/src/mixins/globalMixins.js

@@ -64,42 +64,23 @@ export default {
 
 		// 登录
 		if (isLogin()) {
-			// #ifdef H5
+			console.log(1111)
 			if (this.init) {
 				this.init()
 			}
-			// #endif
-			// #ifdef MP-WEIXIN
-			if (this.init) {
-				this.init()
-			}
-			// #endif
 		} else {
-			// #ifdef H5
-			getCheckLogin().then(res => {
-			})
-			// #endif
-			// #ifdef MP-WEIXIN
+			console.log(1112)
 			wxLoginFn().then(res => {
 				if (this.init) {
+					console.log(1113)
 					this.init()
+					console.log(1114)
 				}
 			})
-			// #endif
 		}
 
 	},
 	mounted() {
-		if (this.mInit) {
-			// #ifdef H5
-			this.mInit()
-			// #endif
-
-			// #ifdef MP-WEIXIN
-			// wxLoginFn().then(res => {
-			// 	this.mInit()
-			// })
-			// #endif
-		}
+		if (this.mInit) {}
 	}
 }

+ 11 - 6
mallApp/src/pages/home/user.vue

@@ -6,7 +6,7 @@
           <div class="user-wrap-top">
             <div class="user-blo-left">
               <div class="user-name-warp">
-                <div class="user-name">石少华</div>
+                <div class="user-name">{{shopUser.name}}</div>
                 <div class="user-level-img">
                   <block>
                     <template>
@@ -16,12 +16,12 @@
                 </div>
               </div>
               <div class="user-level">
-                <div>ID 98</div>
+                <div>ID {{shopUser.id}}</div>
               </div>
             </div>
             <div class="user-blo-right login-attr-wrap">
               <img
-                :src="`${constant.imgUrl}/hhb_small.png`"
+                :src="shopUser.avatar"
                 alt="头像"
                 mode="widthFix"
               />
@@ -36,7 +36,7 @@
                 backgroundColor="#FF2842"
               />
             </div>
-            <div>成长值 580 </div>
+            <div>成长值 {{shopUser.growth}} </div>
           </div>
         </div>
       </template>
@@ -45,7 +45,7 @@
       <div class="surplus-wrap">
         <div class="surplus-left">
           <div>我的余额(¥)</div>
-          <div class="my-surplus">0.00</div>
+          <div class="my-surplus">{{shopUser.balance}}</div>
         </div>
         <div class="surplus-right">
           <button
@@ -125,12 +125,14 @@
 </template>
 
 <script>
+import { mapGetters } from "vuex";
 import TuiListView from "@/components/plugin/list-view";
 import TuiListCell from "@/components/plugin/list-cell";
 import LoginPopup from "@/pages/home/components/login-popup";
 import AppTrademark from "@/components/module/app-trademark";
 import GoLogin from "@/pages/home/components/go-login.vue";
 import AppVipModule from "@/components/module/app-vip";
+import { getShopUser } from "@/utils/auth";
 export default {
   name: "user",
   components: {
@@ -159,11 +161,14 @@ export default {
 
   },
   computed: {
+    ...mapGetters({ shopUser: "getShopUser" })
   },
   onLoad(option) {
   },
   methods: {
-    init() {},
+    init() {
+      getShopUser(true).then(res => {})
+    },
     pageToFn(item) {
         this.$util.pageTo(item)
     }