From f2555c50af57692bf4c2ce10e74a3e0c3def9c77 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Tue, 29 Mar 2022 10:43:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BF=AE=E5=A4=8D=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/http.js | 6 ++--- src/components/codemirror.vue | 41 ++++++++++++++++++++++------------- src/main.js | 5 +---- src/styles/common.scss | 16 +++++--------- 4 files changed, 36 insertions(+), 32 deletions(-) diff --git a/src/api/http.js b/src/api/http.js index 78a3c19..685bd79 100644 --- a/src/api/http.js +++ b/src/api/http.js @@ -15,7 +15,7 @@ const service = axios.create({ service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'; // 请求拦截器 service.interceptors.request.use(config => { - const token = util.getCookie('admin-token') + const token = util.getCookie('token') if (token) { config.headers.token = token } @@ -52,8 +52,8 @@ service.interceptors.response.use( history.back() break; default: - Message.error(error.response.data.message) - Promise.reject(res); + // Message.error(error.response.data.message) + Promise.reject(error.response); } return Promise.reject(error.response); } diff --git a/src/components/codemirror.vue b/src/components/codemirror.vue index 3b67850..6468ee2 100644 --- a/src/components/codemirror.vue +++ b/src/components/codemirror.vue @@ -60,16 +60,18 @@ - - +
+ + +
取消 导入 @@ -234,7 +236,6 @@ export default { records.map(n => { n.categoryName = n.modelName }) - console.log(records) e.children = [...e.children, ...records] resolve() }).catch(res => { @@ -264,8 +265,13 @@ export default { const id = this.$refs.tree.getCheckedKeys() if (!id.length) return this.$message.error('请选择模型!') this.$post(`${this.api.referenceFindById}?id=${id[0]}`).then(res => { - this.codeVal += '\n\n' + res.data.modelDemo + this.codeVal += '\n\n' + res.data.modelDemo // 空两行插入 this.modelVisible = false + this.$nextTick(() => { + const codemirror = this.$refs.codemirror.codemirror + codemirror.focus() + codemirror.setCursor(codemirror.lineCount(), 0) + }) }).catch(res => {}) }, /** @@ -386,7 +392,9 @@ export default { this.$emit('update:codeId', res.codeId) // 更新coddeId this.$emit('update:answer', this.runResult) // 更新运行结果 this.$emit('update:retResult', data.retResult) // 更新返回结果 - }).catch(err => {}) + }).catch(err => { + this.loadIns.close() + }) } else { this.loadIns = Loading.service({ background: 'transparent' @@ -440,8 +448,8 @@ export default { this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length)) } }).catch(res => { - res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。') this.loadIns.close() + res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。') }) } } @@ -455,7 +463,6 @@ export default { }, // 下载图片 downloadPic(i) { - console.log(11, this.$refs['picLink' + i][0]) this.$refs['picLink' + i][0].click() }, // 获取正式答案 @@ -647,4 +654,8 @@ export default { max-width: 100%; } } +.model-wrap { + max-height: 400px; + overflow: auto; +} \ No newline at end of file diff --git a/src/main.js b/src/main.js index 152eff7..af37b04 100644 --- a/src/main.js +++ b/src/main.js @@ -53,11 +53,8 @@ Vue.prototype.$put = put; Vue.prototype.$config = config Vue.config.productionTip = false; - +document.title = config.title router.beforeEach((to, from, next) => { - if (to.meta.title) { - document.title = to.meta.title - } next() }) diff --git a/src/styles/common.scss b/src/styles/common.scss index 92bbeb5..f331c08 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -8,18 +8,14 @@ cursor: pointer; } ::-webkit-scrollbar { - width: 2px; - height: 6px; + width: 8px; + height: 8px; } + ::-webkit-scrollbar-thumb { - background-color: #fdca17; - border-radius: 3px; - box-shadow: inset 0 0 5px #dddddd; -} -::-webkit-scrollbar-track { - box-shadow: inset 0 0 5px #dddddd; - border-radius: 0; - background: #dddddd; + width: 5px; + border-radius: 6px; + background: #d7d7d7; } input::-webkit-input-placeholder { color: #333;