index.vue 9.5 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. import { useUserStore } from '@/store/user.js'
  102. onMounted(() => {
  103. onClickItem({ currentIndex: 0 })
  104. })
  105. const userStore = useUserStore()
  106. function clickCheckIn() {
  107. console.log('clickCheckIn', userStore.user);
  108. // console.log('getUserInfo', getUserInfo());
  109. // $tab.navigateTo('/pages/mine/clockIn/clockIn')
  110. }
  111. // 分段器选项列表
  112. const items = reactive(['全部', '已读', '未读'])
  113. // 分段器选项
  114. const current = ref(-1)
  115. // 消息列表
  116. let messages = reactive([])
  117. // 待办列表
  118. let processes = reactive([
  119. {
  120. id: 1,
  121. title: '账户1 的请假申请',
  122. user: '账户1',
  123. createTime: '2024/10/10',
  124. startTime: '2024/10/10',
  125. endTime: '2024/10/12',
  126. totalTime: '2',
  127. description: '请假说明请假说明请假说明请假说明请假说明',
  128. type: 'icon-apply-leave',
  129. step: 0
  130. },
  131. {
  132. id: 1,
  133. title: '账户2 的请假申请',
  134. user: '账户2',
  135. createTime: '2024/10/10',
  136. startTime: '2024/10/10',
  137. endTime: '2024/10/12',
  138. totalTime: '2',
  139. description: '请假说明请假说明',
  140. type: 'icon-apply-leave',
  141. step: 0
  142. },
  143. {
  144. id: 2,
  145. title: '账户2 的加班申请',
  146. user: '账户2',
  147. createTime: '2024/10/10',
  148. startTime: '2024/10/10 17/30/00',
  149. endTime: '2024/10/10 18/30/00',
  150. totalTime: '1',
  151. description: '加班说明加班说明',
  152. type: 'icon-apply-overtime',
  153. step: 0
  154. },
  155. ])
  156. // 点击消息分段器
  157. function onClickItem({ currentIndex }) {
  158. current.value = currentIndex
  159. switch (currentIndex) {
  160. case 0:
  161. messages = [
  162. {
  163. id: 1,
  164. user: "账户1",
  165. title: "已读公告1",
  166. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  167. time: "2024/10/10",
  168. icon: 'icon-announce',
  169. is_read: 1
  170. },
  171. {
  172. id: 2,
  173. user: "账户2",
  174. title: "已读通知2",
  175. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  176. time: "2024/10/10",
  177. icon: 'icon-notify',
  178. is_read: 1
  179. },
  180. {
  181. id: 3,
  182. user: "账户3",
  183. title: "未读公告3未读公告3未读公告3未读公告3未读公告3未读公告3",
  184. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  185. time: "2024/10/10",
  186. icon: 'icon-announce',
  187. is_read: 0
  188. },
  189. {
  190. id: 4,
  191. user: "账户4",
  192. title: "未读通知4",
  193. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  194. time: "2024/10/10",
  195. icon: 'icon-notify',
  196. is_read: 0
  197. }
  198. ]
  199. break;
  200. case 1:
  201. messages = [
  202. {
  203. id: 1,
  204. user: "账户1",
  205. title: "已读公告1",
  206. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  207. time: "2024/10/10",
  208. icon: 'icon-announce',
  209. is_read: 1
  210. },
  211. {
  212. id: 2,
  213. user: "账户2",
  214. title: "已读通知2",
  215. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  216. time: "2024/10/10",
  217. icon: 'icon-notify',
  218. is_read: 1
  219. }
  220. ]
  221. break;
  222. case 2:
  223. messages = [
  224. {
  225. id: 3,
  226. user: "账户3",
  227. title: "未读公告3未读公告3未读公告3未读公告3未读公告3未读公告3",
  228. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  229. time: "2024/10/10",
  230. icon: 'icon-announce',
  231. is_read: 0
  232. },
  233. {
  234. id: 4,
  235. user: "账户4",
  236. title: "未读通知4",
  237. content: "消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容消息内容",
  238. time: "2024/10/10",
  239. icon: 'icon-notify',
  240. is_read: 0
  241. }
  242. ]
  243. break;
  244. }
  245. }
  246. // 点击消息
  247. function handleToDetail({ id }) {
  248. $tab.navigateTo('/pages/message/detail/index?id=' + id)
  249. console.log('handleToDetail', id);
  250. }
  251. function clickFabButton() {
  252. console.log('clickFabButton');
  253. $tab.navigateTo('/pages/message/chat/index')
  254. }
  255. </script>
  256. <style lang="scss">
  257. @import "@/static/font/ygoa/iconfont.css";
  258. .text {
  259. text-align: center;
  260. font-size: 26rpx;
  261. margin-top: 10rpx;
  262. }
  263. .grid-body {
  264. .ygoa-icon {
  265. font-size: 40px;
  266. }
  267. .grid-item-box {
  268. flex: 1;
  269. /* #ifndef APP-NVUE */
  270. display: flex;
  271. /* #endif */
  272. border-top: 1px solid #ccc;
  273. background-color: #ffffff;
  274. flex-direction: column;
  275. align-items: center;
  276. justify-content: center;
  277. padding: 15px 0;
  278. }
  279. }
  280. .segmented_control_container {
  281. // margin-top: 10px;
  282. }
  283. .message_container {
  284. border-left: #7b7b7b .4rem solid;
  285. .message_top_container {
  286. padding: 5px 5px 0;
  287. .message_user {
  288. color: #000000;
  289. }
  290. }
  291. .message_mid_container {
  292. padding: 5px;
  293. height: 1.1rem;
  294. .message_title {
  295. font-size: 1.1rem;
  296. }
  297. .message_time {
  298. font-size: 0.8rem;
  299. }
  300. }
  301. .message_bottom_container {
  302. .message_content {}
  303. }
  304. }
  305. .message_container_unread {
  306. // 未读样式
  307. border-left-color: #0f6cbd;
  308. .message_user {
  309. color: #000000;
  310. font-weight: bold;
  311. }
  312. .message_title {
  313. color: #0f6cbd;
  314. .message_title_text {
  315. font-weight: bold;
  316. }
  317. }
  318. }
  319. .hidden_over {
  320. white-space: nowrap; // 不换行
  321. overflow: hidden; // 超出内容隐藏
  322. text-overflow: ellipsis; // 超出部分显示省略号
  323. display: inline-block;
  324. max-width: 100%;
  325. }
  326. </style>