index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  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', e);
  238. console.log(e.detail.current);
  239. if (cacheManager.get('auth')) {
  240. // 新的英语人教版
  241. if (currentProduct.value == 2 && typeId.value == 1) {
  242. infoData.zhangId = cacheManager.get('zhangInfo').zhangList[0].zhangId
  243. cacheManager.updateObject('auth', {
  244. currentZhang: e.detail.current,
  245. zhangId: infoData.zhangId
  246. })
  247. } else {
  248. // 旧的数学 英语 新的数学
  249. infoData.zhangId = cacheManager.get('zhangInfo').zhangList[e.detail.current].zhangId
  250. cacheManager.updateObject('auth', {
  251. currentZhang: e.detail.current,
  252. zhangId: infoData.zhangId
  253. })
  254. }
  255. }
  256. }
  257. function init(options) {
  258. if (cacheManager.get('auth')) {
  259. localAuth.value = cacheManager.get('auth');
  260. currentProduct.value = localAuth.value.subjectId;
  261. typeId.value = localAuth.value.typeId;
  262. console.log(localAuth.value);
  263. // 已登录
  264. if (localAuth.value.firstLogin) {
  265. nextTick(() => {
  266. eggDialogRef.value.eggShow();
  267. })
  268. }
  269. if (!cacheManager.get('daoPageCache').isCache) {
  270. console.log('不实用换葱');
  271. chooseMethodNoCache()
  272. } else {
  273. console.log('shiyonghuancun');
  274. chooseMethodUseCache()
  275. }
  276. // 已登录付费未支付选择返回 -> 恢复弹窗
  277. if (options.studyWithCatalgue) {
  278. // 展开弹窗
  279. nextTick(() => {
  280. catalogueRef.value.showPopup({
  281. zhangId: infoData.zhangId
  282. });
  283. })
  284. }
  285. } else {
  286. chooseMethodYouke(options)
  287. }
  288. }
  289. function chooseMethodNoCache() {
  290. // 新的英语 (人教版 之类的 新结构)
  291. if (currentProduct.value == 2 && typeId.value == 1) {
  292. getZhangInfoNewYingyu()
  293. } else {
  294. // 之前 旧的岛 数学英语 和新的数学
  295. getZhangInfo()
  296. }
  297. }
  298. function chooseMethodUseCache() {
  299. // 新的英语 (人教版 之类的 新结构)
  300. if (currentProduct.value == 2 && typeId.value == 1) {
  301. translateData(cacheManager.get('zhangInfo'))
  302. zhangList.value = cacheManager.get('zhangInfo').zhangList[0].zList
  303. zhangName.value = cacheManager.get('zhangInfo').zhangList[0].zhangName
  304. current.value = cacheManager.get('auth').currentZhang
  305. zid.value = cacheManager.get('zhangInfo').zhangList[0].zList[cacheManager.get('auth').currentZhang].zid
  306. infoData.zhangId = cacheManager.get('zhangInfo').zhangList[0].zhangId
  307. recordZhangJie()
  308. } else {
  309. // 之前 旧的岛 数学英语 和新的数学
  310. translateData(cacheManager.get('zhangInfo'))
  311. zhangList.value = cacheManager.get('zhangInfo').zhangList
  312. current.value = cacheManager.get('auth').currentZhang
  313. infoData.zhangId = cacheManager.get('zhangInfo').zhangList[current.value].zhangId
  314. recordZhangJie()
  315. }
  316. }
  317. function chooseMethodYouke(options) {
  318. subjectId.value = options.subjectId
  319. typeId.value = options.typeId
  320. levelId.value = options.levelId
  321. tipFlag.value = options.tipFlag;
  322. currentProduct.value = options.subjectId
  323. youkeZhangId.value = options.youkeZhangId
  324. if (subjectId.value == 2 && typeId.value == 1) {
  325. // 新英语
  326. getCommonZhangNewYingyu(options)
  327. } else {
  328. // 未登录 游客 旧的数学 英语 新数学
  329. getCommonZhang(options)
  330. }
  331. getProjectImg()
  332. }
  333. // 新的英语 (人教版 之类的 新结构)
  334. function getZhangInfoNewYingyu(data) {
  335. let req = {
  336. levelId: localAuth.value.levelId,
  337. // levelId: 31,
  338. zhangId: localAuth.value.zhangId
  339. // zhangId: 195
  340. }
  341. userZhangInfo(req).then(res => {
  342. cacheManager.set('zhangInfo', res.data)
  343. let zhang = cacheManager.get('zhangInfo').zhangList[0].zList.findIndex(zhang => zhang.zid == localAuth
  344. .value.zhangZid);
  345. console.log('zhang', zhang);
  346. if (zhang != -1) {
  347. cacheManager.updateObject('auth', {
  348. currentZhang: zhang
  349. })
  350. } else {
  351. cacheManager.updateObject('auth', {
  352. currentZhang: 0
  353. })
  354. }
  355. cacheManager.set('daoPageCache', {
  356. isCache: true
  357. })
  358. nextTick(() => {
  359. translateData(res.data)
  360. zhangList.value = res.data.zhangList[0].zList
  361. zhangName.value = res.data.zhangList[0].zhangName
  362. current.value = cacheManager.get('auth').currentZhang
  363. zid.value = res.data.zhangList[0].zList[cacheManager.get('auth').currentZhang].zid
  364. infoData.zhangId = res.data.zhangList[0].zhangId
  365. recordZhangJie()
  366. })
  367. }).catch((err) => {
  368. toast('数据异常,请重新登录!')
  369. cacheManager.clearAll();
  370. uni.reLaunch({
  371. url: '/pages/login/index'
  372. });
  373. })
  374. }
  375. //旧的岛 数学英语 和新的数学
  376. function getZhangInfo(data) {
  377. let req = {
  378. levelId: localAuth.value.levelId
  379. }
  380. userZhangInfo(req).then(res => {
  381. cacheManager.set('zhangInfo', res.data)
  382. let zhang = cacheManager.get('zhangInfo').zhangList.findIndex(zhang => zhang.zhangId == localAuth
  383. .value.zhangId);
  384. console.log('zhang', zhang);
  385. if (zhang != -1) {
  386. cacheManager.updateObject('auth', {
  387. currentZhang: zhang
  388. })
  389. } else {
  390. cacheManager.updateObject('auth', {
  391. currentZhang: 0
  392. })
  393. }
  394. cacheManager.set('daoPageCache', {
  395. isCache: true
  396. })
  397. nextTick(() => {
  398. translateData(res.data)
  399. zhangList.value = res.data.zhangList
  400. current.value = cacheManager.get('auth').currentZhang
  401. infoData.zhangId = res.data.zhangList[current.value].zhangId
  402. recordZhangJie()
  403. })
  404. }).catch((err) => {
  405. toast('数据异常,请重新登录!')
  406. cacheManager.clearAll();
  407. uni.reLaunch({
  408. url: '/pages/login/index'
  409. });
  410. })
  411. }
  412. function getCommonZhangNewYingyu(data) {
  413. let req = {
  414. levelId: data.levelId,
  415. zhangId: data.youkeZhangId
  416. }
  417. getCommonZhangInfo(req).then(res => {
  418. translateData(res.data)
  419. youkeImage.value = res.data.icon
  420. youkeImageBook.value = res.data.zhangIcon
  421. zhangList.value = res.data.zhangList[0].zList
  422. zhangName.value = res.data.zhangList[0].zhangName
  423. current.value = 0
  424. }).catch((err) => {
  425. toast('数据异常,请重新登录!')
  426. cacheManager.clearAll();
  427. uni.reLaunch({
  428. url: '/pages/login/index'
  429. });
  430. })
  431. }
  432. function getCommonZhang(data) {
  433. let req = {
  434. levelId: data.levelId,
  435. }
  436. getCommonZhangInfo(req).then(res => {
  437. translateData(res.data)
  438. youkeImage.value = res.data.icon
  439. zhangList.value = res.data.zhangList
  440. current.value = 0
  441. }).catch((err) => {
  442. toast('数据异常,请重新登录!')
  443. cacheManager.clearAll();
  444. uni.reLaunch({
  445. url: '/pages/login/index'
  446. });
  447. })
  448. }
  449. function recordZhangJie() {
  450. let req = {
  451. levelId: localAuth.value.levelId,
  452. userId: localAuth.value.userId,
  453. zhangId: infoData.zhangId,
  454. subjectId: currentProduct.value,
  455. zhangZid: zid.value
  456. }
  457. userLocate(req).then(res => {
  458. })
  459. }
  460. function goPayPage() {
  461. let zhangInfoLocal = cacheManager.get('zhangInfo')
  462. if (!zhangInfoLocal.cardId) {
  463. toast("cardId 丢失请重新选择学科LevelId");
  464. return false
  465. }
  466. uni.redirectTo({
  467. url: '/pages/mall/mallPage?cardId=' + zhangInfoLocal.cardId + '&from=daoPage' + '&subjectId=' +
  468. zhangInfoLocal.subjectId
  469. })
  470. }
  471. function handleChangeZhang(data) {
  472. console.log(data);
  473. const authCode = getUserIdentity();
  474. if (authCode !== 'Visitor') {
  475. cacheManager.updateObject('auth', {
  476. zhangId: data.zhangId,
  477. currentZhang: zhangList.value.findIndex(citem => citem.zhangId == data.zhangId),
  478. })
  479. }
  480. currentDuration.value = 0
  481. setTimeout(() => {
  482. current.value = data.number - 1
  483. nextTick(() => {
  484. currentDuration.value = 500
  485. })
  486. }, 100)
  487. // init()
  488. }
  489. function goKaoshi(data) {
  490. uni.redirectTo({
  491. // url: `/pages/unitTest/index?jieNumber=` + data.number
  492. url: `/pages/unitTest/index?jieId=` + data.jieId
  493. })
  494. }
  495. function goDanciList(data, index) {
  496. if (!cacheManager.get('auth')) {
  497. getWordListYk({
  498. jieId: data.jieId
  499. }).then(res => {
  500. if (res.code == 0 && res.data.wordList.length > 0) {
  501. let youkeData = {
  502. subjectId: subjectId.value,
  503. typeId: typeId.value,
  504. levelId: levelId.value,
  505. tipFlag: tipFlag.value,
  506. youkeZhangId: youkeZhangId.value,
  507. jieId: data.jieId
  508. }
  509. uni.redirectTo({
  510. url: '/pages/wordList/wordList?youkePageData=' + JSON.stringify(youkeData)
  511. })
  512. } else {
  513. toast("该单元没有学习内容!");
  514. return false
  515. }
  516. })
  517. } else {
  518. getWordList({
  519. jieId: data.jieId
  520. }).then(res => {
  521. if (res.code == 0 && res.data.wordList.length > 0) {
  522. uni.redirectTo({
  523. url: '/pages/wordList/wordList?jieId=' + data.jieId
  524. })
  525. } else {
  526. toast("该单元没有学习内容!");
  527. console.log('data,jieId', data.jieId);
  528. wordXuewan({
  529. jieId: data.jieId
  530. }).then(res => {
  531. getZhangInfoNewYingyu()
  532. // 更新缓存 备用 现在是 直接调用接口
  533. // const result = updateStudyFlag(responseData, data.jieId, 1);
  534. // if (result) {
  535. // cacheManager.set('zhangInfo', result)
  536. // }
  537. })
  538. return false
  539. }
  540. })
  541. }
  542. }
  543. // 更新缓存 备用 现在是 直接调用接口
  544. const updateStudyFlag = (data, jieIdToUpdate, newValue) => {
  545. // 检查data和必要的数据结构是否存在
  546. if (!data || !Array.isArray(data.zhangList)) {
  547. console.warn('无效的数据结构');
  548. return false;
  549. }
  550. // 遍历zhangList
  551. data.zhangList.forEach(zhang => {
  552. // 检查zList是否存在且是数组
  553. if (zhang && Array.isArray(zhang.zList)) {
  554. zhang.zList.forEach(z => {
  555. // 检查jieList是否存在且是数组
  556. if (z && Array.isArray(z.jieList)) {
  557. z.jieList.forEach(jie => {
  558. // 检查jie对象和jieId是否存在
  559. if (jie && jie.jieId == jieIdToUpdate) {
  560. jie.studyFlag = newValue;
  561. }
  562. });
  563. }
  564. });
  565. }
  566. });
  567. return data;
  568. };
  569. function goLookShipin(data, index) {
  570. if (!cacheManager.get('auth')) {
  571. console.log('zhangList.value[0].jieList', zhangList.value[0].jieList);
  572. console.log('zhangList.value[0].jieList.index', zhangList.value[0].jieList[index]);
  573. let youkeData = {
  574. levelId: levelId.value,
  575. typeId: typeId.value,
  576. subjectId: subjectId.value,
  577. tipFlag: tipFlag.value,
  578. jieList: zhangList.value[0].jieList[index],
  579. jieName: zhangList.value[0].jieList[index].jieName
  580. }
  581. if (youkeData.typeId == 1) {
  582. if (!data.videoId) {
  583. toast("videoId 丢失!");
  584. return false
  585. }
  586. uni.redirectTo({
  587. url: '/pages/study/lookShipinNew?youkePageData=' + JSON.stringify(youkeData)
  588. })
  589. } else {
  590. if (!data.videoId) {
  591. toast("videoId 丢失!");
  592. return false
  593. }
  594. uni.redirectTo({
  595. url: '/pages/study/lookShipin?youkePageData=' + JSON.stringify(youkeData)
  596. })
  597. }
  598. } else {
  599. if (typeId.value == 1) {
  600. // 1新 2旧
  601. if (!data.videoId) {
  602. toast("videoId 丢失!");
  603. return false
  604. }
  605. uni.redirectTo({
  606. url: '/pages/study/lookShipinNew?jieId=' + data.jieId
  607. })
  608. } else {
  609. if (!data.videoId) {
  610. toast("videoId 丢失!");
  611. return false
  612. }
  613. uni.redirectTo({
  614. url: '/pages/study/lookShipin?jieId=' + data.jieId
  615. })
  616. }
  617. }
  618. }
  619. function translateData(data) {
  620. // gradeTerm.value = termMapping[data.subjectId] +' · '+ data.levelName
  621. gradeTerm.value = data.levelName
  622. }
  623. function listClick(data, data2, index) {
  624. //console.log('data', data); // 节内容
  625. // console.log('data2', data2); //章内容
  626. chooseMethodListClick(data, data2, index)
  627. }
  628. function chooseMethodListClick(data, data2, index) {
  629. // console.log('data', data); // 节内容
  630. // console.log('data2', data2); //章内容
  631. const authCode = getUserIdentity();
  632. if (currentProduct.value == 2 && typeId.value == 1) {
  633. const isFirst = data.jieName == data2.jieList[0].jieName
  634. if (!cacheManager.get('auth') && !isFirst) {
  635. youkeDialogRef.value.handleShow();
  636. return false;
  637. }
  638. // console.log('authCode', authCode);
  639. if (!(authCode == 'VIP' || isFirst)) {
  640. goPayDialogRef.value.handleShow();
  641. return false
  642. }
  643. goDanciList(data, index)
  644. } else {
  645. if (!cacheManager.get('auth') && data.firstFlag != 1) {
  646. youkeDialogRef.value.handleShow();
  647. return;
  648. }
  649. console.log('authCode', authCode);
  650. if (!(authCode == 'VIP' || data.firstFlag == 1)) {
  651. // debugger
  652. goPayDialogRef.value.handleShow();
  653. return false
  654. }
  655. if (data.type == 2) {
  656. // 最后一项
  657. goKaoshi(data, index)
  658. } else {
  659. goLookShipin(data, index)
  660. }
  661. }
  662. }
  663. function handleCheckCatalogue(item) {
  664. catalogueRef.value.showPopup(item);
  665. }
  666. function clickGradeTerm() {
  667. // if(cacheManager.get('auth')){
  668. // cacheManager.updateObject('auth', {
  669. // currentZhang: 0
  670. // })
  671. // }
  672. uni.navigateTo({
  673. url: `/pages/selectGradesTerms/index?tipFlag=${tipFlag.value}&from=daoPage&productId=${levelId.value}&xuekeId=${subjectId.value}`
  674. })
  675. }
  676. // 游客弹窗---确定
  677. function ykConfirm() {
  678. uni.redirectTo({
  679. url: '/pages/login/index'
  680. });
  681. }
  682. function eggBtn() {
  683. console.log('点击:开启提分之旅');
  684. getProjectImg();
  685. cacheManager.updateObject('auth', {
  686. firstLogin: false
  687. })
  688. }
  689. </script>
  690. <style>
  691. </style>