This commit is contained in:
2024-05-17 18:02:49 +08:00
parent 8407d51fb6
commit b5264dc222
4056 changed files with 308094 additions and 41932 deletions

View File

@@ -5,8 +5,8 @@ if (process.env.NODE_ENV === 'development') {
// baseUrl = "http://localhost:7001/";
// socketUrl = "ws://localhost:6001/";
// baseUrl = "https://twin-ui.com/demo/";
baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
// baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
// baseUrl = "http://192.168.110.100:9200/pb/"; // 张川川
@@ -20,14 +20,19 @@ if (process.env.NODE_ENV === 'development') {
// baseUrl = "http://192.168.110.100:9200/pb/"; // 开发用电脑
// baseUrl = "http://59.110.212.44:9200/pb/";
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
// baseUrl = "http://192.168.110.110:9200/pb/";
// baseUrl = "http://192.168.110.110:9200/pb/"; //磊哥
// baseUrl = "http://192.168.110.38:9200/pb/"; // 吴春磊笔记本1
// socketUrl = "ws://8.129.186.35:6001/";
} else if (process.env.NODE_ENV === 'production') {
// 生产环境11
// baseUrl = "http://59.110.212.44:9100/pb/";
// baseUrl = "https://testapi.nuttyreading.com/";
baseUrl = "https://api.nuttyreading.com/"; //1
baseUrl = "https://testapi.nuttyreading.com/";
// baseUrl = "https://api.nuttyreading.com/"; //1
// baseUrl = "ws://twin-ui.com:6001/";
// socketUrl = "ws://twin-ui.com:6001/";
}

View File

@@ -5,9 +5,9 @@ export default {
// 主页页面的页面路径
// 关联功能:打开的页面只有一个的时候右上角自动显示返回首页按钮,下面这个数组是排除显示返回首页的页面。
// 主页使用场景:小程序分享出去的页面,用户点击开是分享页面,很多情况下是没有返回首页按钮的
mainPagePath: ['pages/homePage/index'],
mainPagePath: ['pages/homePage/index/index'],
//返回首页的地址
homePath: '/pages/homePage/index',
homePath: '/pages/homePage/index/index',
/****************以下是zhouWei-APPUpdate插件配置*******************/
// 发起ajax请求获取服务端版本号

View File

@@ -245,7 +245,7 @@ export const h5Login = function(type = "judge", callback) {
title: '用户信息失效,请重新登陆。'
})
uni.navigateTo({
url: "/pages/user/login"
url: "/pages/user/login/login"
});
}else{
uni.showModal({
@@ -256,7 +256,7 @@ export const h5Login = function(type = "judge", callback) {
success: (res) => {
if(res.confirm){
uni.navigateTo({
url: "/pages/user/login"
url: "/pages/user/login/login"
});
}
}

View File

@@ -113,7 +113,7 @@ function judgeLogin(callback, type = "judge"){
success: (res) => {
if (res.confirm) {
uni.navigateTo({
url: "/pages/user/login"
url: "/pages/user/login/login"
});
}
}

View File

@@ -17,7 +17,7 @@ import {
getCurrentNo
} from '@/uni_modules/zhouWei-APPUpdate/js_sdk/appUpdate';
setTimeout(() => {
getCurrentNo(function(res) {
getCurrentNo(function (res) {
console.log("版本号", res);
version_code = res.versionCode;
});
@@ -42,7 +42,7 @@ let $http = new request({
}
});
// 添加获取七牛云token的方法
$http.getQnToken = function(callback) {
$http.getQnToken = function (callback) {
//该地址需要开发者自行配置(每个后台的接口风格都不一样)
$http.get("api/common/v1/qn_upload").then(data => {
/*
@@ -60,7 +60,7 @@ $http.getQnToken = function(callback) {
});
}
// 添加获取阿里云token的方法
$http.getAliToken = function(callback) {
$http.getAliToken = function (callback) {
//该地址需要开发者自行配置(每个后台的接口风格都不一样)
$http.get("api/open/v1/ali_oss_upload").then(data => {
/*
@@ -81,7 +81,7 @@ $http.getAliToken = function(callback) {
});
}
//请求开始拦截器
$http.requestStart = function(options) {
$http.requestStart = function (options) {
// console.log("请求开始", options);
if (options.load && options.data.loadAnimate != 'none') {
//打开加载动画
@@ -132,7 +132,7 @@ $http.requestStart = function(options) {
return options;
}
//请求结束
$http.requestEnd = function(options) {
$http.requestEnd = function (options) {
//判断当前接口是否需要加载动画
if (options.load) {
// 关闭加载动画
@@ -141,7 +141,7 @@ $http.requestEnd = function(options) {
}
let loginPopupNum = 0;
//所有接口数据处理(此方法需要开发者根据各自的接口返回类型修改,以下只是模板)
$http.dataFactory = async function(res) {
$http.dataFactory = async function (res) {
// console.log("接口请求数据", {
// url: res.url,
// resolve: res.response,
@@ -151,7 +151,7 @@ $http.dataFactory = async function(res) {
// });
if (res.response.statusCode && res.response.statusCode == 200) {
let httpData = res.response.data;
if (typeof(httpData) == "string") {
if (typeof (httpData) == "string") {
httpData = JSON.parse(httpData);
}
/*********以下只是模板(及共参考),需要开发者根据各自的接口返回类型修改*********/
@@ -162,17 +162,36 @@ $http.dataFactory = async function(res) {
return Promise.resolve(httpData);
} else if (httpData.code == "401") {
// token失效
// uni.getStorageSync('guidePages') == 2
if (uni.getStorageSync('guidePages') == 2) {
uni.showToast({
title: '登录失效,请重新登录',
icon: 'none'
});
console.log('到这里了')
setTimeout(() => {
uni.navigateTo({
url: "/pages/user/login"
var jump = uni.getStorageSync('isJump') //以下解决多次跳转登录页的重点
if (!jump) {
//以下做token失效的操作
uni.showToast({
title: '登录失效,请重新登录',
icon: 'none'
});
}, 10);
console.log('到这里了')
// setUserInfo({ token: null });
uni.setStorageSync('userInfo', {})
uni.setStorageSync('token', null)
setTimeout(() => {
uni.redirectTo({
url: "/pages/user/login/login"
});
}, 100);
uni.setStorageSync('isJump', 'true')
}
}
} else if (httpData.code == "1000" || httpData.code == "1001" || httpData.code == 1100 || httpData
@@ -252,11 +271,11 @@ $http.dataFactory = async function(res) {
content: content,
confirmText: "去登录",
cancelText: "再逛会",
success: function(res) {
success: function (res) {
loginPopupNum--;
if (res.confirm) {
uni.navigateTo({
url: "/pages/user/login"
url: "/pages/user/login/login"
});
}
}
@@ -294,10 +313,10 @@ $http.dataFactory = async function(res) {
data: res.data
});
} else { //其他错误提示
console.log('httpData at line 297:', httpData)
console.log(httpData.info || httpData.msg)
if (res.isPrompt && res.data.loadAnimate != 'none') {
if (res.isPrompt && res.data.loadAnimate != 'none') {
uni.showToast({
title: httpData.info || httpData.msg,
icon: "none",
@@ -324,7 +343,7 @@ $http.dataFactory = async function(res) {
}
};
// 错误回调
$http.requestError = function(e) {
$http.requestError = function (e) {
// e.statusCode === 0 是参数效验错误抛出的
if (e.statusCode === 0) {
throw e;

View File

@@ -112,11 +112,11 @@ export const setPay = function(payInfo, callback) {
} else if (payInfo.typePay == 'smallPay') {
// 微信小程序支付
httpUrl = 'api/pay/v1/small_pay_sign_wx'
}else if(payInfo.typePay == 'appleiap'){
} else if (payInfo.typePay == 'appleiap') {
// 苹果支付
}
$http.post(httpUrl, payInfo).then(data => {
console.log(data,'data')
console.log(data, 'data')
let payData = {
success: function(res) {
callback && callback({
@@ -126,10 +126,12 @@ export const setPay = function(payInfo, callback) {
console.log('success:' + JSON.stringify(res));
},
fail: function(err) {
callback && callback({
success: false,
data: err
});
console.log('fail:' + JSON.stringify(err));
}
};
@@ -236,18 +238,18 @@ export const getLatLon = function(tip) {
}
// 查看是否有某本书的权限
export const checkBookRight = function(data,callback) {
export const checkBookRight = function(data, callback) {
console.log('接受的值', data)
$http.request({
url: "/book/user/checkUserBook",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data:data,
data: data,
header: { //默认 无 说明请求头1
'Content-Type': 'application/json'
},
}).then(res => {
// console.log(res,'checkBookRight')
if(res.code === 0){
if (res.code === 0) {
callback && callback({
success: true,
data: '有权限'
@@ -264,47 +266,51 @@ export const checkBookRight = function(data,callback) {
// 单独微信支付
export const setWXPay = function(payInfo, callback) {
$http.request({
url: "/pay/placeAnOrder/shoppingPay",
url: "pay/placeAnOrder/shoppingPay",
method: "POST", // POST、GET、PUT、DELETE具体说明查看官方文档
data:payInfo,
data: {
...payInfo,
appName: 'zmzm'
},
header: { //默认 无 说明请求头1
'Content-Type': 'application/json'
},
}).then(res => {
console.log(res,'resshoppingPay')
if(res.code === 0){
console.log(res, 'resshoppingPay')
if (res.code === 0) {
console.log('接下来走微信接口啦')
let payData = {
provider : 'wxpay',
provider: 'wxpay',
orderInfo: {
"appid": res.paramMap.appid , // 微信开放平台 - 应用 - AppId注意和微信小程序、公众号 AppId 可能不一致
"noncestr": res.Map.noncestr, // 随机字符串
"package": res.Map.package, // 固定值
"partnerid": res.paramMap.mchid, // 微信支付商户号
"prepayid": res.Map.prepayid, // 统一下单订单号
"timestamp": res.Map.timestamp, // 时间戳(单位:秒)
"signType": "SHA256-RSA",
"sign": res.Map.sign
},
success(res) {
callback && callback({
success: true,
data: res
});
console.log('success:' + JSON.stringify(res));
},
fail(err) {
callback && callback({
success: false,
data: err
});
console.log('fail:' + JSON.stringify(err));
}
"appid": res.paramMap.appid, // 微信开放平台 - 应用 - AppId注意和微信小程序、公众号 AppId 可能不一致
"noncestr": res.Map.noncestr, // 随机字符串
"package": res.Map.package, // 固定值
"partnerid": res.paramMap.mchid, // 微信支付商户号
"prepayid": res.Map.prepayid, // 统一下单订单号
"timestamp": res.Map.timestamp, // 时间戳(单位:秒)
"signType": "SHA256-RSA",
"sign": res.Map.sign
},
success(res) {
callback && callback({
success: true,
data: res
});
console.log('success:' + JSON.stringify(res));
},
fail(err) {
callback && callback({
success: false,
data: err
});
console.log('微信错误fail:' + JSON.stringify(err));
}
}
// console.log(payData)
if(payData.orderInfo.prepayid != '' && payData.orderInfo.prepayid != undefined){
uni.requestPayment(payData);
if (payData.orderInfo.prepayid != '' && payData.orderInfo.prepayid != undefined) {
uni.requestPayment(payData);
}
}
})
}
}