From 9f816354a296dd8a2638acfe0fbf7f7b70cee470 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Fri, 12 Jul 2024 10:18:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B5=8C=E5=85=A5ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/http.js | 3 +- src/config/index.js | 7 ++-- src/views/Home.vue | 95 +++++++++++++++++++++++++++++---------------- 3 files changed, 66 insertions(+), 39 deletions(-) diff --git a/src/api/http.js b/src/api/http.js index feedc32..7ed4e28 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -5,6 +5,7 @@ import { import router from '../router/index' import Cookie from 'js-cookie' import config from '@/config' +import Util from '@/util' const service = axios.create({ baseURL: config.host, @@ -42,7 +43,7 @@ service.interceptors.response.use( if (!logouted) { Message.error(res.msg.includes('顶') ? '您的账号已在其他设备登录,您已被迫下线!' : '登录过期,请重新登录!') setTimeout(() => { - history.back() + Util.exit() }, 1500) logouted = 1 } diff --git a/src/config/index.js b/src/config/index.js index 6684696..ebc465e 100644 --- a/src/config/index.js +++ b/src/config/index.js @@ -2,8 +2,7 @@ import Cookie from 'js-cookie' const url = location.host const isDev = process.env.NODE_ENV === 'development' //是否本地 -// const isTest = url.includes('121.37.12.51') //测试服 -const isTest = true //测试服 +const isTest = url.includes('121.37.12.51') //测试服 const isHh = url.includes('10.196.131.73') //是否是河海版本 const isPro = url.includes('occupationlab.com') //是否职站生产 const isZxy = url.includes('izhixinyun.com') //是否智信云 @@ -14,8 +13,8 @@ let host = location.origin + '/' let bankPath = `${location.origin}/banksystem` // 银行系统 // 121.37.12.51 | 192.168.31.151 if (isDev) { - host = 'http://192.168.31.51:9000/' - // host = 'http://121.37.12.51:9000/' + host = 'http://192.168.31.217:9000/' + host = 'http://121.37.12.51:9000/' // host = 'https://occupationlab.com/' bankPath = `http://${location.hostname}:8093` } else if (isPro) { diff --git a/src/views/Home.vue b/src/views/Home.vue index 78ff798..bee3edd 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -3,9 +3,13 @@
{{ curriculumName }}
+账号:{{ account }};密码:112233aa
{{ $config.title }}
@@ -61,6 +65,7 @@ export default { data () { return { Config, + isAI: Cookie.get('admin-isAI') == 'true' ? true : false, isSubmit: Cookie.get('admin-isSubmit') == 'true' ? true : false, // 是否提交的标识 loaded: false, // 页面是否加载完的标识,页面默认隐藏,一进来先显示加载条,接口加载完后再显示页面,不然一开始会一闪而过没有样式的页面 loadIns: null, // loading实例 @@ -70,7 +75,7 @@ export default { curriculumName: Cookie.get('admin-curriculumName') ? decodeURIComponent(Cookie.get('admin-curriculumName')) : 'python', // 课程名称 assessmentId: Cookie.get('admin-assessmentId'), // 考核id mallId: Cookie.get('admin-mallId'), - language: Cookie.get('admin-language') || 'python3.7.9', // 编程语言 + language: Cookie.get('admin-language') || 'python3.10.9', // 编程语言 projectId: '', systemId: '', modelIsShow: false, // 导入模型按钮是否显示 @@ -83,7 +88,7 @@ export default { name: 'python3.9' }, { - name: 'python3.10' + name: 'python3.10.9' }, { name: 'python3.12.4' @@ -96,6 +101,7 @@ export default { workbench: [], // 判分点切换列表 codeKey: 1, // 编辑器索引 notAllowed: 1, + account: '', }; }, components: { @@ -103,42 +109,58 @@ export default { testPanel }, mounted () { - Cookie.get('admin-language') || Cookie.set('admin-language', 'python3.7.9') - // const opened = +localStorage.getItem('opened') - // if (opened) { - // localStorage.setItem('opened', opened + 1) - // this.$alert('我们注意到您当前已尝试打开多个实验页面。为保证实验的公平性和诚信,系统仅允许单个实验页面处于活跃状态。', '提示', { - // confirmButtonText: '退出当前页面', - // showClose: false, - // beforeClose: () => { - // Util.exit() - // }, - // }) - // } else { - // this.notAllowed = 0 - // localStorage.setItem('opened', 1) - // } - this.notAllowed = 0 - - document.onkeydown = function (event) { - var e = event || window.event || arguments.callee.caller.arguments[0]; - - if (e && e.keyCode == 123) { - e.returnValue = false; - return (false); + if (this.isAI) { + this.handleAI() + document.body.style.overflow = 'hidden' + this.loaded = true + } else { + Cookie.set('admin-language', 'python3.10.9') + // const opened = +localStorage.getItem('opened') + // if (opened) { + // localStorage.setItem('opened', opened + 1) + // this.$alert('我们注意到您当前已尝试打开多个实验页面。为保证实验的公平性和诚信,系统仅允许单个实验页面处于活跃状态。', '提示', { + // confirmButtonText: '退出当前页面', + // showClose: false, + // beforeClose: () => { + // Util.exit() + // }, + // }) + // } else { + // this.notAllowed = 0 + // localStorage.setItem('opened', 1) + // } + this.notAllowed = 0 + + document.onkeydown = function (event) { + var e = event || window.event || arguments.callee.caller.arguments[0]; + + if (e && e.keyCode == 123) { + e.returnValue = false; + return (false); + } } - } - this.loadIns = Loading.service({ - background: 'rgba(255, 255, 255, .1)' - }) - //兄弟组件传值 - newmain.$on("isSubmit", isSubmit => { - this.isSubmit = isSubmit - }) + this.loadIns = Loading.service({ + background: 'rgba(255, 255, 255, .1)' + }) + //兄弟组件传值 + newmain.$on("isSubmit", isSubmit => { + this.isSubmit = isSubmit + }) + } this.autoLogout() }, methods: { + // 给ai平台添加账号 + async handleAI () { + const res = await this.$get(`${this.api.getTheMostRecentlyRunProject}`, { + ai: 1, + cid: Cookie.get('admin-courseId') + }) + if (res.account) { + this.account = res.account + } + }, // 获取导入模型按钮展示状态 getModelStatus (systemId) { this.$post(`${this.api.displayListOrNotByStudent}?systemId=${systemId}`).then(res => { @@ -230,6 +252,7 @@ export default { margin-left: 10px; } + .back { padding: 23px 50px; border: none; @@ -237,6 +260,10 @@ export default { } } +.AI { + height: calc(100vh - 58px); +} + /deep/.top { display: flex; justify-content: space-between;