index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <app-layout>
  3. <app-math-card v-for="(item,index) in mathLists"
  4. :key="index"
  5. :cover-image="item.coverImage"
  6. :title="item.title"
  7. :index="index"
  8. :custom-style="{marginLeft:index % 2 === 1 ? '20rpx' : 0}"
  9. @open="handleOpen"
  10. >
  11. </app-math-card>
  12. <u-modal v-model="modal.show"
  13. :show-cancel-button="true"
  14. cancel-text="放弃机会"
  15. cancel-color="#CCCCCC"
  16. confirm-text="购买"
  17. confirm-color="#046E64"
  18. @confirm="handleConfirmBuy"
  19. >
  20. <view class="slot-content">
  21. <view class="title">{{modal.title}}</view>
  22. <view class="sub-title">{{modal.subTitle}}</view>
  23. </view>
  24. </u-modal>
  25. </app-layout>
  26. </template>
  27. <script>
  28. import appLayout from "@/components/app-layout"
  29. import appMathCard from "@/components/index/app-math-card"
  30. import mathLists from "@/core/math-lists.js"
  31. export default {
  32. components:{
  33. appLayout,
  34. appMathCard
  35. },
  36. data() {
  37. return {
  38. mathLists: mathLists,
  39. modal:{
  40. show: false,
  41. title: '该功能需开通永久使用',
  42. subTitle: '做桥架不求人,让你秒变大师',
  43. },
  44. scene: '',
  45. setting: null
  46. }
  47. },
  48. methods: {
  49. handleOpen(index){
  50. if(this.setting.review_mode) return
  51. if(this.vuex_user_data.is_vip == 0){
  52. this.modal.show = true
  53. /*if(this.$platform === 'ios'){
  54. uni.showModal({
  55. title: '提示',
  56. content: '由于相关规范,iOS功能暂不可用',
  57. success: function (res) {
  58. // res.confirm res.cancel
  59. }
  60. });
  61. }else{
  62. this.modal.show = true
  63. }*/
  64. }else{
  65. this.$jump({url: mathLists[index].url,type:'to'})
  66. }
  67. },
  68. handleConfirmBuy(){
  69. this.$jump({url:'/pages/my/member',type:'to'})
  70. },
  71. handleBind(){
  72. this.$u.api.userBind({scene:this.scene}).then(res => {
  73. this.$u.vuex(this.$const.USER_SCENE, null);
  74. })
  75. },
  76. getSetting(){
  77. this.$u.api.settingGet().then(data => {
  78. this.setting = data;
  79. })
  80. },
  81. },
  82. onLoad(options){
  83. this.scene = options.scene;
  84. console.log('-->data',this.scene)
  85. if(this.scene){
  86. this.$u.vuex(this.$const.USER_SCENE,this.scene);
  87. this.handleBind()
  88. }
  89. this.getSetting();
  90. },
  91. onShareAppMessage() {
  92. return this.$util.shareMessage(this.vuex_user_data);
  93. },
  94. }
  95. </script>
  96. <style lang="scss" scoped>
  97. .slot-content{
  98. text-align: center;
  99. padding: 36rpx 0;
  100. .title{
  101. font-size: 36rpx;
  102. font-weight: 600;
  103. color: #333333;
  104. padding: 12rpx 0;
  105. }
  106. .sub-title{
  107. font-size: 28rpx;
  108. color: #999999;
  109. }
  110. }
  111. </style>