Commit c711b63a by 前端

Merge branch 'v1.0.0' into 'master'

上线合并

See merge request !1
2 parents dae358b6 34c0dae7
# 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/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
/* eslint-disable */
// @ts-nocheck
// Generated by unplugin-vue-components
// Read more: https://github.com/vuejs/core/pull/3399
export {}
/* prettier-ignore */
declare module 'vue' {
export interface GlobalComponents {
ASelectOption: typeof import('ant-design-vue/es')['SelectOption']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
SvgIcon: typeof import('./src/components/SvgIcon/index.vue')['default']
}
}
<!--
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2022-11-15 10:44:23
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title>官网后台</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
This diff could not be displayed because it is too large.
{
"name": "website-middleground",
"private": true,
"description": "官网内容管理后台",
"version": "1.0.0",
"license": "ISC",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview"
},
"dependencies": {
"@arco-plugins/vite-vue": "^1.4.5",
"axios": "^0.27.2",
"dayjs": "^1.11.12",
"echarts": "^5.4.0",
"js-md5": "^0.8.3",
"js-sha1": "^0.6.0",
"md5": "^2.3.0",
"pinia": "^2.0.17",
"pinia-plugin-persist": "^1.0.0",
"qs": "^6.11.0",
"sha1": "^1.1.1",
"tslib": "^2.4.0",
"vconsole": "^3.7.0",
"vue": "^3.2.25",
"vue-router": "^4.1.1",
"vuex": "^4.0.2"
},
"devDependencies": {
"@arco-design/web-vue": "^2.55.3",
"@types/node": "^18.6.3",
"@types/qs": "^6.9.7",
"@types/sha1": "^1.1.3",
"@vitejs/plugin-vue": "^2.3.3",
"postcss-loader": "^7.0.1",
"postcss-px-to-viewport": "^1.1.1",
"postcss-pxtorem": "^5.1.1",
"sass": "^1.53.0",
"sass-loader": "^13.0.2",
"typescript": "^4.7.4",
"vite": "^2.9.9",
"vite-plugin-style-import": "^1.4.1",
"vue-tsc": "^0.34.7"
},
"repository": {
"type": "git",
"url": "http://huyue@192.168.3.233:8090/glsx-business/website-middleground.git"
},
"author": "huyue"
}
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:59:01
* @LastEditors: huyue
* @LastEditTime: 2024-07-23 18:11:21
*/
module.exports = {
"plugins": {
// "postcss-pxtorem": {
// rootValue: 75, // 75 表示 750 设计稿,37.5 表示 37.5 表示 375 设计稿
// unitPrecision: 6, // 计算结果保留 6 位小数
// selectorBlackList: ['.no-rem', 'no-rem'], // 要忽略的选择器并保留为px
// propList: ['*'], // 可以从 px 更改为 rem 的属性 感叹号开头的不转化
// replace: true, // 转换成 rem 以后,不保留原来的 px 单位属性
// mediaQuery: true, // 允许在媒体查询中转换 px
// minPixelValue: 2, // 设置要替换的最小像素值
// // exclude: /node_modules/i // 排除 node_modules 文件(node_modules 内文件禁止转换)
// }
// 'postcss-px-to-viewport': {
// unitToConvert: "px", // 要转化的单位
// viewportWidth: 1440, // UI设计稿的宽度
// unitPrecision: 6, // 转换后的精度,即小数点位数
// propList: ["*"], // 指定转换的css属性的单位,*代表全部css属性的单位都进行转换
// viewportUnit: "vw", // 指定需要转换成的视窗单位,默认vw
// fontViewportUnit: "vw", // 指定字体需要转换成的视窗单位,默认vw selectorBlackList: ["wrap"], // 指定不转换为视窗单位的类名,
// minPixelValue: 2, // 默认值1,小于或等于1px则不进行转换
// mediaQuery: true, // 是否在媒体查询的css代码中也进行转换,默认false
// replace: true, // 是否转换后直接更换属性值
// exclude: [/node_modules/], // 设置忽略文件,用正则做目录名匹配
// }
}
}
\ No newline at end of file \ No newline at end of file
No preview for this file type
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-23 14:30:40
* @LastEditors: huyue
* @LastEditTime: 2024-07-24 20:38:54
-->
<template>
<router-view class />
</template>
<script lang="ts" setup></script>
<style>
.flex-grow {
flex-grow: 1;
}
</style>
//
// const modulesFiles = import.meta.globEager('./modules/*.ts')
// console.log(modulesFiles)
// const modules: any = {}
// for (const key in modulesFiles) {
// if (Object.prototype.hasOwnProperty.call(modulesFiles, key)) {
// modules[key.replace(/(\.\/modules\/|\.ts)/g, '')] = modulesFiles[key].default
// }
// }
// console.log(modules)
// export default modules
\ No newline at end of file \ No newline at end of file
// import request from "../../utils/request"
// const getList = ('/classify/getList', data)
// const getList = ( data: object ) => {
// return request({
// url: "/classify/getList",
// method: "get",
// data
// })
// }
// export default {
// getList
// }
\ No newline at end of file \ No newline at end of file
<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
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-24 17:47:51
* @LastEditors: huyue
* @LastEditTime: 2024-07-30 18:24:24
-->
<script lang="ts" setup>
import { inject, reactive } from 'vue'
import { useRouter } from 'vue-router';
// 获取全局对象
const global: any = inject("global");
const router = useRouter();
const userInfo = reactive({
account: '管理员'
})
const logout = () => {
router.replace({ path: '/login' })
console.log('退出登录')
}
const getImageUrl = (name: any) => {
return new URL(`./images/${name}.png`, global.$imgUrl).href;
};
</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
import { App } from '@vue/runtime-dom'
import Component from './index.vue'
export default {
install (app: App) {
app.component('SvgIcon', Component)
}
}
<template>
<svg :class="svgClass" aria-hidden="true" v-on="$attrs">
<use :xlink:href="iconName" />
</svg>
</template>
<script lang="ts">
import { defineComponent, computed } from 'vue'
interface Props {
iconClass: string
className: string
}
export default defineComponent({
name: 'SvgIcon',
props: {
iconClass: {
type: String,
required: true
},
className: {
type: String,
default: () => ''
}
},
setup(props: Props) {
const iconName = computed((): string => `#icon-${props.iconClass}`)
const svgClass = computed((): string => {
if (props.className) {
return 'svg-icon ' + props.className
} else {
return 'svg-icon'
}
})
console.log(props)
return {
iconName,
svgClass
}
}
})
</script>
<style scoped>
.svg-icon {
width: 1em;
height: 1em;
vertical-align: -0.15em;
fill: currentColor;
overflow: hidden;
}
</style>
/// <reference types="vite/client" />
declare module '*.vue' {
import type { DefineComponent } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
const component: DefineComponent<{}, {}, any>
export default component
}
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2024-07-24 14:55:03
*/
import { createApp } from 'vue'
import store from './store'
import router, { setupRouter } from './router'
import ArcoVue from '@arco-design/web-vue';
import App from './App.vue'
import fetchConfig from './utils/config'
import VConsole from 'vconsole'
// import 'assets/styles/common.scss'
import '@arco-design/web-vue/dist/arco.css';
const app = createApp(App)
let vConsole: object = {}
fetchConfig().then(res => {
app.provide('global', {
$imgUrl: 'https://img02.glsx.com.cn/weapp/resource/shuke/',
version: res.version
})
localStorage.setItem('config', JSON.stringify(res))
app.use(ArcoVue, {
// 用于改变使用组件时的前缀名称
componentPrefix: 'arco'
});
app.use(store)
setupRouter(app)
router.isReady().then(() => {
app.mount('#app')
})
// // if (res.vconsole) vConsole = new VConsole()
})
import { createRouter, createWebHashHistory } from 'vue-router'
import type { App } from 'vue'
import routes from './routes'
const routerHistory = createWebHashHistory()
// createWebHashHistory hash 路由
// createWebHistory history 路由
// createMemoryHistory 带缓存history路由
const router = createRouter({
history: routerHistory,
routes: routes
})
export function setupRouter(app: App<Element>) {
app.use(router)
}
export default router
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2024-07-25 17:29:46
*/
const staticRoutes = Object.freeze([
{
path: '/',
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: '投资者相关',
path: '/layout/investorRelated',
component: () => import('views/investorRelated/index.vue')
},
{
name: '新增公告',
path: '/layout/addInvnotice',
component: () => import('views/investorRelated/addInvnotice.vue'),
},
{
name: '新闻',
path: '/layout/news',
component: () => import('views/news/index.vue'),
}
]
},
])
export default staticRoutes
import { createPinia } from 'pinia'
import piniaPluginPersist from 'pinia-plugin-persist'
const store = createPinia()
store.use(piniaPluginPersist)
export default store
\ No newline at end of file \ No newline at end of file
import { defineStore } from 'pinia'
export const useUserStore = defineStore({
id: 'user',
state: () => ({
name: '',
sessionId: ''
}),
getters: {
getSession: state => {
if (!state.sessionId) {
state.sessionId = localStorage.getItem('sessionId') || ''
}
return state.sessionId
}
},
actions: {
updateSessionId(sessionId: string) {
this.sessionId = sessionId
localStorage.setItem('sessionId', sessionId)
},
logout() {
localStorage.removeItem('sessionId')
this.sessionId = ''
}
}
// persist: {
// enabled: true,
// strategies: [
// {
// key: 'sessionId',
// storage: localStorage,
// paths: ['sessionId']
// }
// ]
// }
})
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 11:37:11
* @LastEditors: huyue
* @LastEditTime: 2024-07-30 18:08:14
*/
/** 三个数字加一个逗号 */
const numAddSymbol = (val: number | string | undefined) => {
return val ? (val + '').replace(/\B(?=(?:\d{3})+\b)/g, ',') : 0
}
// 获取图片
const getImageUrl = (name: any) => {
return new URL(`/` + name + ".png", import.meta.url).href;
};
export {
numAddSymbol,
getImageUrl
}
\ No newline at end of file \ No newline at end of file
/*
* @Description: 配置
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2023-06-14 10:12:30
*/
const fetchConfig = function (isEnv = true) {
return window.fetch('https://config-center-backend.glsx.com.cn/glsxAdmin/config?moduleUrl=website-config').then(res => res.json())
}
// const $mockConfig = await fetchConfig()
export default fetchConfig
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-08-23 11:04:56
* @LastEditors: huyue
* @LastEditTime: 2024-07-29 16:14:07
*/
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'
// import { Toast } from 'vant';
import { Message } from '@arco-design/web-vue';
import qs from 'qs'
import { createSign } from './util'
const options: any = localStorage.getItem('config')
interface Config {
response: {
'code_key': string,
'code_success_value': 0,
'data_key': string,
'errId_logout_value': string,
'errId'?: string,
'code_error_value': string
},
request: {
baseURL: string
},
secret: string,
sign: object,
vconsole: boolean,
noSignAttr: Array<string>
}
const mockConfig: Config = JSON.parse(options)
const { response, request, sign, secret } = mockConfig
axios.defaults.baseURL = request.baseURL
// 配置新建一个axios 实例
const service: AxiosInstance = axios.create({
timeout: 50000,
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
}
})
// 添加请求拦截器
service.interceptors.request.use((config: AxiosRequestConfig) => {
let { data = {}, domain, noSignAttr = [] } = config
data = createSign(Object.assign({}, sign, data), secret, noSignAttr)
config.baseURL = mockConfig[domain].baseURL
if (config.method) {
const method = config.method.toLowerCase()
if (method == 'get') {
config.params = data
} else if (method == 'post') {
config.data = qs.stringify(data)
}
}
return config
}, (error: AxiosError) => {
Message.error(error)
return Promise.reject(error)
})
// 添加响应拦截器
service.interceptors.response.use((r: AxiosResponse) => {
const { data: res, config: { returnAll } } = r
console.log(r, '===')
const { code_key, code_success_value, data_key = 'data', errId = 'errId', code_error_value, errId_logout_value } = response
let codekey = Array.isArray(code_key) ? code_key.find(key => res.hasOwnProperty(key)) : code_key
let code = res[codekey]
let errValue = res[errId]
// 特殊的code处理,可以增加
switch (code + '') {
case code_success_value + '':
if (returnAll) return res
break
case code_error_value + '':
if (errValue && errValue == errId_logout_value) {
localStorage.removeItem('sessionId')
const [href] = window.location.href.split('/#/')
location.href = `${href}/#/login`
}
// Message(res.message)
break
default:
Message.error(res.message || res.msg || '出错了,请联系管理员')
// Toast(res.message || res.msg || '出错了,请联系管理员')
break
}
if (returnAll) return res
return res[data_key]
}, error => {
// Toast(error.message)
Message.error(error || '出错了,请联系管理员')
return Promise.reject(error)
})
export default service
\ No newline at end of file \ No newline at end of file
/*
* @Description:
* @Author: huyue
* @Date: 2022-08-23 11:04:56
* @LastEditors: huyue
* @LastEditTime: 2024-07-29 16:14:07
*/
import axios, {
AxiosInstance,
AxiosRequestConfig,
AxiosResponse,
AxiosError,
} from "axios";
// import { Toast } from 'vant';
import { Message } from "@arco-design/web-vue";
import qs from "qs";
import { createSign } from "./util";
const options: any = localStorage.getItem("config");
interface Config {
response: {
code_key: string;
code_success_value: 0;
data_key: string;
errId_logout_value: string;
errId?: string;
code_error_value: string;
};
request: {
baseURL: string;
};
secret: string;
sign: object;
sign_file: object;
vconsole: boolean;
noSignAttr: Array<string>;
}
const mockConfig: Config = JSON.parse(options);
const { response, request, sign_file, secret } = mockConfig;
axios.defaults.baseURL = request.baseURL;
// 配置新建一个axios 实例
const service: AxiosInstance = axios.create({
timeout: 50000,
withCredentials: true,
headers: {
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
},
});
// 添加请求拦截器
service.interceptors.request.use(
(config: AxiosRequestConfig) => {
let { data = {}, domain, noSignAttr = [] } = config;
data = createSign(
Object.assign({}, sign_file, data),
secret,
noSignAttr,
"md5"
);
config.baseURL = mockConfig[domain].baseURL;
if (config.method) {
const method = config.method.toLowerCase();
if (method == "get") {
config.params = data;
} else if (method == "post") {
config.data = qs.stringify(data);
}
}
return config;
},
(error: AxiosError) => {
Message.error(error);
return Promise.reject(error);
}
);
// 添加响应拦截器
service.interceptors.response.use(
(r: AxiosResponse) => {
const {
data: res,
config: { returnAll },
} = r;
console.log(r, "===");
const {
code_key,
code_success_value,
data_key = "data",
errId = "errId",
code_error_value,
errId_logout_value,
} = response;
let codekey = Array.isArray(code_key)
? code_key.find((key) => res.hasOwnProperty(key))
: code_key;
let code = res[codekey];
let errValue = res[errId];
// 特殊的code处理,可以增加
switch (code + "") {
case code_success_value + "":
if (returnAll) return res;
break;
case code_error_value + "":
if (errValue && errValue == errId_logout_value) {
localStorage.removeItem("sessionId");
const [href] = window.location.href.split("/#/");
location.href = `${href}/#/login`;
}
// Message(res.message)
break;
default:
Message.error(res.message || res.msg || "出错了,请联系管理员");
// Toast(res.message || res.msg || '出错了,请联系管理员')
break;
}
if (returnAll) return res;
return res[data_key];
},
(error) => {
// Toast(error.message)
Message.error(error || "出错了,请联系管理员");
return Promise.reject(error);
}
);
export default service;
/*
* @Description:
* @Author: huyue
* @Date: 2022-12-06 16:17:36
* @LastEditors: huyue
* @LastEditTime: 2024-07-29 15:40:03
*/
import http from "./http";
import http_file from "./http_file";
import { useUserStore } from "../store/user";
const PATH = "rop-sk-gw/router";
const UPLOADPATH = "/router";
// const UPLOADPATH = 'rop-scrm-carlife/router'
const req: any = (
url: string,
data: any = {},
returnAll = false,
method = "POST"
) => {
data.method = url;
const options = {
domain: "request",
url: PATH,
method,
data,
returnAll,
};
return http(options);
};
const uploadReq = (
url: string,
data: any = {},
returnAll = false,
method = "POST",
noSignAttr = ["file"]
) => {
console.log(noSignAttr);
data.method = url;
const options = {
domain: "uploadRequest",
url: UPLOADPATH,
method,
data,
returnAll,
noSignAttr,
};
return http(options);
};
const uploadFile = (
url: "",
data: any = {},
returnAll = false,
method = "POST",
noSignAttr = ["file"]
) => {
console.log(noSignAttr);
data.method = url;
const options = {
domain: "uploadRequest",
url: "/router?method=glsx.accounts.biz.common.pictureUpload",
method,
data,
returnAll,
noSignAttr,
};
return http_file(options);
};
export { req, uploadReq, uploadFile };
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2024-07-29 10:07:19
*/
import sha1 from "sha1";
import qs from "qs";
import md5 from "js-md5";
export const Util = {
createSign: function (
params: object,
secret: string,
noSignAttr = [],
way = "sha1"
) {
delete params.sign;
params.timestamp = new Date().getTime();
var strQs = qs.stringify(params, {
arrayFormat: "indices",
allowDots: true,
encodeValuesOnly: true,
});
const objQs = strQs.split("&");
const collect = objQs.reduce((collect: any, item) => {
let [key, value] = item.split("=");
if (value === null) {
value = "";
} else if (typeof value === "object") {
value = JSON.stringify(value);
}
collect[key] = decodeURIComponent(value);
return collect;
}, {});
const keys = Object.keys(collect).sort();
const str = keys.reduce((col, key) => {
if (!noSignAttr.includes(key)) {
col.push(key, collect[key]);
}
return col;
}, []);
collect.sign = { sha1, md5 }
[way](secret + str.join("") + secret)
.toUpperCase();
return collect;
},
rgb: function () {
//rgb颜色随机
const r = Math.floor(Math.random() * 256);
const g = Math.floor(Math.random() * 256);
const b = Math.floor(Math.random() * 256);
return `rgb(${r},${g},${b})`;
},
};
export const createSign = Util.createSign;
export default Util;
export interface DataInfo {
[property: string]: any;
}
\ No newline at end of file \ No newline at end of file
<script lang="ts" setup>
import { useRouter, useRoute } from "vue-router";
import { reactive, onMounted, toRefs } from 'vue'
import { DataInfo } from "./addInterface";
import AddForm from "./components/AddForm.vue";
let route = useRoute()
let { query } = toRefs(route)
const router = useRouter();
const form = reactive<Partial<DataInfo>>({
name: ''
})
const back = () => {
router.go(-1)
}
/** 提交表单 */
const handleSubmit = () => {
console.log(form)
}
</script>
<template>
<a-breadcrumb>
<a-breadcrumb-item class="back" @click="back">投资者相关</a-breadcrumb-item>
<a-breadcrumb-item>{{query.id ? '编辑' : '新增'}}公告</a-breadcrumb-item>
</a-breadcrumb>
<div class="add-box">
<a-page-header :style="{ background: 'var(--color-bg-2)' }" :title="`${query.id ? '编辑' : '新增'}公告`" :show-back="false"></a-page-header>
<div class="form">
<AddForm></AddForm>
</div>
</div>
</template>
<style lang="scss" scoped>
.add-box {
margin-top: 12px;
background-color: #fff;
.form {
border-top: 1px solid #E6E8EB;
padding: 24px;
}
}
</style>
<style lang="scss">
.back {
&:hover {
cursor: pointer;
color: #195FFE;
}
}
</style>
\ No newline at end of file \ No newline at end of file
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-23 16:43:07
* @LastEditors: huyue
* @LastEditTime: 2024-08-02 11:12:39
-->
<script lang="ts" setup>
import { h, reactive, inject } from "vue";
import { useRouter } from "vue-router";
import { DataInfo, TableItem, BasicItem } from "./interface";
import { req } from "../../utils/request";
import { Message } from "@arco-design/web-vue";
const router = useRouter();
// 获取全局对象
const global: any = inject("global");
const data = reactive<Partial<DataInfo>>({
tabList: [],
tableData: [],
currentId: '0',
total: 0,
page: {
pageNum: 1,
pageSize: 10
},
imgVisible: false,
imgUrl: ''
})
/** table列配置 */
const columns = [
{
title: "标题",
dataIndex: "zhTitle",
width: '320',
ellipsis: true,
tooltip: true
},
{
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 ? externalReleaseDate : '--'}`)
]),
h('div', { class: 'expand-item' }, [
h('span', { class: 'title span-title' }, '简体:'),
h('span', { class: 'span-content'}, `${_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 span-title' }, '繁体:'),
h('span', { class: 'span-content'}, `${_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 span-title' }, '英文:'),
h('span', { class: 'span-content'}, `${_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);
},
});
/** 新增公告 */
const addInvnotice = () => {
router.push({
path: "/layout/addInvnotice",
});
}
/** 切换公告,参数类型 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 getImageUrl = (name: any) => {
return new URL(`./images/${name}.png`, global.$imgUrl).href;
};
/** 操作类 */
const publishOrDown = async(record: Partial<TableItem>) => {
const { id, systemPublishStatus } = record
const res = await req("gw.api.invnotice.updateStatus", {
id,
systemPublishStatus: systemPublishStatus === 3 ? 1 : 3
})
Message.success(`${systemPublishStatus === 3 ? '下架' : '发布'}成功`) // 没有发布时,若添加发布功能,需修改此处
getTableData()
}
const edit = (record: Partial<TableItem>) => {
router.push({
path: "/layout/addInvnotice",
query: {
id: record?.id
}
});
}
const previewOA = (record: Partial<TableItem>) => {
if (record?.oaScreenshotUrl) {
data.imgVisible = true
data.imgUrl = record?.oaScreenshotUrl
} else {
Message.warning('暂无该数据')
}
}
// 接口定义、调用
const getList = async () => {
const res = await req("gw.api.invnotice.findAllTypeByLanguageCode")
res.unshift({
gwInvnoticeTypeId: '0',
description: "全部公告"
})
data.tabList = 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>
<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" @click="addInvnotice">新增公告</a-button>
</template>
<a-tab-pane v-for="item in data.tabList" :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-popconfirm :content="`是否确认${record.systemPublishStatus === 3 ? '下架' : '发布'}`" @ok="publishOrDown(record)">
<!-- <a-button type="text" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">发布</a-button> -->
<a-button type="text" v-if="record.systemPublishStatus === 3">下架</a-button>
</a-popconfirm>
<a-button type="text" @click="edit(record)" v-if="record.systemPublishStatus === 1 || record.systemPublishStatus === 2">编辑</a-button>
<a-button type="text" @click="previewOA(record)">OA截图</a-button>
<a-image-preview
:src="data.imgUrl"
v-model:visible="data.imgVisible"
/>
</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>
<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;
}
.span-title {
display: inline-block;
width: 50px;
}
.span-content {
display: inline-block;
max-width: calc(100% - 90px);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.pdf-link {
width: 24px;
height: 16px;
}
.pdf {
margin-left: 8px;
width: 16px;
height: 16px;
}
}
</style>
export interface TabItem {
gwInvnoticeTypeId: String;
description: String;
}
export interface Page {
pageNum: Number;
pageSize: Number
}
export interface BasicItem {
id: Number;
gwInvnoticeProductId: Number;
[property: string]: any;
}
export interface DataInfo {
tabList: TabItem[];
tableData: TableItem[]; // 表格数据
currentId?: Number | String;
total: Number;
page: Page;
imgVisible: Boolean;
imgUrl: String;
}
export interface TableItem {
id: Number;
gwInvnoticeTypeId: Number;
gwInvnoticeTypeName: String;
zhTitle: String;
modifiedAt?: String;
invnoticeProductTranslationsList: Partial<BasicItem>[],
externalReleaseDate: String;
zhTag: String;
oaScreenshotUrl: String;
systemPublishStatus: Number;
}
<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
<!--
* @Description:
* @Author: huyue
* @Date: 2024-07-23 16:28:15
* @LastEditors: huyue
* @LastEditTime: 2024-07-30 18:25:37
-->
<script lang="ts" setup>
import {ref, reactive, inject} from 'vue'
import { useRouter } from "vue-router";
import { ValidatedError } from '@arco-design/web-vue';
import { Message } from '@arco-design/web-vue';
const router = useRouter();
// 获取全局对象
const global: any = inject("global");
/**
* 变量定义
*/
const loading = ref(false);
const userData = {
username: 'admin',
password: '@32%weGL'
}
const userInfo = reactive({
username: '',
password: ''
})
const usernameValidator = (value: string | undefined, callback: (error?: string) => void) => {
const rule = /^[\w\.\-]{5,20}$/
if (value && !rule.test(value)) {
callback(new Error())
} else {
callback()
}
}
const passwordValidator = (value: string | undefined, callback: (error?: string) => void) => {
const rule = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[!@#$%^&*])[\w!@#$%^&*]{6,20}$/
if (value && !rule.test(value)) {
callback(new Error())
} else {
}
}
/**
* 方法定义
*/
const handleLogin = ({values, errors}: {
errors: Record<string, ValidatedError> | undefined;
values: Record<string, any>;
}) => {
console.log(values, errors);
if (loading.value) return;
if (!errors) {
loading.value = true;
const { username, password } = userData;
if (values.username === username && values.password === password) {
router.push({
path: "/layout/investorRelated",
});
} else {
loading.value = false;
Message.error('用户名或密码错误')
}
}
};
const getImageUrl = (name: any) => {
return new URL(`./images/${name}.png`, global.$imgUrl).href;
};
</script>
<template>
<div class="root">
<div class="left">
<a-image class="logo" width="140" :src="getImageUrl('logo')" :preview="false" />
<!-- <a-image width="890" :src="getImageUrl('bg')" :preview="false" /> -->
<div class="bg">
<img :src="getImageUrl('bg')" alt="">
</div>
</div>
<div class="right">
<div class="title">广联官网管理平台</div>
<a-form size="large" :model="userInfo" :style="{ width: '374px' }" @submit="handleLogin">
<a-form-item field="username" max-length="20" hide-label :rules="[{ required: true, message: '请输入用户名' },
{ validator: usernameValidator, message: '用户名必须是5-20个字符,包含字母、数字、下划线和点' }]"
:validate-trigger="['change', 'blur']">
<a-input v-model="userInfo.username" :max-length="20" class="input" placeholder="用户名" allow-clear>
<template #prefix>
<icon-user />
</template>
</a-input>
</a-form-item>
<a-form-item field="password" hide-label :rules="[{ required: true, message: '请输入密码' },
{ validator: passwordValidator, message: '用户名必须是6-20个字符,包含字母、数字和特殊字符' }]"
:validate-trigger="['change', 'blur']">
<a-input-password v-model="userInfo.password" :max-length="20" class="input" placeholder="密码" allow-clear>
<template #prefix>
<icon-lock />
</template>
</a-input-password>
</a-form-item>
<a-form-item hide-label>
<a-button class="login-btn" :loading="loading" long type="primary" html-type="submit">登录</a-button>
</a-form-item>
</a-form>
</div>
</div>
</template>
<style lang="scss" scoped>
.root {
display: flex;
width: 100vw;
height: 100vh;
background-color: #f0f3fa;
overflow: hidden;
.left {
width: 61.81%;
display: flex;
flex-direction: column;
.logo {
margin-top: 24px;
margin-left: 48px;
}
}
.right {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
background-color: #fff;
padding-left: 88px;
.title {
font-weight: 500;
font-size: 32px;
color: #333333;
line-height: 44px;
margin-bottom: 38px;
}
.input {
height: 56px;
}
.arco-form-item {
padding-bottom: 32px;
}
}
}
.bg {
width: 61.81%;
height: 75.56%;
img {
widows: 100%;
height: 100%;
}
}
</style>
<!--
* @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": {
"baseUrl": "./",
"paths": {
"@/*": ["src/*"],
},
"target": "esnext",
"useDefineForClassFields": true,
"module": "esnext",
"moduleResolution": "Node",
"strict": true,
"jsx": "preserve",
"sourceMap": true,
"resolveJsonModule": true,
"isolatedModules": true,
"esModuleInterop": true,
"lib": ["esnext", "dom"],
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
"references": [{ "path": "./tsconfig.node.json" }]
}
{
"compilerOptions": {
"composite": true,
"module": "esnext",
"moduleResolution": "node"
},
"include": ["vite.config.ts"]
}
/*
* @Description:
* @Author: huyue
* @Date: 2022-10-10 10:54:14
* @LastEditors: huyue
* @LastEditTime: 2024-07-30 17:12:02
*/
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { vitePluginForArco } from '@arco-plugins/vite-vue'
import * as path from 'path'
const resolve = (dir: string) => path.join(__dirname, dir)
// https://vitejs.dev/config/
export default defineConfig({
base: './',
plugins: [
vue(),
vitePluginForArco({
style: 'css'
})
],
resolve: {
alias: {
'@': resolve('src'),
comps: resolve('src/components'),
apis: resolve('src/apis'),
views: resolve('src/views'),
routes: resolve('src/routes'),
assets: resolve('src/assets'),
utils: resolve('src/utils')
}
},
server: {
// 服务器主机名
host: '0.0.0.0',
// 端口号
port: 3000,
// 设为true时 端口已被占用则会直接退出,而不是尝试下一个可用端口
strictPort: false,
// 服务器启动时自动在浏览器中打开应用程序,当此值为字符串时,会被用作URL的路径名
open: false,
// 自定义代理规则
proxy: {
'/api': {
target: 'http://192.168.1.68:7001',
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '')
}
}
},
// build: {
// target:['edge90','chrome90','firefox90','safari15']
// }
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!