panhui 5 лет назад
Родитель
Сommit
1f5e514fdd
1 измененных файлов с 47 добавлено и 7 удалено
  1. 47 7
      src/pages/store/liveProduct.vue

+ 47 - 7
src/pages/store/liveProduct.vue

@@ -62,14 +62,17 @@
             use-slot
             :show="showCode"
             :show-cancel-button="!isStart"
-            cancel-button-text="返回"
             :confirm-button-text="isStart ? '确认' : '认证成功'"
             :confirm-button-color="$colors.prim"
-            @cancel="navigateBack"
+            @cancel="changeAccount"
             @confirm="showCode = false"
+            :cancel-button-text="isStart ? '' : '切换主播'"
         >
             <div class="url-box">
-                <div class="text1" style="text-align:center;max-width:220px">
+                <div class="text-title" v-if="userStoreInfo && !isStart">
+                    当前店铺直播微信号为:<br /><span>{{ userStoreInfo.wxUsername }}</span>
+                </div>
+                <div class="text2" style="text-align:center;max-width:220px">
                     {{
                         isStart ? '直播间创建成功扫描下方二维码进入直播间' : '开启直播前请先扫描下方二维码进行实名认证'
                     }}
@@ -95,6 +98,7 @@
 </template>
 
 <script>
+import { mapState } from 'vuex';
 import ButtonBg from '../../components/ButtonBg.vue';
 import ProductInfo from '../../components/ProductInfo.vue';
 export default {
@@ -112,6 +116,9 @@ export default {
             path: 'plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=5'
         };
     },
+    computed: {
+        ...mapState(['userStoreInfo'])
+    },
     methods: {
         loginMethods(needShow = false) {
             this.$store.dispatch('getUserStore').then(res => {
@@ -122,6 +129,7 @@ export default {
                 });
                 this.getData();
                 // this.createRoom();
+                console.log(this.isStart && !needShow);
                 if (this.isStart && !needShow) {
                     this.showCode = false;
                 } else {
@@ -172,7 +180,7 @@ export default {
                         confirmColor: this.$colors.prim,
                         showCancel: false,
                         success: res => {
-                            this.navigateBack();
+                            this.loginMethods();
                         }
                     });
                 });
@@ -258,6 +266,28 @@ export default {
                     this.showUrl = false;
                 }
             });
+        },
+        changeAccount() {
+            this.showCode = false;
+            wx.navigateTo({
+                url: '/pages/changeText',
+                success: res => {
+                    // success
+                    res.eventChannel.emit('message', this.userStoreInfo.wxUsername);
+                    res.eventChannel.emit('title', {
+                        title: '修改主播微信号',
+                        key: 'wxUsername'
+                    });
+                }
+            });
+        },
+        updateInfo(changeInfo = {}) {
+            let data = { ...this.userStoreInfo, ...changeInfo };
+            this.showLoading();
+            this.$http.postJson('/store/save', data).then(() => {
+                this.toast('设置成功', 'success');
+                this.loginMethods();
+            });
         }
     }
 };
@@ -318,11 +348,9 @@ export default {
 
     .text2 {
         font-size: 13px;
-        font-family: PingFangSC-Medium, PingFang SC;
-        font-weight: 500;
+        font-weight: bold;
         color: #1a1a1a;
         line-height: 18px;
-        padding: 25px 0;
         word-break: break-all;
         width: 250px;
 
@@ -337,5 +365,17 @@ export default {
         display: block;
         margin-top: 20px;
     }
+
+    .text-title {
+        font-size: 16px;
+        font-weight: bold;
+        color: #000000;
+        line-height: 22px;
+        text-align: center;
+        padding-bottom: 10px;
+        span {
+            color: @prim;
+        }
+    }
 }
 </style>