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

244 lines
5.6 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-box" v-if="item.title">
  20. <view class="title">{{ item.title }}</view>
  21. </view>
  22. <view class="content-box" v-if="item.shortTitle">
  23. <view class="content">
  24. {{ item.shortTitle || '' }}
  25. </view>
  26. <view class="dot bottom-left"></view>
  27. <view class="dot top-right"></view>
  28. </view>
  29. </view>
  30. <view class="right">
  31. <image class="img" :src="item.paperImage" mode="aspectFill"></image>
  32. </view>
  33. </view>
  34. </template>
  35. <template v-else>
  36. <view class="flex empty">
  37. <image class="empty-icon" src="@/static/image/icon-empty.png" mode="widthFix"></image>
  38. </view>
  39. </template>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import mixinsList from '@/mixins/list.js'
  45. export default {
  46. mixins: [mixinsList],
  47. data() {
  48. return {
  49. title: '搜索',
  50. keyword: '',
  51. queryParams: {
  52. pageNo: 1,
  53. pageSize: 10,
  54. title: '',
  55. },
  56. mixinsListApi: 'queryThesisList',
  57. }
  58. },
  59. onLoad({ search, categoryOne, categoryTwo, title, api }) {
  60. if (search) {
  61. this.keyword = search
  62. this.queryParams.title = search
  63. }
  64. if (categoryTwo) {
  65. this.queryParams.categoryOne = categoryOne
  66. this.queryParams.categoryTwo = categoryTwo
  67. }
  68. if (title) {
  69. this.title = title
  70. }
  71. if (api) {
  72. this.mixinsListApi = api
  73. }
  74. this.getData()
  75. },
  76. methods: {
  77. search() {
  78. this.queryParams.pageNo = 1
  79. this.queryParams.pageSize = 10
  80. this.queryParams.title = this.keyword
  81. this.getData()
  82. },
  83. jumpToDetail(thesisId) {
  84. let path = this.mixinsListApi == 'queryThesisList' ? '/pages_order/thesis/index' : '/pages_order/thesis/indexTwo'
  85. uni.navigateTo({
  86. url: `${path}?thesisId=${thesisId}`
  87. })
  88. },
  89. },
  90. }
  91. </script>
  92. <style scoped lang="scss">
  93. .page__view {
  94. background: $uni-bg-color-grey;
  95. }
  96. .top {
  97. padding: 49rpx 0 17rpx 0;
  98. box-sizing: border-box;
  99. background: $uni-color;
  100. }
  101. .search {
  102. margin: 0 19rpx;
  103. width: calc(100% - 20rpx * 2);
  104. background-color: #FFFFFF;
  105. border-radius: 37rpx;
  106. padding: 13rpx 0 13rpx 18rpx;
  107. box-sizing: border-box;
  108. display: flex;
  109. align-items: center;
  110. /deep/ .uv-search__action {
  111. color: $uni-color;
  112. padding: 10rpx 18rpx;
  113. }
  114. &-icon {
  115. width: 26rpx;
  116. height: auto;
  117. }
  118. }
  119. .main {
  120. padding: 17rpx;
  121. box-sizing: border-box;
  122. }
  123. .card {
  124. align-items: flex-start;
  125. background: #ffffff;
  126. border-radius: 20rpx;
  127. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  128. & + & {
  129. margin-top: 27rpx;
  130. }
  131. .left {
  132. flex: 1;
  133. position: relative;
  134. // padding: 13rpx 32rpx 35rpx 20rpx;
  135. padding: 13rpx 70rpx 35rpx 20rpx;
  136. box-sizing: border-box;
  137. .title {
  138. font-size: 32rpx;
  139. font-weight: 700;
  140. color: $uni-color;
  141. padding: 4rpx 16rpx;
  142. background: #FFFFFF;
  143. border-radius: 12rpx;
  144. &-box {
  145. position: absolute;
  146. top: 0;
  147. z-index: 1;
  148. display: inline-block;
  149. padding: 4rpx;
  150. background: linear-gradient(to right, $uni-color, #FFFFFF);
  151. border-radius: 14rpx;
  152. transform: translateY(50%);
  153. }
  154. }
  155. .content {
  156. font-size: 24rpx;
  157. font-weight: 400;
  158. color: #000000;
  159. white-space: pre-wrap;
  160. overflow: hidden;
  161. text-overflow: ellipsis;
  162. display:-webkit-box; //作为弹性伸缩盒子模型显示。
  163. -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
  164. -webkit-line-clamp:7; //显示的行
  165. &-box {
  166. margin-top: 40rpx;
  167. position: relative;
  168. padding: 40rpx 16rpx;
  169. border: 4rpx solid $uni-color;
  170. border-radius: 20rpx;
  171. &:after {
  172. content: ' ';
  173. position: absolute;
  174. bottom: 0;
  175. right: 0;
  176. width: 20rpx;
  177. height: 40rpx;
  178. background: #FFFFFF;
  179. transform: translate(4rpx, 4rpx);
  180. }
  181. .dot {
  182. position: absolute;
  183. z-index: 2;
  184. width: 8rpx;
  185. height: 8rpx;
  186. background: $uni-color;
  187. border-radius: 50%;
  188. &.bottom-left {
  189. bottom: 0;
  190. right: 16rpx;
  191. transform: translateY(6rpx);
  192. }
  193. &.top-right {
  194. bottom: 36rpx;
  195. right: 0;
  196. transform: translateX(6rpx);
  197. }
  198. }
  199. }
  200. }
  201. }
  202. .right {
  203. padding: 23rpx 17rpx 23rpx 0;
  204. box-sizing: border-box;
  205. .img {
  206. width: 225rpx;
  207. height: 325rpx;
  208. }
  209. }
  210. }
  211. .empty {
  212. margin-top: 165rpx;
  213. }
  214. </style>