index.vue 9.7 KB

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