fix:增加测试代码、更新npm包版本

This commit is contained in:
liyi 2025-04-07 11:48:36 +08:00
parent 675c6337da
commit 150a002560
5 changed files with 120 additions and 51 deletions

View File

@ -14,7 +14,9 @@ const {
starEventOn,
starEventEmit,
getFingerprintList,
getIcCardList
getIcCardList,
customPassword,
updateAdminPassword,
} = requirePlugin('starCloud')
Page({
data: {
@ -25,7 +27,9 @@ Page({
cardNumber: 0,
fingerprintId: -1,
fingerprintNumber: 0,
eventChannel: null
eventChannel: null,
pwdId: -1,
pwdNo: 0,
},
async onLoad() {
init({
@ -175,30 +179,31 @@ Page({
this._icCardOperate(Number(operate)); // 调用实际的逻辑函数
},
async _icCardOperate(operate) {
console.log('this.data', this.data)
const parms = {
type: 'card',
keyId: String(this.data.lock.keyId),
uid: String(this.data.accountInfo.uid),
userCountLimit: 0xFFFF,
operate: operate,
isAdmin: 1,
isAdmin: 0,
isForce: 0,
isRound: 0,
weekDays: [],
startDate: 0,
endDate: 0,
startTime: '00:00',
endTime: '00:00',
weekDays: [1, 2, 3, 4, 5],
startDate: 1743991211000,
endDate: 1745978411000,
// startTime: '12:00',
// endTime: '20:00',
cardId: this.data.cardId,
cardNumber: this.data.cardNumber,
cardName: '测试卡片1',
cardType: 1,
cardName: '15161195',
cardType: 2,
cardUserNo: 999
};
if (operate === 1) {
parms.cardName = '测试卡片2'
}
console.log('parms', parms)
const registerExtendedProductsResult = await registerExtendedProducts(parms)
console.log('registerExtendedProductsResult', registerExtendedProductsResult);
},
@ -243,5 +248,60 @@ Page({
async findAllFingerprint() {
const result = await getFingerprintList({lockId: this.data.lock.lockId})
console.log('findAllFingerprint', result)
},
customPasswordOperate(e) {
const operate = e.currentTarget.dataset.operate;
this._customPasswordOperate(Number(operate)); // 调用实际的逻辑函数
},
async _customPasswordOperate(operate) {
await selectLock({
accountInfo: this.data.accountInfo,
lockId: this.data.lock.lockId
})
const parms = {
accountInfo: this.data.accountInfo,
password: {
keyboardPwdName: '测试密码',
keyboardPwdType: 3,
keyboardPwd: 123456,
addType: 2,
isCoerced: 2,
startDate: 1743997466000,
endDate: 1743997646000,
operate: operate,
pwdRight: 0,
lockId: this.data.lock.lockId,
}
};
if (parms.password.operate === 1 || parms.password.operate === 2) {
parms.password.keyboardPwdId = this.data.pwdId
parms.password.pwdNo = this.data.pwdNo
parms.password.keyboardPwd = 112233
parms.password.keyboardPwdName = '测试密码1'
}
const result = await customPassword(parms);
if (parms.password.operate === 0) {
this.data.pwdId = result.data.keyboardPwdId
this.data.pwdNo = result.data.pwdNo
}
console.log('customPassword', result)
},
setAdminPasswordOperate(e) {
const operate = e.currentTarget.dataset.operate;
this._setAdminPasswordOperate(Number(operate)); // 调用实际的逻辑函数
},
async _setAdminPasswordOperate(operate) {
await selectLock({
accountInfo: this.data.accountInfo,
lockId: this.data.lock.lockId
})
const parms = {
accountInfo: this.data.accountInfo,
uid: String(this.data.accountInfo.uid),
adminPwd: '11223345'
};
const reslut= await updateAdminPassword(parms);
console.log('_setAdminPasswordOperate', reslut)
}
})

View File

@ -19,4 +19,8 @@
<button wx:if="{{lock}}" bind:tap="fingerprintOperate" data-operate="2">删除指纹</button>
<button wx:if="{{lock}}" bind:tap="fingerprintOperate" data-operate="3">删除全部指纹</button>
<button wx:if="{{lock}}" bind:tap="findAllFingerprint" >查询指纹列表</button>
<button wx:if="{{lock}}" bind:tap="setAdminPasswordOperate" data-operate="0">设置管理员密码</button>
<button wx:if="{{lock}}" bind:tap="customPasswordOperate" data-operate="0">添加自定义密码</button>
<button wx:if="{{lock}}" bind:tap="customPasswordOperate" data-operate="1">修改自定义密码</button>
<button wx:if="{{lock}}" bind:tap="customPasswordOperate" data-operate="2">删除自定义密码</button>
</view>

View File

@ -21,5 +21,6 @@
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
},
"simulatorPluginLibVersion": {}
}

80
package-lock.json generated
View File

@ -23,11 +23,8 @@
"@dcloudio/uni-mp-weixin": "3.0.0-4030620241128001",
"@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
"buffer": "^6.0.3",
"crc": "^4.3.2",
"js-md5": "^0.8.3",
"pinia": "^2.2.8",
"sm-crypto": "^0.3.13",
"star-cloud-uni": "^1.0.11",
"vue": "^3.5.13",
"vue-i18n": "^9.1.9"
},
@ -9018,9 +9015,9 @@
}
},
"node_modules/pinia": {
"version": "2.2.8",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.2.8.tgz",
"integrity": "sha512-NRTYy2g+kju5tBRe0oNlriZIbMNvma8ZJrpHsp3qudyiMEA8jMmPPKQ2QMHg0Oc4BkUyQYWagACabrwriCK9HQ==",
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/pinia/-/pinia-2.3.1.tgz",
"integrity": "sha512-khUlZSwt9xXCaTbbxFYBKDc/bWAGWJjOgvxETwkTN7KRm66EeT1ZdZj6i2ceh9sP2Pzqsbc704r2yngBrxBVug==",
"license": "MIT",
"dependencies": {
"@vue/devtools-api": "^6.6.3",
@ -9030,45 +9027,15 @@
"url": "https://github.com/sponsors/posva"
},
"peerDependencies": {
"@vue/composition-api": "^1.4.0",
"typescript": ">=4.4.4",
"vue": "^2.6.14 || ^3.5.11"
"vue": "^2.7.0 || ^3.5.11"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
},
"typescript": {
"optional": true
}
}
},
"node_modules/pinia/node_modules/vue-demi": {
"version": "0.14.10",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
"hasInstallScript": true,
"license": "MIT",
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/pirates": {
"version": "4.0.6",
"resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz",
@ -10078,6 +10045,17 @@
"node": ">=10"
}
},
"node_modules/star-cloud-uni": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/star-cloud-uni/-/star-cloud-uni-1.0.11.tgz",
"integrity": "sha512-4FrCDxiMka+vCG9ac9yvBJAIxHy3FqTOykdGaIrzzztU3pbWo8W+4ASkrvfP9mIVs35UoKPN94OBsGGUGNN40g==",
"dependencies": {
"buffer": "^6.0.3",
"crc": "^4.3.2",
"js-md5": "^0.8.3",
"sm-crypto": "^0.3.13"
}
},
"node_modules/statuses": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
@ -10856,6 +10834,32 @@
}
}
},
"node_modules/vue-demi": {
"version": "0.14.10",
"resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz",
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
"hasInstallScript": true,
"license": "MIT",
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/vue-i18n": {
"version": "9.14.2",
"resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-9.14.2.tgz",

View File

@ -51,8 +51,8 @@
"@dcloudio/uni-mp-weixin": "3.0.0-4030620241128001",
"@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
"star-cloud-uni": "^1.0.7",
"pinia": "^2.2.8",
"star-cloud-uni": "^1.0.11",
"vue": "^3.5.13",
"vue-i18n": "^9.1.9"
},