notice.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view class="active">
  3. <view class="top">
  4. </view>
  5. <view class="list" v-if="list.length>0">
  6. <view class="list-item" @click="detail(item.id)" v-for="(item,index) in list" :key='index'>
  7. <view class="tips">
  8. </view>
  9. <view class="image" :style="{backgroundImage:'url('+ (item.cover_resource ? item.cover_resource.url : '../../static/images/avator.png') +')'}">
  10. </view>
  11. <!-- <image :src="item.cover_resource ? item.cover_resource.url : '../../static/images/avator.png'" mode="">
  12. </image> -->
  13. <view class="right">
  14. <view class="title">
  15. {{item.title}}
  16. </view>
  17. <view class="text">
  18. 发布人:{{item.admin_name}}
  19. </view>
  20. <view class="time">
  21. {{item.published_at}}
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="empty" v-else>
  27. <view class="enptyStatus">
  28. <image src="../../static/empty.png" mode=""></image>
  29. <view class="words">
  30. 暂无内容
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. list: [],
  41. page: 1,
  42. last: false,
  43. }
  44. },
  45. async onShow() {
  46. if(this.is_weixin()){
  47. this.navTitle()
  48. }
  49. this.list = []
  50. this.page = 1
  51. this.last = false
  52. await this.getTabList()
  53. await this.getList()
  54. },
  55. onReachBottom() {
  56. if (!this.last) {
  57. this.page++
  58. }
  59. console.log(this.page)
  60. this.getList()
  61. },
  62. methods: {
  63. //判断是否是微信
  64. is_weixin() {
  65. let ua = navigator.userAgent.toLowerCase();
  66. return ua.indexOf('micromessenger') != -1;
  67. },
  68. navTitle() {
  69. let navTitle = document.getElementsByTagName('uni-page-head');
  70. navTitle[0].style.display = 'none'
  71. },
  72. getTabList() {
  73. this.$u.get('/inform/category-user-tree', {
  74. type: 1
  75. }).then(res => {
  76. console.log(res, 'pp')
  77. this.tab_list = res.data
  78. this.current_tab = res.data[0].id
  79. })
  80. },
  81. getList() {
  82. this.$u.get('/inform/information', {
  83. category_id: 1,
  84. page: this.page,
  85. per_page:15
  86. }).then(res => {
  87. console.log(res, 'ppp')
  88. let data = res.data.list
  89. console.log(res, 'course1')
  90. if (this.page > 1 && data.length == 0) {
  91. uni.showToast({
  92. title: '暂无更多',
  93. icon: 'none'
  94. })
  95. this.last = true
  96. } else {
  97. this.list = this.list.concat(data)
  98. }
  99. })
  100. },
  101. detail(id) {
  102. uni.navigateTo({
  103. url: '../activity/details?id=' + id
  104. })
  105. },
  106. //创建活动
  107. add() {
  108. uni.navigateTo({
  109. url: './add'
  110. })
  111. }
  112. }
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. page {
  117. position: relative;
  118. background-color: rgba(238, 238, 238, 1);
  119. }
  120. .enptyStatus{
  121. display: flex;
  122. justify-content: center;
  123. align-items: center;
  124. flex-direction: column;
  125. padding: 30px 10px;
  126. image{
  127. width: 120px;
  128. height: 150px;
  129. margin-top: 80px;
  130. }
  131. .words{
  132. color: #ffae21;
  133. font-size: 18px;
  134. padding-top: 16px;
  135. }
  136. }
  137. .add {
  138. position: fixed;
  139. bottom: 75px;
  140. right: 15px;
  141. text-align: center;
  142. z-index: 6;
  143. .add-buttom {
  144. width: 36px;
  145. height: 36px;
  146. background: #6A6A6A;
  147. display: inline-block;
  148. text-align: center;
  149. line-height: 36px;
  150. opacity: 1;
  151. border-radius: 50%;
  152. }
  153. .add-tips {
  154. font-size: 10px;
  155. font-family: PingFang SC;
  156. font-weight: bold;
  157. line-height: 14px;
  158. color: #292929;
  159. opacity: 1;
  160. margin-top: 3px;
  161. }
  162. }
  163. .active {
  164. position: relative;
  165. height: 100%;
  166. .top {
  167. height: 132px;
  168. background-image: url(../../static/images/active-bg.png);
  169. background-size: 100%;
  170. background-repeat: no-repeat;
  171. }
  172. .tab {
  173. display: flex;
  174. align-items: center;
  175. width: 80%;
  176. margin: 0 auto;
  177. // background-color: #18B566;
  178. .item,
  179. .active-item {
  180. margin-top: 17px;
  181. view {
  182. display: block;
  183. }
  184. font-size: 18px;
  185. font-family: PingFang SC;
  186. font-weight: bold;
  187. line-height: 20px;
  188. color: rgba(113, 113, 113, .43);
  189. opacity: 0.43;
  190. opacity: 1;
  191. flex: 1;
  192. text-align: center;
  193. .week {
  194. padding-bottom: 12px;
  195. }
  196. .line {
  197. width: 48px;
  198. height: 4px;
  199. background: #D12727;
  200. opacity: 1;
  201. border-radius: 1px;
  202. display: block;
  203. margin: 0 auto;
  204. }
  205. }
  206. .active-item {
  207. font-size: 18px;
  208. font-family: PingFang SC;
  209. font-weight: bold;
  210. line-height: 20px;
  211. color: #D12727;
  212. .week {
  213. padding-bottom: 8px;
  214. }
  215. }
  216. }
  217. .list {
  218. padding: 20px 16px;
  219. .list-item {
  220. background: #FFFFFF;
  221. opacity: 1;
  222. border-radius: 12px;
  223. padding: 20px 10px;
  224. position: relative;
  225. display: flex;
  226. align-items: center;
  227. margin-bottom: 20px;
  228. .tips {
  229. position: absolute;
  230. width: 52px;
  231. height: 21px;
  232. text-align: center;
  233. line-height: 21px;
  234. background: #FD6738;
  235. top: 0;
  236. right: 0;
  237. opacity: 1;
  238. border-radius: 0px 12px 0px 12px;
  239. font-size: 12px;
  240. font-family: PingFang SC;
  241. font-weight: bold;
  242. color: #FFFFFF;
  243. }
  244. .image {
  245. flex: 0 0 60px;
  246. width: 60px;
  247. height: 60px;
  248. margin-right: 6px;
  249. background-position: center;
  250. background-repeat: no-repeat;
  251. background-size: cover;
  252. }
  253. .right {
  254. flex: 1;
  255. .title {
  256. width: 220px;
  257. font-size: 16px;
  258. font-family: PingFang SC;
  259. font-weight: bold;
  260. line-height: 20px;
  261. color: #282828;
  262. overflow: hidden;
  263. opacity: 1;
  264. white-space: nowrap;
  265. /*设置不换行*/
  266. overflow: hidden;
  267. /*设置隐藏*/
  268. text-overflow: ellipsis;
  269. /*设置隐藏部分为省略号*/
  270. }
  271. .text {
  272. font-size: 13px;
  273. font-family: PingFang SC;
  274. font-weight: 400;
  275. line-height: 20px;
  276. color: rgba(40, 40, 40, .47);
  277. margin-top: 3px;
  278. }
  279. .time {
  280. font-size: 10px;
  281. font-family: PingFang SC;
  282. font-weight: 400;
  283. line-height: 20px;
  284. color: rgba(40, 40, 40, .47);
  285. }
  286. }
  287. }
  288. }
  289. }
  290. </style>