ZhengShu.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. <template>
  2. <div>
  3. <div class="list">
  4. <div class="title">我的证书</div>
  5. <!-- <div class="tab_list">
  6. <div :class="['item',curTab==0 ?'actived':'' ]" @click="changeTab(0)">
  7. 证书种类
  8. </div>
  9. <div :class="['item',curTab==1 ?'actived':'' ]" @click="changeTab(1)">
  10. 证书种类2
  11. </div>
  12. <div :class="['item',curTab==2 ?'actived':'' ]" @click="changeTab(2)">
  13. 证书种类3
  14. </div>
  15. <div :class="['item',curTab==3 ?'actived':'' ]" @click="changeTab(3)">
  16. 证书种类4
  17. </div>
  18. </div> -->
  19. <div class="zs_list" v-if="list.length>0">
  20. <u-grid :col="2" :border="false">
  21. <u-grid-item :custom-style="{'padding-bottom':'0px'}" @click="zsDetail(item)" v-for="item in list"
  22. :key="item.id">
  23. <div class="zs">
  24. <image :src="item.cover" mode="aspectFit"></image>
  25. <div class="line"></div>
  26. <div class="pop" v-if="myZs.xuefen <item.min_xuefen">
  27. <div>还差{{item.min_xuefen - myZs.xuefen}}学分</div>
  28. </div>
  29. </div>
  30. <div class="desc">
  31. <div class="name">{{item.name}}</div>
  32. <div class="get" v-if="myZs.xuefen >=item.min_xuefen">(已获得)</div>
  33. <div class="get" v-else></div>
  34. </div>
  35. </u-grid-item>
  36. </u-grid>
  37. </div>
  38. <div class="empty_image" v-else>
  39. <u-empty text="暂无记录"></u-empty>
  40. </div>
  41. </div>
  42. </div>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. curTab: 0,
  49. page: 1,
  50. last: false,
  51. list: [],
  52. myZs: {}
  53. }
  54. },
  55. created() {
  56. this.getZsList()
  57. this.getMyZs()
  58. },
  59. onReachBottom() {
  60. if (!this.last) {
  61. this.page++
  62. }
  63. this.getList()
  64. },
  65. methods: {
  66. zsDetail(item) {
  67. if (this.myZs.xuefen - item.min_xuefen < 0) {
  68. this.$u.toast('您还差' + (item.min_xuefen - this.myZs.xuefen) + '学分获得《' + item.name + "》")
  69. return
  70. }
  71. localStorage.setItem('zhengshu',JSON.stringify(item))
  72. uni.navigateTo({
  73. url: '/pages/rongyu/detail'
  74. })
  75. },
  76. //我的证书
  77. getMyZs() {
  78. this.$u.get('/dwbs/zhengshu/me').then(res => {
  79. this.myZs = res.data
  80. })
  81. },
  82. //重置列表请求
  83. resetList() {
  84. this.page = 1
  85. this.last = false
  86. this.list = []
  87. this.getZsList()
  88. },
  89. getZsList() {
  90. this.$u.get('/dwbs/zhengshus').then(res => {
  91. console.log(res, 'list')
  92. let data = res.data.data
  93. if (this.page > 1 && data.length == 0) {
  94. uni.showToast({
  95. title: '暂无更多',
  96. icon: 'none'
  97. })
  98. this.last = true
  99. } else {
  100. this.list = this.list.concat(data)
  101. }
  102. })
  103. },
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .list {
  109. padding: 16px;
  110. .title {
  111. height: 24px;
  112. border-left: 5px solid #F5222D;
  113. padding-left: 11px;
  114. line-height: 24px;
  115. font-size: 19px;
  116. color: #F5222D;
  117. }
  118. .zs_list {
  119. .u-grid-item-box {
  120. padding-bottom: 0px !important;
  121. }
  122. .zs {
  123. background-color: #f5f5f5;
  124. height: 214px;
  125. padding: 10px 15px;
  126. position: relative;
  127. image {
  128. height: 204px;
  129. width: 124px;
  130. }
  131. .line {
  132. position: absolute;
  133. left: 0;
  134. bottom: 0;
  135. height: 10px;
  136. width: 100%;
  137. background: linear-gradient(90deg, #FB7B58 0%, #F5222D 97%);
  138. }
  139. .pop {
  140. position: absolute;
  141. height: 100%;
  142. width: 100%;
  143. background-color: rgba(0, 0, 0, 0.5);
  144. left: 0;
  145. top: 0;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. color: #fff;
  150. font-size: 18px;
  151. }
  152. }
  153. .desc {
  154. padding-top: 10px;
  155. .name {
  156. font-size: 16px;
  157. color: #707070;
  158. text-align: center;
  159. }
  160. .get {
  161. font-size: 12px;
  162. color: #999999;
  163. height: 18px;
  164. }
  165. }
  166. }
  167. }
  168. .tab_list {
  169. margin-top: 13px;
  170. display: flex;
  171. .item,
  172. .actived {
  173. flex: 1;
  174. margin-right: 6px;
  175. border-radius: 5px;
  176. opacity: 1;
  177. box-sizing: border-box;
  178. height: 27px;
  179. line-height: 27px;
  180. border: 1px solid #999999;
  181. text-align: center;
  182. font-size: 14px;
  183. color: #999999;
  184. }
  185. .item:last-child {
  186. margin-right: 0;
  187. }
  188. .actived {
  189. background: linear-gradient(90deg, #FB7B58 0%, #F5222D 97%);
  190. color: #FFFFFF;
  191. border: none;
  192. }
  193. }
  194. </style>