index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view class="index_container">
  3. <uni-collapse>
  4. <uni-collapse-item title-border="show" :border="true" :show-animation="false" :open="false">
  5. <template v-slot:title>
  6. <uni-section title="待办消息" type="line" titleFontSize="20px"></uni-section>
  7. </template>
  8. <view class="process_container">
  9. <view class="process_list" v-if="processes">
  10. <process-list :processes="processes"></process-list>
  11. </view>
  12. <view class="no_process" v-else>
  13. <uni-section title="无待办消息"></uni-section>
  14. </view>
  15. </view>
  16. </uni-collapse-item>
  17. </uni-collapse>
  18. <uni-collapse>
  19. <uni-collapse-item title-border="show" :border="true" :show-animation="false" :open="true">
  20. <template v-slot:title>
  21. <uni-section title="消息" type="line" titleFontSize="20px"></uni-section>
  22. </template>
  23. <view class="segmented_control_container">
  24. <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
  25. activeColor="#409eff"></uni-segmented-control>
  26. </view>
  27. <view class="content">
  28. <view @click="handleToDetail(message)" v-for="(message, index) in messages" :key="index"
  29. :class="message.is_read?' ':'message_container_unread'" class="message_container">
  30. <uni-card :is-full="true">
  31. <template v-slot:title>
  32. <uni-row>
  33. <view class="message_top_container">
  34. <uni-col :span="24">
  35. <text class="message_user">
  36. {{ message.user }}
  37. </text>
  38. </uni-col>
  39. </view>
  40. </uni-row>
  41. <uni-row>
  42. <view class="message_mid_container">
  43. <uni-col :span="19">
  44. <text class="message_title hidden_over">
  45. <text :class="message.icon" class="iconfont"></text>
  46. {{ message.title }}
  47. </text>
  48. </uni-col>
  49. <uni-col :span="4">
  50. <text class="message_time">
  51. {{ message.time }}
  52. </text>
  53. </uni-col>
  54. </view>
  55. </uni-row>
  56. </template>
  57. <view class="message_bottom_container">
  58. <text class="message_content hidden_over">
  59. {{ message.content }}
  60. </text>
  61. </view>
  62. </uni-card>
  63. </view>
  64. </view>
  65. </uni-collapse-item>
  66. </uni-collapse>
  67. </view>
  68. </template>
  69. <script setup lang="ts">
  70. import { onMounted, reactive, ref } from 'vue';
  71. import $tab from '@/plugins/tab.js';
  72. import processList from '@/components/ygoa/processList.vue'
  73. const items = reactive(['全部', '已读', '未读'])
  74. const current = ref(-1)
  75. let messages = reactive([])
  76. let processes = reactive([{
  77. id: 1,
  78. title: '账户1 的请假申请',
  79. user: '账户1',
  80. createTime: '2024/10/10',
  81. startTime: '2024/10/10',
  82. endTime: '2024/10/12',
  83. totalTime: '2',
  84. description: '请假说明请假说明请假说明请假说明请假说明',
  85. type: 'icon-apply-leave',
  86. step: 0
  87. },
  88. {
  89. id: 1,
  90. title: '账户2 的请假申请',
  91. user: '账户2',
  92. createTime: '2024/10/10',
  93. startTime: '2024/10/10',
  94. endTime: '2024/10/12',
  95. totalTime: '2',
  96. description: '请假说明请假说明',
  97. type: 'icon-apply-leave',
  98. step: 0
  99. }])
  100. onMounted(() => {
  101. onClickItem({ currentIndex: 0 })
  102. })
  103. // 点击消息分段器
  104. function onClickItem({ currentIndex }) {
  105. current.value = currentIndex
  106. switch (currentIndex) {
  107. case 0:
  108. messages = [
  109. {
  110. id: 1,
  111. user: "账户1",
  112. title: "已读公告1",
  113. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  114. time: "2024/10/10",
  115. icon: 'icon-announce',
  116. is_read: 1
  117. },
  118. {
  119. id: 2,
  120. user: "账户2",
  121. title: "已读通知2",
  122. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  123. time: "2024/10/10",
  124. icon: 'icon-notify',
  125. is_read: 1
  126. },
  127. {
  128. id: 3,
  129. user: "账户3",
  130. title: "未读公告3未读公告3未读公告3未读公告3未读公告3未读公告3",
  131. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  132. time: "2024/10/10",
  133. icon: 'icon-announce',
  134. is_read: 0
  135. },
  136. {
  137. id: 4,
  138. user: "账户4",
  139. title: "未读通知4",
  140. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  141. time: "2024/10/10",
  142. icon: 'icon-notify',
  143. is_read: 0
  144. }
  145. ]
  146. break;
  147. case 1:
  148. messages = [
  149. {
  150. id: 1,
  151. user: "账户1",
  152. title: "已读公告1",
  153. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  154. time: "2024/10/10",
  155. icon: 'icon-announce',
  156. is_read: 1
  157. },
  158. {
  159. id: 2,
  160. user: "账户2",
  161. title: "已读通知2",
  162. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  163. time: "2024/10/10",
  164. icon: 'icon-notify',
  165. is_read: 1
  166. }
  167. ]
  168. break;
  169. case 2:
  170. messages = [
  171. {
  172. id: 3,
  173. user: "账户3",
  174. title: "未读公告3未读公告3未读公告3未读公告3未读公告3未读公告3",
  175. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  176. time: "2024/10/10",
  177. icon: 'icon-announce',
  178. is_read: 0
  179. },
  180. {
  181. id: 4,
  182. user: "账户4",
  183. title: "未读通知4",
  184. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  185. time: "2024/10/10",
  186. icon: 'icon-notify',
  187. is_read: 0
  188. }
  189. ]
  190. break;
  191. }
  192. }
  193. // 点击消息
  194. function handleToDetail({ id }) {
  195. $tab.navigateTo('/pages/message/detail/index?id=' + id)
  196. console.log('handleToDetail', id);
  197. }
  198. </script>
  199. <style lang="scss">
  200. // iconfont
  201. @import "@/static/font/ygoa/iconfont.css";
  202. .grid_container {
  203. .grid-item-box {
  204. flex: 1;
  205. /* #ifndef APP-NVUE */
  206. display: flex;
  207. /* #endif */
  208. flex-direction: column;
  209. align-items: center;
  210. justify-content: center;
  211. padding: 15px 0;
  212. .grid_icon {
  213. color: #ff8500;
  214. font-size: 30px;
  215. }
  216. .text {
  217. text-align: center;
  218. font-size: 26rpx;
  219. margin-top: 10rpx;
  220. }
  221. }
  222. }
  223. .segmented_control_container {
  224. // margin-top: 10px;
  225. }
  226. .message_container {
  227. border-left: #7b7b7b .4rem solid;
  228. .message_top_container {
  229. padding: 5px 5px 0;
  230. .message_user {
  231. color: #000000;
  232. }
  233. }
  234. .message_mid_container {
  235. padding: 5px;
  236. height: 1.1rem;
  237. .message_title {
  238. font-size: 1.1rem;
  239. }
  240. .message_time {
  241. font-size: 0.8rem;
  242. }
  243. }
  244. .message_bottom_container {
  245. .message_content {}
  246. }
  247. }
  248. .message_container_unread {
  249. // 未读样式
  250. border-left-color: #0f6cbd;
  251. .message_user {
  252. color: #000000;
  253. font-weight: bold;
  254. }
  255. .message_title {
  256. color: #0f6cbd;
  257. font-weight: bold;
  258. .icon-announce {}
  259. .icon-notify {}
  260. }
  261. }
  262. .hidden_over {
  263. white-space: nowrap; // 不换行
  264. overflow: hidden; // 超出内容隐藏
  265. text-overflow: ellipsis; // 超出部分显示省略号
  266. display: inline-block;
  267. max-width: 100%;
  268. }
  269. </style>