Browse Source

修复一起逛bug,新增分享

jinx 3 years ago
parent
commit
41afd0e333

+ 18 - 14
app.json

@@ -49,6 +49,7 @@
     "pages/auth/btnAuth/btnAuth",
     "pages/auth/btnAuth/btnAuth",
     "pages/logistics/index",
     "pages/logistics/index",
     "pages/shared/shared",
     "pages/shared/shared",
+    "pages/shareRoom/shareRoom",
     "pages/godis/godis",
     "pages/godis/godis",
     "component/auth/auth",
     "component/auth/auth",
     "pages/user/imageCropper",
     "pages/user/imageCropper",
@@ -62,25 +63,28 @@
     "navigationBarTextStyle": "black",
     "navigationBarTextStyle": "black",
     "enablePullDownRefresh": true
     "enablePullDownRefresh": true
   },
   },
-  "subpackages": [{
-    "root": "dataReport",
-    "pages": [
-      "pages/data-report/data-report"
-    ],
-    "plugins": {
-      "ykfchat": {
-        "version": "2.0.7",
-        "provider": "wx1fdc8c9f3a3a05e4"
-      }
-    },
-    "independent": false
-  }],
+  "subpackages": [
+    {
+      "root": "dataReport",
+      "pages": [
+        "pages/data-report/data-report"
+      ],
+      "plugins": {
+        "ykfchat": {
+          "version": "2.0.7",
+          "provider": "wx1fdc8c9f3a3a05e4"
+        }
+      },
+      "independent": false
+    }
+  ],
   "tabBar": {
   "tabBar": {
     "backgroundColor": "#fff",
     "backgroundColor": "#fff",
     "borderStyle": "white",
     "borderStyle": "white",
     "selectedColor": "#333333",
     "selectedColor": "#333333",
     "color": "#AFAFAF",
     "color": "#AFAFAF",
-    "list": [{
+    "list": [
+      {
         "pagePath": "pages/index/index",
         "pagePath": "pages/index/index",
         "iconPath": "static/images/icon/home_normal@2x.png",
         "iconPath": "static/images/icon/home_normal@2x.png",
         "selectedIconPath": "static/images/icon/home_selected@2x.png",
         "selectedIconPath": "static/images/icon/home_selected@2x.png",

+ 1 - 1
component/roomItem/roomItem.wxml

@@ -1,6 +1,6 @@
 <view class="tj_listItem" data-id="{{room.id}}" data-index="{{index}}" bindtap="gotoWV">
 <view class="tj_listItem" data-id="{{room.id}}" data-index="{{index}}" bindtap="gotoWV">
 	<view class="tj_listItemCover">
 	<view class="tj_listItemCover">
-		<image wx:if="{{room.appListPicUrl!=''}}" mode="aspectFill" class="coverImage" src="{{room.appListPicUrl}}"></image>
+		<image wx:if="{{ room.appListPicUrl && room.appListPicUrl!=''}}" mode="aspectFill" class="coverImage" src="{{room.appListPicUrl}}"></image>
 		<image wx:else mode="aspectFill" class="coverImage" src="../../static/images/icon/pic_bg@2x.png"></image>
 		<image wx:else mode="aspectFill" class="coverImage" src="../../static/images/icon/pic_bg@2x.png"></image>
 	</view>
 	</view>
 	<view class="tj_listItemMsg">
 	<view class="tj_listItemMsg">

+ 1 - 1
component/storeItem/storeItem.wxml

@@ -1,7 +1,7 @@
 <!--component/storeItem/storeItem.wxml-->
 <!--component/storeItem/storeItem.wxml-->
 <view class="storeBox" data-id="{{storeItem.id}}" data-index="{{index}}" bindtap="gotoWV">
 <view class="storeBox" data-id="{{storeItem.id}}" data-index="{{index}}" bindtap="gotoWV">
   <view class="storeCover">
   <view class="storeCover">
-    <image wx:if="{{storeItem.appListPicUrl!=''}}" mode="aspectFill" src="{{storeItem.appListPicUrl}}"></image>
+    <image wx:if="{{storeItem.appListPicUrl && storeItem.appListPicUrl!=''}}" mode="aspectFill" src="{{storeItem.appListPicUrl}}"></image>
     <image wx:else mode="widthFix" class="coverImage" src="../../static/images/icon/pic_bg@2x.png"></image>
     <image wx:else mode="widthFix" class="coverImage" src="../../static/images/icon/pic_bg@2x.png"></image>
 
 
   </view>
   </view>

+ 4 - 1
config/api.js

@@ -121,5 +121,8 @@ module.exports = {
  
  
 
 
     //统计商家访问次数
     //统计商家访问次数
-    increaseViewCount: API_BASE_URL + 'brand/increaseViewCount'
+    increaseViewCount: API_BASE_URL + 'brand/increaseViewCount',
+    
+    //获取小程序码
+    generateMicroAppCode: API_BASE_URL + 'wechat/generateMicroAppCode'
 };
 };

+ 7 - 4
pages/index/index.js

@@ -103,10 +103,11 @@ Router({
     } = event.currentTarget.dataset
     } = event.currentTarget.dataset
     console.log(id)
     console.log(id)
     wx.navigateTo({
     wx.navigateTo({
-      url: `/pages/webview/index?id=${id}`,
+      url: `/pages/webview/index?id=${id}&type=${this.data.middleType}`,
     })
     })
     util.request(api.increaseViewCount, {
     util.request(api.increaseViewCount, {
-      brandId: id
+      brandId: id,
+      type:this.data.middleType
     }, 'GET').then((res) => {
     }, 'GET').then((res) => {
       
       
     });
     });
@@ -114,10 +115,11 @@ Router({
   gotoWV: function (event) {
   gotoWV: function (event) {
     let {id} = event.detail
     let {id} = event.detail
     wx.navigateTo({
     wx.navigateTo({
-      url: `/pages/webview/index?id=${id}`,
+      url: `/pages/webview/index?id=${id}&type=${this.data.roomType}`,
     })
     })
     util.request(api.increaseViewCount, {
     util.request(api.increaseViewCount, {
-      brandId: id
+      brandId: id,
+      type:this.data.roomType
     }, 'GET').then((res) => {
     }, 'GET').then((res) => {
         // var num =  'roomList['+index+'].pvTotalNum'
         // var num =  'roomList['+index+'].pvTotalNum'
         // this.setData({
         // this.setData({
@@ -240,6 +242,7 @@ Router({
           this.setData({
           this.setData({
             middleTypeList: t,
             middleTypeList: t,
           }, () => {
           }, () => {
+            this.data.middleTypeList.sort()
             this.setData({
             this.setData({
               middleType: this.data.middleTypeList[0]
               middleType: this.data.middleTypeList[0]
             })
             })

+ 1 - 1
pages/index/index.wxml

@@ -12,7 +12,7 @@
 
 
 					</view>
 					</view>
 
 
-					<input disabled="true" placeholder='请输入直播间名称' data-type="-1" bindtap="toSearch" placeholder-class='none'
+					<input disabled="true" placeholder='请输入场景名称' data-type="-1" bindtap="toSearch" placeholder-class='none'
 						placeholder-style='color:#b3b3b3;font-size:22rpx;'></input>
 						placeholder-style='color:#b3b3b3;font-size:22rpx;'></input>
 				</view>
 				</view>
 			</view>
 			</view>

+ 1 - 1
pages/searchRoom/searchRoom.js

@@ -35,7 +35,7 @@ Page({
       id
       id
     } = event.detail
     } = event.detail
     wx.navigateTo({
     wx.navigateTo({
-      url: `/pages/webview/index?id=${id}`,
+      url: `/pages/webview/index?id=${id}&type=${this.data.fetcherData.type}`,
     })
     })
   },
   },
   inputChange(e) {
   inputChange(e) {

+ 1 - 1
pages/searchRoom/searchRoom.wxml

@@ -2,7 +2,7 @@
   <view class="storeContent">
   <view class="storeContent">
     <view class="storeSearch">
     <view class="storeSearch">
       <image src="../../static/images/icon/search@2x.png"></image>
       <image src="../../static/images/icon/search@2x.png"></image>
-      <input focus="true" bindconfirm="search" bindinput="inputChange" value="{{fetcherData.name}}" type="text" placeholder="请输入直播间名称"
+      <input focus="true" bindconfirm="search" bindinput="inputChange" value="{{fetcherData.name}}" type="text" placeholder="请输入场景名称"
         placeholder-class="placeholderStyle" />
         placeholder-class="placeholderStyle" />
     </view>
     </view>
     <view class="searchBtn" bindtap="search">搜索</view>
     <view class="searchBtn" bindtap="search">搜索</view>

+ 13 - 5
pages/sence/sence.js

@@ -139,10 +139,17 @@ Page({
       id
       id
     } = event.detail
     } = event.detail
     wx.navigateTo({
     wx.navigateTo({
-      url: `/pages/webview/index?id=${id}`,
+      url: `/pages/webview/index?id=${id}&type=${this.data.fetcherData.type}`,
     })
     })
+    // wx.navigateTo({
+    //   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`,
+    // })
     util.request(api.increaseViewCount, {
     util.request(api.increaseViewCount, {
-      brandId: id
+      brandId: id,
+      type:this.data.fetcherData.type
     }, 'GET').then((res) => {
     }, 'GET').then((res) => {
 
 
     });
     });
@@ -155,10 +162,11 @@ Page({
       index
       index
     } = event.detail
     } = event.detail
     wx.navigateTo({
     wx.navigateTo({
-      url: `/pages/webview/index?id=${id}`,
+      url: `/pages/webview/index?id=${id}&type=${this.data.fetcherData.type}`,
     })
     })
     util.request(api.increaseViewCount, {
     util.request(api.increaseViewCount, {
-      brandId: id
+      brandId: id,
+      type:this.data.fetcherData.type
     }, 'GET').then((res) => {
     }, 'GET').then((res) => {
       var num = 'roomList[' + index + '].pvTotalNum'
       var num = 'roomList[' + index + '].pvTotalNum'
       this.setData({
       this.setData({
@@ -182,7 +190,7 @@ Page({
 
 
     } else {
     } else {
       wx.setNavigationBarTitle({
       wx.setNavigationBarTitle({
-        title: '直播间'
+        title: '带看'
       })
       })
     }
     }
     this.getRoomList()
     this.getRoomList()

+ 1 - 1
pages/sence/sence.wxml

@@ -6,7 +6,7 @@
       <image src="../../static/images/icon/search@2x.png"></image>
       <image src="../../static/images/icon/search@2x.png"></image>
       <input wx:if="{{fetcherData.type==31}}" bindconfirm="search" bindinput="inputChange" type="text" placeholder="请输入VR场景名称"
       <input wx:if="{{fetcherData.type==31}}" bindconfirm="search" bindinput="inputChange" type="text" placeholder="请输入VR场景名称"
         placeholder-class="placeholderStyle" />
         placeholder-class="placeholderStyle" />
-      <input wx:else bindconfirm="search" bindinput="inputChange" type="text" placeholder="请输入直播间名称" placeholder-class="placeholderStyle" />
+      <input wx:else bindconfirm="search" bindinput="inputChange" type="text" placeholder="请输入场景名称" placeholder-class="placeholderStyle" />
     </view>
     </view>
     <view class="searchBtn" bindtap="search">搜索</view>
     <view class="searchBtn" bindtap="search">搜索</view>
   </view>
   </view>

+ 353 - 0
pages/shareRoom/shareRoom.js

@@ -0,0 +1,353 @@
+// pages/shared/shared.js
+const api = require('../../config/api.js');
+const util = require('../../utils/util.js');
+const atob = require('../../utils/atob')
+import remote from '../../config.js'
+
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    shared_img: '',
+    recommend_text: '',
+    editShowStatus: false,
+    loadHot: false
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: async function (options) {
+
+    let {
+      // companyName,
+      roomId,
+      many,
+      vrLink,
+      id,
+      type
+    } = options
+    //测试用
+    // companyName = '1111'
+    // id = 1046450
+    // vrLink = 'L3BhZ2VzL3dlYnZpZXcvaW5kZXg'
+    //测试用
+    vrLink = atob(vrLink)
+    // this.vrLink = vrLink + `?id=${id}&type=${type}`
+    // 1046450,32,1,4370970,1
+    // [id_type_join_roomId_many]
+    this.vrLink = vrLink + `?id=${id}&type=${type}&join=true&roomId=${roomId}&many=${many}`;
+    console.log(this.vrLink)
+    // this.companyName = companyName
+
+
+
+    let data = await this.getBrandDetail(id, type)
+    this.sceneUrl = data.sceneUrl
+    this.shareCodeImg = data.shareWxQrCode
+    this.sceneName = data.sceneName
+
+    let params = {
+      scene: `a=${id},${type},1,${roomId},1`,
+      // page: vrLink
+      page: 'pages/webview/index'
+    }
+
+    // this.getMIniCode =remote.requestHost+'/statics/tmp/images/1634032649766.png'
+    try {
+      let codeData = await this.generateMicroAppCode(params)
+      if (codeData) {
+        this.getMIniCode = remote.requestHost + codeData
+
+      } else {
+        this.getMIniCode = null
+        wx.showToast({
+          title: '小程序码生成失败',
+        })
+      }
+    } catch (err) {
+      this.getMIniCode = null
+      // this.getMIniCode =remote.requestHost+'/statics/tmp/images/1634032649766.png'
+    }
+
+    this.setData({
+      shared_img: data.appListPicUrl,
+      layoutHeight: wx.getSystemInfoSync().windowHeight - 170
+    })
+
+    const query = wx.createSelectorQuery()
+    query.select('.canvas').boundingClientRect().exec(res => {
+      this.canvas_width = res[0].width
+      this.canvas_height = res[0].height
+      this.drawImage()
+    })
+  },
+
+  getCompanyDetail() {
+    // CompanyApi.getCompanyDetail(this.companyId).then(res => {
+    //   console.log(res, 'company')
+    //   this.setData({
+    //     company: res.data
+    //   })
+    // })
+  },
+  showEdit() {
+    this.setData({
+      editShowStatus: true
+    })
+  },
+  hideEdit() {
+    this.setData({
+      editShowStatus: false
+    })
+  },
+  bindinput(e) {
+    const {
+      value
+    } = e.detail
+    value.substr(0, 25)
+    this.setData({
+      recommend_text: value
+    })
+  },
+  onShareAppMessage() {
+    console.log(this.vrLink)
+    return {
+      path: this.vrLink,
+      imageUrl: this.data.shared_img
+    }
+  },
+  copyLink() {
+    wx.setClipboardData({
+      data: decodeURIComponent(this.sceneUrl),
+      success(res) {
+        wx.showToast({
+          title: '复制成功',
+        })
+      }
+    })
+  },
+
+  getBrandDetail: async function (id, type, cb) {
+    let res = await util.request(api.BrandDetail, {
+      id: id,
+      type: type
+    })
+    return res.data.brand
+  },
+  generateMicroAppCode: async function (data) {
+    let res = await util.request(api.generateMicroAppCode, data, 'POST', 'application/json')
+    if (res.errno == 0) {
+      return res.data
+    } else if (res.errno == 1) {
+      return false
+    }
+
+  },
+  savePhoto() {
+    wx.saveImageToPhotosAlbum({
+      filePath: this.data.img_url,
+      success(res) {
+        wx.showModal({
+          title: '图片保存成功',
+          content: '图片成功保存到相册了,去发圈噻~',
+          showCancel: false,
+          confirmText: '好哒',
+          confirmColor: '#72B9C3',
+          success: (res) => {
+            if (res.confirm) {}
+          }
+        })
+      }
+    })
+  },
+  async drawImage(recommend_text) {
+    this.context = wx.createCanvasContext('content')
+    this.context.lineJoin = 'miter'
+    this.context.font = 'bold 15px sans-serif'
+    this.context.setFillStyle('#fff')
+    this.context.fillRect(0, 0, this.canvas_width, this.canvas_height)
+    const dpr = wx.getSystemInfoSync().pixelRatio
+    let cover = await this.downloadFile(this.data.shared_img)
+    // if (this.shareCodeImg) {
+    //   var shareCode = await this.downloadFile(this.shareCodeImg)
+    // } else {
+    //   var shareCode = null
+    // }
+    if (this.getMIniCode) {
+      var shareCode = await this.downloadFile(this.getMIniCode)
+    } else {
+      var getMIniCode = null
+    }
+
+    const img_width = this.canvas_width * 0.8644,
+      img_height = this.canvas_width * 0.8644
+    const left = (this.canvas_width - img_width) / 2
+    // 画圆弧矩形
+    this.strokeRoundRect((this.canvas_width - img_width) / 2, (this.canvas_width - img_width) / 2, img_width, img_height, 4)
+    this.context.clip()
+    this.context.drawImage(cover, 0, 0, img_width, img_height)
+    this.context.restore()
+    this.context.fillStyle = '#fff'
+    this.context.font = 'normal 300 11px sans-serif'
+    // this.sceneName = 
+    // let title ='MOOST·理想服饰MOOST·理想服饰MOOST'
+    if (this.sceneName.length > 15) {
+      this.sceneName = this.sceneName.substring(0, 15) + '...'
+    }
+    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.context.fillStyle = '#fff'
+    this.context.font = 'normal 300 11px sans-serif'
+    this.context.fillText(this.sceneName, left + 10 + 53 + 10, 243 + 15)
+
+    this.roundRectColor(this.context, left + 10, 243, 53, 22, 6, '#ED5D18')
+    this.context.fillStyle = "#fff";
+    this.context.beginPath();
+    this.context.arc(left + 10 + 6, 243 + 11, 3, Math.PI * 2, 0, true);
+    this.context.closePath();
+    this.context.fill();
+    this.context.fillStyle = '#fff'
+    this.context.font = 'normal 300 11px sans-serif'
+    this.context.fillText('直播中', left + 10 + 12, 243 + 15)
+
+
+
+
+    // this.context.fillStyle = '#131D34'
+    // this.context.font = 'normal bold 15px sans-serif'
+    // this.context.fillText(this.companyName, left, img_width + left + this.canvas_height * 15 / 460 + 21)
+    // this.context.restore()
+    // this.context.font = 'normal 300 13px sans-serif'
+    // this.context.fillStyle = '#79868F'
+    // let recommend_text1, recommend_text2
+    // if (recommend_text) {
+    //   recommend_text1 = recommend_text.slice(0, 11)
+    //   recommend_text2 = recommend_text.slice(11)
+    // }
+    // this.context.fillText(recommend_text1 || '我的个性推荐语', left, img_width + left + this.canvas_height * 15 / 460 + 18 + 21)
+    // if (recommend_text2) {
+    //   this.context.font = 'normal 300 13px sans-serif'
+    //   this.context.fillStyle = '#79868F'
+    //   this.context.fillText(recommend_text2 || '我的个性推荐语', left, img_width + left + this.canvas_height * 15 / 460 + 18 + 21 + 21)
+    // }
+    this.context.font = 'normal 300 12px sans-serif'
+    this.context.fillStyle = '#000'
+    shareCode && this.context.drawImage(shareCode, left, img_height + 40, 60, 60)
+    this.context.fillText('3D实景拍摄', left + 80, img_height + 50)
+    this.context.fillText('手机逛遍卖场', left + 80, img_height + 70)
+    this.context.font = 'normal 300 12px sans-serif'
+    this.context.fillStyle = '#000'
+    this.context.fillText('长按识别二维码', left + 80, img_height + 95)
+    this.context.fillStyle = '#ED5D18'
+    this.context.fillText('进入直播间', left + 170, img_height + 95)
+
+    this.context.draw(false, () => {
+      wx.canvasToTempFilePath({
+        x: 0,
+        y: 0,
+        width: this.canvas_width,
+        height: this.canvas_height,
+        canvasId: 'content',
+        success: (res) => {
+          this.setData({
+            img_url: res.tempFilePath
+          })
+
+          setTimeout(() => {
+            this.setData({
+              loadHot: true
+            })
+          }, 100)
+        }
+      })
+    })
+    this.context.fill()
+    this.context.restore()
+
+  },
+  submitRecommend() {
+    this.drawImage(this.data.recommend_text)
+    this.hideEdit()
+  },
+  strokeRoundRect(x, y, width, height, radius, /*optional*/ lineWidth, /*optional*/ strokeColor) {
+    //圆的直径必然要小于矩形的宽高          
+    if (2 * radius > width || 2 * radius > height) {
+      return false;
+    }
+
+    this.context.save();
+    this.context.translate(x, y);
+    //绘制圆角矩形的各个边  
+    this.drawRoundRectPath(width, height, radius);
+    this.context.lineWidth = 0; //若是给定了值就用给定的值否则给予默认值2  
+    this.context.strokeStyle = strokeColor || "#fff";
+    this.context.stroke();
+
+  },
+  drawRoundRectPath(width, height, radius) {
+    this.context.beginPath(0);
+    //从右下角顺时针绘制,弧度从0到1/2PI  
+    this.context.arc(width - radius, height - radius, radius, 0, Math.PI / 2);
+
+    //矩形下边线  
+    this.context.lineTo(radius, height);
+
+    //左下角圆弧,弧度从1/2PI到PI  
+    this.context.arc(radius, height - radius, radius, Math.PI / 2, Math.PI);
+
+    //矩形左边线  
+    this.context.lineTo(0, radius);
+
+    //左上角圆弧,弧度从PI到3/2PI  
+    this.context.arc(radius, radius, radius, Math.PI, Math.PI * 3 / 2);
+
+    //上边线  
+    this.context.lineTo(width - radius, 0);
+
+    //右上角圆弧  
+    this.context.arc(width - radius, radius, radius, Math.PI * 3 / 2, Math.PI * 2);
+
+    //右边线  
+    this.context.lineTo(width, height - radius);
+    this.context.closePath();
+  },
+  downloadFile(url) {
+    return new Promise(resolve => {
+      wx.downloadFile({
+        url: url,
+        success(res) {
+          resolve(res.tempFilePath)
+        }
+      })
+    })
+  },
+
+  /**
+   * 绘制圆角矩形
+   * @param {*} x 起始点x坐标
+   * @param {*} y 起始点y坐标
+   * @param {*} w 矩形宽
+   * @param {*} h 矩形高
+   * @param {*} r 圆角半径
+   * @param {*} context 画板上下文
+   */
+
+  roundRectColor(context, x, y, w, h, r, color) { //绘制圆角矩形(纯色填充)
+    context.save();
+    // context.setFillStyle("#ED5D18"); 
+    // context.setStrokeStyle('#ED5D18')
+    context.setFillStyle(color);
+    context.setStrokeStyle(color)
+    context.setLineJoin('round'); //交点设置成圆角
+    context.setLineWidth(r);
+    context.strokeRect(x + r / 2, y + r / 2, w - r, h - r);
+    context.fillRect(x + r, y + r, w - r * 2, h - r * 2);
+    // context.stroke();
+    // context.closePath();
+  }
+
+
+})

+ 3 - 0
pages/shareRoom/shareRoom.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "指房宝"
+}

+ 47 - 0
pages/shareRoom/shareRoom.wxml

@@ -0,0 +1,47 @@
+<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>

+ 189 - 0
pages/shareRoom/shareRoom.wxss

@@ -0,0 +1,189 @@
+.container {
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  background-position: center center;
+  background-size: cover;
+  position: absolute;
+  padding: 90rpx 0 0;
+  margin-top: 0;
+  overflow-y: scroll;
+}
+
+.container::after {
+  content: '';
+  display: block;
+  height:380rpx
+}
+.mask {
+  position: fixed;
+  top: 0;
+  left: 0;
+  background: #000;
+  opacity: 0.6;
+  width: 100%;
+  height: 100%;
+}
+.shared-content {
+  position: relative;
+  z-index: 1;
+  /* width: 590rpx;
+  height: 920rpx; */
+  width: 590rpx;
+  height: 760rpx;
+  margin: 0 auto;
+  border-radius:4px;
+  overflow: hidden;
+}
+.canvas-img, .canvas {
+  width: 100%;
+  height: 100%;
+}
+.canvas {
+  position: absolute;
+  right: -9999px;
+  top: -9999px;
+}
+.dingzhi {
+  position: absolute;
+  right: 40rpx;
+  top: 588rpx;
+  font-size: 22rpx;
+  background: #0075DC;
+  border-radius: 4rpx;
+  line-height: 54rpx;
+  width: 144rpx;
+  text-align: center;
+  color: #fff;
+}
+.tools-w {
+  position: fixed;
+  z-index: 1000;
+  background: #fff;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  height: 340rpx;
+  text-align: center;
+}
+.tools-title {
+  font-size: 30rpx;
+  font-weight: bold;
+  line-height: 42rpx;
+  padding-top: 24rpx;
+}
+.share-tools {
+  margin-top: 62rpx;
+  display: flex;
+  font-size: 26rpx;
+  color: #131D34;
+}
+.share-tools .share-item {
+  flex: 1;
+  font-size: 26rpx;
+  line-height: 36rpx;
+}
+.wechat {
+  width: 94rpx;
+  height: 94rpx;
+  background: #4ED77B;
+  border-radius: 50%;
+  margin: 0 auto 16rpx;
+  color: #fff;
+  line-height: 94rpx;
+  align-items: center;
+  justify-content: center;
+  display: flex;
+}
+
+.wechat image {
+  width: 56rpx;
+  height: 48rpx;
+}
+.link image {
+  width: 48rpx;
+  height: 48rpx;
+}
+.photo image {
+  width: 48rpx;
+  height: 48rpx;
+}
+.edit-box .mask {
+  z-index: 111110;
+}
+.edit-w {
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  transform: translate(-50%, -50%);
+  z-index: 111111;
+  background: #fff;
+  width: 530rpx;
+}
+
+.edit-header {
+  height: 110rpx;
+  line-height: 108rpx;
+  padding-left: 40rpx;
+  font-size: 30rpx;
+  color: #131D34;
+  font-weight: bold;
+  border-bottom: 2rpx solid #E5E5E5;
+}
+
+.edit-content {
+  padding: 40rpx;
+  position: relative;
+  font-size: 30rpx;
+}
+
+.edit-content textarea {
+  background: #F2F2F2;
+  border-radius: 8rpx;
+  padding: 16rpx 22rpx;
+  height: 156rpx;
+  width: 100%;
+  box-sizing: border-box;
+  
+}
+.text-tip {
+  position: absolute;
+  right: 60rpx;
+  bottom: 50rpx;
+  color: #909090;
+}
+
+.edit-footer {
+  line-height: 90rpx;
+  display: flex;
+  border-top: 2rpx solid #e5e5e5;
+}
+
+.edit-footer view {
+  flex: 1;
+  text-align: center;
+  font-size: 30rpx;
+  color: #131D34;
+  font-weight: bold;
+}
+
+.edit-footer .submit {
+  color: #0075DC;
+  border-left: 2rpx solid #e5e5e5;
+}
+
+.link {
+  background: #909090;
+}
+.photo {
+  background: #FFCD3C;
+}
+button {
+  border: none;
+  background: transparent;
+  padding: 0;
+}
+button::after {
+  border: none;
+}

+ 7 - 6
pages/shared/shared.js

@@ -20,15 +20,16 @@ Page({
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */
   onLoad: async function (options) {
   onLoad: async function (options) {
-    let { companyName, vrLink, id } = options
-    
+    let { companyName, vrLink, id ,type} = options
+    console.log(vrLink)
     vrLink = atob(vrLink)
     vrLink = atob(vrLink)
-    this.vrLink = vrLink + `?id=${id}`
+    console.log(vrLink)
+    this.vrLink = vrLink + `?id=${id}&type=${type}`
     this.companyName = companyName
     this.companyName = companyName
     
     
     
     
 
 
-    let data = await this.getBrandDetail(id)
+    let data = await this.getBrandDetail(id,type)
     this.sceneUrl = data.sceneUrl
     this.sceneUrl = data.sceneUrl
     this.shareCodeImg = data.shareWxQrCode
     this.shareCodeImg = data.shareWxQrCode
 
 
@@ -87,8 +88,8 @@ Page({
     })
     })
   },
   },
   
   
-  getBrandDetail: async function (id, cb) {
-    let res = await util.request(api.BrandDetail, { id: id })
+  getBrandDetail: async function (id, type,cb) {
+    let res = await util.request(api.BrandDetail, { id: id,type:type })
     return res.data.brand
     return res.data.brand
   },
   },
   savePhoto () {
   savePhoto () {

+ 8 - 0
pages/shared/shared.wxss

@@ -96,6 +96,14 @@
 }
 }
 
 
 .wechat image {
 .wechat image {
+  width: 56rpx;
+  height: 48rpx;
+}
+.link image {
+  width: 48rpx;
+  height: 48rpx;
+}
+.photo image {
   width: 48rpx;
   width: 48rpx;
   height: 48rpx;
   height: 48rpx;
 }
 }

+ 3 - 2
pages/store/store.js

@@ -23,10 +23,11 @@ Page({
   gotoWV: function (event) {
   gotoWV: function (event) {
     let {id,index} = event.detail
     let {id,index} = event.detail
     wx.navigateTo({
     wx.navigateTo({
-      url: `/pages/webview/index?id=${id}`,
+      url: `/pages/webview/index?id=${id}&type=${this.data.fetcherData.type}`,
     })
     })
     util.request(api.increaseViewCount, {
     util.request(api.increaseViewCount, {
-      brandId: id
+      brandId: id,
+      type:this.data.fetcherData.type
     }, 'GET').then((res) => {
     }, 'GET').then((res) => {
         var num =  'storeList['+index+'].pvTotalNum'
         var num =  'storeList['+index+'].pvTotalNum'
         this.setData({
         this.setData({

+ 1 - 1
pages/ucenter/index/index.js

@@ -79,7 +79,7 @@ Page({
           {
           {
             icon: 'vr_live@2x',
             icon: 'vr_live@2x',
             url: '/pages/sence/sence',
             url: '/pages/sence/sence',
-            name: '直播间',
+            name: '带看',
             type: 32
             type: 32
           }
           }
         ],
         ],

+ 86 - 26
pages/webview/index.js

@@ -16,11 +16,13 @@ Page({
     loadUrl: false,
     loadUrl: false,
     goodsCount: 0,
     goodsCount: 0,
     canIUse: wx.canIUse('button.open-type.getUserInfo'),
     canIUse: wx.canIUse('button.open-type.getUserInfo'),
-    rnd:'',
-    temp:'',
+    rnd: '',
+    temp: '',
     live_base_url: 'rtmp://120.24.85.77:1935/hls',
     live_base_url: 'rtmp://120.24.85.77:1935/hls',
     peopleCount: 5,
     peopleCount: 5,
-    surplus: 5
+    surplus: 5,
+    type: '',
+    shareStatus: 0
     // url: 'https://www.4dkankan.com/showProPC.html?m=vroMUXdx&origin=4Dplaza&sid=1046051&room_id=1596785144930&user_id=44'
     // url: 'https://www.4dkankan.com/showProPC.html?m=vroMUXdx&origin=4Dplaza&sid=1046051&room_id=1596785144930&user_id=44'
   },
   },
 
 
@@ -29,11 +31,23 @@ Page({
    * 生命周期函数--监听页面加载
    * 生命周期函数--监听页面加载
    */
    */
   onLoad: async function (options) {
   onLoad: async function (options) {
+    console.log(this.options.a)
+    if (this.options.a) {
+      // [id_type_join_roomId_many]
+      let arr = this.options.a.split(',')
+      this.options.id = arr[0]
+      this.options.type = arr[1]
+      this.options.join = true
+      this.options.roomId = arr[3]
+      this.options.many = true
+    }
+    console.log(this.options)
     getApp().checkNetStatu();
     getApp().checkNetStatu();
 
 
-    
+
     // setTimeout(() => this.login(), 3000)
     // setTimeout(() => this.login(), 3000)
     this.setData({
     this.setData({
+      type: options.type,
       join: false,
       join: false,
       imgServer: util.imgServer,
       imgServer: util.imgServer,
       showGuide: false,
       showGuide: false,
@@ -56,10 +70,10 @@ Page({
       page: 1,
       page: 1,
       size: 1000
       size: 1000
     })
     })
-    
+
     // console.log(options)
     // console.log(options)
     // options.id = '1046098'
     // options.id = '1046098'
-
+ 
     if (this.options.roomId) {
     if (this.options.roomId) {
       this.data.join = true
       this.data.join = true
     }
     }
@@ -77,21 +91,52 @@ Page({
     socketApi.onShow.call(this)
     socketApi.onShow.call(this)
     this.urlPj = '&brandId=' + this.options.id
     this.urlPj = '&brandId=' + this.options.id
   },
   },
-
+  // copy() {
+  //   var dataT =this.data.webviewUrl
+  //   wx.setClipboardData({
+  //     data: dataT,
+  //     success: function (res) {
+  //       wx.getClipboardData({
+  //         success: function (res) {
+  //           console.log(res.data) // data
+  //         }
+  //       })
+  //     }
+  //   })
+  // },
   async init() {
   async init() {
     let options = this.options
     let options = this.options
+    console.log('********')
+    console.log(options)
 
 
-    let {url: base, obj: m } = await new Promise(r => this.getBrandDetail(options.id, (url, obj)  => r({url, obj})))
+    let {
+      url: base,
+      obj: m
+    } = await new Promise(r => this.getBrandDetail(options.id, options.type, (url, obj) => r({
+      url,
+      obj
+    })))
 
 
     this.getBrand(options.id, m)
     this.getBrand(options.id, m)
     this.mcode = m
     this.mcode = m
-    let socketOptions = await this.socketStart({sceneId: this.mcode, roomId: options.roomId})
+    let socketOptions = await this.socketStart({
+      sceneId: this.mcode,
+      roomId: options.roomId
+    })
     let url = this.getUrl(base, socketOptions, this.data.join) + this.urlPj
     let url = this.getUrl(base, socketOptions, this.data.join) + this.urlPj
 
 
     this.base = base
     this.base = base
 
 
-    this.setData({urlTemp: url.split('').join(' ')})
-    this.setData({ url, loadUrl: true, socketOptions, reload: true, hideWebView: false })
+    this.setData({
+      urlTemp: url.split('').join(' ')
+    })
+    this.setData({
+      url,
+      loadUrl: true,
+      socketOptions,
+      reload: true,
+      hideWebView: false
+    })
     this.recorderManager = wx.getRecorderManager()
     this.recorderManager = wx.getRecorderManager()
 
 
     this.brandId = options.id
     this.brandId = options.id
@@ -100,20 +145,28 @@ Page({
   },
   },
 
 
   hideInvitation() {
   hideInvitation() {
-    this.setData({ showInvitation: false })
+    this.setData({
+      showInvitation: false
+    })
     this.exit()
     this.exit()
   },
   },
 
 
   hideGuide() {
   hideGuide() {
-    this.setData({ showGuide: false })
+    this.setData({
+      showGuide: false
+    })
   },
   },
 
 
   hideEnd() {
   hideEnd() {
-    this.setData({ showEnd: false })
+    this.setData({
+      showEnd: false
+    })
   },
   },
 
 
   hideAlert() {
   hideAlert() {
-    this.setData({ showAlert: false })
+    this.setData({
+      showAlert: false
+    })
   },
   },
 
 
   // exit() {
   // exit() {
@@ -121,36 +174,41 @@ Page({
   //   this.socketStop && this.socketStop()
   //   this.socketStop && this.socketStop()
   //   wx.navigateBack()
   //   wx.navigateBack()
   // },
   // },
-  
+
   hidePacked() {
   hidePacked() {
-    this.setData({ showPacked: false })
+    this.setData({
+      showPacked: false
+    })
   },
   },
-  
+
   hideIsEnd() {
   hideIsEnd() {
-    this.setData({ showIsEnd: false })
+    this.setData({
+      showIsEnd: false
+    })
   },
   },
 
 
   /**
   /**
    * 生命周期函数--监听页面初次渲染完成
    * 生命周期函数--监听页面初次渲染完成
    */
    */
   onReady: function () {
   onReady: function () {
-    
+
   },
   },
 
 
-  
+
 
 
 
 
   /**
   /**
    * 生命周期函数--监听页面显示
    * 生命周期函数--监听页面显示
    */
    */
   onShow: async function () {
   onShow: async function () {
+   
     getApp().updateCardCount()
     getApp().updateCardCount()
 
 
-    
-    
+
+
     // this.options.join = true
     // this.options.join = true
     // this.getCartList()
     // this.getCartList()
-    
+
     let userInfo = wx.getStorageSync('userInfo');
     let userInfo = wx.getStorageSync('userInfo');
     let token = wx.getStorageSync('token');
     let token = wx.getStorageSync('token');
 
 
@@ -180,7 +238,9 @@ Page({
           webviewUrl: null
           webviewUrl: null
         })
         })
         setTimeout(() => {
         setTimeout(() => {
-          this.setData({ hideWebView: false })
+          this.setData({
+            hideWebView: false
+          })
           this.init()
           this.init()
         }, 500)
         }, 500)
       } else {
       } else {
@@ -205,7 +265,7 @@ Page({
     getApp().onPullDownRefresh()
     getApp().onPullDownRefresh()
   },
   },
 
 
-  
+
   /**
   /**
    * 页面上拉触底事件的处理函数
    * 页面上拉触底事件的处理函数
    */
    */

+ 4 - 0
pages/webview/index.wxml

@@ -250,4 +250,8 @@
     {{debugerInfo}}
     {{debugerInfo}}
 		<cover-view bindtap="clearDebuger">清除</cover-view>
 		<cover-view bindtap="clearDebuger">清除</cover-view>
   </cover-view>
   </cover-view>
+
+	<!-- <cover-view class="dialog invitation-view">
+		<cover-view bindtap="copy">{{webviewUrl}}</cover-view>
+	</cover-view> -->
 </view>
 </view>

+ 32 - 18
socket.js

@@ -65,19 +65,20 @@ export default {
     }
     }
     // remote.viewHost
     // remote.viewHost
     let hostUrl
     let hostUrl
-    if(options.url.indexOf('www.4dkankan.com')!=-1){
-      hostUrl ='https://www.4dkankan.com/shop-container-zfb/'
-    }else{
-      hostUrl ='https://zfb.4dkankan.com/shop-container/'
+    if (options.url.indexOf('www.4dkankan.com') != -1) {
+      hostUrl = 'https://www.4dkankan.com/shop-container-zfb/'
+    } else {
+      hostUrl = 'https://zfb.4dkankan.com/shop-container/'
     }
     }
     // let base = remote.viewHost + '/shop-container/fashilong.html?env=' + remote.env + '&sponsor=' + sponsor + '&many=' + this.data.many
     // let base = remote.viewHost + '/shop-container/fashilong.html?env=' + remote.env + '&sponsor=' + sponsor + '&many=' + this.data.many
-    let base = hostUrl + 'fashilong.html?env=' + remote.env + '&sponsor=' + sponsor + '&many=' + this.data.many
+    let base = hostUrl + 'fashilong.html?time=' + Date.now() + '&env=' + remote.env + '&sponsor=' + sponsor + '&many=' + this.data.many
     // let base = remote.viewHost + '/shop.html'
     // let base = remote.viewHost + '/shop.html'
 
 
     this.data.reload = false
     this.data.reload = false
     this.data.showCommodity = false
     this.data.showCommodity = false
     // options.url = options.url+'&vlog';
     // options.url = options.url+'&vlog';
     if (!this.data.webviewUrl) {
     if (!this.data.webviewUrl) {
+      console.log(base)
       this.setData({
       this.setData({
         'webviewUrl': base + '#' + JSON.stringify(options)
         'webviewUrl': base + '#' + JSON.stringify(options)
       })
       })
@@ -89,7 +90,7 @@ export default {
       })
       })
     }
     }
 
 
-    console.log(this.data.webviewUrl)
+
   },
   },
 
 
   onShow() {
   onShow() {
@@ -418,7 +419,7 @@ export default {
     //     console.log(err)
     //     console.log(err)
     //   }
     //   }
     // })
     // })
-    
+
   },
   },
   changeRoomEnableTalk(data) {
   changeRoomEnableTalk(data) {
     console.log(data)
     console.log(data)
@@ -485,6 +486,9 @@ export default {
   },
   },
 
 
   async startCall(data) {
   async startCall(data) {
+    this.setData({
+      shareStatus: 1
+    })
     if (!data) return;
     if (!data) return;
 
 
     this.setData({
     this.setData({
@@ -527,6 +531,9 @@ export default {
 
 
   stopCall() {
   stopCall() {
     console.error('stopCall')
     console.error('stopCall')
+    this.setData({
+      shareStatus: 0
+    })
     getApp().setVoiceProps({
     getApp().setVoiceProps({
       noMute: false,
       noMute: false,
       action: 'stopCall'
       action: 'stopCall'
@@ -693,12 +700,12 @@ export default {
       return {
       return {
         title: '【好友推荐】一起来云逛吧',
         title: '【好友推荐】一起来云逛吧',
         imageUrl: newPicUrl,
         imageUrl: newPicUrl,
-        path: `/pages/webview/index?id=${id}&join=true&roomId=${this.data.socketOptions.roomId}&many=${!!this.data.many}`,
+        path: `/pages/webview/index?id=${id}&type=${this.data.type}&join=true&roomId=${this.data.socketOptions.roomId}&many=${!!this.data.many}`,
       }
       }
     } else {
     } else {
       return {
       return {
         imageUrl: newPicUrl,
         imageUrl: newPicUrl,
-        path: `/pages/webview/index?id=${id}&join=false`,
+        path: `/pages/webview/index?id=${id}&type=${this.data.type}&join=false`,
       }
       }
     }
     }
   },
   },
@@ -726,14 +733,20 @@ export default {
     const vrLink = `/pages/webview/index`
     const vrLink = `/pages/webview/index`
     const img_url = this.data.newPicUrl || 'http://video.cgaii.com/new4dage/images/images/home_2_a.jpg'
     const img_url = this.data.newPicUrl || 'http://video.cgaii.com/new4dage/images/images/home_2_a.jpg'
     const shareImg = img_url
     const shareImg = img_url
-
     this.count = this.count || 0
     this.count = this.count || 0
-
-    console.log(`/pages/shared/shared?img_url=${btoa(img_url)}&shareImg=${btoa(shareImg)}&companyName=${companyName}&vrLink=${btoa(vrLink)}&id=${this.data.id}`);
-
-    wx.navigateTo({
-      url: `/pages/shared/shared?img_url=${btoa(img_url)}&shareImg=${btoa(shareImg)}&companyName=${companyName}&vrLink=${btoa(vrLink)}&id=${this.data.id}`,
-    })
+    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)
+      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}`);
+      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}`,
+      })
+    }
   },
   },
 
 
 
 
@@ -1055,9 +1068,10 @@ export default {
     }
     }
   },
   },
 
 
-  getBrandDetail: function (id, cb) {
+  getBrandDetail: function (id, type, cb) {
     util.request(api.BrandDetail, {
     util.request(api.BrandDetail, {
-      id: id
+      id: id,
+      type: type,
     }).then((res) => {
     }).then((res) => {
       let base = res.data.brand.sceneUrl
       let base = res.data.brand.sceneUrl
       // let base = 'http://192.168.0.112:8080/shop.html?m=t-7Uqj9Fq&origin=fashilong'
       // let base = 'http://192.168.0.112:8080/shop.html?m=t-7Uqj9Fq&origin=fashilong'

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

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