gemercheung преди 3 години
родител
ревизия
2293444ea1
променени са 6 файла, в които са добавени 36 реда и са изтрити 10 реда
  1. 1 0
      config.js
  2. 3 3
      project.config.json
  3. 7 0
      sitemap copy.json
  4. 10 0
      socket.io-v4.js
  5. 11 6
      socket.js
  6. 4 1
      utils/util.js

+ 1 - 0
config.js

@@ -15,6 +15,7 @@ const dev = {
 const mal = {
   env: 'pro',
   socketHost: 'wss://shop.4dkankan.com',
+  // socketHost: 'wss://test-socket.4dkankan.com',
   // socketHost: 'wss://192.168.0.79:3031',
   requestHost: 'https://plaza-cszfb.4dkankan.com', // 测试环境
   viewChildHost: 'https://cszfb.4dkankan.com', //测试环境

+ 3 - 3
project.config.json

@@ -27,8 +27,7 @@
             "disablePlugins": [],
             "outputPath": ""
         },
-        "enableEngineNative": false,
-        "useIsolateContext": true,
+        "useIsolateContext": false,
         "userConfirmedBundleSwitch": false,
         "packNpmManually": false,
         "packNpmRelationList": [],
@@ -36,7 +35,8 @@
         "disableUseStrict": false,
         "minifyWXML": true,
         "showES6CompileOption": false,
-        "useCompilerPlugins": false
+        "useCompilerPlugins": false,
+        "ignoreUploadUnusedFiles": true
     },
     "compileType": "miniprogram",
     "libVersion": "2.19.3",

+ 7 - 0
sitemap copy.json

@@ -0,0 +1,7 @@
+{
+  "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
+  "rules": [{
+  "action": "allow",
+  "page": "*"
+  }]
+}

Файловите разлики са ограничени, защото са твърде много
+ 10 - 0
socket.io-v4.js


+ 11 - 6
socket.js

@@ -1,4 +1,5 @@
-const io = require('./socket.io-mp')
+// const io = require('./socket.io-mp');
+const { io } = require('./socket.io-v4');
 var user = require('./services/user.js');
 const api = require('/config/api.js');
 const util = require('/utils/util.js');
@@ -73,7 +74,7 @@ export default {
     }else
     {
       // hostUrl = 'https://zfb.4dkankan.com/shop-container/'
-      hostUrl = remote.viewHost+'/shop-container/'
+      hostUrl = remote.viewHost + '/shop-container/'
     }
     // let base = remote.viewHost + '/shop-container/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
@@ -289,12 +290,14 @@ export default {
       options = await this.getSocketOptions(sceneId, roomId)
     }
 
-    console.log('小程序参数', options)
+    console.log('小程序参数', options);
+
     let socket = io(remote.socketHost, {
       path: '/fsl-node',
       query: {
         ...options,
-        isClient: true
+        isClient: true,
+        from : 1
       }
     })
 
@@ -921,14 +924,16 @@ export default {
 
   async getCouponList(id) {
     const success = (res) => {
+     
       this.setData({
-        coupons: res.data.list.map(item => {
+        coupons: (res.data && res.data.message.list) ? res.data.message.list.map(item => {
           item.typeMoney = item.typeMoney.toString()
           item.fontSize = item.typeMoney.length === 3 ? '90rpx' :
             item.typeMoney.length === 4 ? '70rpx' : '130rpx'
           return item
-        })
+        }):[]
       })
+  
 
       this.loadConponSuccess = true
       this.readySendCouponCtrl()

+ 4 - 1
utils/util.js

@@ -62,8 +62,11 @@ function request(url, data = {}, method = "POST", header = "application/x-www-fo
                     let currPage = pages[pages.length - 1].route
                     let notLogins = ['pages/index/index', 'pages/catalog/catalog', 'pages/category/category', 'pages/ucenter/index/index']
                     console.log('res.data.errno',res.data.errno)
+                    console.log('res.data.code',res.data.code)
+                    console.log('currPage',  currPage)
+                    console.log('notLogins',  notLogins.includes(currPage))
                   
-                    if ((res.data.errno == 401 || res.data.code === 401 ) && !~notLogins.indexOf(currPage)) {
+                    if ((res.data.code === 401 || res.data.errno === 401)) {
                         resolve(res.data);
                         gotoLogin()
                     } else {