gemercheung 2 rokov pred
rodič
commit
1e6b09819d
3 zmenil súbory, kde vykonal 44 pridanie a 17 odobranie
  1. 4 4
      pages/room/add.js
  2. 25 10
      pages/roomManger/roomManger.js
  3. 15 3
      socket.js

+ 4 - 4
pages/room/add.js

@@ -308,10 +308,10 @@ Page({
         title: '创建成功!!',
         icon: "success"
       })
-      // wx.navigateBack({
-      //   delta: 0,
-      // })
-      wx.navigateBack()
+      wx.navigateBack({
+        delta: 0,
+      })
+      // wx.navigateBack()
     } else {
       wx.showToast({
         title: res.error || '创建失败!!',

+ 25 - 10
pages/roomManger/roomManger.js

@@ -11,9 +11,9 @@ Page({
     roomList: [],
     hasData: true,
     loading: false,
-    listNmb:{
-      NotStart:0,
-      Start:0,
+    listNmb: {
+      NotStart: 0,
+      Start: 0,
     },
     isSearch: false,
     state: true,
@@ -48,7 +48,7 @@ Page({
   async handleDelete(e) {
     wx.showModal({
       title: '温馨提示',
-      content: this.data.fetcherData.state !== 102 ?'关闭房间后,房间内的所有人都会退出房间,是否继续关闭?':'删除房间后,房间信息将进行销毁,是否继续删除?',
+      content: this.data.fetcherData.state !== 102 ? '关闭房间后,房间内的所有人都会退出房间,是否继续关闭?' : '删除房间后,房间信息将进行销毁,是否继续删除?',
       success: (res) => {
         console.log('requestDelete', res)
         if (res.confirm) {
@@ -128,10 +128,10 @@ Page({
       url: `/pages/room/add`,
     })
   },
-  async getStartNum(){
+  async getStartNum() {
     const res = await util.request(api.roomChatList, {
       ...this.data.fetcherData,
-      state:101,
+      state: 101,
     }, 'POST', 'application/json')
     // debugger
     if (res.code === 200) {
@@ -162,9 +162,14 @@ Page({
           if (res.code === 200) {
             if (res.data.data.length != 0) {
               let listNmb = this.data.listNmb
-              let objlistNmb = { 101:'Start', 102:'NotStart', }
+              let objlistNmb = {
+                101: 'Start',
+                102: 'NotStart',
+              }
               listNmb[objlistNmb[this.data.fetcherData.state]] = res.data.count
-              let { totalPages } = res.data
+              let {
+                totalPages
+              } = res.data
               this.setData({
                 roomList: this.data.roomList.concat(res.data.data),
                 'fetcherData.page': this.data.fetcherData.page + 1,
@@ -218,7 +223,10 @@ Page({
         wx.hideLoading()
         if (res.errno === 0) {
           let listNmb = this.data.listNmb
-          let objlistNmb = { 101:'Start', 102:'NotStart', }
+          let objlistNmb = {
+            101: 'Start',
+            102: 'NotStart',
+          }
           listNmb[objlistNmb[this.data.fetcherData.state]] = res.data.count
           this.setData({
             roomList: res.data.data,
@@ -282,7 +290,7 @@ Page({
     this.setData({
       'fetcherData.type': options.type
     })
-    this.getRoomList()
+    // this.getRoomList()
     this.getUserInfo()
     this.getStartNum()
   },
@@ -298,6 +306,13 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
+    // debugger
+    this.setData({
+      roomList: [],
+      'fetcherData.page': 1
+    }, () => {
+      this.getRoomList()
+    })
 
   },
 

+ 15 - 3
socket.js

@@ -55,9 +55,17 @@ let urlToJson = (url = window.location.href) => { // 箭头函数默认传值为
 export default {
 
   joinUrl() {
-    // 去除test-shop,转回shop
-    // const url = true ? this.data.url.replace('shop.html', 'test-shop.html') : this.data.url;
-    const url = this.data.url;
+
+    let url = this.data.url;
+    
+    //隐藏部分
+    // if (this.data.url && /smobile.html/.test(this.data.url)) {
+    //   const newUrl = this.data.url.replace('smobile.html', 'shop.html')
+    //   url = newUrl
+    //   this.setData({
+    //     url: newUrl
+    //   });
+    // }
 
     let options = {
       API_BASE_URL: api.API_BASE_URL,
@@ -113,6 +121,9 @@ export default {
     this.data.showCommodity = false
     //上线前隐藏Vlog
     // options.url = options.url + '&vlog';
+
+
+
     if (!this.data.webviewUrl) {
       console.log(base)
       this.setData({
@@ -1507,6 +1518,7 @@ export default {
           wx.navigateTo({
             url: `/pages/webview/index?id=${data.id}&type=32`,
           })
+
         }
       },
       fail: () => {