Browse Source

切换账号

zhaoxiaohai 3 years ago
parent
commit
af2d225718

+ 7 - 3
components/My_navBar/index.js

@@ -10,10 +10,14 @@ Component({
         attached: function () {
             // 在组件实例进入页面节点树时执行
             //获取当前登录用户名
-            /* const userName = getApp().globalData.accountList[wx.getStorageSync('userIndex')].fname;
+            let data = getApp().globalData.account_list[wx.getStorageSync('userData').index];
+            let userName = '';
+            (data.fagentname != null) ? userName = data.fagentname + '-': userName = data.fname + '-'
+            userName += data.frole;
+            console.log(userName)
             this.setData({
                 userName
-            }) */
+            })
         },
         detached: function () {
             // 在组件实例被从页面节点树移除时执行
@@ -34,7 +38,7 @@ Component({
         a1212() {
             //跳转到选择账号
             wx.navigateTo({
-                url: '/pages/login/index?type=' + 2,
+                url: '/pages/login/index?type=changeUser',
             })
         }
     }

+ 3 - 2
pages/businessPartner/details.js

@@ -14,7 +14,7 @@ Page({
         methodsList: ['上游', '下游', '双向合作'],
         showType: '',
         throttle: true, //截流
-        fisadministrator: (wx.getStorageSync('userData').fisadministrator == 1) ? false : true,
+        fisadministrator: null,
     },
     /* 遮罩层点击关闭 */
     closeTheDropDown() {
@@ -42,7 +42,8 @@ Page({
         };
         this.setData({
             partnerDetails: data,
-            showType
+            showType,
+            fisadministrator: (wx.getStorageSync('userData').fisadministrator == 1) ? false : true,
         })
     },
     /* 选择合作方式 */

+ 65 - 3
pages/liveStreaming/index.js

@@ -1,4 +1,7 @@
-// pages/liveStreaming/index.js
+import {
+  ApiModel
+} from "../../utils/api";
+const _Http = new ApiModel;
 Page({
 
   /**
@@ -6,14 +9,69 @@ Page({
    */
   data: {
     tabsList: ["私域直播", "展会直播"], //tabs列表
-    tabsIndex: 0,
+    tabsIndex: 0, //tabs下标
+    accountStatus: null, //直播账号状态 1-账号正常 2-账号审核中 3-没有账号
   },
 
   /**
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
+    //获取直播详情
+    _Http.basic({
+      "accesstoken": wx.getStorageSync('userData').token,
+      "classname": "customer.live.live",
+      "method": "getSYLiveInfo",
+      "content": {}
+    }).then(res => {
+      console.log(res)
+      this.setData({
+        accountStatus: res.code
+      })
+      switch (res.code) {
+        case 1:
+          this.setData({
+            accountMsg: res.data[0]
+          })
+          break;
+        case 2:
+          console.log(2)
+          break;
+        case 3:
+          console.log(2)
+          break;
+        default:
+          wx.showToast({
+            title: res.data,
+            icon: "none"
+          })
+      }
+    })
+  },
+  /* 申请直播账号 */
+  applyForLive() {
+    _Http.basic({
+      "accesstoken": wx.getStorageSync('userData').token,
+      "classname": "customer.live.live",
+      "method": "applySYLive",
+      "content": {}
+    }).then(res => {
+      if (res.code == 1) {
+        wx.showToast({
+          title: res.msg,
+          icon: "none"
+        })
+        this.setData({
+          accountStatus: 2
+        })
+      } else {
+        if (res.data == '私域直播已申请') return wx.showModal({
+          title: "提示",
+          content: "您的私域直播账号正在申请中"
+        })
+      }
 
+    })
   },
   /* tabs回调 */
   setIndex({
@@ -26,8 +84,12 @@ Page({
 
   /* 复制地址 */
   copyTheAddress(e) {
+    console.log(e)
+    const {
+      url
+    } = e.target.dataset
     wx.setClipboardData({
-      data: "321",
+      data: url,
       success(res) {
         wx.getClipboardData({
           success(res) {

+ 17 - 10
pages/liveStreaming/index.wxml

@@ -9,38 +9,45 @@
         </view>
     </view>
     <!-- 直播信息 -->
-    <view wx:if="{{true}}" class="account-information">
+    <view wx:if="{{accountStatus==1}}" class="account-information">
         <view class="account-information-row">
             <view>
-                <text class="title">密码</text> 321654
+                <view class="title" style="margin-right: 8rpx;">密码</view>{{accountMsg.channelpasswd}}
             </view>
             <view>
-                <text class="title">直播间地址 </text> www.jfc001.com/zb001 <text class="copy" bindtap="copyTheAddress">复制</text>
+                <view class="title">直播间地址</view>
+                <view class="chained-address u-line-1">{{accountMsg.fliveshowurl}}</view>
+                <view data-url="{{accountMsg.fliveshowurl}}" class="chained-address-copy" bindtap="copyTheAddress">复制</view>
             </view>
         </view>
         <view class="account-information-row">
             <view>
-                <text class="title">助教地址 </text> www.jfc001.com/zb001 <text class="copy" bindtap="copyTheAddress">复制</text>
+                <view class="title">助教地址</view>
+                <view class="chained-address u-line-1">{{accountMsg.fassistanturl}}</view>
+                <view data-url="{{accountMsg.fassistanturl}}" class="chained-address-copy" bindtap="copyTheAddress">复制</view>
             </view>
         </view>
         <view class="account-information-row">
             <view>
-                <text class="title">客户端开播地址 </text> www.jfc001.com/zb001 <text class="copy" bindtap="copyTheAddress">复制</text>
+                <view class="title">客户端开播地址</view>
+                <view class="chained-address u-line-1">{{accountMsg.fliveurl_client}}</view>
+                <view data-url="{{accountMsg.fliveurl_client}}" class="chained-address-copy" bindtap="copyTheAddress">复制</view>
             </view>
         </view>
         <view class="account-information-row">
             <view>
-                <text class="title">web端开播地址 </text> www.jfc001.com/zb001 <text class="copy" bindtap="copyTheAddress">复制</text>
+                <view class="title">web端开播地址</view>
+                <view class="chained-address u-line-1">{{accountMsg.fliveurl_web}}</view>
+                <view data-url="{{accountMsg.fliveurl_web}}" class="chained-address-copy" bindtap="copyTheAddress">复制</view>
             </view>
         </view>
     </view>
-    <view wx:else class="go-to-apply-for">
-        暂无账号 前往申请 <image style="width: 20rpx; height: 22rpx; margin-left: 8rpx;" src="/static/icon-07.png"></image>
+    <view wx:else class="go-to-apply-for" catchtap="applyForLive">
+        {{accountStatus==3?'暂无账号 点击申请 ':'直播申请中'}}<image wx:if="{{accountStatus==3}}" style="width: 20rpx; height: 22rpx; margin-left: 8rpx;" src="/static/icon-07.png"></image>
     </view>
 </view>
 <!-- 数据 -->
-
-<view class="msgBox" style="white-space:nowrap;">
+<view wx:if="{{accountStatus==1}}" class="msgBox" style="white-space:nowrap;">
     <!-- 标题和按钮 -->
     <view class="msgBox-title-and-but">
         <view class="msgBox-title">直播数据</view>

+ 13 - 1
pages/liveStreaming/index.wxss

@@ -67,11 +67,23 @@
     margin-top: 10rpx;
 }
 
+.account-information-row>view {
+    display: flex;
+}
+
+.account-information-row .chained-address {
+    max-width: 400rpx;
+    padding: 0 8rpx;
+}
 
-.copy {
+.chained-address-copy {
     color: #4DC2D4;
 }
 
+.account-information-row:first-child .chained-address {
+    width: 350rpx;
+}
+
 /* 去申请 */
 .go-to-apply-for {
     display: flex;

+ 5 - 0
pages/login/index.js

@@ -51,6 +51,11 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        if (options.type) {
+            this.setData({
+                pageType: "changeUser"
+            })
+        };
         if (wx.getStorageSync('userData').fphonenumber != null) this.setData({
             fphonenumber: wx.getStorageSync('userData').fphonenumber
         })