main.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <div style="height:100%">
  3. <Header v-if="!gotype.gotype"></Header>
  4. <div class="container">
  5. <div class="container-left" :style="leftShow ? { width: 0 } : { width: '240px' }" v-if="!gotype.gotype">
  6. <div class="container-left-top" @click="dialogVisible1 = !dialogVisible1">
  7. <span>
  8. <img class="icon-img" :src="img11" alt="AI 应用" />AI通识课
  9. <img v-if="dialogVisible1" class="up" :src="img3" alt="up" />
  10. <img v-else class="up" :src="down" alt="down" />
  11. </span>
  12. </div>
  13. <transition name="fade">
  14. <div v-if="dialogVisible1">
  15. <div :class="activeIndex == 0 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(0)">
  16. 教学中心
  17. </div>
  18. <!-- v-if="isLogin" -->
  19. <div :class="activeIndex == 9 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(9)">
  20. 创建课程
  21. </div>
  22. <!-- <div :class="activeIndex == 5 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(5)">
  23. 学生评价
  24. </div> -->
  25. <div v-if="admin" :class="activeIndex == 6 ? 'container-left-top active' : 'container-left-top'"
  26. @click="clickSwitch(6)">
  27. 学生管理
  28. </div>
  29. </div>
  30. </transition>
  31. <div class="container-left-top" @click="dialogVisible = !dialogVisible">
  32. <span>
  33. <img class="icon-img" :src="img2" alt="AI 应用" />AI 应用
  34. <img v-if="dialogVisible" class="up" :src="img3" alt="up" />
  35. <img v-else class="up" :src="down" alt="down" />
  36. </span>
  37. </div>
  38. <transition name="fade">
  39. <div v-if="dialogVisible">
  40. <div :class="activeIndex == 1 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(1)">
  41. 应用中心
  42. </div>
  43. <div :class="activeIndex == 2 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(2)">
  44. 创建应用
  45. </div>
  46. <div :class="activeIndex == 7 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(7)">
  47. 教学空间
  48. </div>
  49. <div :class="activeIndex == 8 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(8)">
  50. 学习空间
  51. </div>
  52. <!-- <div :class="activeIndex == 3 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(3)">
  53. AI
  54. 应用精选</div> -->
  55. <div :class="activeIndex == 4 ? 'container-left-top active' : 'container-left-top'" @click="clickSwitch(4)">
  56. 知识库
  57. </div>
  58. </div>
  59. </transition>
  60. <div class="container-left-show" :style="!leftShow ? { left: '200px' } : { left: '0' }"
  61. @click="leftShow = !leftShow">
  62. <span v-if="leftShow"><el-icon><ArrowRight /></el-icon></span>
  63. <span v-else><el-icon><ArrowLeft /></el-icon></span>
  64. </div>
  65. </div>
  66. <div class="main" :style="leftShow ? { width: '100%' } : ''" v-if="activeIndex == 0" :class="[gotype.gotype ? 'liyuan' : '']">
  67. <div class="pgb" v-if="gotype.gotype && gotype.gotype == 'CourseCon'">
  68. <div @click="backO" class="pgbL">
  69. <img src="../assets/icon/backPage.svg" alt="">
  70. <div style="font-weight: 700;">AI通识课</div>
  71. </div>
  72. </div>
  73. <!-- <BannerVue></BannerVue> -->
  74. <CourseSelect></CourseSelect>
  75. <AIExperience></AIExperience>
  76. <AIexploration></AIexploration>
  77. <DemoCurourse v-if="lang.lang != 'hk'" />
  78. <!-- <resource></resource> -->
  79. <Practice></Practice>
  80. <!-- <other v-if="!isupdateCourse"></other> -->
  81. <!-- <Edu v-if="isLogin"></Edu> -->
  82. </div>
  83. <div class="iframe" :style="leftShow ? { width: '100%' } : ''" v-else-if="activeIndex == 1" v-loading="loading">
  84. <iframe ref="iframeRef1" :src="iframeRef1Url"
  85. allow="camera *; microphone *;display-capture;midi;encrypted-media;clipboard-write;clipboard-read" :webkitallowfullscreen="true" :mozallowfullscreen="true" :allowfullscreen="true"
  86. frameborder="0"></iframe>
  87. </div>
  88. <div class="iframe" :style="leftShow ? { width: '100%' } : ''" v-else-if="activeIndex == 2" v-loading="loading">
  89. <iframe ref="iframeRef2" :src="iframeRef2Url"
  90. allow="camera *; microphone *;display-capture;midi;encrypted-media;clipboard-write;clipboard-read" :webkitallowfullscreen="true" :mozallowfullscreen="true" :allowfullscreen="true"
  91. frameborder="0"></iframe>
  92. <el-dialog v-model="iframeRef2Dialog" width="450" @close="clickSwitch(1)">
  93. <template #header="{ }">
  94. <div class="my-header">
  95. <h4 style="display: flex;align-items: center;color: #0354D7;font-weight: bold;"><img :src="info" alt=""
  96. style="margin-right: 5px;" />无权访问 !</h4>
  97. </div>
  98. </template>
  99. <div class="dialog-content">
  100. 暂无开通权限,请通过<span style="color: #0354D7;font-weight: bold;">“support@cocorobo.cc”</span>联系管理员。
  101. </div>
  102. <template #footer="{ }">
  103. <div class="dialog-footer" style="text-align: right;">
  104. <el-button @click="clickSwitch(1)">返回</el-button>
  105. <el-button type="primary" @click="copyEmail">复制邮箱</el-button>
  106. </div>
  107. </template>
  108. </el-dialog>
  109. </div>
  110. <div class="iframe" :style="leftShow ? { width: '100%' } : ''" v-else-if="activeIndex == 3" v-loading="loading">
  111. <iframe
  112. allow="camera *; microphone *;display-capture;midi;encrypted-media;clipboard-write;clipboard-read" :webkitallowfullscreen="true" :mozallowfullscreen="true" :allowfullscreen="true"
  113. ref="iframeRef" src="//app.cocorobo.cn/#/appSelection" frameborder="0"></iframe>
  114. </div>
  115. <div class="iframe" :style="leftShow ? { width: '100%' } : ''" v-else v-loading="loading">
  116. <iframe
  117. allow="camera *; microphone *;display-capture;midi;encrypted-media;clipboard-write;clipboard-read" :webkitallowfullscreen="true" :mozallowfullscreen="true" :allowfullscreen="true"
  118. ref="iframeRef4" :src="iframeRef1Url4" frameborder="0"></iframe>
  119. </div>
  120. </div>
  121. <Feedback></Feedback>
  122. </div>
  123. </template>
  124. <script setup>
  125. import { ref, watchEffect, onMounted, inject } from 'vue';
  126. import { ArrowLeft,ArrowRight } from '@element-plus/icons-vue'
  127. import img1 from '@/assets/icon/1.png'
  128. import img11 from '@/assets/icon/1-1.png'
  129. import img2 from '@/assets/icon/2.png'
  130. import img3 from '@/assets/icon/up.png'
  131. import down from '@/assets/icon/down.png'
  132. import info from '@/assets/icon/info.png'
  133. import shows from '@/assets/icon/show.png'
  134. import BannerVue from '@/components/main/banner.vue'
  135. import CourseSelect from '@/components/main/courseSelect.vue'
  136. import DemoCurourse from '@/components/main/demoCourse.vue'
  137. import resource from '@/components/main/resource.vue';
  138. import Practice from '@/components/main/Practice.vue';
  139. import AIExperience from '@/components/main/AIExperience.vue';
  140. import AIexploration from '@/components/main/AIexploration.vue';
  141. import other from '@/components/main/other.vue';
  142. import Edu from '@/components/main/edu.vue';
  143. import Feedback from '@/components/main/feedback.vue';
  144. import Header from './header.vue'
  145. import { userCurrentRole, userInfoStore,pageGotype } from '../stores/counter'
  146. const lang = inject('lang')
  147. const user = userInfoStore()
  148. const CurrentRole = userCurrentRole()
  149. const gotype = pageGotype()
  150. const isupdateCourse = ref(false)
  151. const isLogin = ref(false)
  152. const activeIndex = ref(0)
  153. const dialogVisible = ref(true)
  154. const dialogVisible1 = ref(true)
  155. const iframeRef = ref(null)
  156. const iframeRef1 = ref(null)
  157. const iframeRef2 = ref(null)
  158. const iframeRef4 = ref(null)
  159. const loading = ref(false)
  160. const iframeRef1Url = ref('')
  161. const iframeRef2Url = ref('')
  162. const iframeRef1Url4 = ref('')
  163. const iframeRef2Dialog = ref(false)
  164. const leftShow = ref(false)
  165. const admin = ref(false)
  166. onMounted(() => {
  167. // let timer = setInterval(() => {
  168. // if (JSON.stringify(user.user) != "{}") {
  169. // clickSwitch(1)
  170. // clearInterval(timer)
  171. // }
  172. // }, 10);
  173. })
  174. watchEffect(() => {
  175. // console.log('111111111111',CurrentRole, user.user)
  176. if (JSON.stringify(user.user) != "{}") {
  177. isLogin.value = true
  178. if (CurrentRole.currentRole == "edupersonnel" || CurrentRole.currentRole == "areaAdministrator" || CurrentRole.currentRole == "userAdministrator" || CurrentRole.currentRole == "securityAuditor" || CurrentRole.currentRole == "schoolAdministrator" || CurrentRole.currentRole == "schoolSecurityAuditor" || CurrentRole.currentRole == "teacher" || user.user.type != 2) {
  179. isupdateCourse.value = true
  180. }
  181. if (CurrentRole.currentRole == "edupersonnel" || CurrentRole.currentRole == "areaAdministrator" || CurrentRole.currentRole == "userAdministrator" || CurrentRole.currentRole == "securityAuditor" || CurrentRole.currentRole == "schoolAdministrator" || CurrentRole.currentRole == "schoolSecurityAuditor" || CurrentRole.currentRole == "teacher" || user.user.type != 2) {
  182. admin.value = true
  183. }
  184. }
  185. })
  186. const clickSwitch = (index) => {
  187. console.log('clickSwitch', activeIndex.value)
  188. if (index == 1 && activeIndex.value != 1) {
  189. loading.value = true
  190. iframeRef1Url.value = `//app.cocorobo.cn/#/appManagement?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  191. setTimeout(() => {
  192. iframeRef1.value.onload = () => {
  193. loading.value = false
  194. }
  195. }, 100)
  196. } else if (index == 3 && activeIndex.value != 3) {
  197. loading.value = true
  198. setTimeout(() => {
  199. iframeRef.value.onload = () => {
  200. loading.value = false
  201. }
  202. }, 10)
  203. } else if (index == 2 && activeIndex.value != 2) {
  204. loading.value = true
  205. iframeRef2Url.value = `//app.cocorobo.cn/#/AppList?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  206. setTimeout(() => {
  207. iframeRef2.value.onload = () => {
  208. loading.value = false
  209. }
  210. }, 10)
  211. } else if (index == 4 && activeIndex.value != 4) {
  212. loading.value = true
  213. // //storage.cocorobo.cn/dist/#/knowledge?userid=b7ccc834-aae5-11ea-a8d4-52540005ab01&oid=45facc0a-1211-11ec-80ad-005056b86db5&org=null
  214. iframeRef1Url4.value = `//storage.cocorobo.cn/dist/#/knowledge?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}`
  215. setTimeout(() => {
  216. iframeRef4.value.onload = () => {
  217. loading.value = false
  218. }
  219. loading.value = false
  220. }, 100)
  221. } else if (index == 5 && activeIndex.value != 5) {
  222. loading.value = true
  223. // iframeRef1Url4.value = `//pbl.cocorobo.cn/pbl-teacher-table/dist/#/works?userid=4e748720-5878-11ef-b873-005056b86db5&oid=46034950-39b1-11ef-b873-005056b86db5&org=16ace517-b5c7-4168-a9bb-a9e0035df840`
  224. iframeRef1Url4.value = `//pbl.cocorobo.cn/pbl-teacher-table/dist/#/works?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}`
  225. setTimeout(() => {
  226. iframeRef4.value.onload = () => {
  227. loading.value = false
  228. }
  229. loading.value = false
  230. }, 100)
  231. } else if (index == 6 && activeIndex.value != 6) {
  232. loading.value = true
  233. //pbl.cocorobo.cn/pbl-teacher-table/dist/#/grade?userid=4e748720-5878-11ef-b873-005056b86db5&oid=46034950-39b1-11ef-b873-005056b86db5&org=16ace517-b5c7-4168-a9bb-a9e0035df840
  234. iframeRef1Url4.value = `//pbl.cocorobo.cn/pbl-teacher-table/dist/#/studentManageNew?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  235. setTimeout(() => {
  236. iframeRef4.value.onload = () => {
  237. loading.value = false
  238. }
  239. loading.value = false
  240. }, 100)
  241. } else if (index == 7 && activeIndex.value != 7) {
  242. loading.value = true
  243. //pbl.cocorobo.cn/pbl-teacher-table/dist/#/grade?userid=4e748720-5878-11ef-b873-005056b86db5&oid=46034950-39b1-11ef-b873-005056b86db5&org=16ace517-b5c7-4168-a9bb-a9e0035df840
  244. iframeRef1Url4.value = `//app.cocorobo.cn/#/teachingModel?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  245. setTimeout(() => {
  246. iframeRef4.value.onload = () => {
  247. loading.value = false
  248. }
  249. loading.value = false
  250. }, 100)
  251. } else if (index == 8 && activeIndex.value != 8) {
  252. loading.value = true
  253. //pbl.cocorobo.cn/pbl-teacher-table/dist/#/grade?userid=4e748720-5878-11ef-b873-005056b86db5&oid=46034950-39b1-11ef-b873-005056b86db5&org=16ace517-b5c7-4168-a9bb-a9e0035df840
  254. iframeRef1Url4.value = `//app.cocorobo.cn/#/cocobookllm?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  255. setTimeout(() => {
  256. iframeRef4.value.onload = () => {
  257. loading.value = false
  258. }
  259. loading.value = false
  260. }, 100)
  261. } else if (index == 9 && activeIndex.value != 9) {
  262. loading.value = true
  263. //pbl.cocorobo.cn/pbl-teacher-table/dist/#/grade?userid=4e748720-5878-11ef-b873-005056b86db5&oid=46034950-39b1-11ef-b873-005056b86db5&org=16ace517-b5c7-4168-a9bb-a9e0035df840
  264. iframeRef1Url4.value = `//pbl.cocorobo.cn/pbl-teacher-table/dist/#/course?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  265. setTimeout(() => {
  266. iframeRef4.value.onload = () => {
  267. loading.value = false
  268. }
  269. loading.value = false
  270. }, 100)
  271. }
  272. activeIndex.value = index
  273. }
  274. const copyEmail = () => {
  275. navigator.clipboard.writeText('support@cocorobo.cc').then(() => {
  276. console.log('复制成功');
  277. }).catch((error) => {
  278. console.error('复制失败:', error);
  279. });
  280. }
  281. const backO = () => {
  282. window.location.href = `https://pbl.cocorobo.cn/pbl-teacher-table/dist/#/CourseCon?userid=${user.user.userid}&oid=${user.user.oid}&org=${user.user.org}&role=${user.user.role}&tType=${user.user.tType}`
  283. }
  284. const show = () => {
  285. console.log('show')
  286. }
  287. </script>
  288. <style lang="scss">
  289. .container {
  290. display: flex;
  291. overflow: hidden;
  292. align-items: center;
  293. .container-left {
  294. height: calc(100vh - 60px);
  295. width: 240px;
  296. background: #fff;
  297. overflow: hidden;
  298. padding-top: 0px;
  299. .container-left-top {
  300. margin: 0 10px 0 10px;
  301. font-size: 14px;
  302. color: #111;
  303. font-weight: 500;
  304. padding: 10px 0 10px 40px;
  305. position: relative;
  306. cursor: pointer;
  307. transition: all 0.7s ease 0ms;
  308. .icon-img {
  309. position: absolute;
  310. top: 10px;
  311. left: 15px;
  312. }
  313. .up {
  314. position: absolute;
  315. top: 15px;
  316. left: 140px;
  317. }
  318. div {
  319. background-color: #fff;
  320. padding: 5px 0;
  321. color: #00000099;
  322. }
  323. }
  324. .container-left-show{
  325. position: fixed;
  326. top: 60px;
  327. left: 0;
  328. z-index: 99;
  329. }
  330. .container-left-show span{
  331. display: inline-block;
  332. width: 35px;
  333. height: 35px;
  334. line-height: 35px;
  335. text-align: center;
  336. border: 1px solid #E7E7E7;
  337. cursor: pointer;
  338. background-color: #fff;
  339. border-radius: 5px;
  340. z-index: 99;
  341. }
  342. }
  343. .main {
  344. background: #F0F2F5;
  345. padding: 20px 10%;
  346. width: calc(100% - 240px);
  347. height: calc(100vh - 60px);
  348. overflow: auto;
  349. }
  350. .liyuan{
  351. width: 100% !important;
  352. height: 100vh !important;
  353. padding: 20px 90px !important;
  354. }
  355. .iframe {
  356. width: calc(100% - 240px);
  357. height: calc(100vh - 60px);
  358. position: relative;
  359. .el-overlay {
  360. position: absolute !important;
  361. .el-overlay-dialog {
  362. position: absolute !important;
  363. .el-dialog__header {
  364. text-align: left;
  365. }
  366. }
  367. }
  368. iframe {
  369. width: 100%;
  370. height: 100%;
  371. }
  372. }
  373. }
  374. .active {
  375. background: #F0F2F5;
  376. color: #0061FF !important;
  377. border-radius: 5px;
  378. }
  379. /* 渐入渐出动画 */
  380. .fade-enter-active,
  381. .fade-leave-active {
  382. transition: opacity 0.5s;
  383. }
  384. .fade-enter-from,
  385. .fade-leave-to {
  386. opacity: 0;
  387. }
  388. .pgb{
  389. /* font-family: PingFang SC; */
  390. font-weight: bold;
  391. font-size: 20px;
  392. display: flex;align-items: center;
  393. gap: 10px;
  394. padding:20px 0px 0;
  395. /* height: 23.8px; */
  396. margin-bottom: 15px;
  397. }
  398. .pgbL{
  399. display: flex;align-items: center;
  400. gap: 10px;
  401. cursor: pointer;
  402. color: #000;
  403. font-family: '黑体';
  404. }
  405. </style>