订单相关修改提测
This commit is contained in:
@@ -2,10 +2,10 @@ const debug = process.env.NODE_ENV == 'development' ? true : false;
|
||||
// #ifdef H5
|
||||
const proxyApi = "/api"
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN || APP
|
||||
// #ifdef MP-WEIXIN || APP || MP-ALIPAY
|
||||
// const proxyApi = 'http://192.168.2.42:9889/cashierService' // 王伟
|
||||
// const proxyApi = 'http://192.168.2.74:9888/cashierService' // 帆哥
|
||||
// const proxyApiwws = 'ws://192.168.2.74:9888/cashierService' // 测试
|
||||
// const proxyApi = 'http://192.168.1.27:9888/cashierService' // 帆哥
|
||||
// const proxyApiwws = 'ws://192.168.1.15:9999/netty' // 测试
|
||||
const proxyApi = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
|
||||
const proxyApiwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
|
||||
// #endif
|
||||
@@ -15,12 +15,12 @@ const baseUrl = debug ? proxyApi + '/cashierService' : "https://cashier.sxczgkj.
|
||||
const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
|
||||
// #endif
|
||||
|
||||
// #ifdef APP || MP-WEIXIN
|
||||
// #ifdef APP || MP-WEIXIN || MP-ALIPAY
|
||||
const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
|
||||
|
||||
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
|
||||
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
|
||||
// const baseUrl = 'https://wxcashiertest.sxczgkj.cn/cashierService' // 测试
|
||||
// const baseUrlwws = 'wss://wxcashiertest.sxczgkj.cn/netty' // 测试
|
||||
// #endif
|
||||
|
||||
// import VConsole from "./vConsole.js"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import md5 from './md5'
|
||||
import Api from "@/common/js/api.js"
|
||||
|
||||
/**
|
||||
* 转换对象为x-www-form-urlencoded
|
||||
@@ -232,11 +233,84 @@ const pluschooseImage = function() {
|
||||
return true
|
||||
}
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
// #ifdef MP-WEIXIN || MP-ALIPAY
|
||||
return true
|
||||
// #endif
|
||||
}
|
||||
|
||||
const getUserInfo = function (successCallback, failCallback) {
|
||||
// #ifdef MP-WEIXIN
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: (data) => {
|
||||
// 微信小程序环境
|
||||
uni.getUserInfo({
|
||||
provider: 'weixin',
|
||||
success: async (infoRes) => {
|
||||
let res = await Api.userwxlogin({
|
||||
code: data.code, //临时登录凭证
|
||||
rawData: infoRes.rawData,
|
||||
})
|
||||
if (res.code == 0) {
|
||||
resolve(res)
|
||||
// uni.cache.set('token', res.data.token);
|
||||
// uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
// .miniAppOpenId)
|
||||
// uni.cache.set('userInfo', res.data.userInfo);
|
||||
// let pages = getCurrentPages()
|
||||
// let curPage = pages[pages.length -1 ]
|
||||
// curPage.onLoad(curPage.options)
|
||||
// curPage.onShow()
|
||||
// // curPage.mounted()
|
||||
// curPage.onReady()
|
||||
}
|
||||
},
|
||||
fail: (err) => {}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
return new Promise((resolve, reject) => {
|
||||
my.getAuthCode({
|
||||
scopes: 'auth_user',
|
||||
success: (data) => {
|
||||
// 支付宝小程序环境
|
||||
my.getAuthUserInfo({
|
||||
success: async (infoRes) => {
|
||||
uni.cache.set('weixincode', data.authCode);
|
||||
let res = await Api.userwxlogin({
|
||||
code: uni.cache.get('weixincode'), //临时登录凭证
|
||||
rawData: JSON.stringify(infoRes),
|
||||
})
|
||||
if (res.code == 0) {
|
||||
resolve(res)
|
||||
// uni.cache.set('token', res.data.token);
|
||||
// uni.cache.set('miniAppOpenId', res.data.userInfo
|
||||
// .miniAppOpenId)
|
||||
// uni.cache.set('userInfo', res.data.userInfo);
|
||||
// let pages = getCurrentPages()
|
||||
// let curPage = pages[pages.length -1 ]
|
||||
// curPage.onLoad(curPage.options)
|
||||
// curPage.onShow()
|
||||
// // curPage.mounted()
|
||||
// curPage.onReady()
|
||||
}
|
||||
},
|
||||
fail: (err) => {}
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
// #endif
|
||||
}
|
||||
|
||||
|
||||
uni.utils = {
|
||||
md5,
|
||||
transformRequest,
|
||||
@@ -253,5 +327,6 @@ uni.utils = {
|
||||
debounce,
|
||||
getCurrentPage,
|
||||
getCurrentRoute,
|
||||
pluschooseImage
|
||||
pluschooseImage,
|
||||
getUserInfo
|
||||
}
|
||||
@@ -59,7 +59,7 @@ async function request(options) {
|
||||
}
|
||||
try {
|
||||
if (options.toast) {
|
||||
// #ifdef MP-WEIXIN || APP-PLUS
|
||||
// #ifdef MP-WEIXIN || MP-ALIPAY || APP-PLUS
|
||||
uni.showLoading({
|
||||
title: '加载中',
|
||||
mask: true
|
||||
@@ -85,6 +85,10 @@ async function request(options) {
|
||||
// #ifdef MP-WEIXIN
|
||||
environment: 'wx',
|
||||
// #endif
|
||||
// #ifdef MP-ALIPAY
|
||||
environment: 'wx',
|
||||
// environment: 'alipay',
|
||||
// #endif
|
||||
token: uni.cache.get('token'),
|
||||
openId: uni.cache.get('miniAppOpenId'),
|
||||
id: uni.cache.get('userInfo').id,
|
||||
@@ -94,7 +98,7 @@ async function request(options) {
|
||||
} else {
|
||||
|
||||
}
|
||||
// #ifdef MP-WEIXIN || APP-PLUS
|
||||
// #ifdef MP-WEIXIN || MP-ALIPAY || APP-PLUS
|
||||
options.url = uni.conf.baseUrl + options.url
|
||||
let res = await requestrequest(options);
|
||||
// #endif
|
||||
@@ -102,7 +106,6 @@ async function request(options) {
|
||||
let res = await uni.pro.request(options);
|
||||
// #endif
|
||||
if (res.code != 0) {
|
||||
console.log(options)
|
||||
if (res.code == -4) {
|
||||
// uni.showToast({
|
||||
// title: res.message || res.msg,
|
||||
@@ -113,6 +116,7 @@ async function request(options) {
|
||||
// // }, 1000)
|
||||
// }
|
||||
// })
|
||||
|
||||
uni.$u.throttle(store.dispatch("loginEvent"), 1000); //获取shapid
|
||||
|
||||
} else if (res.code == 482) {
|
||||
@@ -128,9 +132,7 @@ async function request(options) {
|
||||
success: () => {
|
||||
setTimeout(res => {
|
||||
if (options.toast) {
|
||||
// #ifdef MP-WEIXIN
|
||||
// #endif
|
||||
// #ifndef MP-WEIXIN
|
||||
// #ifndef MP-WEIXIN || MP-ALIPAY
|
||||
uni.pro.hideLoading()
|
||||
// #endif
|
||||
}
|
||||
|
||||
@@ -13,9 +13,12 @@ uni.pro.uploadFile = (obj) => {
|
||||
|
||||
uni.pro.navigateTo = (pageName, extras = {}) => {
|
||||
let url = uni.url.getUrl(pageName, extras)
|
||||
return uni.navigateTo({
|
||||
url
|
||||
})
|
||||
console.log(url)
|
||||
return uni.navigateTo({
|
||||
url
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
uni.pro.redirectTo = (pageName, extras = {}) => {
|
||||
let url = uni.url.getUrl(pageName, extras)
|
||||
|
||||
@@ -11,14 +11,14 @@ function get(key) {
|
||||
if (!res) {
|
||||
return ''
|
||||
}
|
||||
|
||||
// res = JSON.parse(res)
|
||||
|
||||
if (res.__expiretime && res.__expiretime < uni.utils.timestamp()) {
|
||||
|
||||
if (res.expire > 0 && res.expire < uni.utils.timestamp()) {
|
||||
console.log(res)
|
||||
remove(key)
|
||||
return ''
|
||||
} else {
|
||||
return res
|
||||
return res.data
|
||||
}
|
||||
} catch (e) {
|
||||
return ''
|
||||
@@ -56,15 +56,13 @@ function getStorageData(key) {
|
||||
* @param {Number} expire 指定秒数后过期
|
||||
* @return void
|
||||
*/
|
||||
function set(key, value, expire = uni.conf.default_expire) {
|
||||
let cacheItem = {}
|
||||
cacheItem = value
|
||||
// console.log(cacheItem)
|
||||
if (expire > 0) {
|
||||
cacheItem.__expiretime = uni.utils.timestamp() + expire
|
||||
function set(key, value, expire = 0) {
|
||||
let obj = {
|
||||
data: value, //存储的数据
|
||||
time: Date.now() / 1000, //记录存储的时间戳
|
||||
expire: expire //记录过期时间,单位秒
|
||||
}
|
||||
// uni.setStorageSync(key,JSON.stringify(cacheItem))
|
||||
uni.setStorageSync(key,cacheItem)
|
||||
uni.setStorageSync(key, obj)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user