bug修复

This commit is contained in:
tx 2024-09-11 18:06:45 +08:00
parent 13dbe41a76
commit 53d2036584
5 changed files with 635 additions and 569 deletions

View File

@ -5,11 +5,11 @@ const install = (Vue, vm) => {
Vue.prototype.$u.http.setConfig({ Vue.prototype.$u.http.setConfig({
// baseUrl: 'http://61.174.243.28:15861', // baseUrl: 'http://61.174.243.28:15861',
// baseUrl: 'http://192.168.2.46:8080', // baseUrl: 'http://192.168.2.46:8080',
baseUrl: 'https://che.chuangtewl.com/prod-api', // baseUrl: 'https://che.chuangtewl.com/prod-api',
// 测试环境 // 测试环境
// baseUrl: 'https://dianche.chuantewulian.cn/prod-api', // baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
// 俞山岛 // 俞山岛
// baseUrl: 'https://dche.ccttiot.com/prod-api', baseUrl: 'https://dche.ccttiot.com/prod-api',
// 创特 // 创特
loadingText: '努力加载中~', loadingText: '努力加载中~',
loadingTime: 10000, loadingTime: 10000,
@ -70,35 +70,35 @@ const install = (Vue, vm) => {
// }) // })
// // return res.result; // // return res.result;
// } // }
if (res.code == 401) { // if (res.code == 401) {
wx.login({ // wx.login({
success(res) { // success(res) {
if (res.code) { // if (res.code) {
console.log('登录!', res); // // console.log('登录!', res);
let areaId = uni.getStorageSync('areaId'); // let areaId = uni.getStorageSync('areaId');
if (areaId) { // if (areaId) {
vm.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then( // vm.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then(
res => { // res => {
uni.hideLoading(); // uni.hideLoading();
if (res.code == 200) { // if (res.code == 200) {
uni.setStorageSync('token', res.token); // uni.setStorageSync('token', res.token);
} else if (res.code == 501) { // } else if (res.code == 501) {
uni.showToast({ // uni.showToast({
title: res.msg, // title: res.msg,
icon: 'none', // icon: 'none',
duration: 2000 // duration: 2000
}); // });
} else { // } else {
uni.navigateTo({ // uni.navigateTo({
url: '/pages/login/login' // url: '/pages/login/login'
}) // })
} // }
}); // });
} // }
} // }
}, // },
}); // });
} // }
return res; return res;
} }

View File

@ -21,7 +21,7 @@ import'./common/css/iconfont.css'
let mpShare = require('uview-ui/libs/mixin/mpShare.js'); let mpShare = require('uview-ui/libs/mixin/mpShare.js');
Vue.mixin(mpShare); Vue.mixin(mpShare);
// import tabbar from '@/pages_admin/components/tab-bar/tab-bar.vue'; // import tabbar from '@/components/tab-bar/tab-bar.vue';
// import customizeAnswer from'@/components/customizeAnswer/customizeAnswer.vue' // import customizeAnswer from'@/components/customizeAnswer/customizeAnswer.vue'
// Vue.use('customizeAnswer',customizeAnswer) // Vue.use('customizeAnswer',customizeAnswer)

View File

@ -1552,14 +1552,12 @@
}, },
deviceInfo(num) { deviceInfo(num) {
if (uni.getStorageSync('token')) {
if (this.sn) { if (this.sn) {
this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { this.$u.get('/app/device/info?sn=' + this.sn).then((res) => {
if (res.code === 200) { if (res.code === 200) {
this.isqrcode = true this.isqrcode = true
this.deviceInfos = res.data; this.deviceInfos = res.data;
this.getlist(res.data.getlist) this.getlist(res.data.modelId)
if (!this.orderinfo.sn) { if (!this.orderinfo.sn) {
this.mac = res.data.mac this.mac = res.data.mac
} }
@ -1659,166 +1657,177 @@
} }
} else { // if (uni.getStorageSync('token')) {
console.log('判断2');
wx.login({
success: (res) => { // } else {
if (res.code) { // console.log('2');
console.log('登录!', res); // uni.navigateTo({
let data = { // url: '/pages/login/login'
wxOpenId: res.code,
};
let areaId = uni.getStorageSync('areaId');
if (areaId) {
this.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' +
areaId)
.then((
res) => {
// uni.hideLoading();
if (res.code == 200) {
uni.setStorageSync('token', res.token);
this.getinfo()
if (this.sn) {
this.$u.get('/app/device/info?sn=' + this.sn)
.then((
res) => {
if (res.code === 200) {
this.isqrcode = true
this.deviceInfos = res.data;
this.getlist(res.data.getlist)
if (num == 0) {
// this.routePlanning(res.data.latitude,
// res.data.longitude)
this.showdevice = true;
this.type = 0;
} else {
// if (this.deviceInfos
// .onlineStatus ==
// 0) {
// uni.showToast({
// title: '线,使',
// icon: 'none',
// duration: 4000
// }); // });
// } else // // wx.login({
if (this.deviceInfos // // success: (res) => {
.status == // // if (res.code) {
0) { // // console.log('', res);
uni.showToast({ // // let data = {
title: '车辆未上架,请使用其他车辆', // // wxOpenId: res.code,
icon: 'none', // // };
duration: 4000 // // let areaId = uni.getStorageSync('areaId');
}); // // if (areaId) {
} else if (this.deviceInfos // // this.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' +
.status == // // areaId)
2) { // // .then((
uni.showToast({ // // res) => {
title: '车辆预约中,请使用其他车辆', // // // uni.hideLoading();
icon: 'none', // // if (res.code == 200) {
duration: 4000 // // uni.setStorageSync('token', res.token);
}); // // this.getinfo()
} else if (this.deviceInfos // // if (this.sn) {
.status == // // this.$u.get('/app/device/info?sn=' + this.sn)
3) { // // .then((
uni.showToast({ // // res) => {
title: '车辆骑行中,请使用其他车辆', // // if (res.code === 200) {
icon: 'none', // // this.isqrcode = true
duration: 4000 // // this.deviceInfos = res.data;
}); // // this.getlist(res.data.modelId)
} else if (this.deviceInfos // // if (num == 0) {
.status == // // // this.routePlanning(res.data.latitude,
4) { // // // res.data.longitude)
uni.showToast({ // // this.showdevice = true;
title: '车辆临时锁车中,请使用其他车辆', // // this.type = 0;
icon: 'none', // // } else {
duration: 4000 // // // if (this.deviceInfos
}); // // // .onlineStatus ==
} else if (this.deviceInfos // // // 0) {
.status == // // // uni.showToast({
6) { // // // title: '线,使',
uni.showToast({ // // // icon: 'none',
title: '车辆调度中,请使用其他车辆', // // // duration: 4000
icon: 'none', // // // });
duration: 4000 // // // } else
}); // // if (this.deviceInfos
} else if (this.deviceInfos // // .status ==
.status == // // 0) {
8) { // // uni.showToast({
uni.showToast({ // // title: ',使',
title: '车辆下线中,请使用其他车辆', // // icon: 'none',
icon: 'none', // // duration: 4000
duration: 4000 // // });
}); // // } else if (this.deviceInfos
} else if (this.deviceInfos // // .status ==
.status == // // 2) {
9) { // // uni.showToast({
uni.showToast({ // // title: ',使',
title: '车辆已废弃,请使用其他车辆', // // icon: 'none',
icon: 'none', // // duration: 4000
duration: 4000 // // });
}); // // } else if (this.deviceInfos
} else if (this.deviceInfos // // .status ==
.status == // // 3) {
7) { // // uni.showToast({
uni.showToast({ // // title: ',使',
title: '车辆未上线,请使用其他车辆', // // icon: 'none',
icon: 'none', // // duration: 4000
duration: 4000 // // });
}); // // } else if (this.deviceInfos
} else if (this.deviceInfos // // .status ==
.status == // // 4) {
1) { // // uni.showToast({
// this.routePlanning(res.data // // title: ',使',
// .latitude, res.data // // icon: 'none',
// .longitude) // // duration: 4000
if (this.areaInfo != res.data // // });
.areaId) { // // } else if (this.deviceInfos
this.getArea() // // .status ==
} // // 6) {
// this.routePlanning(res.data.latitude, res.data.longitude) // // uni.showToast({
setTimeout(() => { // // title: ',使',
this.showdevice = // // icon: 'none',
true // // duration: 4000
this.type = 1; // // });
this.deviceIndex = // // } else if (this.deviceInfos
1; // // .status ==
}, 600) // // 8) {
} // // uni.showToast({
} // // title: '线,使',
} else { // // icon: 'none',
this.showdevice = false; // // duration: 4000
this.deviceIndex = 0; // // });
this.type = 0; // // } else if (this.deviceInfos
uni.showToast({ // // .status ==
title: res.msg, // // 9) {
icon: 'none', // // uni.showToast({
duration: 2000 // // title: ',使',
}); // // icon: 'none',
} // // duration: 4000
}); // // });
// // } else if (this.deviceInfos
// // .status ==
// // 7) {
// // uni.showToast({
// // title: '线,使',
// // icon: 'none',
// // duration: 4000
// // });
// // } else if (this.deviceInfos
// // .status ==
// // 1) {
// // // this.routePlanning(res.data
// // // .latitude, res.data
// // // .longitude)
// // if (this.areaInfo != res.data
// // .areaId) {
// // this.getArea()
// // }
// // // this.routePlanning(res.data.latitude, res.data.longitude)
// // setTimeout(() => {
// // this.showdevice =
// // true
// // this.type = 1;
// // this.deviceIndex =
// // 1;
// // }, 600)
// // }
// // }
// // } else {
// // this.showdevice = false;
// // this.deviceIndex = 0;
// // this.type = 0;
// // uni.showToast({
// // title: res.msg,
// // icon: 'none',
// // duration: 2000
// // });
// // }
// // });
} // // }
} else if (res.code == 501) { // // } else if (res.code == 501) {
uni.showToast({ // // uni.showToast({
title: res.msg, // // title: res.msg,
icon: 'none', // // icon: 'none',
duration: 2000 // // duration: 2000
}); // // });
} else { // // } else {
uni.redirectTo({ // // uni.redirectTo({
url: '/pages/login/login' // // url: '/pages/login/login'
}); // // });
} // // }
}); // // });
// // }
// // }
// // },
// // });
// }
}
}
},
});
}
}, },
mapFun() { mapFun() {
console.log('点击了'); console.log('点击了');
uni.openLocation({ uni.openLocation({
@ -2386,6 +2395,7 @@
}, },
taploadmask(num) { taploadmask(num) {
if(uni.getStorageSync('token')){
this.maskepage = 0 this.maskepage = 0
this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/uRxPPoVoqmnmng6wKlij' this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/uRxPPoVoqmnmng6wKlij'
if (num == 1) { if (num == 1) {
@ -2481,6 +2491,15 @@
} }
}else{
this.seeDetail = true
uni.navigateTo({
url: '/pages/login/login?isindex=true'
});
}
}, },
Binddevice() { Binddevice() {
@ -2967,7 +2986,7 @@
// //
sub1() { sub1() {
// uni.showLoading({}); // uni.showLoading({});
if (uni.getStorageSync('token')) {
let data = { let data = {
userId: this.userId, userId: this.userId,
sn: this.sn, sn: this.sn,
@ -3016,6 +3035,13 @@
} }
} }
}); });
}else{
}
}, },
backDevicecar() { backDevicecar() {
@ -5128,111 +5154,113 @@
} else { } else {
this.seeDetail = true
let that = this;
wx.login({
success(res) {
if (res.code) {
console.log('登录成功!', res);
let areaId = uni.getStorageSync('areaId');
uni.showLoading({
title: '登录中...'
});
that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' +
areaId)
.then(res => {
uni.hideLoading();
if (res.code == 200) {
uni.setStorageSync('token', res.token);
if (that.areaInfo.authentication == 1) {
that.$u.get("/getAppInfo").then(res => {
if (res.code == 200) {
that.userinfo = res.user;
that.$store.commit(
'SET_USERID', res
.user.userId);
if (res.user
.isAuthentication == 0) {
uni.hideLoading()
that.seeDetail = true;
that.tozf = true
uni.navigateTo({ uni.navigateTo({
url: "/page_user/idcard_test" url: '/pages/login/login?isindex=true'
});
} else {
that.seeDetail = true;
that.tozf = true
uni.hideLoading()
console.log('跳转3');
uni.navigateTo({
url: '/page_user/yj?isback=' +
that
.showYjTip
});
that.showYjTip = false
}
} else {
uni.hideLoading()
uni.showToast({
title: '未登录,请登录后尝试',
icon: 'none',
duration: 2000
});
}
});
} else {
that.tozf = true
that.seeDetail = true;
uni.hideLoading()
console.log('跳转4');
uni.navigateTo({
url: '/page_user/yj?isback=' + that
.showYjTip
});
that.showYjTip = false
}
} else if (res.code == 501) {
uni.hideLoading()
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
} else {
uni.hideLoading()
uni.redirectTo({
url: '/pages/login/login'
});
}
}).catch(err => {
uni.hideLoading();
uni.showToast({
title: '请求失败,请稍后重试',
icon: 'none',
duration: 2000
});
console.error('请求失败:', err);
});
} else {
uni.hideLoading()
uni.showToast({
title: '登录失败,请重试',
icon: 'none',
duration: 2000
});
console.error('微信登录失败:', res);
}
},
fail(err) {
uni.hideLoading()
uni.showToast({
title: '微信登录接口调用失败',
icon: 'none',
duration: 2000
});
console.error('微信登录接口调用失败:', err);
}
}); });
// wx.login({
// success(res) {
// if (res.code) {
// console.log('', res);
// let areaId = uni.getStorageSync('areaId');
// uni.showLoading({
// title: '...'
// });
// that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' +
// areaId)
// .then(res => {
// uni.hideLoading();
// if (res.code == 200) {
// uni.setStorageSync('token', res.token);
// if (that.areaInfo.authentication == 1) {
// that.$u.get("/getAppInfo").then(res => {
// if (res.code == 200) {
// that.userinfo = res.user;
// that.$store.commit(
// 'SET_USERID', res
// .user.userId);
// if (res.user
// .isAuthentication == 0) {
// uni.hideLoading()
// that.seeDetail = true;
// that.tozf = true
// uni.navigateTo({
// url: "/page_user/idcard_test"
// });
// } else {
// that.seeDetail = true;
// that.tozf = true
// uni.hideLoading()
// console.log('3');
// uni.navigateTo({
// url: '/page_user/yj?isback=' +
// that
// .showYjTip
// });
// that.showYjTip = false
// }
// } else {
// uni.hideLoading()
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 2000
// });
// }
// });
// } else {
// that.tozf = true
// that.seeDetail = true;
// uni.hideLoading()
// console.log('4');
// uni.navigateTo({
// url: '/page_user/yj?isback=' + that
// .showYjTip
// });
// that.showYjTip = false
// }
// } else if (res.code == 501) {
// uni.hideLoading()
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// });
// } else {
// uni.hideLoading()
// uni.redirectTo({
// url: '/pages/login/login'
// });
// }
// }).catch(err => {
// uni.hideLoading();
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 2000
// });
// console.error('', err);
// });
// } else {
// uni.hideLoading()
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 2000
// });
// console.error('', res);
// }
// },
// fail(err) {
// uni.hideLoading()
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 2000
// });
// console.error('', err);
// }
// });
this.showYjTip = false this.showYjTip = false
@ -5257,10 +5285,17 @@
} }
} else if (num == 5) { } else if (num == 5) {
if (uni.getStorageSync('token')) {
uni.navigateTo({ uni.navigateTo({
url: '/page_user/gzsb' url: '/page_user/gzsb'
}) })
}else{
this.seeDetail = true
uni.navigateTo({
url: '/pages/login/login?isindex=true'
});
}
} else if (num == 6) { } else if (num == 6) {
// console.log(''); // console.log('');
this.sn = '' this.sn = ''

View File

@ -244,10 +244,16 @@
codeButtonText2: '获取验证码', codeButtonText2: '获取验证码',
countdown2: 60, countdown2: 60,
openCode:null, openCode:null,
isindex:false
} }
}, },
onLoad() { onLoad(e) {
this.deptId = uni.getStorageSync('deptId'); this.deptId = uni.getStorageSync('deptId');
if(e.isindex=='true'){
this.isindex=true
}
// this.deptId = 101 // this.deptId = 101
}, },
computed: { computed: {
@ -639,9 +645,16 @@
async ceshi() { async ceshi() {
this.$u.get("/getAppInfo").then((res) => { this.$u.get("/getAppInfo").then((res) => {
console.log('进入跳转'); console.log('进入跳转');
if(this.isindex==true){
uni.navigateBack({
delta: 1 // delta1
});
}else{
uni.navigateTo({ uni.navigateTo({
url: '/pages/index/index' url: '/pages/index/index'
}) })
}
}); });
}, },
} }

View File

@ -586,52 +586,70 @@
// }) // })
// } // }
} else { } else {
let areaId = uni.getStorageSync('areaId');
if (areaId) {
let that = this
wx.login({
success(res) {
if (res.code) {
console.log('登录!', res);
let data = {
wxOpenId: res.code,
};
let areaId = uni.getStorageSync('areaId');
that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' +
areaId).then(
res => {
uni.hideLoading();
if (res.code == 200) {
uni.setStorageSync('token', res.token);
that.getuserInfo()
} else if (res.code == 501) {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 2000
});
} else {
// console.log("",res.data)
uni.redirectTo({ uni.redirectTo({
url: '/pages/login/login' url: '/pages/login/login'
})
}
}); });
} // let areaId = uni.getStorageSync('areaId');
}, // if (areaId) {
// let areaId = uni.getStorageSync('areaId');
// if (areaId) {
// let that = this;
// wx.login({
// success(res) {
// if (res.code) {
// console.log('111', res);
// let data = {
// wxOpenId: res.code,
// };
// let areaId = uni.getStorageSync('areaId');
}); // //
} else { // uni.showModal({
uni.showToast({ // title: '',
title: '请授权位置信息后再尝试', // content: '使',
icon: 'none', // success(modalRes) {
duration: 4000 // if (modalRes.confirm) {
}); // console.log('');
} // //
// that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId)
// .then(res => {
// uni.hideLoading();
// if (res.code == 200) {
// uni.setStorageSync('token', res.token);
// that.getuserInfo();
// } else if (res.code == 501) {
// uni.showToast({
// title: res.msg,
// icon: 'none',
// duration: 2000
// });
// } else {
// uni.redirectTo({
// url: '/pages/login/login'
// });
// }
// });
// } else if (modalRes.cancel) {
// console.log('');
// uni.redirectTo({
// url: '/pages/login/login'
// });
// //
// }
// }
// });
// }
// }
// });
// }
// } else {
// uni.showToast({
// title: '',
// icon: 'none',
// duration: 4000
// });
// }
} }
}); });