123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586 |
- <template>
- <view class="content">
- <view class="text-box">
- <view class="text-title">
- <view class="text-1">{{artData.title}}</view>
- <view class="text-2">
- <view class="name clamp">
- {{artData.mer.name}}
- </view>
- <view class="gg"></view>
- <view class="time">
- {{artData.add_time | getTime}}
- </view>
- <view class="gg"></view>
- <view class="time">
- 已阅读 {{artData.visit}}
- </view>
- </view>
- </view>
- <view class="text-content-title" @click="navTo('/pages/user/dydetail?id=' + artData.mer.id)">
- <view class="title-left-box">
- <view class="image">
- <image :src="artData.mer.headimg" mode=""></image>
- </view>
- <view class="title-left-box-content">
- <view class="title-left-box-name">
- <view class="name-title">
- {{artData.mer.name}}
- </view>
- <view class="name-dingyue" v-if="artData.mer.is_sub==1">
- 已订阅
- </view>
- <view class="name-dingyue" v-else>
- +订阅
- </view>
- </view>
- <view class="title-left-box-title">
- <text>发表文章:{{artData.mer.count}}</text><text
- style="margin-left: 20rpx;">订阅:{{artData.mer.sub}}</text>
- </view>
- </view>
- </view>
- <view class="tt">
- >
- </view>
- </view>
- <view class="content-content" v-html="artData.content"></view>
- </view>
- <view class="pinglun" v-if="plList.length > 0">
- <view class=" pinglun-box ">
- <view class="pinglun-title">
- 评论交流({{plNum}})
- </view>
- <view class="" v-if="isZhankai==true && plIemt.user" v-for="plIemt in plList">
- <view class="pinglun-content" >
- <view class="pinglun-content-left">
- <image :src="plIemt.user.avatar" mode=""></image>
- </view>
- <view class="pinglun-content-right">
- <view class="pinglun-name">
- {{plIemt.user.nickname }}
- </view>
- <view class="pinglun-tit">
- {{plIemt.content}}
- </view>
- <view class="pinglun-time">
- {{plIemt.add_time | getTime}}
- </view>
- </view>
- </view>
- <view class="hf-wrap" v-if="plIemt.to.length > 0">
- <view class="hf" v-for="hfitem in plIemt.to">
- <!-- <text style="color: #3ea8cb;">作者</text> -->
- <text style="color: #3ea8cb;">回复</text>:<text>{{hfitem.content}}</text>
- </view>
- </view>
- <view class="" style="height: 10rpx;" v-if="plIemt.to.length > 0">
-
- </view>
- </view>
-
- <view class="zhankai" @click="zhankai()">
- <view class="all" v-if="isZhankai==true">
- 收起
- </view>
- <view class="all" v-else>
- 展开全部
- </view>
- <image src="../../static/img/top.png" mode="" v-if="isZhankai==true"></image>
- <image src="../../static/img/bottom.png" mode="" v-else></image>
- </view>
- </view>
- </view>
- <view class="look">
- <view class=" look-box ">
- <view class="look-title">
- 相关阅读
- </view>
- <view class="look-content" v-for="(xgItem,index) in xgList"
- @click="navTo('/pages/user/article?id=' + xgItem.id)">
- <view class="look-content-right">
- <view class="look-name">
- {{index + 1}}
- </view>
- <view class="look-tit clamp">
- {{xgItem.title}}
- </view>
- </view>
- <view class="look-time">
- <!-- {{xgItem.visit}}次 -->
- </view>
- </view>
- </view>
- </view>
- <view class="pw">
- </view>
- <view class="send-box" @click="buy()">
- <input type="text" class="input" value="" placeholder="我来聊两句..." confirm-type="发布" v-model="myPl"
- @confirm="subPl" />
- <image src="../../static/img/dianzan.png" mode="" @click="dianZan"></image>
- <!-- <image src="../../static/img/share1.png" mode=""></image> -->
- <text style="color: #999;font-weight: bold;font-size: 28rpx;" @click="subPl">发布</text>
- </view>
- </view>
- </template>
- <script>
- import {
- weixindata,
- shareLoad
- } from '@/utils/wxAuthorized.js';
- import {
- getArtDetail,
- getPlList,
- getXgList,
- dianZan,
- subPl
- } from '@/api/art.js'
- import {
- getTime
- } from '@/utils/rocessor.js'
- export default {
- data() {
- return {
- isDingyue: false, //是否订阅
- plNum: 10, //评论数量
- dyNumber: 10, //订阅人数
- isZhankai: false, //是否展开
- artId: 0,
- artData: {},
- plList: [],
- xgList: [], //相关阅读
- myPl: '', //我的评论
- };
- },
- filters: {
- getTime
- },
- onLoad(opt) {
- if (opt.id) {
- this.artId = opt.id
- }
- this.getArtDetail()
- this.getPlList()
- },
- methods: {
- // 分享
- IndexShare() {
- let obj = this;
- // let money = obj.money;
- let item = {
- link: obj.$store.state.baseURL + '/index/#/pages/user/article?id=' + obj.artId, // 分享链接
- imgUrl: obj.artData.image_input[0],
- desc: obj.artData.synopsis,
- title: obj.artData.title,
- success: console.log('分享加载成功')
- };
- shareLoad(item);
- },
- navTo(url) {
- uni.navigateTo({
- url
- })
- },
- //展开全部
- zhankai() {
- if (this.isZhankai == false) {
- this.isZhankai = true
- } else if (this.isZhankai == true) {
- this.isZhankai = false
- }
- },
- // 获取详情
- getArtDetail() {
- let obj = this
- getArtDetail({}, obj.artId).then(res => {
- console.log(res)
- obj.artData = res.data
- if (obj.artData.content != null) {
- obj.artData.content = obj.artData.content.replace(/<img/g,
- "<img style='max-width:100%;height:auto;'");
- // obj.artData.content = obj.artData.content.replace(/<p style="text-indent:28px/g," <p style='text-indent:28px;text-align: justify;");
- } //小程序商品详情图超出屏幕问题
- this.getXgList(res.data.cid)
- this.IndexShare()
- })
- },
- getPlList() {
- let obj = this
- getPlList({}, obj.artId).then(res => {
- console.log(res)
- obj.plNum = res.data.count
- obj.plList = res.data.list
- // let arr = []//评论列表
- // let brr = []//回复列表
- // if (res.data.list.length > 0) {
- // res.data.list.forEach(item => {
- // if (item.user) {
- // arr.push(item)
- // } else {
- // brr.push(item)
- // }
- // })
- // }
-
- // console.log(arr, brr, 'arr++brr')
- })
- },
- getXgList(cid) {
- let obj = this
- getXgList({
- type: cid
- }).then(res => {
- console.log(res)
- obj.xgList = res.data
- })
- },
- subPl() {
- let obj = this
- console.log('发布评论')
- if (obj.myPl == '') {
- return obj.$api.msg('请输入评论内容')
- }
- subPl({
- content: obj.myPl
- }, obj.artId).then(res => {
- obj.myPl = ''
- obj.$api.msg('发布成功!')
- this.getPlList()
- })
- },
- // 点赞
- dianZan() {
- let obj = this
- dianZan({}, obj.artId).then(res => {
- obj.$api.msg('点赞成功!')
- })
- }
- },
- }
- </script>
- <style lang="scss">
- page,
- .content {
- overflow-x: hidden;
- width: 100%;
- height: 100%;
- }
- .text-box {
- padding: 30rpx;
- border: 1rpx solid #EEEEEE;
- width: 100%;
- background-color: #fff;
- .text-title {
- display: flex;
- flex-direction: column;
- .text-1 {
- font-size: 33rpx;
- font-weight: bold;
- color: #333333;
- margin-bottom: 30rpx;
- }
- .text-2 {
- display: flex;
- align-items: center;
- .name {
- font-size: 25rpx;
- font-weight: 500;
- color: #666666;
- }
- .gg {
- margin: 0 15rpx;
- width: 3rpx;
- height: 25rpx;
- background: #EEEEEE;
- }
- .time {
- flex-shrink: 0;
- font-size: 22rpx;
- font-weight: 500;
- color: #999999;
- }
- }
- }
- }
- .text-content-title {
- margin: 30rpx 0;
- display: flex;
- justify-content: space-between;
- align-items: center;
- background: #F5F5F5;
- padding: 17rpx 30rpx;
- border-radius: 7rpx;
- .title-left-box {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .image {
- width: 85rpx;
- height: 85rpx;
- overflow: hidden;
- border-radius: 50%;
- margin-right: 18rpx;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .title-left-box-content {
- display: flex;
- flex-direction: column;
- .title-left-box-name {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .name-title {
- font-size: 29rpx;
- font-weight: bold;
- color: #333333;
- }
- .name-dingyue {
- margin-left: 15rpx;
- font-size: 24rpx;
- font-weight: bold;
- color: #F3554F;
- width: 92rpx;
- height: 34rpx;
- border: 1rpx solid #F3554F;
- border-radius: 17rpx;
- line-height: 34rpx;
- text-align: center;
- }
- }
- }
- .title-left-box-title {
- text {
- font-size: 20rpx;
- font-weight: 500;
- color: #999999;
- }
- }
- }
- .tt {
- color: #B3B3B3;
- }
- }
- /deep/ .content-content {
- p {
- text-align: justify;
- }
- }
- .pinglun {
- background: #F8F8F8;
- padding: 20rpx 0;
- }
- .pinglun-box {
- background: #FFFFFF;
- .pinglun-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- line-height: 80rpx;
- margin-left: 30rpx;
- }
- .pinglun-content {
- display: flex;
- border-top: 1rpx solid #EEEEEE;
- // border-bottom: 1rpx solid #EEEEEE;
- padding: 30rpx 0 0 30rpx;
- .pinglun-content-left {
- width: 66rpx;
- height: 66rpx;
- border-radius: 50%;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .pinglun-content-right {
- display: flex;
- justify-content: space-between;
- margin-left: 30rpx;
- display: flex;
- flex-direction: column;
- .pinglun-name {
- font-size: 26rpx;
- font-weight: 500;
- color: #333333;
- }
- .pinglun-tit {
- margin: 8rpx 0;
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- }
- .pinglun-time {
- font-size: 22rpx;
- font-weight: bold;
- color: #999999;
- margin-bottom: 15rpx;
- }
- }
- }
- }
- .zhankai {
- padding: 10rpx 0;
- justify-content: center;
- display: flex;
- align-items: center;
- .all {}
- image {
- margin-left: 10rpx;
- width: 20rpx;
- height: 20rpx;
- }
- }
- .look {
- background: #FFFFFF;
- margin-top: 20rpx;
- .look-box {
- margin: 0 30rpx;
- .look-title {
- font-size: 30rpx;
- font-weight: bold;
- color: #333333;
- line-height: 80rpx;
- margin-left: 30rpx;
- }
- .look-content {
- display: flex;
- justify-content: space-between;
- padding: 30rpx 0;
- border-top: 1px solid #EEEEEE;
- border-bottom: 1px solid #EEEEEE;
- .look-content-right {
- display: flex;
- align-items: center;
- .look-name {
- width: 37rpx;
- height: 37rpx;
- background: #EE6231;
- border-radius: 50%;
- font-size: 27rpx;
- font-weight: bold;
- color: #FFFFFF;
- line-height: 37rpx;
- text-align: center;
- }
- .look-tit {
- margin-left: 10rpx;
- width: 500rpx;
- font-size: 27rpx;
- font-weight: 500;
- color: #333333;
- }
- }
- .look-time {}
- }
- }
- }
- .send-box {
- // border-top: 1rpx solid #999999;
- background: #FFFFFF;
- padding: 30rpx;
- width: 100%;
- position: fixed;
- bottom: 0;
- display: flex;
- justify-content: space-around;
- align-items: center;
- .input {
- padding-left: 30rpx;
- width: 550rpx;
- height: 60rpx;
- background: #EEEEEE;
- border-radius: 31rpx;
- }
- image {
- width: 42rpx;
- height: 42rpx;
- }
- }
- .pw {
- height: 120rpx;
- }
- .hf-wrap {
- width: 600rpx;
- background-color: #f4f4f4;
- margin-left: 120rpx;
- padding: 10rpx;
- padding-bottom: 0;
- font-size: 26rpx;
- border-radius: 10rpx;
- .hf {
- padding-bottom: 10rpx;
- }
- }
- </style>
|