导入修复等

dev_2022-03-03
yujialong 3 years ago
parent 2f06f6ab7d
commit f2555c50af
  1. 6
      src/api/http.js
  2. 21
      src/components/codemirror.vue
  3. 5
      src/main.js
  4. 16
      src/styles/common.scss

@ -15,7 +15,7 @@ const service = axios.create({
service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'; service.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
// 请求拦截器 // 请求拦截器
service.interceptors.request.use(config => { service.interceptors.request.use(config => {
const token = util.getCookie('admin-token') const token = util.getCookie('token')
if (token) { if (token) {
config.headers.token = token config.headers.token = token
} }
@ -52,8 +52,8 @@ service.interceptors.response.use(
history.back() history.back()
break; break;
default: default:
Message.error(error.response.data.message) // Message.error(error.response.data.message)
Promise.reject(res); Promise.reject(error.response);
} }
return Promise.reject(error.response); return Promise.reject(error.response);
} }

@ -60,6 +60,7 @@
<!-- 导入模型 --> <!-- 导入模型 -->
<el-dialog title="请选择要导入的模型" :visible.sync="modelVisible" width="400px" :close-on-click-modal="false"> <el-dialog title="请选择要导入的模型" :visible.sync="modelVisible" width="400px" :close-on-click-modal="false">
<div class="model-wrap">
<el-tree <el-tree
:data="modelData" :data="modelData"
ref="tree" ref="tree"
@ -70,6 +71,7 @@
node-key="id" node-key="id"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> :props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
</el-tree> </el-tree>
</div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button size="small" @click="modelVisible = false">取消</el-button> <el-button size="small" @click="modelVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="submit">导入</el-button> <el-button size="small" type="primary" @click="submit">导入</el-button>
@ -234,7 +236,6 @@ export default {
records.map(n => { records.map(n => {
n.categoryName = n.modelName n.categoryName = n.modelName
}) })
console.log(records)
e.children = [...e.children, ...records] e.children = [...e.children, ...records]
resolve() resolve()
}).catch(res => { }).catch(res => {
@ -264,8 +265,13 @@ export default {
const id = this.$refs.tree.getCheckedKeys() const id = this.$refs.tree.getCheckedKeys()
if (!id.length) return this.$message.error('请选择模型!') if (!id.length) return this.$message.error('请选择模型!')
this.$post(`${this.api.referenceFindById}?id=${id[0]}`).then(res => { 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.modelVisible = false
this.$nextTick(() => {
const codemirror = this.$refs.codemirror.codemirror
codemirror.focus()
codemirror.setCursor(codemirror.lineCount(), 0)
})
}).catch(res => {}) }).catch(res => {})
}, },
/** /**
@ -386,7 +392,9 @@ export default {
this.$emit('update:codeId', res.codeId) // coddeId this.$emit('update:codeId', res.codeId) // coddeId
this.$emit('update:answer', this.runResult) // this.$emit('update:answer', this.runResult) //
this.$emit('update:retResult', data.retResult) // this.$emit('update:retResult', data.retResult) //
}).catch(err => {}) }).catch(err => {
this.loadIns.close()
})
} else { } else {
this.loadIns = Loading.service({ this.loadIns = Loading.service({
background: 'transparent' background: 'transparent'
@ -440,8 +448,8 @@ export default {
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length)) this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length))
} }
}).catch(res => { }).catch(res => {
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。')
this.loadIns.close() this.loadIns.close()
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。')
}) })
} }
} }
@ -455,7 +463,6 @@ export default {
}, },
// //
downloadPic(i) { downloadPic(i) {
console.log(11, this.$refs['picLink' + i][0])
this.$refs['picLink' + i][0].click() this.$refs['picLink' + i][0].click()
}, },
// //
@ -647,4 +654,8 @@ export default {
max-width: 100%; max-width: 100%;
} }
} }
.model-wrap {
max-height: 400px;
overflow: auto;
}
</style> </style>

@ -53,11 +53,8 @@ Vue.prototype.$put = put;
Vue.prototype.$config = config Vue.prototype.$config = config
Vue.config.productionTip = false; Vue.config.productionTip = false;
document.title = config.title
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
if (to.meta.title) {
document.title = to.meta.title
}
next() next()
}) })

@ -8,18 +8,14 @@
cursor: pointer; cursor: pointer;
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 2px; width: 8px;
height: 6px; height: 8px;
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background-color: #fdca17; width: 5px;
border-radius: 3px; border-radius: 6px;
box-shadow: inset 0 0 5px #dddddd; background: #d7d7d7;
}
::-webkit-scrollbar-track {
box-shadow: inset 0 0 5px #dddddd;
border-radius: 0;
background: #dddddd;
} }
input::-webkit-input-placeholder { input::-webkit-input-placeholder {
color: #333; color: #333;

Loading…
Cancel
Save