index.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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.urlList,'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. }else if(val=='fireWork'){
  162. return this.archive;
  163. }else if(val=='fireSpecial'){
  164. return this.archive;
  165. }
  166. },
  167. // 顶部个人信息跳转
  168. onClick() {
  169. uni.switchTab({
  170. url: '/pages/mine/index'
  171. });
  172. },
  173. changeGrid(e){
  174. },
  175. // 根据不同的url,进行页面的跳转
  176. handleToInfo(url,name) {
  177. this.$tab.navigateTo(url);
  178. console.log(this.$store, this.$store.state.user, this.$store.getters,'sdddddddddddd',url);
  179. },
  180. // 分段器点击 事件中心、管理中心转换
  181. onClickItem(e) {
  182. if (this.current != e.currentIndex) {
  183. this.current = e.currentIndex;
  184. }
  185. }
  186. }
  187. };
  188. </script>
  189. <style lang="scss" scoped>
  190. /* #ifndef APP-NVUE */
  191. page {
  192. display: flex;
  193. flex-direction: column;
  194. box-sizing: border-box;
  195. min-height: 100%;
  196. height: auto;
  197. }
  198. .tubiao {
  199. width: 142upx;
  200. height: 142upx;
  201. }
  202. view {
  203. font-size: 14px;
  204. line-height: inherit;
  205. }
  206. .tabIcon {
  207. color: white;
  208. }
  209. /* #endif */
  210. .text {
  211. text-align: center;
  212. color: #000;
  213. font-size: 26rpx;
  214. margin-top: -18upx;
  215. // margin-top: 10rpx;
  216. }
  217. .grid-item-box {
  218. position: relative;
  219. flex: 1;
  220. /* #ifndef APP-NVUE */
  221. display: flex;
  222. /* #endif */
  223. flex-direction: column;
  224. align-items: center;
  225. justify-content: center;
  226. padding: 15px 0;
  227. }
  228. // 按钮样式
  229. button {
  230. width: 132rpx;
  231. height: 52rpx;
  232. border-radius: 50rpx;
  233. background-color: #f7d1dc;
  234. border-color: #d51a52;
  235. color: #d51a52;
  236. font-size: 25rpx;
  237. border: 3rpx solid;
  238. font-weight: bold;
  239. padding: 0;
  240. margin-left: 70rpx;
  241. }
  242. ::v-deep .u-navbar__content {
  243. // background-color: #4cb2b6 !important;
  244. }
  245. .container {
  246. height: 140vh;
  247. // height: 100vh;
  248. background-color: #fff;
  249. }
  250. // 修改分段器默认样式
  251. ::v-deep .segmented-control {
  252. border-bottom: 1px solid #e5e5e5;
  253. }
  254. ::v-deep .segmented-control__text {
  255. color: #4cb2b6 !important;
  256. }
  257. ::v-deep .segmented-control__text span {
  258. color: #3d3d3d !important;
  259. }
  260. ::v-deep .segmented-control__item--text {
  261. padding: 8px 0;
  262. }
  263. //徽标
  264. // /deep/.u-page__tag-item {
  265. // margin-right: 40px;
  266. // margin-top: 0 !important;
  267. // }
  268. /deep/.u-badge[data-v-662d25bf] {
  269. }
  270. .huibiao,
  271. /deep/.u-badge--error.data-v-662d25bf,/deep/.u-badge--error{
  272. position: absolute;
  273. right: 56rpx;
  274. top: 46rpx;
  275. }
  276. </style>