index.vue 9.1 KB

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