Browse Source

首页按钮权限控制

master
zhang_li 9 months ago
parent
commit
33812d878e
  1. 2
      config.js
  2. 41
      pages/index.vue

2
config.js

@ -1,6 +1,6 @@
// 应用全局配置
module.exports = {
baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.1.18:12080' : 'http://dev.ccwin-in.com:12080/api',
baseUrl: process.env.NODE_ENV === 'development' ? 'http://192.168.0.172:12080' : 'http://dev.ccwin-in.com:12080/api',
baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api',
// 应用信息
appInfo: {

41
pages/index.vue

@ -35,19 +35,20 @@
<view class="">
<view class="title">采购入库</view>
<u-row gutter="16" style="padding:0px 20rpx ;">
<u-col span="3">
<view class="icon-item" @click="open('/pages/inLocation/index')">
<image src="../static/images/icon1.png" mode=""></image>
<view>采购入库</view>
</view>
</u-col>
<u-col span="3">
<view class="icon-item" @click="open('/pages/sparePartsReturn/addForm')">
<image src="../static/images/icon3.png" mode=""></image>
<view>备件归还</view>
</view>
</u-col>
<block v-for="(item,index) in menus" :key="index" >
<u-col span="3" v-if="item.path == 'purchaseIn'">
<view class="icon-item" @click="open('/pages/inLocation/index')">
<image src="../static/images/icon1.png" mode=""></image>
<view>{{item.name}}</view>
</view>
</u-col>
<u-col span="3" v-else-if="item.path == 'itemIn'">
<view class="icon-item" @click="open('/pages/sparePartsReturn/addForm')">
<image src="../static/images/icon3.png" mode=""></image>
<view>{{item.name}}</view>
</view>
</u-col>
</block>
</u-row>
</view>
@ -55,12 +56,14 @@
<view class="">
<view class="title">出库</view>
<u-row gutter="16">
<u-col span="3">
<block v-for="(item,index) in menus" :key="index" >
<u-col span="3" v-if="item.path == 'itemOut'">
<view class="icon-item" @click="open('/pages/outLocation/index')">
<image src="../static/images/icon2.png" mode=""></image>
<view>领用出库</view>
<view>{{item.name}}</view>
</view>
</u-col>
</block>
</u-row>
</view>
</view>
@ -85,6 +88,7 @@
return {
bgOpacity: 0,
token: '',
menus:[]
}
},
@ -113,6 +117,13 @@
// }
this.token = getAccessToken() ? getAccessToken() :''
console.log( this.$store.state)
if (getAccessToken()) {
this.$store.dispatch('GetPermissionInfo').then(res => {
this.menus = res.menus.filter(item=>item.path == '/pda')[0].children
console.log(this.menus)
})
}
},
onPageScroll(e) {
if (e.scrollTop > 0) {

Loading…
Cancel
Save