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

174 lines
3.8 KiB

  1. <template>
  2. <view class="page__view">
  3. <!-- 导航栏 -->
  4. <navbar :title="title" leftClick @leftClick="$utils.navigateBack" bgColor="#4883F9" color="#FFFFFF" />
  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="main">
  16. <template v-if="total">
  17. <view class="flex card" v-for="item in list" :key="item.id" @click="jumpToDetail(item.id)">
  18. <view class="left">
  19. <view class="title">{{ item.title }}</view>
  20. <view class="content">{{ item.shortTitle }}</view>
  21. </view>
  22. <view class="right">
  23. <image class="img" :src="item.image" mode="aspectFill"></image>
  24. </view>
  25. </view>
  26. </template>
  27. <template v-else>
  28. <view class="flex empty">
  29. <image class="empty-icon" src="@/static/image/icon-empty.png" mode="widthFix"></image>
  30. </view>
  31. </template>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import mixinsList from '@/mixins/list.js'
  37. export default {
  38. mixins: [mixinsList],
  39. data() {
  40. return {
  41. title: '搜索',
  42. keyword: '',
  43. queryParams: {
  44. pageNo: 1,
  45. pageSize: 10,
  46. title: '',
  47. },
  48. mixinsListApi: 'queryThesisList',
  49. }
  50. },
  51. onLoad({ search, categoryOne, categoryTwo, title }) {
  52. if (search) {
  53. this.keyword = search
  54. this.queryParams.title = search
  55. }
  56. if (categoryTwo) {
  57. this.queryParams.categoryOne = categoryOne
  58. this.queryParams.categoryTwo = categoryTwo
  59. }
  60. if (title) {
  61. this.title = title
  62. }
  63. this.getData()
  64. },
  65. methods: {
  66. search() {
  67. this.queryParams.pageNo = 1
  68. this.queryParams.pageSize = 10
  69. this.queryParams.title = this.keyword
  70. this.getData()
  71. },
  72. jumpToDetail(thesisId) {
  73. uni.navigateTo({
  74. url: `/pages_order/thesis/index?thesisId=${thesisId}`
  75. })
  76. },
  77. },
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. .page__view {
  82. background: $uni-bg-color-grey;
  83. }
  84. .top {
  85. padding: 49rpx 0 17rpx 0;
  86. box-sizing: border-box;
  87. background: $uni-color;
  88. }
  89. .search {
  90. margin: 0 19rpx;
  91. width: calc(100% - 20rpx * 2);
  92. background-color: #FFFFFF;
  93. border-radius: 37rpx;
  94. padding: 13rpx 0 13rpx 18rpx;
  95. box-sizing: border-box;
  96. display: flex;
  97. align-items: center;
  98. /deep/ .uv-search__action {
  99. color: $uni-color;
  100. padding: 10rpx 18rpx;
  101. }
  102. &-icon {
  103. width: 26rpx;
  104. height: auto;
  105. }
  106. }
  107. .main {
  108. padding: 17rpx;
  109. box-sizing: border-box;
  110. }
  111. .card {
  112. align-items: flex-start;
  113. background: #ffffff;
  114. border-radius: 20rpx;
  115. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  116. & + & {
  117. margin-top: 27rpx;
  118. }
  119. .left {
  120. flex: 1;
  121. padding: 13rpx 32rpx 35rpx 20rpx;
  122. box-sizing: border-box;
  123. .title {
  124. font-size: 32rpx;
  125. font-weight: 700;
  126. color: #000000;
  127. }
  128. .content {
  129. font-size: 28rpx;
  130. font-weight: 400;
  131. color: #0F2248;
  132. overflow: hidden;
  133. text-overflow: ellipsis;
  134. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  135. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  136. -webkit-line-clamp:7; //显示的行
  137. }
  138. }
  139. .right {
  140. padding: 23rpx 17rpx 23rpx 0;
  141. box-sizing: border-box;
  142. .img {
  143. width: 225rpx;
  144. height: 325rpx;
  145. }
  146. }
  147. }
  148. .empty {
  149. margin-top: 165rpx;
  150. }
  151. </style>