index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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">
  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. uni.setNavigationBarTitle({
  65. title: this.getApps('资料库', '/packageA/affiche/index').remark || '企业公告',
  66. });
  67. this.getTypes()
  68. this.getList()
  69. },
  70. onShow() {
  71. this.updateList()
  72. },
  73. methods: {
  74. getTypes() {
  75. this.$Http.basic({
  76. "id": "20221101094603",
  77. "content": {
  78. "pageNumber": 1,
  79. "pageSize": 9999,
  80. "where": {
  81. "condition": "",
  82. "isenable": 1
  83. }
  84. }
  85. }).then(res => {
  86. console.log("获取通告分类", res)
  87. if (this.cutoff(res.msg)) return;
  88. if (res.data.length > 1) {
  89. res.data.unshift({
  90. classname: "全部",
  91. sat_notice_classid: "",
  92. })
  93. this.types = res.data;
  94. }
  95. })
  96. },
  97. getList(init = false) {
  98. if (this.paging(this.content, init)) return;
  99. this.$Http.basic({
  100. "id": "20221111090904",
  101. content: this.content
  102. }).then(res => {
  103. this.$refs.List.RefreshToComplete()
  104. console.log("获取通告列表", res)
  105. if (this.cutoff(res.msg)) return;
  106. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  107. this.content = this.$refs.List.paging(this.content, res)
  108. })
  109. },
  110. updateList() {
  111. if (this.content.pageNumber && this.content.pageNumber >= 2) {
  112. let content = this.paging(this.content, true, true)
  113. this.$Http.basic({
  114. "id": "20221111090904",
  115. content
  116. }).then(res => {
  117. console.log("更新通告列表", res)
  118. if (this.cutoff(res.msg)) return;
  119. this.list = res.data;
  120. this.$refs.List.paging(content, res, true)
  121. })
  122. }
  123. },
  124. changeStatus() {
  125. this.activeStatus = this.activeStatus == '全部' ? '未读' : "全部";
  126. this.content.where.isread = this.activeStatus == '全部' ? "" : 2;
  127. this.getList(true);
  128. },
  129. tabsChange(e) {
  130. this.content.where.sat_notice_classid = e.sat_notice_classid;
  131. this.getList(true)
  132. },
  133. onSearch(e) {
  134. this.content.where.condition = e || "";
  135. this.getList(true)
  136. },
  137. },
  138. }
  139. </script>
  140. <style lang="scss">
  141. /deep/ .u-search__content {
  142. height: 30px !important;
  143. .uni-input-wrapper {
  144. font-size: 14px;
  145. }
  146. .u-icon__icon {
  147. font-size: 22px !important;
  148. }
  149. }
  150. .search-box {
  151. display: flex;
  152. align-items: center;
  153. padding: 0 10px;
  154. margin-top: 10px;
  155. margin-bottom: 5px;
  156. box-sizing: border-box;
  157. .switch {
  158. display: flex;
  159. width: 96px;
  160. height: 30px;
  161. background: #fff;
  162. margin-right: 10px;
  163. border-radius: 15px;
  164. .status {
  165. display: flex;
  166. justify-content: center;
  167. align-items: center;
  168. height: 30px;
  169. width: 48px;
  170. border-radius: 15px;
  171. font-family: Source Han Sans SC, Source Han Sans SC;
  172. font-size: 14px;
  173. color: #666666;
  174. background: #fff;
  175. }
  176. .active {
  177. background: #C30D23;
  178. color: #fff;
  179. }
  180. }
  181. }
  182. .item {
  183. position: relative;
  184. width: 355px;
  185. background: #FFFFFF;
  186. border-radius: 8px;
  187. margin: 0 auto 8px;
  188. padding: 15px 10px;
  189. box-sizing: border-box;
  190. .title {
  191. width: 281px;
  192. font-family: Source Han Sans SC, Source Han Sans SC;
  193. font-weight: bold;
  194. font-size: 14px;
  195. color: #333333;
  196. }
  197. .line {
  198. width: 335px;
  199. height: 1px;
  200. background: #eeeeee;
  201. margin-top: 15px;
  202. }
  203. .date {
  204. line-height: 20px;
  205. font-size: 14px;
  206. color: #666666;
  207. margin-top: 10px;
  208. }
  209. .readstatus {
  210. position: absolute;
  211. top: 10px;
  212. right: 0;
  213. width: 44px;
  214. height: 24px;
  215. line-height: 24px;
  216. font-size: 12px;
  217. text-align: center;
  218. border-radius: 12px 0px 0px 12px;
  219. }
  220. }
  221. </style>