xiansin 4 gadi atpakaļ
vecāks
revīzija
33ebdc95b4

+ 10 - 19
components/page-component/app-my-app/app-my-share.vue

xqd xqd xqd xqd
@@ -1,10 +1,10 @@
 <template>
-    <view class="app-my-share" v-if="userInfo.parent_id">
+    <view class="app-my-share" v-if="shareInfo.parent_id">
         <view class="share-info">
             <view class="headimg">
-                <image :src="userInfo.identity.parent_headimg"></image>
+                <image :src="shareInfo.parent_headimg"></image>
             </view>
-            <text class="nickname">{{userInfo.identity.parent_name}}为您服务</text>
+            <text class="nickname">{{shareInfo.parent_name}}为您服务</text>
             <view class="contact" @click="showQrCode">
                 <image src="../../../static/image/icon/cash/icon-wechat.png"></image> 联系
             </view>
@@ -16,14 +16,14 @@
                 </view>
                 <view class="share">
                     <view class="headimg">
-                        <image :src="userInfo.identity.parent_headimg"></image>
+                        <image :src="shareInfo.parent_headimg"></image>
                     </view>
                     <view class="nickname">
-                        <view>{{userInfo.identity.parent_name}}</view>
+                        <view>{{shareInfo.parent_name}}</view>
                         <view class="desc">加我微信,随时为您服务</view>
                     </view>
                 </view>
-                <image class="qrcode" :src="userInfo.identity.parent_qr_code"></image>
+                <image class="qrcode" :src="shareInfo.parent_qr_code"></image>
                 <view class="saoyisao">扫一扫上面的二维码图案,加我微信</view>
             </div>
 
@@ -46,7 +46,7 @@
         },
         data(){
             return {
-                showQrCodeStatus: false
+                showQrCodeStatus: false,
             }
         },
         methods: {
@@ -78,26 +78,17 @@
                     }
                 });
             }
+        },
+        onLoad(){
+
         },
         computed: {
-            isLogin() {
-                return this.$user.isLogin();
-            },
             ...mapState('mallConfig', {
                 setting: state => state.mall.setting
             }),
             ...mapGetters('mallConfig', {
                 getTheme: 'getTheme',
             }),
-            ...mapGetters({
-                userInfo: 'user/info',
-            }),
-        },
-        created() {
-            if (this.isLogin) {
-                this.$store.dispatch('user/info', {refresh: true});
-            } else {
-            }
         },
     }
 </script>

+ 16 - 1
pages/index/index.vue

xqd xqd xqd xqd
@@ -1,6 +1,6 @@
 <template>
     <app-layout :haveBackground="haveBackground">
-        <app-my-share></app-my-share>
+        <app-my-share :shareInfo="shareInfo"></app-my-share>
         <app-my-app v-if="config.is_add_app == 1"></app-my-app>
         <template v-if="type === 'mall'">
             <app-index @buyProduct="buyProduct" v-if="destroy" :page-hide="pageHide" :home-pages="homePages" :is_storage="is_storage" :theme="themeObject" :page_id="page_id" :is_required="is_required" :coupon_req="coupon_req"></app-index>
@@ -50,6 +50,7 @@
                     goods: {},
                     attrShow: 0
                 },
+                shareInfo:''
             }
         },
 
@@ -66,6 +67,7 @@
             this.pageHide = true;
         },
         onLoad(options) {
+            this.getUserInfo();
             // 测试下分支
             if (typeof options.scene !== 'undefined') {
                 if (options.scene === 'share') {
@@ -267,7 +269,20 @@
             buyProduct(data) {
                 this.attrGoods.goods = data.goods;
                 this.attrGoods.attrShow = data.attrShow;
+            },
+            getUserInfo(){
+                let _this = this;
+                this.$request({
+                    url: this.$api.user.user_info,
+                }).then(response => {
+                    this.$hideLoading();
+                    console.log('-->',response.data)
+                    if (response.code === 0) {
+                        _this.shareInfo = response.data.identity
+                    }
+                })
             }
+
         },
         onShareAppMessage() {
             let args = {