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

218 lines
5.9 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="makePhoneCall">
  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. uni.showLoading({
  121. title: '正在获取资料'
  122. })
  123. this.$http.get({
  124. api: 'api/me',
  125. header: {
  126. Authorization: this.token
  127. }
  128. }).then(res => {
  129. this.userInfo = res.data.data;
  130. uni.hideLoading();
  131. }).catch(err => uni.hideLoading())
  132. },
  133. // 上传更换用户头像
  134. changeImage: function() {
  135. uni.chooseImage({
  136. count: 1,
  137. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  138. sourceType: ['album'], //从相册选择
  139. success: res => {
  140. var tempFilePaths = res.tempFilePaths;
  141. this.newImage = tempFilePaths[0];
  142. uni.uploadFile({
  143. header: {
  144. Authorization: this.token
  145. },
  146. url: config.GLOBAL.baseUrl + 'api/users/upload/avatar',
  147. filePath: tempFilePaths[0],
  148. fileType: 'image',
  149. name: 'avatar_file',
  150. success: res => {
  151. var result = JSON.parse(res.data);
  152. // this.setData({
  153. // 'userInfo.avatar': result.data.url
  154. // });
  155. this.userInfo.avatar = result.data.url;
  156. getUpdateUserInfo(this.token);
  157. }
  158. })
  159. }
  160. });
  161. },
  162. // 拨打电话
  163. makePhoneCall(){
  164. uni.makePhoneCall({
  165. phoneNumber: String('13132794740')
  166. })
  167. },
  168. signOut(){
  169. uni.showModal({
  170. title: '温馨提示',
  171. content: '您确定退出登录吗?',
  172. success: result => {
  173. if(result.confirm){
  174. this.$cookieStorage.clear('user_token');
  175. this.$msg('操作成功', {icon: 'success'}).then(() => {
  176. this.$toBack();
  177. });
  178. }
  179. }
  180. })
  181. }
  182. }
  183. }
  184. </script>
  185. <style>
  186. page{
  187. background-color: #F8F8F8;
  188. }
  189. </style>
  190. <style scoped lang="scss">
  191. .set-btn {
  192. width: 550rpx;
  193. height: 100rpx;
  194. background: #15716E;
  195. border-radius: 50rpx;
  196. margin: 40rpx auto;
  197. font-size: 32rpx;
  198. color: white;
  199. line-height: 100rpx;
  200. }
  201. .set-img {
  202. width: 41rpx;
  203. height: 41rpx;
  204. border-radius: 50%;
  205. }
  206. .set-tag {
  207. height: 100rpx;
  208. width: 100%;
  209. display: flex;
  210. align-items: center;
  211. justify-content: space-between;
  212. // border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  213. }
  214. </style>