index.vue 22 KB

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