zhaoxiaohai 4 vuotta sitten
vanhempi
commit
ae2e776ad7

+ 2 - 0
README.md

@@ -64,6 +64,8 @@
 
 ​	My_TwoDimensionalCode -- 二维码
 
+​	My_liveAccountMsg -- 直播账号信息展示
+
 # 缓存
 
 ​	userData -- 用户基本数据 -- 保存数据:index-用户列表下标,token,fisadministrator--是否主账号,tagentsid,tenterpriseid,userid

+ 75 - 0
components/My_liveAccountMsg/index.js

@@ -0,0 +1,75 @@
+import {
+    ApiModel
+} from "../../utils/api";
+const _Http = new ApiModel;
+Component({
+    options: {
+        addGlobalClass: true
+    },
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        /* 直播账号状态 */
+        accountStatus: {
+            type: Number
+        },
+        /* 直播账号信息 */
+        accountMsg: {
+            type: Object
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {},
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /* 申请直播账号 */
+        applyForLive() {
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('userData').token,
+                "classname": "customer.live.live",
+                "method": "applySYLive",
+                "content": {}
+            }).then(res => {
+                console.log(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: "您的私域直播账号正在申请中"
+                    })
+                }
+            })
+        },
+        /* 复制地址 */
+        copyTheAddress(e) {
+            console.log(e)
+            const {
+                url
+            } = e.target.dataset
+            wx.setClipboardData({
+                data: url,
+                success(res) {
+                    wx.getClipboardData({
+                        success(res) {
+                            console.log('内容已复制') // data
+                        }
+                    })
+                }
+            })
+        },
+    }
+})

+ 4 - 0
components/My_liveAccountMsg/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 46 - 0
components/My_liveAccountMsg/index.wxml

@@ -0,0 +1,46 @@
+<view class="msgBox">
+    <!-- 标题和按钮 -->
+    <view class="msgBox-title-and-but">
+        <view class="msgBox-title">直播账号信息</view>
+        <view class="msgBox-but">
+            <van-button custom-class="custom-class-msgBox-but">一键开播</van-button>
+        </view>
+    </view>
+    <!-- 直播信息 -->
+    <view wx:if="{{accountStatus==1}}" class="account-information">
+        <view class="account-information-row">
+            <view>
+                <view class="title" style="margin-right: 8rpx;">密码</view>{{accountMsg.channelpasswd}}
+            </view>
+            <view>
+                <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>
+                <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>
+                <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>
+                <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" 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>

+ 111 - 0
components/My_liveAccountMsg/index.wxss

@@ -0,0 +1,111 @@
+/* 信息盒子 */
+.msgBox {
+    width: 702rpx;
+    background: #FFFFFF;
+    border-radius: 20rpx;
+    margin: 0 auto;
+    padding: 10rpx;
+    padding-bottom: 20rpx;
+    box-sizing: border-box;
+    margin-bottom: 30rpx;
+    margin-top: 20rpx;
+}
+
+.msgBox-title-and-but {
+    height: 68rpx;
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    padding: 0 10rpx;
+    border-bottom: 2rpx solid rgba(151, 151, 151, .1);
+    box-sizing: border-box;
+}
+
+/* 标题 */
+.msgBox-title {
+    height: 40rpx;
+    line-height: 40rpx;
+    font-size: 28rpx;
+    font-weight: 550;
+    color: rgba(0, 0, 0, 0.85);
+}
+
+.msgBox-title>text {
+    font-size: 26rpx;
+}
+
+.dataReturn {
+    font-size: 20rpx;
+    color: #4CBECF;
+}
+
+/* 一键开播按钮 */
+.custom-class-msgBox-but {
+    width: 116rpx !important;
+    height: 44rpx !important;
+    background: #4DC2D4 !important;
+    border-radius: 22rpx !important;
+    font-size: 20rpx !important;
+    font-weight: 500;
+    color: #FFFFFF !important;
+    padding-left: 0 !important;
+    padding-right: 0 !important;
+}
+
+/* 账号信息 */
+.account-information {
+    width: 100%;
+    font-size: 20rpx;
+    font-family: HelveticaNeue;
+    color: rgba(0, 0, 0, 0.65);
+    padding: 0 20rpx;
+    box-sizing: border-box;
+}
+
+.account-information-row:first-child {
+    margin-top: 18rpx;
+}
+
+.account-information-row {
+    display: flex;
+    justify-content: space-between;
+    width: 100%;
+    height: 44rpx;
+    font-size: 20rpx;
+    font-family: HelveticaNeue;
+    color: rgba(0, 0, 0, 0.65);
+    line-height: 44rpx;
+    margin-top: 10rpx;
+}
+
+.account-information-row>view {
+    display: flex;
+}
+
+.account-information-row .chained-address {
+    max-width: 400rpx;
+    padding: 0 8rpx;
+}
+
+.chained-address-copy {
+    color: #4DC2D4;
+}
+
+.account-information-row:first-child .chained-address {
+    width: 350rpx;
+}
+
+/* 去申请 */
+.go-to-apply-for {
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    width: 330rpx;
+    height: 74rpx;
+    border-radius: 10rpx;
+    border: 2rpx solid rgba(0, 0, 0, 0.85);
+    box-sizing: border-box;
+    margin: 30rpx auto 10rpx;
+    font-size: 24rpx;
+    color: rgba(0, 0, 0, 0.85);
+}

