1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
| <template>
| <view>
| <view class="line">
| <text>登录名:</text>
| <text>{{userName}}</text>
| </view>
| <view class="line">
| <text>真实姓名:</text>
| <text>{{admin}}</text>
| </view>
| <u-button type="success" @click="quit">退出登录</u-button>
| </view>
| </template>
|
| <script lang='js'>
| import {
| logOut,loginToken
| } from '../../api/login.js'
| export default {
| data() {
| return {
| userName:'',
| admin: ''
| };
| },
| onShow() {
| this.userName =JSON.parse(uni.getStorageSync('userName')) || '';
| this.admin = uni.getStorageSync('admin');
| let creator = uni.getStorageSync('creator') || '';
| if(creator){
| this.admin = JSON.parse(uni.getStorageSync('creator')) || '';
| }
| //this.getToken();
| console.log(this.admin)
| },
| methods: {
| getToken(){
| loginToken({}).then((res) => {
| if(res.data.result){
| if(res.data.data){
| uni.setStorageSync('$tokenInfouser', JSON.stringify(res.data.data));
| }
| }
| }).catch(err=>{
| console.log(err)
| })
| },
| back() {
| uni.navigateBack({
| delta: 1
| })
| },
| quit() {
| let params = {
| userName: this.userName,
| sourceMachine:'PDA'
| }
| logOut(params).then((res) => {
| if (res.data.result) {
| this.local_quit();
| } else {
| this.$u.toast(res.data.msg)
| }
| }).catch(err=>{
| this.$u.toast("请检查网络是否畅通!")
| })
| },
| local_quit() {
| uni.clearStorageSync()
| uni.navigateTo({
| url: '../Login/login?id=1'
| })
| }
| }
| }
| </script>
|
| <style lang="scss">
|
| page {
| // padding-bottom: 50px;
| // height: 100%;
| }
|
| .line {
| height: 50px;
| border-bottom: 1px solid #eaeaea;
| padding-left: 3rem;
| font-size: 1rem;
| padding-right: 10px;
| display: flex;
| align-items: center;
| }
|
| .btn {
| position: fixed;
| bottom: 0px;
| width: 100%;
| }
| </style>
|
|