|
|
@ -97,11 +97,14 @@ |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
import { my, editProvinceCity } from '@/apis/modules/parner.js' |
|
|
|
import { my, editProvinceCity } from '@/apis/modules/parner.js' |
|
|
|
import { queryProvince, queryCity, updateAvatars } from '@/apis/modules/user.js' |
|
|
|
import { queryProvince, queryCity, updateAvatars, getUserRolesPermissionMenu } from '@/apis/modules/user.js' |
|
|
|
|
|
|
|
import { getTeamsByAccountId } from '@/apis/modules/client.js' |
|
|
|
export default { |
|
|
|
export default { |
|
|
|
data() { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
return { |
|
|
|
per: true, // 是否有权限 |
|
|
|
per: true, // 是否有权限 |
|
|
|
|
|
|
|
teamId: uni.getStorageSync('teamId') || '', |
|
|
|
|
|
|
|
teams: [], |
|
|
|
my: { |
|
|
|
my: { |
|
|
|
info: { |
|
|
|
info: { |
|
|
|
phone: '' |
|
|
|
phone: '' |
|
|
@ -115,7 +118,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png', |
|
|
|
avatar: uni.getStorageSync('avatar') || '@/static/image/avatar.png', |
|
|
|
userName: uni.getStorageSync('userName'), |
|
|
|
userName: uni.getStorageSync('userName'), |
|
|
|
hasOwnTeam: uni.getStorageSync('hasOwnTeam') == 1, // 有自己的团队 |
|
|
|
hasOwnTeam: 0, // 有自己的团队 |
|
|
|
disabled: true, |
|
|
|
disabled: true, |
|
|
|
provinces: [], |
|
|
|
provinces: [], |
|
|
|
cities: [], |
|
|
|
cities: [], |
|
|
@ -137,8 +140,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
onShow() { |
|
|
|
this.per = true |
|
|
|
this.per = true |
|
|
|
this.initRole() |
|
|
|
this.getTeam() |
|
|
|
this.disabled = uni.getStorageSync('team').isTeam == 0 // 成员不能改省份城市 |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
methods: { |
|
|
|
// 初始化权限 |
|
|
|
// 初始化权限 |
|
|
@ -149,6 +151,80 @@ |
|
|
|
this.getInfo() |
|
|
|
this.getInfo() |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 查询当前角色权限 |
|
|
|
|
|
|
|
getAuth() { |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
|
|
title: '加载中' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
getUserRolesPermissionMenu({ |
|
|
|
|
|
|
|
teamId: this.teams.find(e => e.teamId == this.teamId).partnerClassificationId, |
|
|
|
|
|
|
|
platformId: 4 |
|
|
|
|
|
|
|
}).then(({ permissionMenu }) => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
const auth = [] |
|
|
|
|
|
|
|
// 生成权限数组 |
|
|
|
|
|
|
|
const generateAuth = (list, parent) => { |
|
|
|
|
|
|
|
list.map(e => { |
|
|
|
|
|
|
|
const name = `${parent ? parent + ':' : ''}${e.name}` |
|
|
|
|
|
|
|
auth.push(name) |
|
|
|
|
|
|
|
generateAuth(e.children, name) |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
generateAuth(permissionMenu[0].children, '') |
|
|
|
|
|
|
|
uni.setStorageSync('auth', auth) |
|
|
|
|
|
|
|
this.initRole() |
|
|
|
|
|
|
|
}).catch(e => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
uni.setStorageSync('auth', []) |
|
|
|
|
|
|
|
this.initRole() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
// 获取团队 |
|
|
|
|
|
|
|
getTeam() { |
|
|
|
|
|
|
|
uni.showLoading({ |
|
|
|
|
|
|
|
title: '加载中' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
getTeamsByAccountId().then(({ data }) => { |
|
|
|
|
|
|
|
let hasOwnTeam = 0 // 是否有自己的团队 |
|
|
|
|
|
|
|
data.map(e => { |
|
|
|
|
|
|
|
const n = e.partnerClassificationList |
|
|
|
|
|
|
|
e.id = n.id |
|
|
|
|
|
|
|
// parnerId是商务经理id,teamId则是下面这个,其他地方要用的话直接uni.getStorageSync('team').partnerId去使用 |
|
|
|
|
|
|
|
e.teamId = e.isTeam == 1 ? +e.partnerClassificationId : n.id |
|
|
|
|
|
|
|
e.partnerClassificationName = n.partnerClassificationName |
|
|
|
|
|
|
|
delete e.partnerClassificationList |
|
|
|
|
|
|
|
if (e.isTeam == 1) hasOwnTeam = 1 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
this.hasOwnTeam = hasOwnTeam |
|
|
|
|
|
|
|
const teamId = uni.getStorageSync('teamId') |
|
|
|
|
|
|
|
if (data.length) { |
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* @description 如果是第一次进,则默认选中第一个团队,并把该团队的信息存入缓存 |
|
|
|
|
|
|
|
* 或者团队列表里没有该id,则说明超管已经被转让,也需要重新选中团队 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
const curTeam = data.find(e => e.teamId == teamId) |
|
|
|
|
|
|
|
if (teamId && curTeam) { |
|
|
|
|
|
|
|
uni.setStorageSync('team', curTeam) |
|
|
|
|
|
|
|
} else if (!uni.getStorageSync('team') || !curTeam) { |
|
|
|
|
|
|
|
this.teamId = data[0].teamId |
|
|
|
|
|
|
|
uni.setStorageSync('teamId', data[0].teamId) |
|
|
|
|
|
|
|
uni.setStorageSync('team', data[0]) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 如果没有团队,则退出登录 |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
uni.clearStorageSync() |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
|
|
|
|
url: '../login/login' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.disabled = uni.getStorageSync('team').isTeam == 0 // 成员不能改省份城市 |
|
|
|
|
|
|
|
this.teams = data |
|
|
|
|
|
|
|
this.getAuth() |
|
|
|
|
|
|
|
}).catch(e => { |
|
|
|
|
|
|
|
uni.hideLoading() |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
// 获取个人信息 |
|
|
|
// 获取个人信息 |
|
|
|
getInfo() { |
|
|
|
getInfo() { |
|
|
|
const { partnerId, teamId } = uni.getStorageSync('team') |
|
|
|
const { partnerId, teamId } = uni.getStorageSync('team') |
|
|
@ -187,7 +263,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 创建自己的团队 |
|
|
|
// 创建自己的团队 |
|
|
|
createTeam() { |
|
|
|
createTeam() { |
|
|
|
this.$util.to(`../reg/reg?openid=${uni.getStorageSync('openid')}&phone=${this.my.info.phone}`) |
|
|
|
this.$util.to(`../reg/reg?openid=${uni.getStorageSync('openid')}&phone=${this.my.info.phone}&my=1`) |
|
|
|
}, |
|
|
|
}, |
|
|
|
// 进入设置 |
|
|
|
// 进入设置 |
|
|
|
toSet() { |
|
|
|
toSet() { |
|
|
|