diff --git a/App.vue b/App.vue index a6c7d0f..cf7897b 100644 --- a/App.vue +++ b/App.vue @@ -37,6 +37,8 @@ onLaunch: async function() { // 检查强制升级 this.updateMiniProgram() + // 监听蓝牙开关状态 + this.onBluetoothState() // 检查蓝牙权限 const checkResult = await this.checkSetting() console.log(checkResult) diff --git a/manifest.json b/manifest.json index 49f5a2f..6396c8d 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "appid" : "__UNI__933D519", "description" : "", "versionName" : "1.0.0", - "versionCode" : "12", + "versionCode" : "14", "transformPx" : false, /* 小程序特有相关 */ "mp-weixin" : { diff --git a/pages.json b/pages.json index c8331f0..c6faf86 100644 --- a/pages.json +++ b/pages.json @@ -60,7 +60,7 @@ { "path": "pages/updateSafeQuestion/updateSafeQuestion", "style": { - "navigationBarTitleText": "修改安全问题" + "navigationBarTitleText": "安全问题" } }, { diff --git a/pages/home/home.vue b/pages/home/home.vue index 3900ae7..c5eef4d 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -605,6 +605,7 @@ page { .group-name-text { padding: 0 32rpx; + word-break: break-all; } .group-name-line { diff --git a/pages/lockDetail/lockDetail.vue b/pages/lockDetail/lockDetail.vue index 42802ec..506699e 100644 --- a/pages/lockDetail/lockDetail.vue +++ b/pages/lockDetail/lockDetail.vue @@ -279,6 +279,7 @@ export default { font-size: 32rpx; padding: 32rpx 32rpx 0 32rpx; font-weight: bold; + word-break: break-all; } .top { diff --git a/pages/safeQuestion/safeQuestion.vue b/pages/safeQuestion/safeQuestion.vue index fc67494..ef5b978 100644 --- a/pages/safeQuestion/safeQuestion.vue +++ b/pages/safeQuestion/safeQuestion.vue @@ -7,8 +7,7 @@ - + {{item.answer}} 修改 @@ -51,8 +50,10 @@ export default { return } this.routeJump({ - type: 'redirectTo', - name: 'updateSafeQuestion' + name: 'updateSafeQuestion', + params: { + questionAnswer: JSON.stringify(this.questionAnswer) + } }) } } @@ -95,17 +96,10 @@ page { .input { border-radius: 0 0 32rpx 32rpx; - height: 100rpx; - line-height: 100rpx; + line-height: 40rpx; background: #FFFFFF; - padding: 0 32rpx; -} - -.input-placeholder { - height: 100rpx; - font-size: 36rpx; - font-weight: bold; - line-height: 100rpx; + padding: 20rpx 32rpx; + word-break: break-all; } .line { diff --git a/pages/setting/setting.vue b/pages/setting/setting.vue index 94c784e..9149230 100644 --- a/pages/setting/setting.vue +++ b/pages/setting/setting.vue @@ -4,7 +4,7 @@ 名称 - {{currentLockInfo.lockAlias}} + {{currentLockInfo.lockAlias}} diff --git a/pages/updateSafeQuestion/updateSafeQuestion.vue b/pages/updateSafeQuestion/updateSafeQuestion.vue index 598b6f1..c6d1d50 100644 --- a/pages/updateSafeQuestion/updateSafeQuestion.vue +++ b/pages/updateSafeQuestion/updateSafeQuestion.vue @@ -7,7 +7,7 @@ - @@ -16,7 +16,7 @@ - @@ -25,7 +25,7 @@ - 保存 @@ -65,14 +65,29 @@ export default { answer: '' }], show: false, - pending: false + pending: false, + questionAnswer: null } }, computed: { ...mapState(useUserStore, ['userInfo']) }, - onLoad() { + async onLoad (data) { this.getQuestionList() + const questionAnswer = JSON.parse(data.questionAnswer) + if (questionAnswer) { + uni.setNavigationBarTitle({ + title: '安全问题设置' + }) + this.questionAnswer = questionAnswer + this.answer = questionAnswer.map(item => { + return { + question: item.question, + answer: item.answer, + questionId: item.questionId + } + }) + } }, methods: { ...mapActions(useUserStore, ['updateUserInfo']), @@ -113,7 +128,7 @@ export default { ...this.userInfo, haveSafeAnswer: 1 }) - this.backAndToast('设置成功') + this.backAndToast('设置成功', 2) } else { uni.showToast({ title: message, @@ -151,6 +166,18 @@ export default { this.show = true }, async getQuestionList() { + const netWork = await this.getNetworkType() + if(!netWork) { + uni.showModal({ + title: '提示', + content: '未获取到问题列表,请退出重试', + showCancel: false, + success: () => { + uni.navigateBack() + } + }) + return + } const { code, data, message } = await getQuestionListRequest() if(code === 0) { this.questionList = data diff --git a/stores/bluetooth.js b/stores/bluetooth.js index e28f2de..69e57d9 100644 --- a/stores/bluetooth.js +++ b/stores/bluetooth.js @@ -121,8 +121,6 @@ export const useBluetoothStore = defineStore('ble', { if (initResult) { // 更新蓝牙初始化状态 this.updateInitBluetooth(true) - // 监听蓝牙开关状态 - this.onBluetoothState() // 监听蓝牙连接状态 this.onBluetoothConnectStatus() // 监听设备特征值变化 @@ -542,30 +540,33 @@ export const useBluetoothStore = defineStore('ble', { uni.stopBluetoothDevicesDiscovery() }, // 蓝牙状态提示 - getBluetoothStatus() { - if(this.bluetoothStatus === 1) { - uni.showModal({ - title: '提示', - content: '蓝牙尚未打开,请先打开蓝牙', - showCancel: false, - success(res) { - if (res.confirm) { - wx.openSystemBluetoothSetting({ - success (res) { - console.log(res) - } - }) + async getBluetoothStatus () { + if (this.bluetoothStatus === 1) { + const initResult = await this.initBluetooth() + if (!initResult) { + uni.showModal({ + title: '提示', + content: '蓝牙尚未打开,请先打开蓝牙', + showCancel: false, + success (res) { + if (res.confirm) { + wx.openSystemBluetoothSetting({ + success (res) { + console.log(res) + } + }) + } } - } - }) - } else if(this.bluetoothStatus === 2 || this.bluetoothStatus === 3) { + }) + } + } else if (this.bluetoothStatus === 2 || this.bluetoothStatus === 3) { uni.showModal({ title: '提示', content: '小程序蓝牙功能被禁用,请打开小程序蓝牙权限', showCancel: false, confirmText: '去设置', - success(res) { - if(res.confirm) { + success (res) { + if (res.confirm) { uni.openSetting() } } @@ -594,8 +595,6 @@ export const useBluetoothStore = defineStore('ble', { await that.initBluetooth() } else if(that.bluetoothStatus === 3 && bluetooth !== false) { that.bluetoothStatus = 1 - await that.initBluetooth() - that.onBluetoothState() } console.log('蓝牙权限', bluetooth, that.bluetoothStatus) resolve(bluetooth)