card.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="content">
  3. <view class="images">
  4. <image class="slide-image" :src="url" mode="widthFix" show-menu-by-longpress />
  5. </view>
  6. <view class="btn-box">
  7. <view class="btn" @click="shareQr()">分享</view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import { getCompanyUserCard} from '@/api/companyUser'
  13. export default {
  14. components: {
  15. },
  16. props: {},
  17. data: function() {
  18. return {
  19. url:null,
  20. cardId:null,
  21. }
  22. },
  23. onLoad(options) {
  24. console.log(options)
  25. if(options.id!=null){
  26. this.cardId=options.id;
  27. }
  28. this.getCompanyUserCard()
  29. },
  30. methods: {
  31. getCompanyUserCard(){
  32. var data={cardId:this.cardId}
  33. getCompanyUserCard(data).then(
  34. res => {
  35. this.url =res.data.imageUrl
  36. },
  37. rej => {}
  38. );
  39. },
  40. shareQr(){
  41. wx.downloadFile({
  42. url: this.url,
  43. success: (res) => {
  44. wx.showShareImageMenu({
  45. path: res.tempFilePath
  46. })
  47. }
  48. })
  49. },
  50. },
  51. }
  52. </script>
  53. <style lang="less">
  54. page {
  55. height: 100%;
  56. }
  57. .content {
  58. width: 100%;
  59. height: 100%;
  60. }
  61. .images {
  62. display: flex;
  63. align-items: center;
  64. justify-content: center;
  65. height: 100%;
  66. }
  67. .images .slide-image {
  68. width: 80%;
  69. height: auto;
  70. }
  71. .btn-box{
  72. height: 140upx;
  73. z-index: 9999;
  74. width: 100%;
  75. padding: 0rpx 30upx;
  76. position: fixed;
  77. bottom: 0;
  78. left: 0;
  79. box-sizing: border-box;
  80. background-color: #ffffff;
  81. display: flex;
  82. align-items: center;
  83. justify-content: center;
  84. .btn{
  85. width: 100%;
  86. height: 88upx;
  87. line-height: 88upx;
  88. text-align: center;
  89. font-size: 34upx;
  90. font-family: PingFang SC;
  91. font-weight: 400;
  92. color: #FFFFFF;
  93. background:#2BC7B9 !important;
  94. border-radius: 44upx;
  95. }
  96. }
  97. </style>