This commit is contained in:
2025-09-14 00:21:54 +08:00
commit d40b3bbd62
766 changed files with 36275 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
.weui-cell__bd {
min-height: 24px;
word-break: break-all;
}

View File

@@ -0,0 +1,54 @@
const __templateJs = require("./templates.js");
const __mergePageOptions = require("../../util/mergePageOptions.js");
Page(__mergePageOptions({
onShareAppMessage() {
return {
title: '扫码',
path: 'packageAPI/pages/scan-code/scan-code'
};
},
data: {
apiData: {
content: '',
success: false,
fail: false,
complete: false
},
content: ''
},
resetApiData() {
this.setData({
apiData: {
success: false,
fail: false,
complete: false,
content: ''
}
});
},
updateApiData(type, content) {
const apiData = {
...this.data.apiData
};
apiData[type] = true;
apiData.content = content;
this.setData({
apiData
});
},
scanCode() {
xhs.scanCode({
success: res => {
this.setData({
content: JSON.stringify(res)
});
},
fail: res => {
this.updateApiData('fail', res);
},
complete: res => {
this.updateApiData('complete', res);
}
});
}
}, __templateJs));

View File

@@ -0,0 +1,8 @@
{
"navigationBarTitleText": "扫码",
"usingComponents": {
"showbox": "../../common/component/showbox/index",
"box": "../../common/component/container/index",
"api-status": "../../common/component/api-status/index"
}
}

View File

@@ -0,0 +1,12 @@
<view class="container">
<showbox title="扫码">
<box>
<view class="_text_wrap _mb8">扫码结果:{{content}}</view>
<view>
<button class="_ui-button" hover-class="_ui-button-hover" bindtap="scanCode">扫一扫</button>
</view>
</box>
</showbox>
</view>
<include src="templates.xhsml" />

View File

@@ -0,0 +1,58 @@
/** 以下内容为自动生成,请勿手动修改 */
module.exports = {
data: {
page_data_0: "",
page_data_1: "",
page_data_2: false,
page_data_3: false,
page_data_4: false,
page_data_5: "",
},
page_fun_1(e) {
this.setData("page_data_0", e.detail.value);
},
page_fun_2(e) {
this.setData("page_data_1", e.detail.value);
},
page_fun_0() {
this.setData({
page_data_2: false,
page_data_3: false,
page_data_4: false,
});
xhs.scanCode({
success: (res) => {
console.log("success", res);
this.setData({
page_data_2: true,
page_data_5: JSON.stringify(res),
});
},
fail: (res) => {
console.log("fail", res);
this.setData({
page_data_3: true,
page_data_5: JSON.stringify(res),
});
},
complete: (res) => {
console.log("complete", res);
this.setData({
page_data_4: true,
});
},
onlyFromCamera: this.data.page_data_0,
scanType: this.data.page_data_1,
});
},
};

View File

@@ -0,0 +1,33 @@
<!-- 以下内容为自动生成,请勿手动修改 -->
<view class="container">
<showbox title="scanCode演示">
<box>
<api-status
success="{{page_data_2}}"
complete="{{page_data_4}}"
fail="{{page_data_3}}"
text="{{page_data_5}}"
>
</api-status>
<view class="_ui-space _mt8">
<view class="_dflex _jc_space-between">
<text class="_dflex _ai_center _px8">是否开启onlyFromCamera</text>
<switch color="rgba(255, 36, 66, 1)" bindchange="page_fun_1" />
</view>
<view class="_ui-input">
<input placeholder="scanType" type="text" bindinput="page_fun_2" />
</view>
<button
class="_ui-button"
hover-class="_ui-button-hover"
bindtap="page_fun_0"
>
触发
</button>
</view>
</box>
</showbox>
</view>