add service detail page

This commit is contained in:
AceDataCloud committed 2022-12-29 20:28:52 +08:00
1 parent 7e38c8944a
commit 6aebeba477
9 files changed
+225 -31

No files matched your search

+5
View File
@@ -18,6 +18,11 @@
"init:cert": "npx mkcert create-cert --ca-key certs/data.local.zhishuyun.com.ca.key --ca-cert certs/data.local.zhishuyun.com.ca.crt --validity 36500 --key certs/data.local.zhishuyun.com.cert.key --cert certs/data.local.zhishuyun.com.cert.crt --domains data.local.zhishuyun.com"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-regular-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1",
"@fortawesome/vue-fontawesome": "^3.0.2",
"@types/uuid": "^8.3.4",
"axios": "^0.21.1",
"dayjs": "^1.10.7",
+4 -1
View File
@@ -1,3 +1,6 @@
export default {
learnMore: '了解更多'
learnMore: '了解更多',
apply: '立即申请',
introduction: '服务介绍',
apis: '接口说明'
};
+2 -1
View File
@@ -1,3 +1,4 @@
export default {
free: '免费'
free: '免费',
appliedCount: '申请次数'
};
+2
View File
@@ -7,6 +7,8 @@ import i18n from './i18n/index';
import './assets/css/tailwind.css';
import './assets/scss/style.scss';
import dayjs from './plugins/dayjs';
import './plugins/font-awesome';
const app = createApp(App);
app.use(router);
+2 -1
View File
@@ -4,8 +4,9 @@ export interface IService {
description?: string;
tags?: string[];
thumbnail?: string;
icon?: string;
price?: number;
applied_count: number;
appliedCount: number;
introduction: string;
createdAt?: string;
updatedAt?: string;
+160 -23
View File
@@ -1,55 +1,192 @@
<template>
<verification-alert />
<el-row v-if="service" class="preview">
<el-col :span="20" :offset="2">
<el-row>
<el-col :span="24">
<el-card shadow="hover">
<div class="body">
<div class="left">
<div class="icon">
<font-awesome-icon :icon="'fa-regular fa-' + service.icon" />
</div>
<div class="count">
<p>{{ $t('service.message.appliedCount') }}: {{ service.appliedCount }}</p>
</div>
</div>
<div class="right">
<div class="title">
{{ service.title }}
</div>
<div class="description">
{{ service.description }}
</div>
<div class="price">
<p v-if="service && service.price && service.price > 0" class="nonfree">
<span class="value">¥{{ service.price }}</span>
<span class="unit"> / {{ $t('service.unit.usage') }}</span>
</p>
<p v-else class="free">
{{ $t('service.message.free') }}
</p>
</div>
<div class="operations">
<el-button type="danger">
{{ $t('service.button.apply') }}
</el-button>
</div>
</div>
</div>
</el-card>
</el-col>
</el-row>
<el-row>
<el-col></el-col>
</el-row>
</el-col>
</el-row>
<el-row v-if="service" class="detail">
<el-col :span="20" :offset="2">
<el-card shadow="hover">
<el-tabs v-model="activeTab" class="demo-tabs">
<el-tab-pane :label="$t('service.button.introduction')" name="introduction">
<div class="introduction">
{{ service?.introduction }}
</div>
</el-tab-pane>
<el-tab-pane :label="$t('service.button.apis')" name="apis">Config</el-tab-pane>
</el-tabs>
</el-card>
</el-col>
</el-row>
</template>
<script lang="ts">
import { serviceOperator } from '@/operators';
import { IService, IServiceDetailResponse, serviceOperator } from '@/operators';
import { defineComponent } from 'vue';
import { Clock, MagicStick, Collection, VideoPlay, Goods, Lock } from '@element-plus/icons-vue';
import VerificationAlert from '@/components/common/VerificationAlert.vue';
import { v4 as uuidv4 } from 'uuid';
import { ElMessage } from 'element-plus';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface IData {
service: IService | undefined;
loading: boolean;
buying: boolean;
paid: boolean | undefined;
activeTab: string;
}
export default defineComponent({
name: 'ServiceDetail',
components: {
Clock,
Collection,
MagicStick,
VerificationAlert,
VideoPlay,
Goods,
Lock
FontAwesomeIcon
},
data(): IData {
return {
// service: undefined,
// order: undefined,
// episodes: [],
service: undefined,
order: undefined,
episodes: [],
loading: false,
buying: false,
paid: undefined
activeTab: 'introduction'
// buying: false,
// paid: undefined
};
},
computed: {
verified() {
return this.$store.getters.user.isVerified;
},
id() {
return parseInt(this.$route.params.id.toString());
}
},
async mounted() {
this.loading = true;
serviceOperator.get(this.id).then(({ data: data }: { data: IServiceDetailResponse }) => {
this.service = data;
console.log('this.service', this.service);
this.loading = false;
});
},
methods: {}
});
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.preview {
overflow: hidden;
$left-width: 320px;
$left-height: 290px;
margin: 15px 0;
.body {
display: flex;
.left {
float: left;
position: relative;
border: 1px solid #e8e8e8;
border-radius: 8px;
width: $left-width;
height: $left-height;
text-align: center;
box-sizing: border-box;
box-shadow: none;
padding-top: 50px;
.icon {
width: 150px;
height: 150px;
margin: 0 auto;
font-size: 80px;
}
.count {
color: #999;
}
}
.right {
position: relative;
padding: 15px;
float: left;
width: calc(100% - $left-width);
.title {
font-size: 18px;
color: #000;
line-height: 26px;
padding-right: 8px;
}
.description {
line-height: 22px;
color: #303030;
padding: 15px 0;
font-size: 14px;
}
.price {
margin: 0;
.nonfree {
.value {
font-weight: bold;
color: #ff5441;
font-size: 30px;
}
.unit {
color: #666;
}
}
.free {
color: #29c287;
}
}
.operations {
position: absolute;
left: 15px;
bottom: 10px;
}
}
}
}
.detail {
margin-bottom: 15px;
font-size: 14px;
.introduction {
padding: 10px 0;
color: #999;
font-weight: 400;
}
}
</style>
+3 -5
View File
@@ -5,7 +5,7 @@
<el-col v-for="(service, serviceIndex) in services" :key="serviceIndex" :md="6" :xs="24">
<el-card shadow="hover" class="service">
<div class="icon">
<el-icon> <user /> </el-icon>
<font-awesome-icon :icon="'fa-regular fa-' + service.icon" />
</div>
<div class="title">{{ service.title }}</div>
<div class="price">
@@ -38,7 +38,6 @@
</el-card>
</el-col>
</el-row>
<div class="services"></div>
</el-col>
</el-row>
</template>
@@ -46,7 +45,7 @@
<script lang="ts">
import { serviceOperator, IService, IServiceListResponse } from '@/operators';
import { defineComponent } from 'vue';
import { User, Picture } from '@element-plus/icons-vue';
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
interface IData {
services: IService[];
@@ -55,8 +54,7 @@ interface IData {
export default defineComponent({
name: 'ServiceList',
components: {
User,
Picture
FontAwesomeIcon
},
data(): IData {
return {
+9
View File
@@ -0,0 +1,9 @@
import { library } from '@fortawesome/fontawesome-svg-core';
import * as icons from '@fortawesome/free-regular-svg-icons';
// register all icons from font awesome
for (const key in icons) {
//@ts-ignore
const icon = icons[key];
if (icon?.iconName) library.add(icon);
}
+38
View File
@@ -87,6 +87,44 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"
"@fortawesome/fontawesome-common-types@6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.2.1.tgz#411e02a820744d3f7e0d8d9df9d82b471beaa073"
integrity sha512-Sz07mnQrTekFWLz5BMjOzHl/+NooTdW8F8kDQxjWwbpOJcnoSg4vUDng8d/WR1wOxM0O+CY9Zw0nR054riNYtQ==
"@fortawesome/fontawesome-svg-core@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.2.1.tgz#e87e905e444b5e7b715af09b64d27b53d4c8f9d9"
integrity sha512-HELwwbCz6C1XEcjzyT1Jugmz2NNklMrSPjZOWMlc+ZsHIVk+XOvOXLGGQtFBwSyqfJDNgRq4xBCwWOaZ/d9DEA==
dependencies:
"@fortawesome/fontawesome-common-types" "6.2.1"
"@fortawesome/free-brands-svg-icons@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-6.2.1.tgz#04a6d6f7898f7ef392aba7a65030a584d4f4c84f"
integrity sha512-L8l4MfdHPmZlJ72PvzdfwOwbwcCAL0vx48tJRnI6u1PJXh+j2f3yDoKyQgO3qjEsgD5Fr2tQV/cPP8F/k6aUig==
dependencies:
"@fortawesome/fontawesome-common-types" "6.2.1"
"@fortawesome/free-regular-svg-icons@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.2.1.tgz#650e56d937755a8341f2eef258ecb6f95458820f"
integrity sha512-wiqcNDNom75x+pe88FclpKz7aOSqS2lOivZeicMV5KRwOAeypxEYWAK/0v+7r+LrEY30+qzh8r2XDaEHvoLsMA==
dependencies:
"@fortawesome/fontawesome-common-types" "6.2.1"
"@fortawesome/free-solid-svg-icons@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.2.1.tgz#2290ea5adcf1537cbd0c43de6feb38af02141d27"
integrity sha512-oKuqrP5jbfEPJWTij4sM+/RvgX+RMFwx3QZCZcK9PrBDgxC35zuc7AOFsyMjMd/PIFPeB2JxyqDr5zs/DZFPPw==
dependencies:
"@fortawesome/fontawesome-common-types" "6.2.1"
"@fortawesome/vue-fontawesome@^3.0.2":
version "3.0.2"
resolved "https://registry.yarnpkg.com/@fortawesome/vue-fontawesome/-/vue-fontawesome-3.0.2.tgz#1b2ec546caab790c38d3dcb38407485a70703dd2"
integrity sha512-xHVtVY8ASUeEvgcA/7vULUesENhD+pi/EirRHdMBqooHlXBqK+yrV6d8tUye1m5UKQKVgYAHMhUBfOnoiwvc8Q==
"@humanwhocodes/config-array@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9"