humanFace.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view>
  3. <view class="flex-row justify-center">
  4. <image class="face" mode="widthFix" :src="userInfo.techFaceUrl || '/static/my/renlian.png'"></image>
  5. </view>
  6. <view class="flex-row justify-center">
  7. <button class="btn" @click="navigateTo('/pages/ShootFace/ShootFace?username='+ userInfo.name)">更新人脸</button>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. export default {
  13. data() {
  14. return {
  15. userInfo:{}
  16. }
  17. },
  18. onLoad(){
  19. },
  20. onShow(){
  21. this.getUserInfo()
  22. },
  23. methods: {
  24. getUserInfo(){
  25. this.$api.user.getUserInfo().then(res=>{
  26. this.userInfo = res.data.data
  27. uni.setStorageSync('userInfo', this.userInfo )
  28. if (this.userInfo.techFaceId){
  29. this.getImgUrlByOssId(this.userInfo.techFaceId)
  30. }
  31. })
  32. },
  33. getImgUrlByOssId(ossId){
  34. this.$api.service.getImgUrlByOssId({ossId:ossId}).then(res=>{
  35. this.$set(this.userInfo,'techFaceUrl', res.data.data[0].url.replace(/^http:/, "https:"))
  36. uni.setStorageSync('userInfo', this.userInfo )
  37. })
  38. },
  39. navigateTo(url){
  40. uni.navigateTo({
  41. url:url
  42. })
  43. },
  44. }
  45. }
  46. </script>
  47. <style lang="scss">
  48. @import './index.rpx.css';
  49. </style>