diff --git a/common/api/user.js b/common/api/user.js index c308bab..af8361c 100644 --- a/common/api/user.js +++ b/common/api/user.js @@ -14,3 +14,36 @@ export const getUserInfo = () => { }); }; +/** + * 获取验证码图片 + * @returns {Promise<{img: string, uuid: string, captchaEnabled: boolean}>} + */ +export const getCaptchaImage = () => { + return uni.$uv.http.get('/captchaImage', { + // 验证码无需 token + custom: { + auth: false, + toast: false + } + }); +}; + +/** + * 登录 + * @param {Object} payload 登录参数 + * @param {string} payload.username 用户名 + * @param {string} payload.password 密码 + * @param {string} [payload.code] 验证码 + * @param {string} [payload.uuid] 验证码唯一标识 + * @returns {Promise} 登录结果 + */ +export const login = (payload) => { + return uni.$uv.http.post('/login', payload, { + custom: { + auth: false, + catch: true, + toast: false + } + }); +}; + diff --git a/pages.json b/pages.json index f25e477..10ad3e6 100644 --- a/pages.json +++ b/pages.json @@ -7,6 +7,13 @@ }, "pages": [ + { + "path": "pages/login/index", + "style": { + "navigationBarTitleText": "登录", + "navigationStyle": "custom" + } + }, { "path": "pages/index/index", "style": { diff --git a/pages/login/index.vue b/pages/login/index.vue new file mode 100644 index 0000000..2698c8c --- /dev/null +++ b/pages/login/index.vue @@ -0,0 +1,390 @@ + + + + + + diff --git a/static/logo.jpg b/static/logo.jpg deleted file mode 100644 index 083426d..0000000 Binary files a/static/logo.jpg and /dev/null differ