feat: 打卡签到
This commit is contained in:
8
dist/base.wxml
vendored
8
dist/base.wxml
vendored
@@ -129,6 +129,14 @@
|
|||||||
</image>
|
</image>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template name="tmpl_0_57">
|
||||||
|
<video src="{{i.p33}}" duration="{{i.p10}}" controls="{{xs.b(i.p6,!0)}}" danmu-list="{{i.p8}}" danmu-btn="{{i.p7}}" enable-danmu="{{i.p12}}" autoplay="{{xs.b(i.p4,!1)}}" loop="{{xs.b(i.p16,!1)}}" muted="{{xs.b(i.p17,!1)}}" initial-time="{{xs.b(i.p15,0)}}" page-gesture="{{xs.b(i.p19,!1)}}" direction="{{i.p9}}" show-progress="{{xs.b(i.p30,!0)}}" show-fullscreen-btn="{{xs.b(i.p27,!0)}}" show-play-btn="{{xs.b(i.p29,!0)}}" show-center-play-btn="{{xs.b(i.p26,!0)}}" enable-progress-gesture="{{xs.b(i.p14,!0)}}" object-fit="{{xs.b(i.p18,'contain')}}" poster="{{i.p22}}" show-mute-btn="{{xs.b(i.p28,!1)}}" bindplay="eh" bindpause="eh" bindended="eh" bindtimeupdate="eh" bindfullscreenchange="eh" bindwaiting="eh" binderror="eh" animation="{{i.p1}}" bindanimationstart="eh" bindanimationiteration="eh" bindanimationend="eh" bindtransitionend="eh" title="{{i.p34}}" play-btn-position="{{xs.b(i.p21,'bottom')}}" enable-play-gesture="{{xs.b(i.p13,false)}}" auto-pause-if-navigate="{{xs.b(i.p2,true)}}" auto-pause-if-open-native="{{xs.b(i.p3,true)}}" vslide-gesture="{{xs.b(i.p35,false)}}" vslide-gesture-in-fullscreen="{{xs.b(i.p36,true)}}" ad-unit-id="{{i.p0}}" poster-for-crawler="{{i.p23}}" show-casting-button="{{xs.b(i.p25,false)}}" picture-in-picture-mode="{{xs.b(i.p20,[])}}" enable-auto-rotation="{{xs.b(i.p11,false)}}" show-screen-lock-button="{{xs.b(i.p31,false)}}" show-snapshot-button="{{xs.b(i.p32,false)}}" show-background-playback-button="{{xs.b(i.p24,false)}}" background-poster="{{i.p5}}" bindprogress="eh" bindloadedmetadata="eh" bindcontrolstoggle="eh" bindenterpictureinpicture="eh" bindleavepictureinpicture="eh" bindseekcomplete="eh" bindadload="eh" bindaderror="eh" bindadclose="eh" bindadplay="eh" style="{{i.st}}" class="{{i.cl}}" bindtap="eh" id="{{i.uid||i.sid}}" data-sid="{{i.sid}}">
|
||||||
|
<block wx:for="{{i.cn}}" wx:key="sid">
|
||||||
|
<template is="{{xs.e(cid+1)}}" data="{{i:item,l:l}}" />
|
||||||
|
</block>
|
||||||
|
</video>
|
||||||
|
</template>
|
||||||
|
|
||||||
<template name="tmpl_0_8">
|
<template name="tmpl_0_8">
|
||||||
<block>{{i.v}}</block>
|
<block>{{i.v}}</block>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
2
dist/pages/home/index.js
vendored
2
dist/pages/home/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -13,23 +13,46 @@ import Taro from "@tarojs/taro";
|
|||||||
import { getCurrentInstance } from "@tarojs/taro";
|
import { getCurrentInstance } from "@tarojs/taro";
|
||||||
import React, { useCallback, useEffect, useState } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
import "./index.scss";
|
import "./index.scss";
|
||||||
|
import { Uploader } from "@antmjs/vantui";
|
||||||
|
|
||||||
const CheckIn = () => {
|
const CheckIn = () => {
|
||||||
const formIt = Form.useForm();
|
const formIt = Form.useForm();
|
||||||
const [bottomheight, setbottomheight] = useState(0);
|
const [bottomheight, setbottomheight] = useState(0);
|
||||||
let newBottom =0
|
|
||||||
|
const [value, setValue] = useState([
|
||||||
|
// {
|
||||||
|
// url: "https://img.yzcdn.cn/vant/leaf.jpg",
|
||||||
|
// name: "图片1",
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// url: "https://img.yzcdn.cn/vant/tree.jpg",
|
||||||
|
// },
|
||||||
|
]);
|
||||||
|
|
||||||
|
const afterRead = (event) => {
|
||||||
|
const { file, name } = event.detail;
|
||||||
|
// 可在此处新增云上传图片操作
|
||||||
|
console.log("file", file);
|
||||||
|
setValue(value.concat(file));
|
||||||
|
uploadTaro([file?.url]);
|
||||||
|
};
|
||||||
|
|
||||||
|
const deleteAction = (event) => {
|
||||||
|
const { index } = event.detail;
|
||||||
|
const valueNew = JSON.parse(JSON.stringify(value));
|
||||||
|
valueNew.splice(index, 1);
|
||||||
|
setValue(valueNew);
|
||||||
|
};
|
||||||
|
|
||||||
|
let newBottom = 0;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const { screenHeight, safeArea = {} } = Taro.getSystemInfoSync();
|
const { screenHeight, safeArea = {} } = Taro.getSystemInfoSync();
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
newBottom = screenHeight - safeArea?.bottom ?? 0;
|
newBottom = screenHeight - safeArea?.bottom ?? 0;
|
||||||
setbottomheight(newBottom);
|
setbottomheight(newBottom);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
let $instance: any = getCurrentInstance();
|
|
||||||
const { fileID } = $instance?.router?.params;
|
|
||||||
console.log("fileID---", fileID);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// 设置标题
|
// 设置标题
|
||||||
definePageConfig({
|
definePageConfig({
|
||||||
@@ -37,6 +60,31 @@ const CheckIn = () => {
|
|||||||
});
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
let $instance: any = getCurrentInstance();
|
||||||
|
const { fileID } = $instance?.router?.params;
|
||||||
|
console.log("fileID---", fileID);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if ($instance?.router?.params?.fileID) {
|
||||||
|
uploadTaro([fileID]);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const uploadTaro = (tempFilePaths: any) => {
|
||||||
|
// 云开发存储文件 [/自动创建文件路径]
|
||||||
|
Taro.cloud.uploadFile({
|
||||||
|
cloudPath: `images/dev/${new Date()?.getTime()}.png`,
|
||||||
|
filePath: tempFilePaths?.[0], // 文件路径
|
||||||
|
success: (res: any) => {
|
||||||
|
console.log("res", res?.fileID);
|
||||||
|
},
|
||||||
|
fail: (err: any) => {
|
||||||
|
// handle error
|
||||||
|
console.log("err", err);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="CheckIn">
|
<View className="CheckIn">
|
||||||
<Form
|
<Form
|
||||||
@@ -49,9 +97,12 @@ const CheckIn = () => {
|
|||||||
form={formIt}
|
form={formIt}
|
||||||
onFinish={(errs, res) => console.info(errs, res)}
|
onFinish={(errs, res) => console.info(errs, res)}
|
||||||
>
|
>
|
||||||
|
{/* 图片 */}
|
||||||
<View>
|
<View>
|
||||||
<Image width="100%" height="500px" fit="cover" src={fileID} />
|
<Image width="100%" height="500px" fit="cover" src={fileID} />
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
{/* 留言 */}
|
||||||
<FormItem
|
<FormItem
|
||||||
label="留言"
|
label="留言"
|
||||||
name="userName"
|
name="userName"
|
||||||
@@ -68,14 +119,30 @@ const CheckIn = () => {
|
|||||||
// renderRight={<Icon name="user-o" />}
|
// renderRight={<Icon name="user-o" />}
|
||||||
>
|
>
|
||||||
<Field
|
<Field
|
||||||
// label="留言"
|
// label="留言"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
placeholder="请输入留言"
|
placeholder="分享你的心情和故事吧~"
|
||||||
autosize={{ minHeight: "30px" }}
|
autosize={{ minHeight: "100px" }}
|
||||||
border={false}
|
border={true}
|
||||||
/>
|
/>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
<View style={{ bottom: `${bottomheight ?? 0}px` }}>
|
|
||||||
|
{/* 文件上传 */}
|
||||||
|
{/* <Uploader
|
||||||
|
fileList={value}
|
||||||
|
onAfterRead={afterRead}
|
||||||
|
onDelete={deleteAction}
|
||||||
|
deletable
|
||||||
|
maxCount={1}
|
||||||
|
/> */}
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
bottom: `${bottomheight ?? 0}px`,
|
||||||
|
position: "fixed",
|
||||||
|
width: "95%",
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Button type="primary" block>
|
<Button type="primary" block>
|
||||||
提交
|
提交
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import "./index.scss";
|
|||||||
import { Search } from "@antmjs/vantui";
|
import { Search } from "@antmjs/vantui";
|
||||||
import ActiveCard from "../components/ActiveCard";
|
import ActiveCard from "../components/ActiveCard";
|
||||||
import { Dialog } from "@antmjs/vantui";
|
import { Dialog } from "@antmjs/vantui";
|
||||||
|
import { Loading } from '@antmjs/vantui'
|
||||||
|
|
||||||
|
|
||||||
const Home = () => {
|
const Home = () => {
|
||||||
// const { images } = COMMON
|
// const { images } = COMMON
|
||||||
@@ -63,8 +65,36 @@ const Home = () => {
|
|||||||
// getTableid(objParams);
|
// getTableid(objParams);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const uploadTaro=(tempFilePaths:any)=>{
|
||||||
|
|
||||||
|
// 云开发存储文件 [/自动创建文件路径]
|
||||||
|
Taro.cloud.uploadFile({
|
||||||
|
cloudPath: `images/dev/${new Date()?.getTime()}.png`,
|
||||||
|
filePath: tempFilePaths?.[0], // 文件路径
|
||||||
|
success: (res: any) => {
|
||||||
|
// get resource ID
|
||||||
|
console.log("res", res.fileID);
|
||||||
|
|
||||||
|
// 跳转到目的页面,打开新页面
|
||||||
|
// Taro.navigateTo({
|
||||||
|
// url: `/pages/home/components/CheckIn/index?fileID=${res?.fileID}`,
|
||||||
|
// });
|
||||||
|
|
||||||
|
// Toast.success({
|
||||||
|
// message: "打卡成功",
|
||||||
|
// selector: "#vanToast-demo2",
|
||||||
|
// });
|
||||||
|
},
|
||||||
|
fail: (err: any) => {
|
||||||
|
// handle error
|
||||||
|
console.log("err", err);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View className="homeContent">
|
<View className="homeContent">
|
||||||
|
{/* <Loading type="spinner" /> */}
|
||||||
<View>
|
<View>
|
||||||
<Dialog
|
<Dialog
|
||||||
id="vanDialog3"
|
id="vanDialog3"
|
||||||
@@ -161,30 +191,11 @@ const Home = () => {
|
|||||||
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
|
||||||
let tempFilePaths = res.tempFilePaths;
|
let tempFilePaths = res.tempFilePaths;
|
||||||
console.log("tempFilePaths===", tempFilePaths);
|
console.log("tempFilePaths===", tempFilePaths);
|
||||||
|
Taro.navigateTo({
|
||||||
// 云开发存储文件 [/自动创建文件路径]
|
url: `/pages/home/components/CheckIn/index?fileID=${tempFilePaths?.[0]}`,
|
||||||
Taro.cloud.uploadFile({
|
|
||||||
cloudPath: `images/dev/${new Date()?.getTime()}.png`,
|
|
||||||
filePath: tempFilePaths?.[0], // 文件路径
|
|
||||||
success: (res: any) => {
|
|
||||||
// get resource ID
|
|
||||||
console.log("res", res.fileID);
|
|
||||||
|
|
||||||
// 跳转到目的页面,打开新页面
|
|
||||||
Taro.navigateTo({
|
|
||||||
url: `/pages/home/components/CheckIn/index?fileID=${res?.fileID}`,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Toast.success({
|
|
||||||
// message: "打卡成功",
|
|
||||||
// selector: "#vanToast-demo2",
|
|
||||||
// });
|
|
||||||
},
|
|
||||||
fail: (err: any) => {
|
|
||||||
// handle error
|
|
||||||
console.log("err", err);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
// uploadTaro(tempFilePaths)
|
||||||
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
|||||||
Reference in New Issue
Block a user