index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. <template>
  2. <view class="content">
  3. <view class="">
  4. <!-- 头部 -->
  5. <u-navbar :border-bottom="false" :background="background" :is-back="false" title=" ">
  6. <view class="slot-wrap">
  7. <view class="padding-left-20 flex" >
  8. <u-icon size="34" name="map-fill" color="#FFFFFF"></u-icon>
  9. <text class="text-cut-1 text-white" style="font-size: 32rpx;padding: 0 10rpx;">{{gander?gander:'暂无园区信息'}}</text>
  10. </view>
  11. </view>
  12. </u-navbar>
  13. <!-- banner -->
  14. <swiper class="screen-swiper square-dot " :indicator-dots="true" :circular="true"
  15. :autoplay="true" interval="5000" duration="500">
  16. <swiper-item v-for="(item,index) in bannerList" :key="index">
  17. <image :src="item.banners" mode="aspectFill" ></image>
  18. </swiper-item>
  19. </swiper>
  20. <!-- 公告 -->
  21. <view v-if="!$isEmpty(noticeList)" class="">
  22. <view class="bg-white" style="height: 10rpx;"></view>
  23. <hotConsult @onTap="jump('/pages/index/notice/notice')" @detailTap="goNoticeDetail" :swiperTexts="noticeList"></hotConsult>
  24. </view>
  25. <!-- 园区信息 -->
  26. <view class="bg-white" v-if="loginType=='agency'">
  27. <view class="flex" style="padding: 30rpx; ">
  28. <image style="width: 35rpx;height: 35rpx;display: block;padding-top: 6rpx;padding-right: 10rpx;" src="../../static/icon/tag1.png" mode=""></image>
  29. <text class="text-lg text-black">园区信息</text>
  30. </view>
  31. <view class="cu-list grid col-4 no-border" :key="index">
  32. <view class="cu-item" @click="jump(item.url)" v-for="(item,index) in statistical" :key="index">
  33. <view class="grid-icon" >
  34. <image style="width: 70rpx;height: 70rpx;" :src="item.icon"/>
  35. </view>
  36. <text style="color: #333333;font-size: 26rpx;" >{{item.title}}</text>
  37. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 园区服务 -->
  42. <view class="bg-white">
  43. <view class="flex" style="padding: 30rpx; ">
  44. <image style="width: 35rpx;height: 35rpx;display: block;padding-top: 6rpx;padding-right: 10rpx;" src="../../static/icon/tag1.png" mode=""></image>
  45. <text class="text-lg text-black">园区服务</text>
  46. </view>
  47. <view class="cu-list grid col-4 no-border">
  48. <view class="cu-item" v-if="item.show" @click="jump(item.url)" v-for="(item,index) in elements" :key="index">
  49. <view class="grid-icon" >
  50. <image style="width: 70rpx;height: 70rpx;" :src="item.icon"/>
  51. </view>
  52. <text style="color: #333333;font-size: 26rpx;" >{{item.title}}</text>
  53. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  54. </view>
  55. </view>
  56. <!-- <view class="nav-list padding-top-30" >
  57. <view
  58. v-if="item.show"
  59. hover-class="none"
  60. @click="jump(item.url)"
  61. class="nav-li light" :style="{backgroundColor:item.color}"
  62. v-for="(item,index) in elements" :key="index">
  63. <view class="nav-title" style="color: #000000;font-size: 28rpx;">{{item.title}}</view>
  64. <view class="" style="padding-top: 10rpx;font-size: 24rpx;color: #acacac;">{{item.name}}{{item.show}}</view>
  65. <image :src="item.icon" mode=""></image>
  66. <u-badge :is-center="true" type="error" :count="item.count"></u-badge>
  67. </view>
  68. </view> -->
  69. </view>
  70. <view class="bg-white" v-if="loginType!='staff'">
  71. <view class="flex" style="padding: 30rpx; ">
  72. <image style="width: 35rpx;height: 35rpx;display: block;padding-top: 6rpx;padding-right: 10rpx;" src="../../static/icon/tag1.png" mode=""></image>
  73. <text class="text-lg">消防服务</text>
  74. </view>
  75. <view class="cu-list grid col-4 no-border">
  76. <view class="cu-item" @click="jump(item.url)" v-for="(item,index) in fireList" :key="index">
  77. <view class="grid-icon" >
  78. <image style="width: 70rpx;height: 70rpx;" :src="item.icon"/>
  79. </view>
  80. <text style="color: #333333;font-size: 26rpx;" >{{item.title}}</text>
  81. <view class="cu-tag bg-red badge" v-if="item.count>0">{{item.count}}</view>
  82. </view>
  83. </view>
  84. <!-- <view class="nav-list padding-top-30" >
  85. <view hover-class="none"
  86. @click="jump(item.url)"
  87. class="nav-li light" :style="{backgroundColor:item.color}"
  88. v-for="(item,index) in fireList" :key="index">
  89. <view class="nav-title" style="color: #000000;font-size: 28rpx;">{{item.title}}</view>
  90. <view class="" style="padding-top: 10rpx;font-size: 24rpx;color: #acacac;">{{item.name}}</view>
  91. <image :src="item.icon" mode=""></image>
  92. </view>
  93. </view> -->
  94. </view>
  95. <view class="bg-white padding-bottom-20" v-if="newsList.length>0">
  96. <view class="flex justify-between" style="padding: 30rpx;">
  97. <view class="flex">
  98. <image style="width: 35rpx;height: 35rpx;display: block;padding-top: 6rpx;padding-right: 10rpx;" src="../../static/icon/tag1.png" mode=""></image>
  99. <text class="text-lg text-black">园区动态</text>
  100. </view>
  101. <view @click="jump('/pages/news/list')" style="padding-top: 6rpx;font-size: 26rpx;color: #676767;">
  102. <text style="font-size: 24rpx;color: #676767;margin-top: 5rpx;">查看更多</text>
  103. <text class="cuIcon-right "></text>
  104. </view>
  105. </view>
  106. <infomation :newList="newsList"></infomation>
  107. </view>
  108. <u-action-sheet @click="ganderChange" :list="ganderArray" v-model="ganderShow"></u-action-sheet>
  109. </view>
  110. <u-tabbar v-model="tabbarCurr"
  111. :icon-size="tabbar.iconSize"
  112. :active-color="tabbar.activeColor"
  113. :mid-button-size="tabbar.MinButtonSize"
  114. :list="tabbar.list" :mid-button="true">
  115. </u-tabbar>
  116. </view>
  117. </template>
  118. <script>
  119. import {tabbar} from "@/assets/js/tabbar.js"
  120. import hotConsult from "@/components/hot-consult/hot-consult.vue"
  121. import infomation from "@/components/infomation/infomation.vue"
  122. export default {
  123. components:{
  124. hotConsult,infomation
  125. },
  126. data() {
  127. return {
  128. background:{
  129. backgroundColor:'#5064eb'
  130. },
  131. //登陆类型
  132. loginType:this.$cache.get('loginType') || '',
  133. //tabbar
  134. tabbarCurr:0,
  135. tabbar:tabbar,
  136. //园区 label
  137. ganderShow:false,
  138. //园区列表
  139. ganderArray:[],
  140. gander:'',
  141. //banner
  142. bannerList: [
  143. {
  144. 'banners': "http://139.9.103.171:1888/miniofile/xlyq/banner.jpg"
  145. },
  146. ],
  147. // 公告
  148. noticeList:[],
  149. //消防服务
  150. fireList:[],
  151. //园区服务
  152. elements: [],
  153. //园区统计
  154. statistical:[],
  155. //园区动态
  156. newsList:[]
  157. };
  158. },
  159. onShow() {
  160. this.fetchNoticeList()
  161. if (this.loginType!=this.$loginType.STAFF) {
  162. this.fetchWaitAuditNum()
  163. this.fetchWaitAuditGuestNum()
  164. }
  165. },
  166. // onReady() {
  167. // if (this.$cache.get('loginType')!=this.$loginType.STAFF) {
  168. // let tmp=this.$u.deepClone(tabbar)
  169. // tmp.list.splice(1,1)
  170. // this.tabbar=tmp
  171. // }else{
  172. // this.tabbar=tabbar
  173. // }
  174. // },
  175. onLoad() {
  176. this.fetchStaticData()
  177. this.fetchUserInfo()
  178. this.fetchNewsList()
  179. //缓存字段值
  180. this.cacheDict()
  181. },
  182. methods:{
  183. fetchBanner(){
  184. let params={
  185. tenantId:this.$cache.get('agencyTenantId')
  186. }
  187. this.$api.banner.page(params).then(res=>{
  188. if (!this.$isEmpty(res.data.records)) {
  189. this.bannerList=res.data.records
  190. }
  191. })
  192. },
  193. /**
  194. * 获取园区动态
  195. */
  196. fetchNewsList(){
  197. let params={
  198. size:5,
  199. agencyId:this.$cache.get('agencyId').toString()
  200. }
  201. this.$api.CMS.page(params).then(res=>{
  202. this.newsList=res.data.records
  203. })
  204. },
  205. /**
  206. * 加载用户数据
  207. */
  208. fetchUserInfo(){
  209. if (this.loginType==this.$loginType.STAFF) {
  210. //员工
  211. let phone=this.$cache.get('phone')
  212. this.$api.enterprisestaff.page({phone:phone,examine:1}).then(res=>{
  213. let userInfo=res.data.records[0]
  214. getApp().globalData.userInfo=userInfo
  215. this.$cache.put("residentialId",userInfo.residentialId)
  216. this.gander=userInfo.enterpriseName
  217. })
  218. }else if (this.loginType==this.$loginType.ENTERPRISE) {
  219. let creditCode=this.$cache.get('creditCode')
  220. this.$api.enterprise.detail({creditCode:creditCode}).then(res=>{
  221. this.gander=res.data.enterpriseName
  222. getApp().globalData.userInfo=res.data
  223. this.$cache.put('enterpriseName',res.data.enterpriseName)
  224. this.$cache.put("residentialId",res.data.residentialId)
  225. })
  226. }else if (this.loginType==this.$loginType.AGENCY) {
  227. this.gander=this.$cache.get('agency')
  228. }
  229. },
  230. /**
  231. * 加载待审核员工的数量
  232. */
  233. fetchWaitAuditNum(){
  234. let that=this
  235. let params={
  236. size:200,
  237. examine:0
  238. }
  239. if (this.loginType==this.$loginType.ENTERPRISE) {
  240. params.enterpriseId=this.$cache.get('enterpriseId')
  241. }
  242. if (this.loginType==this.$loginType.AGENCY) {
  243. params.agencyId=this.$cache.get('agencyId')
  244. }
  245. this.$api.enterprisestaff.page(params).then(res=>{
  246. this.elements.forEach(item=>{
  247. if (item.url=='/pages/index/staffAudit/list') {
  248. item.count=res.data.total
  249. }
  250. })
  251. })
  252. },
  253. fetchWaitAuditGuestNum(){
  254. let params={
  255. checkState:0
  256. }
  257. //企业
  258. if (this.loginType==this.$loginType.ENTERPRISE) {
  259. params.enterpriseId=this.$cache.get('enterpriseId')
  260. }
  261. //园区
  262. if (this.loginType==this.$loginType.AGENCY) {
  263. params.agencyId=this.$cache.get('agencyId')
  264. }
  265. this.$api.guest.page(params).then(res=>{
  266. this.elements.forEach(item=>{
  267. if (item.url=='/pages/guest/records/records') {
  268. item.count=res.data.total
  269. }
  270. })
  271. })
  272. },
  273. /**
  274. * @param {Object} index更改园区
  275. */
  276. ganderChange(index){
  277. this.gander=this.ganderArray[index].text
  278. },
  279. /**
  280. * 跳转
  281. * @param {Object} url
  282. */
  283. jump(url){
  284. if (url=='/pages/mine/healthcode/healthcode') {
  285. uni.navigateToMiniProgram({
  286. appId:'wx2eec5fb00157a603',
  287. fail: (err) => {
  288. console.log(err);
  289. }
  290. })
  291. return
  292. }
  293. if (!this.$isEmpty(url)) {
  294. uni.navigateTo({
  295. url:url
  296. })
  297. }
  298. },
  299. /**
  300. * 加载通知列表
  301. */
  302. fetchNoticeList(){
  303. let params={
  304. agencyId:this.$cache.get('agencyId')
  305. }
  306. this.$api.notice.page(params).then(res=>{
  307. this.noticeList=res.data.records
  308. })
  309. },
  310. /**
  311. * 跳转到通知详情
  312. */
  313. goNoticeDetail(item){
  314. console.log(item);
  315. getApp().globalData.noticeDetail=item
  316. uni.navigateTo({
  317. url:"/pages/index/notice/detail",
  318. })
  319. },
  320. //缓存字典的值
  321. async cacheDict(){
  322. let dictCacheData=this.$cache.get('dict')
  323. if (!this.$isEmpty(dictCacheData)) {
  324. return
  325. }
  326. //有效时间
  327. let validTime=1*24*60*60*3
  328. //车辆类型
  329. let carTypeList=[]
  330. //车辆性质
  331. let carPropertiesList=[]
  332. //燃油类别
  333. let fuelCategoryList=[]
  334. // 请求字典begin
  335. let res1=await this.$api.dict({code:'car_type'})
  336. res1.data.forEach((item)=>{
  337. let tmp={
  338. value:item.dictKey,
  339. label:item.dictValue
  340. }
  341. carTypeList.push(tmp)
  342. })
  343. let res2=await this.$api.dict({code:'car_properties'})
  344. res2.data.forEach((item)=>{
  345. let tmp={
  346. value:item.dictKey,
  347. label:item.dictValue
  348. }
  349. carPropertiesList.push(tmp)
  350. })
  351. let res3=await this.$api.dict({code:'fuel_category'})
  352. res3.data.forEach((item)=>{
  353. let tmp={
  354. value:item.dictKey,
  355. label:item.dictValue
  356. }
  357. fuelCategoryList.push(tmp)
  358. })
  359. // 请求字典end
  360. //缓存字典的值begin
  361. let dict={
  362. carTypeList,
  363. carPropertiesList,
  364. fuelCategoryList
  365. }
  366. this.$cache.put('dict',dict,validTime)
  367. //缓存字典的值end
  368. },
  369. /**
  370. * 加载静态数据
  371. */
  372. fetchStaticData(){
  373. this.statistical=[
  374. {
  375. title: '园区信息',
  376. name: 'Campus information',
  377. color: '#e3f5ff',
  378. icon:'../../static/icon/yuanqu.png',
  379. url:'/pages/agency/agency',
  380. count:0,
  381. },
  382. {
  383. title: '数据统计',
  384. icon:'../../static/icon/data-service.png',
  385. url:'/pages/agency/agency?current=1',
  386. },
  387. {
  388. title: '消防统计',
  389. icon:'../../static/icon/fire-service.png',
  390. url:'/pages/agency/agency?current=2',
  391. },
  392. ]
  393. this.elements=[
  394. {
  395. title: '我的企业',
  396. name: 'My business',
  397. color: '#e3f5ff',
  398. icon:'../../static/icon/yuanqu.png',
  399. url:'/pages/company/company',
  400. count:0,
  401. show:this.loginType!=this.$loginType.AGENCY
  402. },
  403. {
  404. title: '我的资料',
  405. name: 'My profile',
  406. color: '#ecf3f9',
  407. icon:'../../static/icon/info.png',
  408. url:'/pages/index/myinfo/myinfo',
  409. count:0,
  410. show:this.loginType==this.$loginType.STAFF
  411. },
  412. {
  413. title: '员工审核',
  414. name: 'Staff certification',
  415. color: '#eaebf9',
  416. icon:'../../static/icon/info.png',
  417. url:'/pages/index/staffAudit/list',
  418. count:0,
  419. show:this.loginType!=this.$loginType.STAFF
  420. },
  421. {
  422. title: '访客审核',
  423. icon:'../../static/icon/guest-gl.png',
  424. url:'/pages/guest/records/records',
  425. count:0,
  426. show:this.loginType!=this.$loginType.STAFF
  427. },
  428. {
  429. title: '我的测温',
  430. name: 'My temperature',
  431. color: '#e5eef9',
  432. icon:'../../static/icon/cewen.png',
  433. url:'/pages/index/staff-temperature/list',
  434. count:0,
  435. show:this.loginType==this.$loginType.STAFF
  436. },
  437. {
  438. title: '测温记录',
  439. name: 'Staff temperature',
  440. color: '#e5eef9',
  441. icon:'../../static/icon/cewen.png',
  442. url:'/pages/index/staff-temperature/list',
  443. count:0,
  444. show:this.loginType!=this.$loginType.STAFF
  445. },
  446. {
  447. title: '通行记录',
  448. name: 'Access records',
  449. color: '#e9f9f3',
  450. icon:'../../static/icon/jilu.png',
  451. url:'/pages/index/access-record/access-record',
  452. count:0,
  453. show:true
  454. },
  455. {
  456. title: '公告管理',
  457. name: 'Notice managerment',
  458. color: '#eaebf9',
  459. icon:'../../static/icon/tongzhi.png',
  460. url:'/pages/index/notice/list',
  461. count:0,
  462. show:this.loginType==this.$loginType.AGENCY
  463. },
  464. {
  465. title: this.loginType==this.$loginType.STAFF?'我的车辆':'车辆管理',
  466. name: 'Notice managerment',
  467. color: '#eaebf9',
  468. icon:'../../static/icon/car.png',
  469. url:this.loginType==this.$loginType.STAFF?'/pages/index/car/my-car/my-car':'/pages/index/car/car-manager/car-manager',
  470. count:0,
  471. show:true
  472. },
  473. {
  474. title: '车辆记录',
  475. name: 'The vehicle record',
  476. color: '#fcf5f3',
  477. icon:'../../static/icon/car-records.png',
  478. url:'/pages/index/car/list',
  479. count:0,
  480. show:this.loginType==this.$loginType.AGENCY
  481. },
  482. ]
  483. this.fireList=[
  484. {
  485. title: '烟感报警',
  486. name: 'Smoke alarm',
  487. color: '#e5eef9',
  488. icon:'../../static/icon/yangan.png',
  489. url:"/pages/index/fire/list/list?fireType=0"
  490. },
  491. {
  492. title: '消防水压',
  493. name: 'Fire water pressure',
  494. color: '#e9f9f3',
  495. icon: '../../static/icon/xiaofang.png',
  496. url:"/pages/index/fire/list/list?fireType=2"
  497. },
  498. {
  499. title: '燃气告警',
  500. name: 'Gas alarm',
  501. color: '#ffefef',
  502. icon: '../../static/icon/ranqi.png',
  503. url:"/pages/index/fire/list/list?fireType=1"
  504. },
  505. {
  506. title: '电表设备',
  507. name: 'Metering equipment',
  508. color: '#e3f5ff',
  509. icon:'../../static/icon/dianbiao.png',
  510. // icon: '../../static/index/fire/dianbiao.png',
  511. url:"/pages/index/fire/list/list?fireType=3"
  512. },
  513. ]
  514. }
  515. }
  516. };
  517. </script>
  518. <style lang="scss" scoped>
  519. page,.content{
  520. background-color: #FFFFFF;
  521. min-height: 100vh;
  522. }
  523. //四宫格 begin
  524. .nav-list {
  525. display: flex;
  526. flex-wrap: wrap;
  527. justify-content: flex-start;
  528. }
  529. .nav-li {
  530. padding: 30upx 30rpx;
  531. border-radius: 12upx;
  532. width: 44%;
  533. margin: 10rpx 2% 10upx;
  534. background-size: cover;
  535. background-position: center;
  536. position: relative;
  537. z-index: 1;
  538. }
  539. .nav-li::after {
  540. content: "";
  541. position: absolute;
  542. z-index: -1;
  543. background-color: inherit;
  544. width: 100%;
  545. height: 100%;
  546. left: 0;
  547. bottom: -10%;
  548. border-radius: 10upx;
  549. opacity: 0.2;
  550. transform: scale(0.9, 0.9);
  551. }
  552. .nav-li.cur {
  553. color: #fff;
  554. background: rgb(94, 185, 94);
  555. box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
  556. }
  557. .nav-title {
  558. font-size: 32upx;
  559. font-weight: 300;
  560. }
  561. .nav-title::first-letter {
  562. font-size: 40upx;
  563. margin-right: 4upx;
  564. }
  565. .nav-name {
  566. font-size: 28upx;
  567. text-transform: Capitalize;
  568. margin-top: 20upx;
  569. position: relative;
  570. }
  571. .nav-name::before {
  572. content: "";
  573. position: absolute;
  574. display: block;
  575. width: 40upx;
  576. height: 6upx;
  577. background: #fff;
  578. bottom: 0;
  579. right: 0;
  580. opacity: 0.5;
  581. }
  582. .nav-name::after {
  583. content: "";
  584. position: absolute;
  585. display: block;
  586. width: 100upx;
  587. height: 1px;
  588. background: #fff;
  589. bottom: 0;
  590. right: 40upx;
  591. opacity: 0.3;
  592. }
  593. .nav-name::first-letter {
  594. font-weight: bold;
  595. font-size: 36upx;
  596. margin-right: 1px;
  597. }
  598. .nav-li image {
  599. position: absolute;
  600. right: 30upx;
  601. top: 22upx;
  602. width: 66upx;
  603. height: 66upx;
  604. }
  605. //四宫格 end
  606. </style>