景徳镇旅游微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

158 lines
2.7 KiB

1 year ago
  1. <template>
  2. <uv-popup ref="popup" :round="30" :customStyle="{height: '60vh'}">
  3. <view class="content">
  4. <uv-vtabs
  5. :chain="chain"
  6. :list="areaList"
  7. keyName="areaName"
  8. :barItemBadgeStyle="{right:'20px',top:'12px'}"
  9. @change="change">
  10. <uv-vtabs-item>
  11. <view class="category-title">
  12. 遗产点
  13. </view>
  14. <view class="list">
  15. <view class="item" v-for="(item,index) in list" :key="index"
  16. @click="select(item)">
  17. <view class="item-image">
  18. <image
  19. :src="item.spotImage"
  20. mode="aspectFill"></image>
  21. </view>
  22. <view class="item-unit">
  23. <text class="text">{{item.spotName}}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </uv-vtabs-item>
  28. </uv-vtabs>
  29. </view>
  30. </uv-popup>
  31. </template>
  32. <script>
  33. import { mapState, mapGetters } from 'vuex'
  34. export default {
  35. data() {
  36. return {
  37. chain: false,
  38. areaList : [],
  39. areaIndex: 0,
  40. }
  41. },
  42. computed: {
  43. list(){
  44. return this.spotList.filter(n => {
  45. if(0 != n.categoryId){
  46. return false
  47. }
  48. if(!this.areaList[this.areaIndex]){
  49. return false
  50. }
  51. if(this.areaList[this.areaIndex].id != n.areaId){
  52. return false
  53. }
  54. return true
  55. })
  56. },
  57. ...mapState(['spotList']),
  58. },
  59. created() {
  60. this.queryAreaList()
  61. },
  62. methods: {
  63. change(index) {
  64. this.areaIndex = index;
  65. },
  66. open(){
  67. this.$refs.popup.open('bottom');
  68. },
  69. select(e){
  70. this.$emit('select', e)
  71. this.$refs.popup.close();
  72. },
  73. queryAreaList(){
  74. this.$api('queryAreaList', res => {
  75. if(res.code == 200){
  76. this.areaList = res.result.records
  77. }
  78. })
  79. },
  80. }
  81. }
  82. </script>
  83. <style scoped lang="scss">
  84. .content{
  85. /deep/ .uv-vtabs{
  86. height: 60vh !important;
  87. }
  88. /deep/ .uv-vtabs__bar{
  89. height: 60vh !important;
  90. }
  91. /deep/ .uv-vtabs__content{
  92. height: 60vh !important;
  93. }
  94. .category-title{
  95. position: relative;
  96. display: flex;
  97. justify-content: center;
  98. align-items: center;
  99. height: 120rpx;
  100. &::before,
  101. &::after {
  102. position: absolute;
  103. top: 50%;
  104. content: '';
  105. width: 10%;
  106. border-top: 2rpx solid black;
  107. }
  108. &::before {
  109. left: 25%;
  110. }
  111. &::after {
  112. right: 25%;
  113. }
  114. }
  115. .list{
  116. display: flex;
  117. flex-wrap: wrap;
  118. margin: 0 auto;
  119. width: 490rpx;
  120. .item {
  121. padding: 10rpx 20rpx;
  122. display: flex;
  123. flex-direction: column;
  124. justify-content: center;
  125. align-items: center;
  126. margin-bottom: 20rpx;
  127. .item-image {
  128. width: 120rpx;
  129. height: 120rpx;
  130. image{
  131. height: 100%;
  132. width: 100%;
  133. border-radius: 50%;
  134. }
  135. }
  136. .item-unit {
  137. font-size: 24rpx;
  138. margin-top: 15rpx;
  139. color: #555;
  140. }
  141. }
  142. .gap {
  143. padding: 0 30rpx;
  144. }
  145. }
  146. }
  147. </style>