吉光研途前端代码仓库
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.

124 lines
2.5 KiB

2 months ago
  1. <template>
  2. <view class="page__view">
  3. <!-- 导航栏 -->
  4. <navbar :title="title" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="top">
  6. <!-- 搜索栏 -->
  7. <view class="search">
  8. <uv-search v-model="keyword" placeholder="输入关键词搜索" bgColor="#FBFBFB" @custom="search" @search="search">
  9. <template #prefix>
  10. <image class="search-icon" src="@/static/image/icon-search.png" mode="widthFix"></image>
  11. </template>
  12. </uv-search>
  13. </view>
  14. </view>
  15. <view class="list">
  16. <view class="list-item"
  17. v-for="item in list"
  18. :key="item.id"
  19. @click="jumpToDetail(item.id, item.title)"
  20. >
  21. <image class="list-item-bg" :src="item.image" mode="scaleToFill"></image>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import mixinsList from '@/mixins/list.js'
  28. export default {
  29. mixins: [mixinsList],
  30. data() {
  31. return {
  32. title: '搜索',
  33. keyword: '',
  34. queryParams: {
  35. pageNo: 1,
  36. pageSize: 10,
  37. categoryId: '',
  38. title: '',
  39. },
  40. mixinsListApi: 'queryServiceArticleList',
  41. }
  42. },
  43. onLoad(arg) {
  44. const { categoryId, title } = arg
  45. this.title = title
  46. this.queryParams.categoryId = categoryId
  47. this.getData()
  48. },
  49. methods: {
  50. search() {
  51. this.queryParams.pageNo = 1
  52. this.queryParams.pageSize = 10
  53. this.queryParams.title = this.keyword
  54. this.getData()
  55. },
  56. jumpToDetail(articleId) {
  57. uni.navigateTo({
  58. url: `/pages_order/serve/index?articleId=${articleId}`
  59. })
  60. },
  61. },
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .top {
  66. padding: 49rpx 0 17rpx 0;
  67. box-sizing: border-box;
  68. }
  69. .search {
  70. margin: 0 19rpx;
  71. width: calc(100% - 20rpx * 2);
  72. background-color: #FFFFFF;
  73. border-radius: 37rpx;
  74. padding: 13rpx 0 13rpx 18rpx;
  75. box-sizing: border-box;
  76. display: flex;
  77. align-items: center;
  78. /deep/ .uv-search__action {
  79. color: $uni-color;
  80. padding: 10rpx 18rpx;
  81. }
  82. &-icon {
  83. width: 26rpx;
  84. height: auto;
  85. }
  86. }
  87. .list {
  88. margin: 0 18rpx;
  89. &-item {
  90. position: relative;
  91. font-size: 0;
  92. border-radius: 25rpx;
  93. overflow: hidden;
  94. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  95. & + & {
  96. margin-top: 32rpx;
  97. }
  98. &-bg {
  99. $w: calc(100vw - 18rpx*2);
  100. width: $w;
  101. height: calc(#{$w} * 179 / 714);
  102. }
  103. }
  104. }
  105. </style>