w-infolist.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. <template>
  2. <view>
  3. <view class="navbar">
  4. <view class="input_box">
  5. <view class="input_icon"></view>
  6. <input type="text" value="" v-model="search_text" placeholder="搜索" />
  7. </view>
  8. <view class="search_btn" @click="search()">
  9. <text>搜索</text>
  10. </view>
  11. </view>
  12. <!-- news -->
  13. <view class="news">
  14. <view class="news_list">
  15. <view class="item">
  16. <view class="title">
  17. <view class="name">一分区机电管理部</view>
  18. <view class="tip">已读</view>
  19. </view>
  20. <view class="time">
  21. 2020-07-05 18:59:23
  22. </view>
  23. <view class="inner">
  24. 内容测试。
  25. </view>
  26. <view class="detail">
  27. 详情 >>
  28. </view>
  29. </view>
  30. <view class="item">
  31. <view class="title">
  32. <view class="name">一分区机电管理部</view>
  33. <view class="tip">已读</view>
  34. </view>
  35. <view class="time">
  36. 2020-07-05 18:59:23
  37. </view>
  38. <view class="inner">
  39. 内容测试。
  40. </view>
  41. <view class="detail">
  42. 详情 >>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. <!-- bar -->
  48. <view class="title_bar">
  49. <view class="title" @click="changeType('')">所有消息</view>
  50. <view class="title" @click="changeType('unread')">未读消息</view>
  51. <view class="title" @click="read('')">全部标已读</view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. export default {
  57. data() {
  58. return {
  59. search_text:'',
  60. type:'',
  61. // 列表数组
  62. messageList:[]
  63. };
  64. },
  65. onLoad() {
  66. // this.get_messageList(this.type)
  67. },
  68. methods:{
  69. search(){
  70. uni.showToast({
  71. icon:'none',
  72. title:"点击了搜索:"+this.search_text
  73. })
  74. },
  75. changeType(type){
  76. console.log(type)
  77. // this.get_messageList(type)
  78. },
  79. async get_messageList(type){
  80. const res = await this.$myRequest({
  81. url:'/message/list',
  82. header:{
  83. Authorization:uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
  84. },
  85. data:{
  86. type:type
  87. }
  88. })
  89. console.log(res.data.data.data)
  90. this.messageList = res.data.data.data
  91. },
  92. async read(id){
  93. // const res = await this.$myRequest({
  94. // method:"POST",
  95. // url:'/message/read',
  96. // header:{
  97. // "Content-Type":"application/json",
  98. // Authorization:uni.getStorageSync('token_type') +' '+uni.getStorageSync('Authorization')
  99. // },
  100. // data:{
  101. // id:id
  102. // }
  103. // })
  104. // uni.showToast({
  105. // icon:'none',
  106. // title:'全部已读'
  107. // })
  108. console.log("全部标已读")
  109. }
  110. }
  111. }
  112. </script>
  113. <style lang="scss">
  114. page{
  115. background-color: #e9e9e9;
  116. }
  117. .navbar {
  118. width: 750rpx;
  119. box-sizing: border-box;
  120. padding-left: 31rpx;
  121. padding-right: 26rpx;
  122. padding-top: 14rpx;
  123. padding-bottom: 14rpx;
  124. display: flex;
  125. justify-content: space-between;
  126. background-color: #eee;
  127. .input_box {
  128. background-color: #fff;
  129. border-radius: 20px;
  130. width: 565rpx;
  131. display: flex;
  132. .input_icon {
  133. margin-left: 43rpx;
  134. margin-top: 16rpx;
  135. width: 34rpx;
  136. height: 34rpx;
  137. background-image: url(icon/search_black.png);
  138. background-size: cover;
  139. background-repeat: no-repeat;
  140. }
  141. input{
  142. width: 460rpx;
  143. margin-left: 19rpx;
  144. height: 65rpx;
  145. font-size: 24rpx;
  146. font-family: PingFangSC-Regular, PingFang SC;
  147. font-weight: 400;
  148. color: #232627;
  149. box-sizing: border-box;
  150. padding-right: 20rpx;
  151. }
  152. }
  153. .search_btn{
  154. margin-left: 30rpx;
  155. margin-top: 2rpx;
  156. width: 108rpx;
  157. height: 60rpx;
  158. line-height: 60rpx;
  159. text-align: center;
  160. background: #FFFFFF;
  161. border-radius: 33rpx;
  162. font-size: 24rpx;
  163. font-family: PingFangSC-Regular, PingFang SC;
  164. font-weight: 400;
  165. color: #232627;
  166. }
  167. }
  168. .news{
  169. padding: 20rpx;
  170. .news_list{
  171. .item{
  172. margin-bottom: 20rpx;
  173. width: 710rpx;
  174. background-color: #fff;
  175. box-sizing: border-box;
  176. padding: 15rpx;
  177. .title{
  178. display: flex;
  179. justify-content: space-between;
  180. .name{
  181. font-size: 30rpx;
  182. color: #666;
  183. }
  184. .tip{
  185. font-size: 24rpx;
  186. padding: 8rpx;
  187. background-color: #d1d1d1;
  188. color: #fff;
  189. }
  190. }
  191. .time{
  192. line-height: 40rpx;
  193. font-size: 20rpx;
  194. color: #999;
  195. }
  196. .inner{
  197. line-height: 50rpx;
  198. font-size: 22rpx;
  199. color: #333;
  200. border-bottom: 1px solid #f3f3f3;
  201. }
  202. .detail{
  203. padding-top: 15rpx;
  204. font-size: 20rpx;
  205. color: #007AFF;
  206. }
  207. }
  208. }
  209. }
  210. .title_bar{
  211. background-color: #fff;
  212. position: fixed;
  213. bottom: 0;
  214. width: 750rpx;
  215. height: 90rpx;
  216. box-sizing: border-box;
  217. padding: 20rpx 0;
  218. .title{
  219. float: left;
  220. width: 248rpx;
  221. line-height: 50rpx;
  222. text-align: center;
  223. font-size: 30rpx;
  224. }
  225. .title:nth-child(2){
  226. border-left: 2rpx solid #ccc;
  227. border-right: 2rpx solid #ccc;
  228. }
  229. }
  230. </style>