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

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