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. toast("支付成功")
  225. uni.redirectTo({
  226. url: '/pages/pay/order?status=2'
  227. })
  228. // toast("chenggong!!!! 之后跳转我的订单页面")
  229. // if (formPage.value == 'my') {
  230. // uni.redirectTo({
  231. // url: '/pages/my/index'
  232. // })
  233. // } else {
  234. // uni.redirectTo({
  235. // url: '/pages/study/index'
  236. // })
  237. // }
  238. }
  239. const creatOrderIos = debounce((data => {
  240. if (productData.selectedIds.length === 0) {
  241. toast("请选择至少一个商品");
  242. return;
  243. }
  244. const selectedProducts = productData.list.filter(
  245. item => productData.selectedIds.includes(item.id)
  246. );
  247. const cardIds = selectedProducts.map(item => item.id);
  248. console.log('cardIds', cardIds);
  249. uni.showLoading({
  250. title: '',
  251. mask: true
  252. });
  253. if (appleFlag.value.toString() == 'true') {
  254. productId.value = 'llisoftEzhuangyuanceshi'
  255. } else {
  256. if (cardId.value == 1) {
  257. productId.value = 'llisoftEzhuangyuan'
  258. } else {
  259. productId.value = 'llisoftEzhuangyuanYingyu'
  260. }
  261. }
  262. let req = {
  263. cardIds: cardIds
  264. }
  265. orderAdd(req).then(res => {
  266. console.log('res', res);
  267. if (res.code == 0) {
  268. uni.hideLoading();
  269. orderId.value = res.data.id
  270. // 测试ios 1元
  271. applePay()
  272. } else {
  273. uni.hideLoading();
  274. return false
  275. console.log('请求失败');
  276. }
  277. }).catch((e) => {
  278. uni.hideLoading();
  279. toast("订单创建失败")
  280. return false
  281. })
  282. }), 500)
  283. function applePaySuccess(data) {
  284. uni.showLoading({
  285. title: '开通中',
  286. mask: true
  287. });
  288. let req = {
  289. "id": orderId.value,
  290. "paynum": data.transactionIdentifier,
  291. "receipt": data.transactionReceipt
  292. }
  293. console.log('reqreq', req);
  294. orderPayApple(req).then(res => {
  295. if (res.code == 0 && res.data) {
  296. iapChannel.finishTransaction(data.transactionIdentifier)
  297. console.log('resiapChanneliapChanneliapChannel', res);
  298. orderCheck({
  299. id: orderId.value
  300. }).then(res3 => {
  301. console.log('res3', res3);
  302. if (res3.code == 0) {
  303. genggaiVip(res3.data)
  304. } else {
  305. setTimeout(() => {
  306. orderCheck({
  307. id: orderId.value
  308. }).then(res4 => {
  309. if (res4.code == 0) {
  310. genggaiVip(res4.data)
  311. } else {
  312. toast(
  313. "开通失败,请联系管理员!"
  314. )
  315. uni
  316. .hideLoading();
  317. return false
  318. }
  319. }).catch(() => {
  320. uni.hideLoading();
  321. toast("check接口报错")
  322. return false
  323. })
  324. }, 5000)
  325. }
  326. }).catch(() => {
  327. uni.hideLoading();
  328. toast("check接口报错")
  329. return false
  330. })
  331. } else {
  332. iapChannel.finishTransaction(data.transactionIdentifier)
  333. uni.hideLoading();
  334. toast("苹果内购失败")
  335. console.log('orderPayApple失败');
  336. return false
  337. }
  338. })
  339. }
  340. function applePay() {
  341. console.log('123123');
  342. if (!productId.value) {
  343. uni.showToast({
  344. title: '苹果内购ID缺失,请选择其它支付方式或联系客服',
  345. icon: "none"
  346. });
  347. return false;
  348. }
  349. uni.showLoading({
  350. title: '正在支付中...'
  351. });
  352. try {
  353. plus.payment.getChannels(function(channels) { //判读项目支付通道开通情况
  354. for (var i in channels) {
  355. iapChannel = channels[i];
  356. // 获取 id 为 'appleiap' 的 channel
  357. console.info("支付通道", iapChannel)
  358. if (iapChannel.id === 'appleiap') { //开通了app应用内支付,在manifest.josn中设置,开通后需打自定议基座
  359. console.info("苹果支付通道", iapChannel)
  360. // ids 数组中的项为 App Store Connect 配置的内购买项目产品ID(productId)
  361. var ids = [productId.value];
  362. // iap 为应用内支付对象
  363. iapChannel.requestOrder(ids, function(e) {
  364. // 获取订单信息成功回调方法
  365. console.log('requestOrder success: ' + JSON.stringify(e));
  366. uni.requestPayment({
  367. provider: 'appleiap',
  368. orderInfo: {
  369. productid: productId.value, //产品id,来自于苹果
  370. quantity: quantity.value, //产品数量
  371. manualFinishTransaction: true
  372. },
  373. success: (e) => {
  374. uni.hideLoading();
  375. // toast("苹果内购成功")
  376. console.info("苹果内购成功", e)
  377. applePaySuccess(e)
  378. //e.payment.orderNo = that.orderNo
  379. //支付成功回调,前端调用后台接口
  380. },
  381. fail: (e) => {
  382. uni.hideLoading();
  383. toast("苹果内购失败")
  384. console.info("苹果内购失败", e)
  385. },
  386. })
  387. },
  388. function(e) {
  389. // 获取订单信息失败回调方法
  390. console.log('requestOrder failed: ' + JSON.stringify(e));
  391. });
  392. } else {
  393. console.log('不支持苹果支付')
  394. }
  395. }
  396. },
  397. function(e) {
  398. console.log("获取iap支付通道失败:" + e.message);
  399. });
  400. } catch (e) {
  401. uni.showModal({
  402. title: "init",
  403. content: e.message,
  404. showCancel: false
  405. });
  406. } finally {
  407. uni.hideLoading();
  408. }
  409. }
  410. function wxPay() {
  411. orderPayWx({
  412. id: orderId.value
  413. }).then(res2 => {
  414. uni.hideLoading();
  415. console.log('res2', res2);
  416. if (res2.code != 0) {
  417. return false
  418. }
  419. uni.requestPayment({
  420. "provider": "wxpay",
  421. "orderInfo": {
  422. "appid": res2.data.appid, // 应用ID(AppID)
  423. "partnerid": res2.data.partnerId, // 商户号(PartnerID)
  424. "prepayid": res2.data.prepayId, // 预支付交易会话ID
  425. "package": res2.data.packageVal, // 固定值
  426. "noncestr": res2.data.nonceStr, // 随机字符串
  427. "timestamp": res2.data.timestamp, // 时间戳(单位:秒)
  428. "sign": res2.data.sign // 签名,这里用的 MD5 签名
  429. }, //此处为服务器返回的订单信息字符串
  430. success: function(res) {
  431. //var rawdata = JSON.parse(res.rawdata);
  432. // console.log('res',res);
  433. // console.log('支付成功');
  434. // console.log('rawdata', rawdata);
  435. uni.showLoading({
  436. title: '开通中,请稍后...'
  437. });
  438. orderCheck({
  439. id: orderId.value
  440. }).then(res3 => {
  441. console.log('res3', res3);
  442. if (res3.code == 0) {
  443. genggaiVip(res3.data)
  444. } else {
  445. setTimeout(() => {
  446. orderCheck({
  447. id: orderId.value
  448. }).then(res4 => {
  449. if (res4.code == 0) {
  450. genggaiVip(res4.data)
  451. } else {
  452. toast(
  453. "开通失败,请联系管理员!"
  454. )
  455. uni
  456. .hideLoading();
  457. return false
  458. }
  459. }).catch(() => {
  460. uni.hideLoading();
  461. toast("check接口报错")
  462. return false
  463. })
  464. }, 5000)
  465. }
  466. }).catch(() => {
  467. uni.hideLoading();
  468. toast("check接口报错")
  469. return false
  470. })
  471. },
  472. fail: function(err) {
  473. uni.hideLoading();
  474. // toast('支付失败:' + JSON.stringify(err));
  475. console.log('支付失败:' + JSON.stringify(err));
  476. }
  477. });
  478. }).catch((error) => {
  479. uni.hideLoading();
  480. console.log(error);
  481. })
  482. }
  483. function aliApy() {
  484. orderPayAli({
  485. id: orderId.value
  486. }).then(res2 => {
  487. console.log('res2', res2);
  488. if (res2.code != 0) {
  489. return false
  490. }
  491. uni.hideLoading();
  492. uni.requestPayment({
  493. "provider": "alipay",
  494. "orderInfo": res2.data.text, //此处为服务器返回的订单信息字符串
  495. success: function(res) {
  496. // var rawdata = JSON.parse(res.rawdata);
  497. // console.log('支付成功');
  498. // console.log('rawdata', rawdata);
  499. uni.showLoading({
  500. title: '开通中,请稍后...'
  501. });
  502. orderCheck({
  503. id: orderId.value
  504. }).then(res3 => {
  505. if (res3.code == 0) {
  506. genggaiVip(res3.data)
  507. } else {
  508. setTimeout(() => {
  509. orderCheck({
  510. id: orderId.value
  511. }).then(res4 => {
  512. if (res4.code ==
  513. 0) {
  514. genggaiVip(res4.data)
  515. } else {
  516. toast(
  517. "开通失败,请联系管理员!"
  518. )
  519. uni
  520. .hideLoading();
  521. return false
  522. }
  523. }).catch(() => {
  524. uni.hideLoading();
  525. toast("check接口报错")
  526. return false
  527. })
  528. }, 5000)
  529. }
  530. }).catch(() => {
  531. uni.hideLoading();
  532. toast("check接口报错")
  533. return false
  534. })
  535. },
  536. fail: function(err) {
  537. console.log('支付失败:' + JSON.stringify(err));
  538. uni.hideLoading();
  539. }
  540. });
  541. })
  542. }
  543. const creatOrder = debounce((data) => {
  544. if (productData.selectedIds.length === 0) {
  545. toast("请选择至少一个商品");
  546. return;
  547. }
  548. // 获取选中商品的cardId列表
  549. const selectedProducts = productData.list.filter(
  550. item => productData.selectedIds.includes(item.id)
  551. );
  552. const cardIds = selectedProducts.map(item => item.id);
  553. console.log('cardIds', cardIds);
  554. uni.showLoading({
  555. title: '',
  556. mask: true
  557. });
  558. if (payType.value == 'weixin') {
  559. console.log('创建订单11');
  560. let req = {
  561. cardIds: cardIds
  562. }
  563. orderAdd(req).then(res => {
  564. console.log('res', res);
  565. console.log(' res.data.id', res.data.id);
  566. orderId.value = res.data.id
  567. wxPay()
  568. }).catch((err) => {
  569. uni.hideLoading();
  570. toast("订单创建失败")
  571. return false
  572. })
  573. } else {
  574. let req = {
  575. cardIds: cardIds
  576. }
  577. orderAdd(req).then(res => {
  578. console.log('res', res);
  579. orderId.value = res.data.id
  580. aliApy()
  581. }).catch((err) => {
  582. uni.hideLoading();
  583. toast("订单创建失败")
  584. return false
  585. })
  586. }
  587. }, 500)
  588. function onChangeTab(e) {
  589. console.log('e', e);
  590. productData.current = e.currentIndex
  591. productData.selectedIds = [] // 清空选中
  592. if (!cacheManager.get('auth')) {
  593. getMoreYk()
  594. } else {
  595. getMore()
  596. }
  597. }
  598. function getMore() {
  599. const opt = {
  600. subjectId: productData.current + 1
  601. }
  602. getMallist(opt).then(res => {
  603. if (res.code == 0) {
  604. productData.list = res.data
  605. // 初始化选中状态(当有外部cardId时)
  606. if (productData.cardId) {
  607. const exist = res.data.some(item => item.id == productData.cardId)
  608. if (exist) {
  609. productData.selectedIds = [Number(productData.cardId)]
  610. }
  611. }
  612. nextTick(() => {
  613. scrollToIdFun(productData.cardId)
  614. })
  615. }
  616. }).catch(err => {
  617. toast("获取产品数据失败")
  618. return false
  619. })
  620. }
  621. function getMoreYk() {
  622. const opt = {
  623. subjectId: productData.current + 1
  624. }
  625. getMallistCom(opt).then(res => {
  626. if (res.code == 0) {
  627. productData.list = res.data
  628. }
  629. }).catch(err => {
  630. toast("获取产品数据失败")
  631. return false
  632. })
  633. }
  634. function scrollToIdFun(targetId) {
  635. const index = productData.list.findIndex(item => item.id == targetId)
  636. console.log('index', index);
  637. if (index > -1) {
  638. // 安卓设备需要双保险
  639. scrollIntoId.value = `item-${targetId}`
  640. setTimeout(() => {
  641. scrollIntoId.value = `item-${targetId}`
  642. }, 300)
  643. }
  644. }
  645. function addProduct(item) {
  646. if (!cacheManager.get('auth')) {
  647. youkeDialogRef.value.handleShow();
  648. return false
  649. }
  650. console.log('item', item);
  651. const temp = [...productData.selectedIds]
  652. const index = temp.indexOf(item.id)
  653. index > -1 ? temp.splice(index, 1) : temp.push(item.id)
  654. productData.selectedIds = temp
  655. console.log('productData.selectedIds', productData.selectedIds);
  656. }
  657. function isItemSelected(id) {
  658. return productData.cardId ?
  659. id == productData.cardId // 有外部cardId时严格匹配
  660. :
  661. productData.selectedIds.includes(id) // 无cardId时检查选中列表
  662. }
  663. function goBack() {
  664. if (!cacheManager.get('auth')) {
  665. // 游客
  666. uni.redirectTo({
  667. url: `/pages/my/index?levelId=${levelId.value}&typeId=${typeId.value}&subjectId=${subjectId.value}&tipFlag=${tipFlag.value}`
  668. })
  669. } else {
  670. if (productData.from == 'daoPage') {
  671. uni.redirectTo({
  672. url: '/pages/study/index'
  673. })
  674. } else {
  675. uni.redirectTo({
  676. url: '/pages/my/index'
  677. })
  678. }
  679. }
  680. }
  681. onLoad((options) => {
  682. if (!cacheManager.get('auth')) {
  683. // 游客
  684. levelId.value = options.levelId
  685. typeId.value = options.typeId
  686. subjectId.value = options.subjectId
  687. tipFlag.value = options.tipFlag
  688. productData.current = Number(options.subjectId) - 1
  689. getMoreYk()
  690. } else {
  691. if (options.from == 'daoPage') {
  692. productData.current = Number(options.subjectId) - 1
  693. productData.cardId = options.cardId
  694. productData.from = options.from
  695. } else {
  696. productData.current = Number(cacheManager.get('auth').subjectId) - 1
  697. }
  698. //isIOSorAndroid()
  699. getMore();
  700. }
  701. })
  702. </script>
  703. <style>
  704. </style>