From f2d8e2ed27d047cbb24ae6d60ce46cba08d3ca36 Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Fri, 23 Jan 2026 17:07:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 2 +- config/index.js | 81 +- pages.json | 7 + pages/index/index.vue | 270 ++++-- pages/index/verify_backup_phone.vue | 305 +++++++ pages/my/index.vue | 1312 ++++++++++++++++----------- 6 files changed, 1346 insertions(+), 631 deletions(-) create mode 100644 pages/index/verify_backup_phone.vue diff --git a/App.vue b/App.vue index 06337e4..d612907 100644 --- a/App.vue +++ b/App.vue @@ -24,7 +24,7 @@ // 判断是否是开发环境 if (process.env.NODE_ENV === 'development') { console.log('开发环境,使用模拟登录') - this.mockAccountLogin('songwz', 'Abcd1234') + this.mockAccountLogin('songwz', 'Admin@2025') } else { this.wxH5AuthLogin() } diff --git a/config/index.js b/config/index.js index 621b977..3b3fd2e 100644 --- a/config/index.js +++ b/config/index.js @@ -1,41 +1,42 @@ -// API配置 -export const BASE_URL = 'https://xukoushuniu.115.langye.net' - -// 判断环境(你可以用 process.env.NODE_ENV 或自定义变量) -const IS_PROD = process.env.NODE_ENV === 'production'; - -// API接口地址 -export const API = { - WECHAT_JSSDK_CONFIG: `${BASE_URL}/api/customer/wechat/jssdk-config`, - LOGIN: `${BASE_URL}/api/customer/login-by-code`, - WX_LOGIN: `${BASE_URL}/api/customer/login-by-wechat-code`, - STATISTICS: `${BASE_URL}/api/customer/reservation/statistics`, - LOGIN_ACCOUNT: `${BASE_URL}/api/customer/login`, - GET_USER_INFO: `${BASE_URL}/api/customer/me`, - UPDATE_USER_INFO: `${BASE_URL}/api/customer/profile/update`, - UPLOAD_FILE:`${BASE_URL}/api/customer/upload-file`, - SHIP_CREATE: `${BASE_URL}/api/customer/ship/create`, - SHIP_INDEX: `${BASE_URL}/api/customer/ship/index`, - SHIP_DETAIL: `${BASE_URL}/api/customer/ship/get-one`, - SHIP_PROPERTY_ENUM: `${BASE_URL}/api/customer/ship/get-property-enum`, - SHIP_DELETE: `${BASE_URL}/api/customer/ship/delete`, - RESERVATION_STATUS_ENUM: `${BASE_URL}/api/customer/reservation/get-status-enum`, - RESERVATION_CREATE: `${BASE_URL}/api/customer/reservation/create`, - RESERVATION_LIST: `${BASE_URL}/api/customer/reservation/index`, - AVAILABLE_SHIP: `${BASE_URL}/api/customer/reservation/get-available-ship`, - // GET_PAYMENT_QRCODE: IS_PROD - // ? `${BASE_URL}/api/customer/reservation/get-payment-qrcode` - // : `${BASE_URL}/api/customer/reservation/get-fake-payment-qrcode`, - GET_PAYMENT_QRCODE: `${BASE_URL}/api/customer/reservation/fake-pay`, - FAKE_PAY: `${BASE_URL}/api/customer/reservation/fake-pay`, - NOTIFICATION_LIST: `${BASE_URL}/api/customer/notifications/index`, - CANCEL_RESERVATION: `${BASE_URL}/api/customer/reservation/cancel`, - GET_DIRECTION_ENUM: `${BASE_URL}/api/customer/reservation/get-direction-enum`, - SHIP_UPDATE: `${BASE_URL}/api/customer/ship/update`, - GET_INVOICE: `${BASE_URL}/api/customer/reservation/get-invoice`, - GET_DAILY_RESERVATION_DEADLINE: `${BASE_URL}/api/customer/setting/get-daily-reservation-deadline`, - GET_GEOFENCE_BY_DIRECTION: `${BASE_URL}/api/customer/geofence/get-by-direction`, - GET_WATER_LEVEL: `${BASE_URL}/api/customer/setting/get-water-level`, - GET_UNIT_PRICE: `${BASE_URL}/api/customer/setting/get-unit-price`, - GET_SHIP_INSPECTION_EXAMPLES: `${BASE_URL}/api/customer/setting/get-ship-inspection-examples`, +// API配置 +export const BASE_URL = 'https://xukoushuniu.115.langye.net' + +// 判断环境(你可以用 process.env.NODE_ENV 或自定义变量) +const IS_PROD = process.env.NODE_ENV === 'production'; + +// API接口地址 +export const API = { + WECHAT_JSSDK_CONFIG: `${BASE_URL}/api/customer/wechat/jssdk-config`, + LOGIN: `${BASE_URL}/api/customer/login-by-code`, + WX_LOGIN: `${BASE_URL}/api/customer/login-by-wechat-code`, + STATISTICS: `${BASE_URL}/api/customer/reservation/statistics`, + LOGIN_ACCOUNT: `${BASE_URL}/api/customer/login`, + GET_USER_INFO: `${BASE_URL}/api/customer/me`, + UPDATE_USER_INFO: `${BASE_URL}/api/customer/profile/update`, + UPLOAD_FILE:`${BASE_URL}/api/customer/upload-file`, + SHIP_CREATE: `${BASE_URL}/api/customer/ship/create`, + SHIP_INDEX: `${BASE_URL}/api/customer/ship/index`, + SHIP_DETAIL: `${BASE_URL}/api/customer/ship/get-one`, + SHIP_PROPERTY_ENUM: `${BASE_URL}/api/customer/ship/get-property-enum`, + SHIP_DELETE: `${BASE_URL}/api/customer/ship/delete`, + RESERVATION_STATUS_ENUM: `${BASE_URL}/api/customer/reservation/get-status-enum`, + RESERVATION_CREATE: `${BASE_URL}/api/customer/reservation/create`, + RESERVATION_LIST: `${BASE_URL}/api/customer/reservation/index`, + AVAILABLE_SHIP: `${BASE_URL}/api/customer/reservation/get-available-ship`, + // GET_PAYMENT_QRCODE: IS_PROD + // ? `${BASE_URL}/api/customer/reservation/get-payment-qrcode` + // : `${BASE_URL}/api/customer/reservation/get-fake-payment-qrcode`, + GET_PAYMENT_QRCODE: `${BASE_URL}/api/customer/reservation/fake-pay`, + FAKE_PAY: `${BASE_URL}/api/customer/reservation/fake-pay`, + NOTIFICATION_LIST: `${BASE_URL}/api/customer/notifications/index`, + CANCEL_RESERVATION: `${BASE_URL}/api/customer/reservation/cancel`, + GET_DIRECTION_ENUM: `${BASE_URL}/api/customer/reservation/get-direction-enum`, + SHIP_UPDATE: `${BASE_URL}/api/customer/ship/update`, + GET_INVOICE: `${BASE_URL}/api/customer/reservation/get-invoice`, + GET_DAILY_RESERVATION_DEADLINE: `${BASE_URL}/api/customer/setting/get-daily-reservation-deadline`, + GET_GEOFENCE_BY_DIRECTION: `${BASE_URL}/api/customer/geofence/get-by-direction`, + GET_WATER_LEVEL: `${BASE_URL}/api/customer/setting/get-water-level`, + GET_UNIT_PRICE: `${BASE_URL}/api/customer/setting/get-unit-price`, + GET_SHIP_INSPECTION_EXAMPLES: `${BASE_URL}/api/customer/setting/get-ship-inspection-examples`, + PROFILE_SEND_PHONE_CODE: `${BASE_URL}/api/customer/profile/send-phone-code`, } \ No newline at end of file diff --git a/pages.json b/pages.json index 8a805b4..6603d76 100644 --- a/pages.json +++ b/pages.json @@ -127,6 +127,13 @@ "navigationBarTitleText": "关于我们", "navigationStyle": "custom" } + }, + { + "path": "pages/index/verify_backup_phone", + "style": { + "navigationBarTitleText": "验证备用手机号", + "navigationStyle": "custom" + } } ], "tabBar": { diff --git a/pages/index/index.vue b/pages/index/index.vue index 20f5edf..a3ebed1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -5,59 +5,39 @@ 胥口枢纽闸站状态 - 太湖 - 吃水深度:{{ - statistics.taihu_to_xujiang - ? statistics.taihu_to_xujiang.draft_depth + statistics.min_water_level_minus_06 !== undefined && statistics.min_water_level_minus_06 !== null + ? statistics.min_water_level_minus_06 : "-" }}m - - - - 胥江 - - 吃水深度:{{ - statistics.xujiang_to_taihu - ? statistics.xujiang_to_taihu.draft_depth + >限高高度:{{ + statistics.height_limit_minus_max !== undefined && statistics.height_limit_minus_max !== null + ? statistics.height_limit_minus_max : "-" }}m - + - + @@ -162,7 +142,7 @@ 北向南2025040102准备过闸 --> - + @@ -180,14 +160,14 @@ /> - 交款人类型 + 开票抬头类型 - 个人 + 船号 + + 单位名称 + + 手机号 + + 验证码 + + + + + 您稍后还可以验证一个备用手机号 + 证件号 0) { + return; + } + const token = uni.getStorageSync("token"); + if (!token) { + uni.showToast({ title: "请先登录", icon: "none" }); + return; + } + try { + uni.showLoading({ title: "发送中..." }); + const res = await new Promise((resolve, reject) => { + uni.request({ + url: `${API.PROFILE_SEND_PHONE_CODE}?token=${token}`, + method: "POST", + data: { + phone: this.editForm.phone, + type: "phone", + }, + success: resolve, + fail: reject, + }); + }); + uni.hideLoading(); + if (res.data && res.data.errcode === 0) { + uni.showToast({ title: "验证码已发送", icon: "success" }); + // 开始倒计时 + this.canSendCode = false; + this.countdown = 60; + this.countdownTimer = setInterval(() => { + this.countdown--; + if (this.countdown <= 0) { + clearInterval(this.countdownTimer); + this.countdownTimer = null; + this.canSendCode = true; + } + }, 1000); + } else { + uni.showToast({ + title: (res.data && res.data.errmsg) || "发送失败", + icon: "none", + }); + } + } catch (e) { + uni.hideLoading(); + uni.showToast({ title: "发送失败", icon: "none" }); + } }, validateForm() { if (!this.editForm.name) { @@ -467,7 +555,12 @@ export default { return false; } if (![1, 2].includes(Number(this.editForm.payer_type))) { - uni.showToast({ title: "请选择交款人类型", icon: "none" }); + uni.showToast({ title: "请选择开票抬头类型", icon: "none" }); + return false; + } + // 如果是单位类型,需要填写单位名称 + if (Number(this.editForm.payer_type) === 2 && !this.editForm.company_name) { + uni.showToast({ title: "请输入单位名称", icon: "none" }); return false; } const phoneReg = /^1\d{10}$/; @@ -475,6 +568,11 @@ export default { uni.showToast({ title: "请输入正确的手机号", icon: "none" }); return false; } + // 验证码校验 + if (!this.editForm.phone_code || this.editForm.phone_code.length !== 6) { + uni.showToast({ title: "请输入6位验证码", icon: "none" }); + return false; + } const idReg = /^(?:\d{15}|\d{17}[\dXx])$/; if (!idReg.test(this.editForm.id_card)) { uni.showToast({ title: "请输入正确的证件号", icon: "none" }); @@ -491,16 +589,22 @@ export default { } try { uni.showLoading({ title: "提交中..." }); + const requestData = { + name: this.editForm.name, + payer_type: Number(this.editForm.payer_type), + phone: this.editForm.phone, + phone_code: this.editForm.phone_code, + id_card: this.editForm.id_card, + }; + // 如果是单位类型,添加单位名称 + if (Number(this.editForm.payer_type) === 2) { + requestData.company_name = this.editForm.company_name; + } const res = await new Promise((resolve, reject) => { uni.request({ url: `${API.UPDATE_USER_INFO}?token=${token}`, method: "POST", - data: { - name: this.editForm.name, - payer_type: Number(this.editForm.payer_type), - phone: this.editForm.phone, - id_card: this.editForm.id_card, - }, + data: requestData, success: resolve, fail: reject, }); @@ -509,7 +613,35 @@ export default { if (res.data && res.data.errcode === 0) { uni.showToast({ title: "更新成功", icon: "success" }); this.closeEditPopup(); + // 先重新获取用户信息 await this.fetchUserInfo(); + // 不立即刷新页面,而是提示是否验证备用手机号 + setTimeout(() => { + uni.showModal({ + title: "提示", + content: "是否需要立即验证备用手机号码?", + confirmText: "需要", + cancelText: "稍后再说", + success: (modalRes) => { + if (modalRes.confirm) { + // 跳转到备用手机号验证页面 + uni.navigateTo({ + url: "/pages/index/verify_backup_phone", + success: () => { + console.log("跳转成功"); + }, + fail: (err) => { + console.error("跳转失败:", err); + uni.showToast({ title: "跳转失败,请重试", icon: "none" }); + } + }); + } else { + // 稍后再说,用户信息已经刷新过了 + console.log("用户选择稍后再说"); + } + } + }); + }, 500); } else { uni.showToast({ title: (res.data && res.data.errmsg) || "更新失败", @@ -537,7 +669,7 @@ export default { } }, }); - } + } }; if (!this.userInfo) { this.fetchUserInfo().then(afterCheck).catch(afterCheck); @@ -595,7 +727,7 @@ export default { justify-content: center; align-items: flex-start; width: fit-content; - margin: 2vh auto 0 auto; /* 水平居中 */ + margin: 4vh auto 0 auto; /* 水平居中,往下移动 */ gap: 154rpx; /* 控制每组间距 */ } @@ -624,12 +756,13 @@ export default { display: flex; flex-direction: column; align-items: flex-start; - gap: 4rpx; + gap: 12rpx; margin-top: 8rpx; } .info-value-group .info-value { margin-top: 0; - font-size: 28rpx; + font-size: 36rpx; /* 字号加大 */ + font-weight: 500; } .batch-row-strict { @@ -915,6 +1048,39 @@ export default { .edit-submit-btn::after { border: none; } +.verify-code-row { + display: flex; + align-items: center; + gap: 16rpx; +} +.verify-code-input { + flex: 1; +} +.send-code-btn { + min-width: 180rpx; + height: 80rpx; + line-height: 80rpx; + border-radius: 12rpx; + background: #3b7cff; + color: #fff; + font-size: 24rpx; + border: none; + padding: 0 24rpx; + white-space: nowrap; +} +.send-code-btn::after { + border: none; +} +.send-code-btn:disabled { + background: #ccc; + color: #999; +} +.hint-text { + display: block; + font-size: 24rpx; + color: #999; + margin-top: 12rpx; +} .info-list { background: #fff; border-radius: 24rpx; diff --git a/pages/index/verify_backup_phone.vue b/pages/index/verify_backup_phone.vue new file mode 100644 index 0000000..bae358d --- /dev/null +++ b/pages/index/verify_backup_phone.vue @@ -0,0 +1,305 @@ + + + + + diff --git a/pages/my/index.vue b/pages/my/index.vue index 5c5c975..a3eea71 100644 --- a/pages/my/index.vue +++ b/pages/my/index.vue @@ -1,539 +1,775 @@ - - - - - \ No newline at end of file