|
|
|
@ -78,7 +78,7 @@ import axios from "axios"; |
|
|
|
// import "highlight.js/styles/atelier-plateau-light.css"; |
|
|
|
|
|
|
|
const cli = axios.create({ |
|
|
|
baseURL: "http://json.cobb.wang/", |
|
|
|
baseURL: "https://json.cobb.wang/", |
|
|
|
timeout: 1000, |
|
|
|
headers: { "content-type": "application/json" }, |
|
|
|
}); |
|
|
|
@ -182,6 +182,8 @@ export default { |
|
|
|
this.output["model"] = this.handleModelOutput(v); |
|
|
|
this.output["service"] = this.handleServiceOutput(v); |
|
|
|
this.output["api"] = this.handleApiOutput(v); |
|
|
|
this.output["route"] = this.handleRouteOutput(v); |
|
|
|
this.output["js-api"] = this.handleJsApi(v); |
|
|
|
this.renderKey++; |
|
|
|
this.activeName = ""; |
|
|
|
this.dialogVisible = true; |
|
|
|
@ -207,9 +209,72 @@ export default { |
|
|
|
this.output["model"] = this.handleModelOutput(v); |
|
|
|
this.output["service"] = this.handleServiceOutput(v); |
|
|
|
this.output["api"] = this.handleApiOutput(v); |
|
|
|
console.log("output", this.output); |
|
|
|
this.output["route"] = this.handleRouteOutput(v); |
|
|
|
this.output["js-api"] = this.handleJsApi(v); |
|
|
|
this.schemaKey = Date.now(); |
|
|
|
}, |
|
|
|
handleRouteOutput(v) { |
|
|
|
const tableName = toCamelCase(v.title); |
|
|
|
const lowTableName = v.title; |
|
|
|
const Output = ` |
|
|
|
{ |
|
|
|
${lowTableName} := admin.Group("${lowTableName}") |
|
|
|
${lowTableName}.POST("list", a.${tableName}.List${tableName}) |
|
|
|
${lowTableName}.POST("create", a.${tableName}.Create${tableName}) |
|
|
|
${lowTableName}.POST("detail", a.${tableName}.Get${tableName}One) |
|
|
|
${lowTableName}.POST("del", a.${tableName}.Delete${tableName}) |
|
|
|
} |
|
|
|
`; |
|
|
|
return Output; |
|
|
|
}, |
|
|
|
handleJsApi(v) { |
|
|
|
const tableName = toCamelCase(v.title); |
|
|
|
const lowTableName = v.title; |
|
|
|
const Output = ` |
|
|
|
import request from '@/utils/request'; |
|
|
|
export function get${tableName}(data) { |
|
|
|
return request({ |
|
|
|
url: '/api/admin/${lowTableName}/detail', |
|
|
|
method: 'post', |
|
|
|
data: data |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
export function list${tableName}(data) { |
|
|
|
return request({ |
|
|
|
url: '/api/admin/${lowTableName}/list', |
|
|
|
method: 'post', |
|
|
|
data: data |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
export function list${tableName}Export(data) { |
|
|
|
return request({ |
|
|
|
url: '/api/admin/${lowTableName}/list', |
|
|
|
method: 'post', |
|
|
|
data: data, |
|
|
|
responseType: 'blob' |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
export function create${tableName}(data) { |
|
|
|
return request({ |
|
|
|
url: '/api/admin/${lowTableName}/create', |
|
|
|
method: 'post', |
|
|
|
data: data |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
export function del${tableName}(data) { |
|
|
|
return request({ |
|
|
|
url: '/api/admin/${lowTableName}/del', |
|
|
|
method: 'post', |
|
|
|
data: data |
|
|
|
}) |
|
|
|
} |
|
|
|
`; |
|
|
|
return Output; |
|
|
|
}, |
|
|
|
handleApiOutput(v) { |
|
|
|
const tableName = toCamelCase(v.title); |
|
|
|
const apiOutput = ` |
|
|
|
|