dialogPanel.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <template>
  2. <uni-popup ref="main" type="center">
  3. <view class="pop">
  4. <view class="title"><text>识别下方二维码即可购买</text></view>
  5. <view style="margin-left:30rpx;width: 580rpx;height: 2rpx;background: #F0F0F0;"></view>
  6. <view class="img">
  7. <image :src="imgUrl" mode="aspectFit"/>
  8. </view>
  9. <view class="btn">
  10. <view class="cancel" @click="$refs.main.close()"><text>取消</text></view>
  11. <view class="download" @click="saveImg"><text>保存图片</text></view>
  12. </view>
  13. </view>
  14. </uni-popup>
  15. </template>
  16. <script>
  17. export default{
  18. name: "dialog-panel",
  19. data(){
  20. return {
  21. imgUrl:""
  22. }
  23. },
  24. methods:{
  25. show(arg){
  26. this.imgUrl = arg
  27. this.$refs.main.open()
  28. },
  29. saveImg(){
  30. uni.getImageInfo({
  31. src: this.imgUrl,
  32. success:(res)=>{
  33. uni.saveImageToPhotosAlbum({
  34. filePath: res.path,
  35. success(_) {
  36. uni.showToast({
  37. title: '已保存到相册',
  38. icon: 'success',
  39. duration: 2000
  40. })
  41. },
  42. fail(err){
  43. console.log(err)
  44. }
  45. })
  46. }
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style scoped lang="scss">
  53. $pageColor:#F9F9F9;
  54. $bgColor:#FFFFFF;
  55. @mixin flexlayout {
  56. display: flex;
  57. align-items: center;
  58. justify-content: center;
  59. }
  60. .pop {
  61. width: 640rpx;
  62. height: 740rpx;
  63. background: #FFFFFF;
  64. border-radius: 20rpx;
  65. padding-top: 32rpx;
  66. box-sizing: border-box;
  67. .title {
  68. @include flexlayout();
  69. margin-bottom: 32rpx;
  70. text {
  71. font-size: 34rpx;
  72. font-family: PingFangSC-Medium, PingFang SC;
  73. font-weight: 500;
  74. color: #000;
  75. }
  76. }
  77. .img {
  78. margin-left: 48rpx;
  79. width: 544rpx;
  80. height: 484rpx;
  81. background: $bgColor;
  82. border-radius: 12rpx;
  83. @include flexlayout();
  84. margin-bottom: 32rpx;
  85. image {
  86. width: 420rpx;
  87. height: 440rpx;
  88. border-radius: 12rpx;
  89. }
  90. }
  91. .textfont {
  92. margin-left: 30rpx;
  93. margin-bottom: 40rpx;
  94. @include flexlayout();
  95. width: 572rpx;
  96. height: 106rpx;
  97. text {
  98. text-align: center;
  99. font-size: 34rpx;
  100. font-weight: 400;
  101. color: #828282;
  102. }
  103. }
  104. .btn {
  105. width: 100%;
  106. height: 110rpx;
  107. display: flex;
  108. align-items: center;
  109. .cancel {
  110. @include flexlayout();
  111. width: 50%;
  112. height: 100%;
  113. border-top: #E5E5E5 solid 1rpx;
  114. border-right: #E5E5E5 solid 1rpx;
  115. text {
  116. font-size: 32rpx;
  117. font-family: PingFangSC-Medium, PingFang SC;
  118. font-weight: 500;
  119. color: #666666;
  120. }
  121. }
  122. .download {
  123. border-top: #E5E5E5 solid 1rpx;
  124. // border-left:#E5E5E5 solid 0.3rpx;
  125. @include flexlayout();
  126. height: 100%;
  127. width: 50%;
  128. text {
  129. font-size: 32rpx;
  130. font-family: PingFangSC-Medium, PingFang SC;
  131. font-weight: 500;
  132. color: #FF7119;
  133. }
  134. }
  135. }
  136. }
  137. </style>