index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <view class="index-page ">
  3. <view class="header custom_status_bar">
  4. <view class="status_bar">
  5. <div class="name">工作台</div>
  6. <div class="actions">
  7. <div class="message" @click="linkToMessage">
  8. <image v-if="user.userAvatar" class="icon" src="/static/index/message.png" mode="widthFix"></image>
  9. </div>
  10. <div class="scan" @click="scanQrcode">
  11. <image class="icon" src="/static/index/scanner.png" mode="widthFix"></image>
  12. <text class="icon-name">扫一扫</text>
  13. </div>
  14. </div>
  15. </view>
  16. <view class="user-info">
  17. <div class="company">
  18. <text class="company-name">{{user.ocName}}</text>
  19. <image class="icon" src="/static/index/company.png" mode="widthFix"></image>
  20. </div>
  21. <div class="user">
  22. <view class="avatar-box">
  23. <image v-if="user.userAvatar" class="avatar" :src="user.userAvatar" mode="widthFix" @error="userAvatar=defaultAvatar"></image>
  24. <image v-else class="avatar" :src="defaultAvatar" mode="widthFix"></image>
  25. </view>
  26. <view class="info">
  27. <view class="user-name">
  28. {{user.userName}}
  29. </view>
  30. <view class="user-position">
  31. {{user.positionName}}
  32. </view>
  33. </view>
  34. </div>
  35. </view>
  36. </view>
  37. <view class="container">
  38. <view class="cont">
  39. <div class="container-wrap">
  40. <div class="notice">
  41. <div class="notice-name">
  42. <image class="icon" src="/static/index/notice.png" mode="widthFix"></image>
  43. <text>最近动态</text>
  44. </div>
  45. <div class="notice-cont">
  46. <uni-notice-bar
  47. scrollable :text="notice"
  48. background-color="#fff0"
  49. :speed="20"
  50. color="#333" />
  51. </div>
  52. </div>
  53. <view class="tab">
  54. <div class="tab-item">
  55. <image class="icon" src="/static/index/tab1.png" mode="widthFix"></image>
  56. <view class="tab-name">待办任务 3 个</view>
  57. </div>
  58. <div class="tab-item">
  59. <image class="icon" src="/static/index/tab2.png" mode="widthFix"></image>
  60. <view class="tab-name">告警事件 2个</view>
  61. </div>
  62. <div class="tab-item">
  63. <image class="icon" src="/static/index/tab3.png" mode="widthFix"></image>
  64. <view class="tab-name">待处理隐患 2个</view>
  65. </div>
  66. </view>
  67. <view class="tab-cont">
  68. <div class="part" v-for="part in 4" :key="part">
  69. <div class="head">
  70. <text class="head-name">代办任务</text>
  71. <view class="more">更多</view>
  72. </div>
  73. <div class="part-cont">
  74. <div class="item" v-for="item in 4" :key="item">
  75. <div class="title">
  76. <div class="name">任务名称</div>
  77. <view class="state">状态</view>
  78. </div>
  79. <div class="tags">
  80. <text class="tag">优先级</text>
  81. <text class="tag">分类名称</text>
  82. <text class="tag">普通任务</text>
  83. </div>
  84. <view class="time">
  85. 预期结束时间:21天12小时23分32秒
  86. </view>
  87. <div class="bottom">
  88. <view class="user">
  89. <image class="avatar" src="/static/index/user.png" mode="widthFix"></image>
  90. 处理人:孙小白
  91. </view>
  92. <view class="hand-time">
  93. 2023.08.25 09:00
  94. </view>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </view>
  100. </div>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import {getNotices} from '@/api/system/art.js'
  107. export default {
  108. data() {
  109. return {
  110. applist: [],
  111. defaultAvatar:"/static/components/avatar.png",
  112. notice:"",
  113. user:{
  114. groupName: "",
  115. ocName: "",
  116. positionName: "",
  117. roleName: "",
  118. userAvatar: "",
  119. userIntro: "",
  120. userName: "",
  121. userPhone: "",
  122. userPhoto: "",
  123. userRealName: ""
  124. }
  125. }
  126. },
  127. onShow() {
  128. this.getData()
  129. },
  130. methods: {
  131. scanQrcode(){
  132. uni.scanCode({
  133. onlyFromCamera: true,
  134. success: function (res) {
  135. console.log('条码类型:' + res.scanType);
  136. console.log('条码内容:' + res.result);
  137. },
  138. fail() {
  139. uni.showToast({
  140. icon:'none',
  141. title:"扫码失败"
  142. })
  143. }
  144. });
  145. },
  146. linkToMessage(){
  147. uni.navigateTo({
  148. url:"/pages/message/message"
  149. })
  150. },
  151. getData(){
  152. let user=uni.getStorageSync('accountInfo');
  153. if(user){this.user=user}
  154. let notice=""
  155. getNotices({
  156. page: 1,
  157. limit: 10,
  158. artCatId: 2,
  159. artCatTitle: "最新动态"
  160. }).then((res)=>{
  161. for(let i=0;i<res.data.length;i++){
  162. notice+=`${res.data[i].artTitle} 发布时间:${res.data[i].issuedAt};`
  163. }
  164. this.notice=notice
  165. })
  166. }
  167. }
  168. }
  169. </script>
  170. <style lang="scss" scoped>
  171. .index-page {
  172. min-height: 100vh;
  173. background-color: rgba(245, 246, 248, 1);
  174. .header{
  175. height: 400rpx;
  176. background-image: url('/static/index/bg.png');
  177. background-repeat: no-repeat;
  178. background-size: 100% 100%;
  179. /* #ifdef MP-WEIXIN */
  180. padding-top: 28px;
  181. /* #endif */
  182. .status_bar{
  183. padding: 0 32rpx;
  184. height: 88rpx;
  185. display: flex;
  186. justify-content: space-between;
  187. align-items: center;
  188. .name{
  189. font-size: 40rpx;
  190. font-weight: 600;
  191. color: #000;
  192. }
  193. .actions{
  194. display: flex;
  195. align-items: center;
  196. .message{
  197. .icon{
  198. display: inline-block;
  199. width: 32rpx;
  200. }
  201. }
  202. .scan{
  203. width: 144rpx;
  204. height: 48rpx;
  205. border-radius: 20rpx;
  206. background-color: #fff;
  207. display: flex;
  208. justify-content: center;
  209. align-items: center;
  210. margin-left: 32rpx;
  211. .icon{
  212. display: inline-block;
  213. width: 28rpx;
  214. }
  215. .icon-name{
  216. font-size: 24rpx;
  217. color: #000;
  218. padding-left: 10rpx;
  219. }
  220. }
  221. }
  222. }
  223. .user-info{
  224. width: 686rpx;
  225. height: 228rpx;
  226. background: linear-gradient(180deg, #7AB2FF 0%, #808EFF 100%);
  227. margin: 0 auto;
  228. border-radius: 16px;
  229. margin-top: 24rpx;
  230. padding: 24px 22rpx 0 30rpx;
  231. box-sizing: border-box;
  232. .company{
  233. display: flex;
  234. justify-content: flex-end;
  235. align-items: center;
  236. .company-name{
  237. padding-right: 10rpx;
  238. font-size: 28rpx;
  239. color: #fff;
  240. }
  241. .icon{
  242. display: block;
  243. width: 40rpx;
  244. height: 40rpx;
  245. }
  246. }
  247. .user{
  248. display: flex;
  249. align-items: center;
  250. .avatar-box{
  251. width: 72rpx;
  252. height: 72rpx;
  253. border-radius: 50%;
  254. .avatar{
  255. display: block;
  256. width: 72rpx;
  257. height: 72rpx;
  258. border-radius: 50%;
  259. }
  260. }
  261. .info{
  262. padding-left: 24rpx;
  263. .user-name{
  264. font-size: 32rpx;
  265. color: #fff;
  266. }
  267. .user-position{
  268. font-size: 24rpx;
  269. color: #fff;
  270. opacity: 0.6;
  271. padding-top: 8rpx;
  272. }
  273. }
  274. }
  275. }
  276. }
  277. .container{
  278. position: relative;
  279. width: 750rpx;
  280. .cont{
  281. width: 750rpx;
  282. min-height: 1200px;
  283. position: absolute;
  284. overflow: auto;
  285. background-image: url('/static/index/bg-bottom.png');
  286. background-repeat: no-repeat;
  287. background-size: 100% 1200px;
  288. background-position: 0 0;
  289. box-sizing: border-box;
  290. top: -45px;
  291. margin-top: var(--status-bar-height);
  292. left: 0;
  293. .container-wrap{
  294. padding: 0 32rpx;
  295. background-color: rgba(245, 246, 248, 1);
  296. padding-bottom: 180rpx;
  297. }
  298. .notice{
  299. height: 84rpx;
  300. background-color:rgba(245, 246, 248, 1);
  301. margin-top: 48rpx;
  302. border-radius: 8rpx;
  303. display: flex;
  304. justify-content: space-between;
  305. align-items: center;
  306. box-shadow: 0px 10px 10px -4px rgba(45, 54, 67, 0.2);
  307. padding: 0 32rpx;
  308. .notice-name{
  309. font-weight: 600;
  310. font-size: 24rpx;
  311. color: rgba(0, 0, 0, 0.9);
  312. .icon{
  313. width: 22rpx;
  314. margin-right: 8rpx;
  315. }
  316. }
  317. .notice-cont{
  318. width: 500rpx;
  319. height: 80rpx;
  320. flex: 1;
  321. font-size: 28rpx;
  322. color: rgba(0, 0, 0, 0.9);
  323. // background-color: #fff;
  324. }
  325. }
  326. .tab{
  327. display: flex;
  328. justify-content: center;
  329. align-items: center;
  330. padding: 40rpx 32rpx 20rpx 32rpx;
  331. .tab-item{
  332. width: 33.33%;
  333. height: 150rpx;
  334. display: flex;
  335. justify-content: center;
  336. align-items: center;
  337. flex-direction: column;
  338. .icon{
  339. width: 96rpx;
  340. }
  341. .tab-name{
  342. font-size: 28rpx;
  343. color: rgba(0, 0, 0, 0.9);
  344. padding-top: 12rpx;
  345. }
  346. }
  347. }
  348. .tab-cont{
  349. .part{
  350. .head{
  351. padding-top: 20rpx;
  352. display: flex;
  353. justify-content: space-between;
  354. align-items: center;
  355. .head-name{
  356. font-size: 32rpx;
  357. font-weight: 600;
  358. color: rgba(0, 0, 0, 0.9);
  359. }
  360. .more{
  361. font-size: 24rpx;
  362. color: rgba(110, 116, 128, 1);
  363. }
  364. }
  365. .part-cont{
  366. .item{
  367. background-color: #fff;
  368. border-radius: 12rpx;
  369. margin-top: 16rpx;
  370. padding: 24rpx 20rpx;
  371. .title{
  372. display: flex;
  373. justify-content: space-between;
  374. align-items: center;
  375. .name{
  376. font-size: 36rpx;
  377. color: rgba(0, 0, 0, 0.8);
  378. }
  379. .state{
  380. font-size: 32rpx;
  381. color: rgba(250, 139, 55, 1);
  382. }
  383. }
  384. .tags{
  385. padding-top: 24rpx;
  386. .tag{
  387. background: rgba(245, 246, 248, 1);
  388. font-size: 20rpx;
  389. margin-left: 10rpx;
  390. padding: 10rpx 20rpx;
  391. &:nth-child(1){
  392. color: rgba(234, 130, 89, 1);
  393. background: rgba(251, 241, 237, 1);
  394. }
  395. }
  396. }
  397. .time{
  398. padding-top: 20rpx;
  399. font-size: 28rpx;
  400. color:rgba(241, 57, 57, 0.8);
  401. }
  402. .bottom{
  403. display: flex;
  404. justify-content: space-between;
  405. align-items: center;
  406. padding-top: 20rpx;
  407. .user{
  408. display: flex;
  409. align-items: center;
  410. font-size: 24rpx;
  411. color: rgba(0, 0, 0, 1);
  412. .avatar{
  413. width: 44rpx;
  414. margin-right: 10rpx;
  415. }
  416. }
  417. .hand-time{
  418. font-size: 24rpx;
  419. color: rgba(0, 0, 0, 1);
  420. }
  421. }
  422. }
  423. }
  424. }
  425. }
  426. }
  427. }
  428. }
  429. </style>