合同小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

170 lines
3.2 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="container">
  3. <!-- 用户信息 -->
  4. <view class="user-info">
  5. <view class="user-info-content">
  6. <image :src="avatar" ></image>
  7. <text class="username">{{nickName}}</text>
  8. </view>
  9. </view>
  10. <!-- 功能列表 -->
  11. <view class="menu">
  12. <view class="menu-item" >
  13. <view class="menu-item-left">
  14. <image class="arrow" src="/static/image/组 71696.png"></image>
  15. <text>关于我们</text>
  16. </view>
  17. <uni-icons type="right" class="menu-item-right"></uni-icons>
  18. </view>
  19. <view class="menu-item" >
  20. <view class="menu-item-left">
  21. <image class="arrow" src="/static/image/路径 6112.png"></image>
  22. <text>联系客服</text>
  23. </view>
  24. <uni-icons type="right" class="menu-item-right"></uni-icons>
  25. </view>
  26. <view class="menu-item" @click="logout">
  27. <view class="menu-item-left">
  28. <image class="arrow" src="/static/image/路径 6111.png"></image>
  29. <text>退出登录</text>
  30. </view>
  31. <uni-icons type="right" class="menu-item-right"></uni-icons>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {logout,isToken} from '@/api.uts'
  38. export default {
  39. data() {
  40. return {
  41. avatar:'',
  42. nickName:''
  43. }
  44. },
  45. mounted() {
  46. isToken();
  47. this.avatar = getApp().usrInfo.avatar;
  48. this.nickName = getApp().usrInfo.nickName;
  49. console.log(uni.getStorageSync('token'));
  50. },
  51. methods: {
  52. logout() {
  53. uni.showModal({
  54. title: '提示',
  55. content: '确定要退出登录吗?',
  56. success: (res) => {
  57. if (res.confirm) {
  58. logout().then((res)=>{
  59. if(res.success){
  60. uni.showToast({
  61. title: '退出登录成功',
  62. icon: 'success',
  63. success: () => {
  64. // 这里可以添加退出登录的逻辑,例如清除用户登录状态
  65. uni.clearStorageSync();
  66. setTimeout(() => {
  67. uni.navigateTo({ url: '/pages/index/login' });
  68. }, 1500);
  69. }
  70. });
  71. }
  72. })
  73. }
  74. }
  75. });
  76. }
  77. }
  78. };
  79. </script>
  80. <style>
  81. .container {
  82. display: flex;
  83. flex-direction: column;
  84. height: 100vh;
  85. background-color: #f5f5f5;
  86. }
  87. .user-info {
  88. padding: 1rem;
  89. height: 30%;
  90. background-color: #044f7a;
  91. color: #fff;
  92. display: flex;
  93. flex-direction: column;
  94. /* justify-content: space-between; */
  95. align-items: center;
  96. }
  97. .user-info-content{
  98. width: 40%;
  99. height: 70%;
  100. display: flex;
  101. align-items: center;
  102. margin-top: auto;
  103. }
  104. .user-info-content image{
  105. width: 70%;
  106. height: 70%;
  107. border-radius: 10%;
  108. }
  109. .user-info text{
  110. position: absolute;
  111. font-size: 1rem;
  112. bottom: 5%;
  113. }
  114. .menu {
  115. flex: 1;
  116. padding: 20px;
  117. background-color: #fff;
  118. }
  119. .menu-item {
  120. display: flex;
  121. flex-direction: row;
  122. justify-content: center;
  123. align-items: center;
  124. padding: 15px 0;
  125. border-bottom: 1px solid #eee;
  126. }
  127. .menu-item-left {
  128. display: flex;
  129. flex-direction: row;
  130. margin-right: auto;
  131. }
  132. .menu-item text {
  133. margin-left: 1rem;
  134. font-size: 16px;
  135. }
  136. .arrow {
  137. width: 20px;
  138. height: 20px;
  139. }
  140. .footer {
  141. display: flex;
  142. justify-content: space-around;
  143. padding: 10px;
  144. background-color: #fff;
  145. border-top: 1px solid #ccc;
  146. }
  147. .nav-item {
  148. text-align: center;
  149. }
  150. .nav-item text {
  151. font-size: 14px;
  152. }
  153. </style>