history.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="history">
  3. <view class="" v-if="list.length>0">
  4. <view class="item" v-for="(item,index) in list" :key='index' @click="detail(item.id)">
  5. <view :class="item.check_status==1 ? 'tips' : item.check_status==2 ? 'fail':'loading'">
  6. {{item.check_status_text}}
  7. </view>
  8. <view class="image" :style="{backgroundImage:'url('+ (item.cover_resource ? item.cover_resource.url : '../../static/images/avator.png') +')'}">
  9. </view>
  10. <!-- <image :src="item.cover_resource ? item.cover_resource.url : '../../static/images/avator.png'" mode="">
  11. </image> -->
  12. <view class="right">
  13. <view class="title">
  14. {{item.title}}
  15. </view>
  16. <view class="name">
  17. {{item.category_name}}
  18. </view>
  19. <view class="time">
  20. {{item.published_at}}
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="empty" v-else>
  26. <view class="enptyStatus">
  27. <image src="../../static/empty.png" mode=""></image>
  28. <view class="words">
  29. 暂无内容
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. export default {
  37. data() {
  38. return {
  39. list: [1, 1, 1, 1, 1],
  40. page: 1,
  41. last:false
  42. }
  43. },
  44. onShow() {
  45. if(this.is_weixin()){
  46. this.navTitle()
  47. }
  48. this.list = []
  49. this.page=1
  50. this.last=false
  51. this.getList()
  52. },
  53. onReachBottom() {
  54. if (!this.last) {
  55. this.page++
  56. }
  57. console.log(this.page)
  58. this.getList()
  59. },
  60. methods: {
  61. //判断是否是微信
  62. is_weixin() {
  63. let ua = navigator.userAgent.toLowerCase();
  64. return ua.indexOf('micromessenger') != -1;
  65. },
  66. navTitle() {
  67. let navTitle = document.getElementsByTagName('uni-page-head');
  68. navTitle[0].style.display = 'none'
  69. },
  70. getList() {
  71. let id = this.$store.state.vuex_user.id
  72. this.$u.get('/inform/information', {
  73. admin_id: id,
  74. page: this.page,
  75. per_page:15
  76. }).then(res => {
  77. let data = res.data.list
  78. console.log(res, 'course1')
  79. if (this.page > 1 && data.length == 0) {
  80. uni.showToast({
  81. title: '暂无更多',
  82. icon: 'none'
  83. })
  84. this.last=true
  85. } else {
  86. this.list = this.list.concat(data)
  87. }
  88. })
  89. },
  90. detail(id) {
  91. uni.navigateTo({
  92. url: './details?id=' + id
  93. })
  94. }
  95. }
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. .history {
  100. padding: 10px 15px;
  101. overflow: hidden;
  102. .enptyStatus{
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. flex-direction: column;
  107. padding: 30px 10px;
  108. image{
  109. width: 120px;
  110. height: 150px;
  111. margin-top: 100px;
  112. }
  113. .words{
  114. color: #ffae21;
  115. font-size: 18px;
  116. padding-top: 18px;
  117. }
  118. }
  119. .item {
  120. background: #F4F9FD;
  121. padding: 12px 10px;
  122. border-radius: 12px;
  123. display: flex;
  124. align-items: center;
  125. position: relative;
  126. margin-bottom: 10px;
  127. .tips,
  128. .fail,
  129. .loading {
  130. position: absolute;
  131. padding: 0 5px;
  132. top: 0;
  133. right: 0;
  134. height: 20px;
  135. line-height: 20px;
  136. font-size: 11px;
  137. font-family: PingFang SC;
  138. font-weight: 400;
  139. line-height: 20px;
  140. color: #FFFFFF;
  141. border-radius: 12px 12px 0px 12px;
  142. }
  143. .tips {
  144. background: #3B7652;
  145. }
  146. .fail {
  147. background: rgba(136, 136, 136, 1);
  148. }
  149. .loading {
  150. background: rgba(242, 74, 20, 1);
  151. }
  152. // justify-content: center;
  153. .image {
  154. flex: 0 0 60px;
  155. height: 60px;
  156. width: 60px;
  157. margin-right: 6px;
  158. background-position: center;
  159. background-repeat: no-repeat;
  160. background-size: cover;
  161. }
  162. .right {
  163. flex: 1;
  164. width: 100%;
  165. margin-left: 5px;
  166. .title {
  167. width: 70%;
  168. white-space: nowrap;
  169. /*设置不换行*/
  170. overflow: hidden;
  171. /*设置隐藏*/
  172. text-overflow: ellipsis;
  173. /*设置隐藏部分为省略号*/
  174. font-size: 16px;
  175. font-family: PingFang SC;
  176. font-weight: bold;
  177. line-height: 20px;
  178. color: #282828;
  179. opacity: 1;
  180. }
  181. .name {
  182. font-size: 13px;
  183. font-family: PingFang SC;
  184. font-weight: 400;
  185. line-height: 20px;
  186. color: rgba(40, 40, 40, .47);
  187. }
  188. .time {
  189. font-size: 10px;
  190. font-family: PingFang SC;
  191. font-weight: 400;
  192. line-height: 20px;
  193. color: rgba(40, 40, 40, .47);
  194. }
  195. }
  196. }
  197. }
  198. </style>