金诚优选前端代码
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.

196 lines
5.4 KiB

  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="true" :showIcon="true" title="设置"></lf-nav>
  4. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  5. <view class="set-tag lf-border-bottom" @click="$url('/pages/user/my/editname')">
  6. <view class="lf-font-28 lf-color-black">
  7. 昵称
  8. </view>
  9. <view class="lf-flex">
  10. <view class="lf-font-28 lf-color-555">{{ userInfo.nick_name || userInfo.mobile }}</view><text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  11. </view>
  12. </view>
  13. </view>
  14. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  15. <view class="set-tag lf-border-bottom" @click="changeImage">
  16. <view class="lf-font-28 lf-color-black">
  17. 头像
  18. </view>
  19. <view class="lf-flex">
  20. <view class="lf-row-center">
  21. <image :src="userInfo.avatar" mode="aspectFill" class="set-img" v-if="userInfo.avatar"></image>
  22. <image src="../../../static/images/empty.png" mode="aspectFill" class="set-img" v-else></image>
  23. </view>
  24. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  29. <view class="set-tag lf-border-bottom" @click="$url('/pages/user/my/vipinfo')">
  30. <view class="lf-font-28 lf-color-black">
  31. 会员资料
  32. </view>
  33. <view class="lf-flex">
  34. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  35. </view>
  36. </view>
  37. </view>
  38. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  39. <view class="set-tag" @click="$url('/pages/address/list/list')">
  40. <view class="lf-font-28 lf-color-black">
  41. 地址管理
  42. </view>
  43. <view class="lf-flex">
  44. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  45. </view>
  46. </view>
  47. </view>
  48. <self-line/>
  49. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  50. <view class="set-tag lf-border-bottom" @click="$url('/pages/user/my/verificationPhone')">
  51. <view class="lf-font-28 lf-color-black">
  52. 修改手机号
  53. </view>
  54. <view class="lf-flex">
  55. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  60. <view class="set-tag" @click="$url('/pages/user/my/setPassword')">
  61. <view class="lf-font-28 lf-color-black">
  62. 支付密码设置
  63. </view>
  64. <view class="lf-flex">
  65. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  66. </view>
  67. </view>
  68. </view>
  69. <self-line/>
  70. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  71. <view class="set-tag lf-border-bottom" @click="$url('/pages/user/agreement/agreement')">
  72. <view class="lf-font-28 lf-color-black">
  73. 关于我们
  74. </view>
  75. <view class="lf-flex">
  76. <text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  77. </view>
  78. </view>
  79. </view>
  80. <view class="lf-p-l-32 lf-p-r-32 lf-bg-white">
  81. <view class="set-tag" @click="$msg('敬请期待')">
  82. <view class="lf-font-28 lf-color-black">
  83. 客服电话
  84. </view>
  85. <view class="lf-flex">
  86. <view class="lf-font-28 lf-color-555">0315-7483482</view><text class="lf-iconfont icon-xiangyou lf-font-24 lf-m-l-10 lf-color-777"></text>
  87. </view>
  88. </view>
  89. </view>
  90. <button class="set-btn" hover-class="lf-opacity" @click="signOut">退出账号</button>
  91. </view>
  92. </template>
  93. <script>
  94. import { config, getUpdateUserInfo } from '@/common/js/utils.js';
  95. export default {
  96. data(){
  97. return {
  98. userInfo: {},
  99. token: '',
  100. shou_count: 0
  101. }
  102. },
  103. onLoad(){
  104. // var userInfo = this.$cookieStorage.get('user_info');
  105. // this.userInfo = userInfo || {};
  106. var token = this.$cookieStorage.get('user_token');
  107. this.token = token;
  108. this.getMeInfo();
  109. },
  110. onShow(){
  111. this.shou_count++;
  112. if(this.shou_count > 1){
  113. this.getMeInfo();
  114. }
  115. },
  116. methods: {
  117. // 获取页面信息
  118. getMeInfo(){
  119. this.$http.get({
  120. api: 'api/me',
  121. header: {
  122. Authorization: this.token
  123. }
  124. }).then(res => {
  125. this.userInfo = res.data.data;
  126. })
  127. },
  128. // 上传更换用户头像
  129. changeImage: function() {
  130. uni.chooseImage({
  131. count: 1,
  132. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  133. sourceType: ['album'], //从相册选择
  134. success: res => {
  135. var tempFilePaths = res.tempFilePaths;
  136. this.newImage = tempFilePaths[0];
  137. uni.uploadFile({
  138. header: {
  139. Authorization: this.token
  140. },
  141. url: config.GLOBAL.baseUrl + 'api/users/upload/avatar',
  142. filePath: tempFilePaths[0],
  143. fileType: 'image',
  144. name: 'avatar_file',
  145. success: res => {
  146. var result = JSON.parse(res.data);
  147. // this.setData({
  148. // 'userInfo.avatar': result.data.url
  149. // });
  150. this.userInfo.avatar = result.data.url;
  151. getUpdateUserInfo(this.token);
  152. }
  153. })
  154. }
  155. });
  156. },
  157. signOut(){
  158. this.$msg('敬请期待')
  159. }
  160. }
  161. }
  162. </script>
  163. <style>
  164. page{
  165. background-color: #F8F8F8;
  166. }
  167. </style>
  168. <style scoped lang="scss">
  169. .set-btn {
  170. width: 550rpx;
  171. height: 100rpx;
  172. background: #15716E;
  173. border-radius: 50rpx;
  174. margin: 40rpx auto;
  175. font-size: 32rpx;
  176. color: white;
  177. line-height: 100rpx;
  178. }
  179. .set-img {
  180. width: 41rpx;
  181. height: 41rpx;
  182. border-radius: 50%;
  183. }
  184. .set-tag {
  185. height: 100rpx;
  186. width: 100%;
  187. display: flex;
  188. align-items: center;
  189. justify-content: space-between;
  190. // border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  191. }
  192. </style>