diff --git a/core/routes/index.js b/core/routes/index.js index 5dfbcbb29b8816f71b2fafb185243ee68c02c211..2042f7a23008bcfb16624ee853dd185e815e77d7 100644 --- a/core/routes/index.js +++ b/core/routes/index.js @@ -98,6 +98,35 @@ router.get('/getUserInfo', async (req, res) => { data: user[0], }) }) + +// 验证码校验 +router.post('/checkCode', async (req, res) => { + let checkCode = req.body + + if (checkCode.code) { + let codeObj = CodeArr.find(obj => obj.phone == checkCode.phone && obj.code == checkCode.code) + if (codeObj) { + res.send({ + code: 200, + msg: '验证码正确', + }) + } else { + res.send({ + code: 201, + msg: '验证码错误', + }) + } + } else { + res.send({ + code: 203, + msg: '信息有误 请重新输入', + }) + } + +}) + + +// 登录 router.post('/login', async (req, res) => { let { phone, value, codeOrword } = req.body console.log(phone, value, codeOrword) @@ -345,7 +374,16 @@ router.post('/updateUserAvatar', async (req, res) => { msg: '修改成功', }) }) - +// 根据id修改用户密码 +router.post('/updateUserPassword', async (req, res) => { + let { id, password } = req.body + console.log(id,password) + await UserModel.updateOne({ _id: id }, { password: password }) + res.send({ + code: 200, + msg: '修改成功', + }) +}) //获取img路径 @@ -360,17 +398,33 @@ router.post('/getImg', (req, res) => { }) }) }) - -router.post('/deleteUser', async(req, res) => { +// 注销用户 +router.post('/deleteUser', async (req, res) => { let { id } = req.query console.log(id) // 根据id删除用户 await UserModel.deleteOne({ _id: id }) res.send({ - code:200 + code: 200 }) }) - +// 设置新手机号 +router.post('/updateUserPhone', async (req, res) => { + let data = req.body + // 通过id修改手机号 + let date = await UserModel.updateOne({ _id: data.id }, { phone: data.phone }) + if (date) { + res.send({ + code: 200, + msg: '修改成功', + }) + } else { + res.send({ + code: 500, + msg: '修改失败', + }) + } +}) //合并分片 diff --git a/core/upload/BmxGyhay1aOj4qycLgBTawwg.jpg b/core/upload/BmxGyhay1aOj4qycLgBTawwg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6b4321c59d0ff1a23dfa2d940c62d766fa07cd44 Binary files /dev/null and b/core/upload/BmxGyhay1aOj4qycLgBTawwg.jpg differ diff --git a/core/upload/GEIDikUn7v24oGM4y_iYYhWW.jpg b/core/upload/GEIDikUn7v24oGM4y_iYYhWW.jpg new file mode 100644 index 0000000000000000000000000000000000000000..db0b3ba9776dcff42db22491ee2d098376bc217d Binary files /dev/null and b/core/upload/GEIDikUn7v24oGM4y_iYYhWW.jpg differ diff --git a/core/upload/VD2cD0JmV43qtWN2i9ySDRc_.jpg b/core/upload/VD2cD0JmV43qtWN2i9ySDRc_.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1a3443bb9ffbbbe6448e2ad3c55eb0c1f45e5f4a Binary files /dev/null and b/core/upload/VD2cD0JmV43qtWN2i9ySDRc_.jpg differ diff --git a/yunyou_pavilion/src/router/index.js b/yunyou_pavilion/src/router/index.js index 0e42bc0444a4d1f8e1d3dcdff02cf44fd7f269f8..c70ea9d516256535697f09012981c7b9df0f7833 100644 --- a/yunyou_pavilion/src/router/index.js +++ b/yunyou_pavilion/src/router/index.js @@ -174,6 +174,15 @@ const router = createRouter({ name: 'setpassword', component: () => import('../views/SetUser/setPasswoed.vue') }, + { + path: '/setphone', + name: 'setphone', + component: () => import('../views/SetUser/setPhone.vue') + },{ + path: '/uploadphone', + name: 'uploadphone', + component: () => import('../views/SetUser/uploadPhone.vue') + }, { path: '/', component: () => import('../views/TabberAll.vue'), diff --git a/yunyou_pavilion/src/views/SetUser/AccountSecurity.vue b/yunyou_pavilion/src/views/SetUser/AccountSecurity.vue index 55de833e82b9318c8580aa05287f1110285605d8..37f370e9509c8cfd9c2a5c600cfededf2085caba 100644 --- a/yunyou_pavilion/src/views/SetUser/AccountSecurity.vue +++ b/yunyou_pavilion/src/views/SetUser/AccountSecurity.vue @@ -11,7 +11,13 @@