初始化
This commit is contained in:
225
components/UserCard.vue
Normal file
225
components/UserCard.vue
Normal file
@@ -0,0 +1,225 @@
|
||||
<template>
|
||||
<div :class="form?.style" 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 xl:p-0 px-4">
|
||||
<div class="py-8 sm:py-16" _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 grid lg:grid-cols-2 lg:items-center">
|
||||
<el-space class="flex">
|
||||
<div class="mr-4" v-if="company.companyLogo">
|
||||
<el-avatar :src="company.companyLogo" :size="150"></el-avatar>
|
||||
</div>
|
||||
<div class="title-bar">
|
||||
<h1 class="text-3xl font-bold tracking-tight text-gray-900 dark:text-white sm:text-4xl lg:text-5xl">
|
||||
<span>{{ company.shortName }}</span>
|
||||
</h1>
|
||||
<div class="mt-4 text-lg text-gray-500 dark:text-gray-400">
|
||||
{{ company?.comments || desc }}
|
||||
</div>
|
||||
<el-space class="mt-4">
|
||||
<el-button
|
||||
:icon="ElIconPlus"
|
||||
@click="openSpmUrl(`http://git.gxwebsoft.com/gxwebsoft/websoft-cms.git`, {},0,true)"
|
||||
>
|
||||
关注
|
||||
</el-button>
|
||||
<!-- <el-tree-select-->
|
||||
<!-- v-model="where.categoryId"-->
|
||||
<!-- v-if="navigation?.length > 0"-->
|
||||
<!-- :data="navigation"-->
|
||||
<!-- placeholder="选择分类"-->
|
||||
<!-- :render-after-expand="false"-->
|
||||
<!-- style="width: 240px"-->
|
||||
<!-- />-->
|
||||
<div class="w-[300px]">
|
||||
<el-input
|
||||
v-model="where.keywords"
|
||||
placeholder="搜索"
|
||||
:prefix-icon="Search"
|
||||
@keydown.enter="reload"
|
||||
>
|
||||
<template #append>
|
||||
<el-button type="primary" @click="reload">搜索</el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
</el-space>
|
||||
</div>
|
||||
</el-space>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 密码可见 -->
|
||||
<el-dialog
|
||||
v-model="dialogVisible"
|
||||
title="请输入查看密码"
|
||||
:show-close="false"
|
||||
:close-on-click-modal="false"
|
||||
width="400"
|
||||
>
|
||||
<el-input type="password" v-model="password2" show-password placeholder="请输入查看密码">请输入查看密码</el-input>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button type="primary" @click="checkPassword">
|
||||
确定
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<!-- <el-space class="mt-4">-->
|
||||
<!-- <el-button-->
|
||||
<!-- :icon="ElIconBottom"-->
|
||||
<!-- @click="openSpmUrl(`http://git.gxwebsoft.com/gxwebsoft/websoft-cms.git`, {},0,true)"-->
|
||||
<!-- >-->
|
||||
<!-- 关注-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button-->
|
||||
<!-- :icon="ElIconMemo"-->
|
||||
<!-- @click="openSpmUrl(`/docs`)"-->
|
||||
<!-- >-->
|
||||
<!-- 选择分类-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <div class="w-[500px]">-->
|
||||
<!-- <el-input-->
|
||||
<!-- v-model="where.keywords"-->
|
||||
<!-- placeholder="搜索"-->
|
||||
<!-- :prefix-icon="Search"-->
|
||||
<!-- @keydown.enter="reload"-->
|
||||
<!-- >-->
|
||||
<!-- <template #append>-->
|
||||
<!-- <el-button type="primary" @click="reload">搜索</el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-input>-->
|
||||
<!-- </div>-->
|
||||
<!-- </el-space>-->
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {Search} from '@element-plus/icons-vue'
|
||||
import {openSpmUrl} from "~/utils/common";
|
||||
import {useServerRequest} from "~/composables/useServerRequest";
|
||||
import type {ApiResult} from "~/api";
|
||||
import type {Navigation} from "~/api/cms/navigation/model";
|
||||
import {ref} from 'vue'
|
||||
import type {CompanyParam} from "~/api/system/company/model";
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
form?: any;
|
||||
layout?: any;
|
||||
title?: string;
|
||||
desc?: string;
|
||||
buyUrl?: string;
|
||||
avatar?: string;
|
||||
}>(),
|
||||
{
|
||||
title: 'PageName',
|
||||
desc: 'Description',
|
||||
demoUrl: '/product',
|
||||
buyUrl: '/buy'
|
||||
}
|
||||
);
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'done', show: boolean): void;
|
||||
}>();
|
||||
|
||||
const route = useRoute();
|
||||
const token = useToken();
|
||||
const form = ref<Navigation>();
|
||||
const layout = ref<any>();
|
||||
const password2 = ref('');
|
||||
// 密码弹窗
|
||||
const dialogVisible = ref(false)
|
||||
const company = useCompany();
|
||||
const navigation = ref<Navigation[]>()
|
||||
|
||||
// 搜索表单
|
||||
const where = reactive<CompanyParam>({
|
||||
keywords: ''
|
||||
});
|
||||
|
||||
// 验证密码
|
||||
const checkPassword = async () => {
|
||||
const {data: response} = await useServerRequest<ApiResult<unknown>>('/cms/cms-navigation/checkNavigationPassword', {
|
||||
query: {
|
||||
password: form.value?.password,
|
||||
password2: password2.value
|
||||
}
|
||||
})
|
||||
if (response.value?.code === 0) {
|
||||
dialogVisible.value = false;
|
||||
emit('done', true);
|
||||
console.log(response.value.message);
|
||||
} else {
|
||||
ElMessage.error(response.value?.message);
|
||||
}
|
||||
}
|
||||
|
||||
const reload = async () => {
|
||||
useClientRequest<ApiResult<Navigation[]>>('/cms/cms-navigation', {
|
||||
params: {
|
||||
userId: route.params.userId
|
||||
}
|
||||
}).then(res => {
|
||||
navigation.value = res?.data?.map(d => {
|
||||
return {
|
||||
label: d.title,
|
||||
value: d.navigationId,
|
||||
children: null
|
||||
}
|
||||
});
|
||||
console.log(navigation.value)
|
||||
})
|
||||
// 校验密码
|
||||
const {data: nav} = await useServerRequest<ApiResult<Navigation>>('/cms/cms-navigation/getNavigationByPath', {
|
||||
query: {
|
||||
path: route.path
|
||||
}
|
||||
})
|
||||
if (nav.value?.data) {
|
||||
form.value = nav.value?.data;
|
||||
console.log('PageBanner.vue => ', form.value)
|
||||
// 页面布局
|
||||
if (form.value?.layout) {
|
||||
layout.value = JSON.parse(form.value?.layout)
|
||||
}
|
||||
// 允许直接访问
|
||||
if (form.value?.permission === 0) {
|
||||
emit('done', true);
|
||||
}
|
||||
// 要求登录可见
|
||||
if (form.value?.permission === 1) {
|
||||
navigateTo(`/passport/login`);
|
||||
if (token && token.value.length > 0) {
|
||||
emit('done', true);
|
||||
}
|
||||
}
|
||||
// 要求密码可见
|
||||
if (form.value?.permission === 2) {
|
||||
dialogVisible.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
reload();
|
||||
</script>
|
||||
Reference in New Issue
Block a user