update style
This commit is contained in:
1 parent
6e4252232b
commit
277ef9a325
10 files changed
+105
-87
No files matched your search
+2
-5
@@ -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 .",
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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)
|
||||
@@ -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<IRequest['method']> | Uppercase<IRequest['method']>;
|
||||
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<IRenderData['method']>
|
||||
};
|
||||
} 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;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export default {
|
||||
free: '免费',
|
||||
appliedCount: '申请次数',
|
||||
indexTitle: '数据驱动未来',
|
||||
indexSubtitle: '一个个标准化服务,助力科技和生活的方方面面。'
|
||||
indexTitle: '方便易用的数字化解决方案',
|
||||
indexSubtitle: '用一个个标准化服务,助力你的工作与生活的方方面面。'
|
||||
};
|
||||
+3
-1
@@ -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');
|
||||
@@ -12,8 +12,7 @@
|
||||
<el-table v-loading="loading" :data="applications" stripe>
|
||||
<el-table-column :label="$t('application.field.service')" width="200px">
|
||||
<template #default="scope">
|
||||
<font-awesome-icon v-if="scope.row?.service?.icon" :icon="scope.row?.service?.icon" />
|
||||
<span style="margin-left: 10px">{{ scope.row.service?.title }}</span>
|
||||
<span>{{ scope.row.service?.title }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
@@ -28,7 +27,7 @@
|
||||
width="100px"
|
||||
class-name="text-center"
|
||||
/>
|
||||
<el-table-column :label="$t('application.field.apiKey')" class-name="api-key" width="320px">
|
||||
<el-table-column :label="$t('application.field.apiKey')" class-name="api-key" width="330px">
|
||||
<template #default="scope">
|
||||
<span class="key">{{ scope.row.api_key }}</span>
|
||||
<span class="copy">
|
||||
|
||||
+63
-52
@@ -33,39 +33,32 @@
|
||||
</el-row>
|
||||
<el-row v-else :gutter="15" class="services">
|
||||
<el-col v-for="(service, serviceIndex) in services" :key="serviceIndex" :lg="6" :md="8" :sm="12" :xs="24">
|
||||
<el-card shadow="hover" class="service">
|
||||
<div class="icon">
|
||||
<font-awesome-icon v-if="service.icon" :icon="service.icon" />
|
||||
</div>
|
||||
<div class="title">{{ service.title }}</div>
|
||||
<div class="price">
|
||||
<p v-if="service && service.price && service.price > 0" class="nonfree">
|
||||
¥{{ service.price }} / {{ $t('service.unit.usage') }}
|
||||
</p>
|
||||
<p v-else class="free">
|
||||
{{ $t('service.message.free') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="introduction">
|
||||
<p>
|
||||
{{ service.introduction }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="operations">
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'service-detail',
|
||||
params: {
|
||||
id: service.id
|
||||
}
|
||||
}"
|
||||
>
|
||||
<el-button type="danger">
|
||||
{{ $t('service.button.learnMore') }}
|
||||
</el-button>
|
||||
</router-link>
|
||||
</div>
|
||||
</el-card>
|
||||
<router-link
|
||||
:to="{
|
||||
name: 'service-detail',
|
||||
params: {
|
||||
id: service.id
|
||||
}
|
||||
}"
|
||||
>
|
||||
<el-card shadow="hover" class="service" :body-style="{ padding: 0 }">
|
||||
<el-image class="thumb" :src="service?.thumbnail" />
|
||||
<div class="title">{{ service.title }}</div>
|
||||
<div class="price">
|
||||
<p v-if="service && service.price && service.price > 0" class="nonfree">
|
||||
¥{{ service.price }} / {{ $t('service.unit.usage') }}
|
||||
</p>
|
||||
<p v-else class="free">
|
||||
{{ $t('service.message.free') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="description">
|
||||
<p>
|
||||
{{ service.description }}
|
||||
</p>
|
||||
</div>
|
||||
</el-card>
|
||||
</router-link>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
@@ -149,6 +142,7 @@ export default defineComponent({
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.banner {
|
||||
// display: none;
|
||||
height: calc(100vh - 60px);
|
||||
background-color: #111827;
|
||||
width: 100%;
|
||||
@@ -221,11 +215,11 @@ $transition-duration: 0.5s;
|
||||
.services {
|
||||
padding: 50px 0;
|
||||
.service {
|
||||
$hover-offset: 50px;
|
||||
width: 100%;
|
||||
height: 280px;
|
||||
height: 250px;
|
||||
margin-bottom: 15px;
|
||||
border-radius: 30px !important;
|
||||
margin: 10px auto;
|
||||
padding: 30px 0;
|
||||
position: relative;
|
||||
transition: all $transition-duration;
|
||||
|
||||
@@ -256,17 +250,32 @@ $transition-duration: 0.5s;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.thumb {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
height: 150px;
|
||||
top: 0px;
|
||||
opacity: 1;
|
||||
transition: all $transition-duration;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: #666;
|
||||
font-size: 14px;
|
||||
font-size: 16px;
|
||||
text-align: center;
|
||||
margin: 0;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 8px;
|
||||
padding: 0 20px;
|
||||
font-weight: bold;
|
||||
transition: all $transition-duration;
|
||||
position: relative;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.price {
|
||||
position: relative;
|
||||
top: 0;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
@@ -277,10 +286,11 @@ $transition-duration: 0.5s;
|
||||
.free {
|
||||
color: #29c287;
|
||||
}
|
||||
transition: all $transition-duration;
|
||||
}
|
||||
|
||||
.introduction {
|
||||
padding: 5px 0;
|
||||
.description {
|
||||
padding: 5px 15px;
|
||||
text-align: center;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
@@ -291,25 +301,26 @@ $transition-duration: 0.5s;
|
||||
color: #9f9f9f;
|
||||
font-size: 12px;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
word-break: break-all;
|
||||
transition: all $transition-duration;
|
||||
text-overflow: ellipsis;
|
||||
height: 42px;
|
||||
}
|
||||
|
||||
.operations {
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
text-align: center;
|
||||
transition: all $transition-duration;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
padding-top: 0;
|
||||
.introduction {
|
||||
.thumb {
|
||||
top: -$hover-offset;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.title {
|
||||
top: -$hover-offset;
|
||||
}
|
||||
.price {
|
||||
top: -$hover-offset;
|
||||
}
|
||||
.description {
|
||||
opacity: 1;
|
||||
}
|
||||
.operations {
|
||||
|
||||
@@ -1,16 +1,7 @@
|
||||
import { library } from '@fortawesome/fontawesome-svg-core';
|
||||
import * as iconsRegular from '@fortawesome/free-regular-svg-icons';
|
||||
import * as iconsSolid from '@fortawesome/free-solid-svg-icons';
|
||||
import { faCopy } from '@fortawesome/free-regular-svg-icons';
|
||||
import { faRotateRight, faCheck } from '@fortawesome/free-solid-svg-icons';
|
||||
|
||||
// register all icons from font awesome
|
||||
for (const key in iconsRegular) {
|
||||
//@ts-ignore
|
||||
const icon = iconsRegular[key];
|
||||
if (icon?.iconName) library.add(icon);
|
||||
}
|
||||
|
||||
for (const key in iconsSolid) {
|
||||
//@ts-ignore
|
||||
const icon = iconsSolid[key];
|
||||
if (icon?.iconName) library.add(icon);
|
||||
}
|
||||
library.add(faCopy);
|
||||
library.add(faRotateRight);
|
||||
library.add(faCheck);
|
||||
+1
-1
@@ -71,7 +71,7 @@ export default defineConfig({
|
||||
}
|
||||
},
|
||||
build: {
|
||||
sourcemap: process.env.NODE_ENV !== 'production',
|
||||
sourcemap: false,
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks(id) {
|
||||
|
||||
Reference in new issue
Block a user