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

184 lines
4.0 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.thesisId)">
  18. <view class="left">
  19. <view class="title">{{ item.title }}</view>
  20. <view class="content">{{ item.description }}</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: null,
  47. cid: null,
  48. },
  49. mixinsListApi: 'queryThesisList',
  50. }
  51. },
  52. onLoad({ search, categoryOne, categoryTwo, title }) {
  53. if (search) {
  54. this.keyword = search
  55. this.queryParams.title = search
  56. }
  57. if (categoryTwo) {
  58. this.queryParams.categoryOne = categoryOne
  59. this.queryParams.categoryTwo = categoryTwo
  60. }
  61. if (title) {
  62. this.title = title
  63. }
  64. this.getData()
  65. },
  66. methods: {
  67. search() {
  68. this.queryParams.pageNo = 1
  69. this.queryParams.pageSize = 10
  70. this.queryParams.title = this.keyword
  71. this.getData()
  72. },
  73. getDataThen(list) {
  74. // todo: check
  75. const reg = /\<[^>]*\>/g
  76. this.list = list.map(item => {
  77. const description = item.description.replace(reg, '')
  78. return { ...item, description }
  79. })
  80. },
  81. jumpToDetail(thesisId) {
  82. uni.navigateTo({
  83. url: `/pages_order/thesis/index?thesisId=${thesisId}`
  84. })
  85. },
  86. },
  87. }
  88. </script>
  89. <style scoped lang="scss">
  90. .page__view {
  91. background: $uni-bg-color-grey;
  92. }
  93. .top {
  94. padding: 49rpx 0 17rpx 0;
  95. box-sizing: border-box;
  96. background: $uni-color;
  97. }
  98. .search {
  99. margin: 0 19rpx;
  100. width: calc(100% - 20rpx * 2);
  101. background-color: #FFFFFF;
  102. border-radius: 37rpx;
  103. padding: 13rpx 0 13rpx 18rpx;
  104. box-sizing: border-box;
  105. display: flex;
  106. align-items: center;
  107. /deep/ .uv-search__action {
  108. color: $uni-color;
  109. padding: 10rpx 18rpx;
  110. }
  111. &-icon {
  112. width: 26rpx;
  113. height: auto;
  114. }
  115. }
  116. .main {
  117. padding: 17rpx;
  118. box-sizing: border-box;
  119. }
  120. .card {
  121. background: #ffffff;
  122. border-radius: 20rpx;
  123. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  124. & + & {
  125. margin-top: 27rpx;
  126. }
  127. .left {
  128. flex: 1;
  129. padding: 13rpx 32rpx 35rpx 20rpx;
  130. box-sizing: border-box;
  131. .title {
  132. font-size: 32rpx;
  133. font-weight: 700;
  134. color: #000000;
  135. }
  136. .content {
  137. font-size: 28rpx;
  138. font-weight: 400;
  139. color: #0F2248;
  140. overflow: hidden;
  141. text-overflow: ellipsis;
  142. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  143. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  144. -webkit-line-clamp:7; //显示的行
  145. }
  146. }
  147. .right {
  148. padding: 23rpx 17rpx 23rpx 0;
  149. box-sizing: border-box;
  150. .img {
  151. width: 225rpx;
  152. height: 325rpx;
  153. }
  154. }
  155. }
  156. .empty {
  157. margin-top: 165rpx;
  158. }
  159. </style>