index.vue 8.8 KB

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