From 4775cc85f057cf091235b7c26c4037a8eca06391 Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期四, 28 三月 2024 22:40:48 +0800 Subject: [PATCH] # --- pages/api/common/common.js | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/pages/api/common/common.js b/pages/api/common/common.js index e69de29..4b3f3b1 100644 --- a/pages/api/common/common.js +++ b/pages/api/common/common.js @@ -0,0 +1,27 @@ +import md5 from '@/static/js/md5.js' + +async function onLogin(user) { + let _this = this, + item = {}; + var login = await uni.request({ + url: `${baseUrl}/login.action`, + data: { + username: user.username, + password: md5.hex_md5(user.password) + }, + }).then((result) => { + console.log(result); + result = result.data + if (result.code === 200 && result.data.token) { + uni.setStorageSync('token', result.data.token); + } + item = result + }, (res) => { + item = {code: 0} + }) + return item +} + +module.exports = { + onLogin: onLogin +} \ No newline at end of file -- Gitblit v1.9.1