猎豆优选小程序

lhKF.vue 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <view class="page-wrap">
  3. <image class="bg" src="https://ld.726p.com/ldyx_static/imgs/tjkf_bg.png" mode="widthFix" />
  4. <image class="kf-img" :src="kfImg" :show-menu-by-longpress="true" />
  5. </view>
  6. </template>
  7. <script>
  8. const app = getApp()
  9. export default {
  10. data() {
  11. return {
  12. params: {},
  13. kfImg: '',
  14. kfImgDefault: 'https://ld.726p.com/ldyx_static/imgs/lhkf_default.png',
  15. }
  16. },
  17. onLoad(options) {
  18. console.log('options => ', options)
  19. this.params = {...options}
  20. this.handleGetKfImg()
  21. },
  22. methods: {
  23. async handleGetKfImg () {
  24. try {
  25. const url = this.$api.lh_getUserQrcode;
  26. const params = {
  27. ...this.params
  28. }
  29. uni.showLoading({ title: '加载中...', mask: true })
  30. const { data: res = {} } = await this.$get(url, params);
  31. if (res && res.errno == 0) {
  32. this.kfImg = res.rst.qrcode_url || this.kfImgDefault
  33. } else {
  34. uni.showToast({ title: res.err || '加载失败', icon: 'none' })
  35. }
  36. } catch (error) {
  37. uni.showToast({ title: '服务器错误', icon: 'none' })
  38. } finally {
  39. uni.hideLoading()
  40. }
  41. },
  42. },
  43. }
  44. </script>
  45. <style scoped lang="scss">
  46. .page-wrap {
  47. position: relative;
  48. min-height: 100vh;
  49. background-color: #fff;
  50. .bg {
  51. width: 100vw;
  52. }
  53. .kf-img {
  54. position: absolute;
  55. top: 600rpx;
  56. left: 155rpx;
  57. width: 440rpx;
  58. height: 440rpx;
  59. }
  60. }
  61. </style>