+ 59 - 101
pages/liveStreaming/index.js

@@ -27,62 +27,56 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function (options) {
-    //获取直播详情
+    //获取直播账号
+    this.getLiveInfo()
+  },
+  /* 获取直播账号详情 */
+  getLiveInfo() {
+    const method = (this.data.tabsIndex == 0) ? 'getSYLiveInfo' : 'getLiveInfo';
     _Http.basic({
       "accesstoken": wx.getStorageSync('userData').token,
       "classname": "customer.live.live",
-      "method": "getSYLiveInfo",
+      "method": method,
       "content": {}
     }).then(res => {
-      console.log(res)
       this.setData({
-        accountStatus: res.code
+        accountStatus: res.code,
+        accountMsg: res.data[0]
       })
-      switch (res.code) {
-        case 1:
-          this.setData({
-            accountMsg: res.data[0]
-          })
-          /* 直播数据统计 */
-          _Http.basic({
-            "accesstoken": wx.getStorageSync('userData').token,
-            "classname": "customer.live.live",
-            "method": "getSYLiveDataCount",
-            "content": {
-              "channelid": res.data[0].channelid
-            }
-          }).then(res => {
-            if (res.msg != '成功') return wx.showToast({
-              title: res.data,
-              icon: "none"
-            });
-            this.setData({
-              liveDataCount: res.data
-            })
-          })
-          /* 私域直播场次列表查询 */
-          this.getSYLiveSessionList()
-          break;
-        case 2:
-          console.log(2)
-          break;
-        case 3:
-          console.log(3)
-          break;
-        default:
-          wx.showToast({
-            title: res.data,
-            icon: "none"
-          })
+      /* 直播数据统计 */
+      this.getLiveDataCount()
+      /* 直播场次列表查询 */
+      this.getLiveSessionList()
+    })
+  },
+  /* 直播数据统计 */
+  getLiveDataCount() {
+    //判断私域还是展会
+    const method = (this.data.tabsIndex == 0) ? 'getSYLiveDataCount' : 'getLiveDataCount'
+    _Http.basic({
+      "accesstoken": wx.getStorageSync('userData').token,
+      "classname": "customer.live.live",
+      "method": method,
+      "content": {
+        "channelid": this.data.accountMsg.channelid
       }
+    }).then(res => {
+      if (res.msg != '成功') return wx.showToast({
+        title: res.data,
+        icon: "none"
+      });
+      this.setData({
+        liveDataCount: res.data
+      })
     })
   },
-  /* 私域直播场次列表查询 */
-  getSYLiveSessionList() {
+  /* 直播场次列表查询 */
+  getLiveSessionList() {
+    const method = (this.data.tabsIndex == 0) ? "getSYLiveSessionList" : "getLiveSessionList"
     _Http.basic({
       "accesstoken": wx.getStorageSync('userData').token,
       "classname": "customer.live.live",
-      "method": "getSYLiveSessionList",
+      "method": method,
       "content": {
         "getdatafromdbanyway": true,
         "pageNumber": this.data.pageNumber,
@@ -105,18 +99,7 @@ Page({
       })
     })
   },
-  /* 场次列表选中 */
-  optionItemIndex(e) {
-    const {
-      index
-    } = e.currentTarget.dataset;
-    if (index == this.data.optionRow) return this.setData({
-      optionRow: -1
-    });
-    this.setData({
-      optionRow: index
-    })
-  },
+
   /* 查看场次详情 */
   viewDetails(e) {
     const {
@@ -150,13 +133,15 @@ Page({
       dataTypes: 1
     })
   },
+
   /* 观看用户列表 */
   LiveUserList() {
     /* 用户观看列表 */
+    const method = (this.data.tabsIndex == 0) ? "getSYLiveUserList" : "getLiveUserList";
     _Http.basic({
       "accesstoken": wx.getStorageSync('userData').token,
       "classname": "customer.live.live",
-      "method": "getSYLiveUserList",
+      "method": method,
       "content": {
         "getdatafromdbanyway": true,
         "pageNumber": this.data.userPageNumber,
@@ -188,6 +173,18 @@ Page({
       userPageTotal: 1
     })
   },
+  /* 场次列表选中 */
+  optionItemIndex(e) {
+    const {
+      index
+    } = e.currentTarget.dataset;
+    if (index == this.data.optionRow) return this.setData({
+      optionRow: -1
+    });
+    this.setData({
+      optionRow: index
+    })
+  },
   /* 下一页 */
   buttonRightClick() {
     if (this.data.dataTypes == 0) {
@@ -232,57 +229,18 @@ Page({
       this.LiveUserList()
     }
   },
-  /* 申请直播账号 */
-  applyForLive() {
-    _Http.basic({
-      "accesstoken": wx.getStorageSync('userData').token,
-      "classname": "customer.live.live",
-      "method": "applySYLive",
-      "content": {}
-    }).then(res => {
-      console.log(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({
     detail
   }) {
     this.setData({
-      tabsIndex: detail
-    })
-  },
-
-  /* 复制地址 */
-  copyTheAddress(e) {
-    console.log(e)
-    const {
-      url
-    } = e.target.dataset
-    wx.setClipboardData({
-      data: url,
-      success(res) {
-        wx.getClipboardData({
-          success(res) {
-            console.log('内容已复制') // data
-          }
-        })
-      }
+      tabsIndex: detail,
+      pageNumber: 1,
+      pageTotal: 1,
+      userPageNumber: 1,
+      userPageTotal: 1
     })
+    this.getLiveInfo();
   },
 
   /**

+ 3 - 1
pages/liveStreaming/index.json

@@ -1,3 +1,5 @@
 {
-  "usingComponents": {}
+  "usingComponents": {
+    "My_liveAccountMsg": "/components/My_liveAccountMsg/index"
+  }
 }

+ 4 - 46
pages/liveStreaming/index.wxml

@@ -1,51 +1,9 @@
 <view style="height: 14rpx;"></view>
 <My_NavTabs tabsList="{{tabsList}}" tabsIndex="{{tabsIndex}}" bindsetIndex="setIndex" liveDownload="{{true}}" />
-<view class="msgBox">
-    <!-- 标题和按钮 -->
-    <view class="msgBox-title-and-but">
-        <view class="msgBox-title">直播账号信息</view>
-        <view class="msgBox-but">
-            <van-button custom-class="custom-class-msgBox-but">一键开播</van-button>
-        </view>
-    </view>
-    <!-- 直播信息 -->
-    <view wx:if="{{accountStatus==1}}" class="account-information">
-        <view class="account-information-row">
-            <view>
-                <view class="title" style="margin-right: 8rpx;">密码</view>{{accountMsg.channelpasswd}}
-            </view>
-            <view>
-                <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>
-                <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>
-                <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>
-                <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" 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>
+<!-- 私域直播 -->
+<My_liveAccountMsg wx:if="{{tabsIndex==0}}" accountStatus="{{accountStatus}}" accountMsg="{{accountMsg}}"></My_liveAccountMsg>
+<!-- 展会直播 -->
+<My_liveAccountMsg wx:else accountStatus="{{accountStatus}}" accountMsg="{{accountMsg}}"></My_liveAccountMsg>
 <!-- 数据 -->
 <view wx:if="{{accountStatus==1}}" class="msgBox clearfix" style="white-space:nowrap;">
     <!-- 标题和按钮 -->

+ 1 - 111
pages/liveStreaming/index.wxss

@@ -1,114 +1,4 @@
-/* 信息盒子 */
-.msgBox {
-    width: 702rpx;
-    background: #FFFFFF;
-    border-radius: 20rpx;
-    margin: 0 auto;
-    padding: 10rpx;
-    padding-bottom: 20rpx;
-    box-sizing: border-box;
-    margin-bottom: 30rpx;
-    margin-top: 20rpx;
-}
-
-.msgBox-title-and-but {
-    height: 68rpx;
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    padding: 0 10rpx;
-    border-bottom: 2rpx solid rgba(151, 151, 151, .1);
-    box-sizing: border-box;
-}
-
-/* 标题 */
-.msgBox-title {
-    height: 40rpx;
-    line-height: 40rpx;
-    font-size: 28rpx;
-    font-weight: 550;
-    color: rgba(0, 0, 0, 0.85);
-}
-
-.msgBox-title>text {
-    font-size: 26rpx;
-}
-
-.dataReturn {
-    font-size: 20rpx;
-    color: #4CBECF;
-}
-
-/* 一键开播按钮 */
-.custom-class-msgBox-but {
-    width: 116rpx !important;
-    height: 44rpx !important;
-    background: #4DC2D4 !important;
-    border-radius: 22rpx !important;
-    font-size: 20rpx !important;
-    font-weight: 500;
-    color: #FFFFFF !important;
-    padding-left: 0 !important;
-    padding-right: 0 !important;
-}
-
-/* 账号信息 */
-.account-information {
-    width: 100%;
-    font-size: 20rpx;
-    font-family: HelveticaNeue;
-    color: rgba(0, 0, 0, 0.65);
-    padding: 0 20rpx;
-    box-sizing: border-box;
-}
-
-.account-information-row:first-child {
-    margin-top: 18rpx;
-}
-
-.account-information-row {
-    display: flex;
-    justify-content: space-between;
-    width: 100%;
-    height: 44rpx;
-    font-size: 20rpx;
-    font-family: HelveticaNeue;
-    color: rgba(0, 0, 0, 0.65);
-    line-height: 44rpx;
-    margin-top: 10rpx;
-}
-
-.account-information-row>view {
-    display: flex;
-}
-
-.account-information-row .chained-address {
-    max-width: 400rpx;
-    padding: 0 8rpx;
-}
-
-.chained-address-copy {
-    color: #4DC2D4;
-}
-
-.account-information-row:first-child .chained-address {
-    width: 350rpx;
-}
-
-/* 去申请 */
-.go-to-apply-for {
-    display: flex;
-    justify-content: center;
-    align-items: center;
-    width: 330rpx;
-    height: 74rpx;
-    border-radius: 10rpx;
-    border: 2rpx solid rgba(0, 0, 0, 0.85);
-    box-sizing: border-box;
-    margin: 30rpx auto 10rpx;
-    font-size: 24rpx;
-    color: rgba(0, 0, 0, 0.85);
-}
+@import "/components/My_liveAccountMsg/index.wxss";
 
 /* 直播数据网格 */
 .data-grid {

+ 1 - 1
project.config.json

@@ -46,7 +46,7 @@
         "useCompilerPlugins": false
     },
     "compileType": "miniprogram",
-    "libVersion": "2.21.1",
+    "libVersion": "2.19.6",
     "appid": "wx5dc7fd18b6335214",
     "projectname": "%E5%B8%83%E4%B8%87%E5%AE%B6%E5%B0%8F%E7%A8%8B%E5%BA%8F",
     "debugOptions": {