Browse Source

Merge branch 'master' of ssh://101.201.226.163:50022/binbin0314/datang-admin

master
song 3 years ago
parent
commit
c46628a8ea
  1. 13
      src/components/Banner/index.vue
  2. 2
      src/components/News/contentRelation.vue
  3. 2
      src/components/News/detailContent.vue
  4. 3
      src/components/News/index.vue
  5. 1
      src/components/News/search.vue
  6. 10
      src/store/modules/user.js
  7. 46
      src/views/layout/Layout.vue
  8. 8
      src/views/privilegeManagement/account/index.vue
  9. 4
      src/views/privilegeManagement/role/index.vue
  10. 2
      src/views/privilegeManagement/role/permissions.vue

13
src/components/Banner/index.vue

@ -5,6 +5,7 @@
icon="el-icon-plus"
style="margin-bottom: 15px;"
@click="addModal"
v-if="$store.state.user.showBtnList.add"
>
添加
</el-button>
@ -59,10 +60,12 @@
icon="el-icon-edit"
style="margin-right: 15px;"
@click="editModal(lists.row)"
size="mini">
size="mini"
v-if="$store.state.user.showBtnList.update"
>
编辑
</el-button>
<el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteItem(lists.row.id)">删除</el-button>
<el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteItem(lists.row.id)" v-if="$store.state.user.showBtnList.delete">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -118,13 +121,19 @@
pageSize: 10,
pageNum: 1,
showAdd: true,
perList: [],
}
},
components: {
AddOrEdit,
},
created() {
this.perList = this.$store.state.user.perList;
console.log('this.perList: ', this.perList);
},
methods: {
/**
* 获取轮播图列表
*/

2
src/components/News/contentRelation.vue

@ -24,7 +24,7 @@
label="操作"
>
<template slot-scope="relations">
<el-button type="danger" plain size="mini" @click="deleteItem(relations.row)">删除</el-button>
<el-button type="danger" plain size="mini" @click="deleteItem(relations.row)" v-if="$store.state.user.showBtnList.delete">删除</el-button>
</template>
</el-table-column>
</el-table>

2
src/components/News/detailContent.vue

@ -18,7 +18,7 @@
<!-- 关联文章信息 -->
<div>
<span class="font-bold">相关新闻 </span>
<el-button type="primary" plain size="mini" class="mt-2 ml-4" @click="addRelationNews">添加相关新闻</el-button>
<el-button v-if="$store.state.user.showBtnList.add" type="primary" plain size="mini" class="mt-2 ml-4" @click="addRelationNews">添加相关新闻</el-button>
<div v-if="detailContent && detailContent.relations && detailContent.relations.length" class="flex flex-column px-10">
<content-relation class="px-10" :introId="list.introId" :relations="detailContent.relations" />
</div>

3
src/components/News/index.vue

@ -83,10 +83,11 @@
icon="el-icon-edit"
style="margin-right: 15px;"
@click="editModal(lists.row)"
v-if="$store.state.user.showBtnList.update"
size="mini">
编辑
</el-button>
<el-button type="danger" icon="el-icon-delete" size="mini" @click="deleteItem(lists.row.introId)">删除</el-button>
<el-button type="danger" v-if="$store.state.user.showBtnList.delete" icon="el-icon-delete" size="mini" @click="deleteItem(lists.row.introId)">删除</el-button>
</template>
</el-table-column>
</el-table>

1
src/components/News/search.vue

@ -54,6 +54,7 @@
icon="el-icon-plus"
class="mb-4"
@click="$emit('addModal')"
v-if="$store.state.user.showBtnList.add"
>
添加
</el-button>

10
src/store/modules/user.js

@ -15,6 +15,13 @@ const user = {
articlePlatform: []
},
perList: [],
showBtnList: {
add: false,
update: false,
delete: false,
relation: false,
reset: false,
},
},
mutations: {
@ -44,6 +51,9 @@ const user = {
},
SET_PER_LIST: (state, perList) => {
state.perList = perList
},
setShowBtnList: (state, data) => {
state.showBtnList = {...data}
}
},

46
src/views/layout/Layout.vue

