u
This commit is contained in:
1 parent
68e0785ec6
commit
57c0d98f11
189 files changed
+34329
No files matched your search
@@ -0,0 +1,12 @@
|
||||
VITE_BASE_URL=/
|
||||
|
||||
VITE_APP_TITLE=Link56
|
||||
|
||||
# 上传地址
|
||||
VITE_UPLOAD_BASEURL = ''
|
||||
# VITE_UPLOAD_BASEURL = 'https://g3soft.oss-cn-beijing.aliyuncs.com'
|
||||
|
||||
# 是否开启代理 Y 开启 N 不开启
|
||||
VITE_APP_PROXY= 'Y'
|
||||
# 代理地址
|
||||
VITE_APP_PROXY_PREFIX = '/api'
|
||||
@@ -0,0 +1,6 @@
|
||||
VITE_SERVER_BASEURL = 'http://link56.net:80'
|
||||
VITE_WEBSOCKET_BASEURL = 'ws://link56.net:8080/websocket'
|
||||
|
||||
# VITE_SERVER_BASEURL = 'http://121.237.182.108:80'
|
||||
# VITE_WEBSOCKET_BASEURL = 'ws://121.237.182.108:8080/websocket'
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
VITE_SERVER_BASEURL = 'http://127.0.0.1:8083'
|
||||
VITE_WEBSOCKET_BASEURL = 'ws://127.0.0.1:8083/websocket'
|
||||
@@ -0,0 +1,23 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["Vue.volar"]
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
{
|
||||
// Disable the default formatter, use eslint instead
|
||||
"prettier.enable": false,
|
||||
"editor.formatOnSave": false,
|
||||
|
||||
// Auto fix
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.eslint": "explicit",
|
||||
"source.organizeImports": "never"
|
||||
},
|
||||
|
||||
// Silent the stylistic rules in your IDE, but still auto fix them
|
||||
"eslint.rules.customizations": [
|
||||
{ "rule": "style/*", "severity": "off", "fixable": true },
|
||||
{ "rule": "format/*", "severity": "off", "fixable": true },
|
||||
{ "rule": "*-indent", "severity": "off", "fixable": true },
|
||||
{ "rule": "*-spacing", "severity": "off", "fixable": true },
|
||||
{ "rule": "*-spaces", "severity": "off", "fixable": true },
|
||||
{ "rule": "*-order", "severity": "off", "fixable": true },
|
||||
{ "rule": "*-dangle", "severity": "off", "fixable": true },
|
||||
{ "rule": "*-newline", "severity": "off", "fixable": true },
|
||||
{ "rule": "*quotes", "severity": "off", "fixable": true },
|
||||
{ "rule": "*semi", "severity": "off", "fixable": true }
|
||||
],
|
||||
|
||||
// Enable eslint for all supported languages
|
||||
"eslint.validate": [
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"vue",
|
||||
"html",
|
||||
"markdown",
|
||||
"json",
|
||||
"json5",
|
||||
"jsonc",
|
||||
"yaml",
|
||||
"toml",
|
||||
"xml",
|
||||
"gql",
|
||||
"graphql",
|
||||
"astro",
|
||||
"svelte",
|
||||
"css",
|
||||
"less",
|
||||
"scss",
|
||||
"pcss",
|
||||
"postcss"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"Print unibest Vue3 SFC": {
|
||||
"scope": "vue",
|
||||
"prefix": "v3",
|
||||
"body": [
|
||||
"<script lang=\"ts\" setup>",
|
||||
|
||||
"</script>\n",
|
||||
"<template>",
|
||||
" <div class=\"\">$3</div>",
|
||||
"</template>\n",
|
||||
"<style lang=\"scss\" scoped>",
|
||||
"//$4",
|
||||
"</style>\n",
|
||||
],
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import antfu from '@antfu/eslint-config'
|
||||
|
||||
export default antfu({
|
||||
formatters: true,
|
||||
vue: true,
|
||||
|
||||
stylistic: {
|
||||
indent: 2,
|
||||
quotes: 'single',
|
||||
},
|
||||
rules: {
|
||||
'unused-imports/no-unused-imports': 'warn',
|
||||
'unused-imports/no-unused-vars': 'warn',
|
||||
'no-console': 'off',
|
||||
'node/prefer-global/process': 'off',
|
||||
'@typescript-eslint/no-require-imports': 'off',
|
||||
'no-useless-catch': 'off',
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,13 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>link-frontend-new2</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "link-frontend-new2",
|
||||
"type": "module",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "vite build --mode prod",
|
||||
"build:test": "vite build --mode test",
|
||||
"dev": "vite --mode test",
|
||||
"dev:prod": "vite --mode prod",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"@element-plus/icons-vue": "^2.3.2",
|
||||
"axios": "^1.13.2",
|
||||
"dayjs": "^1.11.19",
|
||||
"element-plus": "^2.12.0",
|
||||
"pinia": "^3.0.4",
|
||||
"pinia-plugin-persistedstate": "^4.7.1",
|
||||
"vue": "^3.5.24",
|
||||
"vue-router": "^4.6.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^6.6.1",
|
||||
"@iconify/json": "^2.2.417",
|
||||
"@iconify/vue": "^5.0.0",
|
||||
"@types/node": "^24.10.1",
|
||||
"@vitejs/plugin-vue": "^6.0.1",
|
||||
"@vue/tsconfig": "^0.8.1",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-plugin-format": "^1.1.0",
|
||||
"sass": "^1.96.0",
|
||||
"typescript": "~5.9.3",
|
||||
"unplugin-icons": "^22.5.0",
|
||||
"unplugin-vue-components": "^30.0.0",
|
||||
"vite": "^7.2.4",
|
||||
"vue-tsc": "^3.1.4"
|
||||
}
|
||||
}
|
||||
+4490
File diff suppressed because it is too large.
Load diff
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 783 KiB |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,29 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted } from 'vue'
|
||||
import { getAreaListApi } from './request/api/area'
|
||||
import { getPropertyListApi } from './request/api/peoperty'
|
||||
import { useCommonOptions } from './store/commonOptions'
|
||||
|
||||
const commonOptions = useCommonOptions()
|
||||
|
||||
onMounted(() => {
|
||||
handleInitData()
|
||||
})
|
||||
|
||||
function handleInitData() {
|
||||
getAreaListApi().then((res) => {
|
||||
commonOptions.areaOptions.splice(0, commonOptions.areaOptions.length, ...res.data)
|
||||
})
|
||||
getPropertyListApi().then((res) => {
|
||||
commonOptions.propertyOptions.splice(0, commonOptions.propertyOptions.length, ...res.data)
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouterView />
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
</style>
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 496 B |
@@ -0,0 +1,133 @@
|
||||
<script lang="ts" setup>
|
||||
import type { PropType } from 'vue'
|
||||
import type { Area, CompanyQuery, Property } from '@/types/company/index'
|
||||
|
||||
const props = defineProps({
|
||||
properties: {
|
||||
type: Object as PropType<Property[]>,
|
||||
required: false,
|
||||
},
|
||||
areas: {
|
||||
type: Object as PropType<Area[]>,
|
||||
required: false,
|
||||
},
|
||||
})
|
||||
|
||||
const query: CompanyQuery = {
|
||||
areas: [],
|
||||
properties: [],
|
||||
name: '',
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="query">
|
||||
<div class="query-item">
|
||||
<el-select
|
||||
v-model="query.properties"
|
||||
filterable
|
||||
placeholder="请选择行业"
|
||||
multiple
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
:max-collapse-tags="2"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in props.properties"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div class="query-item">
|
||||
<el-tree-select
|
||||
v-model="query.areas"
|
||||
placeholder="请选择地域"
|
||||
:data="areas"
|
||||
filterable
|
||||
multiple
|
||||
check-strictly
|
||||
collapse-tags
|
||||
collapse-tags-tooltip
|
||||
:max-collapse-tags="2"
|
||||
:render-after-expand="false"
|
||||
/>
|
||||
</div>
|
||||
<div class="query-item">
|
||||
<el-input
|
||||
v-model="query.name"
|
||||
placeholder="请输入公司名称"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="search">
|
||||
<i-tdesign:search />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.query {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 60px;
|
||||
border-radius: 4px;
|
||||
border: 0;
|
||||
color: #000;
|
||||
.query-item {
|
||||
flex: 1;
|
||||
|
||||
:deep(.el-select__wrapper) {
|
||||
height: 60px;
|
||||
border-radius: 0px;
|
||||
box-shadow: none;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
:deep(.el-select__placeholder) {
|
||||
font-size: 18px;
|
||||
}
|
||||
:deep(.el-select__input) {
|
||||
font-size: 18px;
|
||||
}
|
||||
:deep(.el-input__wrapper) {
|
||||
border-radius: 0px;
|
||||
box-shadow: none;
|
||||
padding: 0px;
|
||||
}
|
||||
:deep(.el-input__inner) {
|
||||
height: 60px;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
.search {
|
||||
height: 60px;
|
||||
width: 60px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 24px;
|
||||
background-color: #333;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s ease;
|
||||
|
||||
&:hover {
|
||||
background-color: #555;
|
||||
}
|
||||
&:active {
|
||||
background-color: #111;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,172 @@
|
||||
<script lang="ts" setup>
|
||||
import { useRoute } from 'vue-router'
|
||||
|
||||
const props = defineProps({
|
||||
isLogined: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const menuList = [
|
||||
{ name: '首页', path: '/' },
|
||||
{ name: '企业名录', path: '/companies' },
|
||||
{ name: '论坛中心', path: '/forum' },
|
||||
{ name: '关于我们', path: '/companies' },
|
||||
{ name: '联系我们', path: '/forum' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="header">
|
||||
<nav class="container">
|
||||
<img src="/logo.png" class="logo">
|
||||
<div class="menu">
|
||||
<span
|
||||
v-for="item in menuList"
|
||||
:key="item.path"
|
||||
:class="{ active: route.path.startsWith(item.path) }"
|
||||
class="menu-item"
|
||||
>
|
||||
<span class="menu-item-name">
|
||||
{{ item.name }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="action">
|
||||
<i-tdesign:search class="action-item" />
|
||||
|
||||
<i-tdesign:notification v-if="props.isLogined" class="action-item" />
|
||||
|
||||
<template v-if="props.isLogined">
|
||||
<el-divider direction="vertical" />
|
||||
|
||||
<el-dropdown>
|
||||
<div class="user">
|
||||
<el-avatar :size="32" src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png" />
|
||||
<span class="name">
|
||||
远通G3
|
||||
</span>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item>个人中心</el-dropdown-item>
|
||||
<el-dropdown-item>退出登录</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<el-button type="primary" round>
|
||||
登录
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.header {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
z-index: 99;
|
||||
background-color: #fff;
|
||||
|
||||
.container {
|
||||
width: 100%;
|
||||
padding: 0rem 3rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
height: 60px;
|
||||
box-shadow: 0 5px 16px rgba(0, 0, 0, 0.1);
|
||||
.logo {
|
||||
width: 160px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.menu {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.menu-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
color: #000;
|
||||
outline: none;
|
||||
margin-left: 36px;
|
||||
transition: color 0.3s ease;
|
||||
position: relative;
|
||||
|
||||
&:hover {
|
||||
color: #0f6fec !important;
|
||||
}
|
||||
&:first-child {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
||||
&.active {
|
||||
color: #0f6fec !important;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: -4px;
|
||||
left: 50%;
|
||||
width: 0;
|
||||
height: 2px;
|
||||
background-color: #0f6fec;
|
||||
transition: all 0.3s ease;
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
&:hover::after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
&.active::after {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.menu-item-name {
|
||||
font-size: 18px;
|
||||
font-weight: 400;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.action {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.action-item {
|
||||
font-size: 20px;
|
||||
margin-right: 24px;
|
||||
color: #000;
|
||||
cursor: pointer;
|
||||
&:last-child {
|
||||
margin-right: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
.user {
|
||||
margin-left: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
cursor: pointer;
|
||||
outline: 0;
|
||||
.name {
|
||||
margin-left: 8px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
<script lang="ts" setup>
|
||||
import Header from './components/header.vue'
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="app">
|
||||
<Header />
|
||||
<div class="content">
|
||||
<RouterView />
|
||||
</div>
|
||||
<footer class="footer">
|
||||
footer
|
||||
</footer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.app {
|
||||
position: relative;
|
||||
background-color: #eff2f6;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: 60px;
|
||||
height: 1800px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
height: 100px;
|
||||
background-color: #ccc;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,18 @@
|
||||
import ElementPlus from 'element-plus'
|
||||
import { createApp } from 'vue'
|
||||
import App from './App.vue'
|
||||
import { setupRouter } from './router/index'
|
||||
import { setupPinia } from './store'
|
||||
import 'element-plus/dist/index.css'
|
||||
import '@/styles/css/global.css'
|
||||
|
||||
async function setupApp() {
|
||||
const app = createApp(App)
|
||||
setupPinia(app)
|
||||
setupRouter(app)
|
||||
|
||||
app.use(ElementPlus)
|
||||
app.mount('#app')
|
||||
}
|
||||
|
||||
setupApp()
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { AreaResult } from '@/types/company/index'
|
||||
import { httpGet } from '../utils'
|
||||
|
||||
export function getAreaListApi() {
|
||||
return httpGet<AreaResult>(`/webArea/list`)
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { PropertyResult } from '@/types/company/index'
|
||||
import { httpGet } from '../utils'
|
||||
|
||||
export function getPropertyListApi() {
|
||||
return httpGet<PropertyResult>(`/webProperty/list`)
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
import type { AxiosError, AxiosInstance, AxiosResponse, InternalAxiosRequestConfig } from 'axios'
|
||||
import axios from 'axios'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
function buildBaseUrl() {
|
||||
const isProxy = import.meta.env.VITE_APP_PROXY === 'Y'
|
||||
const mode = import.meta.env.MODE
|
||||
const proxyPrefix = import.meta.env.VITE_APP_PROXY_PREFIX
|
||||
|
||||
const baseURL = import.meta.env.VITE_SERVER_BASEURL
|
||||
|
||||
if (mode === 'prod') {
|
||||
if (isProxy) {
|
||||
return baseURL + proxyPrefix
|
||||
}
|
||||
else {
|
||||
return baseURL
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (isProxy) {
|
||||
return proxyPrefix
|
||||
}
|
||||
else {
|
||||
return baseURL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const axiosInstance: AxiosInstance = axios.create({
|
||||
baseURL: buildBaseUrl(),
|
||||
timeout: 0,
|
||||
})
|
||||
|
||||
const NoFreePaths = [
|
||||
'/imMessage/**',
|
||||
'/file/**',
|
||||
'/company/getPrivateDetail',
|
||||
]
|
||||
|
||||
// 请求拦截器
|
||||
axiosInstance.interceptors.request.use(
|
||||
(config: InternalAxiosRequestConfig) => {
|
||||
const router = useRouter()
|
||||
const userStore = useUserStore()
|
||||
const path = config.url || ''
|
||||
|
||||
const needAuth = matchPaths(path, NoFreePaths)
|
||||
|
||||
if (needAuth) {
|
||||
if (!userStore.isLogined) {
|
||||
userStore.clearUserInfo()
|
||||
router.push('/login')
|
||||
return Promise.reject(new Error('尚未登录,请先登录!'))
|
||||
}
|
||||
}
|
||||
|
||||
config.headers.Authorization = `Bearer ${userStore.userInfo.token}`
|
||||
config.headers.id = userStore.userInfo.id
|
||||
|
||||
return config
|
||||
},
|
||||
(error: AxiosError) => {
|
||||
return Promise.reject(error)
|
||||
},
|
||||
)
|
||||
|
||||
axiosInstance.interceptors.response.use(
|
||||
(response: AxiosResponse) => {
|
||||
// 判断响应是否为文件下载类型
|
||||
const isDownload = isDownloadResponse(response.headers)
|
||||
if (isDownload) {
|
||||
return response
|
||||
}
|
||||
|
||||
if (response.status !== 200) {
|
||||
return Promise.reject(new Error('系统异常'))
|
||||
}
|
||||
|
||||
const resData = response.data as ResponseData<any>
|
||||
response.data.data = parseJsonOrReturnString(response.data.data)
|
||||
|
||||
if (resData.code === 200) {
|
||||
return Promise.resolve(response.data)
|
||||
}
|
||||
else {
|
||||
return Promise.reject(resData)
|
||||
}
|
||||
},
|
||||
(error: AxiosError) => {
|
||||
console.log(error)
|
||||
},
|
||||
)
|
||||
|
||||
function matchPaths(path: string, patterns: string[]): boolean {
|
||||
return patterns.some((pattern) => {
|
||||
const regex = new RegExp(
|
||||
`${pattern
|
||||
.replace(/\/\*\*/g, '(/.*)?')
|
||||
.replace(/\/\*/g, '(/[^/]*)?')
|
||||
.replace(/\./g, '\\.')}$`,
|
||||
)
|
||||
return regex.test(path)
|
||||
})
|
||||
}
|
||||
|
||||
function isDownloadResponse(headers: any): boolean {
|
||||
const contentType = headers['content-type']
|
||||
return /application\/(?:octet-stream|force-download|pdf|vnd.ms-excel|msexcel|OCTET-STREAM)/.test(contentType || '')
|
||||
}
|
||||
|
||||
function parseJsonOrReturnString(input: any) {
|
||||
try {
|
||||
return JSON.parse(input)
|
||||
}
|
||||
catch {
|
||||
return input
|
||||
}
|
||||
}
|
||||
|
||||
export default axiosInstance
|
||||
@@ -0,0 +1,21 @@
|
||||
import axiosInstance from './index'
|
||||
|
||||
export function httpGet<T>(url: string, params?: Record<string, any>): Promise<ResponseData<T>> {
|
||||
return axiosInstance.get(url, { params })
|
||||
}
|
||||
|
||||
export function httpPostJson<T>(url: string, data?: Record<string, any>): Promise<ResponseData<T>> {
|
||||
return axiosInstance.post(url, data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
export function httpPostForm<T>(url: string, data?: any): Promise<ResponseData<T>> {
|
||||
return axiosInstance.post(url, data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { App } from 'vue'
|
||||
import { createRouter, createWebHashHistory } from 'vue-router'
|
||||
import Layout from '@/layout/index.vue'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHashHistory(),
|
||||
strict: true,
|
||||
routes: [
|
||||
{
|
||||
path: '/',
|
||||
component: Layout,
|
||||
children: [
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/views/home/index.vue'),
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
scrollBehavior: () => ({ left: 0, top: 0 }),
|
||||
})
|
||||
|
||||
export function setupRouter(app: App) {
|
||||
app.use(router)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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,9 @@
|
||||
import type { App } from 'vue'
|
||||
import { createPinia } from 'pinia'
|
||||
import { createPersistedState } from 'pinia-plugin-persistedstate'
|
||||
|
||||
export function setupPinia(app: App) {
|
||||
const store = createPinia()
|
||||
store.use(createPersistedState())
|
||||
app.use(store)
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
interface IUserInfo {
|
||||
id: number
|
||||
account?: string
|
||||
email?: string
|
||||
name?: string
|
||||
token?: string
|
||||
avatar?: string
|
||||
}
|
||||
|
||||
export const useUserStore = defineStore(
|
||||
'user',
|
||||
() => {
|
||||
const userInfo = ref<IUserInfo>({
|
||||
id: 0,
|
||||
})
|
||||
|
||||
const setUserInfo = (val: IUserInfo) => {
|
||||
userInfo.value = val
|
||||
}
|
||||
|
||||
const clearUserInfo = () => {
|
||||
}
|
||||
|
||||
// ✅ 如果需要同时验证多个字段
|
||||
const isLogined = computed(() => {
|
||||
return !!(
|
||||
(
|
||||
userInfo.value.token
|
||||
&& userInfo.value.id !== 0
|
||||
&& userInfo.value.account
|
||||
)
|
||||
)
|
||||
})
|
||||
|
||||
return {
|
||||
userInfo,
|
||||
setUserInfo,
|
||||
clearUserInfo,
|
||||
isLogined,
|
||||
}
|
||||
},
|
||||
{
|
||||
persist: true,
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
body::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 8px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: #f1f1f1;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
background: #888;
|
||||
border-radius: 10px;
|
||||
border: 2px solid #f1f1f1;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
background: #555;
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,23 @@
|
||||
/* eslint-disable */
|
||||
// @ts-nocheck
|
||||
// biome-ignore lint: disable
|
||||
// oxlint-disable
|
||||
// ------
|
||||
// Generated by unplugin-vue-components
|
||||
// Read more: https://github.com/vuejs/core/pull/3399
|
||||
|
||||
export {}
|
||||
|
||||
/* prettier-ignore */
|
||||
declare module 'vue' {
|
||||
export interface GlobalComponents {
|
||||
HelloWorld: typeof import('./../components/HelloWorld.vue')['default']
|
||||
ICarbonAccessibility: typeof import('~icons/carbon/accessibility')['default']
|
||||
IMdiAccountBox: typeof import('~icons/mdi/account-box')['default']
|
||||
'ITdesign:notification': typeof import('~icons/tdesign/notification')['default']
|
||||
'ITdesign:search': typeof import('~icons/tdesign/search')['default']
|
||||
QueryCompany: typeof import('./../components/QueryCompany.vue')['default']
|
||||
RouterLink: typeof import('vue-router')['RouterLink']
|
||||
RouterView: typeof import('vue-router')['RouterView']
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
export interface Area {
|
||||
label: string
|
||||
value: number
|
||||
children?: AreaResult[]
|
||||
}
|
||||
|
||||
export type AreaResult = Area[]
|
||||
|
||||
export interface Property {
|
||||
label: string
|
||||
value: string
|
||||
}
|
||||
export type PropertyResult = Property[]
|
||||
|
||||
export interface CompanyQuery {
|
||||
properties: string[]
|
||||
areas: string[]
|
||||
name: string
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// src/env.d.ts
|
||||
declare namespace Env {
|
||||
interface ImportMeta extends ImportMetaEnv {
|
||||
readonly VITE_BASE_URL: string
|
||||
readonly VITE_APP_TITLE: string
|
||||
readonly VITE_SERVER_BASEURL: string
|
||||
readonly VITE_UPLOAD_BASEURL: string
|
||||
readonly VITE_WEBSOCKET_BASEURL: string
|
||||
|
||||
readonly VITE_APP_PROXY: string
|
||||
readonly VITE_APP_PROXY_PREFIX: string
|
||||
readonly VITE_APP_SERVER_PREFIX: string
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export {}
|
||||
|
||||
declare global {
|
||||
interface ResponseData<T> {
|
||||
code: number
|
||||
message: string
|
||||
data: T
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<script lang="ts" setup>
|
||||
const tableData = [
|
||||
{
|
||||
date: '2016-05-03',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-02',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-04',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
{
|
||||
date: '2016-05-01',
|
||||
name: 'Tom',
|
||||
address: 'No. 189, Grove St, Los Angeles',
|
||||
},
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="recommend">
|
||||
<div class="left">
|
||||
<div class="recommend-title">
|
||||
企业名录
|
||||
</div>
|
||||
|
||||
<el-table :data="tableData" border stripe style="width: 100%">
|
||||
<el-table-column prop="date" label="地区" width="180" />
|
||||
<el-table-column prop="name" label="公司" />
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
<div class="hot-card">
|
||||
<div class="hot-card-title">
|
||||
热门推荐
|
||||
</div>
|
||||
<div class="hot-card-list">
|
||||
<div v-for="i in 10" :key="i" class="hot-card-item">
|
||||
<span class="number">{{ i }}</span>
|
||||
<span class="name">xxxxxxxxxx公司公司</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.recommend {
|
||||
width: 100%;
|
||||
padding: 0 128px;
|
||||
margin-top: 24px;
|
||||
display: flex;
|
||||
.left {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.right {
|
||||
width: 20%;
|
||||
margin-left: 32px;
|
||||
.hot-card {
|
||||
width: 100%;
|
||||
|
||||
.hot-card-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: #fff;
|
||||
.hot-card-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
border-bottom: 1px solid #eee;
|
||||
cursor: pointer;
|
||||
.number {
|
||||
font-weight: bold;
|
||||
color: #666666;
|
||||
font-size: 22px;
|
||||
}
|
||||
|
||||
.name {
|
||||
margin-left: 12px;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.recommend-title,
|
||||
.hot-card-title {
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
position: relative;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,98 @@
|
||||
<script lang="ts" setup>
|
||||
import QueryCompany from '@/components/QueryCompany.vue'
|
||||
import { useCommonOptions } from '@/store/commonOptions'
|
||||
import Recommend from './components/recommend.vue'
|
||||
|
||||
const commonOptions = useCommonOptions()
|
||||
|
||||
const carouselList = [
|
||||
{ img: '/ship-8263464_1920.jpg', href: '' },
|
||||
{ img: '/ship-8263464_1920.jpg', href: '' },
|
||||
{ img: '/ship-8263464_1920.jpg', href: '' },
|
||||
]
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="wrapper">
|
||||
<!-- 轮播图 -->
|
||||
<el-carousel class="carousel">
|
||||
<el-carousel-item v-for="item in carouselList" :key="item.href">
|
||||
<img :src="item.img">
|
||||
</el-carousel-item>
|
||||
</el-carousel>
|
||||
|
||||
<!-- 内容浮在轮播图上 -->
|
||||
<div class="content">
|
||||
<div class="intro">
|
||||
<span class="intro-heading">连接优质企业伙伴</span>
|
||||
</div>
|
||||
|
||||
<div class="query">
|
||||
<QueryCompany :properties="commonOptions.propertyOptions" :areas="commonOptions.areaOptions" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Recommend />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.wrapper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* 轮播图 */
|
||||
.carousel {
|
||||
width: 100%;
|
||||
height: 600px;
|
||||
position: relative;
|
||||
:deep(.el-carousel__container) {
|
||||
height: 100%;
|
||||
}
|
||||
:deep(.el-carousel__item) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
/* 内容浮在轮播图上 */
|
||||
.content {
|
||||
position: absolute;
|
||||
top: 260px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 2;
|
||||
color: #fff;
|
||||
|
||||
.intro {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 28px;
|
||||
|
||||
.intro-heading {
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.intro-detail {
|
||||
font-size: 18px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
.query {
|
||||
width: 1240px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"jsx": "preserve",
|
||||
"jsxImportSource": "vue",
|
||||
"lib": ["DOM", "ESNext"],
|
||||
"baseUrl": ".",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"~/*": ["./*"]
|
||||
},
|
||||
"resolveJsonModule": true,
|
||||
"types": ["vite/client", "node", "unplugin-icons/types/vue"],
|
||||
"strict": true,
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals": false,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"isolatedModules": true
|
||||
},
|
||||
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.vue"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import process from 'node:process'
|
||||
import { fileURLToPath, URL } from 'node:url'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import IconsResolver from 'unplugin-icons/resolver'
|
||||
import Icons from 'unplugin-icons/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
|
||||
export default defineConfig((configEnv) => {
|
||||
const viteEnv = loadEnv(configEnv.mode, process.cwd()) as unknown as Env.ImportMeta
|
||||
const { VITE_SERVER_BASEURL, VITE_APP_PROXY, VITE_APP_PROXY_PREFIX } = viteEnv
|
||||
|
||||
return {
|
||||
base: viteEnv.VITE_BASE_URL,
|
||||
resolve: {
|
||||
// 使其通过能 ~ 或 @ 导入
|
||||
alias: {
|
||||
'~': fileURLToPath(new URL('./', import.meta.url)),
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
css: {
|
||||
preprocessorOptions: {
|
||||
scss: {
|
||||
api: 'modern-compiler',
|
||||
additionalData: `@use "@/styles/scss/global.scss" as *;`,
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
vue(),
|
||||
Icons(),
|
||||
Components({
|
||||
dts: 'src/types/auto-import.d.ts',
|
||||
resolvers: [IconsResolver()],
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
port: 8080,
|
||||
open: true,
|
||||
// 用于配置开发服务器启动时预加载的一些客户端文件,以提高初次加载的速度。
|
||||
warmup: {
|
||||
clientFiles: ['./index.html', './src/{pages,components}/*'],
|
||||
},
|
||||
proxy:
|
||||
VITE_APP_PROXY === 'Y'
|
||||
? {
|
||||
[VITE_APP_PROXY_PREFIX]: {
|
||||
target: VITE_SERVER_BASEURL,
|
||||
changeOrigin: true, // 跨域
|
||||
rewrite: path => path.replace(new RegExp(`^${VITE_APP_PROXY_PREFIX}`), ''),
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
},
|
||||
preview: {
|
||||
port: 9725,
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user