task_ima_tab.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <template>
  2. <view class="task-tab">
  3. <scroll-view class="scroll-Y row" scroll-x="true">
  4. <view class="z-tabs-scroll-view row-justify-sb center" style="position: relative;">
  5. <view class="column-c p-lr30 p-t30 p-b20" v-for="(item,index) in navList" :key="index"
  6. @click="setType(index)">
  7. <image class="wh-60 r-circle" :class="index===current?'double-border':''" :src="item.product_icon"
  8. mode="aspectFill">
  9. </image>
  10. <view class="m-t16 sys-size-24 sys-weight-600" :class="{'default-text':index===current}">
  11. {{item.briefness_name}}
  12. </view>
  13. </view>
  14. <view class="half-circle m-t20"></view>
  15. </view>
  16. </scroll-view>
  17. </view>
  18. </template>
  19. <script>
  20. import {
  21. getTaskType
  22. } from "@/api/task";
  23. <<<<<<< HEAD:page_task/module/task_ima_tab.vue
  24. export default {
  25. =======
  26. export default {
  27. name:'task-ima-tab',
  28. >>>>>>> 115515895717a610da60bb7ef15828663115e978:common/task/task_ima_tab.vue
  29. data() {
  30. return {
  31. current: 0,
  32. navList: [{
  33. id: 0,
  34. briefness_name: '全部',
  35. product_icon: '/static/img/task/task-all.png'
  36. }]
  37. }
  38. },
  39. mounted() {
  40. this.getTaskType()
  41. },
  42. methods: {
  43. getTaskType() {
  44. getTaskType().then(res => {
  45. if (res.code === 1) {
  46. this.navList.push(...res.data)
  47. }
  48. })
  49. },
  50. setType(current) {
  51. // this.$nextTick(() => {
  52. // uni.createSelectorQuery().in(this).select(".z-tabs-scroll-view").fields({
  53. // scrollOffset: true
  54. // }, data => {
  55. // if (data) {
  56. // this.currentScrollLeft = data.scrollLeft;
  57. // console.log(data);
  58. // } else {}
  59. // }).exec();
  60. // })
  61. if (current !== this.current) {
  62. this.current = current
  63. this.$emit('setProductId', this.navList[current].id)
  64. }
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .task-tab {
  71. margin: 0 20rpx;
  72. border-radius: 30rpx;
  73. background: #fff;
  74. width: calc(100% - 40rpx);
  75. }
  76. .default-text {
  77. color: #10B261;
  78. }
  79. .half-circle {
  80. width: 20rpx;
  81. height: 10rpx;
  82. background-color: #3eaf7c;
  83. border-top-left-radius: 10rpx;
  84. border-top-right-radius: 10rpx;
  85. position: absolute;
  86. bottom: 0;
  87. left: calc(25%/2 - 10rpx);
  88. }
  89. .half-transition {
  90. transition: all .5s ease;
  91. }
  92. .tab-item {
  93. // width: 25%;
  94. }
  95. .double-border {
  96. box-shadow: 0 0 0 6rpx #fff, 0 0 0 12rpx #10B261;
  97. }
  98. </style>