123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- <style lang="sass">
- @import "./../../sass/page/comment.scss";
- </style>
- <template>
- <section class="comment-bd">
- <ul class="list-comment">
- <li class="item-comment" v-for="(filmComment,commentIndex) in filmComments" :key="commentIndex" v-if="commentIndex<5">
- <div class="item-fl">
- <img :src='filmComment.user.head' v-if="filmComment.user">
- </div>
- <div class="item-fr">
- <div class="info">
- <div class="info-fl">
- <h4 v-if="filmComment.user">{{filmComment.user.nick}}</h4>
- <p>{{filmComment.createTime | parseTime}}</p>
- </div>
- <div class="info-fr">
- <span class="icon-zan">{{filmComment.zanCount}}</span>
- <span class="icon-comment">{{filmComment.replyCount}}</span>
- </div>
- </div>
- <div class="cont">
- <p>{{filmComment.extend.text}}</p>
- <ul class="list-pic ext-list" v-if="filmComment.extend.pics.length==1">
- <li v-for="(pic,picIndex) in filmComment.extend.pics" :key="picIndex" class="item-pic" :style="{backgroundImage : 'url('+pic+'?imageview/4/0/w/400/h/400/format/)'}" @click="previewImage(commentIndex,picIndex)"></li>
- </ul>
- <ul class="list-pic" v-else>
- <li v-for="(pic,picIndex) in filmComment.extend.pics" :key="picIndex" class="item-pic" :style="{backgroundImage : 'url('+pic+'?imageview/4/0/w/400/h/400/format/)'}" @click="previewImage(commentIndex,picIndex)"></li>
- </ul>
- <ul class="list-post">
- <li v-for="(replie,index) in filmComment.replies" :key="index"><span v-if="replie.user">{{replie.user.nick}}:</span>{{replie.content}}</li>
- </ul>
- </div>
- <p class="tip" v-if="filmComment.commentaryTitle">评:{{filmComment.commentaryTitle}}</p>
- </div>
- </li>
- </ul>
- <div class="no-comment" v-if="filmComments.length==0">
- <p>暂无评论</p>
- </div>
- <a class="btn-more" :href="downloadUrl" v-if="filmComments.length>5">进入APP查看更多影评</a>
- </section>
- </template>
- <script>
- import lib from 'lib'
- import _ from 'underscore'
- export default {
- data() {
- return{
- downloadUrl : lib.downloadUrl,
- filmComments : [],
- isiOS : navigator.userAgent.match(/(iPhone|iPod|iPad);?/i) //ios终端
- }
- },
- props : ["type","id","hasPlayer"],//评论类型,id,是否属于播放页
- methods : {
- //电影影评列表
- getFilmCommentsByAid(){
- let self = this;
- let url = `${lib.apiUrl}/share/getFilmCommentsByAid.do`;
- let param = {
- aid : self.id,
- channel : "LuciferChannel",
- ver : 1,
- os : 1,
- uid : 1,
- token : "lucifer_test_token"
- }
- $.ajax({
- type: "get",
- url: url,
- data: param,
- dataType: "jsonp",
- success: function (ret) {
- var ret = lib.formatHttpProtocol(ret);
- if (ret.result == 1){
- let filmComments = ret.data.filmComments;
- self.filmComments = filmComments ? filmComments : [];
- setTimeout(function(){
- $("#commentNum").text(self.filmComments.length)
- },0)
- }
- }
- });
- },
- //电影解说影评列表
- getFilmCommentsByCid(){
- let self = this;
- let url = `${lib.apiUrl}/share/getFilmCommentsByCid.do`;
- let param = {
- cid : self.id,
- channel : "LuciferChannel",
- ver : 1,
- os : 1,
- uid : 1,
- token : "lucifer_test_token"
- }
- $.ajax({
- type: "get",
- url: url,
- data: param,
- dataType: "jsonp",
- success: function (ret) {
- var ret = lib.formatHttpProtocol(ret);
- if (ret.result == 1){
- let filmComments = ret.data.filmComments;
- self.filmComments = filmComments ? filmComments : [];
- }
- }
- });
- },
- previewImage(commentIndex,picIndex){
- let self = this;
- let items = [],picList = [],arr = [];
- picList = self.filmComments[commentIndex].extend.pics;
- lib.setPreviewImage(picList,picIndex);
- }
- },
- filters : {
- parseTime(value){
- return lib.handleTime(value).substring(5,17)
- }
- },
- mounted(){
- let self = this
- switch(self.type) {
- case 1 : //电影
- self.getFilmCommentsByAid(self.id)
- break;
- case 2 : //解说视频
- self.getFilmCommentsByCid(self.id)
- break;
- default :
- break;
- }
- }
- }
- </script>
|