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 = { 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', baseApi:process.env.NODE_ENV === 'development' ? '/admin-api' : '/api/admin-api',
// 应用信息 // 应用信息
appInfo: { appInfo: {

41
pages/index.vue

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

Loading…
Cancel
Save