Skip to content
This repository has been archived by the owner on Nov 15, 2018. It is now read-only.

Commit

Permalink
feat: ( #324 ) 新增圈子发帖权限设置
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonleex committed Jan 4, 2018
1 parent 5053606 commit 82226a3
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/page/group/children/groupDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
<div class="menu-item-title">圈子收益</div>
<v-icon class='menu-item-append' type='base-arrow-r'></v-icon>
</div>
<div class="menu-item">
<div class="menu-item" @click='to(`/group/${groupID}/permissions`)'>
<v-icon class='menu-item-prepend' type='group-permissions'></v-icon>
<div class="menu-item-title">发帖权限</div>
<v-icon class='menu-item-append' type='base-arrow-r'></v-icon>
Expand Down
2 changes: 1 addition & 1 deletion src/page/group/children/groupMember.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {
data() {
return {
groupID: this.$route.params.groupID,
rule: this.$route.params.rule,
rule: this.$route.params.rule || 'member',
members: [],
manager: [],
blacklist: [],
Expand Down
89 changes: 89 additions & 0 deletions src/page/group/children/groupPermissions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<template>
<div class="group-permissions">
<head-top :go-back='true' title='发帖权限设置'></head-top>
<div class="group-permissions-list">
<div class="group-permissions-list-item" v-for='option in options' @click='postData(option.val)'>
<span>{{ option.label }}</span>
<v-icon type='base-checked' width='.32' height='.32' color='#70b0ad' v-if='curSelect === option.val'></v-icon>
</div>
</div>
</div>
</template>
<script>
import HeadTop from '@/components/HeadTop'
export default {
name: 'groupPermissions',
components: {
HeadTop
},
data() {
return {
options: [{
label: '所有成员',
val: 3
}, {
label: '仅圈主',
val: 1
}, {
label: '仅圈主和管理员',
val: 2
}],
curSelect: 3
}
},
methods: {
async postData(val) {
// PATCH /groups/:group/permissions
let params
switch (val) {
case 3:
params = ['member', 'administrator', 'founder']
break
case 1:
params = ['founder']
break
case 2:
params = ['administrator', 'founder']
break
}
const { status } = await this.$http.patch(`/plus-group/groups/${this.$route.params.groupID}/permissions`, {
permissions: params
})
status === 204 && (this.curSelect = val)
},
async initData() {
const {
data: {
permissions
}
} = await this.$http.get(`/plus-group/groups/${this.$route.params.groupID}`)
this.curSelect = permissions.split(',').length
}
},
mounted() {
this.initData()
}
}
</script>
<style lang='less'>
.group-permissions {
&-list {
&-item {
padding: 0 20px;
height: 100px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 30px;
color: #333;
background-color: #fff;
border-bottom: 1px solid #ededed;
/*no*/
}
}
}
</style>
2 changes: 1 addition & 1 deletion src/page/group/components/groupMemberItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default {
props: {
user: Object,
groupID: {
type: Number,
type: [Number, String],
default () {
return this.$route.params.groupID
}
Expand Down
11 changes: 10 additions & 1 deletion src/routers/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const
import(/* webpackChunkName: 'group' */ '../page/group/children/groupDetail'),
groupMember = () =>
import(/* webpackChunkName: 'group' */ '../page/group/children/groupMember'),
groupPermissions = () =>
import(/* webpackChunkName: 'group' */ '../page/group/children/groupPermissions'),


question = () =>
Expand Down Expand Up @@ -150,11 +152,18 @@ const router = [{
meta: { title: '圈子详情', keepAlive: true, requiresAuth: true }
}, {
name: 'groupMember',
path: '/group/member',
path: '/group/:groupID/member',
component: groupMember,
meta: {
title: '成员管理'
}
}, {
name: 'groupPermissions',
path: '/group/:groupID/permissions',
component: groupPermissions,
meta: {
title: '发帖权限'
}
}, {
path: '/group/all',
component: groupAll,
Expand Down

0 comments on commit 82226a3

Please sign in to comment.