From 6017f46b762663b9393cdae8422e0de1ed3db218 Mon Sep 17 00:00:00 2001
From: guifei zhu <guifeizhu@guifeideiMac.local>
Date: 星期三, 27 十一月 2024 13:30:06 +0800
Subject: [PATCH] 添加mqtt数据接口
---
pages/login/login.vue | 35 +++++++++++++++++++++++++++++++----
1 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 438a26d..c12de54 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -34,8 +34,8 @@
data() {
return {
model: {
- username: "",
- password: ""
+ username: "tongjitang",
+ password: "123456"
},
rules: {
'username': {
@@ -59,17 +59,41 @@
if (account) {
this.model = account
}
+ let _that = this
+ // uni-app瀹㈡埛绔幏鍙杙ush瀹㈡埛绔爣璁�
+ // uni.getPushClientId({
+ // success: (res) => {
+ // let push_clientid = res.cid
+ // _that.model.username = push_clientid
+ // console.log('瀹㈡埛绔帹閫佹爣璇�:', push_clientid)
+ // },
+ // fail(err) {
+ // _that.model.username = err
+ // console.log(err)
+ // }
+ // })
+
+ // uni.onPushMessage((res) => {
+ // _that.model.username = JSON.stringify(res)
+ // console.log("鏀跺埌鎺ㄩ�佹秷鎭細", res) //鐩戝惉鎺ㄩ�佹秷鎭�
+ // })
+
+
},
-
+ computed: {
+ cid() {
+ return this.$store.getters.getCid; // 浣跨敤 getter 鑾峰彇 cid
+ },
+ },
methods: {
+
forget() {
uni.navigateTo({
url: "/pages/tabBar/demo"
})
},
submit() {
-
if (this.model.username.startsWith("http")) {
uni.setStorageSync('baseurl', this.model.username);
this.model.username = null
@@ -88,6 +112,7 @@
this.$api.login(this.model).then((res) => {
if (res.success) {
+
console.log('request success', res)
uni.showToast({
title: '鐧诲綍鎴愬姛',
@@ -99,6 +124,8 @@
uni.setStorageSync('userinfo', res.result.userInfo);
uni.setStorageSync('token', res.result.token);
+
+
uni.switchTab({
url: '/pages/tabBar/general'
})
--
Gitblit v1.9.3