测试扫码

This commit is contained in:
weiwei committed 2025-03-20 11:13:28 +08:00
1 parent 012f4f0f7b
commit 1a1a7897f5
3 files changed
+45 -46

No files matched your search

+21 -22
View File
@@ -1,25 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<script src="https://dapp.tmuyun.com/oss-static/app/jcommind.js"></script>
<script>
var coverSupport =
"CSS" in window &&
typeof CSS.supports === "function" &&
(CSS.supports("top: env(a)") || CSS.supports("top: constant(a)"));
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ", viewport-fit=cover" : "") +
'" />'
);
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
<head>
<meta charset="UTF-8" />
<script src="https://dapp.tmuyun.com/oss-static/app/jcommind.js"></script>
<script src="https://g.alicdn.com/gdt/jsapi/1.9.24/index.js"></script>
<script>
var coverSupport =
"CSS" in window && typeof CSS.supports === "function" && (CSS.supports("top: env(a)") || CSS.supports("top: constant(a)"))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ", viewport-fit=cover" : "") +
'" />',
)
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
+24
View File
@@ -5,6 +5,7 @@ import { onLoad, onShow } from "@dcloudio/uni-app"
import { hooks, router } from "@@/index"
import { merchantApi } from "@@/api"
import { filePath } from "@@/utils/file"
// import dd from "gdt-jsapi"
const state = reactive<any>({
pa: {
@@ -32,9 +33,32 @@ const toDetail = async (v: any) => {
router.jump("/pages/merchant/detail", { id: v.id })
}
}
// 扫扫扫
const doScanCode = async () => {
try {
const res = await dd.scan({ type: "all" })
console.log(res)
uni.showToast({
title: JSON.stringify(res),
icon: "none",
})
} catch (error) {
console.log("error", error)
uni.showToast({
title: JSON.stringify(error),
icon: "none",
})
}
}
</script>
<template>
<view class="flex-col-center m-t-40rpx m-x-30rpx">
<view class="w-full text-center sub-text-28 p-y-20rpx rounded-40rpx border-solid border border-#0094ff" @tap="doScanCode">
扫扫测试
</view>
</view>
<crud-layout bg="/static/page/blue-bg.png">
<z-paging
ref="pageRef"
-24
View File
@@ -37,11 +37,6 @@
退出登录
</view>
</view>
<view class="flex-col-center m-t-40rpx m-x-30rpx">
<view class="w-full text-center sub-text-28 p-y-20rpx rounded-40rpx border-solid border border-#0094ff" @tap="doScanCode">
扫扫扫
</view>
</view>
</crud-layout>
</template>
@@ -53,7 +48,6 @@ import { filePath } from "@@/utils/file"
import { hooks, router, constant } from "@@/index"
import { userApi } from "@@/api"
import isDevEnv from "@/sheep/utils/isDevEnv"
import dd from "gdt-jsapi"
interface MenuItem {
text: string
@@ -194,24 +188,6 @@ const onTabMenu = async (v: MenuItem, i: number) => {
}
}
// 扫扫扫
const doScanCode = async () => {
try {
const res = await dd.scan({ type: "all" })
console.log(res)
uni.showToast({
title: JSON.stringify(res),
icon: "none",
})
} catch (error) {
console.log("error", error)
uni.showToast({
title: JSON.stringify(error),
icon: "none",
})
}
}
const getStorageUserInfo = () => {
const tokenKey = constant.storageConstant.TOKEN
const userInfoKey = constant.storageConstant.USERINFO