diff --git a/package.json b/package.json index b6dd8342..9bd1e9a6 100644 --- a/package.json +++ b/package.json @@ -2,14 +2,11 @@ "name": "zhishuyun-data", "version": "0.1.0", "scripts": { - "start": "cross-env VITE_APP_ENV=$npm_config_env NODE_ENV=$npm_config_env vite --host", + "start": "cross-env NODE_ENV=$npm_config_env vite --host", "start:local": "npm run start --env=local", "start:test": "npm run start --env=test", "start:production": "npm run start --env=production", - "build": "cross-env VITE_APP_ENV=$npm_config_env NODE_ENV=$npm_config_env vue-tsc --noEmit --skipLibCheck && vite build", - "build:local": "npm run build --env=local", - "build:test": "npm run build --env=test", - "build:production": "npm run build --env=production", + "build": "vue-tsc --noEmit --skipLibCheck && vite build", "serve": "vite preview", "lint": "npx eslint src --fix --ext .ts,.tsx,.vue,.js,.jsx", "prettier": "npx prettier --write .", diff --git a/src/App.vue b/src/App.vue index c2742979..6cacc74d 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,6 +8,7 @@ import { defineComponent } from 'vue'; import { ElConfigProvider } from 'element-plus'; import zhCn from 'element-plus/dist/locale/zh-cn.mjs'; +import { registerIcons } from './plugins/font-awesome'; export default defineComponent({ components: { diff --git a/src/assets/templates/python.tpl b/src/assets/templates/python.tpl index 16dec3b6..34b36d26 100644 --- a/src/assets/templates/python.tpl +++ b/src/assets/templates/python.tpl @@ -14,5 +14,5 @@ payload = { {{/body}} } -response = requests.{{{method}}}}(url, json=payload, headers=headers) +response = requests.{{{method}}}(url, json=payload, headers=headers) print(response.text) \ No newline at end of file diff --git a/src/components/api/Code.vue b/src/components/api/Code.vue index 085a6823..8c8c215b 100644 --- a/src/components/api/Code.vue +++ b/src/components/api/Code.vue @@ -26,7 +26,7 @@ import javascript from 'programming-languages-logos/src/javascript/javascript.sv import python from 'programming-languages-logos/src/python/python.svg'; import java from 'programming-languages-logos/src/java/java.svg'; import php from 'programming-languages-logos/src/php/php.svg'; -import { IApi, IForm } from '@/operators/api/models'; +import { IApi, IForm, IRequest } from '@/operators/api/models'; import urlJoin from 'url-join'; import Mustache from 'mustache'; import pythonTemplate from '@/assets/templates/python.tpl'; @@ -53,6 +53,19 @@ interface IData { options: IOption[]; } +interface IRenderData { + headers: { + key: string; + value: string; + }[]; + body: { + key: string; + value: string | object | number | object[]; + }[]; + method: IRequest['method'] | Lowercase | Uppercase; + url: string; +} + export default defineComponent({ name: 'ApiCode', components: { @@ -140,8 +153,18 @@ export default defineComponent({ }, code(): string | undefined { let template = undefined; + let renderData: IRenderData = { + headers: this.headers, + body: this.body, + url: this.url, + method: this.method + }; if (this.lang === LANG_PYTHON) { template = pythonTemplate; + renderData = { + ...renderData, + method: renderData.method.toLowerCase() as Lowercase + }; } else if (this.lang === LANG_JAVASCRIPT) { template = javascriptTemplate; } else if (this.lang === LANG_PHP) { @@ -149,13 +172,7 @@ export default defineComponent({ } else if (this.lang === LANG_JAVA) { template = javaTemplate; } - if (template) - return Mustache.render(template, { - headers: this.headers, - body: this.body, - url: this.url, - method: this.method - }); + if (template) return Mustache.render(template, renderData); return undefined; } }, diff --git a/src/i18n/zh/service/message.ts b/src/i18n/zh/service/message.ts index c1d6aa7a..7623da12 100644 --- a/src/i18n/zh/service/message.ts +++ b/src/i18n/zh/service/message.ts @@ -1,6 +1,6 @@ export default { free: '免费', appliedCount: '申请次数', - indexTitle: '数据驱动未来', - indexSubtitle: '一个个标准化服务,助力科技和生活的方方面面。' + indexTitle: '方便易用的数字化解决方案', + indexSubtitle: '用一个个标准化服务,助力你的工作与生活的方方面面。' }; diff --git a/src/main.ts b/src/main.ts index be9af93d..4440990e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -7,8 +7,9 @@ import i18n from './i18n/index'; import './assets/scss/style.scss'; import './assets/css/tailwind.css'; import dayjs from './plugins/dayjs'; -import './plugins/font-awesome'; +// import './plugins/font-awesome'; +console.debug('start to create app'); const app = createApp(App); app.use(router); @@ -19,3 +20,4 @@ app.use(dayjs, { formatString: 'YYYY-MM-DD HH:mm:ss' }); app.mount('#app'); +console.debug('app mounted'); diff --git a/src/pages/console/application/List.vue b/src/pages/console/application/List.vue index 3135e620..5c71e6f6 100644 --- a/src/pages/console/application/List.vue +++ b/src/pages/console/application/List.vue @@ -12,8 +12,7 @@ - +