|
|
@ -5,9 +5,16 @@ |
|
|
|
<view class="flex flex-col"> |
|
|
|
<view class="mb-1">用户以什么角色加入项目</view> |
|
|
|
<!-- 下拉多选 --> |
|
|
|
<u-dropdown> |
|
|
|
<u-dropdown-item v-model="roleValue" :title="roleValue" :options="allRoles" @change="changeRole"></u-dropdown-item> |
|
|
|
</u-dropdown> |
|
|
|
<view class="uni-list"> |
|
|
|
<view class="uni-list-cell"> |
|
|
|
<view class="uni-list-cell-db ml-2" v-if="rolesArray.length"> |
|
|
|
<picker @change="changeRole" :value="index" :range="rolesArray"> |
|
|
|
<view class="uni-input">{{ allRolesName[index].name }}</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<!-- 复制链接 --> |
|
|
|
<view class="link flex items-center mt-4"> |
|
|
|
<view class="link-url">{{ links }}</view> |
|
|
@ -22,7 +29,6 @@ |
|
|
|
复制链接 |
|
|
|
</u-button> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view @click="select"> |
|
|
|
<!-- 全选按钮 --> |
|
|
|
<!-- <view class="flex mt-4"> |
|
|
@ -59,8 +65,10 @@ import { mapGetters, mapState } from 'vuex'; |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
roleValue: '观众', |
|
|
|
links: 'https://kdocs.cn/l/cbs', //复制的链接 |
|
|
|
rolesArray: [], |
|
|
|
allRolesName: [], |
|
|
|
index: 0, |
|
|
|
links: '', //复制的链接 |
|
|
|
checked: false, //全选按钮是否选中 |
|
|
|
// 多选框列表 |
|
|
|
list: [ |
|
|
@ -97,45 +105,44 @@ export default { |
|
|
|
computed: { |
|
|
|
...mapState('role', ['visibleRoles', 'invisibleRoles']), |
|
|
|
...mapGetters('project', ['projectId']), |
|
|
|
|
|
|
|
allRoles() { |
|
|
|
let newArr = []; |
|
|
|
if (this.visibleRoles.length || this.invisibleRoles.length) { |
|
|
|
const arr = this.visibleRoles.concat(this.invisibleRoles); |
|
|
|
arr.forEach(role => { |
|
|
|
let item = { value: '', label: '' }; |
|
|
|
item.id = role.id; |
|
|
|
item.value = role.name; |
|
|
|
item.label = role.name; |
|
|
|
newArr.push(item); |
|
|
|
}); |
|
|
|
const firstItem = { id: '0', value: '观众', label: '观众' }; |
|
|
|
newArr.unshift(firstItem); |
|
|
|
} |
|
|
|
return newArr; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
async created() { |
|
|
|
this.path = window.location.href.split('?')[0]; |
|
|
|
const { path, projectId } = this; |
|
|
|
const params = { path: `${path}share=1`, projectId, roleId: '0' }; |
|
|
|
await this.creatShare(params); |
|
|
|
mounted() { |
|
|
|
this.$nextTick(() => { |
|
|
|
this.path = window.location.href.split('?')[0]; |
|
|
|
const { path, projectId } = this; |
|
|
|
const params = { path: `${path}`, projectId, roleId: '0' }; |
|
|
|
this.creatShare(params); |
|
|
|
}); |
|
|
|
|
|
|
|
if (this.visibleRoles.length || this.invisibleRoles.length) { |
|
|
|
const arr = this.visibleRoles.concat(this.invisibleRoles); |
|
|
|
arr.forEach(role => { |
|
|
|
let item = { id: '', name: '' }; |
|
|
|
item.id = role.id; |
|
|
|
item.name = role.name; |
|
|
|
this.allRolesName.push(item); |
|
|
|
this.rolesArray.push(role.name); |
|
|
|
}); |
|
|
|
const firstItem = { id: '0', name: '观众' }; |
|
|
|
this.allRolesName.unshift(firstItem); |
|
|
|
this.rolesArray.unshift('观众'); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
// 选择角色 |
|
|
|
async changeRole(value) { |
|
|
|
this.roleValue = value; |
|
|
|
const role = this.allRoles.find(item => item.value == value); |
|
|
|
async changeRole(e) { |
|
|
|
this.index = e.target.value; |
|
|
|
const { path, projectId } = this; |
|
|
|
const params = { path, projectId, roleId: role.id }; |
|
|
|
const params = { path, projectId, roleId: this.allRolesName[this.index].id }; |
|
|
|
await this.creatShare(params); |
|
|
|
}, |
|
|
|
|
|
|
|
// 复制成功 |
|
|
|
copySuccess() { |
|
|
|
this.$t.ui.showToast('复制成功'); |
|
|
|
console.log('this.links: ', this.links); |
|
|
|
}, |
|
|
|
// 复制失败 |
|
|
|
copyError() { |
|
|
|