123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412 |
- <template>
- <view>
- <u-navbar></u-navbar>
- <!-- 新闻内容 -->
- <view class="content">
- <view class="title">
- {{info.title}}
- </view>
- <view class="infos">
- <view class="date">
- {{info.createTime}}
- </view>
- <view class="pageview" >
- <view class="icon">
- <u-icon name="eye" size="32"></u-icon>
- </view>
- <view class="number">
- {{info.hits}}
- </view>
- </view>
- </view>
- <view class="text" v-html="info.content">
-
-
- </view>
- <!-- <view class="picture">
- <img src="../../assets/img/articlePic.png" alt="">
- <view class="pic-title">
- 鲍威尔称美联储应“迅速”行动以收紧政策
- </view>
- </view> -->
- </view>
- <!-- 评论 -->
- <view class="comment" v-if="info.title&&info.listComment" >
- <view class="title">
- 精华评论
- </view>
-
- <view class="comment-item" v-for="(item,i) in info.listComment" :key="i" >
- <view class="photo">
- <img :src="item.headImg" alt="">
- </view>
- <view class="details">
- <view class="name-date">
- <view class="name" :class="{
- red:!item.name
- }" >
- {{item.name?item.name:'用户异常'}}
- </view>
- <view class="date">
- {{item.date}}
- </view>
- </view>
- <view class="comment-content">
- {{item.content}}
- <view class="mine" v-if="item.isMine">
- <view class="my-comment">
- 我的评论
- </view>
- <view class="delete" @click="newsCommentsdelete(item.id)">
- 删除
- </view>
- </view>
- </view>
-
- </view>
- </view>
- </view>
-
- <view class="bottom" v-if="userInfo" >
- <view class="input" @click="showMessage=true">
- <view class="inputT">发表评论</view>
- </view>
- <view class="like" :class="{
- red:info.iLike
- }" @click="changeLikes()">
- <view class="icon">
- <u-icon name="thumb-up" size="32"></u-icon>
- </view>
- <view class="number">
-
- </view>
- </view>
- </view>
- <u-popup v-model="showMessage" border-radius="34" mode="bottom" >
- <view class="showMessage">
- <view class="showMessage1"><h3>发表评论</h3></view>
- <view class="showMessage2">
- <textarea name="" id=""
- v-model="content"
- cols="30" rows="5" placeholder="填写内容"></textarea>
- </view>
- <view class="showMessage3">
- <u-button type="primary" @click="submitMessage()">提交</u-button>
- </view>
- </view>
-
- </u-popup>
-
- </view>
- </template>
- <script>
- import * as API from '@/apis/pagejs/news.js'
-
- export default {
- data() {
- return {
- id:"",
- content:"",
- info:{},
- showMessage:false,
- userInfo:null,
- list:[],
-
- recordsTotal:0,
-
- }
- },
- onLoad(op){
- this.id=op.id
- this.userInfo=this.carhelp.getPersonInfo()
- this.getInfo(true)
-
- },
-
- methods: {
- newsCommentsdelete(id){
- uni.showModal({
- title: '提示',
- content: '是否删除评论?',
-
- success: res=>{
- if (res.confirm) {
- this.newsCommentsdeletemethods(id)
- } else if (res.cancel) {
- //('用户点击取消');
- }
- }
- });
- },
- newsCommentsdeletemethods(id){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.newsCommentsdelete(id).then((res) => {
-
- uni.showToast({
- title: "删除成功",
- icon: "none"
- })
-
- this.getInfo();
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- submitMessage(){
- if(!this.content){
- uni.showToast({
- title: "请填写内容",
- icon: "none"
- })
- return
- }
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.commentNews({
- newsId:this.id,
- content:this.content,
- }).then((res) => {
- this.content=""
- uni.showToast({
- title: "提交成功",
- icon: "none"
- })
-
- this.getInfo();
-
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- changeLikes(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
-
- API.changeLikes({
- newsId:this.id
- }).then((res) => {
- uni.hideLoading();
- this.getInfo()
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- getInfo(bl){
- if(bl){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- }
-
- var userId=null
- if(this.userInfo){
- userId=this.userInfo.id
- }
-
- API.detail(this.id,userId).then((res) => {
-
- if(bl){
- uni.hideLoading();
- }
- this.info=res.data;
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- page{
- padding-bottom:100px;
- }
- // 新闻内容
- .content{
- padding: 32rpx 32rpx 48rpx 32rpx;
- background-color: #fff;
- .title{
- color: rgba(16, 16, 16, 1);
- font-size: 20px;
- text-align: justify;
- font-weight: 550;
- }
- .infos{
- display: flex;
- justify-content: space-between;
- padding: 24rpx 0 32rpx 0;
- border-bottom: 1px solid rgba(241, 241, 241, 1);
- color: rgba(119, 119, 119, 1);
- font-size: 12px;
- .pageview{
- display: flex;
- }
- .icon{
- margin-right:8rpx ;
- }
- }
- .text{
- margin-top: 40rpx;
- line-height: 28px;
- color: rgba(51, 51, 51, 1);
- }
- .picture{
-
- margin-top: 40rpx;
- img{
- width: 100%;
- height: 155px;
- }
- .pic-title{
- margin-top: 7px;
- color: rgba(119, 119, 119, 1);
- font-size: 12px;
- text-align: center;
- }
- }
- }
- .showMessage{
- padding: 60rpx 50rpx ;
- .showMessage2{
- background-color: #E5E7EA;
- margin: 40rpx 0;
- textarea{
- padding: 8rpx;
- border-radius:34px;
- }
- }
-
- }
- // 评论
- .comment{
- margin-top:24rpx;
- background-color: #fff;
- padding: 32rpx 32rpx 48rpx 32rpx;
- .title{
- color: rgba(51, 51, 51, 1);
- font-size: 18px;
- }
- .comment-item:last-of-type{
- .comment-content{
- border: none;
- }
- }
- .comment-item{
- display: flex;
- padding-top: 58rpx;
- .photo{
- margin-top: -12px;
- img{
- width: 80rpx;
- height: 80rpx;
- border-radius: 50px;
- }
- }
- .details{
- margin-left: 24rpx;
- width: 100%;
- .name-date{
- display: flex;
- justify-content: space-between;
- .name{
- color: rgba(51, 51, 51, 1);
- font-size: 16px;
- }
- .date{
- color: rgba(119, 119, 119, 1);
- font-size: 12px;
- }
- }
-
- }
- .comment-content{
- margin-top: 16rpx;
- color: rgba(51, 51, 51, 1);
- line-height: 20px;
- border-bottom: 1px solid rgba(232, 232, 232, 1);
- padding-bottom: 40rpx;
- .mine{
- margin-top: 16rpx;
- display: flex;
- justify-content: space-between;
- line-height: 20px;
- .my-comment{
-
- color: rgba(119, 119, 119, 1);
- font-size: 12px;
- border: 1px solid rgba(153, 153, 153, 1);
- padding: 0rpx 12rpx;
- border-radius: 4px;
- }
- .delete{
- color: rgba(119, 119, 119, 1);
- font-size: 12px;
- }
- }
- }
-
-
- }
- }
- .red{
- color: red !important;
- }
- .bottom{
- position: fixed;
- left: 0;
- right: 0;
- bottom: 0;
- background-color: #fff;
- padding: 16rpx 32rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .input{
- background-color: rgba(229, 231, 234, 1);
- height: 32px;
- line-height: 32px;
- border-radius: 8rpx;
- width: 520rpx;
- padding-left: 16rpx;
- }
- /deep/.uni-input-placeholder{
- text-indent: 28rpx;
- }
- /deep/.uni-input-input{
- text-indent: 28rpx;
- }
-
- .like{
- display: flex;
- .number{
- margin-left: 16rpx;
- }
- }
- }
-
- </style>
|