card.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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. if(options.id!=null){
  25. this.cardId=options.id;
  26. }
  27. this.getCompanyUserCard()
  28. },
  29. methods: {
  30. getCompanyUserCard(){
  31. var data={cardId:this.cardId}
  32. getCompanyUserCard(data).then(
  33. res => {
  34. this.url =res.data.imageUrl
  35. },
  36. rej => {}
  37. );
  38. },
  39. shareQr(){
  40. wx.downloadFile({
  41. url: this.url,
  42. success: (res) => {
  43. wx.showShareImageMenu({
  44. path: res.tempFilePath
  45. })
  46. }
  47. })
  48. },
  49. },
  50. }
  51. </script>
  52. <style lang="less">
  53. page {
  54. height: 100%;
  55. }
  56. .content {
  57. width: 100%;
  58. height: 100%;
  59. }
  60. .images {
  61. display: flex;
  62. align-items: center;
  63. justify-content: center;
  64. height: 100%;
  65. }
  66. .images .slide-image {
  67. width: 80%;
  68. height: auto;
  69. }
  70. .btn-box{
  71. height: 140upx;
  72. z-index: 9999;
  73. width: 100%;
  74. padding: 0rpx 30upx;
  75. position: fixed;
  76. bottom: 0;
  77. left: 0;
  78. box-sizing: border-box;
  79. background-color: #ffffff;
  80. display: flex;
  81. align-items: center;
  82. justify-content: center;
  83. .btn{
  84. width: 100%;
  85. height: 88upx;
  86. line-height: 88upx;
  87. text-align: center;
  88. font-size: 34upx;
  89. font-family: PingFang SC;
  90. font-weight: 400;
  91. color: #FFFFFF;
  92. background:#018C39 !important;
  93. border-radius: 44upx;
  94. }
  95. }
  96. </style>