|
@@ -41,12 +41,7 @@
|
|
|
<div class="message">{{ content.answer }}</div>
|
|
|
</div>
|
|
|
<div class="img-wrapper">
|
|
|
- <img
|
|
|
- width="60px"
|
|
|
- heigth="60px"
|
|
|
- class="img"
|
|
|
- :src="from2"
|
|
|
- />
|
|
|
+ <img width="60px" heigth="60px" class="img" :src="from2" />
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-col>
|
|
@@ -189,9 +184,7 @@ export default {
|
|
|
chatContents: [],
|
|
|
//前三个问题
|
|
|
preList: [],
|
|
|
- questionList: [
|
|
|
- { index: 1, des: "能描述一下您最近训练的内容吗?", type: "1-2" },
|
|
|
- ],
|
|
|
+ questionList: [{ index: 1, des: "能描述一下您最近训练的内容吗?", type: "1-2" }],
|
|
|
//随机的4个数集合
|
|
|
radomNumList: [],
|
|
|
questionNum: 0,
|
|
@@ -235,12 +228,14 @@ export default {
|
|
|
mounted() {
|
|
|
window.jumpPage = this.jumpPage;
|
|
|
const scrollview = this.$refs["scrollview"];
|
|
|
+ this.$root.smartNum = this.$root.smartNum + 1;
|
|
|
this.init();
|
|
|
//获取编号
|
|
|
this.identifier = sessionStorage.getItem("num");
|
|
|
this.userName = sessionStorage.getItem("name");
|
|
|
// this.selectScale("20220805135201");
|
|
|
scrollview.addEventListener("scroll", this.handleScroll, true);
|
|
|
+
|
|
|
// /menu/evaluation
|
|
|
// this.askEndMul(
|
|
|
// ' 轻度:建议您使用系统中的虚拟现实、生物反馈训练<span onclick="jumpPage(1)" style="color:blue;cursor:pointer">(点击跳转)</span>、认知行为干预<span onclick="jumpPage(2)" style="color:blue;cursor:pointer">(点击跳转--走出抑郁)</span>功能进行心理状态调'
|
|
@@ -284,24 +279,18 @@ export default {
|
|
|
scaleInfoTemp.checkItems = item;
|
|
|
this.scale_result.push(scaleInfoTemp);
|
|
|
// bbc测试判断是否展示20~24题
|
|
|
- if (
|
|
|
- item != "是" &&
|
|
|
- this.scale_flag == "20211101163739" &&
|
|
|
- this.scale_index == 19
|
|
|
- ) {
|
|
|
+ if (item != "是" && this.scale_flag == "20211101163739" && this.scale_index == 19) {
|
|
|
this.scale_index = 24;
|
|
|
for (let i = 20; i < 24; i++) {
|
|
|
this.scale_result.push(this.scale_infos[i]);
|
|
|
}
|
|
|
- this.scale_checkItems =
|
|
|
- this.scale_infos[this.scale_index].checkItems.split(";");
|
|
|
+ this.scale_checkItems = this.scale_infos[this.scale_index].checkItems.split(";");
|
|
|
return;
|
|
|
}
|
|
|
//如果是单选题
|
|
|
|
|
|
if (scaleInfoTemp.questionType == "0") {
|
|
|
- if (this.scale_index <= this.scale_infos.length - 1)
|
|
|
- this.scale_index += 1;
|
|
|
+ if (this.scale_index <= this.scale_infos.length - 1) this.scale_index += 1;
|
|
|
this.answerSelect(this.tmpRadio);
|
|
|
//scale_index == 题目总数,表示结束
|
|
|
if (this.scale_index == this.scale_infos.length) {
|
|
@@ -350,8 +339,9 @@ export default {
|
|
|
this.askEnd(a);
|
|
|
}, 20);
|
|
|
|
|
|
- this.scale_checkItems =
|
|
|
- this.scale_infos[this.scale_index].checkItems.split(";");
|
|
|
+ this.scale_checkItems = this.scale_infos[this.scale_index].checkItems.split(
|
|
|
+ ";"
|
|
|
+ );
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -363,13 +353,10 @@ export default {
|
|
|
_this.scaleSelectFlag = true;
|
|
|
if (res.data.code == 200 && res.data.data) {
|
|
|
_this.resultJsonParams = res.data.data;
|
|
|
- let testResult = JSON.parse(
|
|
|
- res.data.data.userRecordEntity.testResult
|
|
|
- )[0].version;
|
|
|
+ let testResult = JSON.parse(res.data.data.userRecordEntity.testResult)[0]
|
|
|
+ .version;
|
|
|
if (_this.scale_flag === "20210910163158") {
|
|
|
- let sleep = JSON.parse(
|
|
|
- _this.resultJsonParams.userRecordEntity.testResult
|
|
|
- );
|
|
|
+ let sleep = JSON.parse(_this.resultJsonParams.userRecordEntity.testResult);
|
|
|
sleep = sleep[0].newTableContext.result[0].improvementSuggestions;
|
|
|
_this.askEndMul(sleep);
|
|
|
if (_this.emotionMul.length == 0) {
|
|
@@ -382,9 +369,7 @@ export default {
|
|
|
// this.scale_checkItems = ["是", "否"];
|
|
|
// this.inputFlag = 2;
|
|
|
} else if (_this.scale_flag === "20220805135201") {
|
|
|
- let sleep = JSON.parse(
|
|
|
- _this.resultJsonParams.userRecordEntity.testResult
|
|
|
- );
|
|
|
+ let sleep = JSON.parse(_this.resultJsonParams.userRecordEntity.testResult);
|
|
|
sleep = sleep[0].tableContext;
|
|
|
console.log(sleep);
|
|
|
let str = "";
|
|
@@ -505,8 +490,7 @@ export default {
|
|
|
this.scale_infos = res.data;
|
|
|
this.scale_all = this.scale_infos.length;
|
|
|
this.askEnd(this.scale_infos[this.scale_index].answer);
|
|
|
- this.scale_checkItems =
|
|
|
- this.scale_infos[this.scale_index].checkItems.split(";");
|
|
|
+ this.scale_checkItems = this.scale_infos[this.scale_index].checkItems.split(";");
|
|
|
this.scale_percent = parseInt((this.scale_index + 1) / this.scale_all);
|
|
|
this.scale_percent = ((this.scale_index + 1) * 100) / this.scale_all;
|
|
|
});
|
|
@@ -687,29 +671,42 @@ export default {
|
|
|
i < res.data.intelligentDialogueEntities.content.length;
|
|
|
i++
|
|
|
) {
|
|
|
- if (
|
|
|
- res.data.intelligentDialogueEntities.content[i].label == "0"
|
|
|
- ) {
|
|
|
- this.chatContents.unshift({
|
|
|
- from: 1,
|
|
|
- question:
|
|
|
- res.data.intelligentDialogueEntities.content[i].content,
|
|
|
- from1: HeadImg,
|
|
|
- });
|
|
|
+ if (res.data.intelligentDialogueEntities.content[i].label == "0") {
|
|
|
+ if (that.$root.smartNum == 1) {
|
|
|
+ this.chatContents.unshift({
|
|
|
+ from: 1,
|
|
|
+ question: res.data.intelligentDialogueEntities.content[i].content,
|
|
|
+ from1: HeadImg,
|
|
|
+ isHistory: true,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.chatContents.unshift({
|
|
|
+ from: 1,
|
|
|
+ question: res.data.intelligentDialogueEntities.content[i].content,
|
|
|
+ from1: HeadImg,
|
|
|
+ });
|
|
|
+ }
|
|
|
} else {
|
|
|
- this.chatContents.unshift({
|
|
|
- from: 2,
|
|
|
- answer:
|
|
|
- res.data.intelligentDialogueEntities.content[i].content,
|
|
|
- from1: HeadImg,
|
|
|
- });
|
|
|
+ if (that.$root.smartNum == 1) {
|
|
|
+ this.chatContents.unshift({
|
|
|
+ from: 2,
|
|
|
+ answer: res.data.intelligentDialogueEntities.content[i].content,
|
|
|
+ from1: HeadImg,
|
|
|
+ isHistory: true,
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.chatContents.unshift({
|
|
|
+ from: 2,
|
|
|
+ answer: res.data.intelligentDialogueEntities.content[i].content,
|
|
|
+ from1: HeadImg,
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
let contant1 = document.getElementById("contant1");
|
|
|
this.sleep(300).then(() => {
|
|
|
- contant1.scrollTop =2;
|
|
|
+ contant1.scrollTop = 2;
|
|
|
});
|
|
|
- // console.log(this.chatContents);
|
|
|
}
|
|
|
} else {
|
|
|
}
|
|
@@ -756,27 +753,27 @@ export default {
|
|
|
//http://127.0.0.1:9999
|
|
|
//`http://127.0.0.1:9999/sentiment
|
|
|
//http://aagvs5.natappfree.cc/sentiment
|
|
|
+ //http://127.0.0.1:9999/sentiment
|
|
|
+ //http://127.0.0.1:9999/sentiment
|
|
|
let that = this;
|
|
|
- axios
|
|
|
- .post(`http://127.0.0.1:9999/sentiment`, { text: val })
|
|
|
- .then((res) => {
|
|
|
- console.log(res.data.sentiment);
|
|
|
- if (
|
|
|
- res.data.sentiment === "厌恶" ||
|
|
|
- res.data.sentiment === "恐惧" ||
|
|
|
- res.data.sentiment === "悲伤" ||
|
|
|
- res.data.sentiment === "愤怒"
|
|
|
- ) {
|
|
|
- this.moonNegative += 1;
|
|
|
- }
|
|
|
+ axios.post(`http://127.0.0.1:9999/sentiment`, { text: val }).then((res) => {
|
|
|
+ console.log(res.data.sentiment);
|
|
|
+ if (
|
|
|
+ res.data.sentiment === "厌恶" ||
|
|
|
+ res.data.sentiment === "恐惧" ||
|
|
|
+ res.data.sentiment === "悲伤" ||
|
|
|
+ res.data.sentiment === "愤怒"
|
|
|
+ ) {
|
|
|
+ this.moonNegative += 1;
|
|
|
+ }
|
|
|
|
|
|
- //假如负面情绪大于5则需要调用量表方法
|
|
|
+ //假如负面情绪大于5则需要调用量表方法
|
|
|
|
|
|
- // that.sendMsgFlag = true;
|
|
|
- // that.threeAnswers.push(res.data.sentiment);
|
|
|
- //如果是已婚人员则判断七个中是否存在4个负面情绪
|
|
|
- //0为已婚人员
|
|
|
- });
|
|
|
+ // that.sendMsgFlag = true;
|
|
|
+ // that.threeAnswers.push(res.data.sentiment);
|
|
|
+ //如果是已婚人员则判断七个中是否存在4个负面情绪
|
|
|
+ //0为已婚人员
|
|
|
+ });
|
|
|
},
|
|
|
//发送问题的接口
|
|
|
|
|
@@ -793,18 +790,34 @@ export default {
|
|
|
if (this.chatContents.length < 5) {
|
|
|
for (let i = 0; i < this.chatContents.length; i++) {
|
|
|
if (this.chatContents[i].from == 1) {
|
|
|
- list.push(this.chatContents[i].question);
|
|
|
+ console.log(this.chatContents[i].hasOwnProperty("isHistory"));
|
|
|
+ debugger;
|
|
|
+ if (!this.chatContents[i].hasOwnProperty("isHistory")) {
|
|
|
+ list.push(this.chatContents[i].question);
|
|
|
+ }
|
|
|
} else {
|
|
|
- list.push(this.chatContents[i].answer);
|
|
|
+ if (!this.chatContents[i].hasOwnProperty("isHistory")) {
|
|
|
+ debugger;
|
|
|
+ list.push(this.chatContents[i].answer);
|
|
|
+ }
|
|
|
}
|
|
|
- // list.push(chatContents.question)
|
|
|
}
|
|
|
} else {
|
|
|
for (let i = 5; i > 0; i--) {
|
|
|
if (this.chatContents[this.chatContents.length - i].from == 1) {
|
|
|
- list.push(this.chatContents[this.chatContents.length - i].question);
|
|
|
+ debugger;
|
|
|
+ if (
|
|
|
+ !this.chatContents[this.chatContents.length - i].hasOwnProperty("isHistory")
|
|
|
+ ) {
|
|
|
+ list.push(this.chatContents[this.chatContents.length - i].question);
|
|
|
+ }
|
|
|
} else {
|
|
|
- list.push(this.chatContents[this.chatContents.length - i].answer);
|
|
|
+ debugger;
|
|
|
+ if (
|
|
|
+ !this.chatContents[this.chatContents.length - i].hasOwnProperty("isHistory")
|
|
|
+ ) {
|
|
|
+ list.push(this.chatContents[this.chatContents.length - i].answer);
|
|
|
+ }
|
|
|
}
|
|
|
// list.push(chatContents.question);
|
|
|
}
|
|
@@ -820,6 +833,7 @@ export default {
|
|
|
//`http://127.0.0.1:9998/chat`
|
|
|
//http://127.0.0.1:9998/chat
|
|
|
//http://ray-thunder.natapp1.cc/chat
|
|
|
+ debugger;
|
|
|
HTTP_AXIOS({
|
|
|
method: "post",
|
|
|
url: `http://127.0.0.1:9998/chat`,
|
|
@@ -828,12 +842,6 @@ export default {
|
|
|
})
|
|
|
.then((res) => {
|
|
|
if (res) {
|
|
|
- // this.chatContents.push({
|
|
|
- // from: 1,
|
|
|
- // question: res.data.response,
|
|
|
- // from1: HeadImg,
|
|
|
- // });
|
|
|
-
|
|
|
let contant1 = document.getElementById("contant1");
|
|
|
this.sleep(101).then(() => {
|
|
|
contant1.scrollTop = contant1.scrollHeight;
|
|
@@ -884,8 +892,9 @@ export default {
|
|
|
this.flagTime = setInterval(
|
|
|
() => {
|
|
|
if (this.printIndex < a.length) {
|
|
|
- this.chatContents[this.chatContents.length - 1].question +=
|
|
|
- a.charAt(this.printIndex);
|
|
|
+ this.chatContents[this.chatContents.length - 1].question += a.charAt(
|
|
|
+ this.printIndex
|
|
|
+ );
|
|
|
this.printIndex++;
|
|
|
if (flag) {
|
|
|
let contant1 = document.getElementById("contant1");
|
|
@@ -905,8 +914,7 @@ export default {
|
|
|
clearInterval(this.flagTime);
|
|
|
let ob = {
|
|
|
label: 0,
|
|
|
- content:
|
|
|
- this.chatContents[this.chatContents.length - 1].question,
|
|
|
+ content: this.chatContents[this.chatContents.length - 1].question,
|
|
|
};
|
|
|
this.saveRecord(ob);
|
|
|
//在这判断负面情绪是否足够5个
|
|
@@ -946,31 +954,29 @@ export default {
|
|
|
selectMood(val) {
|
|
|
// this.sendMsgFlag=true;
|
|
|
let that = this;
|
|
|
- axios
|
|
|
- .post(`http://192.168.219:9999/sentiment`, { text: val })
|
|
|
- .then((res) => {
|
|
|
- that.sendMsgFlag = true;
|
|
|
- that.threeAnswers.push(res.data.sentiment);
|
|
|
- //是否问问题的标志
|
|
|
- //当答案小于3时需要接着提问
|
|
|
- if (that.threeAnswers.length < 3) {
|
|
|
- that.askQuestions();
|
|
|
- } else if (that.threeAnswers.length === 3) {
|
|
|
- //当等于3时需要判断是否接着提问
|
|
|
- //当负面情绪小于2时则终止询问
|
|
|
- //当负面情绪大于等于2时需要再次提问
|
|
|
- that.judgeMood(2);
|
|
|
- } else if (that.threeAnswers.length === 4) {
|
|
|
- //当问题等于4时再次询问
|
|
|
- that.askQuestions();
|
|
|
- } else if (that.threeAnswers.length === 5) {
|
|
|
- //调用判断结果负面情绪是否大于等于3
|
|
|
- that.judgeMood(3);
|
|
|
- }
|
|
|
+ axios.post(`http://192.168.219:9999/sentiment`, { text: val }).then((res) => {
|
|
|
+ that.sendMsgFlag = true;
|
|
|
+ that.threeAnswers.push(res.data.sentiment);
|
|
|
+ //是否问问题的标志
|
|
|
+ //当答案小于3时需要接着提问
|
|
|
+ if (that.threeAnswers.length < 3) {
|
|
|
+ that.askQuestions();
|
|
|
+ } else if (that.threeAnswers.length === 3) {
|
|
|
+ //当等于3时需要判断是否接着提问
|
|
|
+ //当负面情绪小于2时则终止询问
|
|
|
+ //当负面情绪大于等于2时需要再次提问
|
|
|
+ that.judgeMood(2);
|
|
|
+ } else if (that.threeAnswers.length === 4) {
|
|
|
+ //当问题等于4时再次询问
|
|
|
+ that.askQuestions();
|
|
|
+ } else if (that.threeAnswers.length === 5) {
|
|
|
+ //调用判断结果负面情绪是否大于等于3
|
|
|
+ that.judgeMood(3);
|
|
|
+ }
|
|
|
|
|
|
- //当回答的答案大于等于3时判断是否结束,当负面情绪大于等于2时
|
|
|
- // that.judgeMood();
|
|
|
- });
|
|
|
+ //当回答的答案大于等于3时判断是否结束,当负面情绪大于等于2时
|
|
|
+ // that.judgeMood();
|
|
|
+ });
|
|
|
},
|
|
|
askEnd(val) {
|
|
|
this.chatContents.push({
|
|
@@ -1227,4 +1233,4 @@ export default {
|
|
|
height:70vh;
|
|
|
overflow:auto;
|
|
|
} */
|
|
|
-</style>
|
|
|
+</style>
|