aiBox.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573
  1. <template>
  2. <div class="ai_body">
  3. <div class="ai_body_dialog" v-loading="loading">
  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="3" @keyup.enter="addContent" class="binfo_input binfo_textarea" cols v-model.trim="courseText" placeholder="在此输入您想了解的内容"
  54. ></textarea>
  55. <div class="c_pub_button_confirm" v-if="!loading && courseText" @click="addContent">发送</div>
  56. <div class="c_pub_button_confirm" @click="promptTit" v-else>发送</div>
  57. </div>
  58. </div>
  59. </template>
  60. <script>
  61. import checkImg from '../../../assets/icon/sourceFile/check.png'
  62. import checkIsImg from '../../../assets/icon/sourceFile/check_is.png'
  63. export default {
  64. props: {
  65. unitJson: {
  66. type: Array,
  67. },
  68. },
  69. data() {
  70. return {
  71. array: [
  72. { text: '你好,有说么可以帮你', role: 1 },
  73. ],
  74. courseText: '',
  75. checkImg: checkImg,
  76. checkIsImg: checkIsImg,
  77. checkArray: [],
  78. course: [
  79. { title: '任务1' },
  80. { title: '任务2' },
  81. { title: '任务3' }
  82. ],
  83. partArray: [{ name: '全部内容' }, { name: '任务设计' }, { name: '评价设计' }],
  84. part: '',
  85. checkBool: false,
  86. loading: false
  87. }
  88. },
  89. watch: {
  90. unitJson: {
  91. immediate: true,
  92. deep: true,
  93. handler(newValue, oldValue) {
  94. this.course = this.unitJson[0].chapterInfo[0].taskJson
  95. }
  96. },
  97. },
  98. methods: {
  99. promptTit(){
  100. if (!this.loading && !this.courseText) {
  101. this.$message({
  102. message: '请输入您想要了解的内容',
  103. type: 'warning'
  104. });
  105. }else{
  106. this.$message({
  107. message: '请回答完毕后再次发送',
  108. type: 'warning'
  109. });
  110. }
  111. },
  112. addContent() {
  113. if (this.courseText) {
  114. this.loading = true
  115. this.array.push({ text: this.courseText, role: 2 })
  116. this.courseText = ''
  117. setTimeout(() => {
  118. this.loading = false
  119. if (this.courseText == '请告诉我任务四该具体如何实施?') {
  120. this.array.push({
  121. text: `任务四:设计保温杯的初步方案
  122. 教学目标:
  123. •学会应用热传递原理设计保温杯。
  124. •掌握基本的设计思维和创新方法。
  125. •理解材料选择对保温效果的影响。
  126. 教学过程:
  127. 1.复习:回顾热传递的基本原理和不同材料的导热性能。
  128. 2.需求分析:讨论保温杯的使用场景和功能需求,如保温时间、容量、便携性等。
  129. 3.设计指导:教师介绍设计原则和考虑因素,如材料的导热性能、结构设计、成本和环保等。
  130. 4.创意发散:学生团队进行头脑风暴,提出多种设计方案,并选出最可行的方案。
  131. 5.方案绘制:学生绘制保温杯的设计图,包括尺寸、形状、结构和所用材料。
  132. 师生研讨:
  133. •分享各组的设计方案,讨论设计的创新点和实用性。
  134. •教师提供专业意见和建议,帮助学生完善设计方案。
  135. •讨论如何将设计方案转化为实际操作的步骤。
  136. 拓展:
  137. •学生研究市场上不同类型保温杯的设计和功能。
  138. •分析保温杯的改进空间和潜在的创新点。
  139. 学生任务单:
  140. •列出保温杯的功能需求和设计目标。
  141. •绘制保温杯的设计方案图,并标注所用材料和尺寸。
  142. •简述所选材料的导热性能和对保温效果的影响。
  143. 知识点练习:
  144. 1.为什么保温杯通常使用不锈钢或陶瓷作为内胆材料?
  145. 2.描述一个创新的保温杯设计方案,并解释其工作原理。
  146. 3.讨论在设计保温杯时需要考虑的环境因素。
  147. 答案:
  148. 1.保温杯通常使用不锈钢或陶瓷作为内胆材料,因为这些材料是热的不良导体,可以有效减缓热量的散失。
  149. 2.一个创新的保温杯设计方案可能是采用多层结构,内层为不锈钢,中间层为真空隔热层,外层为塑料保护层。这种设计可以有效隔绝外界温度对热水温度的影响。
  150. 在设计保温杯时,需要考虑的环境因素包括材料的可回收性、生产过程中的能源消耗和废弃物处理等。`, role: 1
  151. })
  152. }else if(this.courseText == '请你重新设计该任务,我没有感温粉末。'){
  153. this.array.push({text:`任务一:探究热的传递方式
  154. 任务名: 观察热在水中的传递
  155. 任务描述:
  156. 同学们,今天我们将通过一个有趣的实验来探究热是如何在水中传递的。你将需要加热水并观察温度是如何分布的。请准备好实验器材,并按照安全指南进行操作。在实验过程中,请注意观察热水和冷水之间的相互作用,以及水温是如何随时间和空间变化的。你将需要记录你的观察结果,并思考热是如何从一个地方传递到另一个地方的。
  157. 工具名字: 电子白板
  158. 工具指引:
  159. 使用电子白板工具来绘制你的实验设置和观察到的热传递过程。你可以使用电子白板的绘图功能来创建一个温度分布图,展示热水和冷水相遇时的情况。同时,你可以用它来记录实验步骤和关键观察点,以便于你和同学们进行讨论和分享。
  160. 评价维度:
  161. •实验观察和记录:学生应该能够准确地记录实验过程中的观察结果,包括水温变化和热传递的现象。
  162. •数据分析和解释:学生应该能够分析实验数据,解释热在水中的传递方式,并能够用自己的话描述热对流的原理。
  163. •实验报告撰写:学生应该能够撰写一份清晰的实验报告,包括实验目的、方法、结果和结论,以及对实验过程的反思。`,role: 1})
  164. this.$emit('setUnitJson')
  165. }else if(this.checkArray.indexOf(0) !== -1 && this.courseText == '请告诉该具体如何实施?'){
  166. this.array.push({text:`教学活动1:探究热的传递方式
  167. 教学目标:
  168. •理解热的三种传递方式:传导、对流和辐射。
  169. •掌握热对流现象的基本概念。
  170. •学会通过实验观察和分析热在水中的传递过程。
  171. 教学过程:
  172. 1.引入:讨论日常生活中的热现象,如热水变凉、金属勺柄变热等,引出热传递的概念。
  173. 2.实验准备:介绍实验材料(试管、大烧杯、滴管、三脚架、石棉网、酒精灯、火柴、铁架台、试管架、感温粉末、红墨水、清水等)和安全注意事项。
  174. 3.实验操作:学生分组进行实验,加热试管和烧杯中的水,并加入感温粉末或红墨水以观察热的传递。
  175. 4.观察记录:学生记录实验现象,包括水温的变化、感温粉末或红墨水的颜色变化等。
  176. 5.结果分析:师生共同讨论实验结果,理解热对流的形成机制。
  177. 师生研讨:
  178. •讨论实验中观察到的热在水中的传递方式。
  179. •分析为什么水受热后会产生对流现象。
  180. •探讨热对流在生活中的应用,如暖气系统、热水器等。
  181. 拓展:
  182. •学生研究热在其他物质(如空气)中的传递方式。
  183. •设计并执行一个简单的实验,比较热在不同物质中的传递速度。
  184. 学生任务单:
  185. •描述实验中观察到的热在水中的传递过程。
  186. •解释热对流的形成原理。
  187. •提出一个生活中热对流的应用实例。
  188. 知识点练习:
  189. 1.热传递的三种方式是什么?
  190. 2.为什么加热试管底部的水会使试管上部的水也变热?
  191. 3.描述热对流的一个实际应用,并解释其工作原理。
  192. 答案:
  193. 1.热传递的三种方式是传导、对流和辐射。
  194. 2.加热试管底部的水会使试管上部的水也变热,因为热通过水的对流传递到了上部。
  195. 一个热对流的实际应用是暖气系统。它通过加热空气,使热空气上升,冷空气下降,形成对流循环,从而使房间变暖。`,role:1})
  196. }else if(this.checkArray.indexOf(0) !== -1 && this.courseText == '我没有感温粉末怎么办'){
  197. this.array.push({text:`如果您没有感温粉末,不用担心,我们仍然可以探究热的传递方式,只是需要采用不同的方法来观察和记录热在水中的传递。以下是几种替代方案:
  198. 1. **温度计**:您可以使用普通温度计或数字温度计来测量水在加热过程中的温度变化。通过在不同时间点记录水温,您可以绘制出温度随时间变化的曲线,从而理解热是如何在水中传播的。
  199. 2. **红墨水或其他有色液体**:如果家里有红墨水或其他任何有颜色的液体,您可以在水加热前滴入几滴。当红墨水在加热的水中扩散时,您可以观察到颜色的变化,这可以帮助您可视化水的流动和混合。
  200. 3. **视频记录**:您可以使用手机或相机录制水加热的过程,特别是观察加热区域与未加热区域之间的界面。通过回放视频,您可以分析和讨论热传递的现象。
  201. 4. **实验日志**:在实验过程中,详细记录您的观察和思考。包括您使用的替代方法、观察到的现象、遇到的问题以及您对这些现象的解释。
  202. 5. **讨论和交流**:与同学或老师讨论您的发现,即使没有感温粉末,您也可以通过交流想法和观察结果来增进对热传递现象的理解。
  203. 记住,科学探究的本质在于提出问题、设计实验、收集数据、分析结果和得出结论。即使缺少某些工具或材料,创新和适应性也是科学探究的重要部分。`,role:1})
  204. } else {
  205. this.array.push({ text: '请输入正确的文案', role: 1 })
  206. }
  207. // this.array.push({text: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', role: 1})
  208. }, 5000);
  209. }
  210. },
  211. addTask(index) {
  212. if (this.checkArray.indexOf(index) !== -1) {
  213. this.checkArray.splice(this.checkArray.indexOf(index), 1)
  214. } else {
  215. this.checkArray.push(index)
  216. }
  217. console.log(index);
  218. },
  219. addAllTask() {
  220. if (this.checkArray.length === this.course.length) {
  221. this.checkArray = []
  222. } else {
  223. this.checkArray = []
  224. this.course.forEach((item, index) => {
  225. this.checkArray.push(index)
  226. })
  227. }
  228. },
  229. checkPart(name) {
  230. this.part = name
  231. }
  232. },
  233. computed: {
  234. courseTextLength() {
  235. return this.courseText.length
  236. },
  237. taskName() {
  238. let task = ''
  239. if (this.checkArray.length) {
  240. task = '任务'
  241. this.checkArray = this.checkArray.sort((a, b) => a - b)
  242. let a = JSON.parse(JSON.stringify(this.checkArray))
  243. for (let index = 0; index < a.length; index++) {
  244. a[index]++;
  245. }
  246. task += a.join('/')
  247. }
  248. return task + ' ' + this.part
  249. }
  250. },
  251. }
  252. </script>
  253. <style scoped>
  254. .ai_body {
  255. height: 100%;
  256. width: calc(100% - 20px);
  257. margin: 0 auto;
  258. }
  259. .binfo_input {
  260. width: 100%;
  261. margin: 0;
  262. padding: 12px 14px;
  263. display: block;
  264. min-width: 0;
  265. outline: none;
  266. box-sizing: border-box;
  267. background: none;
  268. border: none;
  269. border-radius: 4px;
  270. background: #fff;
  271. font-size: 14px;
  272. resize: none;
  273. font-family: "Microsoft YaHei";
  274. min-height: 48px;
  275. /* border: 1px solid #3682fc00; */
  276. border: 1.5px solid #cad1dc;
  277. }
  278. .binfo_textarea {
  279. border: 1.5px solid #cad1dc;
  280. font-size: 14px;
  281. resize: none;
  282. /* background: #f6f6f6; */
  283. font-family: "Microsoft YaHei";
  284. }
  285. .binfo_textarea::-webkit-scrollbar {
  286. /*滚动条整体样式*/
  287. width: 6px;
  288. /*高宽分别对应横竖滚动条的尺寸*/
  289. height: 6px;
  290. }
  291. /*定义滚动条轨道 内阴影+圆角*/
  292. .binfo_textarea::-webkit-scrollbar-track {
  293. border-radius: 10px;
  294. background-color: rgba(0, 0, 0, 0.1);
  295. }
  296. /*定义滑块 内阴影+圆角*/
  297. .binfo_textarea::-webkit-scrollbar-thumb {
  298. border-radius: 10px;
  299. -webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, .3);
  300. background-color: rgba(0, 0, 0, 0.1);
  301. }
  302. .binfo_input:focus-visible {
  303. border: 1.5px solid #3681fc !important;
  304. }
  305. .ai_body_input {
  306. /* position: relative; */
  307. display: flex;
  308. flex-direction: column;
  309. justify-content: center;
  310. align-items: end;
  311. }
  312. .c_pub_button_confirm {
  313. /* position: absolute;
  314. bottom: 13px;
  315. right: 13px; */
  316. margin-top: 10px;
  317. width: 80px;
  318. display: flex;
  319. justify-content: center;
  320. }
  321. .ai_body_dialog {
  322. padding: 10px 0;
  323. box-sizing: border-box;
  324. height: calc(100% - 180px);
  325. overflow: auto;
  326. margin-bottom: 10px;
  327. }
  328. .dialog_content {
  329. width: 100%;
  330. display: flex;
  331. }
  332. .dialog_content+.dialog_content {
  333. margin: 15px 0;
  334. }
  335. .dialog_content.right {
  336. flex-direction: row-reverse;
  337. }
  338. .dialog_content.right .role {
  339. margin-right: 0;
  340. margin-left: 10px;
  341. }
  342. .dialog_content .role {
  343. min-width: 30px;
  344. width: 30px;
  345. height: 30px;
  346. margin-right: 10px;
  347. border-radius: 50%;
  348. }
  349. .dialog_content .role>img {
  350. height: 100%;
  351. width: 100%;
  352. }
  353. .dialog_content .content {
  354. padding: 10px 5px;
  355. border-radius: 5px;
  356. width: 100%;
  357. word-break: break-word;
  358. box-sizing: border-box;
  359. white-space: pre-line;
  360. max-width: 100%;
  361. background: #F7F7F7;
  362. overflow: hidden;
  363. }
  364. .dialog_content .content2 {
  365. background: #3681fc;
  366. color: #fff;
  367. }
  368. .ai_body_select {
  369. position: relative;
  370. }
  371. .ai_body_select>.check {
  372. background: #e7e7e7;
  373. display: flex;
  374. width: fit-content;
  375. padding: 0 10px;
  376. height: 30px;
  377. border-radius: 21px;
  378. font-size: 14px;
  379. align-items: center;
  380. justify-content: center;
  381. color: #0061FF;
  382. font-weight: 700;
  383. margin: 10px 0;
  384. cursor: pointer;
  385. }
  386. .ai_body_select>.check::before {
  387. content: '';
  388. width: 15px;
  389. height: 15px;
  390. display: block;
  391. background-image: url('../../../assets/icon/course/aiPart.png');
  392. background-size: 100% 100%;
  393. margin-right: 5px;
  394. }
  395. .ai_body_select>.check::after {
  396. content: '';
  397. width: 15px;
  398. height: 15px;
  399. display: block;
  400. background-image: url('../../../assets/icon/course/aiPart_arrow.png');
  401. background-size: 100% 100%;
  402. margin-right: 5px;
  403. }
  404. .ai_body_select>.isCheck {
  405. background: #0061FF;
  406. display: flex;
  407. width: fit-content;
  408. padding: 0 10px;
  409. height: 30px;
  410. border-radius: 21px;
  411. font-size: 14px;
  412. align-items: center;
  413. justify-content: center;
  414. color: #fff;
  415. font-weight: 700;
  416. margin: 10px 0;
  417. cursor: pointer;
  418. max-width: 100%;
  419. box-sizing: border-box;
  420. }
  421. .ai_body_select>.isCheck>span {
  422. width: calc(100% - 40px);
  423. display: block;
  424. overflow: hidden;
  425. white-space: nowrap;
  426. text-overflow: ellipsis;
  427. }
  428. .ai_body_select>.isCheck::before {
  429. content: '';
  430. width: 15px;
  431. height: 15px;
  432. display: block;
  433. background-image: url('../../../assets/icon/course/aiPart_active.png');
  434. background-size: 100% 100%;
  435. margin-right: 5px;
  436. }
  437. .ai_body_select>.isCheck::after {
  438. content: '';
  439. width: 15px;
  440. height: 15px;
  441. display: block;
  442. background-image: url('../../../assets/icon/course/aiPart_arrow_active.png');
  443. background-size: 100% 100%;
  444. margin-right: 5px;
  445. }
  446. .ai_body_select>.checkBox {
  447. position: absolute;
  448. bottom: 40px;
  449. border: 1px solid #E0EAFB;
  450. width: 100%;
  451. height: 300px;
  452. background: #fff;
  453. border-radius: 5px;
  454. padding: 10px;
  455. box-sizing: border-box;
  456. }
  457. .ai_body_select>.checkBox>.task>.title,
  458. .ai_body_select>.checkBox>.part>.title {
  459. font-size: 14px;
  460. font-weight: 700;
  461. margin-bottom: 5px;
  462. }
  463. .ai_body_select>.checkBox>.task {
  464. height: calc(100% - 60px);
  465. }
  466. .ai_body_select>.checkBox>.part {}
  467. .ai_body_select>.checkBox>.task>.content {
  468. height: calc(100% - 40px);
  469. overflow: auto;
  470. }
  471. .ai_body_select>.checkBox>.task>.content>.span+.span {
  472. margin-top: 5px;
  473. }
  474. .ai_body_select>.checkBox>.task>.content>.span {
  475. display: flex;
  476. align-items: center;
  477. font-size: 14px;
  478. cursor: pointer;
  479. }
  480. .ai_body_select>.checkBox>.task>.content>.span>.check {
  481. width: 13px;
  482. height: 13px;
  483. display: flex;
  484. align-items: center;
  485. margin-right: 5px;
  486. }
  487. .ai_body_select>.checkBox>.task>.content>.span>.check>img {
  488. width: 100%;
  489. height: 100%;
  490. }
  491. .ai_body_select>.checkBox>.part>.content {
  492. display: flex;
  493. align-items: center;
  494. font-size: 14px;
  495. justify-content: space-between;
  496. }
  497. .ai_body_select>.checkBox>.part>.content>.span {
  498. padding: 3px 6px;
  499. border: 1px solid #E0EAFB;
  500. border-radius: 40px;
  501. cursor: pointer;
  502. }
  503. .ai_body_select>.checkBox>.part>.content>.span.active {
  504. color: #0061ff;
  505. border-color: #0061ff;
  506. }
  507. </style>