@@ -1963,62 +1963,25 @@ export default {
// console.log(item, type);
},
//评价接口
- appraise(evaluation, item, event) {
- //evaluation 1为有帮助 2没有帮助
- let current = event.currentTarget;
- let settled = event.currentTarget.parentNode.children[1]; //有帮助
- let unsettled = event.currentTarget.parentNode.children[0]; //没有帮助
-
- let param = {
- fromFlag: 1,
- userId: this.userId,
- sessionId: this.sessionId,
- source: this.source,
- qaId: item.qaId,
- evaluation: evaluation,
- reqAndResType: "3",
- timestamp: new Date().valueOf(),
- };
-
- current.disabled = true;
- //this.set_sendLoading(true);
- // 满意度调查系统需求
- this.savePaperResult(param)
- .then((res) => { })
- .catch((err) => {
- console.log(err);
- });
-
- this.$post("evaluation/evaluateAnswer", param)
- .then((res) => {
- //this.set_sendLoading(false);
- // console.log("评价接口==", res)
- if (res.code && res.code != 0) {
- showToast(res.msg);
-
- current.disabled = false;
- return;
- }
-
- // 禁掉按钮
- current.disabled = true;
- current.classList.add("active");
- if (current.innerText === "有帮助") {
- unsettled.disabled = true;
- } else if (current.innerText === "没有帮助") {
- settled.disabled = true;
- }
-
- this.set_chatList(res.data);
- this.scrollTopBody();
-
- //评价返回数据
- })
- .catch((error) => {
- current.disabled = false;
- console.log(error);
- });
- },
+ appraise(evaluation, item, event) {
+ //evaluation 1为有帮助 2没有帮助
+ // 基础评价数据交给 appraise-popup 弹窗:提交/关闭时统一落库并置灰按钮
+ let current = event.currentTarget;
+
+ let baseHandle = {
+ fromFlag: 1,
+ userId: this.userId,
+ sessionId: this.sessionId,
+ source: this.source,
+ qaId: item.qaId,
+ evaluation: evaluation,
+ reqAndResType: "3",
+ timestamp: new Date().valueOf(),
+ event: current,
+ };
+
+ this.$emit("handleAppraise", true, baseHandle);
+ },
//留言
leaveMessageBtn(event) {
let current = event.currentTarget;
diff --git a/src/components/chat-new.vue b/src/components/chat-new.vue
index 640d955..f551370 100644
--- a/src/components/chat-new.vue
+++ b/src/components/chat-new.vue
@@ -10,6 +10,7 @@ import hotQuestionNew from '@/components/hot-question-new.vue'
import welcomes from '@/components/welcomes.vue'
import abstract from '@/components/abstract.vue'
import chatContent from '@/components/chat-content.vue'
+import appraisePopup from '@/components/appraise-popup.vue'
import DynamicImage from '@/components/common/DynamicImage.vue'
import bussinessHandle from '@/components/business-handle.vue'
import imageService from '@/utils/imageService'
@@ -41,6 +42,13 @@ const sessionId = inject('sessionId', ref(''))
const userId = inject('userId', ref(''))
const isLostMessage = inject('isLostMessage', ref(null))
const mainContainerRef = ref(null)
+const appraiseShow = ref(false) // 有帮助/没帮助评价弹层
+const baseHandle = ref('') // 评价弹层基础数据(含被点按钮 event)
+
+function appraiseIsClose(val, param) {
+ appraiseShow.value = val
+ baseHandle.value = param || ''
+}
// 参考 liics/chat-main 的 tokenExist:token 获取成功后才渲染聊天主内容
@@ -518,16 +526,24 @@ watch(
:isWX="isWX"
:tokenExist="tokenExist"
:lostChatInfoNum="lostChatInfoNum"
+ @handleAppraise="appraiseIsClose"
/>