index.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. parent_id: '',
  46. setting: null
  47. }
  48. },
  49. methods: {
  50. handleOpen(index){
  51. if(this.setting.review_mode) return
  52. this.$u.api.userGet().then(res => {
  53. if(res.is_vip == 0){
  54. this.modal.show = true
  55. }else{
  56. this.$jump({url: mathLists[index].url,type:'to'})
  57. }
  58. })
  59. },
  60. handleConfirmBuy(){
  61. this.$jump({url:'/pages/my/member',type:'to'})
  62. },
  63. handleBind(){
  64. this.$u.api.userBind({scene:this.scene,parent_id:this.parent_id}).then(res => {
  65. this.$u.vuex(this.$const.USER_SCENE, null);
  66. })
  67. },
  68. getSetting(){
  69. this.$u.api.settingGet().then(data => {
  70. this.setting = data;
  71. })
  72. },
  73. },
  74. onLoad(options){
  75. this.scene = options.scene ? options.scene : 0;
  76. this.parent_id = options.user_id ? options.user_id : 0;
  77. if(this.scene){
  78. this.$u.vuex(this.$const.USER_SCENE,this.scene);
  79. this.handleBind()
  80. }
  81. if(this.parent_id){
  82. this.$u.vuex(this.$const.USER_SCENE,this.scene);
  83. this.handleBind()
  84. }
  85. this.getSetting();
  86. },
  87. onShareAppMessage() {
  88. return this.$util.shareMessage(this.vuex_user_data);
  89. },
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .slot-content{
  94. text-align: center;
  95. padding: 36rpx 0;
  96. .title{
  97. font-size: 36rpx;
  98. font-weight: 600;
  99. color: #333333;
  100. padding: 12rpx 0;
  101. }
  102. .sub-title{
  103. font-size: 28rpx;
  104. color: #999999;
  105. }
  106. }
  107. </style>