浏览代码

feat:更新代码

jinx 3 年之前
父节点
当前提交
714be8c009
共有 4 个文件被更改,包括 46 次插入21 次删除
  1. 1 1
      pages/sence/sence.js
  2. 24 10
      pages/shareRoom/shareRoom.js
  3. 15 8
      pages/webview/index.js
  4. 6 2
      socket.js

+ 1 - 1
pages/sence/sence.js

@@ -142,7 +142,7 @@ Page({
       url: `/pages/webview/index?id=${id}&type=${this.data.fetcherData.type}`,
     })
     // wx.navigateTo({
-    //   url: `/pages/webview/index?a=1046450,32,1,4370970,1`,
+    //   url: `/pages/webview/index?a=1046450_32_1_4370970_1`,
     // })
     // wx.navigateTo({
     //   url: `/pages/webview/index?id=1046450&type=32&join=true&roomId=4370970&many=true`,

+ 24 - 10
pages/shareRoom/shareRoom.js

@@ -50,17 +50,18 @@ Page({
     this.sceneName = data.sceneName
 
     let params = {
-      scene: `a=${id},${type},1,${roomId},1`,
-      // page: vrLink
-      page: 'pages/webview/index'
+      scene: `${id}_${type}_1_${roomId}_1`,
+      page: vrLink.substr(1, vrLink.length - 1) //截掉page前的 /
     }
 
     // this.getMIniCode =remote.requestHost+'/statics/tmp/images/1634032649766.png'
     try {
       let codeData = await this.generateMicroAppCode(params)
       if (codeData) {
-        this.getMIniCode = remote.requestHost + codeData
 
+        this.getMIniCode = remote.requestHost + codeData
+        console.log('****')
+        console.log(this.getMIniCode)
       } else {
         this.getMIniCode = null
         wx.showToast({
@@ -176,10 +177,15 @@ Page({
     // } else {
     //   var shareCode = null
     // }
+    var shareCode = null
     if (this.getMIniCode) {
-      var shareCode = await this.downloadFile(this.getMIniCode)
-    } else {
-      var getMIniCode = null
+      try {
+        shareCode = await this.downloadFile(this.getMIniCode)
+
+      } catch (err) {
+        shareCode = null
+
+      }
     }
 
     const img_width = this.canvas_width * 0.8644,
@@ -194,11 +200,19 @@ Page({
     this.context.font = 'normal 300 11px sans-serif'
     // this.sceneName = 
     // let title ='MOOST·理想服饰MOOST·理想服饰MOOST'
-    if (this.sceneName.length > 15) {
+    if (this.sceneName && this.sceneName.length > 15) {
       this.sceneName = this.sceneName.substring(0, 15) + '...'
+    } else if(!this.sceneName){
+      this.sceneName = ''
+    }
+    console.log(this.sceneName)
+    if (this.sceneName != '') {
+      this.titleWidth = this.context.measureText(this.sceneName).width+ 53 + 20
+    } else {
+      this.titleWidth = 20
     }
-    let titleWidth = this.context.measureText(this.sceneName).width
-    this.roundRectColor(this.context, left + 10, 243, titleWidth + 53 + 20, 22, 6, 'rgba(0, 0, 0, 0.6)')
+
+    this.roundRectColor(this.context, left + 10, 243, this.titleWidth , 22, 6, 'rgba(0, 0, 0, 0.6)')
     this.context.fillStyle = '#fff'
     this.context.font = 'normal 300 11px sans-serif'
     this.context.fillText(this.sceneName, left + 10 + 53 + 10, 243 + 15)

+ 15 - 8
pages/webview/index.js

@@ -31,15 +31,17 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: async function (options) {
-    console.log(this.options.a)
-    if (this.options.a) {
+    // console.log(this.options.a)
+    if (options.scene) {
       // [id_type_join_roomId_many]
-      let arr = this.options.a.split(',')
+      const scene = decodeURIComponent(options.scene)
+
+      let arr = scene.split('_')
       this.options.id = arr[0]
       this.options.type = arr[1]
-      this.options.join = true
+      this.options.join = "true"
       this.options.roomId = arr[3]
-      this.options.many = true
+      this.options.many = "true"
     }
     console.log(this.options)
     getApp().checkNetStatu();
@@ -47,7 +49,7 @@ Page({
 
     // setTimeout(() => this.login(), 3000)
     this.setData({
-      type: options.type,
+      type: options.type || this.options.type ,
       join: false,
       imgServer: util.imgServer,
       showGuide: false,
@@ -83,11 +85,16 @@ Page({
     } else {
       this.role = 'leader'
     }
-
-    if (options.many !== void 0) {
+   
+    if (options.many !== void 0 ) {
       this.data.many = options.many
     }
+    if(this.options.many){
+      this.data.many = this.options.many
+    }
+    console.log(this.options.many)
 
+    console.log(this.data.many)
     socketApi.onShow.call(this)
     this.urlPj = '&brandId=' + this.options.id
   },

+ 6 - 2
socket.js

@@ -259,6 +259,7 @@ export default {
     // wx.showToast({
     //   title: this.data.peopleCount.toString(),
     // })
+   
     return {
       role: this.role || 'leader',
       userId: userInfo.userId,
@@ -574,7 +575,7 @@ export default {
       this.wssSuccess = false
       this.socketStop && this.socketStop()
       this.data.many = !!this.data.canShow
-
+     
       this.setData({
         // peopleCount: this.data.many ? manyCount : 5
         peopleCount: this.data.many ? manyCount : 2
@@ -691,7 +692,7 @@ export default {
       newPicUrl
     } = this.data
 
-
+   
     if (res.from === 'button') {
       this.setData({
         sendShare: false
@@ -729,6 +730,8 @@ export default {
 
 
   share() {
+    console.log('**********')
+    // console.log(!!this.data.mamy)
     const companyName = `杭州天门科技有限公司`
     const vrLink = `/pages/webview/index`
     const img_url = this.data.newPicUrl || 'http://video.cgaii.com/new4dage/images/images/home_2_a.jpg'
@@ -1088,6 +1091,7 @@ export default {
         if (this.data.many === void 0) {
           this.data.many = !!res.data.brand.canShow
         }
+        
         this.setData({
           // peopleCount: this.data.many ? manyCount : 5,
           peopleCount: this.data.many ? manyCount : 2,