代码优化

This commit is contained in:
GaoHao 2024-12-28 17:34:13 +08:00
parent f3615bfbb8
commit 820fb9aea6
7 changed files with 53 additions and 27 deletions

16
App.vue
View File

@ -376,8 +376,18 @@
// //
that.$Request.getT('/app/user/selectNewApp').then(res => { that.$Request.getT('/app/user/selectNewApp').then(res => {
res = res.data[0]; res = res.data[0];
console.log(widgetInfo)
if (widgetInfo.version < res.version && uni.getSystemInfoSync().platform == 'android') { console.log(res)
let version;
if (uni.getSystemInfoSync().platform == 'android') {
version = res.version
}
if (uni.getSystemInfoSync().platform == 'ios') {
version = res.iosVersion
}
version = res.version
// && uni.getSystemInfoSync().platform == 'android'
if (widgetInfo.version < version) {
let downloadLink = ''; let downloadLink = '';
let androidLink = res.androidWgtUrl; let androidLink = res.androidWgtUrl;
let iosLink = res.iosWgtUrl; let iosLink = res.iosWgtUrl;
@ -635,7 +645,7 @@
onShow: function() { onShow: function() {
// #ifdef H5 // #ifdef H5
isH5Android() // isH5Android()
// #endif // #endif
console.log('App Show') console.log('App Show')

View File

@ -1,11 +1,21 @@
const ROOTPATH1 = "https://dj-api.hnsiyao.cn/czg/"; // // APP
const ROOTPATH = "https://dj-api.hnsiyao.cn/czg/"; //后台服务域名 // const ROOTPATH1 = "https://dj-api.hnsiyao.cn/czg/"; //
const ROOTPATH2 = "https://dj-h5.hnsiyao.cn"; //后台服务域名 // const ROOTPATH = "https://dj-api.hnsiyao.cn/czg/"; //后台服务域名
// const ROOTPATH2 = "https://dj-h5.hnsiyao.cn"; //后台服务域名
// const ROOTPATH1 = "https://video.hnsiyao.cn/czg/"; // // const ROOTPATH1 = "https://video.hnsiyao.cn/czg/"; //
// const ROOTPATH = "https://video.hnsiyao.cn/czg/"; //后台服务域名 // const ROOTPATH = "https://video.hnsiyao.cn/czg/"; //后台服务域名
// const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名 // const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名
// h5
const ROOTPATH1 = "https://web.hnsiyao.cn/czg/"; //
const ROOTPATH = "https://web.hnsiyao.cn/czg/"; //后台服务域名
const ROOTPATH2 = "https://dj-h5.hnsiyao.cn"; //后台服务域名
// const ROOTPATH1 = "https://web-api.hnsiyao.cn/czg/"; //
// const ROOTPATH = "https://web-api.hnsiyao.cn/czg/"; //后台服务域名
// const ROOTPATH2 = "https://video-h5.hnsiyao.cn"; //后台服务域名
// const ROOTPATH1 = "http://192.168.1.5:8100/czg/"; // // const ROOTPATH1 = "http://192.168.1.5:8100/czg/"; //
// const ROOTPATH = "http://192.168.1.5:8100/czg/"; //后台服务域名 // const ROOTPATH = "http://192.168.1.5:8100/czg/"; //后台服务域名
// const ROOTPATH2 = "http://192.168.1.5:8100"; //后台服务域名 // const ROOTPATH2 = "http://192.168.1.5:8100"; //后台服务域名

View File

@ -52,6 +52,17 @@ const install = (Vue, vm) => {
}, 1500) }, 1500)
return false; return false;
} else if (res.code == 401) { } else if (res.code == 401) {
// 获取当前页面实例
const pages = getCurrentPages();
// 获取当前页面的实例
const currentPage = pages[pages.length - 1];
// 获取页面路径
const pagePath = currentPage.route
const systemInfo = uni.getSystemInfoSync();
const isIOS = /iOS/.test(systemInfo.platform);
// if ( pagePath == "pages/task/index") {
// return;
// }
// 假设201为token失效这里跳转登录 // 假设201为token失效这里跳转登录
vm.$u.toast('验证失败,请重新登录'); vm.$u.toast('验证失败,请重新登录');
uni.removeStorageSync("token") uni.removeStorageSync("token")

View File

@ -34,9 +34,9 @@ module.exports = {
const pagePath = currentPage.route const pagePath = currentPage.route
const systemInfo = uni.getSystemInfoSync(); const systemInfo = uni.getSystemInfoSync();
const isIOS = /iOS/.test(systemInfo.platform); const isIOS = /iOS/.test(systemInfo.platform);
if ( pagePath == "pages/task/index") { // if ( pagePath == "pages/task/index") {
return; // return;
} // }
uni.removeStorageSync("token") uni.removeStorageSync("token")
uni.removeStorageSync("userId") uni.removeStorageSync("userId")
uni.removeStorageSync("phone") uni.removeStorageSync("phone")
@ -52,9 +52,7 @@ module.exports = {
title: '用户信息失效,请重新登录!', title: '用户信息失效,请重新登录!',
icon: 'none' icon: 'none'
}) })
uni.navigateTo({ uni.navigateTo({ url: "/pages/login/login" })
url: "/pages/login/login"
})
}, },
post: function(url, data, header) { post: function(url, data, header) {
let that = this; let that = this;

View File

@ -340,7 +340,7 @@
uni.setStorageSync('qdCodeion', options.qdCode) uni.setStorageSync('qdCodeion', options.qdCode)
} }
if (uni.getStorageSync('token')) { if (uni.getStorageSync('token')) {
this.$Request.get('/app/common/type/813').then(res => { this.$u.get('/app/common/type/813').then(res => {
if (res.code == 0 && res.data.value) { if (res.code == 0 && res.data.value) {
if (res.data.value == '是') { if (res.data.value == '是') {
this.getActivity() this.getActivity()
@ -418,7 +418,7 @@
//#endif //#endif
if (uni.getStorageSync('token')) { if (uni.getStorageSync('token')) {
this.getMyLoveVideo() this.getMyLoveVideo()
this.$Request.get('/app/common/type/813').then(res => { this.$u.get('/app/common/type/813').then(res => {
if (res.code == 0 && res.data.value) { if (res.code == 0 && res.data.value) {
if (res.data.value == '是') { if (res.data.value == '是') {
this.getActivitys() this.getActivitys()
@ -426,7 +426,7 @@
} }
}) })
// 837 // 837
this.$Request.get('/app/common/type/837').then(res => { this.$u.get('/app/common/type/837').then(res => {
if (res.code == 0 && res.data.value) { if (res.code == 0 && res.data.value) {
this.xxJDNum = res.data.value; this.xxJDNum = res.data.value;
this.checkNewUser() this.checkNewUser()
@ -890,6 +890,7 @@
state: 1 state: 1
} }
this.$u.api.msg(data).then(res => { this.$u.api.msg(data).then(res => {
console.log(res)
if (res.code == 0) { if (res.code == 0) {
this.notice = res.data.list this.notice = res.data.list
res.data.list.forEach(res => { res.data.list.forEach(res => {

View File

@ -285,6 +285,7 @@
title: '正在登录中...', title: '正在登录中...',
}) })
this.$u.post('/app/Login/registerCode?password=' + code + '&phone=' + mobile).then(res => { this.$u.post('/app/Login/registerCode?password=' + code + '&phone=' + mobile).then(res => {
console.log(res)
if (res.code === 0) { if (res.code === 0) {
uni.setStorageSync('token', res.token) uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId) uni.setStorageSync('userId', res.user.userId)
@ -306,13 +307,8 @@
icon: 'none' icon: 'none'
}) })
const arr= getCurrentPages() const arr= getCurrentPages()
if(arr.length<=1){ uni.reLaunch({
return uni.reLaunch({ url:'/pages/index/index'
url:'/pages/index/index'
})
}
uni.navigateBack({
delta: arr.length<=2?1:2
}) })
} else { } else {
uni.hideLoading(); uni.hideLoading();

View File

@ -75,11 +75,11 @@
this.relation = relation; this.relation = relation;
this.invitation = relation; this.invitation = relation;
} }
this.$u.get('/app/common/type/3').then(res => { // this.$u.get('/app/common/type/3').then(res => {
if (res.code == 0) { // if (res.code == 0) {
this.registerCode = res.data.value // this.registerCode = res.data.value
} // }
}); // });
}, },
methods: { methods: {
isShowAgree() { isShowAgree() {