景徳镇旅游微信小程序
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.

169 lines
2.9 KiB

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