修改兼容h5调试
This commit is contained in:
@@ -8,7 +8,7 @@ export default (params) => {
|
|||||||
const shopId = uni.cache.get("shopId") * 1;
|
const shopId = uni.cache.get("shopId") * 1;
|
||||||
const userInfo = uni.cache.get("userInfo") || {};
|
const userInfo = uni.cache.get("userInfo") || {};
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
token = "21f0a0b10e1d40ce9c6464037fedb792";
|
token = "b61c8b0f1c9d47ad924e33c48b496ce6";
|
||||||
// #endif
|
// #endif
|
||||||
let header = {
|
let header = {
|
||||||
version: uni.conf.version,
|
version: uni.conf.version,
|
||||||
|
|||||||
@@ -32,13 +32,14 @@ uni.conf = {
|
|||||||
baseUrlwws,
|
baseUrlwws,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('uni.conf',uni.conf)
|
|
||||||
|
|
||||||
export const changeEnv = (env) => {
|
export const changeEnv = (env) => {
|
||||||
if (env === "test") {
|
if (env === "test") {
|
||||||
let baseUrl = "http://192.168.1.42"
|
let baseUrl = "http://192.168.1.42"
|
||||||
|
let baseUrlwws="ws://192.168.1.42:2348"
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
baseUrl = "/api"
|
baseUrl = "/api"
|
||||||
|
baseUrlwws="http://192.168.1.42:2348"
|
||||||
// #endif
|
// #endif
|
||||||
uni.conf = {
|
uni.conf = {
|
||||||
debug: true,
|
debug: true,
|
||||||
@@ -47,7 +48,7 @@ export const changeEnv = (env) => {
|
|||||||
phpChatWx: 'ws://192.168.1.42:2348',
|
phpChatWx: 'ws://192.168.1.42:2348',
|
||||||
version: 100,
|
version: 100,
|
||||||
autoRemoveCache,
|
autoRemoveCache,
|
||||||
baseUrlwws: "ws://192.168.1.42:2348",
|
baseUrlwws,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (env === "prod") {
|
if (env === "prod") {
|
||||||
@@ -59,4 +60,6 @@ export const changeEnv = (env) => {
|
|||||||
baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",
|
baseUrlwws: "wss://czgeatws.sxczgkj.com/wss",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default uni.conf
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -11,7 +11,9 @@ function get(key) {
|
|||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
return res.value
|
||||||
|
// #endif
|
||||||
|
|
||||||
if (res.expiretime && res.expiretime < Date.now()) {
|
if (res.expiretime && res.expiretime < Date.now()) {
|
||||||
remove(key)
|
remove(key)
|
||||||
|
|||||||
1
framework/bootstrap.js
vendored
1
framework/bootstrap.js
vendored
@@ -1,4 +1,3 @@
|
|||||||
import './0-conf'
|
|
||||||
import './1-utils'
|
import './1-utils'
|
||||||
import './2-url'
|
import './2-url'
|
||||||
import './3-pro'
|
import './3-pro'
|
||||||
|
|||||||
2
main.js
2
main.js
@@ -1,6 +1,8 @@
|
|||||||
import App from './App'
|
import App from './App'
|
||||||
import uviewPlus from '@/uni_modules/uview-plus'
|
import uviewPlus from '@/uni_modules/uview-plus'
|
||||||
import './framework/bootstrap'
|
import './framework/bootstrap'
|
||||||
|
import config from '@/common/config.js'
|
||||||
|
|
||||||
// #ifndef VUE3
|
// #ifndef VUE3
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import './uni.promisify.adaptor'
|
import './uni.promisify.adaptor'
|
||||||
|
|||||||
@@ -233,6 +233,10 @@ export const useWebSocket = defineStore('socketTask', () => {
|
|||||||
|
|
||||||
// 发送消息
|
// 发送消息
|
||||||
const sendMessage = (data) => {
|
const sendMessage = (data) => {
|
||||||
|
console.log('data',data)
|
||||||
|
if(!data){
|
||||||
|
return
|
||||||
|
}
|
||||||
if (isConnected.value && data) {
|
if (isConnected.value && data) {
|
||||||
// console.log('发送消息', data);
|
// console.log('发送消息', data);
|
||||||
socketTask.value.send({
|
socketTask.value.send({
|
||||||
|
|||||||
@@ -115,6 +115,18 @@ export const productStore = defineStore("product", {
|
|||||||
getLocation() {
|
getLocation() {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
console.log("获取经纬度");
|
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({
|
uni.getLocation({
|
||||||
type: "wgs84",
|
type: "wgs84",
|
||||||
altitude: true,
|
altitude: true,
|
||||||
@@ -298,11 +310,11 @@ export const productStore = defineStore("product", {
|
|||||||
]) {
|
]) {
|
||||||
resolve(
|
resolve(
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
reject(
|
reject(
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user