Browse Source

统计数

gemercheung 3 years ago
parent
commit
1d99548e33
4 changed files with 78 additions and 61 deletions
  1. 46 47
      pages/shared/shared.wxml
  2. 2 0
      pages/webview/index.js
  3. 30 13
      socket.js
  4. 0 1
      webview/shop-container/js/main.js

+ 46 - 47
pages/shared/shared.wxml

@@ -1,47 +1,46 @@
-<view class="container" style="background-image: url({{shared_img}})">
-  <auth bindlogin="onShow" />
-	
-  <!-- <lip-sync /> -->
-  <view class="mask"></view>
-  <view class="shared-layout" >
-    <view class="shared-content">
-      <image class="canvas-img" src="{{img_url}}"></image>
-      <canvas class="canvas"  canvas-id="content"></canvas>
-      <view class="dingzhi" bindtap="showEdit" wx:if="{{loadHot}}">定制推荐语</view>
-    </view>
-  </view>
-  <view class="tools-w">
-  <view>{{ shareImg  }}</view>
-    <view class="tools-title">分享到</view>
-    <view class="share-tools">
-      <button class="share-item" open-type="share">
-        <view class="wechat"><image src="../../static/images/share_wechat.png"></image></view>
-        <view>微信好友</view>
-      </button>
-      <view class="share-item share-link" bindtap="copyLink">
-        <view class="wechat link"><image src="../../static/images/share_link.png"></image></view>
-        <view>复制链接</view>
-        
-      </view>
-      <view class="share-item share-photo" bindtap="savePhoto">
-        <view class="wechat photo"><image src="../../static/images/share_poster.png"></image></view>
-        <view>保存至相册</view>
-      </view>
-    </view>
-  </view>
-
-  <view class="edit-box" wx:if="{{ editShowStatus }}">
-    <view class="mask"></view>
-    <view class="edit-w">
-      <view class="edit-header">我的个性推荐语</view>
-      <view class="edit-content">
-        <textarea bindinput="bindinput" value="{{recommend_text}}" placeholder="请输入您的推荐语" maxlength="25" show-confirm-bar="{{ false }}" />
-        <view class="text-tip">{{ recommend_text.length > 25 ? 25 : recommend_text.length }}/25</view>
-      </view>
-      <view class="edit-footer">
-        <view bindtap="hideEdit">取消</view>
-        <view class="submit" bindtap="submitRecommend" >确认</view>
-      </view>
-    </view>
-  </view>
-</view>
+<view class="container" style="background-image: url({{shared_img}})">
+  <auth bindlogin="onShow" />
+	
+  <!-- <lip-sync /> -->
+  <view class="mask"></view>
+  <view class="shared-layout" >
+    <view class="shared-content">
+      <image class="canvas-img" src="{{img_url}}"></image>
+      <canvas class="canvas"  canvas-id="content"></canvas>
+      <view class="dingzhi" bindtap="showEdit" wx:if="{{loadHot}}">定制推荐语</view>
+    </view>
+  </view>
+  <view class="tools-w">
+  <view>{{ shareImg  }}</view>
+    <view class="tools-title">分享到</view>
+    <view class="share-tools">
+      <button class="share-item" open-type="share">
+        <view class="wechat"><image src="../../static/images/share_wechat.png"></image></view>
+        <view>微信好友</view>
+      </button>
+      <view class="share-item share-link" bindtap="copyLink">
+        <view class="wechat link"><image src="../../static/images/share_link.png"></image></view>
+        <view>复制链接</view>
+      </view>
+      <view class="share-item share-photo" bindtap="savePhoto">
+        <view class="wechat photo"><image src="../../static/images/share_poster.png"></image></view>
+        <view>保存至相册</view>
+      </view>
+    </view>
+  </view>
+
+  <view class="edit-box" wx:if="{{ editShowStatus }}">
+    <view class="mask"></view>
+    <view class="edit-w">
+      <view class="edit-header">我的个性推荐语</view>
+      <view class="edit-content">
+        <textarea bindinput="bindinput" value="{{recommend_text}}" placeholder="请输入您的推荐语" maxlength="25" show-confirm-bar="{{ false }}" />
+        <view class="text-tip">{{ recommend_text.length > 25 ? 25 : recommend_text.length }}/25</view>
+      </view>
+      <view class="edit-footer">
+        <view bindtap="hideEdit">取消</view>
+        <view class="submit" bindtap="submitRecommend" >确认</view>
+      </view>
+    </view>
+  </view>
+</view>

+ 2 - 0
pages/webview/index.js

