|
|
- <template>
- <view class="page__view">
-
- <!-- 导航栏 -->
- <navbar :title="title" leftClick @leftClick="$utils.navigateBack" bgColor="#4883F9" color="#FFFFFF" />
-
-
- <view class="top">
- <!-- 搜索栏 -->
- <view class="search">
- <uv-search v-model="keyword" placeholder="输入关键词搜索" bgColor="#FBFBFB" @custom="search" @search="search">
- <template #prefix>
- <image class="search-icon" src="@/static/image/icon-search.png" mode="widthFix"></image>
- </template>
- </uv-search>
- </view>
- </view>
-
- <view class="main">
- <template v-if="total">
- <view class="flex card" v-for="item in list" :key="item.id" @click="jumpToDetail(item.thesisId)">
- <view class="left">
- <view class="title">{{ item.title }}</view>
- <view class="content">{{ item.description }}</view>
- </view>
- <view class="right">
- <image class="img" :src="item.image" mode="aspectFill"></image>
- </view>
- </view>
- </template>
- <template v-else>
- <view class="flex empty">
- <image class="empty-icon" src="@/static/image/icon-empty.png" mode="widthFix"></image>
- </view>
- </template>
- </view>
-
- </view>
- </template>
-
- <script>
- import mixinsList from '@/mixins/list.js'
-
- export default {
- mixins: [mixinsList],
- data() {
- return {
- title: '搜索',
- keyword: '',
- queryParams: {
- pageNo: 1,
- pageSize: 10,
- title: null,
- cid: null,
- },
- mixinsListApi: 'queryThesisList',
- }
- },
- onLoad({ search, categoryOne, categoryTwo, title }) {
- if (search) {
- this.keyword = search
- this.queryParams.title = search
- }
- if (categoryTwo) {
- this.queryParams.categoryOne = categoryOne
- this.queryParams.categoryTwo = categoryTwo
- }
- if (title) {
- this.title = title
- }
-
- this.getData()
- },
- methods: {
- search() {
- this.queryParams.pageNo = 1
- this.queryParams.pageSize = 10
- this.queryParams.title = this.keyword
- this.getData()
- },
- getDataThen(list) {
- // todo: check
- const reg = /\<[^>]*\>/g
-
- this.list = list.map(item => {
- const description = item.description.replace(reg, '')
-
- return { ...item, description }
- })
- },
- jumpToDetail(thesisId) {
- uni.navigateTo({
- url: `/pages_order/thesis/index?thesisId=${thesisId}`
- })
- },
- },
- }
- </script>
-
- <style scoped lang="scss">
-
- .page__view {
- background: $uni-bg-color-grey;
- }
-
- .top {
- padding: 49rpx 0 17rpx 0;
- box-sizing: border-box;
- background: $uni-color;
- }
-
- .search {
- margin: 0 19rpx;
- width: calc(100% - 20rpx * 2);
- background-color: #FFFFFF;
- border-radius: 37rpx;
- padding: 13rpx 0 13rpx 18rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
-
- /deep/ .uv-search__action {
- color: $uni-color;
- padding: 10rpx 18rpx;
- }
-
- &-icon {
- width: 26rpx;
- height: auto;
- }
- }
-
- .main {
- padding: 17rpx;
- box-sizing: border-box;
- }
-
- .card {
- background: #ffffff;
- border-radius: 20rpx;
- box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
-
- & + & {
- margin-top: 27rpx;
- }
-
- .left {
- flex: 1;
- padding: 13rpx 32rpx 35rpx 20rpx;
- box-sizing: border-box;
-
- .title {
- font-size: 32rpx;
- font-weight: 700;
- color: #000000;
- }
-
- .content {
- font-size: 28rpx;
- font-weight: 400;
- color: #0F2248;
- overflow: hidden;
- text-overflow: ellipsis;
- display:-webkit-box; //作为弹性伸缩盒子模型显示。
- -webkit-box-orient:vertical; //设置伸缩盒子的子元素排列方式--从上到下垂直排列
- -webkit-line-clamp:7; //显示的行
- }
- }
-
- .right {
- padding: 23rpx 17rpx 23rpx 0;
- box-sizing: border-box;
-
- .img {
- width: 225rpx;
- height: 325rpx;
- }
- }
- }
-
- .empty {
- margin-top: 165rpx;
- width: 100%;
-
- &-icon {
- width: 464rpx;
- height: auto;
- }
- }
-
- </style>
|