import * as config from '../config' const rolesList = [] const getListByUserId = function() { let baseUrlNew = config.def().baseUrlNew var userInfo = uni.getStorageSync("userInfo") console.log("------",userInfo) if(userInfo){ uni.request({ url: baseUrlNew + '/roleMenu/query/getListByUserId', data: { userId: userInfo.id?userInfo.id:userInfo.data.id }, method: 'GET', success: (res) => { if (res.statusCode === 200) { uni.setStorageSync("jurisdiction", res.data.data) let list = getUserAllRoles(res.data.data); uni.setStorageSync("rolesList", list) } } }) } } const getUserAllRoles = (item) => { console.log(item) for (let i = 0; i < item.length; i++) { rolesList.push(item[i].name) // console.log('用户权限',rolesList) if (item[i].children && item[i].children.length > 0) { getUserAllRoles(item[i].children) } } return rolesList; } const setAudit = (item) => { let _list = uni.getStorageSync("copyTaskInfo") let _isShowbtn = true if (_list.length == 0) { _isShowbtn = false } for (let i = 0; i < _list.length; i++) { if (_list[i].businessId == item.id) { _list.splice(i, 1) uni.setStorageSync("copyTaskInfo", _list) } } if (_list.length > 0) { uni.navigateTo({ url: _list[0].itemUrl + '&isShowbtn=' + _isShowbtn, }) } console.log(item) } export default { getListByUserId, setAudit }