aiBox.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <template>
  2. <div class="ai_body" v-loading="loading">
  3. <div class="ai_body_dialog">
  4. <div class="dialog_content" :class="{ right: item.role == 2 }" v-for="(item, index) in array" :key="index">
  5. <div class="role">
  6. <img src="../../../assets/icon/new/role1.png" v-if="item.role == 1">
  7. <img src="../../../assets/icon/new/role2.png" v-else>
  8. </div>
  9. <div class="content" :class="{ content2: item.role == 2 }">{{ item.text }}</div>
  10. </div>
  11. </div>
  12. <div class="ai_body_select">
  13. <div class="checkBox" v-if="checkBool">
  14. <div class="task">
  15. <div class="title">选择需要优化的任务:</div>
  16. <div class="content">
  17. <div class="span" @click="addAllTask()">
  18. <div class="check">
  19. <img :src="checkImg" alt="" v-if="checkArray.length !== course.length">
  20. <img :src="checkIsImg" alt="" v-else>
  21. </div>
  22. <span>全选</span>
  23. </div>
  24. <div class="span" v-for="(item, index) in course" :key="index" @click="addTask(index)">
  25. <div class="check">
  26. <img :src="checkImg" alt="" v-if="checkArray.indexOf(index) === -1">
  27. <img :src="checkIsImg" alt="" v-else>
  28. </div>
  29. <span>任务{{ index + 1 }}</span>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="part">
  34. <div class="title">选择优化的部分:</div>
  35. <div class="content">
  36. <div class="span" v-for="(item, index) in partArray" :key="index"
  37. :class="{ active: part == item.name }" @click="checkPart(item.name)">
  38. {{ item.name }}
  39. </div>
  40. </div>
  41. </div>
  42. </div>
  43. <span class="check" :class="{ isCheck: checkBool }" v-if="!checkArray.length && !part"
  44. @click="checkBool = !checkBool">选择优化内容</span>
  45. <span class="check" :class="{ isCheck: checkBool }" @click="checkBool = !checkBool" v-else>
  46. <el-tooltip :content="taskName" placement="top" effect="dark">
  47. <!-- content to trigger tooltip here -->
  48. <span>{{ taskName }}</span>
  49. </el-tooltip>
  50. </span>
  51. </div>
  52. <div class="ai_body_input">
  53. <textarea rows="5" class="binfo_input binfo_textarea" cols v-model="courseText" placeholder="在此输入您想了解的内容"
  54. style="padding-right: 86px;"></textarea>
  55. <div class="c_pub_button_confirm" @click="addContent">发送</div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import checkImg from '../../../assets/icon/sourceFile/check.png'
  61. import checkIsImg from '../../../assets/icon/sourceFile/check_is.png'
  62. export default {
  63. props: {
  64. unitJson: {
  65. type: Array,
  66. },
  67. },
  68. data() {
  69. return {
  70. array: [
  71. { text: '你好,有说么可以帮你', role: 1 },
  72. ],
  73. courseText: '',
  74. checkImg: checkImg,
  75. checkIsImg: checkIsImg,
  76. checkArray: [],
  77. course: [
  78. { title: '任务1' },
  79. { title: '任务2' },
  80. { title: '任务3' }
  81. ],
  82. partArray: [{ name: '全部内容' }, { name: '任务设计' }, { name: '评价设计' }],
  83. part: '',
  84. checkBool: false,
  85. loading: false
  86. }
  87. },
  88. watch: {
  89. unitJson: {
  90. immediate: true,
  91. deep: true,
  92. handler(newValue, oldValue) {
  93. this.course = this.unitJson[0].chapterInfo[0].taskJson
  94. }
  95. },
  96. },
  97. methods: {
  98. addContent() {
  99. if (this.courseText) {
  100. this.loading = true
  101. this.array.push({ text: this.courseText, role: 2 })
  102. setTimeout(() => {
  103. this.loading = false
  104. if (this.courseText == '请告诉我任务四该具体如何实施?') {
  105. this.array.push({
  106. text: `任务四:设计保温杯的初步方案
  107. 教学目标:
  108. •学会应用热传递原理设计保温杯。
  109. •掌握基本的设计思维和创新方法。
  110. •理解材料选择对保温效果的影响。
  111. 教学过程:
  112. 1.复习:回顾热传递的基本原理和不同材料的导热性能。
  113. 2.需求分析:讨论保温杯的使用场景和功能需求,如保温时间、容量、便携性等。
  114. 3.设计指导:教师介绍设计原则和考虑因素,如材料的导热性能、结构设计、成本和环保等。
  115. 4.创意发散:学生团队进行头脑风暴,提出多种设计方案,并选出最可行的方案。
  116. 5.方案绘制:学生绘制保温杯的设计图,包括尺寸、形状、结构和所用材料。
  117. 师生研讨:
  118. •分享各组的设计方案,讨论设计的创新点和实用性。
  119. •教师提供专业意见和建议,帮助学生完善设计方案。
  120. •讨论如何将设计方案转化为实际操作的步骤。
  121. 拓展:
  122. •学生研究市场上不同类型保温杯的设计和功能。
  123. •分析保温杯的改进空间和潜在的创新点。
  124. 学生任务单:
  125. •列出保温杯的功能需求和设计目标。
  126. •绘制保温杯的设计方案图,并标注所用材料和尺寸。
  127. •简述所选材料的导热性能和对保温效果的影响。
  128. 知识点练习:
  129. 1.为什么保温杯通常使用不锈钢或陶瓷作为内胆材料?
  130. 2.描述一个创新的保温杯设计方案,并解释其工作原理。
  131. 3.讨论在设计保温杯时需要考虑的环境因素。
  132. 答案:
  133. 1.保温杯通常使用不锈钢或陶瓷作为内胆材料,因为这些材料是热的不良导体,可以有效减缓热量的散失。
  134. 2.一个创新的保温杯设计方案可能是采用多层结构,内层为不锈钢,中间层为真空隔热层,外层为塑料保护层。这种设计可以有效隔绝外界温度对热水温度的影响。
  135. 在设计保温杯时,需要考虑的环境因素包括材料的可回收性、生产过程中的能源消耗和废弃物处理等。`, role: 1
  136. })
  137. }else if(this.courseText == '请你重新设计该任务,我没有感温粉末。'){
  138. this.array.push({text:`任务一:探究热的传递方式
  139. 任务名: 观察热在水中的传递
  140. 任务描述:
  141. 同学们,今天我们将通过一个有趣的实验来探究热是如何在水中传递的。你将需要加热水并观察温度是如何分布的。请准备好实验器材,并按照安全指南进行操作。在实验过程中,请注意观察热水和冷水之间的相互作用,以及水温是如何随时间和空间变化的。你将需要记录你的观察结果,并思考热是如何从一个地方传递到另一个地方的。
  142. 工具名字: 电子白板
  143. 工具指引:
  144. 使用电子白板工具来绘制你的实验设置和观察到的热传递过程。你可以使用电子白板的绘图功能来创建一个温度分布图,展示热水和冷水相遇时的情况。同时,你可以用它来记录实验步骤和关键观察点,以便于你和同学们进行讨论和分享。
  145. 评价维度:
  146. •实验观察和记录:学生应该能够准确地记录实验过程中的观察结果,包括水温变化和热传递的现象。
  147. •数据分析和解释:学生应该能够分析实验数据,解释热在水中的传递方式,并能够用自己的话描述热对流的原理。
  148. •实验报告撰写:学生应该能够撰写一份清晰的实验报告,包括实验目的、方法、结果和结论,以及对实验过程的反思。`,role: 1})
  149. this.$emit('setUnitJson')
  150. } else {
  151. this.array.push({ text: '请输入正确的文案', role: 1 })
  152. }
  153. // this.array.push({text: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', role: 1})
  154. this.courseText = ''
  155. }, 5000);
  156. }
  157. },
  158. addTask(index) {
  159. if (this.checkArray.indexOf(index) !== -1) {
  160. this.checkArray.splice(this.checkArray.indexOf(index), 1)
  161. } else {
  162. this.checkArray.push(index)
  163. }
  164. console.log(index);
  165. },
  166. addAllTask() {
  167. if (this.checkArray.length === this.course.length) {
  168. this.checkArray = []
  169. } else {
  170. this.checkArray = []
  171. this.course.forEach((item, index) => {
  172. this.checkArray.push(index)
  173. })
  174. }
  175. },
  176. checkPart(name) {
  177. this.part = name
  178. }
  179. },
  180. computed: {
  181. courseTextLength() {
  182. return this.courseText.length
  183. },
  184. taskName() {
  185. let task = ''
  186. if (this.checkArray.length) {
  187. task = '任务'
  188. this.checkArray = this.checkArray.sort((a, b) => a - b)
  189. let a = JSON.parse(JSON.stringify(this.checkArray))
  190. for (let index = 0; index < a.length; index++) {
  191. a[index]++;
  192. }
  193. task += a.join('/')
  194. }
  195. return task + ' ' + this.part
  196. }
  197. },
  198. }
  199. </script>
  200. <style scoped>
  201. .ai_body {
  202. height: 100%;
  203. width: calc(100% - 20px);
  204. margin: 0 auto;
  205. }
  206. .binfo_input {
  207. width: 100%;
  208. margin: 0;
  209. padding: 12px 14px;
  210. display: block;
  211. min-width: 0;
  212. outline: none;
  213. box-sizing: border-box;
  214. background: none;
  215. border: none;
  216. border-radius: 4px;
  217. background: #fff;
  218. font-size: 14px;
  219. resize: none;
  220. font-family: "Microsoft YaHei";
  221. min-height: 48px;
  222. /* border: 1px solid #3682fc00; */
  223. border: 1.5px solid #cad1dc;
  224. }
  225. .binfo_textarea {
  226. border: 1.5px solid #cad1dc;
  227. font-size: 14px;
  228. resize: none;
  229. /* background: #f6f6f6; */
  230. font-family: "Microsoft YaHei";
  231. }
  232. .binfo_textarea::-webkit-scrollbar {
  233. /*滚动条整体样式*/
  234. width: 6px;
  235. /*高宽分别对应横竖滚动条的尺寸*/
  236. height: 6px;
  237. }
  238. /*定义滚动条轨道 内阴影+圆角*/
  239. .binfo_textarea::-webkit-scrollbar-track {
  240. border-radius: 10px;
  241. background-color: rgba(0, 0, 0, 0.1);
  242. }
  243. /*定义滑块 内阴影+圆角*/
  244. .binfo_textarea::-webkit-scrollbar-thumb {
  245. border-radius: 10px;
  246. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
  247. background-color: rgba(0, 0, 0, 0.1);
  248. }
  249. .binfo_input:focus-visible {
  250. border: 1.5px solid #3681fc !important;
  251. }
  252. .ai_body_input {
  253. position: relative;
  254. }
  255. .c_pub_button_confirm {
  256. position: absolute;
  257. bottom: 13px;
  258. right: 13px;
  259. }
  260. .ai_body_dialog {
  261. padding: 10px 0;
  262. box-sizing: border-box;
  263. height: calc(100% - 180px);
  264. overflow: auto;
  265. margin-bottom: 10px;
  266. }
  267. .dialog_content {
  268. width: 100%;
  269. display: flex;
  270. }
  271. .dialog_content+.dialog_content {
  272. margin-top: 20px;
  273. }
  274. .dialog_content.right {
  275. flex-direction: row-reverse;
  276. }
  277. .dialog_content.right .role {
  278. margin-right: 0;
  279. margin-left: 10px;
  280. }
  281. .dialog_content .role {
  282. min-width: 30px;
  283. width: 30px;
  284. height: 30px;
  285. margin-right: 10px;
  286. border-radius: 50%;
  287. }
  288. .dialog_content .role>img {
  289. height: 100%;
  290. width: 100%;
  291. }
  292. .dialog_content .content {
  293. padding: 5px;
  294. border-radius: 5px;
  295. width: 100%;
  296. word-break: break-word;
  297. box-sizing: border-box;
  298. white-space: pre-line;
  299. max-width: 100%;
  300. overflow: hidden;
  301. }
  302. .dialog_content .content2 {
  303. background: #3681fc;
  304. color: #fff;
  305. }
  306. .ai_body_select {
  307. position: relative;
  308. }
  309. .ai_body_select>.check {
  310. background: #e7e7e7;
  311. display: flex;
  312. width: fit-content;
  313. padding: 0 10px;
  314. height: 30px;
  315. border-radius: 21px;
  316. font-size: 14px;
  317. align-items: center;
  318. justify-content: center;
  319. color: #0061FF;
  320. font-weight: 700;
  321. margin: 10px 0;
  322. cursor: pointer;
  323. }
  324. .ai_body_select>.check::before {
  325. content: '';
  326. width: 15px;
  327. height: 15px;
  328. display: block;
  329. background-image: url('../../../assets/icon/course/aiPart.png');
  330. background-size: 100% 100%;
  331. margin-right: 5px;
  332. }
  333. .ai_body_select>.check::after {
  334. content: '';
  335. width: 15px;
  336. height: 15px;
  337. display: block;
  338. background-image: url('../../../assets/icon/course/aiPart_arrow.png');
  339. background-size: 100% 100%;
  340. margin-right: 5px;
  341. }
  342. .ai_body_select>.isCheck {
  343. background: #0061FF;
  344. display: flex;
  345. width: fit-content;
  346. padding: 0 10px;
  347. height: 30px;
  348. border-radius: 21px;
  349. font-size: 14px;
  350. align-items: center;
  351. justify-content: center;
  352. color: #fff;
  353. font-weight: 700;
  354. margin: 10px 0;
  355. cursor: pointer;
  356. max-width: 100%;
  357. box-sizing: border-box;
  358. }
  359. .ai_body_select>.isCheck>span {
  360. width: calc(100% - 40px);
  361. display: block;
  362. overflow: hidden;
  363. white-space: nowrap;
  364. text-overflow: ellipsis;
  365. }
  366. .ai_body_select>.isCheck::before {
  367. content: '';
  368. width: 15px;
  369. height: 15px;
  370. display: block;
  371. background-image: url('../../../assets/icon/course/aiPart_active.png');
  372. background-size: 100% 100%;
  373. margin-right: 5px;
  374. }
  375. .ai_body_select>.isCheck::after {
  376. content: '';
  377. width: 15px;
  378. height: 15px;
  379. display: block;
  380. background-image: url('../../../assets/icon/course/aiPart_arrow_active.png');
  381. background-size: 100% 100%;
  382. margin-right: 5px;
  383. }
  384. .ai_body_select>.checkBox {
  385. position: absolute;
  386. bottom: 40px;
  387. border: 1px solid #E0EAFB;
  388. width: 100%;
  389. height: 300px;
  390. background: #fff;
  391. border-radius: 5px;
  392. padding: 10px;
  393. box-sizing: border-box;
  394. }
  395. .ai_body_select>.checkBox>.task>.title,
  396. .ai_body_select>.checkBox>.part>.title {
  397. font-size: 14px;
  398. font-weight: 700;
  399. margin-bottom: 5px;
  400. }
  401. .ai_body_select>.checkBox>.task {
  402. height: calc(100% - 60px);
  403. }
  404. .ai_body_select>.checkBox>.part {}
  405. .ai_body_select>.checkBox>.task>.content {
  406. height: calc(100% - 40px);
  407. overflow: auto;
  408. }
  409. .ai_body_select>.checkBox>.task>.content>.span+.span {
  410. margin-top: 5px;
  411. }
  412. .ai_body_select>.checkBox>.task>.content>.span {
  413. display: flex;
  414. align-items: center;
  415. font-size: 14px;
  416. cursor: pointer;
  417. }
  418. .ai_body_select>.checkBox>.task>.content>.span>.check {
  419. width: 13px;
  420. height: 13px;
  421. display: flex;
  422. align-items: center;
  423. margin-right: 5px;
  424. }
  425. .ai_body_select>.checkBox>.task>.content>.span>.check>img {
  426. width: 100%;
  427. height: 100%;
  428. }
  429. .ai_body_select>.checkBox>.part>.content {
  430. display: flex;
  431. align-items: center;
  432. font-size: 14px;
  433. justify-content: space-between;
  434. }
  435. .ai_body_select>.checkBox>.part>.content>.span {
  436. padding: 3px 6px;
  437. border: 1px solid #E0EAFB;
  438. border-radius: 40px;
  439. cursor: pointer;
  440. }
  441. .ai_body_select>.checkBox>.part>.content>.span.active {
  442. color: #0061ff;
  443. border-color: #0061ff;
  444. }
  445. </style>