From 8304eac2a45a32b00563c03a2f3fd303ecd5872a Mon Sep 17 00:00:00 2001
From: zhuguifei <zhuguifei@zhuguifeideiMac.local>
Date: 星期五, 22 八月 2025 13:54:36 +0800
Subject: [PATCH] 1.解决微信小程序真机MQTT无法连接问题
---
pages/login/login.vue | 68 +++++++++++++++++++++++++---------
1 files changed, 50 insertions(+), 18 deletions(-)
diff --git a/pages/login/login.vue b/pages/login/login.vue
index af74294..416fbe6 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -2,7 +2,7 @@
<template>
<view class="contaier">
<view class="top-bg">
- <view class="text-white text-bold text-xxxl">鏅鸿兘涓崏鑽共鐕ュ皬绋嬪簭绯荤粺</view>
+ <view class="text-white text-bold text-xxxl">鍏版郸<text @longpress="showModal">鏅鸿兘</text>骞茬嚗</view>
<view class="margin-top-xs text-white">娆㈣繋浣跨敤锛岃鍏堢櫥褰�</view>
</view>
<u-form labelPosition="left" :model="model" ref="form">
@@ -22,17 +22,27 @@
<view class="padding margin-top-xs">
<button @click="submit" class="cu-btn block round bg-login-zl margin-tb-sm lg">绔嬪嵆鐧诲綍</button>
<view class="text-gray flex justify-between padding-lr-sm">
- <text>娉ㄥ唽璐﹀彿</text>
- <text>蹇樿瀵嗙爜</text>
+ <!-- <text @click="switchMode">灞�鍩熺綉妯″紡</text> -->
+ <!-- <text>蹇樿瀵嗙爜</text> -->
</view>
</view>
</u-form>
+
+ <u-modal :show="show" title="鎻愮ず" @confirm="handleSwitchMode">
+ <view class="slot-content">
+ <u-input v-model="pass" style="width: 100%;" placeholder="璇疯緭鍏ョ鐞嗗憳瀵嗙爜" border="surround" password
+ clearable></u-input>
+ </view>
+ </u-modal>
+
</view>
</template>
<script>
export default {
data() {
return {
+ show: false,
+ pass: "",
model: {
username: "",
password: ""
@@ -54,28 +64,54 @@
};
},
+
onLoad() {
const account = uni.getStorageSync('account');
if (account) {
this.model = account
}
-
},
+ mounted() {
+ setTimeout(() => {
+ //this.model.username = this.clientPushId
+ }, 1000)
+ },
+ computed: {
+ clientPushId() {
+ return this.$store.getters.getClientPushId;
+ },
+ },
methods: {
- forget() {
+ showModal() {
+ this.pass = ""
+ this.show = true
+ },
+ handleSwitchMode() {
+ this.show = false
+ if (this.pass === 'lanbaoit') {
+ this.switchMode()
+ }
+ },
+ switchMode() {
uni.navigateTo({
- url: "/pages/tabBar/demo"
+ url: "/packageA/pages/login/switchMode"
})
},
+ forget() {
+
+ },
submit() {
-
- if (this.model.username.startsWith("http")) {
- uni.setStorageSync('baseurl', this.model.username);
- this.model.username = null
- uni.$u.toast('閰嶇疆baseUrl鎴愬姛,璇烽��鍑虹▼搴忛噸鏂板惎鍔▇')
- return false;
+ const mode = uni.getStorageSync('mode');
+ //棣栨鐧诲綍娌℃湁閰嶇疆锛岄粯璁や负浜戞湇鍔℃ā寮�
+ if (!mode) {
+ uni.setStorageSync('mode', 'cloud');
}
+ const curMode = uni.getStorageSync('mode');
+
+ getApp().globalData.mode = curMode;
+
+
this.$refs.form.validate().then(res => {
this.login()
@@ -87,14 +123,12 @@
login() {
this.$api.login(this.model).then((res) => {
if (res.success) {
-
- console.log('request success', res)
uni.showToast({
title: '鐧诲綍鎴愬姛',
icon: 'success',
mask: true
});
-
+ //缂撳瓨淇℃伅
uni.setStorageSync('account', this.model);
uni.setStorageSync('userinfo', res.result.userInfo);
uni.setStorageSync('token', res.result.token);
@@ -116,9 +150,7 @@
console.log('request fail', err);
})
},
- onReset(e) {
- console.log(e)
- }
+
},
onReady() {
//onReady 涓簎ni-app鏀寔鐨勭敓鍛藉懆鏈熶箣涓�
--
Gitblit v1.9.3