{"remainingRequest":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js??vue-loader-options!/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_comment.vue?vue&type=script&lang=js","dependencies":[{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/src/components/o_comment.vue","mtime":1725957645725},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/babel-loader/lib/index.js","mtime":456789000000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/cache-loader/dist/cjs.js","mtime":499162500000},{"path":"/data/jenkins/workspace/badp-bcxin-web-5.x-vue/node_modules/vue-loader/lib/index.js","mtime":499162500000}],"contextDependencies":[],"result":["\nimport Constant from \"@/Constant.js\";\nexport default {\n name: \"o-comment\",\n props: [\"id\"],\n computed: {\n field: function() {\n let allData = this.$parent.findField(this.id)\n return allData\n },\n },\n mounted(){\n this.init()\n },\n data: function() {\n return { \n Constant, \n commentData:{\n list:[],\n comment:''\n },\n commentDetail:'',\n avatar: '',\n };\n },\n methods: {\n likeForm(){\n let {id, likeNum} = this.commentDetail\n this.$api.setLike(\n this.field.appId,\n id,\n {\n onSucess: res => {\n likeNum = res.data.data\n this.commentDetail.likeNum = likeNum\n this.$forceUpdate()\n }\n }\n )\n\n },\n\n clickLike(id, index, inx){\n let cd = this.commentData;\n this.$api.setLike(\n this.field.appId,\n id,\n {\n onSucess: res => {\n if(res.data.data) {\n if(inx >= 0) {\n cd.list[index].replyList[inx].likeNum= res.data.data\n }else {\n cd.list[index].likeNum = res.data.data\n }\n this.$forceUpdate();\n }\n }\n }\n )\n },\n\n clickUnLike(id, index, inx){\n let cd = this.commentData\n this.$api.setUnlike(\n this.field.appId,\n id,\n {\n onSucess: res => {\n if(res.data.data) {\n if(inx >= 0) {\n cd.list[index].replyList[inx].unlikeNum = res.data.data\n }else {\n cd.list[index].unlikeNum = res.data.data\n }\n this.$forceUpdate();\n }\n }\n }\n )\n },\n\n replyToComments(id, isShow, index, currentId, name) {\n let cd = this.commentData\n cd.list[index].placeholder = \"回复 @\" + name\n cd.list[index].currentId = currentId\n if(id == currentId) {\n cd.list[index].isShowReleaseBox = !isShow\n }else {\n cd.list[index].commentValue = ''\n // cd.list[index].placeholder = \"回复 @\" + name\n cd.list[index].isShowReleaseBox = true\n }\n this.$forceUpdate()\n },\n\n postComment(id, value, currentId, placeholder, index){\n let cd = this.commentData\n let field = this.field\n let content = {\n comment: '',\n parentId:'',\n }\n if(id) {\n if(id == currentId) { //回复第一层\n content.comment = value\n content.parentId = id\n }else { //第二层回复\n content.parentId = id\n content.comment = placeholder + \":\" + value\n }\n }else {\n content.comment = cd.comment\n }\n this.$api.publishComment(this.$root.appid, field.docId, content, {\n onSucess: res => {\n let list = res.data.data\n if(id) {\n if(cd.list[index].replyList) {\n cd.list[index].replyList.unshift(list)\n }else {\n cd.list[index].replyList = [];\n cd.list[index].replyList.push(list)\n }\n cd.list[index].commentValue = ''\n }else {\n cd.comment = ''\n cd.list.unshift(list)\n }\n this.$forceUpdate()\n }\n })\n },\n\n init(){\n let field = this.field\n this.$api.getCommentList(\n field.appId,\n field.docId,\n {\n onSucess: res => {\n let list = res.data.data;\n if(list && list.length > 0) {\n list.forEach(el => {\n el.commentValue = ''\n el.isShowReleaseBox = false\n el.currentId = el.id\n el.placeholder = ''\n });\n this.commentData.list = list;\n list.forEach(el => {\n this.$api.getReplyList(\n field.appId,\n el.id,\n {\n onSucess: res => {\n if(res.data.data) {\n el.replyList = res.data.data\n }else {\n el.replyList = []\n }\n this.$forceUpdate()\n }\n }\n )\n })\n }\n }\n }\n )\n this.$api.getLikesCount(\n field.appId,\n field.docId,\n {\n onSucess: res => {\n this.commentDetail = res.data.data;\n }\n }\n )\n let userId = this.$store.state.userId\n\n this.$api.getUserAvatar(\n userId,\n {\n onSucess: res=> {\n this.avatar = res.data.data;\n }\n }\n )\n },\n onChange() {\n \n },\n },\n filters: {\n writeCurrentDate(val){\n let now = new Date(val)\n let year=now.getFullYear()\n let month=now.getMonth()+1\n let date=now.getDate()\n let hour=now.getHours()\n let minute=now.getMinutes();\n hour = hour >= 10 ? hour: '0' + hour\n minute = minute >= 10 ? minute: '0' + minute\n return year+\"-\"+month+\"-\"+date+\" \"+hour+\":\"+minute;\n }\n }\n};\n",null]}