index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <view >
  3. <image :src="worktop" style="height: 340rpx;width: 90%;margin-left: 40rpx;"></image>
  4. <!-- <uni-segmented-control :current="current" :values="items" @clickItem="onClickItem" styleType="text"
  5. activeColor="#4cd964"></uni-segmented-control>
  6. <view v-if="current === 0"> -->
  7. <view class="grid-body">
  8. <uni-card :border="false">
  9. <uni-section title="事件中心" type="line" titleFontSize='18px' >
  10. <uni-grid :column="3" :showBorder="false" @change="changeGrid">
  11. <uni-grid-item v-for="(item, index) in urlList1" :key="index">
  12. <view class="example-body">
  13. <view class="grid-item-box" @click="handleToInfo(item.menuUrl,item.menuName)">
  14. <image :src="urlIconTran(item.menuIcon)" class="tubiao"></image>
  15. <text class="text">{{ item.menuName }}</text>
  16. <u-badge v-if="item.menuName == '指令'&&unread != 0" :value="unread" type="error" class="huibiao"></u-badge>
  17. </view>
  18. </view>
  19. </uni-grid-item>
  20. </uni-grid>
  21. </uni-section>
  22. <uni-section title="管理中心" type="line" titleFontSize='18px'>
  23. <uni-grid :column="3" :showBorder="false" @change="changeGrid">
  24. <uni-grid-item v-for="(item, index1) in urlList" :key="index1">
  25. <view class="example-body">
  26. <view class="grid-item-box" @click="handleToInfo(item.menuUrl,item.menuName)">
  27. <image :src="urlIconTran(item.menuIcon)" class="tubiao"></image>
  28. <text class="text">{{ item.menuName }}</text>
  29. <u-badge v-if="item.menuName == '指令'&&unread != 0" :value="unread" type="error" class="huibiao"></u-badge>
  30. </view>
  31. </view>
  32. </uni-grid-item>
  33. </uni-grid>
  34. </uni-section>
  35. <uni-section title="乡镇消防工作档案" type="line" titleFontSize='18px' >
  36. <uni-grid :column="3" :showBorder="false" @change="changeGrid">
  37. <uni-grid-item v-for="(item, index) in urlList2" :key="index">
  38. <view class="example-body">
  39. <view class="grid-item-box" @click="handleToInfo(item.menuUrl,item.menuName)">
  40. <image :src="urlIconTran(item.menuIcon)" class="tubiao"></image>
  41. <text class="text">{{ item.menuName }}</text>
  42. <u-badge v-if="item.menuName == '指令'&&unread != 0" :value="unread" type="error" class="huibiao"></u-badge>
  43. </view>
  44. </view>
  45. </uni-grid-item>
  46. </uni-grid>
  47. </uni-section>
  48. </uni-card>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import storage from '@/utils/storage';
  54. import {
  55. getNoticeList ,// 通知公告列表
  56. getNoticeReadData //指令未读的数量
  57. } from '@/api/notice';
  58. import { getMenusByUser } from '@/api/login';
  59. import config from '@/config'
  60. const baseUrlImg=config.baseUrlImg
  61. export default {
  62. data() {
  63. return {
  64. urls:baseUrlImg,
  65. roles: this.$store.state.user.roles,
  66. current: 0,
  67. swiperDotIndex: 0,
  68. worktop:`${baseUrlImg}/working/worktop.png`, //图片
  69. zhudongjiancha: `${baseUrlImg}/working/zhudongjiancha.png`,
  70. yinhuanguanli: `${baseUrlImg}/working/yinhuanguanli.png`,
  71. user_business: `${baseUrlImg}/working/user_business.png`,
  72. tabler_clock_edit: `${baseUrlImg}/working/tabler_clock_edit.png`,
  73. tabler_chart_histogram: `${baseUrlImg}/working/tabler_chart_histogram.png`,
  74. outline_trumpet: `${baseUrlImg}/working/outline_trumpet.png`,
  75. outline_permissions: `${baseUrlImg}/working/outline_permissions.png`,
  76. meirixuncha: `${baseUrlImg}/working/big1.png`,
  77. fire_extinguishe: `${baseUrlImg}/working/weixingxiaofang.png`,
  78. unit_info: `${baseUrlImg}/working/danweixinxi.png`,
  79. zhilin: `${baseUrlImg}/working/zhilin.png`,
  80. unit_arc: `${baseUrlImg}/working/danweijianzhu.png`,
  81. xiaofangsheshi: `${baseUrlImg}/working/xiaofangsheshi.png`,
  82. renyuan: `${baseUrlImg}/working/renyuan.png`,
  83. drill: `${baseUrlImg}/working/drill.png`,
  84. archive: `${baseUrlImg}/working/gongzuodangan.png`,
  85. items: ['事件中心', '管理中心'],
  86. current: 0,
  87. urlList: [],
  88. urlList1: [],
  89. unread:0,//未读数量
  90. urlList2:[]
  91. };
  92. },
  93. onLoad() {
  94. this.getMenu();
  95. },
  96. onShow() {
  97. this.getData()
  98. },
  99. methods: {
  100. getData(){
  101. getNoticeReadData({userId:this.$store.state.user.id}).then(response=>{
  102. this.unread=response.data
  103. console.log(this.unread,'this.unread');
  104. })
  105. },
  106. getMenu() {
  107. console.log('this.$store.state.user.id: ', this.$store.state.user.id);
  108. getMenusByUser({
  109. id: this.$store.state.user.id
  110. }).then(response => {
  111. console.log(response.data,'dddd');
  112. this.urlList = response.data.sort((a, b) => a.menuSort - b.menuSort).splice(12);
  113. this.urlList1 = response.data.sort((a, b) => a.menuSort - b.menuSort).splice(0,12)
  114. this.urlList2 = this.urlList.splice(this.urlList.length-2,2)
  115. console.log(this.urlList2,'asdbj');
  116. });
  117. },
  118. urlIconTran(val) {
  119. if (val == 'outline_permissions') {
  120. return this.outline_permissions;
  121. } else if (val == 'meirixuncha') {
  122. return this.meirixuncha;
  123. } else if (val == 'zhudongjiancha') {
  124. return this.zhudongjiancha;
  125. } else if(val=='check_inspection'){
  126. return this.zhudongjiancha;
  127. }else if(val=='yinhuanfucha'){
  128. return this.yinhuanguanli
  129. }else if (val == 'tabler_clock_edit') {
  130. return this.tabler_clock_edit;
  131. } else if (val == 'outline_trumpet') {
  132. return this.outline_trumpet;
  133. } else if (val == 'outline_trumpet') {
  134. return this.outline_trumpet;
  135. } else if (val == 'yinhuanguanli') {
  136. return this.yinhuanguanli;
  137. } else if (val == 'user_business') {
  138. return this.user_business;
  139. } else if (val == 'fire_extinguishe') {
  140. return this.fire_extinguishe;
  141. } else if (val == 'unit_info') {
  142. return this.unit_info;
  143. } else if (val == 'unit_arc') {
  144. return this.unit_arc;
  145. } else if (val == 'drill') {
  146. return this.drill;
  147. } else if (val == 'xiaofangsheshi') {
  148. return this.xiaofangsheshi;
  149. } else if (val == 'archive') {
  150. return this.archive;
  151. } else if (val == 'renyuan') {
  152. return this.renyuan;
  153. } else if (val == 'tabler_chart_histogram') {
  154. return this.tabler_chart_histogram;
  155. } else if (val == 'zhilin') {
  156. return this.zhilin;
  157. }else if (val == 'zlgztzs_icon') {
  158. return this.renyuan
  159. }else if(val=='fire_inspetItem'){
  160. return this.archive;
  161. }
  162. },
  163. // 顶部个人信息跳转
  164. onClick() {
  165. uni.switchTab({
  166. url: '/pages/mine/index'
  167. });
  168. },
  169. changeGrid(e){
  170. },
  171. // 根据不同的url,进行页面的跳转
  172. handleToInfo(url,name) {
  173. this.$tab.navigateTo(url);
  174. console.log(this.$store, this.$store.state.user, this.$store.getters,'sdddddddddddd',url);
  175. },
  176. // 分段器点击 事件中心、管理中心转换
  177. onClickItem(e) {
  178. if (this.current != e.currentIndex) {
  179. this.current = e.currentIndex;
  180. }
  181. }
  182. }
  183. };
  184. </script>
  185. <style lang="scss" scoped>
  186. /* #ifndef APP-NVUE */
  187. page {
  188. display: flex;
  189. flex-direction: column;
  190. box-sizing: border-box;
  191. min-height: 100%;
  192. height: auto;
  193. }
  194. .tubiao {
  195. width: 142upx;
  196. height: 142upx;
  197. }
  198. view {
  199. font-size: 14px;
  200. line-height: inherit;
  201. }
  202. .tabIcon {
  203. color: white;
  204. }
  205. /* #endif */
  206. .text {
  207. text-align: center;
  208. color: #000;
  209. font-size: 26rpx;
  210. margin-top: -18upx;
  211. // margin-top: 10rpx;
  212. }
  213. .grid-item-box {
  214. position: relative;
  215. flex: 1;
  216. /* #ifndef APP-NVUE */
  217. display: flex;
  218. /* #endif */
  219. flex-direction: column;
  220. align-items: center;
  221. justify-content: center;
  222. padding: 15px 0;
  223. }
  224. // 按钮样式
  225. button {
  226. width: 132rpx;
  227. height: 52rpx;
  228. border-radius: 50rpx;
  229. background-color: #f7d1dc;
  230. border-color: #d51a52;
  231. color: #d51a52;
  232. font-size: 25rpx;
  233. border: 3rpx solid;
  234. font-weight: bold;
  235. padding: 0;
  236. margin-left: 70rpx;
  237. }
  238. ::v-deep .u-navbar__content {
  239. // background-color: #4cb2b6 !important;
  240. }
  241. .container {
  242. height: 140vh;
  243. // height: 100vh;
  244. background-color: #fff;
  245. }
  246. // 修改分段器默认样式
  247. ::v-deep .segmented-control {
  248. border-bottom: 1px solid #e5e5e5;
  249. }
  250. ::v-deep .segmented-control__text {
  251. color: #4cb2b6 !important;
  252. }
  253. ::v-deep .segmented-control__text span {
  254. color: #3d3d3d !important;
  255. }
  256. ::v-deep .segmented-control__item--text {
  257. padding: 8px 0;
  258. }
  259. //徽标
  260. // /deep/.u-page__tag-item {
  261. // margin-right: 40px;
  262. // margin-top: 0 !important;
  263. // }
  264. /deep/.u-badge[data-v-662d25bf] {
  265. }
  266. .huibiao,
  267. /deep/.u-badge--error.data-v-662d25bf,/deep/.u-badge--error{
  268. position: absolute;
  269. right: 56rpx;
  270. top: 46rpx;
  271. }
  272. </style>