|
@@ -1,13 +1,21 @@
|
|
|
<template>
|
|
|
- <shuxueZhangjie v-if="currentProduct ==1" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
|
|
|
- @handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
|
|
|
- </shuxueZhangjie>
|
|
|
- <yingyuZhangjie v-if="currentProduct ==2" @clickGradeTerm="clickGradeTerm" @onLeft="onLeft" @onRight="onRight"
|
|
|
- @handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="infoData">
|
|
|
- </yingyuZhangjie>
|
|
|
+ <swiper :circular="false" style="height: 100vh;" @change="onChangeTab" :duration="currentDuration"
|
|
|
+ :current="current">
|
|
|
+ <swiper-item v-for="(item,index) in zhangList" :key="index">
|
|
|
+ <view class="item flex-col flex-center">
|
|
|
+ <shuxueZhangjie v-if="currentProduct ==1" @clickGradeTerm="clickGradeTerm"
|
|
|
+ @handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :gradeTerm='gradeTerm'
|
|
|
+ :options="item">
|
|
|
+ </shuxueZhangjie>
|
|
|
+ <yingyuZhangjie v-if="currentProduct ==2" @clickGradeTerm="clickGradeTerm"
|
|
|
+ @handleCheckCatalogue="handleCheckCatalogue" @listClick="listClick" :options="item">
|
|
|
+ </yingyuZhangjie>
|
|
|
+ </view>
|
|
|
+ </swiper-item>
|
|
|
+ </swiper>
|
|
|
<!-- 蛋 -->
|
|
|
<egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
|
|
|
- <catalogue ref="catalogueRef" @change-zhang="handleChangeZhang"></catalogue>
|
|
|
+ <catalogue ref="catalogueRef" :list=zhangList @change-zhang="handleChangeZhang"></catalogue>
|
|
|
<CustomTabBar :cardId="cardId" :nianji="nianji" :zhangId="zhangId"></CustomTabBar>
|
|
|
<tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPayPage" :content="tipContent"></tip-small-dialog>
|
|
|
<tip-middle-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :content="YouKeContent"></tip-middle-dialog>
|
|
@@ -34,6 +42,7 @@
|
|
|
import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
|
|
|
import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
|
|
|
import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
|
|
|
+ import dSwiper from '@/components/wSwiper/DSwiper.vue';
|
|
|
|
|
|
import shuxueZhangjie from './product/shuxue.vue';
|
|
|
import yingyuZhangjie from './product/yingyu.vue';
|
|
@@ -50,7 +59,10 @@
|
|
|
const tipContent = '付费章节,是否前往开通付费?'; //当前产品
|
|
|
const goPayDialogRef = ref(null);
|
|
|
const youkeDialogRef = ref(null);
|
|
|
+ const dSwiperRef = ref(null);
|
|
|
const eggDialogRef = ref(null);
|
|
|
+ const current = ref(0);
|
|
|
+ const currentDuration = ref(500)
|
|
|
const YouKeContent = '您当前是游客身份,登录后才能浏览内容,现在去登录?';
|
|
|
const zhangId = ref(null); //游客使用
|
|
|
const nianji = ref(null); //游客使用
|
|
@@ -58,6 +70,8 @@
|
|
|
const catalogueRef = ref(null);
|
|
|
const currentProduct = ref(null);
|
|
|
const selectZhang = ref(null);
|
|
|
+ const zhangList = ref(null);
|
|
|
+ const gradeTerm = ref(null);
|
|
|
let infoData = reactive({
|
|
|
jieList: [],
|
|
|
haveFlag: '',
|
|
@@ -68,27 +82,48 @@
|
|
|
zhangName: '',
|
|
|
numberStr: '',
|
|
|
});
|
|
|
+ const gradeMapping = {
|
|
|
+ 1: '一年级',
|
|
|
+ 2: '二年级',
|
|
|
+ 3: '三年级',
|
|
|
+ 4: '四年级',
|
|
|
+ 5: '五年级',
|
|
|
+ 6: '六年级'
|
|
|
+ };
|
|
|
+
|
|
|
+ const termMapping = {
|
|
|
+ 1: ' 数学',
|
|
|
+ 2: ' 英语'
|
|
|
+ };
|
|
|
onLoad((options) => {
|
|
|
init(options)
|
|
|
})
|
|
|
|
|
|
+ function onChangeTab(e) {
|
|
|
+ console.log(e.detail.current);
|
|
|
+ infoData.zhangId = cacheManager.get('zhangInfo').zhangList[e.detail.current].zhangId
|
|
|
+ cacheManager.updateObject('auth', {
|
|
|
+ currentZhang: e.detail.current,
|
|
|
+ zhangId: infoData.zhangId
|
|
|
+ })
|
|
|
+
|
|
|
+ //current.value = e.detail.current;
|
|
|
+ }
|
|
|
+
|
|
|
function init(options) {
|
|
|
if (cacheManager.get('auth')) {
|
|
|
- currentProduct.value = cacheManager.get('auth').cardId;
|
|
|
//会员 取auth
|
|
|
selectZhang.value = cacheManager.get('auth');
|
|
|
+ currentProduct.value = cacheManager.get('auth').cardId;
|
|
|
+ //let currentObject = this.cacheZhangInfo.jieList.find(item => item.jieId == this.jieId);
|
|
|
console.log(selectZhang.value);
|
|
|
// 已登录
|
|
|
- // 选择年级进入调用此接口
|
|
|
- //options.flag == 'selectGrades'
|
|
|
- if (!selectZhang.value.firstLogin) {
|
|
|
+ if (selectZhang.value.firstLogin) {
|
|
|
nextTick(() => {
|
|
|
eggDialogRef.value.eggShow();
|
|
|
})
|
|
|
}
|
|
|
getZhangInfo()
|
|
|
- // 蛋
|
|
|
- // eggDialogRef.value.eggShow();
|
|
|
} else {
|
|
|
zhangId.value = options.zhangId
|
|
|
nianji.value = options.nianji
|
|
@@ -107,22 +142,25 @@
|
|
|
}
|
|
|
userZhangInfo(req).then(res => {
|
|
|
cacheManager.set('zhangInfo', res.data)
|
|
|
- infoData.jieList = res.data.jieList
|
|
|
- infoData.haveFlag = res.data.haveFlag
|
|
|
- infoData.nianji = res.data.nianji
|
|
|
- infoData.number = res.data.number
|
|
|
- infoData.numberStr = res.data.numberStr
|
|
|
- infoData.cardId = res.data.cardId
|
|
|
- infoData.zhangId = res.data.zhangId
|
|
|
- infoData.zhangName = res.data.zhangName
|
|
|
- recordZhangJie()
|
|
|
- getNewData()
|
|
|
- // if (cacheManager.get('zhangInfo')) {
|
|
|
- // cacheManager.remove('zhangInfo')
|
|
|
- // cacheManager.set('zhangInfo', res.data)
|
|
|
- // } else {
|
|
|
- // cacheManager.set('zhangInfo', res.data)
|
|
|
- // }
|
|
|
+ let zhang = cacheManager.get('zhangInfo').zhangList.findIndex(zhang => zhang.zhangId == selectZhang
|
|
|
+ .value.zhangId);
|
|
|
+ if (zhang != -1) {
|
|
|
+ cacheManager.updateObject('auth', {
|
|
|
+ currentZhang: zhang
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ cacheManager.updateObject('auth', {
|
|
|
+ currentZhang: 0
|
|
|
+ })
|
|
|
+ }
|
|
|
+ nextTick(() => {
|
|
|
+ translateData(res.data)
|
|
|
+ zhangList.value = res.data.zhangList
|
|
|
+ current.value = cacheManager.get('auth').currentZhang
|
|
|
+ infoData.zhangId = res.data.zhangList[current.value].zhangId
|
|
|
+ recordZhangJie()
|
|
|
+ })
|
|
|
+
|
|
|
})
|
|
|
}
|
|
|
|
|
@@ -146,71 +184,6 @@
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- function onLeft(event) {
|
|
|
- const authCode = getUserIdentity();
|
|
|
- if (authCode !== 'VIP') {
|
|
|
- return false
|
|
|
- }
|
|
|
- console.log('用户左滑了');
|
|
|
- let req = {
|
|
|
- nianji: selectZhang.value.nianji,
|
|
|
- zhangId: selectZhang.value.zhangId,
|
|
|
- cardId: selectZhang.value.cardId,
|
|
|
- }
|
|
|
- userZhangForntInfo(req).then(res => {
|
|
|
- cacheManager.set('zhangInfo', res.data)
|
|
|
- infoData.jieList = res.data.jieList
|
|
|
- infoData.haveFlag = res.data.haveFlag
|
|
|
- infoData.nianji = res.data.nianji
|
|
|
- infoData.number = res.data.number
|
|
|
- infoData.numberStr = res.data.numberStr
|
|
|
- infoData.cardId = res.data.cardId
|
|
|
- infoData.zhangId = res.data.zhangId
|
|
|
- infoData.zhangName = res.data.zhangName
|
|
|
- recordZhangJie()
|
|
|
- getNewData()
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- function onRight(event) {
|
|
|
- console.log('');
|
|
|
- const authCode = getUserIdentity();
|
|
|
- if (authCode !== 'VIP') {
|
|
|
- return false
|
|
|
- }
|
|
|
- console.log('用户又滑了');
|
|
|
- let req = {
|
|
|
- nianji: selectZhang.value.nianji,
|
|
|
- zhangId: selectZhang.value.zhangId,
|
|
|
- cardId: selectZhang.value.cardId,
|
|
|
- }
|
|
|
- userZhangNextInfo(req).then(res => {
|
|
|
- cacheManager.set('zhangInfo', res.data)
|
|
|
- nextTick(() => {
|
|
|
- // uni.redirectTo({
|
|
|
- // url: `/pages/study/index`
|
|
|
- // })
|
|
|
- uni.navigateTo({
|
|
|
- url: `/pages/study/index`
|
|
|
- });
|
|
|
- })
|
|
|
-
|
|
|
- // cacheManager.set('zhangInfo', res.data)
|
|
|
- // infoData.jieList = res.data.jieList
|
|
|
- // infoData.haveFlag = res.data.haveFlag
|
|
|
- // infoData.nianji = res.data.nianji
|
|
|
- // infoData.number = res.data.number
|
|
|
- // infoData.numberStr = res.data.numberStr
|
|
|
- // infoData.cardId = res.data.cardId
|
|
|
- // infoData.zhangId = res.data.zhangId
|
|
|
- // infoData.zhangName = res.data.zhangName
|
|
|
- // recordZhangJie()
|
|
|
- // getNewData()
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
function getNewData() {
|
|
|
selectZhang.value.zhangId = cacheManager.get('zhangInfo').zhangId;
|
|
|
selectZhang.value.cardId = cacheManager.get('zhangInfo').cardId;
|
|
@@ -241,6 +214,7 @@
|
|
|
}
|
|
|
|
|
|
function handleChangeZhang(data) {
|
|
|
+ console.log(data);
|
|
|
selectZhang.value = data;
|
|
|
const authCode = getUserIdentity();
|
|
|
if (authCode !== 'Visitor') {
|
|
@@ -248,7 +222,14 @@
|
|
|
zhangId: data.zhangId
|
|
|
})
|
|
|
}
|
|
|
- init()
|
|
|
+ currentDuration.value = 0
|
|
|
+ setTimeout(() => {
|
|
|
+ current.value = data.number - 1
|
|
|
+ nextTick(() => {
|
|
|
+ currentDuration.value = 500
|
|
|
+ })
|
|
|
+ }, 100)
|
|
|
+ // init()
|
|
|
}
|
|
|
|
|
|
function goKaoshi(data) {
|
|
@@ -270,14 +251,19 @@
|
|
|
return;
|
|
|
} else {
|
|
|
uni.redirectTo({
|
|
|
- url: '/pages/study/lookShipin?jieId=' + data.jieId
|
|
|
+ url: '/pages/study/lookShipin?jieId=' + data.jieId + '&zhangId=' + infoData.zhangId
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- function listClick(data, index) {
|
|
|
+ function translateData(data) {
|
|
|
+ gradeTerm.value = gradeMapping[data.nianji] + termMapping[data.cardId]
|
|
|
+ }
|
|
|
+
|
|
|
+ function listClick(data) {
|
|
|
+ console.log('data', data);
|
|
|
if (!cacheManager.get('auth') && data.firstFlag != 1) {
|
|
|
youkeDialogRef.value.handleShow();
|
|
|
return;
|
|
@@ -300,6 +286,9 @@
|
|
|
}
|
|
|
|
|
|
function clickGradeTerm() {
|
|
|
+ cacheManager.updateObject('auth', {
|
|
|
+ currentZhang: 0
|
|
|
+ })
|
|
|
uni.navigateTo({
|
|
|
url: `/pages/selectGradesTerms/index`,
|
|
|
})
|
|
@@ -314,7 +303,7 @@
|
|
|
function eggBtn() {
|
|
|
console.log('点击:开启提分之旅');
|
|
|
cacheManager.updateObject('auth', {
|
|
|
- firstLogin: true
|
|
|
+ firstLogin: false
|
|
|
})
|
|
|
}
|
|
|
</script>
|