fix:调整demo测试页面

This commit is contained in:
liyi 2025-07-17 10:15:44 +08:00
parent 39a70a768d
commit 32378c2aef
4 changed files with 39 additions and 31 deletions

View File

@ -27,12 +27,12 @@ Page({
onLoad(options) {
const app = getApp();
// 尝试获取全局数据
const lock = app.globalData.lock;
const accountInfo = app.globalData.accountInfo;
console.log('lockDetail onLoad:', { lock, accountInfo });
console.log('lockDetail onLoad:', {lock, accountInfo});
if (!lock || !accountInfo) {
wx.showToast({
@ -158,13 +158,14 @@ Page({
accountInfo: this.data.accountInfo,
lockId: app.globalData.lock.lockId
});
const result = await openDoor({
accountInfo: this.data.accountInfo,
disconnect: true,
type: 'open'
});
console.log('openDoor result', result);
if (result.code === Result.Success.code) {
wx.showToast({
title: '开门成功',
@ -196,8 +197,8 @@ Page({
},
onPassageModeInput(e) {
const { field } = e.currentTarget.dataset;
const { value } = e.detail;
const {field} = e.currentTarget.dataset;
const {value} = e.detail;
this.setData({
[`passageModeForm.${field}`]: value
});
@ -236,7 +237,7 @@ Page({
default:
throw new Error('请选择循环类型');
}
await this._updatePassageModeSetting({
passageMode: parseInt(form.passageMode),
startDate: startTime,
@ -245,7 +246,7 @@ Page({
weekDay,
autoUnlock: parseInt(form.autoUnlock)
});
this.hidePassageMode();
} catch (error) {
wx.showToast({
@ -261,7 +262,7 @@ Page({
accountInfo: this.data.accountInfo,
lockId: this.data.lock.lockId
});
const result = await updateSupportFunctionsWithParams({
accountInfo: this.data.accountInfo,
featureBit: 50,
@ -292,20 +293,20 @@ Page({
accountInfo: this.data.accountInfo,
lockId: this.data.lock.lockId
});
const result = await deleteLock({
accountInfo: this.data.accountInfo
});
if (result.code === Result.Success.code) {
wx.showToast({
title: '删除成功',
icon: 'success'
});
const app = getApp();
app.globalData.lock = null;
setTimeout(() => {
wx.navigateBack();
}, 1500);
@ -321,9 +322,9 @@ Page({
// 通用的API调用方法
async handleApiCall(apiFunc, loadingText = '处理中...') {
const app = getApp();
this.setData({ loading: true });
wx.showLoading({ title: loadingText, mask: true });
this.setData({loading: true});
wx.showLoading({title: loadingText, mask: true});
try {
// 检查锁信息是否存在
if (!app.globalData.lock || !app.globalData.lock.lockId) {
@ -336,7 +337,7 @@ Page({
icon: 'none'
});
} finally {
this.setData({ loading: false });
this.setData({loading: false});
wx.hideLoading();
}
},

View File

@ -4,23 +4,30 @@
"compileType": "plugin",
"libVersion": "latest",
"srcMiniprogramRoot": "miniprogram/",
"appid": "wxf2c491f734bbf82f",
"pluginAppid": "wxf2c491f734bbf82f",
"packOptions": {
"ignore": [],
"include": []
},
"setting": {
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
}
},
"coverView": false,
"postcss": false,
"minified": false,
"enhance": false,
"showShadowRootInWxmlPanel": false,
"packNpmRelationList": [],
"ignoreUploadUnusedFiles": true
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
},
"simulatorPluginLibVersion": {}
"simulatorPluginLibVersion": {},
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wxf2c491f734bbf82f",
"pluginAppid": "wxf2c491f734bbf82f"
}

8
package-lock.json generated
View File

@ -24,7 +24,7 @@
"@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
"pinia": "^2.2.8",
"star-cloud-uni": "^1.0.18",
"star-cloud-uni": "^1.0.22",
"vue": "^3.5.13",
"vue-i18n": "^9.1.9"
},
@ -10046,9 +10046,9 @@
}
},
"node_modules/star-cloud-uni": {
"version": "1.0.18",
"resolved": "https://registry.npmjs.org/star-cloud-uni/-/star-cloud-uni-1.0.18.tgz",
"integrity": "sha512-KvJTm1ilJrHHqYz7Ha/0wACNPQmkvq4bIf1m4wTvvzIvL4aCubeI5UnAlCn938Xgm0L8bg4D+rIAYFvYrcd0Ew==",
"version": "1.0.22",
"resolved": "https://registry.npmjs.org/star-cloud-uni/-/star-cloud-uni-1.0.22.tgz",
"integrity": "sha512-9iJMxGfbe1m6lyLksU7mS4NI7VcUWu4SCu/TRXgJBLbfGrHnSK9Iil1Ym6KApZLR5rQICVYOoqLH+liBrX6z1w==",
"dependencies": {
"buffer": "^6.0.3",
"crc": "^4.3.2",

View File

@ -52,7 +52,7 @@
"@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
"pinia": "^2.2.8",
"star-cloud-uni": "^1.0.18",
"star-cloud-uni": "^1.0.22",
"vue": "^3.5.13",
"vue-i18n": "^9.1.9"
},