yunshangxie/pages/index/new_info.vue

105 lines
2.8 KiB
Vue
Raw Normal View History

2023-12-25 17:56:30 +08:00
<template>
<view style="letter-spacing: 1rpx;">
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="true" backgroundColor="#FFFFFF">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
<view style="padding-left: 15rpx;" @click="goBack()">
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
<view class="tn-margin-top"
style=";text-shadow: 1rpx 0 0 #FFF, 0 1rpx 0 #FFF, -1rpx 0 0 #FFF , 0 -1rpx 0 #FFF;">
<tn-tabs :list="[{name:'详情'}]" :current="topCurrent" activeColor="#000" :bold="false"
:fontSize="36"></tn-tabs>
</view>
</view>
</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<view style="padding: 30rpx;">
2024-04-23 11:58:07 +08:00
<view style="text-align: center;font-size:40rpx;font-weight: 600">{{info.news_title}}</view>
2023-12-25 17:56:30 +08:00
<view style="margin-top: 30rpx;color: #999;">
2024-04-23 11:58:07 +08:00
<text>时间{{info.showtime}}</text>
<text style="margin-left: 20rpx;">来源{{info.news_source}}</text>
2023-12-25 17:56:30 +08:00
</view>
<view style="width: 100%;height: 2rpx;background-color: #eee;margin-top: 30rpx;"></view>
<view>
2024-04-23 11:58:07 +08:00
<!-- <view style="margin-top: 20rpx;position: relative;">-->
<!-- <image src="/static/b1.png"-->
<!-- style="width: 100rpx;height: 100rpx;position: absolute;left: 0;right: 0;top: 38%;z-index: 10;margin: 0 auto;">-->
<!-- </image>-->
<!-- <image src="/static/t7.jpg" style="width: 100%;border-radius: 20rpx;" mode="widthFix">-->
<!-- </image>-->
<!-- </view>-->
<view class="ks_html" style="line-height: 50rpx;margin-top: 20rpx;">
<div v-html="info.news_content"></div>
2023-12-25 17:56:30 +08:00
</view>
</view>
</view>
</view>
</view>
</template>
<script>
2024-04-20 17:56:32 +08:00
import {
newsInfo,
} from '@/util/api.js';
import store from '@/store/index.js'
2023-12-25 17:56:30 +08:00
export default {
data() {
return {
2024-04-23 11:58:07 +08:00
topCurrent: 0,
id: 0,
info: {},
2023-12-25 17:56:30 +08:00
}
},
2024-04-23 11:58:07 +08:00
// mounted() {
// var id = window.location.href.split("=")[1];
// this.id = id;
// this.getNewsInfo();
// },
onLoad(d) {
console.log(d);
this.id = d.id;
this.getNewsInfo();
2024-04-20 17:56:32 +08:00
},
2023-12-25 17:56:30 +08:00
methods: {
2024-04-20 17:56:32 +08:00
getNewsInfo() {
2024-04-23 11:58:07 +08:00
newsInfo({
2024-04-20 17:56:32 +08:00
association_id: store.state.Gid,
2024-04-23 11:58:07 +08:00
news_id: this.id
2024-04-20 17:56:32 +08:00
})
.then(res => {
console.log(res);
if (res.code == 1) {
2024-04-23 11:58:07 +08:00
var key = res.data;
if (key.news_content.indexOf("<img") != -1) {
key.news_content = getApp().addWidthToImages(key.news_content);
}
this.info = key;
2024-04-20 17:56:32 +08:00
}
})
.catch(error => {
uni.showToast({
title: error,
duration: 2000
});
})
},
2023-12-25 17:56:30 +08:00
goBack() {
if (getCurrentPages().length > 1) {
uni.navigateBack()
} else {
uni.redirectTo({
url: '/pages/index/index'
})
}
2024-04-23 11:58:07 +08:00
},
2023-12-25 17:56:30 +08:00
}
}
</script>
<style>
2024-04-23 11:58:07 +08:00
.ks_html img {
width: 100% !important;
}
2024-04-20 17:56:32 +08:00
</style>