diff --git a/src/components/love.vue b/src/components/love.vue index efe68a5..d6b4269 100644 --- a/src/components/love.vue +++ b/src/components/love.vue @@ -539,11 +539,14 @@ import {listTable1, predictReaction} from "@/utils/table1"; methods: { /** 预测按钮操作 */ handleQuery() { - this.predictResult=''; - predictReaction(this.smiles1,this.smiles2).then(response => { - this.predictResult = response.data; // 将预测结果赋值给 predictResult - }); - // this.predictResult = '666'; + this.predictResult = ''; + predictReaction(this.smiles1, this.smiles2) + .then(prediction => { + this.predictResult = prediction; + }) + .catch(error => { + console.error(error); + }); }, selectSort(sort) { this.$emit("selectSort", sort); diff --git a/src/utils/table1.js b/src/utils/table1.js index 3392b7d..5a9e279 100644 --- a/src/utils/table1.js +++ b/src/utils/table1.js @@ -39,12 +39,11 @@ export function selectDetails(drugName) { export function predictReaction(mol1, mol2) { const url = 'http://127.0.0.1:5000/predict'; return axios.get(url, { params: { mol1, mol2 } }) - .then(response => response.data) + .then(response => Number(response.data)) .catch(error => console.error(error)); } - // 查询药品作用管理详细 // export function getTable1(id) { // return request({