| | |
| | | import common from '@/static/js/common.js' |
| | | |
| | | async function getDetail() { |
| | | let _this = this,item = []; |
| | | let ress = await uni.request({ |
| | | url: `${common.baseUrl}/user/detail/auth`, |
| | | header:{'token':uni.getStorageSync('token')}, |
| | | }).then((res)=> { |
| | | res = res[1].data |
| | | // console.log(res); |
| | | if (res.code === 200) { |
| | | item = { |
| | | code: res.code, |
| | | data: res.data |
| | | } |
| | | } else if(res.code === 403){ |
| | | item = {code: 403,msg: '请重新登录'} |
| | | } |
| | | },(result)=>{ |
| | | // console.log(res); |
| | | }) |
| | | return item |
| | | } |
| | | |
| | | async function getUserTree() { |
| | | let _this = this,item = []; |
| | | let ress = await uni.request({ |
| | | url: `${common.baseUrl}/dept/user/tree/auth`, |
| | | header:{'token':uni.getStorageSync('token')}, |
| | | method: 'POST' |
| | | }).then((res)=> { |
| | | res = res[1].data |
| | | // console.log(res.data[0].children); |
| | | if (res.code === 200) { |
| | | item = { |
| | | code: res.code, |
| | | data: res.data[0].children |
| | | } |
| | | } else if(res.code === 403){ |
| | | item = {code: 403,msg: '请重新登录'} |
| | | } |
| | | },(result)=>{ |
| | | // console.log(res); |
| | | }) |
| | | return item |
| | | } |
| | | |
| | | module.exports = { |
| | | getDetail, |
| | | getUserTree |
| | | } |
| | |
| | | <template> |
| | | <view> |
| | | <u-collapse @change="change" @close="close" @open="open"> |
| | | <u-collapse-item :title="item.title" name="Docs guide" v-for="item in tree"> |
| | | <text class="u-collapse-content">1</text> |
| | | </u-collapse-item> |
| | | </u-collapse> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import user from '@/pages/api/user/user.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | tree: [{title: '超级管理员'}] |
| | | } |
| | | }, |
| | | onShow() { |
| | | this.getUserTree() |
| | | }, |
| | | methods: { |
| | | async getUserTree() { |
| | | let res = await user.getUserTree() |
| | | if (res.code === 200) { |
| | | this.tree = [] |
| | | console.log(res.data); |
| | | for (let k of res.data) { |
| | | this.tree.push(k) |
| | | } |
| | | } else if (res.code === 403) { |
| | | this.backLogin(res) |
| | | } |
| | | }, |
| | | open(e) { |
| | | // console.log('open', e) |
| | | }, |
| | | close(e) { |
| | | // console.log('close', e) |
| | | }, |
| | | change(e) { |
| | | // console.log('change', e) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | |
| | | <block slot="right"> |
| | | <view class="city"> |
| | | <view> |
| | | <text class="uni-nav-bar-text">角色</text> |
| | | <text class="uni-nav-bar-text">{{username}}</text> |
| | | </view> |
| | | <uni-icons type="arrowdown" color="#333333" size="20" /> |
| | | </view> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import user from '@/pages/api/user/user.js' |
| | | export default { |
| | | data() { |
| | | return { |
| | | csmtrList: [], |
| | | last_id: '', |
| | | username: '', |
| | | userid: 0, |
| | | reload: false, |
| | | status: 'more', |
| | | curr:2, |
| | |
| | | }) |
| | | |
| | | }, |
| | | onLoad() { |
| | | |
| | | }, |
| | | onShow() { |
| | | setTimeout(()=> { |
| | | this.getCsmtr1() |
| | | },500) |
| | | this.getDetail() |
| | | }, |
| | | onReachBottom() { |
| | | this.status = 'more'; |
| | | this.getCsmtr() |
| | | }, |
| | | mounted() { |
| | | // this.getUserTree() |
| | | // this.columns = [['aa','bb']] |
| | | }, |
| | | methods: { |
| | | async getDetail() { |
| | | let res = await user.getDetail() |
| | | if (res.code === 200) { |
| | | this.username = res.data.username |
| | | } else if (res.code === 403) { |
| | | this.backLogin(res) |
| | | } |
| | | }, |
| | | open() { |
| | | this.show = true |
| | | console.log(this.columns); |
| | |
| | | }).then((res)=>{ |
| | | console.log(res); |
| | | }) |
| | | |
| | | |
| | | |
| | | // success(res) { |
| | | // res = res.data |
| | | // res.data[0].childern |
| | | // let sel1 = [] |
| | | // for (let k of res.data[0].children) { |
| | | // res.data[0].children |
| | | // sel1.push(k.title) |
| | | |
| | | // } |
| | | // // _this.columns[0] = sel1 |
| | | // } |
| | | }, |
| | | back() { |
| | | uni.navigateBack({ |
| | |
| | | // --- |
| | | search() { |
| | | |
| | | }, |
| | | backLogin(res) { |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '../login/login' |
| | | }); |
| | | }, 1000); |
| | | } |
| | | } |
| | | } |
| | |
| | | .city { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-right: 4px; |
| | | } |
| | | .uni-nav-bar-text { |
| | | font-size: 12px; |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import user from '@/pages/api/user/user.js' |
| | | export default{ |
| | | data() { |
| | | return { |
| | |
| | | this.getDetail() |
| | | }, |
| | | methods: { |
| | | async getDetail() { |
| | | let res = await user.getDetail() |
| | | if (res.code === 200) { |
| | | this.username = res.data.username |
| | | console.log(res); |
| | | } else if (res.code === 403) { |
| | | this.backLogin(res) |
| | | } |
| | | }, |
| | | userDetail() { |
| | | uni.navigateTo({ |
| | | url:'/pages/user/user_detail/userDetail' |
| | | }) |
| | | }, |
| | | getDetail() { |
| | | let that = this |
| | | uni.request({ |
| | | url: that.baseUrl + '/user/detail/auth', |
| | | header: {'token' : uni.getStorageSync('token')}, |
| | | method: 'POST', |
| | | success(res) { |
| | | res = res.data |
| | | if (res.code === 200) { |
| | | that.username = res.data.username |
| | | } else if (res.code === 403) { |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '../../login/login' |
| | | }); |
| | | }, 1000); |
| | | } else { |
| | | uni.showToast({title: res.msg, icon: "none",position: 'top'}) |
| | | } |
| | | console.log(res.data); |
| | | } |
| | | }) |
| | | }, |
| | | backLogin(res) { |
| | | uni.showToast({title: res.msg, icon: "none", position: 'top'}) |
| | | setTimeout(() => { |
| | | uni.reLaunch({ |
| | | url: '../login/login' |
| | | }); |
| | | }, 1000); |
| | | } |
| | | } |
| | | } |
| | | </script> |