index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view>
  3. <u-tabs :list="types" :activeStyle="{ fontWeight: 'bold', color: '#C30D23' }" lineColor="#C30D23"
  4. keyName="classname" @change="tabsChange" />
  5. <view class="search-box">
  6. <view hover-class="navigator-hover" class="switch" @click="changeStatus">
  7. <view class="status" :class="activeStatus == '全部' ? 'active' : ''">
  8. 全部
  9. </view>
  10. <view class="status" :class="activeStatus != '全部' ? 'active' : ''">
  11. 未读
  12. </view>
  13. </view>
  14. <u-search placeholder="搜索关键字" bgColor="#fff" v-model="keyword" @search="onSearch" @clear="onSearch"
  15. :showAction="false" />
  16. </view>
  17. <My_listbox ref="List" @getlist="getList(true)">
  18. <view style="height: 5px;" />
  19. <navigator :url="'/packageA/affiche/detail?id=' + item.sat_noticeid" class="item" v-for="item in list"
  20. :key="item.sat_noticeid" hover-class="navigator-hover">
  21. <view class="title">{{ item.title }}</view>
  22. <view class="line" />
  23. <view class="date">{{ item.checkdate }}</view>
  24. <view class="readstatus" :style="{
  25. color: colors[item.readstatus].color,
  26. background: colors[item.readstatus].back,
  27. }">{{ item.readstatus }}</view>
  28. </navigator>
  29. </My_listbox>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. activeStatus: '全部',
  37. keyword: "",
  38. list: [],
  39. types: [],
  40. "content": {
  41. "where": {
  42. "condition": "",
  43. "sat_notice_classid": "",
  44. "isread": ""//0:已读.1:已知,2:未读
  45. }
  46. },
  47. colors: {
  48. 已读: {
  49. color: '#E3041F',
  50. back: '#FFF0F2'
  51. },
  52. 未读: {
  53. color: '#FFFFFF',
  54. back: '#E3041F'
  55. },
  56. 已知: {
  57. color: '#999999',
  58. back: '#EEEEEE'
  59. },
  60. }
  61. }
  62. },
  63. onLoad() {
  64. this.getTypes()
  65. this.getList()
  66. },
  67. methods: {
  68. getTypes() {
  69. this.$Http.basic({
  70. "id": "20221101094603",
  71. "content": {
  72. "pageNumber": 1,
  73. "pageSize": 9999,
  74. "where": {
  75. "condition": "",
  76. "isenable": 1
  77. }
  78. }
  79. }).then(res => {
  80. console.log("获取通告分类", res)
  81. if (this.cutoff(res.msg)) return;
  82. if (res.data.length > 1) {
  83. res.data.unshift({
  84. classname: "全部",
  85. sat_notice_classid: "",
  86. })
  87. this.types = res.data;
  88. }
  89. })
  90. },
  91. getList(init = false) {
  92. if (this.paging(this.content, init)) return;
  93. this.$Http.basic({
  94. "id": "20221111090904",
  95. content: this.content
  96. }).then(res => {
  97. this.$refs.List.RefreshToComplete()
  98. console.log("获取通告列表", res)
  99. if (this.cutoff(res.msg)) return;
  100. this.list = res.data;
  101. this.content = this.$refs.List.paging(this.content, res)
  102. })
  103. },
  104. changeStatus() {
  105. this.activeStatus = this.activeStatus == '全部' ? '未读' : "全部";
  106. this.content.where.isread == this.activeStatus == '全部' ? "" : 2;
  107. this.getList(true);
  108. },
  109. tabsChange(e) {
  110. this.content.where.sat_notice_classid = e.sat_notice_classid;
  111. this.getList(true)
  112. },
  113. onSearch(e) {
  114. this.content.where.condition = e || "";
  115. this.getList(true)
  116. },
  117. },
  118. }
  119. </script>
  120. <style lang="scss">
  121. /deep/ .u-search__content {
  122. height: 30px !important;
  123. .uni-input-wrapper {
  124. font-size: 14px;
  125. }
  126. .u-icon__icon {
  127. font-size: 22px !important;
  128. }
  129. }
  130. .search-box {
  131. display: flex;
  132. align-items: center;
  133. padding: 0 10px;
  134. margin-top: 10px;
  135. margin-bottom: 5px;
  136. box-sizing: border-box;
  137. .switch {
  138. display: flex;
  139. width: 96px;
  140. height: 30px;
  141. background: #fff;
  142. margin-right: 10px;
  143. border-radius: 15px;
  144. .status {
  145. display: flex;
  146. justify-content: center;
  147. align-items: center;
  148. height: 30px;
  149. width: 48px;
  150. border-radius: 15px;
  151. font-family: Source Han Sans SC, Source Han Sans SC;
  152. font-size: 14px;
  153. color: #666666;
  154. background: #fff;
  155. }
  156. .active {
  157. background: #C30D23;
  158. color: #fff;
  159. }
  160. }
  161. }
  162. .item {
  163. position: relative;
  164. width: 355px;
  165. background: #FFFFFF;
  166. border-radius: 8px;
  167. margin: 0 auto 8px;
  168. padding: 15px 10px;
  169. box-sizing: border-box;
  170. .title {
  171. width: 281px;
  172. font-family: Source Han Sans SC, Source Han Sans SC;
  173. font-weight: bold;
  174. font-size: 14px;
  175. color: #333333;
  176. }
  177. .line {
  178. width: 335px;
  179. height: 1px;
  180. background: #eeeeee;
  181. margin-top: 15px;
  182. }
  183. .date {
  184. line-height: 20px;
  185. font-size: 14px;
  186. color: #666666;
  187. margin-top: 10px;
  188. }
  189. .readstatus {
  190. position: absolute;
  191. top: 10px;
  192. right: 0;
  193. width: 44px;
  194. height: 24px;
  195. line-height: 24px;
  196. font-size: 12px;
  197. text-align: center;
  198. border-radius: 12px 0px 0px 12px;
  199. }
  200. }
  201. </style>