From ce1578853f1282ef7d13f984b0dc7e563de4bc8b Mon Sep 17 00:00:00 2001 From: kevin Date: Fri, 7 Nov 2025 19:25:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=97=E4=B8=8D=E4=BA=86ts=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontent/ops_vue/src/my_network_func.ts | 18 +++++++++++++++--- frontent/ops_vue/src/views/HomeView.vue | 24 +++++++++++------------- 2 files changed, 26 insertions(+), 16 deletions(-) diff --git a/frontent/ops_vue/src/my_network_func.ts b/frontent/ops_vue/src/my_network_func.ts index 5ff3c50..7580d99 100644 --- a/frontent/ops_vue/src/my_network_func.ts +++ b/frontent/ops_vue/src/my_network_func.ts @@ -1,14 +1,21 @@ import axios from 'axios' import { myfuncs } from './myfunc' +interface re_data { + statusCode: number + cookie?: string + error?: string + data?: JSON +} + export const my_network_func = { - post_json(path: string) { + post_json(path: string, json: JSON, callback: (i: re_data) => void) { const head_path = '/api/v1' const url = head_path + path const cookie = myfuncs.load('cookie') || '' const data = { - + data: json, cookie: cookie, } @@ -19,7 +26,12 @@ export const my_network_func = { }, }) .then((response) => { - console.log(response) + const re: re_data = { + statusCode: response.status, + data: response.data, + } + callback(re) + //console.log(response) }) .catch((error) => { console.error('There was an error!', error) diff --git a/frontent/ops_vue/src/views/HomeView.vue b/frontent/ops_vue/src/views/HomeView.vue index fb0c14c..471eaaf 100644 --- a/frontent/ops_vue/src/views/HomeView.vue +++ b/frontent/ops_vue/src/views/HomeView.vue @@ -1,7 +1,7 @@