|
@@ -1,21 +1,140 @@
|
|
|
import React from "react";
|
|
|
-import { View } from "@tarojs/components";
|
|
|
+import { View, Button } from "@tarojs/components";
|
|
|
import Taro from "@tarojs/taro";
|
|
|
|
|
|
+import { getGlobalData } from "../../config/index";
|
|
|
+
|
|
|
import "./index.scss";
|
|
|
|
|
|
class Team extends React.Component<any, any> {
|
|
|
static defaultProps = {};
|
|
|
- #systemInfo = Taro.getSystemInfoSync();
|
|
|
+// #systemInfo = Taro.getSystemInfoSync();
|
|
|
|
|
|
constructor(props: any) {
|
|
|
super(props);
|
|
|
this.state = {};
|
|
|
}
|
|
|
|
|
|
+ download_template = () => {
|
|
|
+ Taro.showLoading({
|
|
|
+ title: "下载中...",
|
|
|
+ });
|
|
|
+ Taro.downloadFile({
|
|
|
+ url: "https://cxzx.smcic.net/topic/tool/img/%E5%B0%91%E5%84%BF%E4%B9%A6%E7%94%BB%E5%A4%A7%E8%B5%9B/2024%E2%80%9C%E6%88%91%E5%BF%83%E4%B8%AD%E7%9A%84%E9%BB%84%E5%B8%9D%E9%99%B5%E2%80%9D%E9%9D%92%E5%B0%91%E5%B9%B4%E4%B9%A6%E7%94%BB%E6%B4%BB%E5%8A%A8%E5%9B%A2%E4%BD%93%E6%8A%A5%E5%90%8D%E4%BF%A1%E6%81%AF%E8%A1%A8.xlsx",
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ const fs = getGlobalData("FileSystemManager");
|
|
|
+ fs?.access({
|
|
|
+ path: Taro.env.USER_DATA_PATH + "/download",
|
|
|
+ success: () => {
|
|
|
+ console.log("success");
|
|
|
+ fs?.saveFileSync(
|
|
|
+ res.tempFilePath,
|
|
|
+ Taro.env.USER_DATA_PATH +
|
|
|
+ "/download/2024“我心中的黄帝陵”青少年书画活动团体报名信息表.xlsx"
|
|
|
+ );
|
|
|
+ Taro.hideLoading();
|
|
|
+ Taro.showToast({
|
|
|
+ title: "下载成功",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ fs.mkdir({
|
|
|
+ dirPath: Taro.env.USER_DATA_PATH + "/download",
|
|
|
+ success: () => {
|
|
|
+ fs.saveFileSync(
|
|
|
+ res.tempFilePath,
|
|
|
+ Taro.env.USER_DATA_PATH +
|
|
|
+ "/download/2024“我心中的黄帝陵”青少年书画活动团体报名信息表.xlsx"
|
|
|
+ );
|
|
|
+ Taro.hideLoading();
|
|
|
+ Taro.showToast({
|
|
|
+ title: "下载成功",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ console.log("fail");
|
|
|
+ Taro.showToast({
|
|
|
+ title: "暂无权限",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ Taro.hideLoading();
|
|
|
+ Taro.showToast({
|
|
|
+ title: "下载失败",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ update_template = () => {
|
|
|
+ const fs = getGlobalData("FileSystemManager");
|
|
|
+ Taro.showLoading({
|
|
|
+ title: "上传中...",
|
|
|
+ });
|
|
|
+ fs?.access({
|
|
|
+ path: Taro.env.USER_DATA_PATH + "/download/2024“我心中的黄帝陵”青少年书画活动团体报名信息表.xlsx",
|
|
|
+ success: () => {
|
|
|
+ Taro.uploadFile({
|
|
|
+ url: "https://shuhuadasai2024api.smcic.net/upload",
|
|
|
+ filePath: Taro.env.USER_DATA_PATH + "/download/2024“我心中的黄帝陵”青少年书画活动团体报名信息表.xlsx",
|
|
|
+ name: "file",
|
|
|
+ complete: () => {
|
|
|
+ Taro.hideLoading();
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ console.log(res);
|
|
|
+ Taro.showToast({
|
|
|
+ title: "上传成功",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ Taro.showToast({
|
|
|
+ title: "暂无权限",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ Taro.hideLoading();
|
|
|
+ Taro.showToast({
|
|
|
+ title: "暂无模板",
|
|
|
+ icon: "none",
|
|
|
+ });
|
|
|
+ },
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
render() {
|
|
|
// const { } = this.props;
|
|
|
- return <View className="team">123</View>;
|
|
|
+ return (
|
|
|
+ <View className="team">
|
|
|
+ <Button
|
|
|
+ className="btn"
|
|
|
+ style="width: 600rpx;margin-bottom: 2em;margin-top: 0;"
|
|
|
+ onClick={this.download_template}
|
|
|
+ >
|
|
|
+ 下载模板
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ className="btn"
|
|
|
+ style="width: 600rpx;margin-bottom: 2em;margin-top: 0;"
|
|
|
+ onClick={this.update_template}
|
|
|
+ >
|
|
|
+ 批量报名
|
|
|
+ </Button>
|
|
|
+ </View>
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
|