treatDepression.vue 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187
  1. <template>
  2. <div class="main_right_height">
  3. <div class="smart_content">
  4. <el-row>
  5. <!-- <el-col :span="1">&nbsp;</el-col> -->
  6. <div style="text-align: right">
  7. <i
  8. class="el-icon-refresh"
  9. style="cursor: pointer; color: blue"
  10. @click="init()"
  11. ></i>
  12. </div>
  13. <el-col :span="24">
  14. <div
  15. class="chat-window"
  16. style="padding-left: 20px; padding-right: 20px; margin-top: 20px"
  17. id="contant1"
  18. ref="scrollview"
  19. >
  20. <div v-if="echoFlag" style="text-align: center">
  21. <i class="el-icon-loading"></i>
  22. </div>
  23. <!-- <div style="text-align: right">
  24. <i class="el-icon-loading"></i>
  25. </div> -->
  26. <div
  27. class="chat-msg-content"
  28. id="rongqi"
  29. v-for="(content, index) in chatContents"
  30. :key="index"
  31. >
  32. <div
  33. v-if="content.from == 1 && content.question !== ''"
  34. class="main_answer_right"
  35. style="margin-top: 10px"
  36. >
  37. <!-- &&!(chatContents.length - 1 == index) -->
  38. <div
  39. class="img-wrapper"
  40. v-if="
  41. (content.isType == 0 && chatContents.length - 1 == index) ||
  42. content.isType == -1 ||
  43. (content.isType == 5 && chatContents.length - 1 == index)
  44. "
  45. >
  46. <img width="60px" heigth="60px" class="img" :src="from1" />
  47. </div>
  48. <div
  49. class="message-wrapper message-wrapper-left"
  50. v-if="
  51. (content.isType == 0 && chatContents.length - 1 == index) ||
  52. content.isType == -1 ||
  53. (content.isType == 5 && chatContents.length - 1 == index)
  54. "
  55. >
  56. <div class="message" v-if="content.isType == 0">
  57. <el-radio-group
  58. v-model="answerList[content.index].checkItems"
  59. @input="nextHandle(content.index)"
  60. >
  61. <el-radio
  62. style="width: 100%"
  63. v-for="(item, index) in content.question"
  64. :key="index"
  65. size="small"
  66. :label="item"
  67. border
  68. >{{ item }}</el-radio
  69. >
  70. </el-radio-group>
  71. </div>
  72. <div class="message" v-if="content.isType == 5">
  73. <el-radio-group
  74. v-model="answerList[content.index].checkItems"
  75. @input="nextHandle(content.index)"
  76. >
  77. <el-radio
  78. v-for="(item, index) in content.question"
  79. :key="index"
  80. size="small"
  81. :label="item.label"
  82. border
  83. >{{ item.name }}</el-radio
  84. >
  85. </el-radio-group>
  86. </div>
  87. <div class="message" v-if="content.isType == -1">
  88. {{ content.question }}
  89. </div>
  90. </div>
  91. </div>
  92. <el-row v-if="content.from == 2" style="margin-top: 10px">
  93. <el-col :span="10"> &nbsp; </el-col>
  94. <el-col :span="14">
  95. <div class="main_answer_left" style="float: right">
  96. <div class="message-wrapper message-wrapper-right">
  97. <el-radio-group
  98. v-if="content.isScale"
  99. v-model="answerList[content.index].checkItems"
  100. @input="nextHandle(content.index)"
  101. >
  102. <el-radio
  103. style="width: 100%"
  104. v-for="(item, index) in content.question"
  105. :key="index"
  106. size="small"
  107. :label="item"
  108. border
  109. >{{ item }}</el-radio
  110. >
  111. </el-radio-group>
  112. <el-radio-group
  113. v-if="!content.isScale && content.isType == 0"
  114. v-model="content.radio"
  115. :disabled="!(chatContents.length - 1 == index)"
  116. @input="chooseAnswer(content)"
  117. >
  118. <el-radio
  119. style="width: 100%"
  120. v-for="item in content.question"
  121. :key="item.id"
  122. size="small"
  123. :label="item.nextQuestionNo"
  124. border
  125. >{{ item.answer }}</el-radio
  126. >
  127. </el-radio-group>
  128. <div
  129. class="send_class"
  130. v-if="content.isType == 1 || content.isType == 3"
  131. >
  132. <el-input
  133. :disabled="!(chatContents.length - 1 == index)"
  134. v-if="content.isType == 1 || content.isType == 3"
  135. v-model="content.text"
  136. @keyup.native.enter="sendMessageFun(content)"
  137. /><i
  138. v-show="chatContents.length - 1 == index"
  139. style="
  140. width: 20px;
  141. height: 20px;
  142. color: #57c02c;
  143. margin-left: 10px;
  144. "
  145. v-if="content.isType == 1 || content.isType == 3"
  146. @click="sendMessageFun(content)"
  147. class="el-icon-s-promotion"
  148. ></i>
  149. <!-- {{content}} -->
  150. </div>
  151. <div
  152. class="message_form2"
  153. style="color: #000000"
  154. v-if="content.isType == -1"
  155. >
  156. {{ content.question }}
  157. </div>
  158. </div>
  159. <div class="img-wrapper">
  160. <img width="60px" heigth="60px" class="img" :src="from2" />
  161. </div>
  162. </div>
  163. </el-col>
  164. </el-row>
  165. </div>
  166. </div>
  167. </el-col>
  168. <!-- <el-col :span="1">&nbsp;</el-col> -->
  169. </el-row>
  170. <el-row v-show="inputFlag === 2" class="footSendSelect">
  171. <el-col :span="1"> &nbsp; </el-col>
  172. <el-col :span="22" style="margin-top: 20px; margin-bottom: 20px">
  173. <div>
  174. <el-radio
  175. style="margin-top: 10px"
  176. v-for="(item, index) in scale_checkItems"
  177. :key="index"
  178. v-model="radio"
  179. :label="item"
  180. fill="#57ACBB"
  181. @change="selectRadio(item)"
  182. >{{ item }}</el-radio
  183. >
  184. </div></el-col
  185. >
  186. <el-col :span="1"> &nbsp; </el-col>
  187. </el-row>
  188. <el-row v-show="inputFlag === 3" class="footSendSelect">
  189. <el-col :span="1"> &nbsp; </el-col>
  190. <el-col :span="22" style="margin-top: 20px; margin-bottom: 20px">
  191. <div>
  192. <el-radio
  193. :disabled="!scaleSelectFlag"
  194. style="margin-top: 10px"
  195. v-for="(item, index) in scale_checkItems"
  196. :key="index"
  197. v-model="radio"
  198. :label="item"
  199. fill="#57ACBB"
  200. @change="choiceTriger(item)"
  201. >{{ item }}</el-radio
  202. >
  203. </div></el-col
  204. >
  205. <el-col :span="1"> &nbsp; </el-col>
  206. </el-row>
  207. </div>
  208. <!-- 弹出框显示视频视频从头开始播放,下方有按钮--按钮点击进行访问下一题 -->
  209. <el-dialog
  210. :close-on-click-modal="false"
  211. title="刺激呈现"
  212. :visible.sync="centerDialogVisible"
  213. width="80%"
  214. center
  215. >
  216. <span>
  217. <video width="100%" height="100%" controls>
  218. <source src="../assets/EMDR.mp4" type="video/mp4" />
  219. </video>
  220. </span>
  221. <span slot="footer" class="dialog-footer">
  222. <!-- <el-button @click="centerDialogVisible = false">取 消</el-button> -->
  223. <el-button type="primary" @click="centerDialogVisible = false"
  224. >我已看完</el-button
  225. >
  226. </span>
  227. </el-dialog>
  228. <!-- <el-button @click="centerDialogVisible = true">打开窗口</el-button> -->
  229. </div>
  230. </template>
  231. <script>
  232. import HeadImg from "@/assets/lion.png";
  233. import HeadImg1 from "@/assets/newImage/peopleUser.png";
  234. import axios from "axios";
  235. import Video from "./Video.vue";
  236. export default {
  237. components: { Video },
  238. data() {
  239. return {
  240. centerDialogVisible: false,
  241. tmpRadio: "",
  242. radio: "",
  243. inputFlag: 1,
  244. desc: "",
  245. from1: HeadImg,
  246. from2: HeadImg1,
  247. chatContents: [],
  248. //前三个问题
  249. preList: [],
  250. questionList: [],
  251. //随机的4个数集合
  252. radomNumList: [],
  253. questionNum: 0,
  254. //随机4个问题的集合
  255. randomQuestion: [],
  256. //随机4个答案的集合
  257. randomAnswer: [],
  258. //全部题目
  259. scale_infos: [{ answer: "" }],
  260. //题目总数
  261. scale_all: 0,
  262. scale_checkItems: [],
  263. //进度参数
  264. scale_percent: [],
  265. //
  266. scale_index: 0,
  267. // 答案数据
  268. scale_result: [],
  269. //检测情绪前的发送数据条数
  270. threeAnswers: [],
  271. //负面情绪标志
  272. moonNegative: 0,
  273. scale_flag: "",
  274. pressure_flag: "",
  275. sendMsgFlag: true,
  276. scaleSelectFlag: true,
  277. radio3: "",
  278. scaleTestStart: false,
  279. flag: "",
  280. questionList: [],
  281. answerList: [],
  282. interveneId: "",
  283. //当回显接口正在调用时为true
  284. echoFlag: false,
  285. //当前返回历史记录
  286. currenRecordTotol: 0,
  287. //当前页
  288. pageNum: 1,
  289. //一页多少条
  290. pageSize: 10,
  291. printIndex: 0,
  292. flagTime: null,
  293. openDialogFlag: true,
  294. isTimeout: false,
  295. timeoutDes: "",
  296. //获取下一题问题的编号
  297. preQuestion: "",
  298. oNum: 1,
  299. currentId: "",
  300. };
  301. },
  302. created() {},
  303. mounted() {
  304. var scrollview = this.$refs["scrollview"];
  305. this.interveneId = this.$route.query.id;
  306. //
  307. // this.init("start");
  308. // this.selectScale("20220805135201");
  309. //上来就查询之前的聊天记录
  310. scrollview.addEventListener("scroll", this.handleScroll, true);
  311. //先调用接口知道是否出来弹窗
  312. this.selectPage();
  313. //判断是否是第一次进来,如果查询记录为空,则是第一次进来--则需要调用出初始化语句
  314. //如果不是第一次进来--则接着上次的记录说
  315. },
  316. beforeDestroy() {
  317. let that = this;
  318. var scrollview = this.$refs["scrollview"];
  319. scrollview.removeEventListener("scroll", that.handleScroll);
  320. },
  321. methods: {
  322. openDialog() {
  323. openDialogFlag = true;
  324. },
  325. handleScroll() {
  326. let scrollview = this.$refs["scrollview"];
  327. if (scrollview.scrollTop == 0) {
  328. //当前没有调接口的时候
  329. if (!this.echoFlag) {
  330. //判断上一次的页面是否足够10条如果不够就不查询了
  331. //页面页数加1
  332. if (this.currenRecordTotol == this.pageSize) {
  333. this.pageNum++;
  334. this.selectPage();
  335. }
  336. }
  337. //当等于0时需要调用加载上一页
  338. }
  339. // console.log("qlkhdeqj1");
  340. //滚动监听事件
  341. },
  342. //保存聊天记录--单条
  343. saveRecord(val) {
  344. let data = {
  345. identifier: sessionStorage.getItem("num"),
  346. label: val.label,
  347. content: val.content,
  348. userName: sessionStorage.getItem("name"),
  349. questionNo: val.questionNo,
  350. type: this.interveneId,
  351. num: this.oNum,
  352. };
  353. if (val.content && val.content.includes("测评结果")) {
  354. let result = sessionStorage.getItem("testResults");
  355. data.content = val.content + result;
  356. }
  357. console.log(data);
  358. // this.$message.success("保存成功");
  359. this.$http.post(`/intelligent/save`, data, (res) => {
  360. if (res.data.code == 200) {
  361. } else {
  362. }
  363. });
  364. },
  365. //查询聊天记录
  366. selectPage() {
  367. let that = this;
  368. that.echoFlag = true;
  369. this.$http.get(
  370. `/intelligent/dialogueRecords?identifier=${sessionStorage.getItem(
  371. "num"
  372. )}&pageNum=${that.pageNum}&pageSize=${that.pageSize}&type=${that.interveneId}`,
  373. {},
  374. (res) => {
  375. if (res.code == 200) {
  376. //res.data.greetings==
  377. // console.log(res.data.greetings==null)
  378. //
  379. if (that.pageNum == 1) {
  380. if (res.data.greetings == null) {
  381. that.isTimeout = false;
  382. that.timeoutDes = "";
  383. } else {
  384. that.isTimeout = true;
  385. that.timeoutDes = res.data.greetings;
  386. }
  387. } else {
  388. that.isTimeout = false;
  389. }
  390. // that.isTimeout = true;
  391. // that.timeoutDes = "三天没见了,你最近好吗";
  392. that.echoFlag = false;
  393. // res.data.
  394. if (res.data.intelligentDialogueEntities.content.length > 0) {
  395. that.currenRecordTotol =
  396. res.data.intelligentDialogueEntities.content.length;
  397. this.oNum = res.data.intelligentDialogueEntities.content[0].num;
  398. //判断当前是第几页
  399. //如果是第一个
  400. for (
  401. let i = 0;
  402. i < res.data.intelligentDialogueEntities.content.length;
  403. i++
  404. ) {
  405. if (res.data.intelligentDialogueEntities.content[i].label == "0") {
  406. //当是第一页第一个时,不取了
  407. //判断最后一个是不是填空还是选择
  408. //如果时填空或选择则后两个都不如库
  409. if (!(that.pageNum == 1 && i == 0)) {
  410. //当满足条件时
  411. this.chatContents.unshift({
  412. from: 1,
  413. //是否是量表的信息
  414. isScale: false,
  415. //是单选还是文字 0单选 1填空 -1描述
  416. isType: -1,
  417. //可点击可不点击 0单选 1填空
  418. disabled: false,
  419. //问题
  420. question: res.data.intelligentDialogueEntities.content[i].content,
  421. //头像
  422. from1: HeadImg,
  423. });
  424. } else {
  425. that.preQuestion =
  426. res.data.intelligentDialogueEntities.content[0].questionNo;
  427. }
  428. } else {
  429. if (!(that.pageNum == 1 && i == 0)) {
  430. this.chatContents.unshift({
  431. from: 2,
  432. //是否是量表的信息
  433. isScale: false,
  434. //是单选还是文字 0单选 1填空 -1描述
  435. isType: -1,
  436. //可点击可不点击 0单选 1填空
  437. disabled: false,
  438. //问题
  439. question: res.data.intelligentDialogueEntities.content[i].content,
  440. //头像
  441. from1: HeadImg,
  442. });
  443. }
  444. }
  445. }
  446. let contant1 = document.getElementById("contant1");
  447. this.sleep(300).then(() => {
  448. contant1.scrollTop = 2;
  449. });
  450. console.log(this.chatContents);
  451. } else {
  452. this.oNum = 1;
  453. }
  454. //如满足条件//应还有一个参数--用来表示是否需要显示提示几天不见的话语
  455. if (that.isTimeout) {
  456. that.chatContents.push({
  457. //是问题还是答案
  458. from: 1,
  459. //是否是量表的信息
  460. isScale: false,
  461. //是单选还是文字 0单选 1填空 -1描述
  462. isType: -1,
  463. //可点击可不点击 0单选 1填空
  464. disabled: false,
  465. //问题
  466. question: "",
  467. //头像
  468. from1: HeadImg,
  469. });
  470. that.pFun(that.timeoutDes, true, "", false, true);
  471. } else {
  472. if (that.pageNum == 1) {
  473. //当是第一次进来时,需要调用question 获取第一次问答信息,但是传输的是type为5
  474. if (res.data.intelligentDialogueEntities.content.length == 0) {
  475. //将当前的设置为5
  476. that.interveneId = 5;
  477. that.getQuestion("", false);
  478. } else {
  479. let id = res.data.intelligentDialogueEntities.content[0].questionNo;
  480. that.getQuestion(id, false);
  481. }
  482. }
  483. }
  484. //当是第一页
  485. //且总条数为0时
  486. // if (that.pageNum == 1) {
  487. // //当是第一次进来时,需要调用question 获取第一次问答信息,但是传输的是type为5
  488. // if (res.data.intelligentDialogueEntities.content.length == 0) {
  489. // //将当前的设置为5
  490. // that.interveneId = 5;
  491. // that.getQuestion("", false);
  492. // } else {
  493. // let id =
  494. // res.data.intelligentDialogueEntities.content[0].questionNo;
  495. // that.getQuestion(id, false);
  496. // }
  497. // }
  498. } else {
  499. }
  500. }
  501. );
  502. },
  503. //保存测试记录
  504. saveChat() {
  505. let list = [];
  506. for (let i = 0; i < this.chatContents.length; i++) {
  507. //先判断当前类型是form是左侧还是右侧
  508. //当是对话左侧的时候
  509. if (this.chatContents[i].from == 1) {
  510. if (this.chatContents[i].question !== "") {
  511. if (this.chatContents[i].isType == -1) {
  512. //存储进去
  513. let ob = {
  514. from: this.chatContents[i].from,
  515. question: this.chatContents[i].question,
  516. };
  517. list.push(ob);
  518. } else if (this.chatContents[i].isType == 0) {
  519. //如果是选择题选择题且必定是量表
  520. let ob = {
  521. from: 2,
  522. question: this.answerList[this.chatContents[i].index].checkItems,
  523. };
  524. list.push(ob);
  525. } else if (this.chatContents[i].isType == 5) {
  526. let ob = {
  527. from: 2,
  528. question: this.answerList[this.chatContents[i].index].checkItems,
  529. };
  530. list.push(ob);
  531. }
  532. }
  533. //判断是不是量表
  534. //如果是
  535. //则判断是选择题还是描述
  536. //如果是描述
  537. } else if (this.chatContents[i].from == 2) {
  538. //如果是选择题的话
  539. if (this.chatContents[i].isType == 0) {
  540. for (let j = 0; j < this.chatContents[i].question.length; j++) {
  541. if (
  542. this.chatContents[i].question[j].nextQuestionNo ==
  543. this.chatContents[i].radio
  544. ) {
  545. let ob = {
  546. from: 2,
  547. question: this.chatContents[i].question[j].answer,
  548. };
  549. list.push(ob);
  550. }
  551. }
  552. } else if (this.chatContents[i].isType == 1) {
  553. //如果是填空题
  554. let ob = {
  555. from: 2,
  556. question: this.chatContents[i].text,
  557. };
  558. list.push(ob);
  559. }
  560. //先看
  561. }
  562. }
  563. // console.log(JSON.stringify(list));
  564. //调用保存接口
  565. this.saveRealFun(list);
  566. },
  567. saveRealFun(list) {
  568. this.$http.post(
  569. `/chat/complete/chat`,
  570. {
  571. content: list,
  572. userName: sessionStorage.getItem("name"),
  573. label: this.interveneId,
  574. identifier: sessionStorage.getItem("num"),
  575. num: this.oNum,
  576. },
  577. (res) => {
  578. if (res.data.code == 200) {
  579. } else {
  580. that.$message.error("访问服务器失败!");
  581. }
  582. }
  583. );
  584. },
  585. init() {
  586. this.getQuestion(1, true);
  587. let contant1 = document.getElementById("contant1");
  588. this.sleep(101).then(() => {
  589. contant1.scrollTop = contant1.scrollHeight;
  590. });
  591. },
  592. sendMessageFun(val) {
  593. if (val.text == "") {
  594. this.$message.warning("请输入内容");
  595. return;
  596. }
  597. // 若问题类型为3,校验输入值是否为0~100的整数
  598. if (val.isType == 3) {
  599. var a = val.text;
  600. var reg = new RegExp("^(\\d|[1-9]\\d|100)$");
  601. if (!reg.test(a)) {
  602. this.$message.warning("请输入0~100之间的整数");
  603. return;
  604. }
  605. }
  606. let id = val.question[0].nextQuestionNo;
  607. let questionNo = val.question[0].questionNo;
  608. this.chatContents[this.chatContents.length - 1] = {
  609. //是问题还是答案
  610. from: 2,
  611. //是否是量表的信息
  612. isScale: false,
  613. //是单选还是文字 0单选 1填空 -1描述
  614. isType: -1,
  615. //可点击可不点击 0单选 1填空
  616. disabled: false,
  617. //问题
  618. question: val.text,
  619. //头像
  620. from1: HeadImg1,
  621. };
  622. //发送填空题
  623. if (!id == "") {
  624. let paramsSave = {
  625. label: 1,
  626. content: val.text,
  627. questionNo: questionNo,
  628. };
  629. //当标志是5时,则不需要保存
  630. if (this.interveneId != 5) {
  631. this.saveRecord(paramsSave);
  632. this.getQuestion(id, true);
  633. } else {
  634. //当标志是5时需要调用修改昵称接口
  635. //且当前问题编号为2时
  636. if (questionNo == "2") {
  637. console.log(123);
  638. this.updateName(val.text, id);
  639. }
  640. }
  641. } else {
  642. this.chatContents.push({
  643. //是问题还是答案
  644. from: 1,
  645. //是否是量表的信息
  646. isScale: false,
  647. //是单选还是文字 0单选 1填空 -1描述
  648. isType: -1,
  649. //可点击可不点击 0单选 1填空
  650. disabled: false,
  651. //问题
  652. question: "对话结束",
  653. //头像
  654. from1: HeadImg,
  655. });
  656. // let paramsSave = {
  657. // label: 1,
  658. // content: val.text,
  659. // questionNo: questionNo,
  660. // };
  661. // this.saveRecord(paramsSave);
  662. // this.saveChat();
  663. // let contant1 = document.getElementById("contant1");
  664. // this.sleep(101).then(() => {
  665. // contant1.scrollTop = contant1.scrollHeight;
  666. // });
  667. }
  668. },
  669. updateName(val, id) {
  670. let that = this;
  671. let data = {
  672. identifier: sessionStorage.getItem("num"),
  673. userName: val,
  674. };
  675. this.$http.post(`/v1/user/updateUserName`, data, (res) => {
  676. console.log("updateUserName");
  677. if (res.data.code == 200) {
  678. //当等于5且编号的能够与
  679. that.getQuestion(id, false);
  680. } else {
  681. }
  682. });
  683. },
  684. // 获取问题
  685. //第二个参数判断是否是需要回显的,如果是数据已返回就不回显了
  686. //或保存,当第二个参数为true时需要保存,当第二个参数为false时不需要保存
  687. //第三个参数判断是否出现
  688. getQuestion(id, flag) {
  689. let that = this;
  690. if (this.interveneId == 4) {
  691. if (id == "109" || id == "117" || id == "119") {
  692. this.centerDialogVisible = true;
  693. }
  694. }
  695. this.$http.get(
  696. `chat/getQuestion/${that.interveneId}`,
  697. {
  698. id: id,
  699. num: this.oNum,
  700. },
  701. (res) => {
  702. if (res.code == "200") {
  703. console.log("res");
  704. console.log(res);
  705. console.log(that.interveneId);
  706. if (that.interveneId == 5 && id == 3) {
  707. // that.interveneId = that.$route.query.id;
  708. //然后再调用question
  709. // that.getQuestion("", true);
  710. }
  711. let result = res.data;
  712. // 若无下一题,oNum加1进入下一部分
  713. if (result == null) {
  714. this.oNum = this.oNum < 5 ? ++this.oNum : 1;
  715. this.endHandle();
  716. this.getQuestion(1, true);
  717. return;
  718. }
  719. if (result.num) {
  720. that.oNum = result.num;
  721. }
  722. if (result.question && result.question.includes("测评结果")) {
  723. debugger;
  724. //当时量表抑郁的时候是这样显示结果的
  725. // let str = sessionStorage.getItem("testResults");
  726. if (that.interveneId == 2) {
  727. let str = sessionStorage.getItem("testResultsScore");
  728. if (str <= 4) {
  729. result.question =
  730. "您的情绪状态得分在正常范围内。请继续保持积极心态,关注生活中的美好,预防抑郁情绪。如有需要,随时与我沟通,一起守护您的心理健康。";
  731. } else if (str >= 5 && str <= 9) {
  732. result.question =
  733. "您可能正经历轻度抑郁。请放心,我会为您提供专业的心理支持,帮助您调节情绪,及时缓解抑郁情绪。我们一起努力,让心情重回明朗。";
  734. } else if (str >= 10 && str <= 14) {
  735. result.question =
  736. "您的抑郁情绪较为明显。我强烈建议您接受专业的心理治疗,以改善当前状况。我会与您并肩作战,共同应对这个挑战,助您早日走出阴霾。";
  737. } else if (str >= 15 && str <= 19) {
  738. result.question =
  739. "您可能正面临严重的抑郁情绪。面对生活中的阴霾与挑战,我真诚地建议您考虑咨询心理医生或精神科医生,把自己从不适的情绪中分离出来。";
  740. } else if (str >= 20) {
  741. result.question =
  742. "您的抑郁程度较为严重。";
  743. }
  744. }
  745. if (that.interveneId == 1) {
  746. let str = sessionStorage.getItem("testResultsScore");
  747. if (str <= 4) {
  748. result.question =
  749. "您的情绪状态得分在正常范围内。请继续保持心态平和,有效管理压力。如有需要,随时与我沟通,一起守护您的心理健康。";
  750. } else if (str >= 5 && str <= 9) {
  751. result.question =
  752. "您可能正经历轻度焦虑。请放心,我会为您提供专业的心理支持,帮助您学习应对焦虑的技巧。一起努力,让您的心情更加轻松自在。";
  753. } else if (str >= 10 && str <= 14) {
  754. result.question =
  755. "您的焦虑情绪较为明显。我建议您接受系统的心理咨询,以减轻焦虑对您生活的影响。我也会与您同行,共克困难。";
  756. } else if (str >= 15) {
  757. result.question =
  758. "您目前有较为严重的焦虑情绪。我真诚地希望您接受专业的医疗和心理援助。我会全力支持您,与您一起应对这个挑战,直至您重获内心安宁。";
  759. }
  760. }
  761. if (that.interveneId == 3) {
  762. let str = sessionStorage.getItem("testResultsScore");
  763. if (str <= 5) {
  764. result.question =
  765. "您的睡眠质量非常优秀。请继续保持健康的睡眠习惯,确保充足的休息时间,以维持良好的睡眠质量和日间功能。如有任何变化,请随时与我沟通。";
  766. } else if (str >= 6 && str <= 10) {
  767. result.question =
  768. "您的睡眠质量较好。为了进一步提升睡眠品质,建议您关注睡眠环境,减少干扰因素。我会与您一同探讨更多优化睡眠的方法,让您的睡眠更加深沉和高效。";
  769. } else if (str >= 11 && str <= 15) {
  770. result.question =
  771. "您的睡眠质量有待提升。请放心,我会提供专业的指导,帮助您改善入睡困难、睡眠干扰等问题。通过共同努力,我们能够让您享受到更健康的睡眠";
  772. } else if (str >= 16) {
  773. result.question =
  774. "您的睡眠质量非常差,这可能对您的健康和日间功能造成了严重影响。我强烈建议您立即开始改善睡眠,包括调整作息时间、减少压力等。我会全力支持您,与您一起克服睡眠障碍,恢复良好的睡眠质量";
  775. }
  776. }
  777. if (that.interveneId == 4) {
  778. let str = sessionStorage.getItem("testResultsScore");
  779. if (str <= 49) {
  780. result.question =
  781. "您的得分在正常范围内,显示您目前的焦虑水平是正常的。请继续保持心态平和,有效管理压力。如有任何焦虑情绪出现,请及时与我沟通,共同守护您的心理健康。";
  782. } else if (str >= 50 && str <= 59) {
  783. result.question =
  784. "您可能有轻度焦虑。请放心,我会提供专业的心理支持,帮助您学习应对焦虑的技巧。一起努力,让您的心情更加轻松自在。";
  785. } else if (str >= 60 && str <= 69) {
  786. result.question =
  787. "您的焦虑症状已较明显。我建议您接受系统的心理咨询,如放松训练、认知重构等,以减轻焦虑对您生活的影响。我会与您同行,共克时艰。";
  788. } else if (str >= 70) {
  789. result.question =
  790. "您可能正面临严重的焦虑症状。我强烈建议您立即寻求专业医疗和心理援助。我会全力支持您,与您一起应对这个挑战,直至您重获内心的安宁。";
  791. }
  792. }
  793. // result.question = str;
  794. }
  795. if (result.id) {
  796. that.currentId = result.id;
  797. }
  798. // 将本次问题加入对话
  799. this.chatContents.push({
  800. //是问题还是答案
  801. from: 1,
  802. //是否是量表的信息
  803. isScale: false,
  804. //是单选还是文字 0单选 1填空 -1描述
  805. isType: -1,
  806. //可点击可不点击 0单选 1填空
  807. disabled: false,
  808. //问题
  809. question: "",
  810. //头像
  811. from1: HeadImg,
  812. });
  813. this.pFun(result.question, true, result, flag, false);
  814. }
  815. }
  816. );
  817. },
  818. // 本轮对话结束
  819. endHandle() {
  820. this.$alert("本段对话结束", "提示", {
  821. showCancelButton: true,
  822. cancelButtonText: "结束对话",
  823. confirmButtonText: "继续对话",
  824. callback: (action) => {
  825. if ("confirm" == action) {
  826. this.getQuestion(1, true);
  827. } else if ("cancel" == action) {
  828. this.$router.go(-1);
  829. }
  830. },
  831. });
  832. },
  833. //修改文本打印效果
  834. pFun(val, flag, result, saveFlag, isShow) {
  835. clearInterval(this.flagTime);
  836. let that = this;
  837. //3个循环播放
  838. this.chatContents[this.chatContents.length - 1].question = "";
  839. this.printIndex = 0;
  840. // let a = val;
  841. let a = "......";
  842. if (this.interveneId != 5) {
  843. let paramsSave = {
  844. label: 0,
  845. content: result ? result.question : "",
  846. questionNo: result.id,
  847. };
  848. if (saveFlag) {
  849. this.saveRecord(paramsSave);
  850. }
  851. }
  852. this.flagTime = setInterval(
  853. () => {
  854. if (this.printIndex < a.length) {
  855. this.chatContents[this.chatContents.length - 1].question += a.charAt(
  856. this.printIndex
  857. );
  858. this.printIndex++;
  859. if (a == "......") {
  860. if (this.printIndex == 4) {
  861. this.chatContents[this.chatContents.length - 1].question = "";
  862. this.printIndex = 0;
  863. a = val;
  864. }
  865. }
  866. if (flag) {
  867. if (a != "......") {
  868. let contant1 = document.getElementById("contant1");
  869. this.sleep(101).then(() => {
  870. contant1.scrollTop = contant1.scrollHeight;
  871. // contant1.scrollTo({top:contant1.scrollHeight,behavior: 'smooth'});
  872. });
  873. }
  874. }
  875. } else {
  876. if (flag) {
  877. that.buttonFlag = false;
  878. //清除定时器
  879. let contant1 = document.getElementById("contant1");
  880. this.sleep(101).then(() => {
  881. contant1.scrollTop = contant1.scrollHeight;
  882. });
  883. clearInterval(this.flagTime);
  884. //在这判断负面情绪是否足够5个
  885. if (this.interveneId != 5) {
  886. // let paramsSave = {
  887. // label: 0,
  888. // content: result ? result.question : "",
  889. // questionNo: result.id,
  890. // };
  891. // if (saveFlag) {
  892. // this.saveRecord(paramsSave);
  893. // }
  894. if (isShow) {
  895. this.chatContents.push({
  896. id: 123456789,
  897. from: 2,
  898. isScale: false,
  899. //是单选还是文字 0单选 1填空 -1描述
  900. isType: 0,
  901. disabled: false,
  902. question: [
  903. {
  904. id: "123456789",
  905. createTime: null,
  906. updateTime: null,
  907. questionNo: "-200",
  908. nextQuestionNo: "-200",
  909. questionType: "0",
  910. answer: "继续上次",
  911. label: "2",
  912. },
  913. {
  914. id: "1234567890",
  915. createTime: null,
  916. updateTime: null,
  917. questionNo: "-201",
  918. nextQuestionNo: "-201",
  919. questionType: "0",
  920. answer: "重新开始",
  921. label: "2",
  922. },
  923. ],
  924. from1: HeadImg,
  925. radio: false,
  926. text: "",
  927. });
  928. return;
  929. }
  930. }
  931. // identifier: sessionStorage.getItem("num"),
  932. // label: val.label,
  933. // content: val.content,
  934. // userName:sessionStorage.getItem("name"),
  935. // questionNo: val.questionNo,
  936. // type: this.interveneId,
  937. if (this.interveneId == 5 && result.id == "3") {
  938. this.interveneId = that.$route.query.id;
  939. this.getQuestion("", true);
  940. return;
  941. }
  942. if (!result.nextQuestionNo) {
  943. // 无下一题,查询答案
  944. this.getAnswer(result.id);
  945. //保存所选问题的答案
  946. } else if (/flag/g.test(result.nextQuestionNo)) {
  947. // 下一题为量表,查询量表内容
  948. this.flag = result.nextQuestionNo.split("-")[1];
  949. this.getScaleInfo(this.flag);
  950. // this.flag = "20210617121646";
  951. // this.getScaleInfo("20210617121646");
  952. } else {
  953. // 下一题非量表,继续查询下一题
  954. this.getQuestion(result.nextQuestionNo, true);
  955. }
  956. } else {
  957. this.printIndex = 0;
  958. this.chatContents[this.chatContents.length - 1].question = ".";
  959. }
  960. }
  961. },
  962. flag ? 60 : 300
  963. );
  964. },
  965. // 获取答案
  966. getAnswer(id) {
  967. this.$http.get(
  968. `chat/getAnswer/${id}/${this.interveneId}/${this.oNum}`,
  969. {},
  970. (res) => {
  971. if (res.code == "200") {
  972. if (res.data.length > 0) {
  973. let result = res.data;
  974. if (parseInt(result[0].questionType) == 1) {
  975. this.chatContents.push({
  976. id: result[0].id,
  977. from: 2,
  978. isScale: false,
  979. //是单选还是文字 0单选 1填空 -1描述
  980. isType: parseInt(result[0].questionType),
  981. disabled: false,
  982. question: result,
  983. from1: HeadImg,
  984. radio: false,
  985. text: "",
  986. });
  987. } else {
  988. this.chatContents.push({
  989. from: 2,
  990. isScale: false,
  991. //是单选还是文字 0单选 1填空 -1描述
  992. isType: parseInt(result[0].questionType),
  993. disabled: false,
  994. question: result,
  995. from1: HeadImg,
  996. radio: false,
  997. text: "",
  998. });
  999. }
  1000. let contant1 = document.getElementById("contant1");
  1001. this.sleep(101).then(() => {
  1002. contant1.scrollTop = contant1.scrollHeight;
  1003. });
  1004. } else {
  1005. this.oNum = this.oNum < 5 ? ++this.oNum : 1;
  1006. this.endHandle();
  1007. }
  1008. }
  1009. }
  1010. );
  1011. },
  1012. // 获取量表信息
  1013. getScaleInfo(flag) {
  1014. this.$http.get(`v1/scale/${flag}`, {}, (res) => {
  1015. let data = res.data;
  1016. let anwserListx = [];
  1017. for (var i = 0; i < data.length; i++) {
  1018. // if(data[i].questionType=='5'){
  1019. // }
  1020. anwserListx.push({
  1021. answer: data[i].answer,
  1022. checkItems: "",
  1023. flag: data[i].flag,
  1024. id: data[i].id,
  1025. questionNo: data[i].questionNo,
  1026. questionType: data[i].questionType,
  1027. score: data[i].score,
  1028. scoreDirection: data[i].scoreDirection,
  1029. serialNo: data[i].serialNo,
  1030. weight: data[i].weight,
  1031. questionParam: data[i].questionParam,
  1032. });
  1033. }
  1034. this.questionList = res.data;
  1035. this.answerList = anwserListx;
  1036. this.scaleTestStart = true;
  1037. let checkItems = data[0].checkItems;
  1038. //先判断时哪个类型
  1039. //正常时是发布的类型是 描述和单选 --但是现在多一个特别的单选
  1040. //
  1041. this.chatContents.push({
  1042. from: 1,
  1043. isScale: true,
  1044. disabled: false,
  1045. isType: -1,
  1046. question: data[0].answer,
  1047. from1: HeadImg,
  1048. });
  1049. //当 questionType==0时 当questionType==5时
  1050. if (data[0].questionType == 0) {
  1051. this.chatContents.push({
  1052. index: 0,
  1053. from: 2,
  1054. disabled: false,
  1055. isScale: true,
  1056. isType: 0,
  1057. question: checkItems.split(";"),
  1058. from1: HeadImg,
  1059. });
  1060. } else if (data[0].questionType == 5) {
  1061. let dataTmp = JSON.parse(data[0].questionParam);
  1062. let checkIt = "";
  1063. for (let i = 0; i < dataTmp.length; i++) {
  1064. if (dataTmp.length - 1 == i) {
  1065. checkIt += dataTmp[i].label;
  1066. } else {
  1067. checkIt += dataTmp[i].label + ";";
  1068. }
  1069. }
  1070. this.chatContents.push({
  1071. index: 0,
  1072. from: 2,
  1073. disabled: false,
  1074. isScale: true,
  1075. isType: 5,
  1076. question: checkIt.split(";"),
  1077. from1: HeadImg,
  1078. });
  1079. }
  1080. let contant1 = document.getElementById("contant1");
  1081. this.sleep(101).then(() => {
  1082. contant1.scrollTop = contant1.scrollHeight;
  1083. });
  1084. });
  1085. },
  1086. // 选择答案
  1087. chooseAnswer(val) {
  1088. let id = val.radio;
  1089. if (id == "-200") {
  1090. //上一次的id
  1091. this.chatContents[this.chatContents.length - 1] = {
  1092. from: 2,
  1093. isScale: false,
  1094. isType: -1,
  1095. question: "继续上次",
  1096. from1: HeadImg,
  1097. };
  1098. this.getQuestion(this.preQuestion, false);
  1099. return;
  1100. }
  1101. if (id == "-201") {
  1102. this.chatContents[this.chatContents.length - 1] = {
  1103. from: 2,
  1104. isScale: false,
  1105. isType: -1,
  1106. question: "重新开始",
  1107. from1: HeadImg,
  1108. };
  1109. this.oNum = 1;
  1110. this.getQuestion(1, false);
  1111. return;
  1112. }
  1113. console.log("下一题编号");
  1114. console.log(id);
  1115. //循环这个数组得到选择的答案
  1116. let questionRadio = val.question;
  1117. let contentRadio = "";
  1118. let questionNo = "";
  1119. for (let i = 0; i < questionRadio.length; i++) {
  1120. if (questionRadio[i].nextQuestionNo == id) {
  1121. contentRadio = questionRadio[i].answer;
  1122. questionNo = questionRadio[i].questionNo;
  1123. }
  1124. }
  1125. let paramsSave = {
  1126. label: 1,
  1127. content: contentRadio,
  1128. questionNo: questionNo,
  1129. };
  1130. //当编号是5时不需要保存
  1131. if (this.interveneId != 5) {
  1132. this.saveRecord(paramsSave);
  1133. }
  1134. if (id == "") {
  1135. this.chatContents.push({
  1136. //是问题还是答案
  1137. from: 1,
  1138. //是否是量表的信息
  1139. isScale: false,
  1140. //是单选还是文字 0单选 1填空 -1描述
  1141. isType: -1,
  1142. //可点击可不点击 0单选 1填空
  1143. disabled: false,
  1144. //问题
  1145. question: "对话结束",
  1146. //头像
  1147. from1: HeadImg,
  1148. });
  1149. // this.saveChat();
  1150. let contant1 = document.getElementById("contant1");
  1151. this.sleep(101).then(() => {
  1152. contant1.scrollTop = contant1.scrollHeight;
  1153. });
  1154. } else {
  1155. //上一次的id
  1156. this.chatContents[this.chatContents.length - 1] = {
  1157. from: 2,
  1158. isScale: false,
  1159. isType: -1,
  1160. question: contentRadio,
  1161. from1: HeadImg,
  1162. };
  1163. this.getQuestion(id, true);
  1164. }
  1165. },
  1166. // 量表选中切换下一题
  1167. nextHandle(i) {
  1168. this.chatContents[i].disabled = true;
  1169. if (i < this.questionList.length - 1) {
  1170. let ttmp = this.answerList[i].checkItems;
  1171. this.chatContents[this.chatContents.length - 1] = {
  1172. from: 2,
  1173. isScale: false,
  1174. isType: -1,
  1175. question: ttmp,
  1176. from1: HeadImg,
  1177. };
  1178. i = i + 1;
  1179. let checkItems = this.questionList[i].checkItems;
  1180. this.chatContents.push({
  1181. index: i,
  1182. from: 1,
  1183. isScale: true,
  1184. isType: -1,
  1185. question: this.questionList[i].answer,
  1186. from1: HeadImg,
  1187. });
  1188. if (this.questionList[i].questionType == 0) {
  1189. this.chatContents.push({
  1190. index: i,
  1191. from: 2,
  1192. isScale: true,
  1193. isType: 0,
  1194. question: checkItems.split(";"),
  1195. from1: HeadImg,
  1196. });
  1197. } else if (this.questionList[i].questionType == 5) {
  1198. let dataTmp = JSON.parse(this.questionList[i].questionParam);
  1199. let checkIt = "";
  1200. for (let j = 0; j < dataTmp.length; j++) {
  1201. if (dataTmp.length - 1 == j) {
  1202. checkIt += dataTmp[j].label;
  1203. } else {
  1204. checkIt += dataTmp[j].label + ";";
  1205. }
  1206. }
  1207. this.chatContents.push({
  1208. index: i,
  1209. from: 2,
  1210. isScale: true,
  1211. isType: 5,
  1212. question: checkIt.split(";"),
  1213. from1: HeadImg,
  1214. });
  1215. }
  1216. let contant1 = document.getElementById("contant1");
  1217. this.sleep(101).then(() => {
  1218. contant1.scrollTop = contant1.scrollHeight;
  1219. });
  1220. } else {
  1221. let ttmp = this.answerList[i].checkItems;
  1222. this.chatContents[this.chatContents.length - 1] = {
  1223. from: 2,
  1224. isScale: false,
  1225. isType: -1,
  1226. question: ttmp,
  1227. from1: HeadImg,
  1228. };
  1229. this.getScaleResult(this.flag);
  1230. }
  1231. },
  1232. // 提交测试结果
  1233. getScaleResult(flag) {
  1234. this.$http.post(
  1235. `v1/result/${flag}`,
  1236. {
  1237. scale_result: this.answerList,
  1238. identifier: sessionStorage.getItem("num"),
  1239. },
  1240. (res) => {
  1241. if (res.data.code == 200) {
  1242. this.resultQuery(res.data.data);
  1243. } else {
  1244. that.$message.error("访问服务器失败!");
  1245. }
  1246. }
  1247. );
  1248. },
  1249. // 查询测试结果
  1250. resultQuery(id) {
  1251. this.$http.post(`v1/record/find/${id}`, {}, (res) => {
  1252. if (res.data.code == 200 && res.data.data) {
  1253. this.resultJsonParams = res.data.data;
  1254. let testResult = JSON.parse(res.data.data.userRecordEntity.testResult);
  1255. sessionStorage.setItem(
  1256. "testResults",
  1257. res.data.data.userRecordEntity.testResults
  1258. );
  1259. // console.log(res.data.data.userRecordEntity.testResults);
  1260. // console.log(testResult);
  1261. if (this.interveneId == 1) {
  1262. let score = Number(testResult[0].newTableContext.result[0].score);
  1263. sessionStorage.setItem("testResultsScore", score);
  1264. this.getNext(this.currentId);
  1265. } else if (this.interveneId == 2) {
  1266. let score = Number(testResult[0].newTableContext.result[0].score);
  1267. sessionStorage.setItem("testResultsScore", score);
  1268. this.getNext(this.currentId);
  1269. } else if (this.interveneId == 3) {
  1270. debugger;
  1271. // let score = Number(testResult[0].newTableContext.result[0].score);
  1272. let score = Number(testResult[0].tableContext[7].value[0]);
  1273. sessionStorage.setItem("testResultsScore", score);
  1274. this.getNext(this.currentId);
  1275. // this.chatContents.push({
  1276. // from: 1,
  1277. // isScale: false,
  1278. // isType: -1,
  1279. // question: res.data.data.userRecordEntity.testResults,
  1280. // from1: HeadImg,
  1281. // });
  1282. // this.getQuestion(44, true);
  1283. } else if (this.interveneId == 4) {
  1284. debugger;
  1285. let score = Number(testResult[0].tableContext[0].value[0]);
  1286. sessionStorage.setItem("testResultsScore", score);
  1287. this.getNext(this.currentId);
  1288. // this.chatContents.push({
  1289. // from: 1,
  1290. // isScale: false,
  1291. // isType: -1,
  1292. // question: res.data.data.userRecordEntity.testResults,
  1293. // from1: HeadImg,
  1294. // });
  1295. // this.getQuestion(46, true);
  1296. }
  1297. }
  1298. });
  1299. },
  1300. getNext(result) {
  1301. this.$http.get(
  1302. `chat/getNextQuestionByScaleResult?label=${this.interveneId}&result=${result}&num=${this.oNum}`,
  1303. {},
  1304. (res) => {
  1305. if (res.code == 200) {
  1306. if (res.data && res.data.nextQuestionNo) {
  1307. this.getQuestion(res.data.nextQuestionNo, true);
  1308. }
  1309. }
  1310. }
  1311. );
  1312. },
  1313. sleep(time) {
  1314. return new Promise((resolve) => setTimeout(resolve, time));
  1315. },
  1316. sendMsg() {
  1317. this.sendMsgFlag = false;
  1318. let contant1 = document.getElementById("contant1");
  1319. let tmp = {
  1320. from: 2,
  1321. isScale: false,
  1322. answer: this.desc,
  1323. from1: HeadImg,
  1324. };
  1325. this.chatContents.push(tmp);
  1326. // 让滚动条始终在最底部
  1327. this.sleep(101).then(() => {
  1328. contant1.scrollTop = contant1.scrollHeight;
  1329. });
  1330. //第一个问题出来后先对答案进行解析
  1331. this.selectMood(this.desc);
  1332. this.desc = "";
  1333. },
  1334. //调用接口查询情绪
  1335. selectMood(val) {
  1336. // this.sendMsgFlag=true;
  1337. let that = this;
  1338. axios.post(`http://127.0.0.1:9999/sentiment`, { text: val }).then((res) => {
  1339. that.sendMsgFlag = true;
  1340. that.threeAnswers.push(res.data.sentiment);
  1341. //是否问问题的标志
  1342. //当答案小于3时需要接着提问
  1343. if (that.threeAnswers.length < 3) {
  1344. that.askQuestions();
  1345. } else if (that.threeAnswers.length === 3) {
  1346. //当等于3时需要判断是否接着提问
  1347. //当负面情绪小于2时则终止询问
  1348. //当负面情绪大于等于2时需要再次提问
  1349. that.judgeMood(2);
  1350. } else if (that.threeAnswers.length === 4) {
  1351. //当问题等于4时再次询问
  1352. that.askQuestions();
  1353. } else if (that.threeAnswers.length === 5) {
  1354. //调用判断结果负面情绪是否大于等于3
  1355. that.judgeMood(3);
  1356. }
  1357. //当回答的答案大于等于3时判断是否结束,当负面情绪大于等于2时
  1358. // that.judgeMood();
  1359. });
  1360. },
  1361. //当回答的答案大于等于3时判断是否结束,当负面情绪大于等于2时
  1362. judgeMood(val) {
  1363. this.moonNegative = 0;
  1364. for (let i = 0; i < this.threeAnswers.length; i++) {
  1365. if (
  1366. this.threeAnswers[i] === "厌恶" ||
  1367. this.threeAnswers[i] === "恐惧" ||
  1368. this.threeAnswers[i] === "悲伤" ||
  1369. this.threeAnswers[i] === "愤怒"
  1370. ) {
  1371. this.moonNegative += 1;
  1372. }
  1373. }
  1374. if (this.moonNegative >= val) {
  1375. if (val === 2) {
  1376. //需要再拿根据情绪生成两个数据
  1377. //如果是2个负面
  1378. //循环情绪得到判断哪一个是负面情绪
  1379. for (let j = 0; j < this.threeAnswers.length; j++) {
  1380. if (
  1381. this.threeAnswers[j] === "厌恶" ||
  1382. this.threeAnswers[j] === "恐惧" ||
  1383. this.threeAnswers[j] === "悲伤" ||
  1384. this.threeAnswers[j] === "愤怒"
  1385. ) {
  1386. //调用方法进行测试
  1387. this.afterListFun(this.preList[j].type);
  1388. }
  1389. }
  1390. this.askQuestions();
  1391. } else {
  1392. this.inputFlag = 2;
  1393. //进行提问
  1394. this.chatContents.push({
  1395. from: 1,
  1396. isScale: false,
  1397. question: "请问您近期是否存在以下方面的困扰(请选择)",
  1398. from1: HeadImg,
  1399. });
  1400. this.scale_checkItems = ["抑郁", "焦虑", "压力", "睡眠问题", "无"];
  1401. }
  1402. } else {
  1403. //发送一条信息说你的心理状态良好
  1404. this.askEnd("您的心理状态良好请继续保持!");
  1405. this.inputFlag = 0;
  1406. }
  1407. },
  1408. selectRadio(val) {
  1409. this.answerSelect(val);
  1410. if (val === "无") {
  1411. this.askEnd("您可能存在心理健康方面问题,建议寻求专业人员的指导");
  1412. this.inputFlag = 0;
  1413. //隐藏选项框和输入框进行提示
  1414. } else if (val === "睡眠问题") {
  1415. this.inputFlag = 3;
  1416. this.askEnd(
  1417. "为了进一步判断您是否存在睡眠方面的问题,下面我会问您一些问题,请您选择作答"
  1418. );
  1419. // this.askEnd("睡眠问卷");
  1420. this.scale_checkItems = ["好的"];
  1421. this.inputFlag = 2;
  1422. this.scale_flag = "20210910163158";
  1423. // this.selectScale(this.scale_flag);
  1424. //调用接口睡眠量表
  1425. } else if (val === "抑郁" || val === "焦虑" || val === "压力") {
  1426. if (val === "抑郁") {
  1427. this.pressure_flag = "抑郁";
  1428. }
  1429. if (val === "焦虑") {
  1430. this.pressure_flag = "焦虑";
  1431. }
  1432. if (val === "压力") {
  1433. this.pressure_flag = "压力";
  1434. }
  1435. this.inputFlag = 3;
  1436. this.askEnd(
  1437. "为了进一步判断您是否存在心理健康方面的问题,下面我会问您一些问题,请您选择作答"
  1438. );
  1439. // this.askEnd("抑郁、焦虑、压力问卷");
  1440. this.scale_checkItems = ["好的"];
  1441. this.inputFlag = 2;
  1442. this.scale_flag = "20220805135201";
  1443. // this.selectScale(this.scale_flag);
  1444. //调用接口抑郁焦虑压力问卷
  1445. } else if (val === "好的") {
  1446. this.inputFlag = 3;
  1447. // if(this.scale_flag==='20210910163158'){
  1448. // }
  1449. this.selectScale(this.scale_flag);
  1450. } else if (val === "是") {
  1451. //从头开始
  1452. this.init("reStart");
  1453. this.inputFlag = 1;
  1454. } else if (val === "否") {
  1455. //结束测试
  1456. this.askEnd("对话结束");
  1457. this.inputFlag = 0;
  1458. }
  1459. },
  1460. choiceTriger(item) {
  1461. let that = this;
  1462. that.radioChange(item);
  1463. },
  1464. // 选中选项
  1465. radioChange(item) {
  1466. this.tmpRadio = item;
  1467. var scaleInfoTemp = Object.assign({}, this.scale_infos[this.scale_index]);
  1468. this.radio = "";
  1469. scaleInfoTemp.checkItems = item;
  1470. this.scale_result.push(scaleInfoTemp);
  1471. // bbc测试判断是否展示20~24题
  1472. if (item != "是" && this.scale_flag == "20211101163739" && this.scale_index == 19) {
  1473. this.scale_index = 24;
  1474. for (let i = 20; i < 24; i++) {
  1475. this.scale_result.push(this.scale_infos[i]);
  1476. }
  1477. this.scale_checkItems = this.scale_infos[this.scale_index].checkItems.split(";");
  1478. return;
  1479. }
  1480. //如果是单选题
  1481. if (scaleInfoTemp.questionType == "0") {
  1482. if (this.scale_index <= this.scale_infos.length - 1) this.scale_index += 1;
  1483. this.answerSelect(this.tmpRadio);
  1484. //scale_index == 题目总数,表示结束
  1485. if (this.scale_index == this.scale_infos.length) {
  1486. this.scale_index -= 1;
  1487. this.scaleSelectFlag = false;
  1488. //发送测试结果给后台
  1489. // this.$message({
  1490. // message: "测试完成,即将生成测试报告!",
  1491. // type: "success",
  1492. // });
  1493. // console.log("==--3--------->", this.testPlanId);
  1494. console.log(
  1495. "==---4-------->",
  1496. sessionStorage.getItem("b80bb7740288fda1f201890375a60c8f")
  1497. );
  1498. this.$http.post(
  1499. `v1/result/${this.scale_flag}`,
  1500. {
  1501. scale_result: this.scale_result,
  1502. identifier: sessionStorage.getItem("num"),
  1503. },
  1504. (res) => {
  1505. this.next_and_last_button = false;
  1506. if (res.data.code == 200) {
  1507. this.resultJson = res.data.data;
  1508. if (this.scale_flag == "20210725100704") {
  1509. } else {
  1510. this.getAnswerQuestionPaymentSuccess(this.resultJson);
  1511. }
  1512. } else {
  1513. this.$message.error("访问服务器失败!");
  1514. }
  1515. }
  1516. );
  1517. } else {
  1518. // 我觉得很难让自己安静下来
  1519. this.askEnd(this.scale_infos[this.scale_index].answer);
  1520. this.scale_checkItems = this.scale_infos[this.scale_index].checkItems.split(
  1521. ";"
  1522. );
  1523. }
  1524. }
  1525. },
  1526. getAnswerQuestionPaymentSuccess(id) {
  1527. // sessionStorage.setItem("back_page", "1");
  1528. let _this = this;
  1529. _this.$http.post(`v1/record/find/${id}`, {}, (res) => {
  1530. _this.scaleSelectFlag = true;
  1531. if (res.data.code == 200 && res.data.data) {
  1532. _this.resultJsonParams = res.data.data;
  1533. let testResult = JSON.parse(res.data.data.userRecordEntity.testResult)[0]
  1534. .version;
  1535. if (_this.scale_flag === "20210910163158") {
  1536. let sleep = JSON.parse(_this.resultJsonParams.userRecordEntity.testResult);
  1537. sleep = sleep[0].newTableContext.result[0].improvementSuggestions;
  1538. _this.askEnd(sleep);
  1539. _this.askEnd("您还想跟我再聊一聊吗?");
  1540. this.scale_checkItems = ["是", "否"];
  1541. this.inputFlag = 2;
  1542. }
  1543. if (_this.scale_flag === "20220805135201") {
  1544. let sleep = JSON.parse(_this.resultJsonParams.userRecordEntity.testResult);
  1545. sleep = sleep[0].tableContext;
  1546. let str = "";
  1547. for (let i = 0; i < sleep.length; i++) {
  1548. if (_this.pressure_flag === "压力") {
  1549. if (sleep[i].name === "压力指导语") {
  1550. str = "压力建议:" + sleep[i].value[0] + " ";
  1551. }
  1552. }
  1553. if (_this.pressure_flag === "焦虑") {
  1554. if (sleep[i].name === "焦虑指导语") {
  1555. str = "焦虑建议:" + sleep[i].value[0] + " ";
  1556. }
  1557. }
  1558. if (_this.pressure_flag === "抑郁") {
  1559. if (sleep[i].name === "抑郁指导语") {
  1560. str = "抑郁建议:" + sleep[i].value[0] + " ";
  1561. }
  1562. }
  1563. // if (sleep[i].name === "压力建议") {
  1564. // str += "压力建议:" + sleep[i].value[0] + " ";
  1565. // }
  1566. // if (sleep[i].name === "焦虑建议") {
  1567. // str += "焦虑建议:" + sleep[i].value[0] + " ";
  1568. // }
  1569. // if (sleep[i].name === "抑郁建议") {
  1570. // str += "抑郁建议:" + sleep[i].value[0] + " ";
  1571. // }
  1572. }
  1573. _this.askEnd(str);
  1574. _this.askEnd("您还想跟我再聊一聊吗?");
  1575. this.scale_checkItems = ["是", "否"];
  1576. this.inputFlag = 2;
  1577. }
  1578. // let testResult = JSON.parse(
  1579. // res.data.data.userRecordEntity.testResult
  1580. // )[0].version;
  1581. // if (testResult == 2) {
  1582. // _this.$router.push({
  1583. // name: "scaleResultSCl",
  1584. // params: { tableData: _this.resultJsonParams }
  1585. // });
  1586. // } else {
  1587. // _this.$router.push({
  1588. // name: "scaleResult",
  1589. // params: { tableData: _this.resultJsonParams }
  1590. // });
  1591. // }
  1592. }
  1593. });
  1594. },
  1595. //调用查询量表的接口
  1596. //20210910163158 睡眠状况自评量表
  1597. //20220805135201 抑郁-焦虑-压力量表简版(DASS-21)
  1598. selectScale(flag) {
  1599. this.$http.get(`v1/scale/${flag}`, {}, (res) => {
  1600. this.scale_infos = res.data;
  1601. console.log(this.scale_infos);
  1602. this.scale_all = this.scale_infos.length;
  1603. this.askEnd(this.scale_infos[this.scale_index].answer);
  1604. this.scale_checkItems = this.scale_infos[this.scale_index].checkItems.split(";");
  1605. console.log(this.scale_checkItems);
  1606. this.scale_percent = parseInt((this.scale_index + 1) / this.scale_all);
  1607. this.scale_percent = ((this.scale_index + 1) * 100) / this.scale_all;
  1608. });
  1609. },
  1610. askEnd(val) {
  1611. this.chatContents.push({
  1612. from: 1,
  1613. isScale: false,
  1614. question: val,
  1615. from1: HeadImg,
  1616. });
  1617. let contant1 = document.getElementById("contant1");
  1618. this.sleep(101).then(() => {
  1619. contant1.scrollTop = contant1.scrollHeight;
  1620. });
  1621. },
  1622. answerSelect(val) {
  1623. this.chatContents.push({
  1624. from: 2,
  1625. isScale: false,
  1626. answer: val,
  1627. from1: HeadImg,
  1628. });
  1629. },
  1630. askQuestions() {
  1631. this.chatContents.push({
  1632. from: 1,
  1633. isScale: false,
  1634. question: this.preList[this.threeAnswers.length].des,
  1635. from1: HeadImg,
  1636. });
  1637. this.questionNum++;
  1638. },
  1639. goBack() {
  1640. this.$router.go(-1);
  1641. },
  1642. //判断是否是是已婚
  1643. //如果是已婚
  1644. //取随机数1-5否则取1-7
  1645. //格式为需要新加一个情绪判断
  1646. getDom() {
  1647. //判断是否是已婚
  1648. ////已婚0 未婚 1 离异 2
  1649. let married = sessionStorage.getItem("isMarried");
  1650. if (married == "0") {
  1651. //从7个中抽取3个
  1652. console.log(this.getDomList(3, 7));
  1653. } else {
  1654. //从5个中抽取三个
  1655. this.getDomList(3, 5);
  1656. }
  1657. },
  1658. //val抽取几个,totol总共数据
  1659. getDomList(val, totol) {
  1660. let arr = [];
  1661. while (arr.length < val) {
  1662. let num = parseInt(Math.random() * totol + 1);
  1663. // parseInt取正,小数点后面的数字全部抹掉
  1664. // Math.random() 0-1的随机数
  1665. if (arr.indexOf(num) == -1) {
  1666. // this.arr.indexOf(num)若等于-1则证明arr这个数组里没有num这个随机数,因此可以放进这个数组里
  1667. arr.push(num);
  1668. }
  1669. }
  1670. //循环的数组的到想要的那三个问题
  1671. for (let i = 0; i < arr.length; i++) {
  1672. this.switchFun(arr[i]);
  1673. }
  1674. return arr;
  1675. },
  1676. afterListFun(val) {
  1677. let listLin = [];
  1678. //this.preList[val].type
  1679. switch (val) {
  1680. case "1-1":
  1681. {
  1682. for (let i = 0; i < this.questionList.length; i++) {
  1683. if (this.questionList[i].type == "2-1") {
  1684. listLin.push(this.questionList[i]);
  1685. }
  1686. }
  1687. //根据获数组长度获取随机数
  1688. let len = parseInt(Math.random() * listLin.length);
  1689. this.preList.push(listLin[len]);
  1690. }
  1691. break;
  1692. case "1-2":
  1693. {
  1694. for (let i = 0; i < this.questionList.length; i++) {
  1695. if (this.questionList[i].type == "2-2") {
  1696. listLin.push(this.questionList[i]);
  1697. }
  1698. }
  1699. //根据获数组长度获取随机数
  1700. let len = parseInt(Math.random() * listLin.length);
  1701. this.preList.push(listLin[len]);
  1702. }
  1703. break;
  1704. case "1-3":
  1705. {
  1706. for (let i = 0; i < this.questionList.length; i++) {
  1707. if (this.questionList[i].type == "2-3") {
  1708. listLin.push(this.questionList[i]);
  1709. }
  1710. }
  1711. //根据获数组长度获取随机数
  1712. let len = parseInt(Math.random() * listLin.length);
  1713. this.preList.push(listLin[len]);
  1714. }
  1715. break;
  1716. case "1-4":
  1717. {
  1718. for (let i = 0; i < this.questionList.length; i++) {
  1719. if (this.questionList[i].type == "2-4") {
  1720. listLin.push(this.questionList[i]);
  1721. }
  1722. }
  1723. //根据获数组长度获取随机数
  1724. let len = parseInt(Math.random() * listLin.length);
  1725. this.preList.push(listLin[len]);
  1726. }
  1727. break;
  1728. case "1-5":
  1729. {
  1730. for (let i = 0; i < this.questionList.length; i++) {
  1731. if (this.questionList[i].type == "2-5") {
  1732. listLin.push(this.questionList[i]);
  1733. }
  1734. }
  1735. //根据获数组长度获取随机数
  1736. let len = parseInt(Math.random() * listLin.length);
  1737. this.preList.push(listLin[len]);
  1738. }
  1739. break;
  1740. case "1-6":
  1741. {
  1742. for (let i = 0; i < this.questionList.length; i++) {
  1743. if (this.questionList[i].type == "2-6") {
  1744. listLin.push(this.questionList[i]);
  1745. }
  1746. }
  1747. //根据获数组长度获取随机数
  1748. let len = parseInt(Math.random() * listLin.length);
  1749. this.preList.push(listLin[len]);
  1750. }
  1751. break;
  1752. case "1-7":
  1753. {
  1754. for (let i = 0; i < this.questionList.length; i++) {
  1755. if (this.questionList[i].type == "2-7") {
  1756. listLin.push(this.questionList[i]);
  1757. }
  1758. }
  1759. //根据获数组长度获取随机数
  1760. let len = parseInt(Math.random() * listLin.length);
  1761. this.preList.push(listLin[len]);
  1762. }
  1763. break;
  1764. }
  1765. },
  1766. switchFun(val) {
  1767. let listLin = [];
  1768. console.log(val);
  1769. // let listOne = [];
  1770. // if (numKey == 1) {
  1771. // listOne = ["1-1", "1-2", "1-3", "1-4", "1-5", "1-6", "1-7"];
  1772. // } else {
  1773. // listOne = ["2-1", "2-2", "2-3", "2-4", "2-5", "2-6", "2-7"];
  1774. // }
  1775. switch (val) {
  1776. case 1:
  1777. {
  1778. for (let i = 0; i < this.questionList.length; i++) {
  1779. if (this.questionList[i].type == "1-1") {
  1780. listLin.push(this.questionList[i]);
  1781. }
  1782. }
  1783. //根据获数组长度获取随机数
  1784. let len = parseInt(Math.random() * listLin.length);
  1785. this.preList.push(listLin[len]);
  1786. }
  1787. break;
  1788. case 2:
  1789. {
  1790. for (let i = 0; i < this.questionList.length; i++) {
  1791. if (this.questionList[i].type == "1-2") {
  1792. listLin.push(this.questionList[i]);
  1793. }
  1794. }
  1795. //根据获数组长度获取随机数
  1796. let len = parseInt(Math.random() * listLin.length);
  1797. this.preList.push(listLin[len]);
  1798. }
  1799. break;
  1800. case 3:
  1801. {
  1802. for (let i = 0; i < this.questionList.length; i++) {
  1803. if (this.questionList[i].type == "1-3") {
  1804. listLin.push(this.questionList[i]);
  1805. }
  1806. }
  1807. //根据获数组长度获取随机数
  1808. let len = parseInt(Math.random() * listLin.length);
  1809. this.preList.push(listLin[len]);
  1810. }
  1811. break;
  1812. case 4:
  1813. {
  1814. for (let i = 0; i < this.questionList.length; i++) {
  1815. if (this.questionList[i].type == "1-4") {
  1816. listLin.push(this.questionList[i]);
  1817. }
  1818. }
  1819. //根据获数组长度获取随机数
  1820. let len = parseInt(Math.random() * listLin.length);
  1821. this.preList.push(listLin[len]);
  1822. }
  1823. break;
  1824. case 5:
  1825. {
  1826. for (let i = 0; i < this.questionList.length; i++) {
  1827. if (this.questionList[i].type == "1-5") {
  1828. listLin.push(this.questionList[i]);
  1829. }
  1830. }
  1831. //根据获数组长度获取随机数
  1832. let len = parseInt(Math.random() * listLin.length);
  1833. this.preList.push(listLin[len]);
  1834. }
  1835. break;
  1836. case 6:
  1837. {
  1838. for (let i = 0; i < this.questionList.length; i++) {
  1839. if (this.questionList[i].type == "1-6") {
  1840. listLin.push(this.questionList[i]);
  1841. }
  1842. }
  1843. //根据获数组长度获取随机数
  1844. let len = parseInt(Math.random() * listLin.length);
  1845. this.preList.push(listLin[len]);
  1846. }
  1847. break;
  1848. case 7:
  1849. {
  1850. for (let i = 0; i < this.questionList.length; i++) {
  1851. if (this.questionList[i].type == "1-7") {
  1852. listLin.push(this.questionList[i]);
  1853. }
  1854. }
  1855. //根据获数组长度获取随机数
  1856. let len = parseInt(Math.random() * listLin.length);
  1857. this.preList.push(listLin[len]);
  1858. }
  1859. break;
  1860. }
  1861. },
  1862. questionFun() {
  1863. let tmp = [];
  1864. let value = null;
  1865. let flag = true;
  1866. while (flag) {
  1867. if (tmp.length === 0) {
  1868. value = Math.floor(Math.random() * 49);
  1869. tmp.push(value);
  1870. } else {
  1871. value = Math.floor(Math.random() * 49);
  1872. let repeat = false; //是否重复
  1873. for (let i = 0; i < tmp.length; i++) {
  1874. if (value == tmp[i]) {
  1875. repeat = true;
  1876. break;
  1877. }
  1878. }
  1879. if (!repeat && tmp.length < 5) {
  1880. tmp.push(value);
  1881. if (tmp.length === 5) {
  1882. flag = false;
  1883. }
  1884. }
  1885. }
  1886. }
  1887. return tmp;
  1888. },
  1889. },
  1890. };
  1891. </script>
  1892. <style scoped>
  1893. .mainTable-top {
  1894. margin-top: 5%;
  1895. }
  1896. .mainTable-top-two {
  1897. margin-top: 10%;
  1898. }
  1899. .mainTable-tab {
  1900. cursor: pointer;
  1901. margin-left: 100px;
  1902. margin-right: 100px;
  1903. border-radius: 5px;
  1904. border: 1px solid #000000;
  1905. text-align: center;
  1906. height: 150px;
  1907. margin-bottom: 100px;
  1908. }
  1909. .mainTable-tab-p {
  1910. padding-top: 40px;
  1911. }
  1912. .musicTitle {
  1913. display: block;
  1914. font-size: 18px;
  1915. color: #57acbb;
  1916. margin-bottom: 5px;
  1917. }
  1918. .main_answer_left {
  1919. display: flex;
  1920. /* text-align: left; */
  1921. }
  1922. .main_answer_right {
  1923. display: flex;
  1924. /* text-align: right; */
  1925. }
  1926. .message-wrapper {
  1927. background-color: #ffffff;
  1928. }
  1929. .message-wrapper-left {
  1930. margin-left: 10px;
  1931. /* border-radius: 0 1rem 1rem 1rem; */
  1932. border-radius: 4px 4px 4px 4px;
  1933. max-width: 20.86667rem;
  1934. display: inline-table;
  1935. }
  1936. .message-wrapper-right {
  1937. margin-right: 10px;
  1938. border-radius: 4px 4px 4px 4px;
  1939. max-width: 20.86667rem;
  1940. display: inline-table;
  1941. /* background-color: #1fd18e; */
  1942. color: #ffffff;
  1943. /* margin-top: 25px; */
  1944. padding: 18px;
  1945. }
  1946. .message {
  1947. word-break: break-all;
  1948. padding: 18px;
  1949. /* font-size: 20px; */
  1950. }
  1951. .message_form2 {
  1952. word-break: break-all;
  1953. /* font-size: 20px; */
  1954. }
  1955. .xl_d_button {
  1956. background: rgb(87, 172, 187);
  1957. opacity: 1;
  1958. border-radius: 50%;
  1959. font-size: 20px;
  1960. font-family: PingFang SC;
  1961. font-weight: 400;
  1962. color: #ffffff;
  1963. width: 40px;
  1964. line-height: 40px;
  1965. text-align: center;
  1966. }
  1967. .xl_d_button:hover {
  1968. background: rgb(87, 172, 187);
  1969. opacity: 1;
  1970. /* border-radius: 18px; */
  1971. font-size: 14px;
  1972. font-family: PingFang SC;
  1973. font-weight: 400;
  1974. color: #ffffff;
  1975. }
  1976. .xl_d_button:focus {
  1977. background: rgb(87, 172, 187);
  1978. opacity: 1;
  1979. /* border-radius: 18px; */
  1980. font-size: 14px;
  1981. font-family: PingFang SC;
  1982. font-weight: 400;
  1983. color: #ffffff;
  1984. }
  1985. .refrshSmart {
  1986. float: right;
  1987. cursor: pointer;
  1988. }
  1989. .xl_input >>> .el-input__inner {
  1990. border: 0;
  1991. border-radius: 4px;
  1992. background-color: #f4f4f4;
  1993. }
  1994. .footSend {
  1995. background: #ffffff;
  1996. position: absolute;
  1997. height: 80px;
  1998. margin-left: 2%;
  1999. width: 90%;
  2000. border-radius: 14px;
  2001. bottom: 50px;
  2002. }
  2003. .smart_line_class {
  2004. /* background: #BBC5D4; */
  2005. position: absolute;
  2006. height: 1px;
  2007. margin-left: 2%;
  2008. width: 90%;
  2009. border-radius: 14px;
  2010. bottom: 150px;
  2011. border-bottom: 1px solid #bbc5d4;
  2012. }
  2013. .footSend >>> .el-textarea__inner {
  2014. border: 0px solid #ffffff !important;
  2015. border-radius: 14px !important;
  2016. }
  2017. .footSendSelect {
  2018. background: #ffffff;
  2019. /* padding-bottom: 40px; */
  2020. position: absolute;
  2021. margin-left: 2%;
  2022. width: 90%;
  2023. bottom: 40px;
  2024. }
  2025. .xl_d_send {
  2026. margin-top: 18px;
  2027. color: #087b50;
  2028. background: #c6f0ed !important;
  2029. opacity: 1;
  2030. font-size: 14px;
  2031. font-family: PingFang SC;
  2032. font-weight: 400;
  2033. text-align: center;
  2034. border: 0px;
  2035. border-radius: 10px;
  2036. }
  2037. .xl_d_send:hover {
  2038. margin-top: 18px;
  2039. color: #087b50;
  2040. background: #c6f0ed !important;
  2041. opacity: 1;
  2042. font-size: 14px;
  2043. font-family: PingFang SC;
  2044. font-weight: 400;
  2045. text-align: center;
  2046. border-radius: 10px;
  2047. }
  2048. .xl_d_send:focus {
  2049. margin-top: 18px;
  2050. color: #087b50;
  2051. background: #c6f0ed !important;
  2052. opacity: 1;
  2053. font-size: 14px;
  2054. font-family: PingFang SC;
  2055. font-weight: 400;
  2056. text-align: center;
  2057. border-radius: 10px;
  2058. }
  2059. .xl_d_send.is-disabled,
  2060. .xl_d_send.is-disabled:hover,
  2061. .xl_d_send.is-disabled:focus {
  2062. margin-top: 18px;
  2063. color: #087b50;
  2064. background: #c6f0ed !important;
  2065. opacity: 1;
  2066. font-size: 14px;
  2067. font-family: PingFang SC;
  2068. font-weight: 400;
  2069. text-align: center;
  2070. border-radius: 10px;
  2071. }
  2072. .main_right_height {
  2073. /* padding:40px; */
  2074. height: 100vh !important;
  2075. display: block !important;
  2076. overflow-y: auto !important;
  2077. background-color: #ffffff;
  2078. }
  2079. .smart_content {
  2080. height: 88%;
  2081. margin-top: 5%;
  2082. width: 94%;
  2083. margin-left: 3%;
  2084. border-radius: 40px;
  2085. background: #f6f6f6;
  2086. /* display:flex; */
  2087. }
  2088. .chat-window {
  2089. height: 82vh;
  2090. overflow: auto;
  2091. /* overflow-y:hidden; */
  2092. }
  2093. /* .contant1{
  2094. height:70vh;
  2095. overflow:auto;
  2096. } */
  2097. ::v-deep .el-radio.is-bordered + .el-radio.is-bordered {
  2098. display: block;
  2099. margin: 10px 0 0 0;
  2100. }
  2101. .send_class {
  2102. display: flex;
  2103. flex-direction: row;
  2104. align-items: center;
  2105. }
  2106. </style>