index.vue 12 KB

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