From 4b250d5acb8afefe3af4989ed9a6dd8935586c79 Mon Sep 17 00:00:00 2001 From: king <2229249788@qq.com> Date: Tue, 1 Aug 2023 14:54:53 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=9C=AC=E5=9C=B0=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=202.=E4=BF=AE=E6=94=B9=E8=A7=81=E9=9D=A2=E4=BC=9A?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app.config.ts | 4 +- .../showModel/showModel.module.scss | 14 ++- src/components/showModel/showModel.tsx | 2 +- src/pages/business/test/test.tsx | 11 +-- src/pages/business/userInfo/userInfo.tsx | 12 +-- src/pages/business/videoInfo/videoInfo.tsx | 5 +- src/pages/check/check.tsx | 9 +- src/pages/manage/addStudent/addStudent.tsx | 11 +-- src/pages/manage/bingUser/bingUser.tsx | 27 ++---- src/pages/manage/depAdmin/depAdmin.tsx | 9 +- .../spotMeeting.config.ts} | 0 .../spotMeeting.module.scss} | 0 .../spotMeeting.tsx} | 87 ++++++++++--------- .../student.config.ts} | 0 .../college.scss => student/student.scss} | 0 .../college.tsx => student/student.tsx} | 6 +- src/pages/my/components/header/service.tsx | 9 +- src/pages/my/my.tsx | 21 ++--- 18 files changed, 95 insertions(+), 132 deletions(-) rename src/pages/manage/{offline/offline.config.ts => spotMeeting/spotMeeting.config.ts} (100%) rename src/pages/manage/{offline/offline.module.scss => spotMeeting/spotMeeting.module.scss} (100%) rename src/pages/manage/{offline/offline.tsx => spotMeeting/spotMeeting.tsx} (72%) rename src/pages/manage/{college/college.config.ts => student/student.config.ts} (100%) rename src/pages/manage/{college/college.scss => student/student.scss} (100%) rename src/pages/manage/{college/college.tsx => student/student.tsx} (92%) diff --git a/src/app.config.ts b/src/app.config.ts index 206d523..faea8ab 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -54,12 +54,12 @@ export default defineAppConfig({ root: 'pages/manage', pages: [ 'depAdmin/depAdmin', - 'college/college', + 'student/student', 'curriculum/curriculum', 'addStudent/addStudent', 'depCur/depCur', 'addCur/addCur', - 'offline/offline', + 'spotMeeting/spotMeeting', 'bingUser/bingUser', ] } diff --git a/src/components/showModel/showModel.module.scss b/src/components/showModel/showModel.module.scss index b535516..cc79a1c 100644 --- a/src/components/showModel/showModel.module.scss +++ b/src/components/showModel/showModel.module.scss @@ -1,11 +1,19 @@ .operation { display: flex; - justify-content: space-around; - padding: 20px 0; + justify-content: space-between; width: 100%; border-top: 1px solid #eee; & > * { - background: red; + padding: 20px 0; + flex: 1; + width: 50%; + text-align: center; + color: #45D4A8; + + &:first-child { + color: #000; + border-right: 1px solid #ddd; + } } } diff --git a/src/components/showModel/showModel.tsx b/src/components/showModel/showModel.tsx index ae27cb8..3a31772 100644 --- a/src/components/showModel/showModel.tsx +++ b/src/components/showModel/showModel.tsx @@ -15,7 +15,7 @@ interface Props { const ShowModel: FC = (pros) => { return ( - {pros.title} + {pros.title} {pros.children} 取消 diff --git a/src/pages/business/test/test.tsx b/src/pages/business/test/test.tsx index b6b59ca..3f684ca 100644 --- a/src/pages/business/test/test.tsx +++ b/src/pages/business/test/test.tsx @@ -1,7 +1,7 @@ import {Button, View} from "@tarojs/components"; import {getCurrentInstance} from "@tarojs/runtime"; import {curriculum} from "@/api"; -import {FC, useEffect, useState} from "react"; +import {useEffect, useState} from "react"; import ShortAnswer from "@/components/topic/shortAnswer"; import Judge from "@/components/topic/judge"; import Multi from "@/components/topic/multi"; @@ -111,12 +111,5 @@ const Test = () => { ) } -const TestProfile: FC = () => { - return ( - - - - ) -} -export default TestProfile +export default Test diff --git a/src/pages/business/userInfo/userInfo.tsx b/src/pages/business/userInfo/userInfo.tsx index 7c25715..d15c1cf 100644 --- a/src/pages/business/userInfo/userInfo.tsx +++ b/src/pages/business/userInfo/userInfo.tsx @@ -1,4 +1,4 @@ -import {FC, useState} from "react"; +import {useState} from "react"; import {Profile} from '@/store' import avatar from "@/static/img/avatar.png" import PopPut from "@/components/popPut/popPut"; @@ -68,12 +68,4 @@ const List = () => { } -const userInfo: FC = () => { - return ( - - - - ) -} - -export default userInfo +export default List diff --git a/src/pages/business/videoInfo/videoInfo.tsx b/src/pages/business/videoInfo/videoInfo.tsx index ebe0377..299ea44 100644 --- a/src/pages/business/videoInfo/videoInfo.tsx +++ b/src/pages/business/videoInfo/videoInfo.tsx @@ -2,7 +2,6 @@ import {Image, Text, View} from "@tarojs/components"; import {FC, useCallback, useEffect, useState} from "react"; import {CourseDepData, curriculum} from "@/api"; import './videoInfo.scss' -import {Profile} from '@/store' import Catalogue from "./components/catalogue"; import Course from "./components/course"; import Taro from "@tarojs/taro"; @@ -91,7 +90,7 @@ const VideoInfo: FC = () => { return ( - + <> {playId ? @@ -112,7 +111,7 @@ const VideoInfo: FC = () => { - + ) } diff --git a/src/pages/check/check.tsx b/src/pages/check/check.tsx index e431e75..3d033f8 100644 --- a/src/pages/check/check.tsx +++ b/src/pages/check/check.tsx @@ -79,12 +79,5 @@ const Bing: FC = () => { ) } -const Index: FC = () => { - return ( - - - - ); -} -export default Index; +export default Bing; diff --git a/src/pages/manage/addStudent/addStudent.tsx b/src/pages/manage/addStudent/addStudent.tsx index 1258aee..5397ab8 100644 --- a/src/pages/manage/addStudent/addStudent.tsx +++ b/src/pages/manage/addStudent/addStudent.tsx @@ -1,5 +1,5 @@ import {Button, Form, Input, View} from "@tarojs/components"; -import {FC, useEffect, useState} from "react"; +import {useEffect, useState} from "react"; import {ManageApi, Student} from "@/api/manage"; import Icon from "@/components/icon"; import Taro from "@tarojs/taro"; @@ -144,12 +144,5 @@ const AddStudent = () => { ) } -const AddPage: FC = () => { - return ( - - - - ) -} -export default AddPage +export default AddStudent diff --git a/src/pages/manage/bingUser/bingUser.tsx b/src/pages/manage/bingUser/bingUser.tsx index 36a3103..cea0f0b 100644 --- a/src/pages/manage/bingUser/bingUser.tsx +++ b/src/pages/manage/bingUser/bingUser.tsx @@ -9,6 +9,14 @@ const BingUser: FC = () => { const {setUser, setToken, setCompany} = Profile.useContainer() const router = useRouter() + useLoad(() => { + if (!router.params.ticket) { + Taro.reLaunch({ + url: "/pages/index/index" + }) + } + }) + // Taro.useLoad(() => { // const time = Date.now() @@ -82,22 +90,5 @@ const BingUser: FC = () => { ) } -const BingUserIndex = () => { - const router = useRouter() - - useLoad(() => { - if (!router.params.ticket) { - Taro.reLaunch({ - url: "/pages/index/index" - }) - } - }) - - return ( - - - - ) -} -export default BingUserIndex +export default BingUser diff --git a/src/pages/manage/depAdmin/depAdmin.tsx b/src/pages/manage/depAdmin/depAdmin.tsx index 4898665..1f54fdb 100644 --- a/src/pages/manage/depAdmin/depAdmin.tsx +++ b/src/pages/manage/depAdmin/depAdmin.tsx @@ -234,12 +234,5 @@ const DepAdmin: FC = () => { ) } -const DepAdminIndex: FC = () => { - return ( - - - - ) -} -export default DepAdminIndex +export default DepAdmin diff --git a/src/pages/manage/offline/offline.config.ts b/src/pages/manage/spotMeeting/spotMeeting.config.ts similarity index 100% rename from src/pages/manage/offline/offline.config.ts rename to src/pages/manage/spotMeeting/spotMeeting.config.ts diff --git a/src/pages/manage/offline/offline.module.scss b/src/pages/manage/spotMeeting/spotMeeting.module.scss similarity index 100% rename from src/pages/manage/offline/offline.module.scss rename to src/pages/manage/spotMeeting/spotMeeting.module.scss diff --git a/src/pages/manage/offline/offline.tsx b/src/pages/manage/spotMeeting/spotMeeting.tsx similarity index 72% rename from src/pages/manage/offline/offline.tsx rename to src/pages/manage/spotMeeting/spotMeeting.tsx index dbb4bb9..84a8dd5 100644 --- a/src/pages/manage/offline/offline.tsx +++ b/src/pages/manage/spotMeeting/spotMeeting.tsx @@ -1,6 +1,6 @@ import {FC, useCallback, useEffect, useState} from "react"; import {Image, Picker, View} from "@tarojs/components"; -import styles from './offline.module.scss' +import styles from './spotMeeting.module.scss' import Taro from "@tarojs/taro"; import {curriculum} from "@/api"; import {formatDate} from "@/utils/time"; @@ -8,7 +8,7 @@ import {getSetting, authorize} from "@tarojs/taro"; import PopPut from "@/components/popPut/popPut"; import MyButton from "@/components/button/MyButton"; -const Offline: FC = () => { +const SpotMeeting: FC = () => { const [manages, setManages] = useState([]) const [start, setStart] = useState(formatDate(new Date(), "YY-MM-dd 08:00:00")) const [end, setEnd] = useState(formatDate(new Date(), "YY-MM-dd 18:00:00")) @@ -17,23 +17,20 @@ const Offline: FC = () => { const [depid, setDepid] = useState(null) const [isDownloading, setDownloading] = useState(false) - Taro.useLoad(() => { + + useEffect(() => { curriculum.department().then(res => { setManages(res.data) }) - }) + }, []) useEffect(() => { - if (!depid) { + if (!depid || isDownloading) { return } - if (isDownloading) { - return; - } - + Taro.showLoading() setDownloading(true) - const startTime = new Date(start).getTime() const endTime = new Date(end).getTime() const path = encodeURIComponent("/pages/meeting/meeting") @@ -42,6 +39,7 @@ const Offline: FC = () => { if (process.env.TARO_ENV === 'h5') { setTempFilePath(qrcodeUrl) + setDownloading(false) } else { Taro.downloadFile({ url: qrcodeUrl, @@ -56,6 +54,7 @@ const Offline: FC = () => { } }) } + Taro.hideLoading() }, [depid]) function change(e) { @@ -65,38 +64,41 @@ const Offline: FC = () => { const handleWriteFile = useCallback(() => { if (tempFilePath == null) { Taro.showToast({title: '下载失败', icon: 'error'}) - } else if (process.env.TARO_ENV !== 'h5') { - Taro.saveImageToPhotosAlbum({ - filePath: tempFilePath, - success() { - Taro.showModal({title: '下载成功'}) - }, - fail() { - Taro.showToast({title: '下载失败', icon: 'error'}) - } - }) - } else { - Taro.showToast({title: '请截屏', icon: 'error'}) + return } + Taro.saveImageToPhotosAlbum({ + filePath: tempFilePath, + success() { + Taro.showModal({title: '下载成功'}) + }, + fail() { + Taro.showToast({title: '下载失败', icon: 'error'}) + } + }) + }, [tempFilePath]) const handleSaveCode = useCallback(() => { - getSetting({ - success: function ({authSetting}) { - //没有权限则申请 - if (!authSetting["scope.writePhotosAlbum"]) { - authorize({ - scope: "scope.writePhotosAlbum", - success: () => { - //存储二维码 - handleWriteFile() - }, - }); - } else { - handleWriteFile() - } - }, - }); + if (process.env.TARO_ENV === 'h5') { + Taro.showToast({title: '请截屏', icon: 'error'}) + } else { + getSetting({ + success: function ({authSetting}) { + //没有权限则申请 + if (!authSetting["scope.writePhotosAlbum"]) { + authorize({ + scope: "scope.writePhotosAlbum", + success: () => { + //存储二维码 + handleWriteFile() + }, + }); + } else { + handleWriteFile() + } + }, + }); + } }, [tempFilePath]); @@ -126,11 +128,14 @@ const Offline: FC = () => { onError={(e) => setError(e.detail.errMsg)} style={{width: '80%'}} /> - {error && {error}}` - 下载 + {error && {error}} + + {process.env.TARO_ENV !== 'h5' && 下载} + {process.env.TARO_ENV === 'h5' && 请截图保存} + } ) } -export default Offline +export default SpotMeeting diff --git a/src/pages/manage/college/college.config.ts b/src/pages/manage/student/student.config.ts similarity index 100% rename from src/pages/manage/college/college.config.ts rename to src/pages/manage/student/student.config.ts diff --git a/src/pages/manage/college/college.scss b/src/pages/manage/student/student.scss similarity index 100% rename from src/pages/manage/college/college.scss rename to src/pages/manage/student/student.scss diff --git a/src/pages/manage/college/college.tsx b/src/pages/manage/student/student.tsx similarity index 92% rename from src/pages/manage/college/college.tsx rename to src/pages/manage/student/student.tsx index 798b364..5ac49b2 100644 --- a/src/pages/manage/college/college.tsx +++ b/src/pages/manage/student/student.tsx @@ -2,10 +2,10 @@ import {getCurrentInstance} from "@tarojs/runtime"; import {curriculum, RecordData} from "@/api"; import {useEffect, useState} from "react"; import {View, Progress, CustomWrapper} from "@tarojs/components"; -import './college.scss' +import './student.scss' import Taro from "@tarojs/taro"; -const College = () => { +const Student = () => { const {id, name} = getCurrentInstance()?.router?.params as any const [data, setData] = useState([]) @@ -36,4 +36,4 @@ const College = () => { ) } -export default College +export default Student diff --git a/src/pages/my/components/header/service.tsx b/src/pages/my/components/header/service.tsx index 001e133..46a1d8f 100644 --- a/src/pages/my/components/header/service.tsx +++ b/src/pages/my/components/header/service.tsx @@ -6,6 +6,7 @@ import styles from '../../my.module.scss' import dep from '@/static/img/dep.png' import buy from '@/static/img/buy.png' import cur from '@/static/img/cur.png' +import userInfo from '@/static/img/userInfo.png' interface List { title: string; @@ -15,8 +16,8 @@ interface List { const Service = () => { const [list, setList] = useState([ - {title: '学习记录', src: cur, router: '/pages/business/history/history'}, - {title: '设置', src: dep, router: '/pages/business/userInfo/userInfo'}, + {title: '历史记录', src: cur, router: '/pages/business/history/history'}, + {title: '个人中心', src: userInfo, router: '/pages/business/userInfo/userInfo'}, ]) const {user} = Profile.useContainer() @@ -26,8 +27,8 @@ const Service = () => { if ([1, 2].includes(user?.role_type || 0)) { oldList.unshift(...[ {title: '部门管理', src: dep, router: '/pages/manage/depAdmin/depAdmin'}, - {title: '课程购买', src: buy, router: '/pages/manage/curriculum/curriculum'}, - {title: '现场会', src: buy, router: '/pages/manage/offline/offline'}, + {title: '课程市场', src: buy, router: '/pages/manage/curriculum/curriculum'}, + {title: '现场会', src: buy, router: '/pages/manage/spotMeeting/spotMeeting'}, ]) setList(oldList) } diff --git a/src/pages/my/my.tsx b/src/pages/my/my.tsx index 65241a1..9c409b8 100644 --- a/src/pages/my/my.tsx +++ b/src/pages/my/my.tsx @@ -1,7 +1,6 @@ -import {CustomWrapper, View} from "@tarojs/components"; +import {View} from "@tarojs/components"; import Taro from "@tarojs/taro"; import styles from './my.module.scss' -import {Profile} from '@/store' import Header from "./components/header/header"; import {FC} from "react"; import Time from "@/pages/my/components/header/time"; @@ -11,17 +10,13 @@ const My: FC = () => { const globalData = Taro.getApp().globalData return ( - - - -
- - - - - + +
+ + + ) }