diff --git a/common/api/request.js b/common/api/request.js index adda8b2..861e80f 100644 --- a/common/api/request.js +++ b/common/api/request.js @@ -8,7 +8,7 @@ export default (params) => { const shopId = uni.cache.get("shopId") * 1; const userInfo = uni.cache.get("userInfo") || {}; // #ifdef H5 - token = "21f0a0b10e1d40ce9c6464037fedb792"; + token = "b61c8b0f1c9d47ad924e33c48b496ce6"; // #endif let header = { version: uni.conf.version, diff --git a/common/config.js b/common/config.js index 95703ed..049fa46 100644 --- a/common/config.js +++ b/common/config.js @@ -32,13 +32,14 @@ uni.conf = { baseUrlwws, }; -console.log('uni.conf',uni.conf) export const changeEnv = (env) => { if (env === "test") { let baseUrl = "http://192.168.1.42" + let baseUrlwws="ws://192.168.1.42:2348" // #ifdef H5 baseUrl = "/api" + baseUrlwws="http://192.168.1.42:2348" // #endif uni.conf = { debug: true, @@ -47,7 +48,7 @@ export const changeEnv = (env) => { phpChatWx: 'ws://192.168.1.42:2348', version: 100, autoRemoveCache, - baseUrlwws: "ws://192.168.1.42:2348", + baseUrlwws, }; } if (env === "prod") { @@ -59,4 +60,6 @@ export const changeEnv = (env) => { baseUrlwws: "wss://czgeatws.sxczgkj.com/wss", }; } -}; \ No newline at end of file +}; + +export default uni.conf \ No newline at end of file diff --git a/framework/0-conf.js b/framework/0-conf.js index cf0810e..e69de29 100644 --- a/framework/0-conf.js +++ b/framework/0-conf.js @@ -1,34 +0,0 @@ -// const debug = process.env.NODE_ENV == 'development' ? true : false; -const debug = false -// #ifdef H5 -const proxyApi = "/api" -// #endif - -// #ifdef MP-WEIXIN || APP || MP-ALIPAY -const proxyApi = 'http://192.168.1.42' // 调试地址 -const proxyApiwws = 'ws://192.168.1.42:2348' // 调试地址 -// #endif - -// #ifdef H5 -const baseUrl = debug ? proxyApi : "http://192.168.1.42" -const baseUrlwws = 'ws://192.168.1.42:2348' -// #endif - -// #ifdef APP || MP-WEIXIN || MP-ALIPAY -const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.com' // 线上 -const baseUrlwws = debug ? proxyApiwws : 'wss://czgeatws.sxczgkj.com/wss' // 线上 -// #endif - - -const version = '100' -const autoRemoveCache = { - count: 100000, - size: 100000 -} -uni.conf = { - debug, - baseUrl, - version, - autoRemoveCache, - baseUrlwws -} \ No newline at end of file diff --git a/framework/8-cache.js b/framework/8-cache.js index b8b8f41..036e281 100644 --- a/framework/8-cache.js +++ b/framework/8-cache.js @@ -11,7 +11,9 @@ function get(key) { return '' } - + // #ifdef H5 + return res.value + // #endif if (res.expiretime && res.expiretime < Date.now()) { remove(key) diff --git a/framework/bootstrap.js b/framework/bootstrap.js index 81e3b14..235f167 100644 --- a/framework/bootstrap.js +++ b/framework/bootstrap.js @@ -1,4 +1,3 @@ -import './0-conf' import './1-utils' import './2-url' import './3-pro' diff --git a/main.js b/main.js index cd79518..b371822 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,8 @@ import App from './App' import uviewPlus from '@/uni_modules/uview-plus' import './framework/bootstrap' +import config from '@/common/config.js' + // #ifndef VUE3 import Vue from 'vue' import './uni.promisify.adaptor' diff --git a/stores/carts-websocket.js b/stores/carts-websocket.js index 0d35364..facdd39 100644 --- a/stores/carts-websocket.js +++ b/stores/carts-websocket.js @@ -233,6 +233,10 @@ export const useWebSocket = defineStore('socketTask', () => { // 发送消息 const sendMessage = (data) => { + console.log('data',data) + if(!data){ + return + } if (isConnected.value && data) { // console.log('发送消息', data); socketTask.value.send({ diff --git a/stores/user.js b/stores/user.js index 19bb25c..3d9f50e 100644 --- a/stores/user.js +++ b/stores/user.js @@ -115,6 +115,18 @@ export const productStore = defineStore("product", { getLocation() { return new Promise((resolve, reject) => { console.log("获取经纬度"); + // #ifdef H5 + resolve({ + accuracy: 65, + altitude: 0, + errMsg: "getLocation:ok", + horizontalAccuracy: 65, + latitude: 23.129163, + longitude: 113.264435, + speed: -1, + verticalAccuracy: 65, + }); + // #endif uni.getLocation({ type: "wgs84", altitude: true, @@ -298,11 +310,11 @@ export const productStore = defineStore("product", { ]) { resolve( true - ); + ); } else { reject( false - ); + ); } }, });