@ -11,7 +11,7 @@
<script>
import { Navbar, Sidebar, AppMain, TagsView } from './components'
// import { GET_ALL_HAVE } from '@/api/jurisdiction'
import { GET_ALL_HAVE } from '@/api/jurisdiction'
import ResizeMixin from './mixin/ResizeHandler'
import { mapMutations } from 'vuex'
@ -24,6 +24,11 @@ export default {
TagsView
},
mixins: [ResizeMixin],
watch: {
'$route.path'() {
this.showBtn()
}
},
computed: {
sidebar() {
return this.$store.state.app.sidebar
@ -40,17 +45,44 @@ export default {
}
}
},
created() {
this.getPerList()
},
methods: {
...mapMutations(['SET_PER_LIST']),
...mapMutations(['SET_PER_LIST','setShowBtnList']),
handleClickOutside() {
this.$store.dispatch('closeSideBar', { withoutAnimation: false })
},
// getPerList() {
// GET_ALL_HAVE({}).then(res => {
// console.log(res)
// })
// }
getPerList() {
GET_ALL_HAVE({}).then(res => {
let list = []
for(let i = 0; i < res.data.length; i++) {
const item = res.data[i].split('/')
list[i] = item
}
this.SET_PER_LIST(list)
this.showBtn()
})
},
//
showBtn() {
const perList = [...this.$store.state.user.perList];
const code = localStorage.getItem('code');
let list = {
add: false,
update: false,
delete: false,
relation: false,
reset: false,
}
for(var i = 0; i < perList.length; i++) {
if(perList[i][1] === code) {
list[perList[i][2]] = true;
}
}
this.setShowBtnList(list)
},
}
}
</script>

8
src/views/privilegeManagement/account/index.vue

@ -4,7 +4,7 @@
<div class="table">
<el-row>
<router-link :to="`/privilegeManagement/account/opiModel`">
<el-button type="primary">
<el-button type="primary" v-if="$store.state.user.showBtnList.add" >
新增账户
</el-button>
</router-link>
@ -56,9 +56,9 @@
</el-table-column>npm i element-ui -S
<el-table-column fixed="right" label="操作" align="center" width="290">
<template slot-scope="lists">
<el-button icon="el-icon-edit" size="mini" type="primary" @click="showEidt(lists.row)">编辑</el-button>
<el-button icon="el-icon-refresh" size="mini" type="warning" @click="open(lists.row.userId,0)">重置密码</el-button>
<el-button icon="el-icon-delete" size="mini" type="danger" @click="open(lists.row.userId,1)">删除</el-button>
<el-button icon="el-icon-edit" size="mini" type="primary" @click="showEidt(lists.row)" v-if="$store.state.user.showBtnList.update" >编辑</el-button>
<el-button icon="el-icon-refresh" size="mini" type="warning" @click="open(lists.row.userId,0)" v-if="$store.state.user.showBtnList.reset">重置密码</el-button>
<el-button icon="el-icon-delete" size="mini" type="danger" @click="open(lists.row.userId,1)" v-if="$store.state.user.showBtnList.delete">删除</el-button>
</template>
</el-table-column>
</el-table>

4
src/views/privilegeManagement/role/index.vue

@ -6,7 +6,7 @@
<el-col :span="4" :xs="6" :md="5">
<div class="grid-content bg-purple">
<router-link :to="`/privilegeManagement/role/permissions?add=true`">
<el-button type="primary">
<el-button type="primary" v-if="$store.state.user.showBtnList.add">
新增角色
</el-button>
</router-link>
@ -23,7 +23,7 @@
label="操作"
>
<template slot-scope="lists">
<span :class="{'select':lists.row.isSel}" type="text" size="small" class="option-span" @click="removeItem(lists.row.roleId)">
<span v-if="$store.state.user.showBtnList.delete" :class="{'select':lists.row.isSel}" type="text" size="small" class="option-span" @click="removeItem(lists.row.roleId)">
删除
</span>
</template>

2
src/views/privilegeManagement/role/permissions.vue

@ -12,7 +12,7 @@
<div class="detail">
<span style="font-weight: bold;">{{title}}</span>
<div style="text-align: right;display: inline-block">
<el-button v-show="!add" @click="editPermission">编辑</el-button>
<el-button v-show="!add" @click="editPermission" v-if="$store.state.user.showBtnList.update">编辑</el-button>
</div>
</div>
<div v-if="!add" style="position: relative;">

Loading…
Cancel
Save