index.vue 22 KB

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