diff --git a/.env b/.env
index 86e2b46..3852d45 100644
--- a/.env
+++ b/.env
@@ -1,5 +1,5 @@
-#TARO_APP_API=https://yjx.dev.yaojiankang.top
-TARO_APP_API=https://mooc.yaojiankang.top
+TARO_APP_API=https://yjx.dev.yaojiankang.top
+#TARO_APP_API=https://mooc.yaojiankang.top
#TARO_APP_API=https://shopfix.yaojiankang.top
#TARO_APP_API=https://playedu.yaojiankang.top
TARO_APP_LGOIN=true
diff --git a/src/api/manage.ts b/src/api/manage.ts
index ba13c5d..291746b 100644
--- a/src/api/manage.ts
+++ b/src/api/manage.ts
@@ -46,7 +46,6 @@ export interface depCurProps {
interface AddCurProps {
course_id: number[]
dep_id: number[]
- is_required: (1 | 0)[]
}
diff --git a/src/hooks/storageDep.ts b/src/hooks/storageDep.ts
index b0e9c89..bd8283c 100644
--- a/src/hooks/storageDep.ts
+++ b/src/hooks/storageDep.ts
@@ -1,14 +1,12 @@
import Taro from "@tarojs/taro";
const KET = 'SELECT_DEP'
-const KET_REQUIRED = 'SELECT_REQUIRED'
/** 部门 */
function set(data: number[]) {
Taro.setStorageSync(KET, data)
}
-
function get(): number[] {
const deps = Taro.getStorageSync(KET)
if (deps && deps.length) {
@@ -23,28 +21,7 @@ function removeDeps() {
Taro.removeStorageSync(KET)
}
-/** 必修选修 */
-function removeRequired() {
- Taro.removeStorageSync(KET_REQUIRED)
-}
-
-function setRequired(data: number[]) {
- Taro.setStorageSync(KET_REQUIRED, data)
-}
-
-
-/** getRequired 比 set后调用 */
-function getRequired(): (0 | 1)[] {
- const deps = Taro.getStorageSync(KET_REQUIRED)
- if (deps && deps.length) {
- removeRequired()
- return deps
- }
- return []
-}
-
function remove() {
- removeRequired()
removeDeps()
}
@@ -52,6 +29,4 @@ export default {
set,
get,
remove,
- setRequired,
- getRequired
}
diff --git a/src/pages/home/components/curRecommended.tsx b/src/pages/home/components/curRecommended.tsx
index e47d4f3..7a638c1 100644
--- a/src/pages/home/components/curRecommended.tsx
+++ b/src/pages/home/components/curRecommended.tsx
@@ -48,7 +48,7 @@ const CurRecommended: FC = () => {
{i > 0 && }
{d.title}
{(d.intro || '').length > 40 && (
- {d.intro}文章结束阿斯卡极乐空间是你拉卡萨文章结束阿斯卡极乐空间是你拉卡萨文章结束阿斯卡极乐空间是你拉卡萨文章结束阿斯卡极乐空间是你拉卡萨文章结束阿斯卡极乐空间是你拉卡萨文章结束阿斯卡极乐空间是你拉卡萨
+ {d.intro}
{d.cover && }
)}
diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx
index d8f88a1..8d70f42 100644
--- a/src/pages/index/index.tsx
+++ b/src/pages/index/index.tsx
@@ -5,6 +5,9 @@ import {VideoList} from "@/pages/index/components/videoList";
import Tabs, {OnChangOpt, TabList} from "@/components/tabs/tabs";
import {CoursesKey, publicApi} from "@/api/public";
import NavigationBar from "@/components/navigationBar/navigationBar";
+import Spin from "@/components/spinner";
+import Img from "@/components/image/image";
+import {rfc33392time} from "@/utils/day";
// import Taro from "@tarojs/taro";
const category: TabList[] = [
@@ -37,24 +40,35 @@ const Index: FC = () => {
const AuditMode: FC = () => {
const [auditMode, setAuditMode] = useState(false)
const [articles, setArticles] = useState([])
+ const [enable, setEnable] = useState(true)
useEffect(() => {
publicApi.course({page: 1, pageSize: 10}).then(res => {
setAuditMode(res.audit_mode)
setArticles(res.articles)
- // if(res.audit_mode){
- // Taro.setTabBarItem({index: 1, text: '文章'})
- // }
+ setEnable(false)
})
}, [])
return (
<>
+
{
auditMode ?
<>
-
-
+
+
{
- articles.map(d => {d.title})
+ articles.map((d, i) =>
+ {i > 0 && }
+ {d.title}
+ {(d.intro || '').length > 40 && (
+ {d.intro}
+ {d.cover && }
+ )}
+
+ {rfc33392time(d.created_at).split(' ')[0]}
+ 阅读 {d.page_view || 0}
+
+ )
}
>
diff --git a/src/pages/manage/courseAdmin/courseAdmin.tsx b/src/pages/manage/courseAdmin/courseAdmin.tsx
index b21f706..ebcceb7 100644
--- a/src/pages/manage/courseAdmin/courseAdmin.tsx
+++ b/src/pages/manage/courseAdmin/courseAdmin.tsx
@@ -124,13 +124,12 @@ const CourseAdmin: FC = () => {
Taro.useDidShow(useCallback(async () => {
const dep_id = storageDep.get()
- const is_required = storageDep.getRequired()
- if (!dep_id.length || !is_required.length || !curs.length) return;
+ if (!dep_id.length || !curs.length) return;
try {
- await ManageApi.addCur({course_id: curs, dep_id, is_required})
+ await ManageApi.addCur({course_id: curs, dep_id})
Taro.showToast({title: '修改成功'})
// deps 中没有 筛选条件中的depid 删除已选的课程
if (param.dep_id && dep_id.includes(param.dep_id)) {
diff --git a/src/pages/manage/selectDep/selectDep.tsx b/src/pages/manage/selectDep/selectDep.tsx
index 72760ce..8a34de9 100644
--- a/src/pages/manage/selectDep/selectDep.tsx
+++ b/src/pages/manage/selectDep/selectDep.tsx
@@ -1,5 +1,5 @@
import React, {FC, useCallback, useEffect, useState} from "react";
-import {Checkbox, Switch, View} from "@tarojs/components";
+import {Checkbox, View} from "@tarojs/components";
import Taro from "@tarojs/taro";
import {curriculum} from "@/api";
import PopPut from "@/components/popPut/popPut";
@@ -13,10 +13,9 @@ import Spin from "@/components/spinner";
* required 是 必修选修
*/
const SelectDep: FC = () => {
- const params = Taro.getCurrentInstance()?.router?.params as { depIds: string, required: string | undefined }
+ const params = Taro.getCurrentInstance()?.router?.params as { depIds: string}
const [ids, setIds] = useState([])
const [deps, setDeps] = useState([])
- const [required, setRequired] = useState([])
const [enable, setEnable] = useState(true)
useEffect(() => {
@@ -25,7 +24,6 @@ const SelectDep: FC = () => {
})
setEnable(false)
setIds(JSON.parse(params.depIds))
- setRequired(JSON.parse(params.required || "[]"))
}, [])
const onChange = useCallback((id: number) => {
@@ -35,51 +33,19 @@ const SelectDep: FC = () => {
...ids,
id
])
-
- if (params.required) {
- setRequired([...required, 0])
- }
} else {
const oldIds: number[] = JSON.parse(JSON.stringify(ids))
oldIds.splice(index, 1)
setIds(oldIds)
-
- if (params.required) {
- const oldRequired: number[] = JSON.parse(JSON.stringify(required))
- oldRequired.splice(index, 1)
- setRequired(oldRequired)
- }
}
}, [ids])
function ok() {
storageDep.set(ids)
- storageDep.setRequired(required)
Taro.navigateBack({delta: 1})
}
- function isRequired(dep_id: number): boolean {
- const index = ids.indexOf(dep_id)
- if (index === -1) {
- return false
- } else {
- return !!required?.[index]
- }
- }
-
- function requiredChange(dep_id: number, value: boolean) {
- const index = ids.indexOf(dep_id)
- if (index === -1) {
- setIds([...ids, dep_id])
- setRequired([...required, value ? 1 : 0])
- } else {
- const oldRequired: number[] = JSON.parse(JSON.stringify(required))
- oldRequired.splice(index, 1, value ? 1 : 0)
- setRequired(oldRequired)
- }
- }
-
return (
@@ -90,19 +56,7 @@ const SelectDep: FC = () => {
key={d.id}
title={d.name}
chevron
- leftImage={folder}
- content={
- params?.required ?
-
- 必修: event?.stopImmediatePropagation()}
- checked={isRequired(d.id)}
- onChange={(e) => requiredChange(d.id, e.detail.value)}/>
-
- : null
- }
- />
+ leftImage={folder}/>
)}