mallPage.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. <template>
  2. <view class="ezy-mall-page">
  3. <view class="icon-title-navBar-box">
  4. <view @click="goBack" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">鹅状元进阶营</text>
  6. </view>
  7. <view class="ezy-tab-border">
  8. <uni-segmented-control :current="productData.current" :values="productData.items" active-color="#3A7FE9"
  9. @clickItem="onChangeTab" class="ezy-tab-box" />
  10. <view>
  11. <view v-if="productData.current === 0">
  12. <scroll-view scroll-y="true" :scroll-into-view="scrollIntoId" class="order-scroll-view">
  13. <!--数学-->
  14. <view :id="'item-' + item.id" v-for="item in productData.list" :key="item.id"
  15. class="mall-list-item">
  16. <view class="mall-content-box" :class="item.yigou ==1?'mall-yigou-box':''">
  17. <img :src='item.cover' class="mall-image" />
  18. <view class="content-body-box">
  19. <view class="content-name">
  20. <view class="name-text">{{item.name}}</view>
  21. </view>
  22. <view class="content-text">{{item.intro}}</view>
  23. <view class="content-row">
  24. <view class="content-yuanjia">原价:{{item.yuanjia}}</view>
  25. <view class="shop-car-box" @click="addProduct(item)">
  26. <icon v-if="productData.selectedIds.includes(item.id)" class="car-change">
  27. </icon>
  28. </view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="mall-bottom-row">
  33. <view v-if="item.type ==1" class="kcb-btn" @click="productBtn(item.levelList)">课程包明细
  34. <icon>
  35. </icon>
  36. </view>
  37. <view class="hdj-text">活动价:{{item.xianjia}}</view>
  38. </view>
  39. </view>
  40. </scroll-view>
  41. </view>
  42. <view v-if="productData.current === 1">
  43. <scroll-view scroll-y="true" :scroll-into-view="scrollIntoId" class="order-scroll-view">
  44. <!--数学-->
  45. <view :id="'item-' + item.id" v-for="item in productData.list" :key="item.id"
  46. class="mall-list-item">
  47. <view class="mall-content-box" :class="item.yigou ==1?'mall-yigou-box':''">
  48. <img :src='item.cover' class="mall-image" />
  49. <view class="content-body-box">
  50. <view class="content-name">
  51. <view class="name-text">{{item.name}}</view>
  52. </view>
  53. <view class="content-text">{{item.intro}}</view>
  54. <view class="content-row">
  55. <view class="content-yuanjia">原价:{{item.yuanjia}}</view>
  56. <view class="shop-car-box" v-if="item.yigou !=1" @click="addProduct(item)">
  57. <icon v-if="productData.selectedIds.includes(item.id)" class="car-change">
  58. </icon>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="mall-bottom-row">
  64. <view v-if="item.type ==1" class="kcb-btn" @click="productBtn(item.levelList)">课程包明细
  65. <icon>
  66. </icon>
  67. </view>
  68. <view class="hdj-text">活动价:{{item.xianjia}}</view>
  69. </view>
  70. </view>
  71. </scroll-view>
  72. </view>
  73. <!-- <view v-if="productData.current === 2">
  74. <view>语文</view>
  75. </view> -->
  76. </view>
  77. </view>
  78. <view class="footer-mall-pay-box">
  79. <view class="mall-left-box" @click="detailBtn">
  80. <!-- 需要换成从接口中取得 wgy -->
  81. <view class="price-icon-box">
  82. <text class="red-price fh-text">¥</text>
  83. <text class="red-price">{{totalPrice}}</text>明细
  84. <icon :class="mxjtClass"></icon>
  85. </view>
  86. <view>购买即同意虚拟产品不支持退订</view>
  87. </view>
  88. <!-- 微信 -->
  89. <view class="pay-status-box" v-if="payType =='weixin'&&currentPlatform =='android'" @click="switchPayWay">
  90. <icon class="wx-icon"></icon>微信
  91. </view>
  92. <view class="pay-status-box" v-if="payType =='zhifubao'&&currentPlatform =='android'" @click="switchPayWay">
  93. <icon class="zfb-icon"></icon>支付宝
  94. </view>
  95. <view class="pay-status-box apple-status-box" v-if="currentPlatform =='ios'">
  96. <icon class="apple-icon"></icon>apple
  97. </view>
  98. <view v-if="currentPlatform =='android'" class="pay-btn" @touchstart="creatOrder">立即支付
  99. </view>
  100. <view v-if="currentPlatform =='ios'" class="pay-btn" @touchstart="creatOrderIos">立即支付</view>
  101. </view>
  102. <detail-dialog ref="mallDetailPopup" :selected-list="getSelectedProducts"></detail-dialog>
  103. <product-dialog ref="mallProductPopup"></product-dialog>
  104. <tip-big-dialog ref="youkeDialogRef" @confirm-btn="ykConfirm" :imgShow="true"></tip-big-dialog>
  105. </view>
  106. </template>
  107. <script setup>
  108. import {
  109. reactive,
  110. computed,
  111. nextTick,
  112. ref
  113. } from "vue";
  114. import {
  115. getMallist,
  116. getMallistCom
  117. } from "@/api/productMall.js";
  118. import {
  119. orderAdd,
  120. orderPayAli,
  121. orderPayWx,
  122. orderPayApple,
  123. orderCheck
  124. } from "@/api/order.js"
  125. import {
  126. onLoad
  127. } from "@dcloudio/uni-app";
  128. import {
  129. toast,
  130. debounce,
  131. getUserIdentity
  132. } from "@/utils/common";
  133. import cacheManager from '@/utils/cacheManager.js';
  134. import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
  135. import detailDialog from './detailDialog.vue'
  136. import tipBigDialog from '@/components/dialog/tipBigDialog.vue';
  137. import productDialog from './productDialog.vue'
  138. const showPayWay = ref(true)
  139. const showDetail = ref(false)
  140. const mxjtClass = ref('mxjt-sq-icon')
  141. const mallDetailPopup = ref(null);
  142. const mallProductPopup = ref(null);
  143. const youkeDialogRef = ref(null);
  144. let scrollIntoId = ref(null)
  145. const productData = reactive({
  146. items: ['数学', '英语'],
  147. current: 1,
  148. from: '',
  149. cardId: '',
  150. list: [],
  151. selectedIds: [] // 新增选中状态存储
  152. })
  153. let currentPlatform = ref('android')
  154. const payType = ref('weixin');
  155. let orderId = ref('');
  156. let productId = ref(null)
  157. let iapChannel = ref(null)
  158. let quantity = ref(1)
  159. let channel = ref('')
  160. let appleFlag = ref('')
  161. const subjectId = ref(null); //游客使用
  162. const levelId = ref(null); //游客使用
  163. const typeId = ref(null); //游客使用
  164. const tipFlag = ref(null); //游客使用
  165. const totalPrice = computed(() => {
  166. return productData.list
  167. .filter(item => productData.selectedIds.includes(item.id))
  168. .reduce((sum, item) => sum + parseFloat(item.xianjia || 0), 0)
  169. .toFixed(2)
  170. })
  171. const getSelectedProducts = computed(() => {
  172. return productData.list.filter(item => productData.selectedIds.includes(item.id));
  173. });
  174. function switchPayWay() {
  175. payType.value = payType.value == 'weixin' ? 'zhifubao' : 'weixin'
  176. }
  177. function productBtn(item) {
  178. mallProductPopup.value.detailShow(item);
  179. }
  180. function ykConfirm() {
  181. uni.redirectTo({
  182. url: '/pages/login/index'
  183. });
  184. }
  185. function detailBtn() {
  186. // // 获取选中商品的cardId列表
  187. // const selectedProducts = productData.list.filter(
  188. // item => productData.selectedIds.includes(item.id)
  189. // );
  190. // const cardIds = selectedProducts.map(item => item.id);
  191. // console.log('cardIds', cardIds);
  192. if (productData.selectedIds.length === 0) {
  193. toast("请选择至少一个商品查看明细");
  194. return;
  195. }
  196. showDetail.value = !showDetail.value;
  197. if (showDetail.value) {
  198. const selected = productData.list.filter(item =>
  199. productData.selectedIds.includes(item.id)
  200. );
  201. mxjtClass.value = 'mxjt-zk-icon';
  202. mallDetailPopup.value.detailShow(selected);
  203. } else {
  204. mxjtClass.value = 'mxjt-sq-icon';
  205. mallDetailPopup.value.detailCloseBtn();
  206. }
  207. }
  208. const isIOSorAndroid = () => {
  209. const systemInfo = uni.getSystemInfoSync();
  210. console.log('systemInfo', systemInfo);
  211. if (systemInfo.platform == 'ios') {
  212. return currentPlatform.value = 'ios'
  213. } else {
  214. return currentPlatform.value = 'android'
  215. }
  216. }
  217. function genggaiVip(data) {
  218. uni.hideLoading();
  219. const localList = cacheManager.get('auth').levelIdList || []
  220. const mergeList = [...new Set([...localList, ...data.levelIdList])]
  221. cacheManager.updateObject('auth', {
  222. levelIdList: mergeList
  223. })
  224. uni.redirectTo({
  225. url: '/pages/pay/order?status=2'
  226. })
  227. // toast("chenggong!!!! 之后跳转我的订单页面")
  228. // if (formPage.value == 'my') {
  229. // uni.redirectTo({
  230. // url: '/pages/my/index'
  231. // })
  232. // } else {
  233. // uni.redirectTo({
  234. // url: '/pages/study/index'
  235. // })
  236. // }
  237. }
  238. const creatOrderIos = debounce((data => {
  239. if (productData.selectedIds.length === 0) {
  240. toast("请选择至少一个商品");
  241. return;
  242. }
  243. const selectedProducts = productData.list.filter(
  244. item => productData.selectedIds.includes(item.id)
  245. );
  246. const cardIds = selectedProducts.map(item => item.id);
  247. console.log('cardIds', cardIds);
  248. uni.showLoading({
  249. title: '',
  250. mask: true
  251. });
  252. if (appleFlag.value.toString() == 'true') {
  253. productId.value = 'llisoftEzhuangyuanceshi'
  254. } else {
  255. if (cardId.value == 1) {
  256. productId.value = 'llisoftEzhuangyuan'
  257. } else {
  258. productId.value = 'llisoftEzhuangyuanYingyu'
  259. }
  260. }
  261. let req = {
  262. cardIds: cardIds
  263. }
  264. orderAdd(req).then(res => {
  265. console.log('res', res);
  266. if (res.code == 0) {
  267. uni.hideLoading();
  268. orderId.value = res.data.id
  269. // 测试ios 1元
  270. applePay()
  271. } else {
  272. uni.hideLoading();
  273. return false
  274. console.log('请求失败');
  275. }
  276. }).catch((e) => {
  277. uni.hideLoading();
  278. toast("订单创建失败")
  279. return false
  280. })
  281. }), 500)
  282. function applePaySuccess(data) {
  283. uni.showLoading({
  284. title: '开通中',
  285. mask: true
  286. });
  287. let req = {
  288. "id": orderId.value,
  289. "paynum": data.transactionIdentifier,
  290. "receipt": data.transactionReceipt
  291. }
  292. console.log('reqreq', req);
  293. orderPayApple(req).then(res => {
  294. if (res.code == 0 && res.data) {
  295. iapChannel.finishTransaction(data.transactionIdentifier)
  296. console.log('resiapChanneliapChanneliapChannel', res);
  297. orderCheck({
  298. id: orderId.value
  299. }).then(res3 => {
  300. console.log('res3', res3);
  301. if (res3.code == 0) {
  302. genggaiVip(res3.data)
  303. } else {
  304. setTimeout(() => {
  305. orderCheck({
  306. id: orderId.value
  307. }).then(res4 => {
  308. if (res4.code == 0) {
  309. genggaiVip(res4.data)
  310. } else {
  311. toast(
  312. "开通失败,请联系管理员!"
  313. )
  314. uni
  315. .hideLoading();
  316. return false
  317. }
  318. }).catch(() => {
  319. uni.hideLoading();
  320. toast("check接口报错")
  321. return false
  322. })
  323. }, 5000)
  324. }
  325. }).catch(() => {
  326. uni.hideLoading();
  327. toast("check接口报错")
  328. return false
  329. })
  330. } else {
  331. iapChannel.finishTransaction(data.transactionIdentifier)
  332. uni.hideLoading();
  333. toast("苹果内购失败")
  334. console.log('orderPayApple失败');
  335. return false
  336. }
  337. })
  338. }
  339. function applePay() {
  340. console.log('123123');
  341. if (!productId.value) {
  342. uni.showToast({
  343. title: '苹果内购ID缺失,请选择其它支付方式或联系客服',
  344. icon: "none"
  345. });
  346. return false;
  347. }
  348. uni.showLoading({
  349. title: '正在支付中...'
  350. });
  351. try {
  352. plus.payment.getChannels(function(channels) { //判读项目支付通道开通情况
  353. for (var i in channels) {
  354. iapChannel = channels[i];
  355. // 获取 id 为 'appleiap' 的 channel
  356. console.info("支付通道", iapChannel)
  357. if (iapChannel.id === 'appleiap') { //开通了app应用内支付,在manifest.josn中设置,开通后需打自定议基座
  358. console.info("苹果支付通道", iapChannel)
  359. // ids 数组中的项为 App Store Connect 配置的内购买项目产品ID(productId)
  360. var ids = [productId.value];
  361. // iap 为应用内支付对象
  362. iapChannel.requestOrder(ids, function(e) {
  363. // 获取订单信息成功回调方法
  364. console.log('requestOrder success: ' + JSON.stringify(e));
  365. uni.requestPayment({
  366. provider: 'appleiap',
  367. orderInfo: {
  368. productid: productId.value, //产品id,来自于苹果
  369. quantity: quantity.value, //产品数量
  370. manualFinishTransaction: true
  371. },
  372. success: (e) => {
  373. uni.hideLoading();
  374. // toast("苹果内购成功")
  375. console.info("苹果内购成功", e)
  376. applePaySuccess(e)
  377. //e.payment.orderNo = that.orderNo
  378. //支付成功回调,前端调用后台接口
  379. },
  380. fail: (e) => {
  381. uni.hideLoading();
  382. toast("苹果内购失败")
  383. console.info("苹果内购失败", e)
  384. },
  385. })
  386. },
  387. function(e) {
  388. // 获取订单信息失败回调方法
  389. console.log('requestOrder failed: ' + JSON.stringify(e));
  390. });
  391. } else {
  392. console.log('不支持苹果支付')
  393. }
  394. }
  395. },
  396. function(e) {
  397. console.log("获取iap支付通道失败:" + e.message);
  398. });
  399. } catch (e) {
  400. uni.showModal({
  401. title: "init",
  402. content: e.message,
  403. showCancel: false
  404. });
  405. } finally {
  406. uni.hideLoading();
  407. }
  408. }
  409. function wxPay() {
  410. orderPayWx({
  411. id: orderId.value
  412. }).then(res2 => {
  413. uni.hideLoading();
  414. console.log('res2', res2);
  415. if (res2.code != 0) {
  416. return false
  417. }
  418. uni.requestPayment({
  419. "provider": "wxpay",
  420. "orderInfo": {
  421. "appid": res2.data.appid, // 应用ID(AppID)
  422. "partnerid": res2.data.partnerId, // 商户号(PartnerID)
  423. "prepayid": res2.data.prepayId, // 预支付交易会话ID
  424. "package": res2.data.packageVal, // 固定值
  425. "noncestr": res2.data.nonceStr, // 随机字符串
  426. "timestamp": res2.data.timestamp, // 时间戳(单位:秒)
  427. "sign": res2.data.sign // 签名,这里用的 MD5 签名
  428. }, //此处为服务器返回的订单信息字符串
  429. success: function(res) {
  430. //var rawdata = JSON.parse(res.rawdata);
  431. // console.log('res',res);
  432. // console.log('支付成功');
  433. // console.log('rawdata', rawdata);
  434. uni.showLoading({
  435. title: '开通中,请稍后...'
  436. });
  437. orderCheck({
  438. id: orderId.value
  439. }).then(res3 => {
  440. console.log('res3', res3);
  441. if (res3.code == 0) {
  442. genggaiVip(res3.data)
  443. } else {
  444. setTimeout(() => {
  445. orderCheck({
  446. id: orderId.value
  447. }).then(res4 => {
  448. if (res4.code == 0) {
  449. genggaiVip(res4.data)
  450. } else {
  451. toast(
  452. "开通失败,请联系管理员!"
  453. )
  454. uni
  455. .hideLoading();
  456. return false
  457. }
  458. }).catch(() => {
  459. uni.hideLoading();
  460. toast("check接口报错")
  461. return false
  462. })
  463. }, 5000)
  464. }
  465. }).catch(() => {
  466. uni.hideLoading();
  467. toast("check接口报错")
  468. return false
  469. })
  470. },
  471. fail: function(err) {
  472. uni.hideLoading();
  473. // toast('支付失败:' + JSON.stringify(err));
  474. console.log('支付失败:' + JSON.stringify(err));
  475. }
  476. });
  477. }).catch((error) => {
  478. uni.hideLoading();
  479. console.log(error);
  480. })
  481. }
  482. function aliApy() {
  483. orderPayAli({
  484. id: orderId.value
  485. }).then(res2 => {
  486. console.log('res2', res2);
  487. if (res2.code != 0) {
  488. return false
  489. }
  490. uni.hideLoading();
  491. uni.requestPayment({
  492. "provider": "alipay",
  493. "orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串
  494. success: function(res) {
  495. // var rawdata = JSON.parse(res.rawdata);
  496. // console.log('支付成功');
  497. // console.log('rawdata', rawdata);
  498. uni.showLoading({
  499. title: '开通中,请稍后...'
  500. });
  501. orderCheck({
  502. id: orderId.value
  503. }).then(res3 => {
  504. if (res3.code == 0) {
  505. genggaiVip(res3.data)
  506. } else {
  507. setTimeout(() => {
  508. orderCheck({
  509. id: orderId.value
  510. }).then(res4 => {
  511. if (res4.code ==
  512. 0) {
  513. genggaiVip(res4.data)
  514. } else {
  515. toast(
  516. "开通失败,请联系管理员!"
  517. )
  518. uni
  519. .hideLoading();
  520. return false
  521. }
  522. }).catch(() => {
  523. uni.hideLoading();
  524. toast("check接口报错")
  525. return false
  526. })
  527. }, 5000)
  528. }
  529. }).catch(() => {
  530. uni.hideLoading();
  531. toast("check接口报错")
  532. return false
  533. })
  534. },
  535. fail: function(err) {
  536. console.log('支付失败:' + JSON.stringify(err));
  537. uni.hideLoading();
  538. }
  539. });
  540. })
  541. }
  542. const creatOrder = debounce((data) => {
  543. if (productData.selectedIds.length === 0) {
  544. toast("请选择至少一个商品");
  545. return;
  546. }
  547. // 获取选中商品的cardId列表
  548. const selectedProducts = productData.list.filter(
  549. item => productData.selectedIds.includes(item.id)
  550. );
  551. const cardIds = selectedProducts.map(item => item.id);
  552. console.log('cardIds', cardIds);
  553. uni.showLoading({
  554. title: '',
  555. mask: true
  556. });
  557. if (payType.value == 'weixin') {
  558. console.log('创建订单11');
  559. let req = {
  560. cardIds: cardIds
  561. }
  562. orderAdd(req).then(res => {
  563. console.log('res', res);
  564. console.log(' res.data.id', res.data.id);
  565. orderId.value = res.data.id
  566. wxPay()
  567. }).catch((err) => {
  568. uni.hideLoading();
  569. toast("订单创建失败")
  570. return false
  571. })
  572. } else {
  573. let req = {
  574. cardIds: cardIds
  575. }
  576. orderAdd(req).then(res => {
  577. console.log('res', res);
  578. orderId.value = res.data.id
  579. aliApy()
  580. }).catch((err) => {
  581. uni.hideLoading();
  582. toast("订单创建失败")
  583. return false
  584. })
  585. }
  586. }, 500)
  587. function onChangeTab(e) {
  588. console.log('e', e);
  589. productData.current = e.currentIndex
  590. productData.selectedIds = [] // 清空选中
  591. if (!cacheManager.get('auth')) {
  592. getMoreYk()
  593. } else {
  594. getMore()
  595. }
  596. }
  597. function getMore() {
  598. const opt = {
  599. subjectId: productData.current + 1
  600. }
  601. getMallist(opt).then(res => {
  602. if (res.code == 0) {
  603. productData.list = res.data
  604. // 初始化选中状态(当有外部cardId时)
  605. if (productData.cardId) {
  606. const exist = res.data.some(item => item.id == productData.cardId)
  607. if (exist) {
  608. productData.selectedIds = [Number(productData.cardId)]
  609. }
  610. }
  611. nextTick(() => {
  612. scrollToIdFun(productData.cardId)
  613. })
  614. }
  615. }).catch(err => {
  616. toast("获取产品数据失败")
  617. return false
  618. })
  619. }
  620. function getMoreYk() {
  621. const opt = {
  622. subjectId: productData.current + 1
  623. }
  624. getMallistCom(opt).then(res => {
  625. if (res.code == 0) {
  626. productData.list = res.data
  627. }
  628. }).catch(err => {
  629. toast("获取产品数据失败")
  630. return false
  631. })
  632. }
  633. function scrollToIdFun(targetId) {
  634. const index = productData.list.findIndex(item => item.id == targetId)
  635. console.log('index', index);
  636. if (index > -1) {
  637. // 安卓设备需要双保险
  638. scrollIntoId.value = `item-${targetId}`
  639. setTimeout(() => {
  640. scrollIntoId.value = `item-${targetId}`
  641. }, 300)
  642. }
  643. }
  644. function addProduct(item) {
  645. if (!cacheManager.get('auth')) {
  646. youkeDialogRef.value.handleShow();
  647. return false
  648. }
  649. console.log('item', item);
  650. const temp = [...productData.selectedIds]
  651. const index = temp.indexOf(item.id)
  652. index > -1 ? temp.splice(index, 1) : temp.push(item.id)
  653. productData.selectedIds = temp
  654. console.log('productData.selectedIds', productData.selectedIds);
  655. }
  656. function isItemSelected(id) {
  657. return productData.cardId ?
  658. id == productData.cardId // 有外部cardId时严格匹配
  659. :
  660. productData.selectedIds.includes(id) // 无cardId时检查选中列表
  661. }
  662. function goBack() {
  663. if (!cacheManager.get('auth')) {
  664. // 游客
  665. uni.redirectTo({
  666. url: `/pages/my/index?levelId=${levelId.value}&typeId=${typeId.value}&subjectId=${subjectId.value}&tipFlag=${tipFlag.value}`
  667. })
  668. } else {
  669. if (productData.from == 'daoPage') {
  670. uni.redirectTo({
  671. url: '/pages/study/index'
  672. })
  673. } else {
  674. uni.redirectTo({
  675. url: '/pages/my/index'
  676. })
  677. }
  678. }
  679. }
  680. onLoad((options) => {
  681. if (!cacheManager.get('auth')) {
  682. // 游客
  683. levelId.value = options.levelId
  684. typeId.value = options.typeId
  685. subjectId.value = options.subjectId
  686. tipFlag.value = options.tipFlag
  687. productData.current = Number(options.subjectId) - 1
  688. getMoreYk()
  689. } else {
  690. if (options.from == 'daoPage') {
  691. productData.current = Number(options.subjectId) - 1
  692. productData.cardId = options.cardId
  693. productData.from = options.from
  694. } else {
  695. productData.current = Number(cacheManager.get('auth').subjectId) - 1
  696. }
  697. //isIOSorAndroid()
  698. getMore();
  699. }
  700. })
  701. </script>
  702. <style>
  703. </style>