index.vue 20 KB

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