@@ -149,6 +149,8 @@ Page({
       debugerInfo: JSON.stringify({
         userId: socketOptions.userId,
         roomId: socketOptions.roomId,
+        num: socketOptions.sceneNumber,
+        isAssistant: socketOptions.isAssistant,
         role: socketOptions.role,
         assistantId: socketOptions.assistantId
       })

+ 30 - 13
socket.js

@@ -344,17 +344,31 @@ export default {
       this.role = 'customer'
       isAllowMic = 0
     }
-
+    // 助手改用isAssistant作为flag, role因为V3不能新增角色,只支持leader/customer。
+    let isAssistant
     if (assistant && assistant.userId && assistant.userId == userInfo.userId) {
-      this.role = 'assistant'
+      isAssistant = true;
+    } else {
+      isAssistant = false
     }
-    console.log('进入房间角色,', this.role);
+    console.log('进入房间角色, 是否助手 %s', this.role, isAssistant);
 
     const isAuthMic = await this.getAuthorizeRecordStatus();
 
     console.log('当前用户录音权限状态', isAuthMic)
 
     const assistantId = (assistant && assistant.userId) ? assistant.userId : '';
+
+    if (capacities) {
+      this.setData({
+        peopleCount: capacities
+      })
+    } else {
+      this.setData({
+        peopleCount: manyCount
+      })
+    }
+    
     return {
       role: this.role,
       userId: userInfo.userId,
@@ -368,6 +382,7 @@ export default {
       sceneNumber: sceneId,
       onlineStatus: 1,
       assistantId: assistantId,
+      isAssistant: isAssistant ? 1 : 0,
       oid: userInfo.weixin_openid,
       userLimitNum: capacities || 50
     }
@@ -766,10 +781,10 @@ export default {
       this.socketStop && this.socketStop()
       this.data.many = !!this.data.canShow
 
-      this.setData({
-        // peopleCount: this.data.many ? manyCount : 5
-        peopleCount: manyCount
-      })
+      // this.setData({
+      //   // peopleCount: this.data.many ? manyCount : 5
+      //   peopleCount: manyCount
+      // })
 
       let base = this.base
       let socketOptions = await this.socketStart({
@@ -969,22 +984,24 @@ export default {
 
 
   share() {
-    console.log('**********')
-    // console.log(!!this.data.mamy)
+
+    console.log('share-debug')
     const companyName = `指房宝(杭州)科技有限公司`
     const vrLink = `/pages/webview/index`
     const img_url = this.data.newPicUrl || 'http://video.cgaii.com/new4dage/images/images/home_2_a.jpg'
     const shareImg = img_url
     this.count = this.count || 0
+    console.log('share-debug many:%s shareStatus: %s', !!this.data.many, this.data.shareStatus);
+    // debugger;
     if (this.data.many && this.data.shareStatus == 1) {
       //开启一起逛时候的分享
-      console.log(`/pages/shareRoom/shareRoom?img_url=${btoa(img_url)}&vrLink=${btoa(vrLink)}&id=${this.data.id}&type=${this.data.type}&roomId=${this.data.socketOptions.roomId}&many=${!!this.data.many}`)
-      console.log(this.data.socketOptions)
+      console.log(`share-debug: /pages/shareRoom/shareRoom?img_url=${btoa(img_url)}&vrLink=${btoa(vrLink)}&id=${this.data.id}&type=${this.data.type}&roomId=${this.data.socketOptions.roomId}&many=${!!this.data.many}`)
+      console.log('share-debug', this.data.socketOptions)
       wx.navigateTo({
         url: `/pages/shareRoom/shareRoom?img_url=${btoa(img_url)}&vrLink=${btoa(vrLink)}&id=${this.data.id}&type=${this.data.type}&roomId=${this.data.socketOptions.roomId}&many=${!!this.data.many}`,
       })
     } else {
-      console.log(`/pages/shared/shared?img_url=${btoa(img_url)}&shareImg=${btoa(shareImg)}&companyName=${companyName}&vrLink=${btoa(vrLink)}&id=${this.data.id}&type=${this.data.type}`);
+      console.log(`share-debug: /pages/shared/shared?img_url=${btoa(img_url)}&shareImg=${btoa(shareImg)}&companyName=${companyName}&vrLink=${btoa(vrLink)}&id=${this.data.id}&type=${this.data.type}`);
       wx.navigateTo({
         url: `/pages/shared/shared?img_url=${btoa(img_url)}&shareImg=${btoa(shareImg)}&companyName=${companyName}&vrLink=${btoa(vrLink)}&id=${this.data.id}&type=${this.data.type}`,
       })
@@ -1303,7 +1320,7 @@ export default {
           contractPhone: res.data.brand.contractPhone
 
         })
-
+        // debugger
         if (this.data.many === void 0) {
           this.data.many = !!res.data.brand.canShow
         }

+ 0 - 1
webview/shop-container/js/main.js

@@ -165,7 +165,6 @@ function updateSocket(options) {
 
     if (data.type === 'newRoom' && data.data && data.data.roomId) {
       console.log('新建房间', data.data)
-      debugger
       updateSocket(data.data)
     }
   })