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 | 41 +++++++++++++++++++++++++++++++++--------
1 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/pages/login/login.vue b/pages/login/login.vue
index d1539e1..c12de54 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -51,7 +51,7 @@
trigger: ['blur', 'change']
},
},
-
+
};
},
onLoad() {
@@ -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: {
- methods: {
-
forget() {
uni.navigateTo({
url: "/pages/tabBar/demo"
})
},
- submit() {
+ submit() {
if (this.model.username.startsWith("http")) {
uni.setStorageSync('baseurl', this.model.username);
this.model.username = null
@@ -86,8 +110,8 @@
},
login() {
this.$api.login(this.model).then((res) => {
- if (res.success) {
-
+ if (res.success) {
+
console.log('request success', res)
uni.showToast({
@@ -98,8 +122,9 @@
uni.setStorageSync('account', this.model);
uni.setStorageSync('userinfo', res.result.userInfo);
- uni.setStorageSync('token', res.result.token);
-
+ uni.setStorageSync('token', res.result.token);
+
+
uni.switchTab({
url: '/pages/tabBar/general'
--
Gitblit v1.9.3