gracePK.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="grace-pk" :style="{height:height,borderRadius:borderRadius}">
  3. <view class="grace-pk-item">
  4. <text class="grace-pk-title">{{title[0]}}</text>
  5. <view class="grace-pk-btn-wrap" v-if="status == 'button'">
  6. <view class="grace-pk-btn" hover-class="grace-pk-btn-hv"
  7. data-index="left" @tap="choose">{{btnName}}</view>
  8. </view>
  9. <view class="grace-pk-btn-wrap" v-if="status == 'progress'">
  10. <progress :percent="progress[0]" stroke-width="3" class="grace-pk-progress" active
  11. activeColor="#FFFFFF" border-radius="10" backgroundColor="#3699ff"/>
  12. </view>
  13. <view class="grace-pk-text" v-if="status == 'progress'">{{progress[2]}}</view>
  14. </view>
  15. <view class="grace-pk-item">
  16. <text class="grace-pk-title" style="text-align:right;">{{title[1]}}</text>
  17. <view class="grace-pk-btn-wrap" style="justify-content:flex-end;" v-if="status == 'button'">
  18. <view class="grace-pk-btn" hover-class="grace-pk-btn-hv"
  19. style="color:#FF0036;" data-index="right" @tap="choose">{{btnName}}</view>
  20. </view>
  21. <view class="grace-pk-btn-wrap" style="justify-content:flex-end;" v-if="status == 'progress'">
  22. <progress :percent="progress[1]" active stroke-width="3" class="grace-pk-progress"
  23. activeColor="#FFFFFF" border-radius="10" backgroundColor="#FF6666"/>
  24. </view>
  25. <view class="grace-pk-text" style="text-align:right;" v-if="status == 'progress'">{{progress[3]}}</view>
  26. </view>
  27. <view class="grace-pk-icon">
  28. <image src="https://img-cdn-qiniu.dcloud.net.cn/uploads/article/20200806/84515c21a39e8382addbeca53462e3a0.png"
  29. mode="widthFix" style="width:88rpx; height:88rpx;"></image>
  30. </view>
  31. </view>
  32. </template>
  33. <script>
  34. export default{
  35. props:{
  36. height : {type:String, default:'260rpx'},
  37. borderRadius : {type:String, default:'8rpx'},
  38. title : {type:Array, default:function(){return ['',''];}},
  39. btnName : {type:String, default:'站队'},
  40. status : {type:String, default:'button'},
  41. progress : {type:Array, default:function(){return [80,20,'8000 票', '2000 票'];}}
  42. },
  43. methods:{
  44. choose:function (e) {
  45. this.$emit('choose', e.currentTarget.dataset.index);
  46. }
  47. }
  48. }
  49. </script>
  50. <style>
  51. .grace-pk{display:flex; flex-direction:row; justify-content:space-between; background-image:url(https://img-cdn-qiniu.dcloud.net.cn/uploads/article/20200806/24692285f85690abbc762512ce22d2c5.png); background-repeat:repeat-y; background-size:100% auto; background-position:left center; position:relative;}
  52. .grace-pk-item{width:750rpx; overflow:hidden; padding:0rpx 35rpx; box-sizing:border-box; display:flex; flex-direction:column; justify-content:center;}
  53. .grace-pk-title{display:block; color:#FFFFFF; font-size:50rpx; line-height:60rpx;}
  54. .grace-pk-btn-wrap{display:flex; flex-direction:row; margin-top:32rpx;}
  55. .grace-pk-btn{width:150rpx; height:50rpx; line-height:50rpx; text-align:center; background-color:#FFFFFF; font-size:22rpx; border-radius:100rpx; color:#3687FF;}
  56. .grace-pk-btn-hv{font-weight:bold;}
  57. .grace-pk-progress{width:200rpx;}
  58. .grace-pk-text{font-size:22rpx; color:#FFFFFF; line-height:50rpx; margin-top:2px;}
  59. .grace-pk-icon{width:88rpx; height:88rpx; background-color:#FFFFFF; border-radius:100rpx; font-size:0; position:absolute; top:50%; left: 50%; transform: translate(-50%, -50%); padding:20rpx;}
  60. </style>