index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  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: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. onLoad() {
  130. this.fetchStaticData()
  131. this.fetchBanner()
  132. this.fetchUserInfo()
  133. this.fetchNewsList()
  134. },
  135. methods:{
  136. fetchBanner(){
  137. let params={
  138. tenantId:this.$cache.get('agencyTenantId')
  139. }
  140. this.$api.banner.page(params).then(res=>{
  141. if (!this.$isEmpty(res.data.records)) {
  142. this.bannerList=res.data.records
  143. }
  144. })
  145. },
  146. /**
  147. * 获取园区动态
  148. */
  149. fetchNewsList(){
  150. let params={
  151. size:5,
  152. agencyId:this.$cache.get('agencyId').toString()
  153. }
  154. this.$api.CMS.page(params).then(res=>{
  155. this.newsList=res.data.records
  156. })
  157. },
  158. /**
  159. * 加载用户数据
  160. */
  161. fetchUserInfo(){
  162. if (this.loginType==this.$loginType.STAFF) {
  163. //员工
  164. let phone=this.$cache.get('phone')
  165. this.$api.enterprisestaff.page({phone:phone,examine:1}).then(res=>{
  166. let userInfo=res.data.records[0]
  167. getApp().globalData.userInfo=userInfo
  168. this.$cache.put("residentialId",userInfo.residentialId)
  169. this.gander=userInfo.enterpriseName
  170. })
  171. }else if (this.loginType==this.$loginType.ENTERPRISE) {
  172. this.gander=this.$cache.get('enterpriseName')
  173. let creditCode=this.$cache.get('creditCode')
  174. this.$api.enterprise.detail({creditCode:creditCode}).then(res=>{
  175. getApp().globalData.userInfo=res.data
  176. this.$cache.put("residentialId",res.data.residentialId)
  177. })
  178. }else if (this.loginType==this.$loginType.AGENCY) {
  179. this.gander=this.$cache.get('agency')
  180. }
  181. },
  182. /**
  183. * 加载待审核员工的数量
  184. */
  185. fetchWaitAuditNum(){
  186. let that=this
  187. let params={
  188. size:200,
  189. examine:0
  190. }
  191. if (this.loginType==this.$loginType.ENTERPRISE) {
  192. params.enterpriseId=this.$cache.get('enterpriseId')
  193. }
  194. this.$api.enterprisestaff.page(params).then(res=>{
  195. if (!that.$isEmpty(res.data.records)) {
  196. that.elements.forEach(item=>{
  197. if (item.url=='/pages/index/staffAudit/list') {
  198. item.count=res.data.total
  199. }
  200. })
  201. }else{
  202. that.elements.forEach(item=>{
  203. if (item.url=='/pages/index/staffAudit/list') {
  204. item.count=0
  205. }
  206. })
  207. }
  208. console.log(that.elements);
  209. })
  210. },
  211. /**
  212. * @param {Object} index更改园区
  213. */
  214. ganderChange(index){
  215. this.gander=this.ganderArray[index].text
  216. },
  217. /**
  218. * 跳转
  219. * @param {Object} url
  220. */
  221. jump(url){
  222. if (url=='/pages/mine/healthcode/healthcode') {
  223. uni.navigateToMiniProgram({
  224. appId:'wx2eec5fb00157a603',
  225. fail: (err) => {
  226. console.log(err);
  227. }
  228. })
  229. return
  230. }
  231. if (!this.$isEmpty(url)) {
  232. uni.navigateTo({
  233. url:url
  234. })
  235. }
  236. },
  237. /**
  238. * 加载通知列表
  239. */
  240. fetchNoticeList(){
  241. let params={
  242. agencyId:this.$cache.get('agencyId')
  243. }
  244. this.$api.notice.page(params).then(res=>{
  245. this.noticeList=res.data.records
  246. })
  247. },
  248. /**
  249. * 跳转到通知详情
  250. */
  251. goNoticeDetail(item){
  252. console.log(item);
  253. getApp().globalData.noticeDetail=item
  254. uni.navigateTo({
  255. url:"/pages/index/notice/detail",
  256. })
  257. },
  258. /**
  259. * 加载静态数据
  260. */
  261. fetchStaticData(){
  262. this.elements=[
  263. {
  264. title: '我的企业',
  265. name: 'My business',
  266. color: '#e3f5ff',
  267. icon: '../../static/index/gander/qiye.png',
  268. url:'/pages/company/company',
  269. count:0,
  270. show:this.loginType!=this.$loginType.AGENCY
  271. },
  272. {
  273. title: '园区信息',
  274. name: 'Campus information',
  275. color: '#e3f5ff',
  276. icon: '../../static/index/gander/qiye.png',
  277. url:'/pages/index/agency/agency',
  278. count:0,
  279. show:this.loginType==this.$loginType.AGENCY
  280. },
  281. {
  282. title: '我的资料',
  283. name: 'My profile',
  284. color: '#ecf3f9',
  285. icon: '../../static/index/gander/renzheng.png',
  286. url:'/pages/index/myinfo/myinfo',
  287. count:0,
  288. show:this.loginType==this.$loginType.STAFF
  289. },
  290. {
  291. title: '员工审核',
  292. name: 'Staff certification',
  293. color: '#eaebf9',
  294. icon: '../../static/index/gander/renzheng.png',
  295. url:'/pages/index/staffAudit/list',
  296. count:0,
  297. show:this.loginType!=this.$loginType.STAFF
  298. },
  299. {
  300. title: '我的测温',
  301. name: 'My temperature',
  302. color: '#e5eef9',
  303. icon: '../../static/index/gander/cewen1.png',
  304. url:'/pages/index/staff-temperature/list',
  305. count:0,
  306. show:this.loginType==this.$loginType.STAFF
  307. },
  308. {
  309. title: '测温记录',
  310. name: 'Staff temperature',
  311. color: '#e5eef9',
  312. icon: '../../static/index/gander/cewen1.png',
  313. url:'/pages/index/staff-temperature/list',
  314. count:0,
  315. show:this.loginType!=this.$loginType.STAFF
  316. },
  317. {
  318. title: '通行记录',
  319. name: 'Access records',
  320. color: '#e9f9f3',
  321. icon: '../../static/index/gander/tongxing.png',
  322. url:'/pages/index/access-record/access-record',
  323. count:0,
  324. show:true
  325. },
  326. {
  327. title: '公告管理',
  328. name: 'Notice managerment',
  329. color: '#eaebf9',
  330. icon: '../../static/index/gander/notice.png',
  331. url:'/pages/index/notice/list',
  332. count:0,
  333. show:this.loginType==this.$loginType.AGENCY
  334. },
  335. {
  336. title: '健康码',
  337. name: 'Staff temperature',
  338. color: '#f4f0ff',
  339. icon: '../../static/index/gander/health.png',
  340. url:'/pages/mine/healthcode/healthcode',
  341. count:0,
  342. show:this.loginType==this.$loginType.STAFF
  343. },
  344. {
  345. title: '车辆记录',
  346. name: 'The vehicle record',
  347. color: '#fcf5f3',
  348. icon: '../../static/index/gander/car.png',
  349. url:'/pages/index/car/car',
  350. count:0,
  351. show:this.loginType==this.$loginType.AGENCY
  352. },
  353. ]
  354. this.fireList=[
  355. {
  356. title: '烟感报警',
  357. name: 'Smoke alarm',
  358. color: '#e5eef9',
  359. icon: '../../static/index/fire/yangan.png',
  360. url:"/pages/index/fire/list/list?fireType=0"
  361. },
  362. {
  363. title: '燃气告警',
  364. name: 'Gas alarm',
  365. color: '#ffefef',
  366. icon: '../../static/index/fire/ranqi.png',
  367. url:"/pages/index/fire/list/list?fireType=1"
  368. },
  369. {
  370. title: '消防水压',
  371. name: 'Fire water pressure',
  372. color: '#e9f9f3',
  373. icon: '../../static/index/fire/xiaofang.png',
  374. url:"/pages/index/fire/list/list?fireType=2"
  375. },
  376. {
  377. title: '电表设备',
  378. name: 'Metering equipment',
  379. color: '#e3f5ff',
  380. icon: '../../static/index/fire/dianbiao.png',
  381. url:"/pages/index/fire/list/list?fireType=3"
  382. },
  383. ]
  384. }
  385. }
  386. };
  387. </script>
  388. <style lang="scss" scoped>
  389. page,.content{
  390. background-color: #FFFFFF;
  391. min-height: 100vh;
  392. }
  393. //四宫格 begin
  394. .nav-list {
  395. display: flex;
  396. flex-wrap: wrap;
  397. justify-content: flex-start;
  398. }
  399. .nav-li {
  400. padding: 30upx 30rpx;
  401. border-radius: 12upx;
  402. width: 44%;
  403. margin: 10rpx 2% 10upx;
  404. background-size: cover;
  405. background-position: center;
  406. position: relative;
  407. z-index: 1;
  408. }
  409. .nav-li::after {
  410. content: "";
  411. position: absolute;
  412. z-index: -1;
  413. background-color: inherit;
  414. width: 100%;
  415. height: 100%;
  416. left: 0;
  417. bottom: -10%;
  418. border-radius: 10upx;
  419. opacity: 0.2;
  420. transform: scale(0.9, 0.9);
  421. }
  422. .nav-li.cur {
  423. color: #fff;
  424. background: rgb(94, 185, 94);
  425. box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
  426. }
  427. .nav-title {
  428. font-size: 32upx;
  429. font-weight: 300;
  430. }
  431. .nav-title::first-letter {
  432. font-size: 40upx;
  433. margin-right: 4upx;
  434. }
  435. .nav-name {
  436. font-size: 28upx;
  437. text-transform: Capitalize;
  438. margin-top: 20upx;
  439. position: relative;
  440. }
  441. .nav-name::before {
  442. content: "";
  443. position: absolute;
  444. display: block;
  445. width: 40upx;
  446. height: 6upx;
  447. background: #fff;
  448. bottom: 0;
  449. right: 0;
  450. opacity: 0.5;
  451. }
  452. .nav-name::after {
  453. content: "";
  454. position: absolute;
  455. display: block;
  456. width: 100upx;
  457. height: 1px;
  458. background: #fff;
  459. bottom: 0;
  460. right: 40upx;
  461. opacity: 0.3;
  462. }
  463. .nav-name::first-letter {
  464. font-weight: bold;
  465. font-size: 36upx;
  466. margin-right: 1px;
  467. }
  468. .nav-li image {
  469. position: absolute;
  470. right: 30upx;
  471. top: 22upx;
  472. width: 66upx;
  473. height: 66upx;
  474. }
  475. //四宫格 end
  476. </style>