index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <template>
  2. <view style="padding: 30rpx;">
  3. <view style="padding: 0 50rpx;">
  4. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="button" activeColor="#2F4379"></uni-segmented-control>
  5. </view>
  6. <view>
  7. <view v-show="current === 0">
  8. <view v-if="list1.length === 0" class="mar-t"><u-empty text="未购买课程" mode="list"></u-empty></view>
  9. <view v-else class="content" v-for="(item, index) in list1" :key="index" @click="jumpDetail(item)">
  10. <view>
  11. <u-row>
  12. <u-col span="5">
  13. <view style="padding: 5rpx;"><image :src="$method.splitImgHost(item.coverUrl)" class="c_img"></image></view>
  14. </u-col>
  15. <u-col span="7">
  16. <view style="position: relative;height: 134rpx;padding-left: 10rpx;">
  17. <view class="c_title">{{ item.courseName }}</view>
  18. </view>
  19. </u-col>
  20. </u-row>
  21. </view>
  22. </view>
  23. </view>
  24. <view v-show="current === 1">
  25. <view v-if="list2.length === 0" class="mar-t"><u-empty text="未购买题库" mode="list"></u-empty></view>
  26. <view v-else class="content" v-for="(item, index) in list2" :key="index" @click="jumpDetail(item)">
  27. <view>
  28. <u-row>
  29. <u-col span="5">
  30. <view style="padding: 5rpx;"><image :src="$method.splitImgHost(item.coverUrl)" class="c_img"></image></view>
  31. </u-col>
  32. <u-col span="7">
  33. <view style="position: relative;height: 134rpx;padding-left: 10rpx;">
  34. <view class="c_title">{{ item.bankName }}</view>
  35. </view>
  36. </u-col>
  37. </u-row>
  38. </view>
  39. </view>
  40. </view>
  41. <view v-show="current === 2">
  42. <view v-if="list3.length === 0" class="mar-t"><u-empty text="未购买考点重点" mode="list"></u-empty></view>
  43. <view v-else class="content" v-for="(item, index) in list3" :key="index" @click="jumpDetail(item)">
  44. <view>
  45. <u-row>
  46. <u-col span="5">
  47. <view style="padding: 5rpx;"><image :src="$method.splitImgHost(item.coverUrl)" class="c_img"></image></view>
  48. </u-col>
  49. <u-col span="7">
  50. <view style="position: relative;height: 134rpx;padding-left: 10rpx;">
  51. <view class="c_title">{{ item.name }}</view>
  52. </view>
  53. </u-col>
  54. </u-row>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. export default {
  63. data() {
  64. return {
  65. current: 0,
  66. items: ['课程', '刷题', '重点考点'],
  67. list1: [],
  68. list2: [],
  69. list3: [],
  70. paramList: [
  71. {
  72. typeId: 1
  73. },
  74. {
  75. typeId: 2
  76. },
  77. {
  78. typeId: 3
  79. }
  80. ]
  81. };
  82. },
  83. onLoad(option) {
  84. if (option.status !== undefined) {
  85. this.current = parseInt(option.status);
  86. }
  87. this.getMyCourse();
  88. this.getMyBank();
  89. this.getMyNote();
  90. },
  91. onShow() {},
  92. methods: {
  93. jumpDetail(item) {
  94. if (this.current == 0) {
  95. this.$navTo.togo('/pages2/course/detail', {
  96. id: item.courseId
  97. });
  98. return;
  99. }
  100. if (this.current == 1) {
  101. this.$navTo.togo('/pages2/bank/detail', {
  102. id: item.bankId
  103. });
  104. return;
  105. }
  106. if (this.current == 2) {
  107. this.$navTo.togo('/pages2/course/keynote', {
  108. id: item.fileId
  109. });
  110. return;
  111. }
  112. },
  113. onClickItem(e) {
  114. this.current = e.currentIndex;
  115. },
  116. getMyCourse() {
  117. var self = this;
  118. var param = this.paramList[0];
  119. this.$api.getUserBuy(param).then(result => {
  120. if (result.data.data.courseVoList !== null) {
  121. self.list1.push.apply(self.list1, result.data.data.courseVoList);
  122. }
  123. });
  124. },
  125. getMyBank() {
  126. var self = this;
  127. var param = this.paramList[1];
  128. this.$api.getUserBuy(param).then(result => {
  129. if (result.data.data.questionBankList !== null) {
  130. self.list2.push.apply(self.list2, result.data.data.questionBankList);
  131. }
  132. });
  133. },
  134. getMyNote() {
  135. var self = this;
  136. var param = this.paramList[2];
  137. this.$api.getUserBuy(param).then(result => {
  138. if (result.data.data.examNoteList !== null) {
  139. self.list3.push.apply(self.list3, result.data.data.examNoteList);
  140. }
  141. });
  142. }
  143. }
  144. };
  145. </script>
  146. <style scope>
  147. .mar-t {
  148. margin-top: 30rpx;
  149. }
  150. .c_log {
  151. font-size: 20rpx;
  152. font-family: PingFang SC;
  153. font-weight: 400;
  154. color: #2f4379;
  155. position: absolute;
  156. bottom: 10rpx;
  157. }
  158. .c_title {
  159. font-size: 30rpx;
  160. font-family: PingFang SC;
  161. font-weight: bold;
  162. color: #2f4379;
  163. padding-top: 10rpx;
  164. }
  165. .c_img {
  166. width: 278rpx;
  167. height: 134rpx;
  168. }
  169. .c_t1 {
  170. font-size: 20rpx;
  171. color: #2f4379;
  172. padding: 15rpx;
  173. }
  174. .content {
  175. margin-top: 20rpx;
  176. width: 100%;
  177. height: 165rpx;
  178. background: #ffffff;
  179. box-shadow: 0rpx 0rpx 16rpx 4rpx rgba(145, 156, 178, 0.1);
  180. border-radius: 32rpx;
  181. }
  182. .segmented-control__text {
  183. font-size: 24rpx !important;
  184. }
  185. .segmented-control {
  186. height: 56rpx !important;
  187. background-color: #f8f9ff;
  188. }
  189. page {
  190. background: #ffffff;
  191. }
  192. </style>