导入修复等

dev_2022-03-03
yujialong 3 years ago
parent 2f06f6ab7d
commit f2555c50af
  1. 6
      src/api/http.js
  2. 41
      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.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);
}

@ -60,16 +60,18 @@
<!-- 导入模型 -->
<el-dialog title="请选择要导入的模型" :visible.sync="modelVisible" width="400px" :close-on-click-modal="false">
<el-tree
:data="modelData"
ref="tree"
default-expand-all
@check-change="treeCheckChange"
show-checkbox
:check-strictly="true"
node-key="id"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
</el-tree>
<div class="model-wrap">
<el-tree
:data="modelData"
ref="tree"
default-expand-all
@check-change="treeCheckChange"
show-checkbox
:check-strictly="true"
node-key="id"
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}">
</el-tree>
</div>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="modelVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="submit">导入</el-button>
@ -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;
}
</style>

@ -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()
})

@ -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;

Loading…
Cancel
Save