|
@@ -2,84 +2,90 @@
|
|
<view class="grades-terms-page">
|
|
<view class="grades-terms-page">
|
|
<view class="icon-title-navBar-box">
|
|
<view class="icon-title-navBar-box">
|
|
<!-- 返回按钮↓ -->
|
|
<!-- 返回按钮↓ -->
|
|
- <view class="nav-bar-icon" @click="handleBack"></view>
|
|
|
|
|
|
+ <view class="nav-bar-icon" @click="handleBack"></view>
|
|
</view>
|
|
</view>
|
|
<view class="grades-body">
|
|
<view class="grades-body">
|
|
<view class="grades-change-title"></view>
|
|
<view class="grades-change-title"></view>
|
|
<text class="grades-title-desc">我们会根据您选择,为您匹配对应的学习内容</text>
|
|
<text class="grades-title-desc">我们会根据您选择,为您匹配对应的学习内容</text>
|
|
<view class="grades-terms-title terms-title-img"></view>
|
|
<view class="grades-terms-title terms-title-img"></view>
|
|
- <view class="grade-item-box">
|
|
|
|
- <view :key="xueke.id" @click="handleSelectXueke(xueke)" v-for="xueke in xuekeData"
|
|
|
|
- :class="['grade-item',{active: xueke.id == activeXueke}]">{{xueke.lable}}</view>
|
|
|
|
- </view>
|
|
|
|
- <view class="grades-terms-title grades-title-img"></view>
|
|
|
|
- <view class="grade-item-box">
|
|
|
|
- <!-- 产品 -->
|
|
|
|
- <view v-for="item in xuekeList" :key="item.id" @click="handleSelectGrade(item)"
|
|
|
|
- :class="['grade-item', {active: item.id == activeProduct}]">{{item.lable}}</view>
|
|
|
|
- </view>
|
|
|
|
- <view class="grade-line"></view>
|
|
|
|
|
|
+ <view class="grade-item-box">
|
|
|
|
+ <view v-for="item in xueke_list" :key="item.id" @click="handleSelectXueke(item)"
|
|
|
|
+ :class="['grade-item',{active: item.id == activeXueke}]">{{item.label}}</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="grades-terms-title grades-title-img"></view>
|
|
|
|
+ <view class="grade-item-box" v-if="activeXueke != 2">
|
|
|
|
+ <!-- 数学 -->
|
|
|
|
+ <view v-for="item in nianji_list" :key="item.id" @click="handleSelectGrade(item)"
|
|
|
|
+ :class="['grade-item', {active: item.id == activeNianji}]">{{item.label}}</view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="grade-item-box" v-else>
|
|
|
|
+ <!-- 英语 -->
|
|
|
|
+ <template v-for="item in nianji_list" :key="item.id">
|
|
|
|
+ <view @click="handleSelectGrade(item)" v-if="item.id != 6"
|
|
|
|
+ :class="['grade-item', {active: item.id == activeNianji}]">{{item.label}}</view>
|
|
|
|
+ <view v-else class="grade-yingyu-item"></view>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ </view>
|
|
|
|
+ <view class="grade-line"></view>
|
|
<button class="grade-confirm-btn" @click="handleConfirm"></button>
|
|
<button class="grade-confirm-btn" @click="handleConfirm"></button>
|
|
</view>
|
|
</view>
|
|
|
|
+ <coming-soon-dialog ref="comingSoonDialogRef"></coming-soon-dialog>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-
|
|
|
|
|
|
+ import comingSoonDialog from './comingSoonDialog.vue';
|
|
import {
|
|
import {
|
|
reactive,
|
|
reactive,
|
|
toRefs,
|
|
toRefs,
|
|
- computed
|
|
|
|
|
|
+ ref,
|
|
} from "vue";
|
|
} from "vue";
|
|
- import * as httpApi from "@/api/selectGradesTerms.js";
|
|
|
|
|
|
+ import {
|
|
|
|
+ nianji_list,
|
|
|
|
+ xueke_list,
|
|
|
|
+ } from "@/utils/constant.js";
|
|
import {
|
|
import {
|
|
onLoad
|
|
onLoad
|
|
} from "@dcloudio/uni-app";
|
|
} from "@dcloudio/uni-app";
|
|
- import {getUserIdentity,findRootParentId,findTreeNode} from "@/utils/common.js"
|
|
|
|
|
|
+ import {
|
|
|
|
+ getUserIdentity
|
|
|
|
+ } from "@/utils/common.js"
|
|
import cacheManager from "@/utils/cacheManager.js"
|
|
import cacheManager from "@/utils/cacheManager.js"
|
|
- import {getCommonTree, getIndexTree} from "../../api/selectGradesTerms";
|
|
|
|
|
|
+ import {
|
|
|
|
+ getCardOnline
|
|
|
|
+ } from "../../api/catalogue";
|
|
|
|
+
|
|
|
|
+ const comingSoonDialogRef = ref(null);
|
|
|
|
|
|
function useSelectGrade() {
|
|
function useSelectGrade() {
|
|
const userCode = getUserIdentity();
|
|
const userCode = getUserIdentity();
|
|
-
|
|
|
|
const data = reactive({
|
|
const data = reactive({
|
|
- activeProduct: null, // 当前年级
|
|
|
|
|
|
+ activeNianji: null, // 当前年级
|
|
activeXueke: null, // 当前学期
|
|
activeXueke: null, // 当前学期
|
|
activeTipFlag: null, // 当前学期
|
|
activeTipFlag: null, // 当前学期
|
|
- xuekeData: [], // 学科总数据
|
|
|
|
});
|
|
});
|
|
|
|
|
|
- onLoad(({productId,xuekeId,tipFlag}) => {
|
|
|
|
|
|
+ onLoad(({
|
|
|
|
+ nianji,
|
|
|
|
+ cardId,
|
|
|
|
+ tipFlag
|
|
|
|
+ }) => {
|
|
|
|
+
|
|
if (userCode !== 'Visitor') {
|
|
if (userCode !== 'Visitor') {
|
|
- initUserProducts();
|
|
|
|
|
|
+ const {
|
|
|
|
+ nianji: nianji_,
|
|
|
|
+ cardId: cardId_
|
|
|
|
+ } = cacheManager.get('auth');
|
|
|
|
+ data.activeNianji = nianji_;
|
|
|
|
+ data.activeXueke = cardId_;
|
|
} else {
|
|
} else {
|
|
- data.activeProduct = productId;
|
|
|
|
- data.activeXueke = xuekeId;
|
|
|
|
- data.activeTipFlag = tipFlag || '0';
|
|
|
|
- initVisitProducts();
|
|
|
|
|
|
+ data.activeNianji = nianji;
|
|
|
|
+ data.activeXueke = cardId;
|
|
|
|
+ data.activeTipFlag = tipFlag || '0';
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
|
|
- // 初始化游客产品数据
|
|
|
|
- function initVisitProducts() {
|
|
|
|
- httpApi.getCommonTree().then(res => {
|
|
|
|
- data.xuekeData = res.data||[];
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- function initUserProducts() {
|
|
|
|
- httpApi.getIndexTree().then(res => {
|
|
|
|
- data.xuekeData = res.data||[];
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- const {
|
|
|
|
- levelId
|
|
|
|
- } = cacheManager.get('auth');
|
|
|
|
- const xuekeObj = findRootParentId(data.xuekeData, levelId,'levelId');
|
|
|
|
- const productObj = findTreeNode(data.xuekeData, levelId,'levelId');
|
|
|
|
- data.activeProduct = productObj.id;
|
|
|
|
- data.activeXueke = xuekeObj.id;
|
|
|
|
- }
|
|
|
|
|
|
+ });
|
|
|
|
|
|
// 选择 年级+学期
|
|
// 选择 年级+学期
|
|
function handleConfirm() {
|
|
function handleConfirm() {
|
|
@@ -91,7 +97,7 @@
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (!data.activeProduct) {
|
|
|
|
|
|
+ if (!data.activeNianji) {
|
|
uni.showToast({
|
|
uni.showToast({
|
|
title: "请选择课程等级",
|
|
title: "请选择课程等级",
|
|
duration: 2000,
|
|
duration: 2000,
|
|
@@ -99,53 +105,57 @@
|
|
});
|
|
});
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- goDAOToStudy();
|
|
|
|
|
|
+
|
|
|
|
+ getCardOnline({
|
|
|
|
+ cardId: data.activeXueke,
|
|
|
|
+ nianji: data.activeNianji
|
|
|
|
+ }).then(res => {
|
|
|
|
+ if (res.data) {
|
|
|
|
+ goDAOToStudy();
|
|
|
|
+ } else {
|
|
|
|
+ comingSoonDialogRef.value.handleShow();
|
|
|
|
+ }
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
// 跳转 岛 学习
|
|
// 跳转 岛 学习
|
|
function goDAOToStudy() {
|
|
function goDAOToStudy() {
|
|
- const Product = data.xuekeData.find(item => item.id == data.activeXueke).children.find(item => item.id == data.activeProduct)
|
|
|
|
- const levelId = Product.levelId;
|
|
|
|
- const typeId = Product.typeId;
|
|
|
|
- const subjectId = Product.subjectId;
|
|
|
|
-
|
|
|
|
if (userCode !== 'Visitor') {
|
|
if (userCode !== 'Visitor') {
|
|
const auth = cacheManager.get('auth');
|
|
const auth = cacheManager.get('auth');
|
|
cacheManager.updateObject('auth', {
|
|
cacheManager.updateObject('auth', {
|
|
- typeId: typeId,
|
|
|
|
- levelId: levelId,
|
|
|
|
- subjectId: subjectId, // 此处subjectId 独立加入缓存,单独维护,勿动 @date 2025/05/14
|
|
|
|
- zhangId: data.activeProduct == auth.nianji && data.activeXueke == auth.cardId ? auth.zhangId: 0,
|
|
|
|
- currentZhang: 0
|
|
|
|
|
|
+ typeId: typeId,
|
|
|
|
+ levelId: levelId,
|
|
|
|
+ subjectId: subjectId, // 此处subjectId 独立加入缓存,单独维护,勿动 @date 2025/05/14
|
|
|
|
+ zhangId: data.activeProduct == auth.nianji && data.activeXueke == auth.cardId ? auth.zhangId :
|
|
|
|
+ 0,
|
|
|
|
+ currentZhang: 0
|
|
})
|
|
})
|
|
cacheManager.remove('daoPageCache')
|
|
cacheManager.remove('daoPageCache')
|
|
|
|
+ // 数序
|
|
uni.redirectTo({
|
|
uni.redirectTo({
|
|
url: `/pages/study/index`
|
|
url: `/pages/study/index`
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
- if (typeId == 1) {
|
|
|
|
- // 新岛
|
|
|
|
- uni.redirectTo({
|
|
|
|
- url: `/pages/study/index?levelId=${levelId}&typeId=${typeId}&subjectId=${subjectId}&tipFlag=${data.activeTipFlag}`
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- // 旧岛
|
|
|
|
- uni.redirectTo({
|
|
|
|
- url: `/pages/study/index?levelId=${levelId}&typeId=${typeId}&subjectId=${subjectId}&zhangId=0&tipFlag=${data.activeTipFlag}`
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ // 数序
|
|
|
|
+ uni.redirectTo({
|
|
|
|
+ url: `/pages/study/index?nianji=${data.activeNianji}&cardId=${data.activeXueke}&zhangId=0&tipFlag=${data.activeTipFlag}`
|
|
|
|
+ })
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
+
|
|
function handleBack() {
|
|
function handleBack() {
|
|
if (userCode !== 'Visitor') {
|
|
if (userCode !== 'Visitor') {
|
|
- uni.redirectTo({ url: `/pages/study/index`})
|
|
|
|
|
|
+ uni.redirectTo({
|
|
|
|
+ url: `/pages/study/index`
|
|
|
|
+ })
|
|
} else {
|
|
} else {
|
|
- uni.redirectTo({url: '/pages/login/index'})
|
|
|
|
|
|
+ uni.redirectTo({
|
|
|
|
+ url: '/pages/login/index'
|
|
|
|
+ })
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
return {
|
|
return {
|
|
...toRefs(data),
|
|
...toRefs(data),
|
|
handleBack,
|
|
handleBack,
|
|
@@ -155,30 +165,17 @@
|
|
}
|
|
}
|
|
|
|
|
|
const {
|
|
const {
|
|
- activeProduct,
|
|
|
|
|
|
+ activeNianji,
|
|
activeXueke,
|
|
activeXueke,
|
|
- xuekeData,
|
|
|
|
handleConfirm,
|
|
handleConfirm,
|
|
handleBack
|
|
handleBack
|
|
} = useSelectGrade()
|
|
} = useSelectGrade()
|
|
|
|
|
|
- const xuekeList = computed(() => {
|
|
|
|
-
|
|
|
|
- if (!xuekeData.value.length) {
|
|
|
|
- return []
|
|
|
|
- }
|
|
|
|
- const d_id = activeXueke.value || xuekeData.value[0].id;
|
|
|
|
- return xuekeData.value.find(item => item.id == d_id).children
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- function handleSelectGrade(item) {
|
|
|
|
- activeProduct.value = item.id;
|
|
|
|
|
|
+ function handleSelectGrade(item) {
|
|
|
|
+ activeNianji.value = item.id;
|
|
}
|
|
}
|
|
|
|
|
|
function handleSelectXueke(item) {
|
|
function handleSelectXueke(item) {
|
|
activeXueke.value = item.id;
|
|
activeXueke.value = item.id;
|
|
- activeProduct.value = null;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
</script>
|
|
</script>
|