From ad426e36604f6e62368a6f16a283822f914932a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BB=96=E5=BE=B7=E4=BA=91?= Date: Tue, 25 Nov 2025 20:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/login.js | 61 ++++++ api/system/user.js | 70 +++++++ pages.json | 10 +- pages/login.vue | 51 ++++- pages_mine/pages/register/index.vue | 277 ++++++++++++++++++++++++++++ 5 files changed, 465 insertions(+), 4 deletions(-) create mode 100644 pages_mine/pages/register/index.vue diff --git a/api/login.js b/api/login.js index 649f59c..ab23460 100644 --- a/api/login.js +++ b/api/login.js @@ -46,6 +46,7 @@ export function logout() { }) } + // 获取验证码 export function getCodeImg() { return request({ @@ -56,4 +57,64 @@ export function getCodeImg() { method: 'get', timeout: 20000 }) +} + +export function sendEmailCode(data, type = 'register') { + return request({ + url: `/auth/mail/send/${type}`, + headers: { + isToken: false + }, + method: 'post', + timeout: 20000, + data, + params: { + autoRegister: data.autoRegister + }, + }) +} + +export function verifyEmailCode(data, type = 'register') { + return request({ + url: `/auth/mail/verify/${type}`, + headers: { + isToken: false + }, + method: 'post', + timeout: 20000, + data, + params: { + autoRegister: data.autoRegister + }, + }) +} + +export function sendPhoneCode(data, type = 'register') { + return request({ + url: `/auth/dySms/send/${type}`, + headers: { + isToken: false + }, + method: 'post', + timeout: 20000, + data, + params: { + autoRegister: data.autoRegister + }, + }) +} + +export function verifyPhoneCode(data, type = 'register') { + return request({ + url: `/auth/dySms/verify/${type}`, + headers: { + isToken: false + }, + method: 'post', + timeout: 20000, + data, + params: { + autoRegister: data.autoRegister + }, + }) } \ No newline at end of file diff --git a/api/system/user.js b/api/system/user.js index d961407..6d340e9 100644 --- a/api/system/user.js +++ b/api/system/user.js @@ -1,6 +1,50 @@ import upload from '@/utils/upload' import request from '@/utils/request' +// 查询用户列表 +export function listUser(query) { + return request({ + url: '/system/user/list', + method: 'get', + params: query + }) +} + +// 查询用户详细 +export function getUser(userId) { + return request({ + url: '/system/user/' + parseStrEmpty(userId), + method: 'get' + }) +} + +// 新增用户 +export function addUser(data) { + return request({ + url: '/system/user', + method: 'post', + data: data + }) +} + +// 修改用户 +export function updateUser(data) { + return request({ + url: '/system/user', + method: 'put', + data: data + }) +} + +// 删除用户 +export function delUser(userId) { + return request({ + url: '/system/user/' + userId, + method: 'delete' + }) +} + + // 用户密码重置 export function updateUserPwd(oldPassword, newPassword) { const data = { @@ -39,3 +83,29 @@ export function uploadAvatar(data) { filePath: data.filePath }) } + +// 用户密码重置 +export function resetUserPwd(userId, password) { + const data = { + userId, + password + } + return request({ + url: '/system/user/resetPwd', + method: 'put', + data: data + }) +} + +// 用户状态修改 +export function changeUserStatus(userId, status) { + const data = { + userId, + status + } + return request({ + url: '/system/user/changeStatus', + method: 'put', + data: data + }) +} diff --git a/pages.json b/pages.json index eb0151b..2b86e0b 100644 --- a/pages.json +++ b/pages.json @@ -60,11 +60,17 @@ "root": "pages_mine/pages", "pages": [ { - "path": "avatar/index", + "path": "register/index", "style": { - "navigationBarTitleText": "修改头像" + "navigationBarTitleText": "注册账号" } }, + { + "path": "avatar/index", + "style": { + "navigationBarTitleText": "修改头像" + } + }, { "path": "info/index", "style": { diff --git a/pages/login.vue b/pages/login.vue index 45befda..855c853 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -23,7 +23,7 @@ const loginForm = ref({ }); function handleLoginByWx() { - getWxCode().then(res => { + getWxCode("__UNI__A6541FF").then(res => { console.log(res); wxLogin('miniapp', res).then(res => { if (res.token != null) { @@ -102,7 +102,7 @@ getCode(); - 若依移动端登录 + 登录 @@ -126,6 +126,11 @@ getCode(); class="login-btn cu-btn block bg-green lg round">微信一键登录 + + + 没有账号? + 立即注册 + 登录即代表同意 @@ -216,4 +221,46 @@ page { } } } +.register-link { + display: flex; + justify-content: center; + align-items: center; + margin-top: 5px; + margin-bottom: 15px; + + .question-text { + color: #606266; + margin-right: 8px; + font-size: 14px; + } + + .link-type { + color: #409EFF; + text-decoration: none; + font-weight: 500; + font-size: 14px; + position: relative; + transition: all 0.3s ease; + + &::after { + content: ''; + position: absolute; + bottom: -2px; + left: 0; + width: 0; + height: 2px; + background-color: #409EFF; + transition: width 0.3s ease; + } + + &:hover { + color: #66b1ff; + + &::after { + width: 100%; + } + } + } +} + diff --git a/pages_mine/pages/register/index.vue b/pages_mine/pages/register/index.vue new file mode 100644 index 0000000..f9a377e --- /dev/null +++ b/pages_mine/pages/register/index.vue @@ -0,0 +1,277 @@ + + + + + \ No newline at end of file