index.vue 10 KB

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