|
|
@@ -14,25 +14,13 @@
|
|
|
<!-- 资源卡片列表 -->
|
|
|
|
|
|
<!-- 数学 -->
|
|
|
- <ShuXueList
|
|
|
- v-if="data.chanpinActiveSelect === 'shuxue'"
|
|
|
- :list="data.shuxue"
|
|
|
- @select="goDetail"
|
|
|
- />
|
|
|
+ <ShuXueList v-if="data.chanpinActiveSelect === 'shuxue'" :list="data.shuxueList" />
|
|
|
|
|
|
<!-- 英语 -->
|
|
|
- <YingYuList
|
|
|
- v-else-if="data.chanpinActiveSelect === 'yingyu'"
|
|
|
- :list="data.yingyu"
|
|
|
- @select="goDetail"
|
|
|
- />
|
|
|
+ <YingYuList v-if="data.chanpinActiveSelect === 'yingyu'" :list="data.yingyuList" />
|
|
|
|
|
|
<!-- 语文 -->
|
|
|
- <YuWenList
|
|
|
- v-else-if="data.chanpinActiveSelect === 'yuwen'"
|
|
|
- :list="data.yuwen"
|
|
|
- @select="goDetail"
|
|
|
- />
|
|
|
+ <YuWenList v-if="data.chanpinActiveSelect === 'yuwen'" :list="data.yuwenList" />
|
|
|
|
|
|
</view>
|
|
|
</view>
|
|
|
@@ -42,11 +30,12 @@
|
|
|
<script setup>
|
|
|
import {reactive, ref} from "vue";
|
|
|
import {onLoad,onShow} from "@dcloudio/uni-app"
|
|
|
+import {ziliaoIndex} from '@/api/ziliao.js'
|
|
|
import CustomTabBar from "@/components/custom-tabbar/index.vue";
|
|
|
import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
|
|
|
-import shuxueList from "./shuxue/sxList.vue"
|
|
|
-import yingyuList from "./yingyu/yyList.vue"
|
|
|
-import yuwenList from "./yuwen/ywList.vue"
|
|
|
+import ShuXueList from "./shuxue/sxList.vue"
|
|
|
+import YingYuList from "./yingyu/yyList.vue"
|
|
|
+import YuWenList from "./yuwen/ywList.vue"
|
|
|
let currentTabIndex = ref(2);
|
|
|
const data = reactive({
|
|
|
list:[
|
|
|
@@ -55,18 +44,59 @@ const data = reactive({
|
|
|
{ key: 'yuwen', label: '语文' }
|
|
|
],
|
|
|
chanpinActiveSelect: 'shuxue',
|
|
|
- shuxue: {},
|
|
|
- yingyu: {},
|
|
|
- yuwen: {}
|
|
|
+ shuxueList: {},
|
|
|
+ yingyuList: {},
|
|
|
+ yuwenList: {}
|
|
|
})
|
|
|
|
|
|
// tab click
|
|
|
function handleSelectChanpin(item) {
|
|
|
data.chanpinActiveSelect = item.key
|
|
|
}
|
|
|
+
|
|
|
+// ziliao list
|
|
|
+function getZiliaoList() {
|
|
|
+ ziliaoIndex({}).then(res => {
|
|
|
+ const result = getFormatData(res.data);
|
|
|
+ data.shuxueList = result.shuxue;
|
|
|
+ data.yingyuList = result.yingyu;
|
|
|
+ data.yuwenList = result.yuwen;
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+// Format
|
|
|
+function getFormatData(data) {
|
|
|
+ const shuxue = data.shuxue || {};
|
|
|
+ const yingyu = data.yingyu || {};
|
|
|
+ const yuwen = data.yuwen || {};
|
|
|
+
|
|
|
+ return {
|
|
|
+ shuxue: Object.entries(shuxue).map(([chanpin, content]) => {
|
|
|
+ return { chanpin, content };
|
|
|
+ }),
|
|
|
+ yingyu:Object.entries(yingyu).map(([chanpin, content]) => {
|
|
|
+ return { chanpin, content };
|
|
|
+ }),
|
|
|
+ yuwen:Object.entries(yuwen).map(([chanpin, content]) => {
|
|
|
+ return { chanpin, content };
|
|
|
+ }),
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+onShow(() => {
|
|
|
+ currentTabIndex.value = 2;
|
|
|
+ data.chanpinActiveSelect = 'shuxue'
|
|
|
+ // 缺少功能 每日刷新
|
|
|
+ /* if (getFullTimer() !== `2026-01-28`) {
|
|
|
+ //每日刷新
|
|
|
+ getZiliaoList();
|
|
|
+ } */
|
|
|
+})
|
|
|
+
|
|
|
onLoad(() => {
|
|
|
// 隐藏默认系统导航栏显示自定义导航栏
|
|
|
uni.hideTabBar()
|
|
|
+ getZiliaoList()
|
|
|
})
|
|
|
</script>
|
|
|
|