personData.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="content">
  3. <view class="list-container">
  4. <view class="list-item margin-bot">
  5. <view class="list-item-left">
  6. <text>头像</text>
  7. </view>
  8. <view class="list-item-right">
  9. <button class="avatar-wrapper" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
  10. <u-image class="avatar" width="100" height="100" :src="avatarUrl||'/static/def_personal_avatar.png'"></u-image>
  11. </button>
  12. <view style="font-size: 0.8rem;text-align: center;"><text v-if="!avatarUrl">点击头像修改</text></view>
  13. </view>
  14. </view>
  15. <view class="list-item border-bottom">
  16. <view class="list-item-left">
  17. <text>姓名</text>
  18. </view>
  19. <view class="list-item-right">
  20. <text>{{userInfo.userNameCN}}</text>
  21. </view>
  22. </view>
  23. <view class="list-item border-bottom">
  24. <view class="list-item-left">
  25. <text>手机号</text>
  26. </view>
  27. <view class="list-item-right">
  28. <text>{{userInfo.mobile}}</text>
  29. </view>
  30. </view>
  31. <view class="list-item border-bottom">
  32. <view class="list-item-left">
  33. <text>门店名称</text>
  34. </view>
  35. <view class="list-item-right">
  36. <text>{{userInfo.orgName}}</text>
  37. </view>
  38. </view>
  39. <view class="list-item margin-bot" v-if="shelfInfo">
  40. <view class="list-item-left">
  41. <text>汽配经销商</text>
  42. </view>
  43. <view class="list-item-right">
  44. <text>{{shelfInfo.dealerName}}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="bottom-cont" style="color: dodgerblue;" @click="loginOut">
  49. 退出登录
  50. </view>
  51. <uni-popup ref="openModal" type="center">
  52. <uni-popup-dialog content="确定退出登录吗?" @confirm="onOk" :title="title"></uni-popup-dialog>
  53. </uni-popup>
  54. </view>
  55. </template>
  56. <script>
  57. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  58. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  59. import service from '../../service.js';
  60. import {
  61. mapState,
  62. mapMutations
  63. } from 'vuex'
  64. export default {
  65. components: {
  66. uniPopup,uniPopupDialog
  67. },
  68. data() {
  69. return {
  70. title:'',
  71. avatarUrl:""
  72. }
  73. },
  74. onShow() {
  75. //检测是否登录
  76. this.$store.dispatch('checkLogin')
  77. },
  78. computed: {
  79. ...mapState(['hasLogin']),
  80. userInfo(){
  81. return this.$store.state.vuex_userInfo
  82. },
  83. shelfInfo(){
  84. return this.$store.state.vuex_storeShelf
  85. },
  86. },
  87. methods: {
  88. onChooseAvatar(e) {
  89. const { avatarUrl } = e.detail
  90. this.avatarUrl = avatarUrl
  91. },
  92. loginOut(){
  93. this.$refs.openModal.open()
  94. },
  95. onOk(){
  96. this.$refs.openModal.close()
  97. this.$store.dispatch('userLogout');
  98. setTimeout(function(){
  99. uni.redirectTo({
  100. url: '/pages/login/login'
  101. });
  102. },300)
  103. }
  104. },
  105. onLoad() {
  106. },
  107. onReady() {
  108. }
  109. }
  110. </script>
  111. <style lang="less" scoped>
  112. .content{
  113. padding: 0;
  114. background: rgb(245,245,245);
  115. .avatar-wrapper{
  116. width:100rpx;
  117. height:100rpx;
  118. background: none;
  119. padding: 0;
  120. border-radius: 100%;
  121. &::after{
  122. border:1px solid #eee;
  123. }
  124. }
  125. }
  126. .list-container{
  127. width: 100%;
  128. box-sizing:border-box;
  129. .border-bottom{
  130. padding-left: 32rpx;
  131. border-bottom: 1px solid #E5E5E5;
  132. }
  133. .margin-bot{
  134. margin-bottom: 20rpx;
  135. }
  136. .list-item{
  137. width: 100%;
  138. background-color: #fff;
  139. display: flex;
  140. padding: 30rpx 32rpx;
  141. justify-content: space-between;
  142. align-items:center;
  143. // border-bottom: 1px solid #E5E5E5;
  144. .user-photo{
  145. display: block;
  146. width: 100rpx;
  147. height: 100rpx;
  148. border-radius: 50%;
  149. overflow: hidden;
  150. }
  151. .list-item-left{
  152. font-size: 36rpx;
  153. color: #191919;
  154. }
  155. .list-item-right{
  156. font-size: 36rpx;
  157. color: #666666;
  158. .back-img{
  159. width: 18rpx;
  160. height: 34rpx;
  161. margin-left: 20rpx;
  162. }
  163. }
  164. }
  165. }
  166. .bottom-cont{
  167. position: fixed;
  168. bottom: 0;
  169. width: 100%;
  170. background-color: #fff;
  171. height: 110rpx;
  172. font-size: 36rpx;
  173. color: #999999;
  174. text-align: center;
  175. line-height: 110rpx;
  176. }
  177. </style>