main.vue 16 KB

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