From 85e7a0b34be7bb9fce59efe884dc6f54a384ba33 Mon Sep 17 00:00:00 2001 From: weidizhu_admin Date: Tue, 16 Jul 2024 17:00:05 +0800 Subject: [PATCH] bug --- common/api.js | 10 ++- pages/index/detail.vue | 44 ++++++++++-- pages/login/forget.vue | 143 +++++++++++++++++++++++++++++---------- pages/login/register.vue | 2 +- store/modules/api.js | 7 +- 5 files changed, 161 insertions(+), 45 deletions(-) diff --git a/common/api.js b/common/api.js index dfe9c87..a43db07 100644 --- a/common/api.js +++ b/common/api.js @@ -38,10 +38,15 @@ export const getDeviceListDays = (data) => { export const getVersion = (data) => { return post('watch/version/index', data) } -// 获取版本号 +// 获取首页数据 export const getIndexData = (data) => { return post('watch/device/getIndexData', data) } +// 忘记密码 +export const forgotPassword = (data) => { + return post('watch/login/forgotPassword', data) +} + export default { @@ -53,5 +58,6 @@ export default { getDayInfo, getDeviceListDays, getVersion, - getIndexData + getIndexData, + forgotPassword } \ No newline at end of file diff --git a/pages/index/detail.vue b/pages/index/detail.vue index 1d7add8..70ccaab 100644 --- a/pages/index/detail.vue +++ b/pages/index/detail.vue @@ -10,12 +10,12 @@ - + - 疲劳:{{item.data_msg.wear}} - 运动量:{{item.data_msg.amountOfExercise}} + + 运动量:{{item.data_msg.stepCount}} {{item.data_msg.bloodPressureHigh}}/{{item.data_msg.bloodPressureLow}} mmHg @@ -47,9 +47,9 @@ {{item.data_msg[0] / 10}} MET - + 总胆固醇:{{item.data_msg.cholesterol/100}} 甘油三脂:{{item.data_msg.triacylglycerol/100}} - 高密度脂蛋白:{{item.data_msg.highDensity/100}}低密度脂蛋白:{{item.data_msg.lowDensity}} + 密度脂蛋白:高-{{item.data_msg.highDensity/100}} 低-{{item.data_msg.lowDensity/100}} @@ -17,7 +17,13 @@ maxlength="11" placeholder="请输入新密码" isShowPass - > + > + + + + + + { + this.img64 = res.captcha_src; + this.captcha_id = res.captcha_id + }) + }, + getVerCode(){ + if (!this.imgCode) { + uni.showToast({ + icon: 'none', + position: 'bottom', + title: '请输入图形验证码' + }); + return false; + } + + //获取验证码 + if (_this.phoneData == '') { + uni.showToast({ + icon: 'none', + position: 'bottom', + title: '手机号不能为空' + }); + return false; + } + + uni.showToast({ + icon: 'none', + position: 'bottom', + title: '验证码发送中' + }); + + this.$store.dispatch('api/sendSms', { + type:2, + mobile: this.phoneData, + captcha_id: this.captcha_id, + captcha_code: this.imgCode + }).then(res => { + this.$refs.runCode.$emit('runCode'); //触发倒计时(一般用于请求成功验证码后调用) + }) + }, startRePass() { //重置密码 @@ -122,11 +153,18 @@ }); return false; } - console.log("重置密码成功") + _this.isRotate=true setTimeout(function(){ _this.isRotate=false - },3000) + },3000) + this.$store.dispatch('api/forgotPassword', { + mobile: this.phoneData, + password: this.passData, + code: this.verCode + }).then(res => { + this.back() + }) }, back() { uni.navigateBack({ @@ -139,6 +177,43 @@ diff --git a/pages/login/register.vue b/pages/login/register.vue index 9a950b9..8790be6 100644 --- a/pages/login/register.vue +++ b/pages/login/register.vue @@ -103,7 +103,7 @@ // 刷新二维码 reset() { - + this.getImgcode() }, // 获取验证码 diff --git a/store/modules/api.js b/store/modules/api.js index 3c57b9f..95d8f77 100644 --- a/store/modules/api.js +++ b/store/modules/api.js @@ -7,7 +7,8 @@ import { getDayInfo, getDeviceListDays, getVersion, - getIndexData + getIndexData, + forgotPassword } from '@/common/api.js'; let state = { @@ -81,6 +82,10 @@ let state = { const res = await getIndexData(data) return res }, + async forgotPassword({commit}, data) { + const res = await forgotPassword(data) + return res + }, } export default {