main.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. <template>
  2. <div style="height:100%">
  3. <Header v-if="!gotype"></Header>
  4. <div class="container">
  5. <div class="container-left" :style="leftShow ? { width: 0 } : { width: '240px' }" v-if="!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 ? 'liyuan' : '']">
  67. <div class="pgb" v-if="gotype">
  68. <div @click="backO" class="pgbL">
  69. <img src="../assets/icon/backPage.svg" alt="">
  70. <div>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 } from '../stores/counter'
  138. const user = userInfoStore()
  139. const CurrentRole = userCurrentRole()
  140. const isupdateCourse = ref(false)
  141. const isLogin = ref(false)
  142. const activeIndex = ref(0)
  143. const dialogVisible = ref(true)
  144. const dialogVisible1 = ref(true)
  145. const iframeRef = ref(null)
  146. const iframeRef1 = ref(null)
  147. const iframeRef2 = ref(null)
  148. const iframeRef4 = ref(null)
  149. const loading = ref(false)
  150. const iframeRef1Url = ref('')
  151. const iframeRef2Url = ref('')
  152. const iframeRef1Url4 = ref('')
  153. const iframeRef2Dialog = ref(false)
  154. const leftShow = ref(false)
  155. const admin = ref(false)
  156. const gotype = ref((window.topU && window.topU.gotype2) ? window.topU.gotype2 : '')
  157. onMounted(() => {
  158. console.log('gotype',gotype.value);
  159. console.log('gotype',sessionStorage.getItem('gotype2'));
  160. // let timer = setInterval(() => {
  161. // if (JSON.stringify(user.user) != "{}") {
  162. // clickSwitch(1)
  163. // clearInterval(timer)
  164. // }
  165. // }, 10);
  166. })
  167. watchEffect(() => {
  168. // console.log('111111111111',CurrentRole, user.user)
  169. if (JSON.stringify(user.user) != "{}") {
  170. isLogin.value = true
  171. 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) {
  172. isupdateCourse.value = true
  173. }
  174. 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) {
  175. admin.value = true
  176. }
  177. }
  178. })
  179. const clickSwitch = (index) => {
  180. console.log('clickSwitch', activeIndex.value)
  181. if (index == 1 && activeIndex.value != 1) {
  182. loading.value = true
  183. iframeRef1Url.value = `//app.cocorobo.cn/#/appManagement?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  184. setTimeout(() => {
  185. iframeRef1.value.onload = () => {
  186. loading.value = false
  187. }
  188. }, 100)
  189. } else if (index == 3 && activeIndex.value != 3) {
  190. loading.value = true
  191. setTimeout(() => {
  192. iframeRef.value.onload = () => {
  193. loading.value = false
  194. }
  195. }, 10)
  196. } else if (index == 2 && activeIndex.value != 2) {
  197. loading.value = true
  198. iframeRef2Url.value = `//app.cocorobo.cn/#/AppList?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  199. setTimeout(() => {
  200. iframeRef2.value.onload = () => {
  201. loading.value = false
  202. }
  203. }, 10)
  204. } else if (index == 4 && activeIndex.value != 4) {
  205. loading.value = true
  206. // //storage.cocorobo.cn/dist/#/knowledge?userid=b7ccc834-aae5-11ea-a8d4-52540005ab01&oid=45facc0a-1211-11ec-80ad-005056b86db5&org=null
  207. iframeRef1Url4.value = `//storage.cocorobo.cn/dist/#/knowledge?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}`
  208. setTimeout(() => {
  209. iframeRef4.value.onload = () => {
  210. loading.value = false
  211. }
  212. loading.value = false
  213. }, 100)
  214. } else if (index == 5 && activeIndex.value != 5) {
  215. loading.value = true
  216. // 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`
  217. iframeRef1Url4.value = `//pbl.cocorobo.cn/pbl-teacher-table/dist/#/works?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}`
  218. setTimeout(() => {
  219. iframeRef4.value.onload = () => {
  220. loading.value = false
  221. }
  222. loading.value = false
  223. }, 100)
  224. } else if (index == 6 && activeIndex.value != 6) {
  225. loading.value = true
  226. //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
  227. iframeRef1Url4.value = `//pbl.cocorobo.cn/pbl-teacher-table/dist/#/grade?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}`
  228. setTimeout(() => {
  229. iframeRef4.value.onload = () => {
  230. loading.value = false
  231. }
  232. loading.value = false
  233. }, 100)
  234. } else if (index == 7 && activeIndex.value != 7) {
  235. loading.value = true
  236. //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
  237. iframeRef1Url4.value = `//app.cocorobo.cn/#/teachingModel?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  238. setTimeout(() => {
  239. iframeRef4.value.onload = () => {
  240. loading.value = false
  241. }
  242. loading.value = false
  243. }, 100)
  244. } else if (index == 8 && activeIndex.value != 8) {
  245. loading.value = true
  246. //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
  247. iframeRef1Url4.value = `//app.cocorobo.cn/#/cocobookllm?userid=${user.user.userid}&oid=${user.user.organizeid}&org=${user.user.org}&role=${user.user.role}`
  248. setTimeout(() => {
  249. iframeRef4.value.onload = () => {
  250. loading.value = false
  251. }
  252. loading.value = false
  253. }, 100)
  254. } else if (index == 9 && activeIndex.value != 9) {
  255. loading.value = true
  256. //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
  257. 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}`
  258. setTimeout(() => {
  259. iframeRef4.value.onload = () => {
  260. loading.value = false
  261. }
  262. loading.value = false
  263. }, 100)
  264. }
  265. activeIndex.value = index
  266. }
  267. const copyEmail = () => {
  268. navigator.clipboard.writeText('support@cocorobo.cc').then(() => {
  269. console.log('复制成功');
  270. }).catch((error) => {
  271. console.error('复制失败:', error);
  272. });
  273. }
  274. const backO = () => {
  275. 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}`
  276. }
  277. const show = () => {
  278. console.log('show')
  279. }
  280. </script>
  281. <style lang="scss">
  282. .container {
  283. display: flex;
  284. overflow: hidden;
  285. align-items: center;
  286. .container-left {
  287. height: calc(100vh - 60px);
  288. width: 240px;
  289. background: #fff;
  290. overflow: hidden;
  291. padding-top: 0px;
  292. .container-left-top {
  293. margin: 0 10px 0 10px;
  294. font-size: 14px;
  295. color: #111;
  296. font-weight: 500;
  297. padding: 10px 0 10px 40px;
  298. position: relative;
  299. cursor: pointer;
  300. transition: all 0.7s ease 0ms;
  301. .icon-img {
  302. position: absolute;
  303. top: 10px;
  304. left: 15px;
  305. }
  306. .up {
  307. position: absolute;
  308. top: 15px;
  309. left: 140px;
  310. }
  311. div {
  312. background-color: #fff;
  313. padding: 5px 0;
  314. color: #00000099;
  315. }
  316. }
  317. .container-left-show{
  318. position: fixed;
  319. top: 60px;
  320. left: 0;
  321. z-index: 99;
  322. }
  323. .container-left-show span{
  324. display: inline-block;
  325. width: 35px;
  326. height: 35px;
  327. line-height: 35px;
  328. text-align: center;
  329. border: 1px solid #E7E7E7;
  330. cursor: pointer;
  331. background-color: #fff;
  332. border-radius: 5px;
  333. z-index: 99;
  334. }
  335. }
  336. .main {
  337. background: #F0F2F5;
  338. padding: 20px 10%;
  339. width: calc(100% - 240px);
  340. height: calc(100vh - 60px);
  341. overflow: auto;
  342. }
  343. .liyuan{
  344. width: 100% !important;
  345. height: 100vh !important;
  346. padding: 20px 90px !important;
  347. }
  348. .iframe {
  349. width: calc(100% - 240px);
  350. height: calc(100vh - 60px);
  351. position: relative;
  352. .el-overlay {
  353. position: absolute !important;
  354. .el-overlay-dialog {
  355. position: absolute !important;
  356. .el-dialog__header {
  357. text-align: left;
  358. }
  359. }
  360. }
  361. iframe {
  362. width: 100%;
  363. height: 100%;
  364. }
  365. }
  366. }
  367. .active {
  368. background: #F0F2F5;
  369. color: #0061FF !important;
  370. border-radius: 5px;
  371. }
  372. /* 渐入渐出动画 */
  373. .fade-enter-active,
  374. .fade-leave-active {
  375. transition: opacity 0.5s;
  376. }
  377. .fade-enter-from,
  378. .fade-leave-to {
  379. opacity: 0;
  380. }
  381. .pgb{
  382. /* font-family: PingFang SC; */
  383. font-weight: bold;
  384. font-size: 20px;
  385. display: flex;align-items: center;
  386. gap: 10px;
  387. padding:20px 0px 0;
  388. /* height: 23.8px; */
  389. margin-bottom: 15px;
  390. }
  391. .pgbL{
  392. display: flex;align-items: center;
  393. gap: 10px;
  394. cursor: pointer;
  395. }
  396. </style>