From 233fdc1cc07df94e54036fa421addf1e17cdff83 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期三, 28 二月 2024 10:58:12 +0800
Subject: [PATCH] #

---
 pages/api/common/common.js |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/pages/api/common/common.js b/pages/api/common/common.js
index e69de29..a2b2f18 100644
--- a/pages/api/common/common.js
+++ b/pages/api/common/common.js
@@ -0,0 +1,33 @@
+import md5 from '@/static/js/md5.js'
+
+let network = uni.getStorageSync('Network')
+let baseUrl = ''
+if (network) {
+	baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}`
+}
+console.log(network);
+async function onLogin(user) {
+	let _this = this,
+		item = {};
+	var login = await uni.request({
+		url: `${baseUrl}/login.action`,
+		data: {
+			mobile: 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