home.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <!--
  2. * @Title:
  3. * @Description: 首页
  4. * @Author: swp
  5. * @Date: 2022-08-24 10:49:21
  6. * @LastEditors:
  7. * @LastEditTime: 2022-08-24 10:49:21
  8. -->
  9. <template>
  10. <view class="container">
  11. <!-- 导航栏 #3F9EFF-->
  12. <uni-nav-bar :fixed="true" backgroundColor="#f7f7f7" statusBar="false" height="75px">
  13. <block slot="left">
  14. <view class="view-flex-block-center">
  15. <image src="/static/images/logo_start.png"
  16. style="width: 100rpx;height: 100rpx;background: lightgray;border-radius: 50%;" mode="widthFix">
  17. </image>
  18. </view>
  19. </block>
  20. <view class="view-flex-inline">
  21. <uni-list style="background-color: #f7f7f7;" :border="false">
  22. <uni-list-item v-if="isLogin" :border="false" style="background-color: #f7f7f7;" showArrow
  23. :title="userName" :note="userNote" :clickable="true" @click="onUserInfoClick()" />
  24. <uni-list-item v-else :border="false" style="background-color: #f7f7f7;" showArrow title="登录/注册"
  25. note="快速登录 注册体验更多功能" :clickable="true" @click="onLoginClick()" />
  26. </uni-list>
  27. </view>
  28. <block slot="right">
  29. <view style="margin-right:0rpx" @click="onNoticeMoreClick">
  30. <uni-badge class="uni-badge-left-margin" absolute="rightTop" :is-dot="noticeDot" :text="noticeValue"
  31. size="small">
  32. <uni-icons class="input-uni-icon" type="email" size="24" color="#000000" />
  33. </uni-badge>
  34. </view>
  35. <view style="margin-right:10rpx;margin-left: 10px;" @click="onNoticeMoreClick">
  36. <uni-badge class="uni-badge-left-margin" absolute="rightTop" size="small">
  37. <uni-icons class="input-uni-icon" type="scan" size="24" color="#000000" />
  38. </uni-badge>
  39. </view>
  40. </block>
  41. </uni-nav-bar>
  42. <uni-card title="待办工单" :thumbnail="orderLogo">
  43. <uni-list v-if="permission.admin || permission.orgAdmin">
  44. <uni-list-item showArrow title="会议室音响没有声音" note="2024年3月1日 12时10分" rightText="去处理" />
  45. </uni-list>
  46. <uni-card v-else title="快捷操作">
  47. <view class="view-flex-inline">
  48. <uni-icons class="input-uni-icon" type="phone" size="18" color="coral" />
  49. <text class="text-under-line" style="color: coral;font-size: 1rem;"
  50. @click="toShortcutCreateOrder">发起工单</text>
  51. </view>
  52. </uni-card>
  53. </uni-card>
  54. <uni-card title="巡检保养任务" :thumbnail="checkLogo">
  55. <uni-list>
  56. <uni-list-item showArrow title="1-10号门禁查看" note="2024年3月1日 12时10分" :clickable="true" rightText="去处理" />
  57. </uni-list>
  58. </uni-card>
  59. <uni-card :isFull="true">
  60. <swiper style="height: 200px;" circular :indicator-dots="false" :autoplay="true" :interval="2000"
  61. :duration="500">
  62. <swiper-item style="height: 200px;line-height: 300rpx;">
  63. <view style="background-color: lavenderblush;">A</view>
  64. </swiper-item>
  65. <swiper-item style="height: 200px;line-height: 300rpx;">
  66. <view style="background-color: darkcyan;">B</view>
  67. </swiper-item>
  68. <swiper-item style="height: 200px;line-height: 300rpx;">
  69. <view style="background-color: darkgoldenrod;">C</view>
  70. </swiper-item>
  71. </swiper>
  72. </uni-card>
  73. </view>
  74. </template>
  75. <script>
  76. import
  77. navBtns
  78. from "@/api/home.js";
  79. import {
  80. role
  81. } from "@/api/role.js";
  82. import {
  83. oss
  84. } from '@/common/setting';
  85. import http from '@/http/api.js';
  86. export default {
  87. components: {},
  88. data() {
  89. return {
  90. title: '泰山电教维护服务',
  91. permission: {
  92. 'admin': false,
  93. 'orgAdmin': false,
  94. 'companyAdmin': false,
  95. 'companyServciePerson': false,
  96. 'yjServicePerson': false,
  97. },
  98. userLoginStatus: 0,
  99. userName: 'guest',
  100. userNote: '泰山云服务已服务您180天',
  101. postName: '',
  102. currentRole: '',
  103. current: 0,
  104. navButton: [],
  105. navButtonIndex: [],
  106. //more/loading/noMore
  107. loadMoreStatus: "noMore",
  108. timer: false,
  109. pageSize: 10,
  110. pageCurrent: 1,
  111. total: 0,
  112. noticeDot: false,
  113. noticeValue: 0,
  114. todoOrderCount: 0,
  115. todoOrderList: [],
  116. costsApproveOrderCount: 0,
  117. costsApproveOrderList: [],
  118. closeApproveOrderCount: 0,
  119. closeApproveOrderList: [],
  120. orderLogo: "/static/images/logo_pc.png",
  121. checkLogo: "/static/images/home/inspection.png",
  122. };
  123. },
  124. computed: {},
  125. onLoad() {
  126. //console.log(JSON.stringify(this.userInfo))
  127. this.permission.admin = false;
  128. this.permission.orgAdmin = false;
  129. this.permission.companyAdmin = false;
  130. this.permission.companyServciePerson = false;
  131. this.permission.yjServicePerson = false;
  132. this.navButton = navBtns.navButtons;
  133. if (this.userInfo.role_name === role.admin) {
  134. this.permission.admin = true;
  135. this.navButtonIndex = navBtns.sysAdminNavButton;
  136. this.currentRole = role.admin;
  137. } else if (this.userInfo.role_name === role.orgAdmin) {
  138. this.permission.orgAdmin = true;
  139. this.currentRole = role.orgAdmin;
  140. this.navButtonIndex = navBtns.orgAdminNavButton;
  141. } else if (this.userInfo.role_name === role.companyAdmin) {
  142. this.permission.companyAdmin = true;
  143. this.currentRole = role.companyAdmin;
  144. this.navButtonIndex = navBtns.companyAdminNavButton;
  145. } else if (this.userInfo.role_name === role.companyServciePerson) {
  146. this.permission.companyServciePerson = true;
  147. this.currentRole = role.companyServciePerson;
  148. this.navButtonIndex = navBtns.companyServicePersonNavButton;
  149. if (this.userInfo.post_id == '1706859505948098562') {
  150. this.postName = "engineer";
  151. } else if (this.userInfo.post_id == '1730535542909140993') {
  152. this.postName = "servicePerson";
  153. }
  154. }
  155. // if (this.$u.func.checkLogin()) {
  156. // console.log("timer start +++++++ ")
  157. // this.timer = true;
  158. // setTimeout(this.timeCall, 10);
  159. // }
  160. },
  161. onUnload() {
  162. //this.timer = false;
  163. },
  164. onReady() {
  165. // if (this.$u.func.checkLogin()) {} else {
  166. // this.$u.func.logout();
  167. // }
  168. },
  169. onShow() {
  170. // if (this.$u.func.checkLogin()) {
  171. // if (this.userInfo.role_name !== this.currentRole) {
  172. // this.permission.admin = false;
  173. // this.permission.orgAdmin = false;
  174. // this.permission.companyAdmin = false;
  175. // this.permission.companyServciePerson = false;
  176. // this.permission.yjServicePerson = false;
  177. // this.navButton = navBtns.navButtons;
  178. // if (this.userInfo.role_name === role.admin) {
  179. // this.permission.admin = true;
  180. // this.navButtonIndex = navBtns.sysAdminNavButton;
  181. // this.currentRole = role.admin;
  182. // } else if (this.userInfo.role_name === role.orgAdmin) {
  183. // this.permission.orgAdmin = true;
  184. // this.currentRole = role.orgAdmin;
  185. // this.navButtonIndex = navBtns.orgAdminNavButton;
  186. // } else if (this.userInfo.role_name === role.companyAdmin) {
  187. // this.permission.companyAdmin = true;
  188. // this.currentRole = role.companyAdmin;
  189. // this.navButtonIndex = navBtns.companyAdminNavButton;
  190. // } else if (this.userInfo.role_name === role.companyServciePerson) {
  191. // this.permission.companyServciePerson = true;
  192. // this.currentRole = role.companyServciePerson;
  193. // this.navButtonIndex = navBtns.companyServicePersonNavButton;
  194. // if (this.userInfo.post_id == '1706859505948098562') {
  195. // this.postName = "engineer";
  196. // } else if (this.userInfo.post_id == '1730535542909140993') {
  197. // this.postName = "servicePerson";
  198. // }
  199. // }
  200. // }
  201. // if (this.timer == false) {
  202. // this.timer = true;
  203. // setTimeout(this.timeCall, 10);
  204. // }
  205. // } else {
  206. // this.$u.func.logout();
  207. // }
  208. },
  209. onHide() {
  210. //this.timer = false;
  211. },
  212. methods: {
  213. toOss(path) {
  214. return oss + path;
  215. },
  216. onLoginClick() {
  217. console.log("onLoginClick")
  218. var url = '/pages/login/login-account';
  219. uni.navigateTo({
  220. url: url
  221. })
  222. },
  223. onUserInfoClick() {
  224. console.log("onUserInfoClick")
  225. var url = '/pages/user/center-simple';
  226. uni.navigateTo({
  227. url: url
  228. })
  229. },
  230. timeCall() {
  231. if (this.timer == true) {
  232. this.getHomeInfo();
  233. setTimeout(this.timeCall, 10000);
  234. }
  235. },
  236. toDo(item) {
  237. var url = '/pages/check-order/orderconfirm?orderType=' + item.orderType + '&orderId=' + item.id;
  238. uni.navigateTo({
  239. url: url
  240. })
  241. },
  242. toOrderProcess(item) {
  243. var url = '/pages/check-order/orderprocessreport?skipPage=1&costsApprove=2&orderType=' + item.orderType +
  244. '&orderProcessId=' + item
  245. .orderProcessId + '&orderId=' + item.id;
  246. uni.navigateTo({
  247. url: url
  248. })
  249. },
  250. toOrderCostsApprove(item) {
  251. var url = '/pages/check-order/ordercostsapprove?orderType=' + item.orderType + '&orderId=' + item.id;
  252. uni.navigateTo({
  253. url: url
  254. })
  255. },
  256. toOrderCloseApprove(item) {
  257. console.log("toOrderCloseApprove")
  258. var url = '/pages/check-order/ordercloseapprove?orderType=' + item.orderType + '&orderId=' + item.id;
  259. uni.navigateTo({
  260. url: url
  261. })
  262. },
  263. toShortcutCreateOrder() {
  264. let url = '/pages/check-order/orderadd';
  265. uni.navigateTo({
  266. url: url
  267. })
  268. },
  269. onNoticeMoreClick() {
  270. uni.navigateTo({
  271. url: '/pages/news/noticelist'
  272. })
  273. },
  274. getHomeInfo() {
  275. this.getTodoOrderList();
  276. this.getTodoCostsApproveOrderList();
  277. this.getTodoCloseOrderList();
  278. },
  279. getTodoOrderList() {
  280. let that = this;
  281. let postData = {};
  282. http.request({
  283. url: '/galaxy-business/order/todo/list',
  284. method: 'GET',
  285. data: postData,
  286. }).then(res => {
  287. that.todoOrderCount = 0;
  288. if (res.data != null) {
  289. that.todoOrderCount = res.data.length;
  290. that.todoOrderList = res.data;
  291. }
  292. }).catch(err => {
  293. console.log(JOSN.stringify(err))
  294. })
  295. },
  296. getTodoCostsApproveOrderList() {
  297. let that = this;
  298. let postData = {};
  299. http.request({
  300. url: '/galaxy-business/order/todo/costsapprove/list',
  301. method: 'GET',
  302. data: postData,
  303. }).then(res => {
  304. that.costsApproveOrderCount = 0;
  305. if (res.data != null) {
  306. that.costsApproveOrderCount = res.data.length;
  307. that.costsApproveOrderList = res.data;
  308. }
  309. }).catch(err => {
  310. console.log(JOSN.stringify(err))
  311. })
  312. },
  313. getTodoCloseOrderList() {
  314. let that = this;
  315. let postData = {};
  316. http.request({
  317. url: '/galaxy-business/order/todo/closeapprove/list',
  318. method: 'GET',
  319. data: postData,
  320. }).then(res => {
  321. that.closeApproveOrderCount = 0;
  322. if (res.data != null) {
  323. that.closeApproveOrderCount = res.data.length;
  324. that.closeApproveOrderList = res.data;
  325. }
  326. }).catch(err => {
  327. console.log(JOSN.stringify(err))
  328. })
  329. },
  330. }
  331. };
  332. </script>
  333. <style lang="scss" scoped>
  334. $nav-height: 75px;
  335. .user-box {
  336. display: flex;
  337. justify-content: space-between;
  338. padding: 0 20rpx 0 64rpx;
  339. margin-top: 36rpx;
  340. .left {
  341. display: flex;
  342. flex-direction: column;
  343. align-items: center;
  344. .avatar {
  345. width: 128rpx;
  346. height: 128rpx;
  347. background: #ffffff;
  348. border-radius: 50%;
  349. }
  350. .user-name {
  351. margin-top: 20rpx;
  352. font-size: 36rpx;
  353. font-family: Source Han Sans CN;
  354. font-weight: 500;
  355. color: #ffffff;
  356. }
  357. .tag {
  358. margin-top: 20rpx;
  359. display: flex;
  360. justify-content: center;
  361. align-items: center;
  362. padding: 5rpx 16rpx;
  363. border: 1px solid #f5f5f5;
  364. border-radius: 7rpx;
  365. font-size: 19rpx;
  366. font-family: Source Han Sans CN;
  367. font-weight: 300;
  368. color: #ffffff;
  369. }
  370. }
  371. .edit-btn {
  372. margin-top: 20rpx;
  373. margin-bottom: 10px;
  374. flex-shrink: 0;
  375. display: flex;
  376. justify-content: center;
  377. align-items: center;
  378. width: 165rpx;
  379. height: 54rpx;
  380. border: 2rpx solid #f5f5f5;
  381. border-radius: 11rpx;
  382. font-size: 27rpx;
  383. font-family: Source Han Sans CN;
  384. font-weight: 400;
  385. color: #ffffff;
  386. }
  387. }
  388. .decoration {
  389. width: 6px;
  390. height: 6px;
  391. margin-right: 4px;
  392. border-radius: 50%;
  393. background-color: cadetblue;
  394. }
  395. .input-uni-icon {
  396. line-height: $nav-height;
  397. }
  398. .item-block {
  399. display: flex;
  400. flex-direction: column;
  401. justify-content: flex-start;
  402. width: 100%;
  403. }
  404. .line {
  405. display: flex;
  406. flex-direction: row;
  407. justify-content: flex-start;
  408. width: 100%;
  409. }
  410. .line .block {
  411. display: flex;
  412. flex-direction: column;
  413. justify-content: center;
  414. }
  415. .line-end {
  416. display: flex;
  417. flex-direction: row;
  418. justify-content: flex-end;
  419. width: 100%;
  420. }
  421. .line-end .block {
  422. display: flex;
  423. flex-direction: column;
  424. justify-content: center;
  425. }
  426. .line-center {
  427. display: flex;
  428. flex-direction: row;
  429. justify-content: center;
  430. width: 100%;
  431. height: 100%;
  432. }
  433. .line-center .block {
  434. display: flex;
  435. flex-direction: column;
  436. justify-content: center;
  437. }
  438. .rtu-name {
  439. margin-left: 5rpx;
  440. font-size: 0.7rem;
  441. font-weight: bold;
  442. }
  443. .rtu-code {
  444. margin-left: 5rpx;
  445. font-size: 0.6rem;
  446. color: gray;
  447. }
  448. .item-text-line {
  449. width: 100%;
  450. display: flex;
  451. flex-direction: row;
  452. align-items: flex-start;
  453. padding-left: 0px;
  454. padding-right: 0px;
  455. .block {
  456. height: 100%;
  457. display: flex;
  458. flex-direction: column;
  459. justify-content: center;
  460. align-items: center;
  461. }
  462. .item-title {
  463. font-size: 0.7rem;
  464. }
  465. .item-text {
  466. padding-left: 2px;
  467. padding-right: 5px;
  468. font-size: 0.7rem;
  469. }
  470. .item-text-ell {
  471. width: 100%;
  472. overflow: hidden;
  473. font-size: 0.7rem;
  474. white-space: nowrap;
  475. text-overflow: ellipsis;
  476. }
  477. .item-number {
  478. font-size: 0.7rem;
  479. margin-left: 2px;
  480. margin-right: 5px;
  481. }
  482. }
  483. .item-title-image {
  484. /* #ifndef APP-NVUE */
  485. display: block;
  486. /* #endif */
  487. margin-right: 5px;
  488. width: 20px;
  489. height: 20px;
  490. border-radius: 50%;
  491. }
  492. .uni-badge-left-margin {
  493. margin-left: 0px;
  494. }
  495. .logo {
  496. flex-shrink: 0;
  497. width: 80rpx;
  498. height: auto;
  499. }
  500. .container {
  501. // background-color: #f7f7f7;
  502. // min-height: 100vh;
  503. overflow: hidden;
  504. padding: 0 0 75rpx;
  505. }
  506. .nav {
  507. margin: 0rpx 0;
  508. box-sizing: border-box;
  509. padding: 0 10rpx;
  510. &-item {
  511. width: 100%;
  512. box-sizing: border-box;
  513. display: flex;
  514. flex-direction: column;
  515. align-items: center;
  516. justify-content: space-between;
  517. height: 130rpx;
  518. &-img {
  519. width: 80rpx;
  520. height: 80rpx;
  521. }
  522. &-name {
  523. font-size: 0.7rem;
  524. font-family: PingFang SC;
  525. font-weight: 500;
  526. color: #585b61;
  527. }
  528. }
  529. }
  530. </style>