userDetails.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <view>
  3. <view class="userDetalis_ul">
  4. <view class="userDetalis_listLine"></view>
  5. <view class="userDetalis_listA">
  6. <view class="userDetalis_listBox">
  7. <view class="userDetalis_listTxt">账号</view>
  8. <view class="userDetalis_listName">{{user_name}}</view>
  9. </view>
  10. <view class="userDetalis_listLineA"></view>
  11. </view>
  12. <view class="userDetalis_listLineB"></view>
  13. <view class="userDetalis_list" @click="showA = true">
  14. <view class="userDetalis_listTxt">退出账号</view>
  15. <u-icon name="arrow-right" color="#666" class="userDetalis_listRight" size="28"></u-icon>
  16. </view>
  17. </view>
  18. <!-- 操作菜单 -->
  19. <u-action-sheet @click="click" :list="list" v-model="showA"></u-action-sheet>
  20. <!-- 退出登录 -->
  21. <u-modal v-model="show" @confirm="confirm" @cancel="cancel" :show-cancel-button="true" :content="content">
  22. </u-modal>
  23. <!-- 顶部提示 -->
  24. <u-top-tips ref="uTips"></u-top-tips>
  25. </view>
  26. </template>
  27. <script>
  28. export default {
  29. data() {
  30. return {
  31. show: false, //退出登录
  32. content: '?', //退出登录内容
  33. // nickname: false, //修改昵称
  34. value: '', //修改昵称内容
  35. list: [{
  36. text: '退出账号'
  37. }, {
  38. text: '退出程序'
  39. }],
  40. showA: false,
  41. userObj: {}, //个人信息
  42. imgShow: true,
  43. imgArr: [],
  44. type: 'text',
  45. user_name: uni.getStorageSync('user_name')
  46. }
  47. },
  48. watch: {
  49. // nickname(val) {
  50. // if (val == false) {
  51. // this.value = ''
  52. // }
  53. // },
  54. },
  55. methods: {
  56. //退出
  57. click(index) {
  58. if (index == 0) {
  59. this.content = '是否退出当前账号?'
  60. } else if (index == 1) {
  61. this.content = '是否退出程序?'
  62. }
  63. this.show = true
  64. },
  65. // 确定事件
  66. async confirm() {
  67. if (this.content == '是否退出当前账号?') {
  68. console.log('退出账号')
  69. const res = await this.$myRequest({
  70. url: '/api/api_gateway?method=back_source.production.user_logout',
  71. })
  72. if (res) {
  73. uni.clearStorageSync();//同步清理本地数据缓存
  74. uni.showToast({
  75. title: '退出成功',
  76. mask: true,
  77. icon: "success",
  78. })
  79. uni.redirectTo({
  80. url: '../login/login',
  81. });
  82. console.log(999)
  83. }
  84. } else if (this.content == '是否退出程序?') {
  85. console.log('退出程序')
  86. // #ifdef APP-PLUS
  87. plus.runtime.quit();
  88. // #endif
  89. }
  90. },
  91. // 取消事件
  92. cancel() {
  93. var that = this
  94. that.$refs.uTips.show({
  95. title: '取消该操作',
  96. type: 'warning',
  97. duration: '1500'
  98. })
  99. },
  100. },
  101. }
  102. </script>
  103. <style lang="scss">
  104. page {
  105. background: #f7f8fc;
  106. }
  107. .userDetalis_ul {
  108. background: #fff;
  109. .userDetalis_list {
  110. height: 90rpx;
  111. display: flex;
  112. width: 700rpx;
  113. margin: 0 auto;
  114. justify-content: space-between;
  115. .userDetalis_listTxt {
  116. color: #5d5d5d;
  117. padding: 25rpx 0 25rpx 0;
  118. }
  119. .userDetalis_listName {
  120. color: #5d5d5d;
  121. }
  122. .userDetalis_listImg {
  123. width: 80rpx;
  124. height: 80rpx;
  125. border-radius: 55px;
  126. margin: 2px 0 0 0;
  127. }
  128. .userDetalis_listRight {
  129. width: 50rpx;
  130. height: 50rpx;
  131. margin: 20rpx 0 0 0;
  132. }
  133. }
  134. .userDetalis_listA {
  135. width: 700rpx;
  136. margin: 0 auto;
  137. .userDetalis_listBox {
  138. display: flex;
  139. justify-content: space-between;
  140. height: 90rpx;
  141. .userDetalis_listTxt {
  142. padding: 25rpx 0 25rpx 0;
  143. }
  144. .userDetalis_listName {
  145. padding: 25rpx 0 25rpx 0;
  146. color: #5d5d5d;
  147. }
  148. }
  149. }
  150. }
  151. .userDetalis_listLine {
  152. border: 3px solid #f7f8fc;
  153. }
  154. .userDetalis_listLineA {
  155. border-bottom: 1rpx solid #dfdfdf;
  156. }
  157. .userDetalis_listLineB {
  158. border: 5px solid #f7f8fc;
  159. }
  160. // 修改昵称弹框
  161. .popIntBox {
  162. margin: 100rpx auto;
  163. width: 450rpx;
  164. }
  165. .popBtnBox {
  166. display: flex;
  167. }
  168. </style>