12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <template>
- <view style="padding: 20upx 32upx;">
- <view style="font-size: 35rpx;padding-bottom: 30upx;">{{aricte.article_title}}</view>
- <view style="color: #999;padding-bottom: 30upx;">{{aricte.article_time}}</view>
- <rich-text :nodes="nodes"></rich-text>
- <view v-if="aricte.ad_type!=0" class="aricte" :class="isclose?'closeacrile':''">
- <view style="display: flex;justify-content: space-between;padding: 20upx 0;">
- <view>{{aricte.ad_title}}</view>
- <view style="color:#4399FC;" @click="close">x关闭</view>
- </view>
- <view @click="godetail" style="padding: 10upx 0upx;position: relative;">
- <image :src=" pictureUrl + '/' + aricte.ad_image" style="height: 600upx;width: 100%;" />
- <view style="color: #fff;position: absolute;bottom: 20upx;left: 20upx;">广告</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- isclose: false,
- pictureUrl: this.pictureUrl,
- article_id: '',
- nodes:'',
- aricte: {}
- }
- },
- onLoad(a) {
- this.article_id = a.id;
- let name = a.name;
- uni.setNavigationBarTitle({
- title: name
- });
- this.getactrile();
- },
-
- methods: {
- godetail() {
- if(this.aricte.ad_type == 1) {
- //商品
- let id = this.aricte.goods_id; // 商品Id
- let store_id = this.aricte.store_id; // 商品Id
- uni.navigateTo({
- url:`/pages/index/shop?id=${id}&store_id=${store_id}`
- })
-
- }else if(this.aricte.ad_type == 2) {
- //商品
- let id = this.aricte.store_id; // 商品Id
- uni.navigateTo({
- url: `/pages/index/hotel?id=${id}`
- });
- }
- },
- close() {
- this.isclose = true;
- },
- getactrile() {
- this.request({
- url: '/v1/entry/news_desc',
- method: 'post',
- data: {
- article_id: this.article_id
- },
- success: (res) => {
- let { data } = res.data;
- this.aricte = data;
- const regex = new RegExp('<img', 'gi');
- data.article_content =data.article_content.replace(regex,`<img class="changeimg"`);
- this.nodes = data.article_content; // 富文本渲染
- }
- })
- }
- },
- }
- </script>
- <style>
- .aricte {
- background-color: #EEEEEE;
- padding: 0 28upx 10upx 28upx;
- }
- .closeacrile {
- display: none;
- }
- .changeimg {
- width: 100%;
- height: auto!important;
- display: block;
- text-align: center;
- }
- </style>
|