feat: 长按二维码识别

This commit is contained in:
eric
2022-11-26 15:10:39 +08:00
parent 0555fb9392
commit 77975ae7f2
12 changed files with 136 additions and 78 deletions

View File

@@ -28,4 +28,11 @@
padding: 10px;
align-items: center;
// justify-content: space-between;
}
.wechatCode{
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}

View File

@@ -1,5 +1,5 @@
import { Button, Cell, Toast } from "@antmjs/vantui";
import { RichText, View } from "@tarojs/components";
import { Button, Cell, Dialog, Toast } from "@antmjs/vantui";
import { Input, RichText, View } from "@tarojs/components";
import Taro, { getCurrentInstance, useShareTimeline } from "@tarojs/taro";
import react, { useEffect, useState } from "react";
import {
@@ -23,6 +23,9 @@ const details = () => {
const [isCheckin, setisCheckin] = useState(false); // 是否报名
const [openId, setopenId] = useState("");
const [show, setShow] = react.useState(false);
const [value, setValue] = react.useState("");
useEffect(() => {
// 设置标题
definePageConfig({
@@ -86,7 +89,7 @@ const details = () => {
id: id,
okFun: (res) => {
console.log("res", res);
setdataSource((res?.data ?? []));
setdataSource(res?.data ?? []);
},
};
getTableid(objParams); //指定活动详情id
@@ -134,6 +137,7 @@ const details = () => {
});
}
};
return (
<View className={`detailContent`}>
<View>
@@ -214,6 +218,38 @@ const details = () => {
<RichText nodes={dataSource?.richText} />
</View>
<View>
<Dialog
id="vanDialog3"
title="长按二维码识别"
// showCancelButton
// confirmButtonOpenType="getUserInfo"
show={show}
onClose={() => setShow(false)}
>
<View
className="wechatCode"
onClick={() => {
// Taro.previewImage({
// // current: 'cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/未命名码.png', // 当前显示图片的http链接
// urls: ['cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/未命名码.png'] // 需要预览的图片http链接列表
// })
}}
>
{" "}
<Image
showMenuByLongpress={true}
width={300}
height={300}
src="cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/未命名码.png"
// src='cloud://citynew-0givkbre03955d8c.6369-citynew-0givkbre03955d8c-1253655588/images/touxiang/download-1.jpg'
></Image>
</View>
</Dialog>
<Cell title="组件调用" onClick={() => setShow(true)} />
</View>
<View
className={`detailBtn`}
style={{ bottom: `${bottomheight ?? 0}px` }}
@@ -315,6 +351,7 @@ const details = () => {
{/* 立即参加 */}
{btnContent()}
</Button>
<Toast id="vanToast-demo2" />
</View>
</View>

View File

@@ -548,14 +548,16 @@ const Home = () => {
{/* 个人小程序无法打开公众号文章 */}
{/* <WebView src="https://mp.weixin.qq.com/s/LkjkAWW9VUB90KoyZpI5Fg" onMessage={() => {}} /> */}
<View onClick={()=>{
{/* <View onClick={()=>{
Taro.requestSubscribeMessage({
tmplIds:["oyY-sN3yBm4JRch1PoT-Cj7049c9vyZAMs1LwnUma4I"], //模板id
success:(res:any)=>{
console.log('res',res)
}
})
}}></View>
}}>订阅消息</View> */}
<Toast id="vanToast-demo2" />
<TabbarCom active={0} />