personData.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. <open-data class="user-photo" type="userAvatarUrl"></open-data>
  10. <!-- <u-icon class="back-img" name="arrow-right" color="#9DA8B5"></u-icon> -->
  11. </view>
  12. </view>
  13. <view class="list-item border-bottom">
  14. <view class="list-item-left">
  15. <text>名称</text>
  16. </view>
  17. <view class="list-item-right">
  18. <open-data type="userNickName"></open-data>
  19. <!-- <u-icon class="back-img" name="arrow-right" color="#9DA8B5"></u-icon> -->
  20. </view>
  21. </view>
  22. <view class="list-item margin-bot">
  23. <view class="list-item-left">
  24. <text>性别</text>
  25. </view>
  26. <view class="list-item-right">
  27. <open-data type="userGender" lang="zh_CN"></open-data>
  28. <!-- <u-icon class="back-img" name="arrow-right" color="#9DA8B5"></u-icon> -->
  29. </view>
  30. </view>
  31. <view class="list-item ">
  32. <view class="list-item-left">
  33. <text>联系电话</text>
  34. </view>
  35. <view class="list-item-right">
  36. <text>{{userInfo.mobile}}</text>
  37. <!-- <u-icon class="back-img" name="arrow-right" color="#9DA8B5"></u-icon> -->
  38. </view>
  39. </view>
  40. </view>
  41. <view class="bottom-cont" @click="loginOut">
  42. 退出登录
  43. </view>
  44. <uni-popup ref="openModal" type="center">
  45. <uni-popup-dialog content="确定退出登录吗?" @confirm="onOk" :title="title"></uni-popup-dialog>
  46. </uni-popup>
  47. </view>
  48. </template>
  49. <script>
  50. import uniPopup from '@/components/uni-popup/uni-popup.vue'
  51. import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
  52. import service from '../../service.js';
  53. import mIcon from '../../components/m-icon/m-icon.vue'
  54. import {
  55. mapState,
  56. mapMutations
  57. } from 'vuex'
  58. export default {
  59. components: {
  60. mIcon,uniPopup,uniPopupDialog
  61. },
  62. data() {
  63. return {
  64. userInfo:'',
  65. title:'',
  66. }
  67. },
  68. onShow() {
  69. //检测是否登录
  70. this.$store.dispatch('checkLogin')
  71. },
  72. computed: {
  73. ...mapState(['hasLogin'])
  74. },
  75. methods: {
  76. loginOut(){
  77. this.$refs.openModal.open()
  78. // this.$store.dispatch('userLogout');
  79. // setTimeout(function(){
  80. // uni.redirectTo({
  81. // url: '/pages/login/login'
  82. // });
  83. // },300)
  84. },
  85. onOk(){
  86. this.$refs.openModal.close()
  87. this.$store.dispatch('userLogout');
  88. setTimeout(function(){
  89. uni.redirectTo({
  90. url: '/pages/login/login'
  91. });
  92. },300)
  93. }
  94. },
  95. onLoad() {
  96. let UserInfo = uni.getStorageSync('userInfo');
  97. this.userInfo = UserInfo;
  98. console.log(UserInfo,"UserInfo")
  99. // 开启分享
  100. uni.showShareMenu({
  101. withShareTicket: true,
  102. menus: ['shareAppMessage', 'shareTimeline']
  103. })
  104. },
  105. onReady() {
  106. }
  107. }
  108. </script>
  109. <style lang="less" scoped>
  110. .content{
  111. padding: 0;
  112. background: rgb(245,245,245);
  113. }
  114. .list-container{
  115. width: 100%;
  116. box-sizing:border-box;
  117. .border-bottom{
  118. padding-left: 32rpx;
  119. border-bottom: 1px solid #E5E5E5;
  120. }
  121. .margin-bot{
  122. margin-bottom: 20rpx;
  123. }
  124. .list-item{
  125. width: 100%;
  126. background-color: #fff;
  127. display: flex;
  128. padding: 30rpx 32rpx;
  129. justify-content: space-between;
  130. align-items:center;
  131. // border-bottom: 1px solid #E5E5E5;
  132. .user-photo{
  133. display: block;
  134. width: 100rpx;
  135. height: 100rpx;
  136. border-radius: 50%;
  137. overflow: hidden;
  138. }
  139. .list-item-left{
  140. font-size: 36rpx;
  141. color: #191919;
  142. }
  143. .list-item-right{
  144. font-size: 36rpx;
  145. color: #666666;
  146. display: flex;
  147. align-items: center;
  148. .back-img{
  149. width: 18rpx;
  150. height: 34rpx;
  151. margin-left: 20rpx;
  152. }
  153. }
  154. }
  155. }
  156. .bottom-cont{
  157. position: fixed;
  158. bottom: 0;
  159. width: 100%;
  160. background-color: #fff;
  161. height: 110rpx;
  162. font-size: 36rpx;
  163. color: #999999;
  164. text-align: center;
  165. line-height: 110rpx;
  166. }
  167. </style>