gracePK.nvue 3.6 KB

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