user.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <view class="user-header" v-if="userInfo">
  4. <view class="avatar-btn">
  5. <image :src="userInfo?userInfo.avatar:'https://inmei-print.oss-cn-guangzhou.aliyuncs.com/logo.png'"></image>
  6. </view>
  7. <view class="user-info">
  8. <view class="name">{{userInfo.nickname}}</view>
  9. </view>
  10. </view>
  11. <view class="user-header" v-else>
  12. <view class="avatar-btn">
  13. <image src="https://inmei-print.oss-cn-guangzhou.aliyuncs.com/logo.png"></image>
  14. </view>
  15. <view class="user-info">
  16. <view class="name" @click="toLogin">请先登录</view>
  17. </view>
  18. </view>
  19. <view class="user-menu">
  20. <!-- <view class="menu-item">
  21. <view class="icon"><image src="/static/image/info.png"></image></view>
  22. <view class="name">个人信息</view>
  23. <view class="right"><image src="/static/image/right.png"></image></view>
  24. </view> -->
  25. <navigator hover-class="none" url="/pages/user/address?type=1" class="menu-item">
  26. <view class="icon"><image src="/static/image/address.png"></image></view>
  27. <view class="name">会员地址</view>
  28. <view class="right"><image src="/static/image/right.png"></image></view>
  29. </navigator>
  30. <!-- <view class="menu-item" @click="showService()">
  31. <view class="icon"><image src="/static/image/service.png"></image></view>
  32. <view class="name">客服</view>
  33. <view class="right"><image src="/static/image/right.png"></image></view>
  34. </view> -->
  35. <navigator hover-class="none" class="menu-item" url="/pages/user/license">
  36. <view class="icon"><image src="/static/image/zizhi.png"></image></view>
  37. <view class="name">服务资质</view>
  38. <view class="right"><image src="/static/image/right.png"></image></view>
  39. </navigator>
  40. <view class="menu-item" @click="outLogin">
  41. <view class="icon"><image src="/static/image/out.png"></image></view>
  42. <view class="name">退出</view>
  43. <view class="right"><image src="/static/image/right.png"></image></view>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. var app;
  50. import * as Api from "@/static/api/user.js";
  51. export default {
  52. data() {
  53. return {
  54. userInfo:null
  55. }
  56. },
  57. onLoad() {
  58. app = this;
  59. app.getData()
  60. },
  61. methods: {
  62. getData(){
  63. Api.info({}).then((res)=>{
  64. if (res.code == 0) {
  65. return app.$dialog.showSuccess(res.msg)
  66. }
  67. app.userInfo = res.data;
  68. })
  69. },
  70. outLogin(order){
  71. app.$dialog.showError("确定要退出登录吗",function(res){
  72. if (res.confirm) {
  73. app.userInfo = null;
  74. uni.clearStorageSync();
  75. }
  76. })
  77. },
  78. callMobile(mobile){
  79. uni.makePhoneCall({
  80. phoneNumber:mobile,
  81. success(res) {
  82. console.log(res)
  83. },fail(res) {
  84. console.log(res)
  85. }
  86. })
  87. },
  88. showService(){
  89. }
  90. }
  91. }
  92. </script>
  93. <style>
  94. page{background-color: #f8f8f8;}
  95. .user-header{background-color: #005bac;padding: 40upx;display: flex;align-items: center;background: linear-gradient(to right, #094d89, #007aff);width: calc(95% - 80upx);margin: 40upx auto;border-radius: 10upx;}
  96. .user-header image{width: 100upx;height: 100upx;border-radius: 100upx;}
  97. .user-header .user-info{margin-left: 20upx;}
  98. .user-header .name{font-size: 32upx;color: #fff;}
  99. .user-header .desc{font-size: 24upx;color: #f8f8f8;margin-top: 20upx;}
  100. .user-menu{width: 95%;margin: 40upx auto;border-radius: 10upx;background-color: #fff;}
  101. .user-menu .menu-item{height: 100upx;line-height: 100upx;display: flex;align-items: center;font-size: 28upx;color: #333;padding: 0 20upx;border-bottom: 2upx solid #f8f8f8;}
  102. .user-menu .menu-item .icon{margin-right: 20upx;display: flex;align-items: center;justify-content: center;}
  103. .user-menu .menu-item .right{margin-right: 0;margin-left: auto;}
  104. .user-menu .menu-item .icon image{width: 40upx;height: 40upx;}
  105. .user-menu .menu-item .right image{width: 40upx;height: 40upx;}
  106. .service-popup .item{height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;border-bottom: 2upx solid #f8f8f8;}
  107. .service-popup .item .btn{background-color: #fff;border: 0;height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;}
  108. .service-popup .item .btn::after{border: 0;}
  109. .service-popup .foot{height: 100upx;line-height: 100upx;text-align: center;font-size: 28upx;color: #333;border-top: 20upx solid #f8f8f8;}
  110. </style>