123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <template>
- <view class="">
- <u-navbar
- title="详情"
- :placeholder="true"
- :autoBack="true"
- :safeAreaInsetTop="true"
- >
- </u-navbar>
- <view class="page-wrap">
- <view class="base-info" v-if="type=='swiperDetail'">
- <view class="title">{{swiperDetails.name}}</view>
- <view class="info u-flex u-row-between">
- <view class="time">{{swiperDetails.publicTime}}</view>
- <!-- <view class="view-count">{{swiperDetails.viewCount}}</view> -->
- </view>
- </view>
- <view v-else class="base-info">
- <view class="title">{{pageData.title}}</view>
- <view class="info u-flex u-row-between">
- <view class="time">{{pageData.publicTime}}</view>
- <view class="view-count">浏览量:{{pageData.viewCount}}</view>
- </view>
- </view>
-
- <view class="" v-if="type=='swiperDetail'">
- <u--image :src="swiperDetails.sliderImg" :showLoading="true" width="100%" mode="aspectFit"></u--image>
- <!-- <view class="" v-html="swiperDetails.detail"></view> -->
- <u-parse :content="swiperDetails.detail"></u-parse>
- </view>
- <view v-else class="content-wrap">
- <u--image :src="pageData.mainImg" :showLoading="true" width="100%" mode="aspectFit"></u--image>
- <view class="content">
- <u-parse :content="pageData.content"></u-parse>
- <!-- {{pageData.content}} -->
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default{
- data(){
- return{
- id:null,
- type:'',
- pageData:{
- title:'',
- content:''
- },
- swiperDetails:{},
- }
- },
- onLoad(page) {
- this.id = page.id;
- this.type = page.type;
- if(this.type=='swiperDetail'){
- console.log('this.id',this.id);
- this.getSwiperDetails(this.id);
- }else{
- this.getDetails(this.id);
- this.addViewCount(this.id);
- }
-
- },
- methods:{
- getDetails(id){
- this.$u.api.shopNews({id:id}).then(res=>{
- this.pageData = res.data;
- // console.log('res',res);
- }).catch(err=>{
- console.log('shopNews',err.data);
- })
- },
- getSwiperDetails(id){
- this.$u.api.swiperDetails({id:id}).then(res=>{
- this.swiperDetails = res.data;
- // console.log('res',res);
- }).catch(err=>{
- console.log('getSwiperDetails',err.data);
- })
- },
- addViewCount(id){
- this.$u.api.addViewCount({id:id}).then(res=>{
- // console.log('res',res);
- }).catch(err=>{
- console.log('addViewCount',err.data);
- })
- }
- }
- }
- </script>
- <style>
- page{background-color: #F5F5F5;}
- </style>
- <style lang="scss" scoped>
- .title{
- font-size: 36rpx;
- font-weight: 600;
- color: #333333;
- line-height: 50rpx;
- margin-bottom: 20rpx;
- }
- .info{
- margin-bottom: 50rpx;
- font-size: 24rpx;
- font-weight: 400;
- color: #999999;
- line-height: 33rpx;
- }
- .page-wrap{
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- line-height: 44rpx;
- p{
- text-indent: 2em;
- }
- /deep/ .u-image{
- margin-bottom: 20rpx;
- }
- }
- .content{
- font-size: 26rpx;
- font-weight: 400;
- color: #666666;
- line-height: 44rpx;
- margin: 20rpx 0;
- }
- .u-image{
- max-width: 100%;
- }
- </style>
|