liyongli 1 年之前
父節點
當前提交
4f5ceffb7a

+ 1 - 1
project.private.config.json

@@ -2,7 +2,7 @@
   "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
   "setting": {
     "compileHotReLoad": true,
-    "urlCheck": true
+    "urlCheck": false
   },
   "projectname": "shaoershuhua",
   "condition": {}

+ 9 - 8
src/app.ts

@@ -1,15 +1,16 @@
-import { PropsWithChildren } from 'react'
-import { useLaunch } from '@tarojs/taro'
-import './app.scss'
+import { PropsWithChildren } from "react";
+import { useLaunch, getFileSystemManager } from "@tarojs/taro";
+import { setGlobalData } from "./config/index";
 
-function App({ children }: PropsWithChildren<any>) {
+import "./app.scss";
 
+function App({ children }: PropsWithChildren<any>) {
   useLaunch(() => {
-    console.log('App launched.')
-  })
+    setGlobalData("FileSystemManager", getFileSystemManager() || {});
+  });
 
   // children 是将要会渲染的页面
-  return children
+  return children;
 }
 
-export default App
+export default App;

+ 7 - 0
src/config/index.ts

@@ -0,0 +1,7 @@
+const globalData = {};
+export function setGlobalData(key: string, val: any) {
+  globalData[key] = val;
+}
+export function getGlobalData(key: string) {
+  return globalData[key];
+}

+ 1 - 1
src/pages/application/from.tsx

@@ -250,7 +250,7 @@ class aloneUpdate extends React.Component<any, any> {
     return (
       <View>
         <Text className="label">作者姓名*</Text>
-        <Input className="input" type="text" placeholder="" focus />
+        <Input className="input" type="text" placeholder="" />
         <Text className="label">联系电话*</Text>
         <Input className="input" type="number" placeholder="" />
         <Text className="label">学校班级*</Text>

+ 5 - 0
src/pages/application/index.css

@@ -32,6 +32,7 @@
 }
 
 .application .btn {
+  box-sizing: border-box;
   text-align: center;
   border: 2px solid #91725D;
   width: 5em;
@@ -87,3 +88,7 @@
   transform: translate(-50%, -50%);
   z-index: 10;
 }
+
+.team {
+  padding-top: 1em;
+}

+ 1 - 1
src/pages/application/index.min.css

@@ -1 +1 @@
-.application{width:100%;box-sizing:border-box}.application .bmfs{font-weight:600;color:#734c2c;border:none}.application .bmfs_act{background-color:#d9b98c !important}.application .label{color:#91725D;font-weight:600;font-size:28px;margin:32px 0 0 0;display:block}.application .input{background-color:#fff;padding:0 16px;height:2em;line-height:2em;border-radius:12px 12px 12px 12px;display:block;margin:16px 0}.application .btn{text-align:center;border:2px solid #91725D;width:5em;display:block;margin:75px auto 0 auto;background-color:#d9b98c;color:#fff}.application .areaList{display:flex;justify-content:space-between;padding:5px 0}.application .areaList .areaStyle{flex:1;margin-right:10px;border:1px solid #a3a3a3;border-radius:12px;text-align:center;background-color:#fff;height:2em;line-height:2em}.application .inputEle{background-color:#fff;border-radius:12px;overflow:hidden;padding:20px;margin:22px 0;width:600px;height:119px;display:block;box-sizing:border-box}.application .checkbox-list__label{display:block;margin:22px 0}.application .imgP{position:relative;display:inline-block}.application .imgP .del{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:10}
+.application{width:100%;box-sizing:border-box}.application .bmfs{font-weight:600;color:#734c2c;border:none}.application .bmfs_act{background-color:#d9b98c !important}.application .label{color:#91725D;font-weight:600;font-size:28px;margin:32px 0 0 0;display:block}.application .input{background-color:#fff;padding:0 16px;height:2em;line-height:2em;border-radius:12px 12px 12px 12px;display:block;margin:16px 0}.application .btn{box-sizing:border-box;text-align:center;border:2px solid #91725D;width:5em;display:block;margin:75px auto 0 auto;background-color:#d9b98c;color:#fff}.application .areaList{display:flex;justify-content:space-between;padding:5px 0}.application .areaList .areaStyle{flex:1;margin-right:10px;border:1px solid #a3a3a3;border-radius:12px;text-align:center;background-color:#fff;height:2em;line-height:2em}.application .inputEle{background-color:#fff;border-radius:12px;overflow:hidden;padding:20px;margin:22px 0;width:600px;height:119px;display:block;box-sizing:border-box}.application .checkbox-list__label{display:block;margin:22px 0}.application .imgP{position:relative;display:inline-block}.application .imgP .del{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:10}.team{padding-top:1em}

+ 5 - 0
src/pages/application/index.scss

@@ -33,6 +33,7 @@
   }
 
   .btn {
+    box-sizing: border-box;
     text-align: center;
     border: 2px solid $main-color-light;
     width: 5em;
@@ -89,3 +90,7 @@
     }
   }
 }
+
+.team {
+    padding-top: 1em;
+}

+ 122 - 3
src/pages/application/team.tsx

@@ -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>
+    );
   }
 }
 

+ 10 - 8
src/pages/home/index.tsx

@@ -10,6 +10,9 @@ import { InputBox } from "../../component/input/index";
 
 class Home extends React.Component<any, any> {
   static defaultProps = {};
+  #systemInfo = Taro.getSystemInfoSync();
+  #w = this.#systemInfo.windowWidth - 60;
+  #h = (this.#w / 16) * 9;
 
   constructor(props: any) {
     super(props);
@@ -59,9 +62,6 @@ class Home extends React.Component<any, any> {
 
   render() {
     // const {  } = this.props;
-    const systemInfo = Taro.getSystemInfoSync();
-    const w = systemInfo.screenWidth - 60;
-    const h = (w / 16) * 9;
     const sonEle = (item) => (
       <View>
         <Text className="label">· {item.title} </Text>
@@ -71,22 +71,24 @@ class Home extends React.Component<any, any> {
     return (
       <View className="home">
         <Image
-          style={`width: ${systemInfo.screenWidth}px;height: ${this.state.height}px;`}
+          style={`width: ${this.#systemInfo.screenWidth}px;height: ${
+            this.state.height
+          }px;`}
           src="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/home_top.jpg"
           onLoad={this.getImageSize}
         />
 
         <InputBox>
           <View className="mian">
-            {h && this.state.data.baseVideoUrl && (
+            {this.#h && this.state.data.baseVideoUrl && (
               <Video
                 src={this.state.data.baseVideoUrl || ""}
                 controls={false}
-                style={`width: ${w}px;height: ${h}px;`}
+                style={`width: ${this.#w}px;height: ${this.#h}px;`}
                 autoplay={true}
                 loop
-                muted
-                show-fullscreen-btn={true} show-play-btn={true}
+                show-fullscreen-btn={true}
+                show-play-btn={true}
                 id="video"
               />
             )}