This commit is contained in:
aihe 2024-08-05 00:49:59 +08:00
parent 11609b9f8c
commit fea523a122
3 changed files with 68 additions and 18 deletions

View File

@ -1,20 +1,23 @@
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/ {
// launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数 // launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0", "version" : "0.0",
"configurations": [{ "configurations" : [
"app-plus" :
{ {
"app-plus" : {
"launchtype" : "local" "launchtype" : "local"
}, },
"default" : "default" : {
{
"launchtype" : "local" "launchtype" : "local"
}, },
"mp-weixin" : "mp-weixin" : {
{
"launchtype" : "local" "launchtype" : "local"
}, },
"type" : "uniCloud" "type" : "uniCloud"
},
{
"playground" : "custom",
"type" : "uni-app:app-android"
} }
] ]
} }

View File

@ -3,6 +3,10 @@ import qs from "@/common/libs/qs"
import { saveAs } from "file-saver" import { saveAs } from "file-saver"
// #endif // #endif
// #ifdef APP-PLUS
const appCloudScanner = uni.requireNativePlugin('Ba-Scanner');
// #endif
const tabBarUrls = [ const tabBarUrls = [
'/pages/tabBar/deal/deal', '/pages/tabBar/deal/deal',
@ -78,8 +82,34 @@ const hideLoading = ()=> {
uni.hideLoading(); uni.hideLoading();
} }
const customAppScanCode = ({resolve, reject})=> {
appCloudScanner.onScan(
{
// isContinuous: true,
barcodeFormats: [
// "QR Code"
],
// scanTimeSpace: 2000,
// isShowVibrate: true,
// isShowBeep: false,
hintText: '扫码',
},
(res) => {
console.log("scanCode res========", res)
if (res.result) {
resolve(res.result)
}
}
);
}
const scanCode = ()=> { const scanCode = ()=> {
return new Promise((resolve, reject)=> { return new Promise((resolve, reject)=> {
// #ifdef APP-PLUS
customAppScanCode({resolve, reject})
// #endif
// #ifndef APP-PLUS
uni.scanCode({ uni.scanCode({
onlyFromCamera: false, onlyFromCamera: false,
success: (res) =>{ success: (res) =>{
@ -88,6 +118,7 @@ const scanCode = ()=> {
}, },
fail: reject fail: reject
}) })
// #endif0
}) })
} }

View File

@ -180,6 +180,22 @@
}, },
"uniStatistics" : { "uniStatistics" : {
"enable" : true "enable" : true
},
"nativePlugins" : {
"Ba-Scanner" : {
"__plugin_info__" : {
"name" : "扫码原生插件 - 新(连续扫码、设置格式、任意自定义界面)Ba-Scanner",
"description" : "Ba-Scanner 是一款毫秒级扫码插件,采用Google MLKit。支持连续扫码,持续万次不卡顿;支持自定义任意界面、任意点击事件、权限说明;支持多码、相册、闪光灯、焦距缩放、提示音、震动等等。",
"platforms" : "Android",
"url" : "https://ext.dcloud.net.cn/plugin?id=9669",
"android_package_name" : "uni.UNIBCB0FB5",
"ios_bundle_id" : "uni.UNIBCB0FB5",
"isCloud" : true,
"bought" : 1,
"pid" : "9669",
"parameters" : {}
}
}
} }
}, },
/* 快应用特有相关 */ /* 快应用特有相关 */