小程序产品库完成
This commit is contained in:
240
src/mods/AppTopic/AppTopic.vue
Normal file
240
src/mods/AppTopic/AppTopic.vue
Normal file
@@ -0,0 +1,240 @@
|
||||
<template>
|
||||
<div class="news">
|
||||
<div class="header">
|
||||
<div class="header-search">
|
||||
<u-icon name="search" class="icon-search" size="40" color="rgba(255,255,255,0.5)"></u-icon>
|
||||
<input placeholder="请输入标题" v-model="title" @confirm="onConfirm" confirm-type="search"
|
||||
placeholder-style="color:rgba(255,255,255,0.5);">
|
||||
</div>
|
||||
</div>
|
||||
<div class="topic-list">
|
||||
<div class="topic-item" v-for="(item, index) in list" :key="index" hover-class="bg-hover"
|
||||
@click="$linkTo(`./detail?id=${item.id}`)">
|
||||
<div class="topic-item__left">
|
||||
<h2>{{ item.title }}</h2>
|
||||
<p>{{ item.publishTime }}</p>
|
||||
</div>
|
||||
<image :src="item.thumbUrl" mode="aspectFill"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="loading">
|
||||
<u-loadmore :status="loadingStatus"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"AppTopic",
|
||||
appName:"热点话题",
|
||||
data() {
|
||||
return {
|
||||
title: '',
|
||||
isLoading: false,
|
||||
list: [],
|
||||
isShowEmpty: false,
|
||||
isMore: false,
|
||||
current: 0,
|
||||
areaId: '',
|
||||
loadingStatus: 'loadmore'
|
||||
}
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.areaId = uni.getStorageSync('areaId')
|
||||
this.getList(uni.getStorageSync('areaId'))
|
||||
},
|
||||
|
||||
methods: {
|
||||
onConfirm() {
|
||||
this.loadingStatus = 'loadmore'
|
||||
this.current = 0
|
||||
this.$loading()
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.getList(this.areaId)
|
||||
})
|
||||
},
|
||||
|
||||
getList(areaId) {
|
||||
if (this.loadingStatus === 'loading' || this.loadingStatus === 'nomore') return
|
||||
|
||||
this.loadingStatus = 'loading'
|
||||
this.$instance.post(`/app/apphotsubject/listForWx?current=${this.current + 1}&size=10&status=1&title=${this.title}`, null, {
|
||||
withoutToken: 1
|
||||
}).then(res => {
|
||||
if (res.code === 0) {
|
||||
if (this.current === 0) {
|
||||
this.list = []
|
||||
}
|
||||
|
||||
const data = res.data.records
|
||||
this.list.push(...data)
|
||||
this.current = this.current + 1
|
||||
this.loadingStatus = 'loadmore'
|
||||
if (!res.data.records.length || res.data.records.length < 10) {
|
||||
this.loadingStatus = 'nomore'
|
||||
}
|
||||
} else {
|
||||
this.loadingStatus = 'loadmore'
|
||||
}
|
||||
}).catch(() => {
|
||||
this.loadingStatus = 'loadmore'
|
||||
})
|
||||
},
|
||||
|
||||
toDetail(id) {
|
||||
this.$linkTo(`./newsDetail?id=${id}&areaId=${this.areaId}`)
|
||||
}
|
||||
},
|
||||
|
||||
onReachBottom() {
|
||||
this.getList(this.areaId)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.news {
|
||||
min-height: 100vh;
|
||||
background: #F3F6F9;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
.loading {
|
||||
margin-top: 40px;
|
||||
}
|
||||
|
||||
.topic-item {
|
||||
display: flex;
|
||||
width: 686px;
|
||||
height: 208px;
|
||||
margin: 32px auto 0;
|
||||
padding: 32px;
|
||||
background: #FFFFFF;
|
||||
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.02);
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
|
||||
.topic-item__left {
|
||||
flex: 1;
|
||||
margin-right: 32px h2 {
|
||||
height: 88px;
|
||||
line-height: 44px;
|
||||
margin-bottom: 16px;
|
||||
color: #333333;
|
||||
font-size: 32px;
|
||||
text-align: justify;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #999999;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
image {
|
||||
flex-shrink: 1;
|
||||
width: 192px;
|
||||
height: 144px;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.noMore {
|
||||
line-height: 90px;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.topic-list {
|
||||
padding-top: 112px;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 11;
|
||||
width: 100%;
|
||||
height: 112px;
|
||||
padding: 20px 0 0 0;
|
||||
background: #4181FF;
|
||||
|
||||
.header-search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
width: 690px;
|
||||
height: 60px;
|
||||
margin: 0 auto8px;
|
||||
padding: 032px;
|
||||
background: rgba(0, 0, 0, .2);
|
||||
border-radius: 30px;
|
||||
|
||||
.icon-search {
|
||||
flex-shrink: 1;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
height: 100%;
|
||||
font-size: 28px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.header-tab {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 80px;
|
||||
padding-top: 16px;
|
||||
background: #2D80FB;
|
||||
|
||||
span {
|
||||
margin-right: 50px;
|
||||
padding-bottom: 24px;
|
||||
font-size: 28px;
|
||||
color: #fff;
|
||||
border-bottom: 4px solid transparent;
|
||||
|
||||
&:last-child {
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: #fff;
|
||||
border-bottom: 4px solid #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.no-more {
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
color: #999;
|
||||
|
||||
image {
|
||||
width: 400px;
|
||||
height: 240px;
|
||||
}
|
||||
|
||||
p {
|
||||
text-align: center;
|
||||
color: #999;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
204
src/mods/AppTopic/detail.vue
Normal file
204
src/mods/AppTopic/detail.vue
Normal file
@@ -0,0 +1,204 @@
|
||||
<template>
|
||||
<div class="topic-detail" v-if="pageShow">
|
||||
<div class="topic-header">
|
||||
<h2>{{ info.title }}</h2>
|
||||
<p>{{ info.publishTime }}</p>
|
||||
<div class="topic-tags">
|
||||
<span v-for="(item, index) in info.keyWords" :key="index">{{ item }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="topic-list">
|
||||
<div class="topic-item" v-for="(item, index) in info.contents" :key="index">
|
||||
<div class="topic-item__top">
|
||||
<image src="/static/img/rmht.png"/>
|
||||
<div class="topic-item__top--right">
|
||||
<h2>{{ item.question }}</h2>
|
||||
<p>{{ item.questionSource }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="topic-item__bottom">
|
||||
<h2 v-if="item.answerSource">
|
||||
<span style="color:#000;"> {{ item.answerSource }} </span>
|
||||
回复
|
||||
</h2>
|
||||
<h2 v-else>话题回复</h2>
|
||||
<p>{{ item.answer }}</p>
|
||||
<div class="topic-item__img">
|
||||
<image v-for="(img, i) in item.files" :key="i" :src="img.url" mode="aspectFill" hover-class="text-hover"
|
||||
@click="preview(img.url, item.files)"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
info: {},
|
||||
id: '',
|
||||
pageShow: false
|
||||
}
|
||||
},
|
||||
|
||||
onLoad(query) {
|
||||
this.$loading()
|
||||
this.id = query.id
|
||||
this.getInfo()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getInfo() {
|
||||
this.$instance.post(`/app/apphotsubject/detailForWx?id=${this.id}`).then(res => {
|
||||
if (res.code === 0) {
|
||||
this.info = res.data
|
||||
if (res.data.keyWords) {
|
||||
this.info.keyWords = res.data.keyWords.split(',')
|
||||
}
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.pageShow = true
|
||||
})
|
||||
this.$hideLoading()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
preview(img, imgs) {
|
||||
uni.previewImage({
|
||||
current: img,
|
||||
urls: imgs.map(v => v.url)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return {
|
||||
title: this.info.title,
|
||||
path: `/mods/AppTopic/detail?id=${this.id}`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.topic-detail {
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.topic-list {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.topic-item__bottom {
|
||||
margin-top: 22px;
|
||||
padding: 24px 24px;
|
||||
background: #FFFFFF;
|
||||
border-radius: 16px;
|
||||
border: 1px solid #D8DDE6;
|
||||
|
||||
.topic-item__img {
|
||||
margin-top: 16px;
|
||||
font-size: 0;
|
||||
|
||||
image {
|
||||
width: 206px;
|
||||
height: 206px;
|
||||
margin: 0 10px 10px 0;
|
||||
border-radius: 8px;
|
||||
|
||||
&:nth-of-type(3n) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
color: #333333;
|
||||
font-size: 32px;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-bottom: 16px;
|
||||
color: #1365DD;
|
||||
font-size: 26px;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-item {
|
||||
margin-bottom: 16px;
|
||||
padding: 32px;
|
||||
background: #fff;
|
||||
|
||||
.topic-item__top--right {
|
||||
flex: 1;
|
||||
|
||||
h2 {
|
||||
line-height: 1.3;
|
||||
margin-bottom: 16px;
|
||||
font-size: 32px;
|
||||
color: #333;
|
||||
text-align: justify;
|
||||
white-space: pre-line;
|
||||
}
|
||||
|
||||
p {
|
||||
color: #343D65;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.topic-item__top {
|
||||
display: flex;
|
||||
|
||||
image {
|
||||
position: relative;
|
||||
top: 6px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.topic-header {
|
||||
padding: 32px 32px 16px;
|
||||
background: #FFFFFF;
|
||||
border-bottom: 1px solid #D8DDE6;
|
||||
|
||||
.topic-tags {
|
||||
font-size: 0;
|
||||
|
||||
span {
|
||||
display: inline-block;
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
margin: 0 16px 16px 0;
|
||||
padding: 016px;
|
||||
color: #6179A7;
|
||||
font-size: 28px;
|
||||
background: #F4F5FA;
|
||||
border-radius: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
line-height: 1.3;
|
||||
margin-bottom: 16px;
|
||||
font-size: 40px;
|
||||
color: #333333;
|
||||
text-align: justify;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-bottom: 16px;
|
||||
color: #999999;
|
||||
font-size: 28px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user