index.vue 9.4 KB

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