commentN.nvue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757
  1. <template>
  2. <view class="es content es-bc-white" style="position:relative;" @touchmove.stop @tap="hideKeyboard">
  3. <view class="comtentBox es-bc-white es-pb-40 es-br-20 flex" @tap="hideKeyboard" >
  4. <view class="es es-h-60">
  5. <view class="es es-ac es-view-w-x es-h-60 es-pt-25" >
  6. <image class="es-w-35 es-h-31" src="../../../static/image/hall/pingjia_icon.png"></image>
  7. <text class="es-ml-20 es-fs-30 es-fw-600 es-f1">评论</text>
  8. <text class="es-ml-1 es-fs-30 es-c-99">({{totalNum}})</text>
  9. </view>
  10. <image style="position: absolute;right:30rpx;top:20rpx" @tap.stop="closePopup()" class="es-w-40 es-h-40" src="../../../static/images/close40.png"></image>
  11. </view>
  12. <view class="es-view-w-x es-mt-15" >
  13. <view class="es es-ac es-mt-10 es-c" style="border-bottom: 1px #FAFAFA solid;">
  14. <view class="es-on-act nav es-icon-auto es es-ac es-pc x-c es-br-10" :class="sortType==1?'ac':'br'" @tap="tapCommentType(1)">
  15. <image src="../../../static/images/other/course/icon-2.png" class="es-icon-20"></image>
  16. <text class="es-ml-19 es-fs-28 es-c" :class="1?'es-fw-600':''">热度</text>
  17. </view>
  18. <view class="es-on-act nav es-icon-auto es es-ac es-pc es-br-10 es-ml-14" :class="sortType==2?'ac':'br'" @tap="tapCommentType(2)">
  19. <image src="../../../static/images/other/course/icon-2.png" class="es-icon-20"></image>
  20. <text class="es-ml-19 es-fs-28 es-c" :class="0?'es-fw-600':''">时间</text>
  21. </view>
  22. </view>
  23. <list loadmoreoffset="100" @loadmore="loadmore" :style="{'height':listHei+'px'}" @tap="hideKeyboard">
  24. <refresh @pullingdown='onpullingdown' @refresh="onrefresh" :display=" refreshing ? 'show' : 'hide' " class="refresh x-c ">
  25. <loading-indicator style="width: 22px;height: 22px;color:#999;"></loading-indicator>
  26. <text class="es-fs-32 es-ml-8">{{refreshText}}</text>
  27. </refresh>
  28. <cell v-for="(item, index) in dataList" :key="index">
  29. <view class="es es-mt-30" >
  30. <image class="es-icon-80 es-br" :src="isEmpty(item.avatar)?defHeadImg:item.avatar"></image>
  31. <view class="es-f1 es-ml-21" style="display:flex;flex:1;">
  32. <text class="es-fs-30 es-fw">{{ isEmpty(item.nickName)?"暂无昵称":item.nickName }}</text>
  33. <text class="es-c-99 es-fs-26 es-mt-4">{{ formatDate(item.createTime) }}</text>
  34. <text class="es-fs-28 es-fw-500 es-pt-24 es-pb-25" :style="{width: comWidth+'px'}">{{item.content}}</text>
  35. <view class="es es-c-99 es-pb-10 ">
  36. <view class="es es-ac" @tap="doLike(item,index)">
  37. <image class="es-icon-28" :src="item.liked?'../../../static/image/hall/dianzan_on_icon.png':'../../../static/image/hall/dianzan_icon.png'"></image>
  38. <text class="es-ml-11 es-fs-26">{{item.likes}}</text>
  39. </view>
  40. <view class="es es-ac es-ml-23" @tap.stop="doReply(item)">
  41. <image class="es-icon-28" src="../../../static/image/hall/pingjia_icon.png"></image>
  42. <text class="es-ml-11 es-fs-26">{{item.replyCount}}</text>
  43. </view>
  44. <view class="es-f1"></view>
  45. <view class="es es-ac es-pc es-icon-33" style="position:absolute;right:20rpx;" v-if="isMySend(item)" @tap="delComment(item,0)">
  46. <image src="../../../static/images/del.png" class="es-w-32 es-h-32"></image>
  47. </view>
  48. </view>
  49. <view v-if="item.replyList && item.replyList.length>0" class="es-br-20 es-pt-10 es-pb-10 es-view-w-x es-mt-25" style="background-color: #F6F9F8;">
  50. <view class="es es-pt-20 es-pb-20" :class="idx<item.replyList.length-1?'comment-reply-item':''" v-for="(cItem,idx) in item.replyList" :key="idx">
  51. <image class="es-icon-60 es-br" :src="isEmpty(cItem.avatar)?defHeadImg:cItem.avatar"></image>
  52. <view class="es-f1 es-ml-11 flex" style="display:flex;flex:1;">
  53. <text class="es-fs-30 es-fw-600">{{cItem.nickName}}</text>
  54. <text class="es-fs-26 es-c-99 es-mt-10 es-mb-10">{{ formatDate(cItem.createTime) }}</text>
  55. <text class="es-fs-28 es-fw-500 es-pt-14 es-pb-14" :style="{width: replyWidth+'px'}">{{cItem.content}}</text>
  56. <view class="es es-c-99 es-pb-10 ">
  57. <view class="es es-ac" @tap="doReplyLike(cItem,idx,index)">
  58. <image class="es-icon-28" :src="cItem.liked?'../../../static/image/hall/dianzan_on_icon.png':'../../../static/image/hall/dianzan_icon.png'"></image>
  59. <text class="es-ml-11 es-fs-26">{{cItem.likes}}</text>
  60. </view>
  61. <view class="es-f1" style="background-color: red;"></view>
  62. <view class="es es-ac es-pc es-icon-33" style="position:absolute;right:20rpx;" v-if="isMySend(cItem)" @tap="delComment(cItem,1)">
  63. <image src="../../../static/images/del.png" class="es-w-32 es-h-32"></image>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <view @tap="replayClick(item,index)" v-if="item.showReplyBtn" class="es es-ac es-mt-20 es-pb-20">
  70. <view class="es-f1"></view>
  71. <text class="es es-ac es-fs-24 es es-ac es-pc es-pt-10 es-pb-10 es-c-99">
  72. ——展开更多回复
  73. </text>
  74. </view>
  75. </view>
  76. </view>
  77. </cell>
  78. <cell v-if="showLoadMore || dataList.length > 4">
  79. <view class="loading-more">
  80. <text class="loading-more-text">{{loadMoreText}}</text>
  81. </view>
  82. </cell>
  83. <cell>
  84. <view v-if="totalNum==0 && reqDataCode!=0" class="y-f" style="height: 300px;padding-top: 200rpx;" >
  85. <image @tap="refreshPage()" class="es-w-124 es-h-80" style="width:187rpx;height:120rpx;" src="../../../static/image/nodata.png"></image>
  86. <text @tap="refreshPage()" class="es-c-33 es-fs-36 es-mt-20">{{reqDataCode==1?'暂无数据':'请求超时'}}</text>
  87. </view>
  88. </cell>
  89. </list>
  90. </view>
  91. </view>
  92. <!-- <view :style="'height:'+(KeyHight)+'px'" style="background-color: red;" v-if="KeyHight>0"></view>
  93. <view class="es-h-120 es-auto-bottom" v-else></view> -->
  94. <cover-view class="fix-bottom es-b-t" :style="{bottom: KeyHight + 'px'}" @tap.stop="">
  95. <view class="es-h-120 es-view-w-x es es-ac flex" >
  96. <view class="es-f1 es-br flex ac es-h-70 es-pl-20 es-pr-20 es-pt-10" >
  97. <input style="width:100%;font-size: 28rpx;" ref="txtPing" v-model="pingContent" :focus="isInputFocus"
  98. @blur="onblur" :placeholder="placeholder" :adjust-position="false" placeholder-class="es-c" />
  99. </view>
  100. <text class="es-w-120 es-h-60 es-fs-30 es-fw-600 es-ml-20 es-c " style="text-align: center;line-height: 60rpx;" :always-system="true" @tap="doSend">发布</text>
  101. </view>
  102. <view class="es-auto-bottom" v-if="!KeyHight"></view>
  103. </cover-view>
  104. </view>
  105. </template>
  106. <script>
  107. // import { getCourseById,getCommentList,addComment,updateComment,commentDoLike,deleteComment } from '@/api/course'
  108. import { getComments,getReplies,addComment,doLikeComment,deleteComment } from '@/api/shortvideo'
  109. import { isLogin,isEmpty } from '@/utils/common'
  110. import { showLoginPage } from '@/utils/login'
  111. import dayjs from 'dayjs';
  112. export default {
  113. data() {
  114. return {
  115. pingContent: '',
  116. KeyHight:0,
  117. cateId:5,
  118. courseId:0,
  119. totalNum:0,
  120. courseData:{},
  121. pageHei:400,
  122. downOption: {
  123. auto: false ,// 不自动加载 (mixin已处理第一个tab触发downCallback)
  124. use:true
  125. },
  126. upOption: {
  127. use:true,
  128. auto: false, // 不自动加载
  129. page: {
  130. num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  131. size: 10 // 每页数据的数量
  132. },
  133. empty:{
  134. tip: '~ 暂无数据 ~', // 提示
  135. btnText: '去看看'
  136. },
  137. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  138. },
  139. pingType:1,//1:评论 2:回复
  140. dataList: [], //列表数据
  141. replyParentId:null,
  142. txtPing:null,
  143. sortType:1,
  144. isInputFocus:false,
  145. showBoottom:true,
  146. placeholder:"发布一条友善的评论",
  147. defHeadImg:"../../static/image/course/defHead.png",
  148. myUserInfo:{userId:0},
  149. delCommentId:null,
  150. mescroll:null,
  151. adpid: '',
  152. loadMoreText:"加载中...",
  153. showLoadMore:false,
  154. isLastPage:false,
  155. refreshing: false,
  156. refreshText: '↓ 下拉刷新',
  157. pageNum:1,
  158. listHei:0,
  159. rpyPageNum:1,
  160. replyContent:"",
  161. rPlaceholder:"",
  162. reqDataCode:0, //1:正常加载 -1 请求超时
  163. subNVueName: 'videoComment',
  164. comWidth: 300,
  165. replyWidth: 200
  166. }
  167. },
  168. mounted() {
  169. try {
  170. let that=this;
  171. uni.$on('videoComment', (data) => {
  172. that.subNVueName = data.subNVueName
  173. that.totalNum=data.smsNum;
  174. that.placeholder = "发布一条友善的评论";
  175. if(that.videoId && that.videoId==data.videoId && that.reqDataCode==1){
  176. return;
  177. }
  178. that.dataList = [];
  179. that.videoId=data.videoId;
  180. that.reqDataCode=0;
  181. that.initData();
  182. });
  183. const res = uni.getSystemInfoSync();
  184. this.listHei=uni.upx2px(1150 - 240);
  185. // let tempHei=res.windowHeight*0.65;
  186. // console.log("qxj tempHei:"+tempHei);
  187. // this.pageHei=tempHei+"px";
  188. this.comWidth = res.screenWidth - uni.upx2px(182)
  189. this.replyWidth = res.screenWidth - uni.upx2px(312)
  190. this.txtPing = this.$refs["txtPing"];
  191. uni.onKeyboardHeightChange(this.boardHeightChange);
  192. if(isLogin()){
  193. let useInfo=uni.getStorageSync('userInfo');
  194. if(!!useInfo && useInfo!=null){
  195. this.myUserInfo=JSON.parse(useInfo);
  196. }
  197. }
  198. } catch (e) {
  199. }
  200. },
  201. methods: {
  202. initData(){
  203. let that=this;
  204. setTimeout(function() {
  205. that.refreshPage();
  206. }, 300);
  207. },
  208. onpullingdown(e) {
  209. //console.log("qxj onpullingdown");
  210. if (this.refreshing) return;
  211. if (Math.abs(e.pullingDistance) > Math.abs(e.viewHeight)) {
  212. this.refreshText = '下拉更新'
  213. } else {
  214. this.refreshText = '释放更新'
  215. }
  216. },
  217. onrefresh(e) {
  218. //console.log('onRefreshing...');
  219. this.refreshing = true;
  220. this.pageNum=1;
  221. this.upCallback();
  222. if (this.refreshing) return;
  223. },
  224. loadmore(){
  225. if(this.isLastPage){
  226. return;
  227. }
  228. console.log("loadmore");
  229. this.pageNum++;
  230. this.showLoadMore = true;
  231. setTimeout(() => {
  232. this.upCallback();
  233. }, 300);
  234. },
  235. /*下拉刷新的回调 */
  236. upCallback() {
  237. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  238. const params={"videoId":this.videoId,orderBy:this.sortType==2?'likes':'date'};
  239. uni.showLoading({title:""});
  240. getComments(params,this.pageNum).then(res => {
  241. uni.hideLoading();
  242. if(res.code==200){
  243. setTimeout(()=>{
  244. if(this.pageNum == 1) this.dataList = []; //如果是第一页需手动制空列表
  245. let dataList=res.data.list;
  246. // 从接口同步评论总数,保证数量实时更新
  247. if (res.data.total !== undefined && res.data.total !== null) {
  248. this.totalNum = res.data.total;
  249. this.sendNotify(this.totalNum);
  250. }
  251. dataList.forEach((item, index) => {
  252. if(item.replyCount>0){
  253. item.showReplyBtn=true;
  254. item.isLastReplyPage=false;
  255. }else{
  256. item.showReplyBtn=false;
  257. item.isLastReplyPage=true;
  258. }
  259. item.rpyPageNum=1;
  260. });
  261. this.dataList=this.dataList.concat(dataList); //追加新数据
  262. this.reqDataCode=1;
  263. this.refreshing = false;
  264. this.isLastPage=res.data.isLastPage;
  265. if(this.isLastPage){
  266. this.refreshText = '加载完成'
  267. }
  268. if(res.data.isLastPage){
  269. this.loadMoreText = "没有更多数据了!"
  270. this.showLoadMore=false;
  271. }else{
  272. this.loadMoreText = "加载中..."
  273. }
  274. },200);
  275. }else{
  276. this.refreshing = false;
  277. this.refreshText = '加载完成'
  278. this.reqDataCode=-1;
  279. }
  280. },
  281. rej => {}
  282. ).catch(()=>{
  283. //联网失败, 结束加载
  284. this.refreshing = false;
  285. this.refreshText = '加载完成',
  286. this.reqDataCode=-1;
  287. });
  288. },
  289. closePopup() {
  290. const subNVue = uni.getSubNVueById(this.subNVueName);
  291. if (subNVue) {
  292. subNVue.hide('slide-out-bottom');
  293. } else {
  294. console.log('subNVue is already hidden.');
  295. }
  296. },
  297. refreshPage(){
  298. this.pageNum=1;
  299. this.upCallback();
  300. },
  301. tapCommentType(type){
  302. this.sortType=type;
  303. this.refreshPage();
  304. },
  305. isMySend(item){
  306. if(this.myUserInfo!=null && this.myUserInfo.userId==item.userId){
  307. return true;
  308. }
  309. return false;
  310. },
  311. doSend(){
  312. if(this.isEmpty(this.pingContent)){
  313. uni.showToast({title: '评论内容不能为空',icon: 'none'});
  314. return;
  315. }
  316. if(!isLogin()){
  317. showLoginPage();
  318. return;
  319. }
  320. let params={"videoId":this.videoId,"content":this.pingContent};
  321. if(this.pingType==2){
  322. params["parentId"]=this.replyParentId;
  323. }
  324. let that=this;
  325. uni.showLoading({title:""});
  326. addComment(params).then(res => {
  327. uni.hideLoading();
  328. if(res.code==200){
  329. if(this.pingType==1){
  330. uni.showToast({title: '添加评论成功',icon: 'none',position:'bottom'});
  331. this.totalNum++
  332. this.sendNotify(this.totalNum);
  333. this.isInputFocus = false
  334. }else{
  335. uni.showToast({title: '添加回复成功',icon: 'none',position:'bottom'});
  336. this.isInputFocus = false
  337. }
  338. }else{
  339. uni.showToast({title: res.msg,icon: 'none'});
  340. }
  341. this.placeholder="发布一条友善的评论";
  342. this.pingType=1;
  343. this.pingContent='';
  344. setTimeout(function(){
  345. that.refreshPage();
  346. },1000)
  347. },
  348. rej => {}
  349. );
  350. },
  351. doReply(item){
  352. this.replyParentId=item.commentId;
  353. this.pingType=2;
  354. let placeHolder=this.isEmpty(item.nickName)?"回复":"回复"+item.nickName;
  355. this.placeholder=placeHolder;
  356. this.pingContent='';
  357. //this.isInputFocus=true;
  358. this.$nextTick(()=>{
  359. this.$refs.txtPing.focus();
  360. });
  361. },
  362. replayClick(item,index){
  363. const params={"videoId":this.videoId,"parentId":item.commentId};
  364. uni.showLoading({title:""});
  365. getReplies(params,item.rpyPageNum).then(res => {
  366. uni.hideLoading();
  367. console.log("qxj res:"+JSON.stringify(res));
  368. if(res.code==200){
  369. setTimeout(()=>{
  370. if(item.rpyPageNum == 1) item.replyList = []; //如果是第一页需手动制空列表
  371. item.replyList=item.replyList.concat(res.data.list); //追加新数据
  372. if(res.data.isLastPage){
  373. item.showReplyBtn=false;
  374. item.isLastReplyPage=true;
  375. }else{
  376. item.rpyPageNum+=1;
  377. item.showReplyBtn=true;
  378. item.isLastReplyPage=false;
  379. }
  380. //this.dataList[index]=item;
  381. // this.$forceUpdate();
  382. },200);
  383. }else{
  384. this.refreshing = false;
  385. this.refreshText = '加载完成'
  386. this.reqDataCode=-1;
  387. }
  388. },
  389. rej => {}
  390. ).catch(()=>{
  391. //联网失败, 结束加载
  392. this.refreshing = false;
  393. this.refreshText = '加载完成',
  394. this.reqDataCode=-1;
  395. });
  396. },
  397. onblur(){
  398. console.log("qxj onblur");
  399. //this.isInputFocus = false;
  400. },
  401. hideKeyboard(){
  402. uni.hideKeyboard();
  403. },
  404. doLike(item,index){
  405. if(!isLogin()){
  406. showLoginPage();
  407. return;
  408. }
  409. const params={"commentId":item.commentId};
  410. uni.showLoading({title:""});
  411. let that=this;
  412. doLikeComment(params).then(res => {
  413. uni.hideLoading();
  414. if(res.code==200){
  415. if(item.liked==0){
  416. item.likes+=1;
  417. item.liked=1;
  418. }else{
  419. item.likes-=1;
  420. item.liked=0;
  421. }
  422. // 使用 $set 保证 nvue 下响应式更新
  423. this.$set(this.dataList, index, item);
  424. this.$forceUpdate();
  425. uni.showToast({title: '操作成功',icon: 'none'});
  426. }else{
  427. uni.showToast({title: res.msg,icon: 'none'});
  428. }
  429. },
  430. rej => {}
  431. );
  432. },
  433. doReplyLike(cItem, replyIdx, parentIndex){
  434. if(!isLogin()){
  435. showLoginPage();
  436. return;
  437. }
  438. const params={"commentId":cItem.commentId};
  439. uni.showLoading({title:""});
  440. let that=this;
  441. doLikeComment(params).then(res => {
  442. uni.hideLoading();
  443. if(res.code==200){
  444. if(cItem.liked==0){
  445. cItem.likes+=1;
  446. cItem.liked=1;
  447. }else{
  448. cItem.likes-=1;
  449. cItem.liked=0;
  450. }
  451. // 更新嵌套数据并强制刷新视图,保证回复点赞实时显示
  452. this.$set(this.dataList[parentIndex].replyList, replyIdx, cItem);
  453. this.$forceUpdate();
  454. uni.showToast({title: '操作成功',icon: 'none'});
  455. }else{
  456. uni.showToast({title: res.msg,icon: 'none'});
  457. }
  458. },
  459. rej => {}
  460. );
  461. },
  462. delComment(item,type){
  463. if(!isLogin()){
  464. showLoginPage();
  465. return;
  466. }
  467. let that = this;
  468. uni.showModal({
  469. title: '系统提示',
  470. content: '确定删除吗',
  471. success: function (res) {
  472. if (res.confirm) {
  473. console.log("qxj confirm");
  474. that.delCommentAct(item,type);
  475. } else if (res.cancel) {
  476. console.log("qxj cancel");
  477. }
  478. }
  479. });
  480. },
  481. delCommentAct(item,type){
  482. this.delCommentId=item.commentId;
  483. let params={"commentId":this.delCommentId,"videoId":this.videoId};
  484. if(type==1){
  485. params["parentId"]=item.parentId;
  486. }
  487. this.delCommentRequest(params);
  488. },
  489. delCommentRequest(params){
  490. let that=this;
  491. uni.showLoading({title:""});
  492. deleteComment(params).then(res => {
  493. uni.hideLoading();
  494. if(res.code==200){
  495. uni.showToast({title: '操作成功',icon: 'none'});
  496. this.totalNum = this.totalNum-1
  497. this.sendNotify(this.totalNum);
  498. setTimeout(function(){
  499. that.refreshPage();
  500. },1000)
  501. }else{
  502. uni.showToast({title: res.msg,icon: 'none'});
  503. }
  504. },
  505. rej => {}
  506. );
  507. },
  508. sendNotify(smsNum){
  509. uni.$emit('refreshVideoComment', {
  510. videoId: this.videoId,
  511. smsNum:smsNum
  512. });
  513. },
  514. boardHeightChange:function(res){
  515. console.log('changeHeight', res.height);
  516. if(res.height==0){
  517. this.placeholder="发布一条友善的评论";
  518. //this.pingContent='';
  519. this.isInputFocus=false;
  520. }else{
  521. this.isInputFocus=true;
  522. }
  523. this.KeyHight = res.height;
  524. },
  525. isEmpty(obj) {
  526. if (typeof obj == "undefined" || obj == null || obj == "") {
  527. return true;
  528. } else {
  529. return false;
  530. }
  531. },
  532. formatDate(dateStr) {
  533. let formatStr = "";
  534. let formatDate;
  535. if(dateStr==null){
  536. return formatStr;
  537. }
  538. let date = dayjs(dateStr,'YYYY-MM-DD HH:mm:ss');
  539. let today = dayjs();
  540. if (date.year() != today.year()) {
  541. formatDate = date.format('YYYY-MM-DD HH:mm');
  542. }
  543. else if (date.month() === today.month()) {
  544. switch (date.date() - today.date()) {
  545. case 0:
  546. formatDate = date.format('今天 HH:mm');
  547. break;
  548. case -1:
  549. formatDate = date.format('昨天 HH:mm');
  550. break;
  551. case 1:
  552. formatDate = date.format('明天 HH:mm');
  553. break;
  554. default:
  555. formatDate = date.format('MM-DD HH:mm');
  556. break;
  557. }
  558. }
  559. else if (date.month() - today.month() === 0 && date.date() === 1) {
  560. formatDate = date.format('明天 HH:mm');
  561. }
  562. else {
  563. formatDate = date.format('MM-DD HH:mm');
  564. }
  565. return formatDate;
  566. }
  567. },
  568. onShow() {
  569. console.log("qxj videoComment onShow");
  570. },
  571. onUnload: function() {
  572. uni.offKeyboardHeightChange(this.boardHeightChange);
  573. uni.$off("videoComment");
  574. },
  575. beforeDestroy() {
  576. uni.offKeyboardHeightChange(this.boardHeightChange);
  577. // 注销全局配置监听
  578. console.log("qxj videoComment destroyed");
  579. uni.$off("videoComment");
  580. },
  581. onHide() {
  582. console.log("qxj videoComment onHide");
  583. },
  584. onClose() {
  585. console.log("qxj videoComment onClose");
  586. }
  587. }
  588. </script>
  589. <style>
  590. page {
  591. background-color: white;
  592. }
  593. .fl-row{
  594. display: flex;
  595. flex-direction: row;
  596. }
  597. .comtentBox{
  598. background-color:#171a1d;
  599. box-sizing: border-box;
  600. }
  601. .banner {
  602. height: 430rpx;
  603. }
  604. .es-icon-course-bg {
  605. background-image: url(../../../static/images/other/course/bg.png);
  606. }
  607. .es-icon-course-icon-1 {
  608. background-image: url(../../../static/images/other/course/icon-1.png);
  609. }
  610. .es-icon-course-icon-2 {
  611. background-image: url(../../../static/images/other/course/icon-2.png);
  612. }
  613. .es-icon-course-icon-3 {
  614. background-image: url(../../../static/images/other/course/icon-3.png);
  615. }
  616. .es-icon-course-close {
  617. background-image: url(../../../static/images/other/course/close.png);
  618. }
  619. .es-icon-course-info {
  620. background-image: url(../../../static/images/other/course/info.png);
  621. }
  622. .es-icon-course-bg2 {
  623. background-image: url(../../../static/images/other/course/bg2.png);
  624. }
  625. .es-icon-course-bg3 {
  626. background-image: url(../../../static/images/other/course/bg3.png);
  627. }
  628. .es-icon-course-comment {
  629. background-image: url(../../../static/images/other/course/comment.png);
  630. }
  631. .es-icon-course-comment2 {
  632. background-image: url(../../../static/images/other/course/comment2.png);
  633. }
  634. .es-icon-course-nav-bg,
  635. .nav {
  636. background-image: url(../../../static/images/other/course/nav-bg.png);
  637. }
  638. .es-icon-course-nav-bg-ac,.ac {
  639. background-color: #ffd8c4;
  640. }
  641. .es-icon-course-point {
  642. background-image: url(../../../static/images/other/course/point.png);
  643. }
  644. .es-icon-course-share {
  645. background-image: url(../../../static/images/other/course/share.png);
  646. }
  647. .es-icon-course-like2 {
  648. background-image: url(../../../static/images/other/course/like2.png);
  649. }
  650. .es-icon-course-like2-ac {
  651. background-image: url(../../../static/images/other/course/like2-ac.png);
  652. }
  653. .item {
  654. width: calc(33.33% - 14rpx);
  655. }
  656. .nav {
  657. width: 216rpx;
  658. height: 60rpx;
  659. }
  660. .comment-reply-item {
  661. border-bottom: 1px #fff solid;
  662. }
  663. .br{
  664. border: 1px solid #FF5C03;
  665. }
  666. .fix-bottom{
  667. position: fixed;
  668. left: 0;
  669. right: 0;
  670. bottom: 0;
  671. /* width: 100%; */
  672. z-index: 999;
  673. background-color: white;
  674. }
  675. .refresh {
  676. display: flex;
  677. flex-direction: row;
  678. justify-content: center;
  679. height: 50px;
  680. width: 750rpx;
  681. }
  682. .loading-more {
  683. align-items: center;
  684. justify-content: center;
  685. padding-top: 14px;
  686. padding-bottom: 14px;
  687. text-align: center;
  688. }
  689. .loading-more-text {
  690. font-size: 28rpx;
  691. color: #999;
  692. }
  693. </style>