index.vue 20 KB

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