master
lion 1 week ago
parent 604b262c3b
commit 2437d21cc4

@ -125,13 +125,17 @@ export default {
this.isWeixinBrowser = /MicroMessenger/i.test(navigator.userAgent) this.isWeixinBrowser = /MicroMessenger/i.test(navigator.userAgent)
// #endif // #endif
}, },
onShow() { async onShow() {
this.fetchDirectionEnum().then(() => { //
this.fetchShipTypeEnum().then(() => { await this.fetchDirectionEnum();
this.fetchShipList(); await this.fetchShipTypeEnum();
}); const hasShip = await this.fetchShipList();
}); if (!hasShip) {
// // fetchShipList
return;
}
//
uni.showModal({ uni.showModal({
title: '提示', title: '提示',
content: '预约前需要先获取您的位置信息', content: '预约前需要先获取您的位置信息',
@ -150,8 +154,9 @@ export default {
} }
} }
}); });
//
this.fetchDailyReservationDeadline(); this.fetchDailyReservationDeadline();
}, },
methods: { methods: {
// //
@ -493,7 +498,10 @@ export default {
}, },
async fetchShipList() { async fetchShipList() {
const token = uni.getStorageSync('token'); const token = uni.getStorageSync('token');
if (!token) return; if (!token) {
uni.showToast({ title: '请先登录', icon: 'none' });
return false;
}
try { try {
const res = await new Promise((resolve, reject) => { const res = await new Promise((resolve, reject) => {
uni.request({ uni.request({
@ -505,28 +513,31 @@ export default {
}); });
if (res.data && res.data.errcode === 0) { if (res.data && res.data.errcode === 0) {
if (!res.data.data) {
if (!res.data.data) { uni.showToast({ title: '暂无船舶信息', icon: 'none', duration: 1500 });
uni.showToast({ title: '暂无船舶信息', icon: 'none' }); setTimeout(() => {
setTimeout(() => { uni.redirectTo({ url: '/pages/index/ship_manage' });
uni.navigateBack(); }, 1000);
uni.navigateTo({ url: '/pages/index/ship_manage' }); return false;
}, 1000); }
return;
}
this.currentShip = { this.currentShip = {
id: res.data.data.id, id: res.data.data.id,
total_length: res.data.data.total_length, total_length: res.data.data.total_length,
total_width: res.data.data.total_width, total_width: res.data.data.total_width,
molded_depth: res.data.data.molded_depth, molded_depth: res.data.data.molded_depth,
ship_number: res.data.data.ship_number, ship_number: res.data.data.ship_number,
total_tonnage: res.data.data.total_tonnage, total_tonnage: res.data.data.total_tonnage,
ship_type: res.data.data.ship_type ship_type: res.data.data.ship_type
}; };
return true;
} else {
uni.showToast({ title: (res.data && res.data.errmsg) || '获取船舶信息失败', icon: 'none' });
return false;
} }
} catch (e) { } catch (e) {
// uni.showToast({ title: '网络错误', icon: 'none' });
return false;
} }
}, },
async fetchDirectionEnum() { async fetchDirectionEnum() {

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>胥口闸站购票</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>胥口闸站购票</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.f93c9f80.js></script><script src=/h5/static/js/index.c970d746.js></script></body></html> document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/h5/static/index.883130ca.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/h5/static/js/chunk-vendors.f93c9f80.js></script><script src=/h5/static/js/index.14b82f73.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save