statistics_title.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <template>
  2. <view class="m-b20 statistics_title">
  3. <view class="row-justify-sb center">
  4. <view class="row-c left">
  5. <view class="circle column-c justify-center">
  6. <view class="outer" :style="{background:bgColor[genre]}"></view>
  7. <view class="inside" :style="{background:bgColor[genre]}"></view>
  8. </view>
  9. <text class="size-28 text-color-12 sys-weight-600 m-l16">{{leftText}}</text>
  10. </view>
  11. <view class="row-c line-40" v-if="is_right && !is_age" @click="onHandle">
  12. <text class="size-24 text-color-8F9 m-r6">{{rightText}}</text>
  13. <uni-icons type="forward" size="16" color="#8F99B1"></uni-icons>
  14. </view>
  15. <view v-else></view>
  16. <view class="row-c" v-if="is_age">
  17. <view class="row-c m-l20" v-for="(item,index) in list" :key="index">
  18. <view class="wh-14 m-r10" :style="{background:item.color}"></view>
  19. <text class="size-24 text-color-576">{{item.name}}</text>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. name: 'statistics_title',
  28. props: {
  29. genre: {
  30. type: Number,
  31. default: 0
  32. },
  33. leftText: {
  34. type: String,
  35. default: ''
  36. },
  37. rightText: {
  38. type: String,
  39. default: ''
  40. },
  41. is_right: {
  42. type: Boolean,
  43. default: true
  44. },
  45. is_age: {
  46. type: Boolean,
  47. default: false
  48. },
  49. },
  50. data() {
  51. return {
  52. bgColor: ['#0FB160', '#FE7F37', '#10A2B0', '#DE2519'],
  53. list: [{
  54. name: '男',
  55. color: '#FFD023'
  56. }, {
  57. name: '女',
  58. color: '#00BF8A'
  59. }]
  60. };
  61. },
  62. methods: {
  63. onHandle() {
  64. this.$emit('onHandle')
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .statistics_title {
  71. .left {
  72. line-height: 40rpx;
  73. .circle {
  74. position: relative;
  75. .outer {
  76. width: 35rpx;
  77. height: 35rpx;
  78. opacity: 0.2;
  79. border-radius: 50%;
  80. }
  81. .inside {
  82. width: 12rpx;
  83. height: 12rpx;
  84. border-radius: 50%;
  85. position: absolute;
  86. top: calc(50% - 6rpx);
  87. }
  88. }
  89. }
  90. .right {
  91. line-height: 35rpx;
  92. }
  93. }
  94. </style>