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

201 lines
3.8 KiB

10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
10 months ago
  1. <template>
  2. <!-- 申遗新闻 -->
  3. <view class="apply">
  4. <navbar title="申遗新闻" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="top-img">
  6. <uv-swiper
  7. :list="banner.course"
  8. indicator
  9. height="420rpx"
  10. keyName="imageContent"></uv-swiper>
  11. </view>
  12. <!-- <view class="middle-box">
  13. <view class="middle-img">
  14. <view
  15. :key="index"
  16. :class="{act : item.id == articleType}"
  17. v-for="(item, index) in category">
  18. <image src="../static/applyRelic/2.png" mode="aspectFill" />
  19. </view>
  20. </view>
  21. <view class="middle-font">
  22. <view @click="selectMiddle(item.id)"
  23. :key="index"
  24. v-for="(item, index) in category">
  25. {{ item.name }}
  26. </view>
  27. </view>
  28. </view> -->
  29. <view class="apply-list">
  30. <uv-list @scrolltolower="scrolltolower">
  31. <uv-list-item
  32. :title="item.newsTitle"
  33. :note="$dayjs(item.createTime).format('YYYY-MM-DD')"
  34. :border="true"
  35. v-for="(item,index) in list"
  36. :key="index"
  37. :clickable="true"
  38. @click="toUrl(item)"
  39. >
  40. <template #footer>
  41. <uv-image :src="item.newsImage &&
  42. item.newsImage.split(',')[0]" radius="10rpx" width="240rpx"
  43. height="160rpx" />
  44. </template>
  45. </uv-list-item>
  46. </uv-list>
  47. </view>
  48. <uv-empty
  49. v-if="total == 0"
  50. text="没有找到你需要的哦!"
  51. textSize="30rpx"
  52. iconSize="200rpx"
  53. icon="list"></uv-empty>
  54. <tabber />
  55. </view>
  56. </template>
  57. <script>
  58. import { mapState } from 'vuex'
  59. export default {
  60. data() {
  61. return {
  62. queryParams: {
  63. pageNo: 1,
  64. pageSize: 10,
  65. },
  66. total : 0,
  67. list : [],
  68. articleType : -1,
  69. keyword : '',
  70. category : [],
  71. }
  72. },
  73. computed : {
  74. ...mapState(['banner']),
  75. },
  76. onShow() {
  77. this.queryArticleListByType()
  78. },
  79. onReachBottom() {
  80. this.loadMoreData()
  81. },
  82. onPullDownRefresh(){
  83. this.queryArticleListByType()
  84. },
  85. onLoad(args) {
  86. this.keyword = args.keyword
  87. this.queryArticleListByType()
  88. },
  89. methods: {
  90. queryArticleListByType(){
  91. let query = {
  92. ...this.queryParams,
  93. // categoryId : this.articleType
  94. }
  95. // if(this.articleType == -1){
  96. // return
  97. // }
  98. if(this.keyword){
  99. query.articleTitle = this.keyword
  100. }
  101. this.$api('queryNewsByType', query, res => {
  102. uni.stopPullDownRefresh()
  103. if(res.code == 200){
  104. this.list = res.result.records
  105. this.total = res.result.total
  106. }
  107. })
  108. },
  109. queryNewsTypeList(){
  110. this.$api('queryNewsTypeList', {
  111. pageNo : 1,
  112. pageSize : 9999999,
  113. }, res => {
  114. if(res.code == 200){
  115. this.category = res.result.records
  116. this.selectMiddle(this.category[0].id)
  117. }
  118. })
  119. },
  120. loadMoreData(){
  121. if(this.queryParams.pageSize < this.total){
  122. this.queryParams.pageSize += 10
  123. this.queryArticleListByType()
  124. }
  125. },
  126. toUrl(item){
  127. console.log(item);
  128. this.$utils.navigateTo(`/pages_order/service/newsDetail?id=${item.id}`)
  129. },
  130. selectMiddle(id){
  131. this.articleType = id
  132. this.queryArticleListByType()
  133. },
  134. }
  135. }
  136. </script>
  137. <style scoped lang="scss">
  138. .apply {
  139. .top-img {
  140. }
  141. .middle-box {
  142. display: flex;
  143. position: relative;
  144. height: 220rpx;
  145. align-items: center;
  146. justify-content: space-around;
  147. background-color: #fff;
  148. .middle-img {
  149. display: flex;
  150. align-items: center;
  151. justify-content: space-around;
  152. width: 100%;
  153. view {
  154. width: 160rpx;
  155. height: 160rpx;
  156. border-radius: 50%;
  157. image {
  158. width: 100%;
  159. height: 100%;
  160. }
  161. }
  162. }
  163. .act{
  164. box-shadow: 0 0 18rpx 14rpx #ff000042;
  165. }
  166. .middle-font {
  167. position: absolute;
  168. display: flex;
  169. width: 100%;
  170. justify-content: space-around;
  171. view {
  172. width: 60rpx;
  173. color: #FFFDF6;
  174. font-weight: 600;
  175. }
  176. }
  177. }
  178. .apply-list {
  179. width: 94%;
  180. margin-left: 3%;
  181. /deep/ .uv-list-item{
  182. background-color: #FFFDF6 !important;
  183. }
  184. }
  185. }
  186. </style>