index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <template>
  2. <view>
  3. <swiper :circular="true" @change="onChangeTab" :duration="currentDuration" :current="current"
  4. class="ezy-study-swiper" :class="'ezy-study-swiper'+ currentProduct">
  5. <swiper-item v-for="(item,index) in zhangList" :key="index">
  6. <!-- 旧的数学 -->
  7. <shuxueZhangjie v-if="currentProduct ==1&&typeId==2" @clickGradeTerm="clickGradeTerm"
  8. @handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
  9. :options="item" :youkeImage="youkeImage">
  10. </shuxueZhangjie>
  11. <!-- 旧的英语 -->
  12. <yingyuZhangjie v-if="currentProduct ==2&&typeId==2" @clickGradeTerm="clickGradeTerm"
  13. @handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
  14. :options="item" :youkeImage="youkeImage">
  15. </yingyuZhangjie>
  16. <!-- 新的数学 -->
  17. <shuxueNewZhangjie v-if="currentProduct ==1&&typeId==1" @clickGradeTerm="clickGradeTerm"
  18. @handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
  19. :options="item" :youkeImage="youkeImage">
  20. </shuxueNewZhangjie>
  21. <!-- 新的英语(人教版等等) -->
  22. <yingyuNewZhangjie v-if="currentProduct ==2&&typeId==1" @clickGradeTerm="clickGradeTerm"
  23. @handleCheckCatalogue="handleCheckCatalogue(item)" @listClick="listClick" :gradeTerm='gradeTerm'
  24. :options="item" :zhangName="zhangName" :youkeImage="youkeImage" :youkeImageBook="youkeImageBook">
  25. </yingyuNewZhangjie>
  26. </swiper-item>
  27. </swiper>
  28. <!-- 蛋 -->
  29. <egg-dialog ref="eggDialogRef" @eggBtn="eggBtn"></egg-dialog>
  30. <catalogue ref="catalogueRef" :list=zhangList @change-zhang="handleChangeZhang"
  31. @listSelectJieClick="listSelectJieClick"></catalogue>
  32. <CustomTabBar :levelId="levelId" :currentTabNumber="0" :subjectId="subjectId" :typeId="typeId"
  33. :tipFlag="tipFlag">
  34. </CustomTabBar>
  35. <tip-small-dialog ref="goPayDialogRef" @confirm-btn="goPayPage" :content="tipContent"></tip-small-dialog>
  36. <tip-big-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :imgShow="true"></tip-big-dialog>
  37. <dao-tip-dialog ref="daoTipDialogRef" v-if="showDaoTip" :productTip="productTipImg"
  38. @dao-tip-close="daoTipClose"></dao-tip-dialog>
  39. <tipMiddleDialog ref="tipDialogRef" :closeFlag='false' @confirm-btn="BanbenConfirmBtn" :title="tipTitle"
  40. :content="tipContentVersion"></tipMiddleDialog>
  41. <tip-dialog ref="tipDialogRef2" :closeFlag='false' :title="tipTitle"
  42. :content="tipContentVersionAndroid"></tip-dialog>
  43. </view>
  44. </template>
  45. <script setup>
  46. import daoTipDialog from './daoTipDialog.vue';
  47. import {
  48. userZhangInfo,
  49. userLocate,
  50. userZhangForntInfo,
  51. userZhangNextInfo,
  52. getCommonZhangInfo
  53. } from "@/api/learnPlan.js"
  54. import {
  55. getVersion
  56. } from "@/api/login.js"
  57. import {
  58. getWordListYk,
  59. getWordList,
  60. wordXuewan
  61. } from "@/api/word.js"
  62. import {
  63. reactive,
  64. ref,
  65. nextTick,
  66. getCurrentInstance,
  67. onMounted,
  68. computed
  69. } from "vue";
  70. import {
  71. onLoad
  72. } from '@dcloudio/uni-app';
  73. import catalogue from "@/components/catalogue/catalogue.vue";
  74. import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
  75. import tipSmallDialog from '@/components/dialog/tipSmallDialog.vue'
  76. import tipBigDialog from '@/components/dialog/tipBigDialog.vue';
  77. import tipMiddleDialog from '@/components/dialog/tipMiddleDialog.vue';
  78. import dSwiper from '@/components/wSwiper/DSwiper.vue';
  79. import shuxueZhangjie from './product/shuxue.vue';
  80. import shuxueNewZhangjie from './product/shuxueNew.vue';
  81. import yingyuZhangjie from './product/yingyu.vue';
  82. import yingyuNewZhangjie from './product/yingyuNew.vue';
  83. import {
  84. useTabBarHistory
  85. } from '@/utils/emitEvents.js';
  86. import eggDialog from './eggDialog.vue'
  87. import tipDialog from '@/components/dialog/tipDialog.vue';
  88. import config from '../../config.js'
  89. import {
  90. toast,
  91. getUserIdentity
  92. } from "@/utils/common";
  93. import cacheManager from "@/utils/cacheManager.js";
  94. import TipDialog from "../../components/dialog/tipDialog";
  95. const tipContent = '是否前往开通付费?'; //当前产品
  96. const goPayDialogRef = ref(null);
  97. const youkeDialogRef = ref(null);
  98. const dSwiperRef = ref(null);
  99. const eggDialogRef = ref(null);
  100. const current = ref(0);
  101. const zid = ref(0);
  102. const currentDuration = ref(500)
  103. const YouKeContent = '您当前的身份是游客,想要体验完整内容需注册成用户!';
  104. const tipFlag = ref(null) //游客使用
  105. const catalogueRef = ref(null);
  106. const youkeImage = ref(null);
  107. const youkeImageBook = ref(null);
  108. const currentProduct = ref(null);
  109. const localAuth = ref(null);
  110. const levelId = ref(null); //游客使用
  111. const subjectId = ref(null); //游客使用
  112. const youkeZhangId = ref(null); //游客使用
  113. const zhangName = ref(null);
  114. const typeId = ref(null);
  115. const zhangList = ref(null);
  116. const gradeTerm = ref(null);
  117. let infoData = reactive({
  118. jieList: [],
  119. haveFlag: '',
  120. number: '',
  121. zhangId: '',
  122. zhangName: '',
  123. numberStr: '',
  124. });
  125. const termMapping = {
  126. 1: ' 数学',
  127. 2: ' 英语'
  128. };
  129. const daoTipDialogRef = ref(null);
  130. const showDaoTip = ref(true);
  131. const productTipImg = ref('');
  132. const version = config.appInfo.version;
  133. const tipDialogRef = ref(null);
  134. const tipDialogRef2 = ref(null);
  135. const tipTitle = '升级提醒';
  136. const tipContentVersion = '您的APP不是最新版本,部分功能不能使用,请升级至最新版本!';
  137. const tipContentVersionAndroid = '您的APP不是最新版本,部分功能不能使用,请到应用商店升级至最新版本!'
  138. onLoad((options) => {
  139. init(options);
  140. getLoginInit()
  141. })
  142. function listSelectJieClick(item, data, index) {
  143. if (cacheManager.get('auth')) {
  144. cacheManager.updateObject('auth', {
  145. currentZhang: zhangList.value.findIndex(citem => citem.zhangId == item.zhangId),
  146. zhangId: item.zhangId
  147. })
  148. }
  149. listClick(data, item, index);
  150. }
  151. function BanbenConfirmBtn() {
  152. const systemInfo = uni.getSystemInfoSync();
  153. if (systemInfo.platform == 'ios') {
  154. const appStoreUrl = 'itms-apps://itunes.apple.com/app/6741551741'
  155. plus.runtime.openURL(appStoreUrl)
  156. }
  157. }
  158. function getLoginInit() {
  159. getVersion({}).then(res => {
  160. if (version != res.data.version) {
  161. const systemInfo = uni.getSystemInfoSync();
  162. if (systemInfo.platform == 'ios') {
  163. tipDialogRef.value.handleShow();
  164. } else {
  165. tipDialogRef2.value.handleShow();
  166. }
  167. }
  168. })
  169. }
  170. function getProjectImg() {
  171. if (currentProduct.value == 1 && typeId.value == 2) {
  172. // 数学
  173. productTipImg.value = 'static/images/study/shuxue/shuxue-tip.gif';
  174. getBj('shuxue')
  175. } else if (currentProduct.value == 2 && typeId.value == 2) {
  176. // 英语
  177. productTipImg.value = 'static/images/study/yingyu/yingyu-tip.gif'
  178. getBj('yingyu');
  179. } else if (currentProduct.value == 1 && typeId.value == 1) {
  180. // 数学新(计算特训)
  181. productTipImg.value = 'static/images/study/jstx/jstx-tip.gif'
  182. getBj('shuxueNew');
  183. } else if (currentProduct.value == 2 && typeId.value == 1) {
  184. // 英语新(超级单词)
  185. productTipImg.value = 'static/images/study/cjdc/new-yingyu-tip.gif'
  186. getBj('yingyuNew');
  187. }
  188. }
  189. function getBj(data) {
  190. let bjType = cacheManager.get('dao-tip')[data];
  191. if (cacheManager.get('auth')) {
  192. // 非游客
  193. if (bjType !== 'has') {
  194. nextTick(() => {
  195. daoTipDialogRef.value.handleShow();
  196. })
  197. }
  198. } else {
  199. // 游客
  200. if (tipFlag.value === '0') {
  201. nextTick(() => {
  202. daoTipDialogRef.value.handleShow();
  203. })
  204. }
  205. }
  206. }
  207. function daoTipClose() {
  208. if (cacheManager.get('auth')) {
  209. // 非游客 记缓存
  210. if (currentProduct.value == 1 && typeId.value == 2) {
  211. // 数学
  212. cacheManager.updateObject('dao-tip', {
  213. shuxue: 'has'
  214. })
  215. } else if (currentProduct.value == 2 && typeId.value == 2) {
  216. // 英语
  217. cacheManager.updateObject('dao-tip', {
  218. yingyu: 'has'
  219. })
  220. } else if (currentProduct.value == 1 && typeId.value == 1) {
  221. // 数学新(计算特训)
  222. cacheManager.updateObject('dao-tip', {
  223. shuxueNew: 'has'
  224. })
  225. } else if (currentProduct.value == 2 && typeId.value == 1) {
  226. // 英语新(超级单词)
  227. cacheManager.updateObject('dao-tip', {
  228. yingyuNew: 'has'
  229. })
  230. }
  231. } else {
  232. //游客
  233. tipFlag.value = '1';
  234. }
  235. }
  236. function onChangeTab(e) {
  237. console.log(e.detail.current);
  238. if (cacheManager.get('auth')) {
  239. // 新的英语人教版
  240. if (currentProduct.value == 2 && typeId.value == 1) {
  241. cacheManager.updateObject('zhangInfo', {
  242. curZid: cacheManager.get('zhangInfo').zhangList[0].zList[e.detail.current].zid
  243. })
  244. } else {
  245. // // 旧的数学 英语 新的数学
  246. cacheManager.updateObject('zhangInfo', {
  247. curZhangId: cacheManager.get('zhangInfo').zhangList[e.detail.current].zhangId
  248. })
  249. }
  250. }
  251. }
  252. function init(options) {
  253. if (cacheManager.get('auth')) {
  254. localAuth.value = cacheManager.get('auth');
  255. currentProduct.value = localAuth.value.subjectId;
  256. typeId.value = localAuth.value.typeId;
  257. console.log(localAuth.value);
  258. // 已登录
  259. if (localAuth.value.firstLogin) {
  260. nextTick(() => {
  261. eggDialogRef.value.eggShow();
  262. })
  263. }
  264. if (!cacheManager.get('zhangInfo')) {
  265. console.log('无zhangInfo缓存');
  266. chooseMethodNoCache()
  267. } else {
  268. console.log('使用缓存Zhanginfo');
  269. chooseMethodUseCache()
  270. }
  271. } else {
  272. chooseMethodYouke(options)
  273. }
  274. }
  275. function chooseMethodNoCache() {
  276. // 新的英语 (人教版 之类的 新结构)
  277. if (currentProduct.value == 2 && typeId.value == 1) {
  278. getZhangInfoNewYingyu()
  279. } else {
  280. // 之前 旧的岛 数学英语 和新的数学
  281. getZhangInfo()
  282. }
  283. }
  284. function chooseMethodUseCache() {
  285. // 新的英语 (人教版 之类的 新结构)
  286. if (currentProduct.value == 2 && typeId.value == 1) {
  287. translateData(cacheManager.get('zhangInfo'))
  288. zhangList.value = cacheManager.get('zhangInfo').zhangList[0].zList
  289. zhangName.value = cacheManager.get('zhangInfo').zhangList[0].zhangName
  290. const curZid = cacheManager.get('zhangInfo').curZid;
  291. const index = zhangList.value.findIndex(item => item.zid == curZid)
  292. current.value = index
  293. zid.value = cacheManager.get('zhangInfo').zhangList[0].zList[cacheManager.get('auth').curZid].zhangZid
  294. infoData.zhangId = cacheManager.get('zhangInfo').zhangList[0].zhangId
  295. recordZhangJie()
  296. } else {
  297. // 之前 旧的岛 数学英语 和新的数学
  298. const curZhangId = cacheManager.get('zhangInfo').curZhangId;
  299. const resZhangList = cacheManager.get('zhangInfo').zhangList;
  300. const index = resZhangList.findIndex(item => item.zhangId == curZhangId)
  301. console.log('index', index);
  302. translateData(cacheManager.get('zhangInfo'))
  303. zhangList.value = cacheManager.get('zhangInfo').zhangList
  304. current.value = index
  305. infoData.zhangId = cacheManager.get('zhangInfo').zhangList[current.value].zhangId
  306. recordZhangJie()
  307. }
  308. }
  309. function chooseMethodYouke(options) {
  310. subjectId.value = options.subjectId
  311. typeId.value = options.typeId
  312. levelId.value = options.levelId
  313. tipFlag.value = options.tipFlag;
  314. currentProduct.value = options.subjectId
  315. youkeZhangId.value = options.youkeZhangId
  316. if (subjectId.value == 2 && typeId.value == 1) {
  317. // 新英语
  318. getCommonZhangNewYingyu(options)
  319. } else {
  320. // 未登录 游客 旧的数学 英语 新数学
  321. getCommonZhang(options)
  322. }
  323. getProjectImg()
  324. }
  325. // 新的英语 (人教版 之类的 新结构)
  326. function getZhangInfoNewYingyu(data) {
  327. const arr = localAuth.value.levelId.split(",");
  328. let req = {
  329. levelId: arr[0],
  330. zhangId: arr[1]
  331. }
  332. userZhangInfo(req).then(res => {
  333. cacheManager.set('zhangInfo', res.data)
  334. const curZid = res.data.curZid;
  335. const resZList = res.data.zhangList[0].zList;
  336. const index = resZList.findIndex(item => item.zid == curZid)
  337. nextTick(() => {
  338. translateData(res.data)
  339. zhangList.value = res.data.zhangList[0].zList
  340. zhangName.value = res.data.zhangList[0].zhangName
  341. current.value = index
  342. zid.value = res.data.zhangList[0].zList[index].zhangZid
  343. infoData.zhangId = res.data.zhangList[0].zhangId
  344. recordZhangJie()
  345. })
  346. }).catch((err) => {
  347. toast('数据异常,请重新登录!')
  348. // cacheManager.clearAll();
  349. // uni.reLaunch({
  350. // url: '/pages/login/index'
  351. // });
  352. })
  353. }
  354. function findZhangindex(data) {
  355. console.log('data', data);
  356. for (let zhangIndex = 0; zhangIndex < data.zhangList.length; zhangIndex++) {
  357. const zhang = data.zhangList[zhangIndex];
  358. for (let jieIndex = 0; jieIndex < zhang.jieList.length; jieIndex++) {
  359. if (zhang.jieList[jieIndex].studyFlag == 0) {
  360. return zhangIndex; // 返回所在zhang的索引
  361. }
  362. }
  363. }
  364. return -1; // 如果没有找到
  365. }
  366. function getZhangInfo(data) {
  367. let req = {
  368. levelId: localAuth.value.levelId
  369. }
  370. userZhangInfo(req).then(res => {
  371. cacheManager.set('zhangInfo', res.data)
  372. const curZhangId = res.data.curZhangId;
  373. const resZhangList = res.data.zhangList;
  374. const index = resZhangList.findIndex(item => item.zhangId == curZhangId)
  375. console.log('index', index);
  376. nextTick(() => {
  377. translateData(res.data)
  378. zhangList.value = res.data.zhangList
  379. current.value = index
  380. infoData.zhangId = res.data.zhangList[current.value].zhangId
  381. recordZhangJie()
  382. })
  383. }).catch((err) => {
  384. toast('数据异常,请重新登录!')
  385. // cacheManager.clearAll();
  386. // uni.reLaunch({
  387. // url: '/pages/login/index'
  388. // });
  389. })
  390. }
  391. function getCommonZhangNewYingyu(data) {
  392. let req = {
  393. levelId: data.levelId,
  394. zhangId: data.youkeZhangId
  395. }
  396. getCommonZhangInfo(req).then(res => {
  397. translateData(res.data)
  398. youkeImage.value = res.data.icon
  399. youkeImageBook.value = res.data.zhangIcon
  400. zhangList.value = res.data.zhangList[0].zList
  401. zhangName.value = res.data.zhangList[0].zhangName
  402. current.value = 0
  403. }).catch((err) => {
  404. toast('数据异常,请重新登录!')
  405. // cacheManager.clearAll();
  406. // uni.reLaunch({
  407. // url: '/pages/login/index'
  408. // });
  409. })
  410. }
  411. function getCommonZhang(data) {
  412. let req = {
  413. levelId: data.levelId,
  414. }
  415. getCommonZhangInfo(req).then(res => {
  416. translateData(res.data)
  417. youkeImage.value = res.data.icon
  418. zhangList.value = res.data.zhangList
  419. current.value = 0
  420. }).catch((err) => {
  421. toast('数据异常,请重新登录!')
  422. cacheManager.clearAll();
  423. uni.reLaunch({
  424. url: '/pages/login/index'
  425. });
  426. })
  427. }
  428. function recordZhangJie() {
  429. let req = {
  430. levelId: localAuth.value.levelId,
  431. userId: localAuth.value.userId,
  432. subjectId: currentProduct.value,
  433. }
  434. userLocate(req).then(res => {
  435. })
  436. }
  437. function goPayPage() {
  438. let zhangInfoLocal = cacheManager.get('zhangInfo')
  439. if (!zhangInfoLocal.cardId) {
  440. toast("cardId 丢失请重新选择学科LevelId");
  441. return false
  442. }
  443. uni.redirectTo({
  444. url: '/pages/mall/mallPage?cardId=' + zhangInfoLocal.cardId + '&from=daoPage' + '&subjectId=' +
  445. zhangInfoLocal.subjectId
  446. })
  447. }
  448. function handleChangeZhang(data) {
  449. console.log(data);
  450. const authCode = getUserIdentity();
  451. if (authCode !== 'Visitor') {
  452. cacheManager.updateObject('auth', {
  453. zhangId: data.zhangId,
  454. currentZhang: zhangList.value.findIndex(citem => citem.zhangId == data.zhangId),
  455. })
  456. }
  457. currentDuration.value = 0
  458. setTimeout(() => {
  459. current.value = data.number - 1
  460. nextTick(() => {
  461. currentDuration.value = 500
  462. })
  463. }, 100)
  464. if (currentProduct.value == 2 && typeId.value == 1) {
  465. cacheManager.remove('zhangInfo')
  466. }
  467. init()
  468. }
  469. function goKaoshi(data) {
  470. uni.redirectTo({
  471. // url: `/pages/unitTest/index?jieNumber=` + data.number
  472. url: `/pages/unitTest/index?jieId=` + data.jieId
  473. })
  474. }
  475. function goDanciList(data, index) {
  476. if (!cacheManager.get('auth')) {
  477. getWordListYk({
  478. jieId: data.jieId
  479. }).then(res => {
  480. if (res.code == 0 && res.data.wordList.length > 0) {
  481. let youkeData = {
  482. subjectId: subjectId.value,
  483. typeId: typeId.value,
  484. levelId: levelId.value,
  485. tipFlag: tipFlag.value,
  486. youkeZhangId: youkeZhangId.value,
  487. jieId: data.jieId
  488. }
  489. uni.redirectTo({
  490. url: '/pages/wordList/wordList?youkePageData=' + JSON.stringify(youkeData)
  491. })
  492. } else {
  493. toast("该单元没有学习内容!");
  494. return false
  495. }
  496. })
  497. } else {
  498. getWordList({
  499. jieId: data.jieId
  500. }).then(res => {
  501. if (res.code == 0 && res.data.wordList.length > 0) {
  502. uni.redirectTo({
  503. url: '/pages/wordList/wordList?jieId=' + data.jieId
  504. })
  505. } else {
  506. toast("该单元没有学习内容!");
  507. console.log('data,jieId', data.jieId);
  508. wordXuewan({
  509. jieId: data.jieId
  510. }).then(res => {
  511. getZhangInfoNewYingyu()
  512. // 更新缓存 备用 现在是 直接调用接口
  513. // const result = updateStudyFlag(responseData, data.jieId, 1);
  514. // if (result) {
  515. // cacheManager.set('zhangInfo', result)
  516. // }
  517. })
  518. return false
  519. }
  520. })
  521. }
  522. }
  523. // 更新缓存 备用 现在是 直接调用接口
  524. const updateStudyFlag = (data, jieIdToUpdate, newValue) => {
  525. // 检查data和必要的数据结构是否存在
  526. if (!data || !Array.isArray(data.zhangList)) {
  527. console.warn('无效的数据结构');
  528. return false;
  529. }
  530. // 遍历zhangList
  531. data.zhangList.forEach(zhang => {
  532. // 检查zList是否存在且是数组
  533. if (zhang && Array.isArray(zhang.zList)) {
  534. zhang.zList.forEach(z => {
  535. // 检查jieList是否存在且是数组
  536. if (z && Array.isArray(z.jieList)) {
  537. z.jieList.forEach(jie => {
  538. // 检查jie对象和jieId是否存在
  539. if (jie && jie.jieId == jieIdToUpdate) {
  540. jie.studyFlag = newValue;
  541. }
  542. });
  543. }
  544. });
  545. }
  546. });
  547. return data;
  548. };
  549. function goLookShipin(data, index) {
  550. if (!cacheManager.get('auth')) {
  551. console.log('zhangList.value[0].jieList', zhangList.value[0].jieList);
  552. console.log('zhangList.value[0].jieList.index', zhangList.value[0].jieList[index]);
  553. let youkeData = {
  554. levelId: levelId.value,
  555. typeId: typeId.value,
  556. subjectId: subjectId.value,
  557. tipFlag: tipFlag.value,
  558. jieList: zhangList.value[0].jieList[index],
  559. jieName: zhangList.value[0].jieList[index].jieName
  560. }
  561. if (youkeData.typeId == 1) {
  562. if (!data.videoId) {
  563. toast("videoId 丢失!");
  564. return false
  565. }
  566. uni.redirectTo({
  567. url: '/pages/study/lookShipinNew?youkePageData=' + JSON.stringify(youkeData)
  568. })
  569. } else {
  570. if (!data.videoId) {
  571. toast("videoId 丢失!");
  572. return false
  573. }
  574. uni.redirectTo({
  575. url: '/pages/study/lookShipin?youkePageData=' + JSON.stringify(youkeData)
  576. })
  577. }
  578. } else {
  579. if (typeId.value == 1) {
  580. // 1新 2旧
  581. if (!data.videoId) {
  582. toast("videoId 丢失!");
  583. return false
  584. }
  585. uni.redirectTo({
  586. url: '/pages/study/lookShipinNew?jieId=' + data.jieId
  587. })
  588. } else {
  589. if (!data.videoId) {
  590. toast("videoId 丢失!");
  591. return false
  592. }
  593. uni.redirectTo({
  594. url: '/pages/study/lookShipin?jieId=' + data.jieId
  595. })
  596. }
  597. }
  598. }
  599. function translateData(data) {
  600. // gradeTerm.value = termMapping[data.subjectId] +' · '+ data.levelName
  601. gradeTerm.value = data.levelName
  602. }
  603. function listClick(data, data2, index) {
  604. //console.log('data', data); // 节内容
  605. // console.log('data2', data2); //章内容
  606. chooseMethodListClick(data, data2, index)
  607. }
  608. function chooseMethodListClick(data, data2, index) {
  609. console.log('data', data); // 节内容
  610. console.log('data2', data2); //章内容
  611. const authCode = getUserIdentity();
  612. if (currentProduct.value == 2 && typeId.value == 1) {
  613. // const isFirst = data.jieName == data2.jieList[0].jieName
  614. if (!cacheManager.get('auth') && data.number != 1) {
  615. youkeDialogRef.value.handleShow();
  616. return false;
  617. }
  618. // console.log('authCode', authCode);
  619. if (!(authCode == 'VIP' || data.number == 1)) {
  620. goPayDialogRef.value.handleShow();
  621. return false
  622. }
  623. goDanciList(data, index)
  624. } else {
  625. if (!cacheManager.get('auth') && data.firstFlag != 1) {
  626. youkeDialogRef.value.handleShow();
  627. return;
  628. }
  629. console.log('authCode', authCode);
  630. if (!(authCode == 'VIP' || data.firstFlag == 1)) {
  631. // debugger
  632. goPayDialogRef.value.handleShow();
  633. return false
  634. }
  635. if (data.type == 2) {
  636. // 最后一项
  637. goKaoshi(data, index)
  638. } else {
  639. goLookShipin(data, index)
  640. }
  641. }
  642. }
  643. function handleCheckCatalogue(item) {
  644. catalogueRef.value.showPopup(item);
  645. }
  646. function clickGradeTerm() {
  647. uni.navigateTo({
  648. url: `/pages/selectGradesTerms/index?tipFlag=${tipFlag.value}&from=daoPage&productId=${levelId.value}&xuekeId=${subjectId.value}`
  649. })
  650. }
  651. // 游客弹窗---确定
  652. function ykConfirm() {
  653. uni.redirectTo({
  654. url: '/pages/login/index'
  655. });
  656. }
  657. function eggBtn() {
  658. console.log('点击:开启提分之旅');
  659. getProjectImg();
  660. cacheManager.updateObject('auth', {
  661. firstLogin: false
  662. })
  663. }
  664. </script>
  665. <style>
  666. </style>