details.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="page">
  3. <view class="uni-list">
  4. <view class="uni-list-cell" @tap="goSet('3')">
  5. <view class="uni-media-list uni-list-cell-navigate uni-navigate-right">
  6. <text>头像</text>
  7. <view class="uni-media-list-logo photo">
  8. <image :src="myPhoto" :lazy-load="true" style="border-radius: 10upx;"/>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="uni-list-cell" @tap="goSet('0')">
  13. <view class="uni-list-cell-navigate uni-navigate-right">
  14. <view>
  15. <text>昵称</text>
  16. <view class="show_text">{{info.nickname}}</view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="uni-list-cell">
  21. <view class="uni-list-cell-navigate">
  22. <view>
  23. <text>账号</text>
  24. <view class="show_text">{{info.username}}</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="uni-list-cell" @tap="goSet('1')">
  29. <view class="uni-list-cell-navigate uni-navigate-right">
  30. <view>
  31. <text>个性签名</text>
  32. <view class="show_text">{{info.doodling}}</view>
  33. </view>
  34. </view>
  35. </view>
  36. <view class="uni-list-cell" @tap="goSet('4')">
  37. <view class="uni-media-list uni-list-cell-navigate uni-navigate-right">
  38. <text>我的二维码</text>
  39. <view class="uni-media-list-logo photo_qrcode">
  40. <image src="/static/theme/default/my/qrcode.png" :lazy-load="true"/>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="uni-list-cell" @tap="goSet('2')">
  45. <view class="uni-list-cell-navigate uni-navigate-right">
  46. <view>
  47. <text>性别</text>
  48. <view class="show_text">{{[ '男','女' ][info.sex]}}</view>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="uni-list-cell" v-if="0">
  53. <view class="uni-list-cell-navigate uni-navigate-right">
  54. <view>
  55. <text>更多</text>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </template>
  62. <script>
  63. import _get from '../../common/_get';
  64. import _hook from '../../common/_hook';
  65. import _data from '../../common/_data';
  66. export default {
  67. components: {
  68. },
  69. data() {
  70. return {
  71. info: {},
  72. }
  73. },
  74. onShow(){
  75. _hook.routeSonHook();
  76. let _this = this;
  77. _this.info = _data.data('user_info');
  78. /** 监听新的个人数据 */
  79. uni.$on('data_user_info',function(data){
  80. _this.info = data;
  81. });
  82. },
  83. onLoad(option) {
  84. },
  85. onUnload(){
  86. uni.$off('data_user_info');
  87. },
  88. computed: {
  89. myPhoto(){
  90. return _data.staticPhoto() + this.info.photo;
  91. },
  92. },
  93. onBackPress(options){
  94. if (options.from === 'navigateBack') {
  95. return false;
  96. }
  97. this.back();
  98. return true;
  99. },
  100. methods: {
  101. back(){
  102. uni.switchTab({
  103. url: '/pages/chat/index',
  104. });
  105. },
  106. goSet(type){
  107. let url;
  108. switch (type){
  109. case '0':
  110. case '1':
  111. case '2':
  112. url = '../set/user?type=' + type;
  113. break;
  114. case '3':
  115. url = '../set/photo';
  116. break;
  117. case '4':
  118. url = './qrcode';
  119. break;
  120. default:
  121. return;
  122. break;
  123. }
  124. uni.navigateTo({
  125. url: url,
  126. animationType: 'slide-in-bottom',
  127. });
  128. }
  129. },
  130. watch: {
  131. },
  132. }
  133. </script>
  134. <style>
  135. .uni-media-list-logo {
  136. width: 30upx;
  137. height: 30upx;
  138. display: inline-block;
  139. vertical-align:middle;
  140. }
  141. .photo_qrcode{
  142. width: 52upx;
  143. height: 52upx;
  144. margin-left: 30upx;
  145. margin-right: 50upx;
  146. }
  147. .photo {
  148. width: 106upx;
  149. height: 106upx;
  150. margin-left: 30upx;
  151. margin-right: 50upx;
  152. }
  153. .uni-card {
  154. box-shadow: none;
  155. }
  156. .show_text {
  157. position: absolute;
  158. right: 60upx;
  159. color: #8f8f94;
  160. display: inline-block;
  161. }
  162. .uni-navigate-right.uni-media-list {
  163. padding-right: 23upx;
  164. }
  165. </style>