index.vue 11 KB

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