123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360 |
- <template>
- <view class="container">
- <navbar :config="config" backColor="#666"></navbar>
- <view class="detail" v-if="detail">
- <view class="title">
- {{detail.informationTitle}}
- </view>
- <view class="postMessage">
- <view class="message-info">
- <text>{{detail.informationAuthor}}</text>
- <view @click.stop="onFollow(detail)"
- :class="['follow-status', detail.followStatus ? 'is-follow' : '' ]">
- {{detail.followStatus ? '已关注' : '关注' }}
- </view>
- </view>
- <view class="message-time">{{detail.createTime}}</view>
- </view>
- <view class="content">
- <view class="ql-editor-box" v-html="detail.informationContent">
- </view>
- <!-- <u-parse :domain="$mConfig.imgURL" :html="detail.informationContent"></u-parse> -->
- </view>
- <view class="browse">
- <view class="collect-box look-box" @click.stop="onCollect(detail)">
- <text v-if="detail.collectStatus" class="look-icon is-ok iconfont_yige"></text>
- <text v-else class="collect-icon iconfont_yige"></text>
- <text class="look-name">{{detail.collectStatus ? '已收藏' : '收藏' }}</text>
- </view>
- <view class="look-box">
- <text class="iconfont_yige look-icon"></text>
- <text class="look-name">浏览量:{{detail.browseNum||0}}</text>
- </view>
- </view>
- </view>
- <!-- <view class="footer-box">
- <view class="btn" @click="openKongKim" v-if="detail.jumpType !== null || detail.jumpType !== undefined">
- <text v-if="detail.jumpType == 2">{{detail.resourceModelTitle || '一键前往'}}</text>
- <text v-else>一键前往</text>
- </view>
- <view class="footer-tools">
- <view>
- <text class="iconfont3 look-icon"></text>
- <text>{{detail.browseNum||0}}</text>
- </view>
- </view>
- </view> -->
- <!-- <share ref="shares" :contentHeight="580"></share> -->
- </view>
- </template>
- <script>
- import {
- newsDetial,
- setUserFollow,
- setUserCollect
- } from '@/api/government.js';
- import share from "@/pages/public/share";
- import rate from "@/components/rate.vue"
- export default {
- components: {
- share,
- rate
- },
- data() {
- return {
- config: {
- back: true,
- title: '资讯详情',
- color: '#1A1A1A',
- backgroundColor: [1, "#fff"],
- statusBarFontColor: '#1A1A1A',
- leftSlot: true
- },
- detail: null,
- FollowLoad: false,
- CollectLoad: false,
- }
- },
- onLoad(options) {
- if (options && options.informationId) {
- this.getDetail(options.informationId)
- }
- },
- methods: {
- getDetail(id) {
- newsDetial(id).then(res => {
- if (res.code === 200) {
- this.detail = res.data
- }
- })
- },
- openKongKim() {
- this.$openPage(this.detail)
- },
- // 关注
- onFollow(info) {
- if (!info) return;
- if (this.FollowLoad) {
- return false;
- };
- this.FollowLoad = true;
- uni.showLoading({
- title: '',
- mask: false
- });
- setUserFollow({
- // followId: info.informationId,
- followSourceId: info.informationId,
- // followType: 0
- }).then(res => {
- uni.hideLoading();
- this.detail.followStatus = !this.detail.followStatus;
- uni.showToast({
- title: info.followStatus ? '关注成功' : '取消关注'
- })
- }).catch(err => {
- uni.hideLoading();
- }).finally(() => {
- setTimeout(() => {
- this.FollowLoad = false;
- }, 300)
- })
- },
- // 收藏
- onCollect(info) {
- if (!info) return;
- if (this.CollectLoad) {
- return false;
- };
- this.CollectLoad = true;
- setUserCollect({
- collectSourceId: info.resourceModelId,
- }).then(res => {
- uni.hideLoading();
- this.detail.collectStatus = !this.detail.collectStatus;
- uni.showToast({
- title: info.collectStatus ? '收藏成功' : '取消收藏'
- })
- }).catch(err => {
- uni.hideLoading();
- }).finally(() => {
- setTimeout(() => {
- this.CollectLoad = false;
- }, 300)
- })
- }
- }
- }
- </script>
- <style>
- page {
- background: #fff;
- }
- </style>
- <style lang="scss" scoped>
- .container {
- // padding-bottom: 100rpx;
- }
- .detail {
- padding: 42rpx 30rpx 40rpx 30rpx;
- // margin: 30rpx;
- background-color: #fff;
- border-radius: 20rpx;
- .title {
- margin-bottom: 40rpx;
- font-size: 35rpx;
- font-family: PingFang SC, PingFang SC-Bold;
- font-weight: 700;
- color: #1a1a1a;
- line-height: 56rpx;
- letter-spacing: -0.7rpx;
- }
- .postMessage {
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- padding: 0 10rpx;
- margin-bottom: 30rpx;
- font-size: 26rpx;
- font-family: PingFang SC, PingFang SC-Medium;
- font-weight: 500;
- color: #999999;
- .message-info {
- width: 100%;
- display: flex;
- align-items: center;
- flex-wrap: wrap;
- justify-content: space-between;
- .follow-status {
- margin-left: 20rpx;
- flex-shrink: 0;
- padding: 5rpx 20rpx;
- background-color: #3CBACF;
- color: #fff;
- border-radius: 8rpx;
- }
- .is-follow {
- background-color: #ccc;
- }
- }
- .message-time {
- width: 100%;
- padding-top: 10rpx;
- }
- .mb20 {
- margin-bottom: 20rpx;
- }
- .icon-img {
- margin-right: 8rpx;
- color: #FA6138;
- font-size: 36rpx;
- }
- }
- .look-box {
- display: flex;
- align-items: center;
- .collect-icon{
- font-size: 32rpx;
- margin-right: 8rpx;
- }
- .look-icon {
- font-size: 36rpx;
- margin-right: 8rpx;
- }
-
- }
- * {
- word-break: break-all;
- }
- .content /deep/ img {
- max-width: 100%;
- }
- .content /deep/ .ql-align-center {
- text-align: center;
- }
- .content /deep/ .ql-align-right {
- text-align: right;
- }
- .content /deep/ blockquote {
- display: block;
- border-left: 8px solid #d0e5f2;
- padding: 5px 10px;
- margin: 10px 0;
- line-height: 1.4;
- font-size: 100%;
- background-color: #f1f1f1;
- }
- .content /deep/ .ql-indent-1 {
- margin-left: 60rpx;
- }
- .content /deep/ .ql-indent-2 {
- margin-left: 120rpx;
- }
- .content /deep/ .ql-indent-3 {
- margin-left: 180rpx;
- }
- .content /deep/ .ql-indent-4 {
- margin-left: 240rpx;
- }
- .content /deep/ .ql-indent-5 {
- margin-left: 300rpx;
- }
- .content {
- /deep/ .ql-editor-box {
- .ql-video {
- width: 100%;
- // height: 45vw;
- }
- }
- }
- .browse {
- margin-top: 30rpx;
- font-size: 24rpx;
- font-family: PingFang SC, PingFang SC-Medium;
- font-weight: 500;
- color: #999999;
- display: flex;
- align-items: center;
- .collect-box {
- margin-right: 20rpx;
- // .look-icon {
- // margin-right: 10rpx;
- // }
- .is-ok {
- color: red;
- }
- }
- }
- }
- .footer-box {
- position: fixed;
- left: 0;
- bottom: 0;
- width: 100%;
- padding: 30rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- background-color: #fff;
- box-shadow: 0 0 6rpx 6rpx rgba(0, 0, 0, .1);
- }
- .btn {
- max-width: 400rpx;
- padding: 0 20rpx;
- line-height: 60rpx;
- text-align: center;
- color: #fff;
- background-color: #3775F6;
- border-radius: 8rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .footer-tools {
- flex-shrink: 0;
- .look-icon {
- margin-right: 4rpx;
- font-size: 40rpx;
- }
- &>view {
- display: flex;
- align-items: center;
- font-size: 30rpx;
- }
- }
- </style>
|