Commit e5f90751 by 胡悦

添加登录

1 parent 69dd9477
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-23 14:30:40
* @LastEditors: huyue
* @LastEditTime: 2024-07-24 20:38:54
-->
<template> <template>
<router-view /> <router-view class />
</template> </template>
<script lang="ts" setup></script> <script lang="ts" setup></script>
<style> <style>
......
<script lang="ts" setup></script>
<template>
<div class="menu-box">
<a-menu
class="menu"
:style="{ width: '200px', height: '100%' }"
:default-open-keys="['0']"
:default-selected-keys="['0']"
>
<a-menu-item key="0"><icon-user />投资者相关</a-menu-item>
</a-menu>
</div>
</template>
<style lang="scss" scoped>
.menu-box {
box-sizing: border-box;
width: 100%;
height: 100%;
padding-top: 24px;
.arco-menu-light .arco-menu-item.arco-menu-selected {
background-color: rgba(25, 95, 254, .08);
}
}
</style>
\ No newline at end of file \ No newline at end of file
<script lang="ts" setup>
import { getImageUrl } from "@/utils/common"
import { ref, reactive } from 'vue'
import { useRouter } from 'vue-router';
const router = useRouter();
const userInfo = reactive({
account: '管理员'
})
const logout = () => {
router.replace({ path: '/login' })
console.log('退出登录')
}
</script>
<template>
<div class="navbar">
<div class="navbar-left">
<a-image class="logo" width="32" :src="getImageUrl('layout-logo')" :preview="false" />
<div class="title">广联数科控股有限公司</div>
</div>
<div class="navbar-right">
<div class="avatar">{{ userInfo.account.slice(0, 1)}}</div>
<div class="username">{{userInfo.account}}</div>
<a-popover position="br" content-class="logout-popover">
<icon-down />
<template #content>
<a-button @click="logout">退出登录</a-button>
</template>
</a-popover>
</div>
</div>
</template>
<style lang="scss" scoped>
.navbar {
display: flex;
justify-content: space-between;
width: 100%;
height: 48px;
background-color: #fff;
box-shadow: 0 0 6px 0 #EBEDF0;
z-index: 100;
&-left {
display: flex;
align-items: center;
.logo {
margin-left: 16px;
}
.title {
font-weight: 500;
font-size: 16px;
color: #000814;
line-height: 24px;
margin-left: 40px;
}
}
&-right {
display: flex;
align-items: center;
margin-right: 18px;
.avatar {
width: 28px;
height: 28px;
background-color: rgba(25, 95, 254, .08);
border-radius: 50%;
display: flex;
justify-content: center;
align-items: center;
font-size: 14px;
color: #195FFE;
margin-right: 8px;
}
.username {
color: #6E6E7A;
font-size: 14px;
margin-right: 8px;
}
}
}
.logout-popover {
.arco-popover-content {
.arco-btn-secondary {
background-color: #EDF3FF;
color: #195FFE;
}
}
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -16,28 +16,21 @@ import VConsole from 'vconsole' ...@@ -16,28 +16,21 @@ import VConsole from 'vconsole'
import '@arco-design/web-vue/dist/arco.css'; import '@arco-design/web-vue/dist/arco.css';
const app = createApp(App) const app = createApp(App)
let vConsole: object = {} let vConsole: object = {}
// import { components } from './libs/vant' fetchConfig().then(res => {
// components.forEach(component => app.use(component)); app.provide('global', {
// // 自动注册全局组件 $imgUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/h5-posters/',
// const modules = import.meta.globEager('./components/**/index.ts') version: res.version
// for (const path in modules) { })
// app.use(modules[path].default) localStorage.setItem('config', JSON.stringify(res))
// } app.use(ArcoVue, {
// fetchConfig().then(res => {
// app.provide('global', {
// $imgUrl: 'https://img02.glsx.com.cn/weapp/resource/miniprogram/h5-posters/',
// version: res.version
// })
// localStorage.setItem('config', JSON.stringify(res))
app.use(ArcoVue, {
// 用于改变使用组件时的前缀名称 // 用于改变使用组件时的前缀名称
componentPrefix: 'arco' componentPrefix: 'arco'
}); });
app.use(store) app.use(store)
setupRouter(app) setupRouter(app)
router.isReady().then(() => { router.isReady().then(() => {
app.mount('#app') app.mount('#app')
}) })
// // if (res.vconsole) vConsole = new VConsole() // // if (res.vconsole) vConsole = new VConsole()
// }) })
...@@ -3,19 +3,34 @@ ...@@ -3,19 +3,34 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-10-10 10:54:14 * @Date: 2022-10-10 10:54:14
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-07-24 15:13:31 * @LastEditTime: 2024-07-24 17:22:14
*/ */
const staticRoutes = Object.freeze([ const staticRoutes = Object.freeze([
{ {
name: 'login',
path: '/', path: '/',
component: () => import('views/login/index.vue'), component: () => import('views/login/index.vue'),
}, },
{ {
name: 'login',
path: '/login',
component: () => import('views/login/index.vue'),
},
{
path: '/layout',
component: () => import('views/layout/index.vue'),
children: [
{
name: 'investorRelated', name: 'investorRelated',
path: '/investorRelated', path: '/layout/investorRelated',
component: () => import('views/investorRelated/index.vue'), component: () => import('views/investorRelated/index.vue'),
}, },
{
name: 'news',
path: '/layout/news',
component: () => import('views/news/index.vue'),
}
]
},
]) ])
export default staticRoutes export default staticRoutes
...@@ -3,13 +3,19 @@ ...@@ -3,13 +3,19 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-10-10 11:37:11 * @Date: 2022-10-10 11:37:11
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-08-08 10:52:01 * @LastEditTime: 2024-07-24 17:49:38
*/ */
/** 三个数字加一个逗号 */ /** 三个数字加一个逗号 */
const numAddSymbol = (val: number | string | undefined) => { const numAddSymbol = (val: number | string | undefined) => {
return val ? (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',') : 0 return val ? (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',') : 0
} }
export default { // 获取图片
numAddSymbol const getImageUrl = (name: any) => {
return new URL(`../assets/images/` + name + ".png", import.meta.url).href;
};
export {
numAddSymbol,
getImageUrl
} }
\ No newline at end of file \ No newline at end of file
...@@ -6,9 +6,7 @@ ...@@ -6,9 +6,7 @@
* @LastEditTime: 2023-06-14 10:12:30 * @LastEditTime: 2023-06-14 10:12:30
*/ */
const fetchConfig = function (isEnv = true) { const fetchConfig = function (isEnv = true) {
// return window.fetch('https://oss-config.dev.glsx.com.cn/mock/618cb9331072f92988f05a23/wx/h5-config', {}).then(res => res.json()) return window.fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=website-config').then(res => res.json())
// return window.fetch('https://oss-config.test.glsx.com.cn/mock/618cb9331072f92988f05a23/wx/h5-config', {}).then(res => res.json())
return window.fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=h5-config').then(res => res.json())
} }
// const $mockConfig = await fetchConfig() // const $mockConfig = await fetchConfig()
export default fetchConfig export default fetchConfig
\ No newline at end of file \ No newline at end of file
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-08-23 11:04:56 * @Date: 2022-08-23 11:04:56
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-02-07 15:14:49 * @LastEditTime: 2024-07-25 11:51:11
*/ */
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios' import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'
import { Toast } from 'vant'; // import { Toast } from 'vant';
import { Message } from '@arco-design/web-vue';
import qs from 'qs' import qs from 'qs'
import { createSign } from './util' import { createSign } from './util'
const options: any = localStorage.getItem('config') const options: any = localStorage.getItem('config')
...@@ -73,16 +74,18 @@ service.interceptors.response.use((r: AxiosResponse) => { ...@@ -73,16 +74,18 @@ service.interceptors.response.use((r: AxiosResponse) => {
const [href] = window.location.href.split('/#/') const [href] = window.location.href.split('/#/')
location.href = `${href}/#/login` location.href = `${href}/#/login`
} }
Toast(res.message) // Message(res.message)
break break
default: default:
Toast(res.message || res.msg || '出错了,请联系管理员') Message.error(res.message || res.msg || '出错了,请联系管理员')
// Toast(res.message || res.msg || '出错了,请联系管理员')
break break
} }
if (returnAll) return res if (returnAll) return res
return res[data_key] return res[data_key]
}, error => { }, error => {
Toast(error.message) // Toast(error.message)
Message.error(error)
return Promise.reject(error) return Promise.reject(error)
}) })
export default service export default service
\ No newline at end of file \ No newline at end of file
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-12-06 16:17:36 * @Date: 2022-12-06 16:17:36
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2023-03-07 10:26:01 * @LastEditTime: 2024-07-25 11:23:29
*/ */
import http from './http' import http from './http'
import { useUserStore } from '../store/user' import { useUserStore } from '../store/user'
const PATH = 'rop-scrm-shopmall/router' const PATH = 'rop-sk-gw/router'
const DJPATH = 'rop-dj-smartcarlife/router'
const req: any = (url: string, data: any = {}, returnAll = false, method = 'POST',) => { const req: any = (url: string, data: any = {}, returnAll = false, method = 'POST',) => {
data.method = url data.method = url
const options = { const options = {
......
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-23 16:43:07
* @LastEditors: huyue
* @LastEditTime: 2024-07-25 17:22:06
-->
<script lang="ts" setup>
import { h, ref, reactive } from "vue";
import { DataInfo, TableItem, BasicItem } from "./interface";
import { req } from "../../utils/request";
import { getImageUrl } from "@/utils/common"
const data = reactive<Partial<DataInfo>>({
menuList: [],
tableData: [],
currentId: '0',
total: 0,
page: {
pageNum: 1,
pageSize: 10
}
})
/** table列配置 */
const columns = [
{
title: "标题",
dataIndex: "zhTitle",
},
{
title: "公告类型",
dataIndex: "gwInvnoticeTypeName",
},
{
title: "修改时间",
dataIndex: "modifiedAt",
},
{
title: "发布时间",
dataIndex: "systemPublishTime",
},
{
title: "操作",
slotName: 'operation',
}
];
/** 表格展开内容 */
const vnode = (record: Partial<TableItem>) => {
const { invnoticeProductTranslationsList, externalReleaseDate, zhTag } = record;
const _CN = invnoticeProductTranslationsList?.find((item: Partial<BasicItem>) => item.languageCode === 'zh-CN')
const _US = invnoticeProductTranslationsList?.find((item: Partial<BasicItem>) => item.languageCode === 'en-US')
const _TW = invnoticeProductTranslationsList?.find((item: Partial<BasicItem>) => item.languageCode === 'zh-TW')
return h('div', {}, [
h('div', { class: 'expand-item' }, [
h('span', { class: 'title' }, '公告标签:'),
h('span', {}, `${zhTag ? zhTag : '--'}`)
]),
h('div', { class: 'expand-item' }, [
h('span', { class: 'title' }, '外显发布时间:'),
h('span', {}, `${externalReleaseDate}`)
]),
h('div', { class: 'expand-item' }, [
h('span', { class: 'title' }, '简体:'),
h('span', {}, `${_CN?.title}`),
h('a', {
class: 'pdf-link',
href: `${_CN?.filePath}`,
target: '_blank'
}, [
h('img', {
class: 'pdf',
src: getImageUrl('pdf')
})
])
]),
h('div', { class: 'expand-item' }, [
h('span', { class: 'title' }, '繁体:'),
h('span', {}, `${_TW?.title}`),
h('a', {
class: 'pdf-link',
href: `${_TW?.filePath}`,
target: '_blank'
}, [
h('img', {
class: 'pdf',
src: getImageUrl('pdf')
})
])
]),
h('div', { class: 'expand-item long' }, [
h('span', { class: 'title' }, '英文:'),
h('span', {}, `${_US?.title}`),
h('a', {
class: 'pdf-link',
href: `${_US?.filePath}`,
target: '_blank'
}, [
h('img', {
class: 'pdf',
src: getImageUrl('pdf')
})
])
])
]);
}
const expandable = reactive({
width: 50,
expandedRowRender: (record: Partial<TableItem>) => {
return vnode(record);
},
});
/** 切换公告,参数类型 id */
const changeMenu = (key: string | number) => {
data.currentId = key
getTableData()
};
/** 分页切换 */
const changePage = (current: number) => {
data.page!.pageNum = current
getTableData()
}
const changeSize = (size: number) => {
data.page!.pageNum = 1
data.page!.pageSize = size
getTableData()
}
// 接口定义、调用
const getList = async () => {
const res = await req("gw.api.invnotice.findAllTypeByLanguageCode")
res.unshift({
gwInvnoticeTypeId: '0',
description: "全部公告"
})
data.menuList = res
}
const getTableData = async () => {
let { currentId, page } = data
const gwInvnoticeTypeId = currentId === '0' ? '' : currentId
const res = await req("gw.api.invnotice.findInvoticeProByConditionPage", {
gwInvnoticeTypeId,
...page
})
data.total = res.total
data.tableData = res.list
}
getList()
getTableData()
</script>
<template> <template>
投资者关系 <div class="page-title">投资者相关</div>
<div class="page-content">
<a-tabs default-active-key="0" size="'large'" @tab-click="changeMenu">
<template #extra>
<a-button type="primary">新增公告</a-button>
</template>
<a-tab-pane v-for="item in data.menuList" :key="item.gwInvnoticeTypeId" :title="item.description">
</a-tab-pane>
</a-tabs>
<a-table :columns="columns" :data="data.tableData" row-key="id" :expandable="expandable" :pagination="false" :bordered="false">
<template #operation="{ record }">
<a-button type="text">发布</a-button>
<a-button type="text">编辑</a-button>
<a-button type="text">OA截图</a-button>
</template>
</a-table>
<a-pagination class="pagination" :total="data.total" @change="changePage" @page-size-change="changeSize" show-total show-jumper show-page-size />
</div>
</template> </template>
<style lang="scss" scoped>
.page-title {
font-weight: 500;
font-size: 20px;
color: #000814;
}
.page-content {
background-color: #fff;
padding: 10px 20px;
margin-top: 16px;
}
.pagination {
justify-content: flex-end;
padding: 16px 0;
}
</style>
<style lang="scss">
.expand-item {
display: inline-flex;
align-items: center;
width: 50%;
font-size: 14px;
color: #6E6E7A;
padding-left: 80px;
box-sizing: border-box;
padding-top: 10px;
&:nth-child(2n) {
padding-left: 40px;
}
&:first-child {
padding-top: 16px;
}
&:last-child {
padding-bottom: 16px;
}
&.long {
width: 100%;
padding-left: 80px;
}
.title {
color: #000814;
}
.pdf-link {
width: 24px;
height: 16px;
}
.pdf {
margin-left: 8px;
width: 16px;
height: 16px;
}
}
</style>
export interface MenuItem {
gwInvnoticeTypeId: String;
description: String;
}
export interface Page {
pageNum: Number;
pageSize: Number
}
export interface BasicItem {
id: Number;
gwInvnoticeProductId: Number;
[property: string]: any;
}
export interface DataInfo {
menuList: MenuItem[];
tableData: TableItem[]; // 表格数据
currentId?: Number | String;
total: Number;
page: Page;
}
export interface TableItem {
id: Number;
gwInvnoticeTypeId: Number;
gwInvnoticeTypeName: String;
zhTitle: String;
modifiedAt?: String;
invnoticeProductTranslationsList: Partial<BasicItem>[],
externalReleaseDate: String;
zhTag: String;
}
\ No newline at end of file \ No newline at end of file
<script lang="ts" setup>
import NavBar from '@/components/NavBar/index.vue';
import Menu from '@/components/Menu/index.vue';
</script>
<template>
<div class="layout">
<a-layout>
<a-layout-header><NavBar /></a-layout-header>
<a-layout>
<a-layout-sider>
<Menu />
</a-layout-sider>
<a-layout-content class="content">
<router-view></router-view>
</a-layout-content>
</a-layout>
</a-layout>
</div>
</template>
<style lang="scss" scoped>
.content {
box-sizing: border-box;
width: 100%;
height: calc(100vh - 48px);
background-color: #f7f8f9;
box-sizing: border-box;
padding: 16px 20px;
overflow-y: auto
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -3,13 +3,14 @@ ...@@ -3,13 +3,14 @@
* @Author: huyue * @Author: huyue
* @Date: 2024-07-23 16:28:15 * @Date: 2024-07-23 16:28:15
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-07-24 16:13:41 * @LastEditTime: 2024-07-24 17:50:21
--> -->
<script lang="ts" setup> <script lang="ts" setup>
import {ref, reactive} from 'vue' import {ref, reactive} from 'vue'
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { ValidatedError } from '@arco-design/web-vue'; import { ValidatedError } from '@arco-design/web-vue';
import { Message } from '@arco-design/web-vue'; import { Message } from '@arco-design/web-vue';
import { getImageUrl } from "@/utils/common"
const router = useRouter(); const router = useRouter();
/** /**
* 变量定义 * 变量定义
...@@ -20,8 +21,8 @@ const userData = { ...@@ -20,8 +21,8 @@ const userData = {
password: '@32%weGL' password: '@32%weGL'
} }
const userInfo = reactive({ const userInfo = reactive({
username: '', username: 'admin',
password: '' password: '@32%weGL'
}) })
/** /**
* 方法定义 * 方法定义
...@@ -37,7 +38,7 @@ const handleLogin = ({values, errors}: { ...@@ -37,7 +38,7 @@ const handleLogin = ({values, errors}: {
const { username, password } = userData; const { username, password } = userData;
if (values.username === username && values.password === password) { if (values.username === username && values.password === password) {
router.push({ router.push({
path: "/investorRelated", path: "/layout/investorRelated",
}); });
} else { } else {
loading.value = false; loading.value = false;
...@@ -45,9 +46,9 @@ const handleLogin = ({values, errors}: { ...@@ -45,9 +46,9 @@ const handleLogin = ({values, errors}: {
} }
} }
}; };
const getImageUrl = (name: any) => { // const getImageUrl = (name: any) => {
return new URL(`../../assets/images/` + name + ".png", import.meta.url).href; // return new URL(`../../assets/images/` + name + ".png", import.meta.url).href;
}; // };
</script> </script>
<template> <template>
<div class="root"> <div class="root">
......
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-23 16:43:07
* @LastEditors: huyue
* @LastEditTime: 2024-07-24 17:23:08
-->
<template>
新闻
</template>
\ No newline at end of file \ No newline at end of file
{ {
"compilerOptions": { "compilerOptions": {
"baseUrl": ".", "baseUrl": "./",
"paths": {
"@/*": ["src/*"],
},
"target": "esnext", "target": "esnext",
"useDefineForClassFields": true, "useDefineForClassFields": true,
"module": "esnext", "module": "esnext",
...@@ -13,7 +16,7 @@ ...@@ -13,7 +16,7 @@
"esModuleInterop": true, "esModuleInterop": true,
"lib": ["esnext", "dom"], "lib": ["esnext", "dom"],
"skipLibCheck": true, "skipLibCheck": true,
"allowSyntheticDefaultImports": true "allowSyntheticDefaultImports": true,
}, },
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{ "path": "./tsconfig.node.json" }]
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* @Author: huyue * @Author: huyue
* @Date: 2022-10-10 10:54:14 * @Date: 2022-10-10 10:54:14
* @LastEditors: huyue * @LastEditors: huyue
* @LastEditTime: 2024-07-24 15:42:00 * @LastEditTime: 2024-07-25 11:09:38
*/ */
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue' import vue from '@vitejs/plugin-vue'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!