zjh
2025-04-26 18db0dbf100ff81ead99b1d6a3daa6c4c26e5d91
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
<template>
  <uni-base-page :footer="false">
    <view slot="page">
      <uni-list v-if="loginInfo.hasLogin">
        <uni-list-item style="background-color: #f8f8f8;" :show-extra-icon="true" :show-arrow="false"
                       :title="loginInfo.chineseName">
          <template slot="header">
            <image class="slot-image" src="../../static/img/touxiang.jpg" mode="widthFix"></image>
          </template>
        </uni-list-item>
        <uni-list-item style="background-color: #f8f8f8;" :show-extra-icon="true" :show-arrow="false"
                       :title="'修改密码'"
                       :to="'newPwd'"></uni-list-item>
      </uni-list>
      <view class="btn-row" style="margin-top: 10px;">
        <button v-if="!loginInfo.hasLogin" type="primary" class="primary" @tap="bindLogin">登录</button>
        <button v-if="loginInfo.hasLogin" type="default" @tap="bindLogout">退出登录</button>
      </view>
    </view>
  </uni-base-page>
</template>
 
<script>
export default {
  data() {
    return {
      loginInfo: this.$loginInfo
    }
  },
  created() {
 
  },
  methods: {
    bindLogin() {
      uni.navigateTo({
        url: 'login',
      });
    },
    bindLogout() {
      this.$logout();
     
        uni.setStorage({
            key: 'gs_mes_pad_userkey',
            data: null,
            success: function() {
 
            }
        });
      /**
       * 如果需要强制登录跳转回登录页面
       */
      if (this.loginInfo.forcedLogin) {
        uni.reLaunch({
          url: 'login',
        });
      }
    }
  }
}
</script>
 
<style>
.slot-image {
  display: block;
  margin-right: 10px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
}
</style>