初始化
This commit is contained in:
64
pages/detail/components/LikeArticle.vue
Normal file
64
pages/detail/components/LikeArticle.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<el-affix class="lg:p-0 p-3" v-if="form" :offset="offset" @change="onAffix">
|
||||
<el-button type="text" color="gray">
|
||||
<div class="text-xl text-gray-600 ">你可能还喜欢</div>
|
||||
<el-icon class="el-icon--right text-gray-600" color="#999999">
|
||||
<ArrowRightBold/>
|
||||
</el-icon>
|
||||
</el-button>
|
||||
<template v-for="(item,index) in list" :key="index">
|
||||
<el-card shadow="hover" :body-style="{ padding: '0px' }" class="hover:bg-gray-50 cursor-pointer mt-3"
|
||||
@click="openSpmUrl(`/detail`,item,item.articleId,true)">
|
||||
<el-image :src="item.image" fit="fill" :lazy="true" class="w-full md:h-[150px] h-[199px] cursor-pointer"/>
|
||||
<div class="flex-1 px-4 py-5 sm:p-6 !p-4">
|
||||
<div class="text-gray-700 dark:text-white text-base font-semibold flex items-center gap-1.5">
|
||||
<span class="flex-1 text-xl cursor-pointer max-h-[57px] overflow-hidden">{{ item.title }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-1.5 py-2 text-gray-500">
|
||||
<el-avatar :src="item.avatar" :size="20"/>
|
||||
<span>{{ item.author }} · {{ dayjs(item.createTime).format('MM-DD hh:mm') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</template>
|
||||
</el-affix>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ArrowRightBold } from '@element-plus/icons-vue'
|
||||
import {getIdBySpm, openSpmUrl} from "~/utils/common";
|
||||
import dayjs from "dayjs";
|
||||
import type {Article} from "~/api/cms/article/model";
|
||||
import {useServerRequest} from "~/composables/useServerRequest";
|
||||
import type {ApiResult, PageResult} from "~/api";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
title?: string;
|
||||
form?: Article;
|
||||
}>(),
|
||||
{}
|
||||
);
|
||||
|
||||
const list = ref<Article[]>([]);
|
||||
const isAffix = ref<any>();
|
||||
const offset = ref(70)
|
||||
|
||||
const onAffix = (e: any) => {
|
||||
isAffix.value = e;
|
||||
}
|
||||
|
||||
const {data: response} = await useServerRequest<ApiResult<PageResult<Article>>>('/cms/cms-article/page', {
|
||||
params: {
|
||||
categoryId: getIdBySpm(4),
|
||||
limit: 3
|
||||
}
|
||||
})
|
||||
if (response.value?.data) {
|
||||
list.value = response.value.data.list;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
|
||||
</style>
|
||||
94
pages/detail/components/PageBanner.vue
Normal file
94
pages/detail/components/PageBanner.vue
Normal file
@@ -0,0 +1,94 @@
|
||||
<template>
|
||||
<div class="banner m-auto relative sm:flex">
|
||||
<svg viewBox="0 0 1440 181" fill="none" xmlns="http://www.w3.org/2000/svg"
|
||||
class="pointer-events-none absolute w-full top-[-2px] transition-all text-green-5 flex-shrink-0 opacity-100 duration-[400ms] opacity-80 -z-10">
|
||||
<mask id="path-1-inside-1_414_5526" fill="white">
|
||||
<path d="M0 0H1440V181H0V0Z"></path>
|
||||
</mask>
|
||||
<path d="M0 0H1440V181H0V0Z" fill="url(#paint0_linear_414_5526)" fill-opacity="0.22"></path>
|
||||
<path d="M0 2H1440V-2H0V2Z" fill="url(#paint1_linear_414_5526)" mask="url(#path-1-inside-1_414_5526)"></path>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_414_5526" x1="720" y1="0" x2="720" y2="181" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="currentColor"></stop>
|
||||
<stop offset="1" stop-color="currentColor" stop-opacity="0"></stop>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_414_5526" x1="0" y1="90.5" x2="1440" y2="90.5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="currentColor" stop-opacity="0"></stop>
|
||||
<stop offset="0.395" stop-color="currentColor"></stop>
|
||||
<stop offset="1" stop-color="currentColor" stop-opacity="0"></stop>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
<div class="md:w-screen-xl m-auto px-3">
|
||||
<Breadcrumb :data="form" />
|
||||
<div class="md:py-8 sm:py-16 md:px-0 px-4 py-8" _path="/templates" _dir="" _draft="false" _partial="false" _locale=""
|
||||
_id="content:4.templates.yml" _type="yaml" _source="content" _file="4.templates.yml" _stem="4.templates"
|
||||
_extension="yml">
|
||||
<div class="gap-8 sm:gap-y-16 lg:items-center" v-if="form">
|
||||
<div class="w-full">
|
||||
<h1
|
||||
class="text-2xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-3xl lg:text-4xl">
|
||||
<span v-if="form.title">{{ form.title }}</span>
|
||||
</h1>
|
||||
<el-space class="mt-4 text-gray-500 dark:text-gray-400">
|
||||
<el-avatar size="small" :src="form.logo" />
|
||||
<span class="cursor-pointer text-gray-500" @click="openSpmUrl(`/ask/${form.userId}`)">{{ form.tenantName }}</span> · {{ dayjs(form.createTime).format('YYYY-MM-DD hh:mm') }}
|
||||
</el-space>
|
||||
|
||||
<!-- <el-space class="mt-4">-->
|
||||
<!-- <el-button-->
|
||||
<!-- :icon="ElIconView"-->
|
||||
<!-- size="large"-->
|
||||
<!-- v-if="form.demoUrl"-->
|
||||
<!-- @click="openSpmUrl(form.demoUrl)"-->
|
||||
<!-- >-->
|
||||
<!-- 演示地址-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- v-if="form.buyUrl"-->
|
||||
<!-- :icon="ElIconBottom"-->
|
||||
<!-- size="large"-->
|
||||
<!-- @click="openSpmUrl(form.buyUrl)"-->
|
||||
<!-- >-->
|
||||
<!-- 下载模版-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- :icon="ElIconMemo"-->
|
||||
<!-- size="large"-->
|
||||
<!-- v-if="form.docUrl"-->
|
||||
<!-- @click="openSpmUrl(form.docUrl)"-->
|
||||
<!-- >-->
|
||||
<!-- 帮助文档-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </el-space>-->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {openSpmUrl} from "~/utils/common";
|
||||
import Breadcrumb from "~/components/Breadcrumb.vue";
|
||||
import type {Article} from "~/api/cms/article/model";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
title?: string;
|
||||
desc?: string;
|
||||
buyUrl?: string;
|
||||
form?: Article;
|
||||
}>(),
|
||||
{
|
||||
title: 'Templates',
|
||||
desc: 'Explore community templates to get up and running in a few seconds.',
|
||||
demoUrl: '/product/website',
|
||||
buyUrl: 'https://github.com/websoft9/ansible-templates'
|
||||
}
|
||||
);
|
||||
|
||||
</script>
|
||||
Reference in New Issue
Block a user