index.vue 21 KB

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