index.vue 21 KB

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