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