This commit is contained in:
oneao committed 2025-12-11 22:26:28 +08:00
1 parent 57c0d98f11
commit 861b529d9b
19 files changed
+742 -66

No files matched your search

+7 -4
View File
@@ -2,9 +2,9 @@
import { onMounted } from 'vue'
import { getAreaListApi } from './request/api/area'
import { getPropertyListApi } from './request/api/peoperty'
import { useCommonOptions } from './store/commonOptions'
import { useCommonStore } from './store/common'
const commonOptions = useCommonOptions()
const commonOptions = useCommonStore()
onMounted(() => {
handleInitData()
@@ -12,10 +12,13 @@ onMounted(() => {
function handleInitData() {
getAreaListApi().then((res) => {
commonOptions.areaOptions.splice(0, commonOptions.areaOptions.length, ...res.data)
commonOptions.areaOptions.splice(0, commonOptions.areaOptions.length, ...res.data || [])
})
getPropertyListApi().then((res) => {
commonOptions.propertyOptions.splice(0, commonOptions.propertyOptions.length, ...res.data)
commonOptions.propertyOptions.splice(0, commonOptions.propertyOptions.length, ...res.data || [])
}).catch((err) => {
console.log(err)
})
}
</script>
@@ -1,8 +1,13 @@
<script lang="ts" setup>
import type { PropType } from 'vue'
import type { Area, CompanyQuery, Property } from '@/types/company/index'
import { computed } from 'vue'
const props = defineProps({
modelValue: {
type: Object as PropType<CompanyQuery>,
required: true,
},
properties: {
type: Object as PropType<Property[]>,
required: false,
@@ -13,11 +18,14 @@ const props = defineProps({
},
})
const query: CompanyQuery = {
areas: [],
properties: [],
name: '',
}
const emit = defineEmits(['update:modelValue'])
const query = computed({
get: () => props.modelValue,
set: (val: CompanyQuery) => {
emit('update:modelValue', val)
},
})
</script>
<template>
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { useRoute } from 'vue-router'
import { useRoute, useRouter } from 'vue-router'
const props = defineProps({
isLogined: {
@@ -9,6 +9,7 @@ const props = defineProps({
})
const route = useRoute()
const router = useRouter()
const menuList = [
{ name: '首页', path: '/' },
@@ -17,6 +18,10 @@ const menuList = [
{ name: '关于我们', path: '/companies' },
{ name: '联系我们', path: '/forum' },
]
function navigateTo(path: string) {
router.push(path)
}
</script>
<template>
@@ -60,7 +65,11 @@ const menuList = [
</template>
<template v-else>
<el-button type="primary" round>
<el-button
type="primary"
round
@click="navigateTo('/auth/login')"
>
登录
</el-button>
</template>
@@ -62,6 +62,7 @@ axiosInstance.interceptors.request.use(
return config
},
(error: AxiosError) => {
console.log("===ReqError===");
return Promise.reject(error)
},
)
@@ -89,7 +90,9 @@ axiosInstance.interceptors.response.use(
}
},
(error: AxiosError) => {
console.log(error)
console.log("===ResError===");
return Promise.reject(error)
},
)
@@ -16,6 +16,31 @@ const router = createRouter({
},
],
},
{
path: '/auth/login',
name: 'Login',
component: () => import('@/views/auth/login.vue'),
},
{
path: '/auth/register',
name: 'Register',
component: () => import('@/views/auth/register.vue'),
},
{
path: '/auth/forget',
name: 'Forget',
component: () => import('@/views/auth/forget.vue'),
},
{
path: '/error/500',
name: 'Error',
component: () => import('@/views/error/500.vue'),
},
{
path: '/:pathMatch(.*)*',
name: 'NotFound',
component: () => import('@/views/error/404.vue'),
},
],
scrollBehavior: () => ({ left: 0, top: 0 }),
})
@@ -0,0 +1,22 @@
import type { Area, CompanyQuery, Property } from '@/types/company/index'
import { defineStore } from 'pinia'
import { reactive, ref } from 'vue'
export const useCommonStore = defineStore(
'common',
() => {
const areaOptions = reactive<Area[]>([])
const propertyOptions = reactive<Property[]>([])
const companyQuery = ref<CompanyQuery>({
properties: [],
areas: [],
name: '',
})
return {
areaOptions,
propertyOptions,
companyQuery,
}
},
)
@@ -1,13 +0,0 @@
import type { Area } from '@/types/company/area'
import type { Property } from '@/types/company/peoperty'
import { reactive } from 'vue'
const areaOptions = reactive<Area[]>([])
const propertyOptions = reactive<Property[]>([])
export function useCommonOptions() {
return {
areaOptions,
propertyOptions,
}
}
@@ -0,0 +1,179 @@
<script lang="ts" setup>
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
function navigateTo(path: string) {
router.push(path)
}
// do not use same name with ref
const form = reactive({
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
})
function onSubmit() {
console.log('submit!')
}
</script>
<template>
<div class="auth-wrapper">
<div class="auth-bg">
<img src="/auth-bg.jpg">
<div class="bg-content">
<el-carousel
height="150px"
indicator-position="none"
>
<el-carousel-item v-for="item in 4" :key="item">
<h3 class="small justify-center" text="2xl">
{{ item }}
</h3>
</el-carousel-item>
</el-carousel>
</div>
</div>
<div class="login-form">
<img src="/logo.png" class="logo" @click="navigateTo('/')">
<div class="main">
<h4 class="title">
重置密码
</h4>
<p class="title-extra">
请输入您的电子邮箱地址,我们将向您发送一封包含密码重置说明的邮件。
</p>
<el-form
:model="form"
label-width="auto"
label-position="top"
>
<el-form-item label="邮箱">
<el-input v-model="form.name" placeholder="请输入邮箱" size="large" />
</el-form-item>
<el-form-item>
<el-button type="primary" class="form-btn">
找回密码
</el-button>
</el-form-item>
</el-form>
</div>
<div class="footer">
返回
<span class="back" @click="navigateTo('/auth/login')">登录</span>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.auth-wrapper {
display: flex;
height: 100vh;
overflow: hidden;
.auth-bg {
width: 70%;
height: 100%;
position: relative;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
.bg-content {
position: absolute;
left: 50%;
bottom: 12%;
transform: translateX(-50%);
text-align: center;
color: #fff;
width: 600px;
}
}
.form-label-flex {
display: flex;
justify-content: space-between;
width: 100%;
align-items: center;
.forgot {
color: #0f6fec;
cursor: pointer;
}
}
.login-form {
flex: 1;
display: flex;
flex-direction: column;
padding: 48px 56px 24px 56px;
.logo {
height: 70px;
width: 160px;
cursor: pointer;
margin-bottom: 48px;
}
.main {
flex: 1;
display: flex;
justify-content: center;
flex-direction: column;
:deep(.el-form-item__label) {
font-size: 16px;
width: 100%;
margin-bottom: 12px;
}
.title {
font-size: 28px;
font-weight: 600;
margin-bottom: 10px;
}
.title-extra {
font-size: 16px;
color: #666;
margin-bottom: 36px;
}
.form-btn {
width: 100%;
height: 36px;
font-size: 16px;
margin-top: 16px;
}
}
.footer {
font-size: 18px;
color: #999;
height: 48px;
text-align: center;
line-height: 48px;
.back {
color: #0f6fec;
cursor: pointer;
}
}
}
}
</style>
@@ -0,0 +1,177 @@
<script lang="ts" setup>
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
function navigateTo(path: string) {
router.push(path)
}
// do not use same name with ref
const form = reactive({
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
})
function onSubmit() {
console.log('submit!')
}
</script>
<template>
<div class="auth-wrapper">
<div class="auth-bg">
<img src="/auth-bg.jpg">
</div>
<div class="login-form">
<img src="/logo.png" class="logo" @click="navigateTo('/')">
<div class="main">
<h4 class="title">
登录
</h4>
<p class="title-extra">
输入你的 邮箱/账号 和 密码 登录账户.
</p>
<el-form
:model="form"
label-width="auto"
label-position="top"
>
<el-form-item label="邮箱 / 账号">
<el-input v-model="form.name" placeholder="请输入邮箱 / 账号" size="large" />
</el-form-item>
<el-form-item>
<template #label>
<div class="form-label-flex">
<span>密码</span>
<span class="forgot" @click="navigateTo('/auth/forget')">忘记密码?</span>
</div>
</template>
<el-input v-model="form.name" placeholder="请输入密码" size="large" />
</el-form-item>
<el-form-item>
<el-checkbox label="记住我" class="remeber" />
</el-form-item>
<el-form-item>
<el-button type="primary" class="form-btn">
登录
</el-button>
</el-form-item>
</el-form>
</div>
<div class="footer">
没有账号?前去
<span class="back" @click="navigateTo('/auth/register')">注册</span>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.auth-wrapper {
display: flex;
height: 100vh;
overflow: hidden;
.auth-bg {
width: 70%;
height: 100%;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.form-label-flex {
display: flex;
justify-content: space-between;
width: 100%;
align-items: center;
.forgot {
color: #0f6fec;
cursor: pointer;
}
}
.login-form {
flex: 1;
display: flex;
flex-direction: column;
padding: 48px 56px 24px 56px;
.logo {
height: 70px;
width: 160px;
cursor: pointer;
margin-bottom: 48px;
}
.main {
flex: 1;
display: flex;
justify-content: center;
flex-direction: column;
:deep(.el-form-item__label) {
font-size: 16px;
width: 100%;
margin-bottom: 12px;
}
.remeber {
:deep(.el-checkbox__inner) {
width: 16px;
height: 16px;
}
:deep(.el-checkbox__label) {
font-size: 16px;
}
}
.title {
font-size: 28px;
font-weight: 600;
margin-bottom: 10px;
}
.title-extra {
font-size: 16px;
color: #666;
margin-bottom: 36px;
}
.form-btn {
width: 100%;
height: 36px;
font-size: 16px;
}
}
.footer {
font-size: 18px;
color: #999;
height: 48px;
text-align: center;
line-height: 48px;
.back {
color: #0f6fec;
cursor: pointer;
}
}
}
}
</style>
@@ -0,0 +1,165 @@
<script lang="ts" setup>
import { reactive } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
function navigateTo(path: string) {
router.push(path)
}
// do not use same name with ref
const form = reactive({
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
})
function onSubmit() {
console.log('submit!')
}
</script>
<template>
<div class="auth-wrapper">
<div class="auth-bg">
<img src="/auth-bg.jpg">
</div>
<div class="login-form">
<img src="/logo.png" class="logo" @click="navigateTo('/')">
<div class="main">
<h4 class="title">
注册
</h4>
<p class="title-extra">
请填写必要的注册信息,完成账户创建。
</p>
<el-form
:model="form"
label-width="auto"
label-position="top"
>
<el-form-item label="邮箱">
<el-input v-model="form.name" placeholder="请输入邮箱" size="large" />
</el-form-item>
<el-form-item label="账号">
<el-input v-model="form.name" placeholder="请输入账号" size="large" />
</el-form-item>
<el-form-item label="公司名称">
<el-input v-model="form.name" placeholder="请输入公司名称" size="large" />
</el-form-item>
<el-form-item label="密码">
<el-input v-model="form.name" placeholder="请输入密码" size="large" />
</el-form-item>
<el-form-item>
<el-button type="primary" class="form-btn">
注册
</el-button>
</el-form-item>
</el-form>
</div>
<div class="footer">
没有账号?前去
<span class="back" @click="navigateTo('/auth/login')">登录</span>
</div>
</div>
</div>
</template>
<style lang="scss" scoped>
.auth-wrapper {
display: flex;
height: 100vh;
overflow: hidden;
.auth-bg {
width: 70%;
height: 100%;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.form-label-flex {
display: flex;
justify-content: space-between;
width: 100%;
align-items: center;
.forgot {
color: #0f6fec;
cursor: pointer;
}
}
.login-form {
flex: 1;
display: flex;
flex-direction: column;
padding: 48px 56px 24px 56px;
.logo {
height: 70px;
width: 160px;
cursor: pointer;
margin-bottom: 48px;
}
.main {
flex: 1;
display: flex;
justify-content: center;
flex-direction: column;
:deep(.el-form-item__label) {
font-size: 16px;
width: 100%;
margin-bottom: 12px;
}
.title {
font-size: 28px;
font-weight: 600;
margin-bottom: 10px;
}
.title-extra {
font-size: 16px;
color: #666;
margin-bottom: 36px;
}
.form-btn {
width: 100%;
height: 36px;
font-size: 16px;
margin-top: 16px;
}
}
.footer {
font-size: 18px;
color: #999;
height: 48px;
text-align: center;
line-height: 48px;
.back {
color: #0f6fec;
cursor: pointer;
}
}
}
}
</style>
@@ -0,0 +1,65 @@
<script lang="ts" setup>
import { useRouter } from 'vue-router'
const router = useRouter()
function toHome() {
router.push('/')
}
</script>
<template>
<div class="error-wrapper">
<img src="/404.svg" class="illustration">
<h1>404</h1>
<h4>您访问的页面不存在</h4>
<p>可能是输入的地址有误,或者页面已经被移除。</p>
<el-button size="large" type="primary" @click="toHome">
返回首页
</el-button>
</div>
</template>
<style lang="scss" scoped>
.error-wrapper {
height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 20px;
text-align: center;
.illustration {
width: 60%;
max-width: 520px;
margin-bottom: 32px;
}
h1 {
font-size: 100px;
color: #3b82f6;
font-weight: 600;
margin-bottom: 12px;
}
h4 {
font-size: 26px;
color: #3b82f6;
font-weight: 500;
margin-bottom: 8px;
}
p {
font-size: 16px;
color: #374151;
margin-bottom: 28px;
max-width: 480px;
}
}
</style>
@@ -0,0 +1,65 @@
<script lang="ts" setup>
import { useRouter } from 'vue-router'
const router = useRouter()
function toHome() {
router.push('/')
}
</script>
<template>
<div class="error-wrapper">
<img src="/500.svg" class="illustration">
<h1>500</h1>
<h4>抱歉,服务器出了一点问题</h4>
<p>
我们的团队已经收到该问题的报告。请稍后重试。
</p>
<el-button size="large" type="primary" @click="toHome">
返回首页
</el-button>
</div>
</template>
<style lang="scss" scoped>
.error-wrapper {
height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 0 20px;
text-align: center;
.illustration {
width: 60%;
max-width: 520px;
margin-bottom: 32px;
}
h1 {
font-size: 100px;
color: #3b82f6;
font-weight: 600;
margin-bottom: 12px;
}
h4 {
font-size: 26px;
color: #3b82f6;
font-weight: 500;
margin-bottom: 8px;
}
p {
font-size: 16px;
color: #374151;
margin-bottom: 28px;
max-width: 480px;
}
}
</style>
@@ -1,9 +1,9 @@
<script lang="ts" setup>
import QueryCompany from '@/components/QueryCompany.vue'
import { useCommonOptions } from '@/store/commonOptions'
import { useCommonStore } from '@/store/common'
import Recommend from './components/recommend.vue'
const commonOptions = useCommonOptions()
const commonStore = useCommonStore()
const carouselList = [
{ img: '/ship-8263464_1920.jpg', href: '' },
@@ -28,7 +28,7 @@ const carouselList = [
</div>
<div class="query">
<QueryCompany :properties="commonOptions.propertyOptions" :areas="commonOptions.areaOptions" />
<QueryCompany v-model="commonStore.companyQuery" :properties="commonStore.propertyOptions" :areas="commonStore.areaOptions" />
</div>
</div>