gui-pk.vue 4.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="gui-pk-wrap"
  3. :style="{width:width,height:height,borderRadius:borderRadius}">
  4. <!-- 背景 -->
  5. <image
  6. src="https://upload-images.jianshu.io/upload_images/15372054-ef5c77eb84052ec1.png?imageMogr2/auto-orient/strip|imageView2/2/w/750/format/webp"
  7. class="gui-pk-bg" style="width:690rpx; height:460rpx;"></image>
  8. <!-- pk 图标 -->
  9. <view class="gui-pk-icon-wrap gui-flex gui-rows gui-justify-content-center gui-align-items-center"
  10. :style="{width:width, height:height,borderRadius:borderRadius}">
  11. <view class="gui-pk-icon gui-border-box">
  12. <image
  13. src="https://upload-images.jianshu.io/upload_images/15372054-24bbe2c57e61d1a2.png?imageMogr2/auto-orient/strip|imageView2/2/w/140/format/webp"
  14. mode="widthFix" style="width:80rpx; height:80rpx;"></image>
  15. </view>
  16. </view>
  17. <view class="gui-pk gui-flex gui-rows gui-space-between gui-align-items-center"
  18. :style="{width:width, height:height,borderRadius:borderRadius}">
  19. <view class="gui-pk-item gui-flex gui-columns">
  20. <text class="gui-pk-title gui-block-text">{{title[0]}}</text>
  21. <view class="gui-pk-btn-wrap" hover-class="gui-tap" v-if="status == 'button'">
  22. <text class="gui-pk-btn gui-block-text"
  23. data-index="left" @tap="choose">{{btnName}}</text>
  24. </view>
  25. <view class="gui-pk-btn-wrap" v-if="status == 'progress'">
  26. <progress :percent="progress[0]" activeColor="#FFFFFF" :active="active"
  27. stroke-width="3" class="gui-pk-progress" backgroundColor="#3699ff" />
  28. </view>
  29. <text class="gui-pk-text gui-block-text" v-if="status == 'progress'">{{progress[2]}}</text>
  30. </view>
  31. <view class="gui-pk-item">
  32. <text class="gui-pk-title gui-block-text" style="text-align:right;">{{title[1]}}</text>
  33. <view class="gui-pk-btn-wrap gui-flex gui-rows" hover-class="gui-tap"
  34. style="justify-content:flex-end;" v-if="status == 'button'">
  35. <text class="gui-pk-btn gui-block-text"
  36. style="color:#FF0036;" data-index="right" @tap="choose">{{btnName}}</text>
  37. </view>
  38. <view class="gui-pk-btn-wrap" style="justify-content:flex-end;" v-if="status == 'progress'">
  39. <progress :percent="progress[1]" stroke-width="3" class="gui-pk-progress"
  40. :active="active" activeColor="#FFFFFF" backgroundColor="#FF6666"/>
  41. </view>
  42. <text class="gui-pk-text gui-block-text" style="text-align:right;" v-if="status == 'progress'">{{progress[3]}}</text>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default{
  49. name : "gui-pk",
  50. props : {
  51. width : {type:String, default:'690rpx'},
  52. height : {type:String, default:'260rpx'},
  53. borderRadius : {type:String, default:'8rpx'},
  54. title : {type:Array, default:function(){return ['',''];}},
  55. btnName : {type:String, default:'站队'},
  56. status : {type:String, default:'button'},
  57. progress : {type:Array, default:function(){return [80,20,'8000 票', '2000 票'];}}
  58. },
  59. methods:{
  60. choose:function (e) {
  61. this.$emit('choose', e.currentTarget.dataset.index);
  62. }
  63. },
  64. data() {
  65. return {
  66. // #ifndef APP-NVUE
  67. active: true,
  68. // #endif
  69. // #ifdef APP-NVUE
  70. active: false
  71. // #endif
  72. }
  73. },
  74. }
  75. </script>
  76. <style scoped>
  77. .gui-pk-wrap{font-size:0; overflow:hidden; position:relative;}
  78. .gui-pk-bg{position:absolute; left:0; top:0; z-index:1;}
  79. .gui-pk{position:absolute; left:0; top:0; z-index:3;}
  80. .gui-pk-item{width:220rpx; overflow:hidden; padding-left:35rpx; padding-right:35rpx;}
  81. /* #ifndef APP-PLUS */
  82. .gui-pk-item{box-sizing:border-box;}
  83. /* #endif */
  84. .gui-pk-title{color:#FFFFFF; font-size:50rpx; line-height:60rpx;}
  85. .gui-pk-btn-wrap{margin-top:32rpx;}
  86. .gui-pk-btn{width:120rpx; height:50rpx; line-height:50rpx; text-align:center; background-color:#FFFFFF; font-size:24rpx; border-radius:100rpx; color:#3687FF;}
  87. .gui-pk-btn-hv{font-weight:bold;}
  88. .gui-pk-progress{width:150rpx;}
  89. .gui-pk-text{font-size:22rpx; color:#FFFFFF; line-height:50rpx; margin-top:2px;}
  90. .gui-pk-icon-wrap{position:absolute; top:0px; left:0px; z-index:2;}
  91. .gui-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;}
  92. </style>