bug fix and performance improvements

This commit is contained in:
2023-07-20 11:47:32 +08:00
parent 0f582dec46
commit b2f3296717
14 changed files with 122 additions and 40 deletions

10
Caddyfile Normal file
View File

@ -0,0 +1,10 @@
:4173 {
handle_path /api/* {
reverse_proxy http://101.34.131.16:1618
}
handle {
root * "/Volumes/iMac Doc/WebstormProjects/cas_cloud_web/dist"
file_server
try_files {path} /
}
}

View File

@ -0,0 +1,9 @@
import request from "@/utils/request";
// /app/laboratory/statistic
export const getLaboratoryStatistic = () => {
return request({
url: "/app/laboratory/statistic",
method: "get",
});
};

View File

@ -0,0 +1,9 @@
import request from "@/utils/request";
// /app/research/statistic
export const getResearchStatistic = () => {
return request({
url: "/app/research/statistic",
method: "get",
});
};

View File

@ -2,14 +2,14 @@
<div class="webHead"> <div class="webHead">
<el-row> <el-row>
<el-col :span="5"> <el-col :span="5">
<img src="@/assets/logo/logo.png" class="logo" /> <img class="logo" src="@/assets/logo/logo.png" />
</el-col> </el-col>
<el-col :span="16"> <el-col :span="16">
<ul class="menu"> <ul class="menu">
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit"
:class="pagePath == '/' ? 'active' : ''" :class="pagePath == '/' ? 'active' : ''"
class="menu-item-tit"
@click="handlePath('/')" @click="handlePath('/')"
> >
首页 首页
@ -17,18 +17,18 @@
</li> </li>
<li class="menu-item1 solution"> <li class="menu-item1 solution">
<div <div
class="menu-item-tit"
:class="pagePath.indexOf('/solution/') != -1 ? 'active' : ''" :class="pagePath.indexOf('/solution/') != -1 ? 'active' : ''"
class="menu-item-tit"
> >
解决方案 解决方案
</div> </div>
<div class="show_box"> <div class="show_box">
<div <div
v-for="item in categoryList" v-for="item in categoryList"
class="pointer"
:class=" :class="
pagePath == `/solution/${item.id}` ? 'x_blue _active' : '' pagePath == `/solution/${item.id}` ? 'x_blue _active' : ''
" "
class="pointer"
@click="handlePath(`/solution/${item.id}?name=${item.name}`)" @click="handlePath(`/solution/${item.id}?name=${item.name}`)"
> >
{{ item.name }} {{ item.name }}
@ -73,8 +73,8 @@
</li> </li>
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit"
:class="pagePath == '/innovate' ? 'active' : ''" :class="pagePath == '/innovate' ? 'active' : ''"
class="menu-item-tit"
@click="handlePath('/innovate')" @click="handlePath('/innovate')"
> >
创新服务 创新服务
@ -82,8 +82,8 @@
</li> </li>
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit"
:class="pagePath == '/activity' ? 'active' : ''" :class="pagePath == '/activity' ? 'active' : ''"
class="menu-item-tit"
@click="handlePath('/activity')" @click="handlePath('/activity')"
> >
活动报名 活动报名
@ -91,8 +91,8 @@
</li> </li>
<li class="menu-item1"> <li class="menu-item1">
<div <div
class="menu-item-tit"
:class="pagePath == '/about' ? 'active' : ''" :class="pagePath == '/about' ? 'active' : ''"
class="menu-item-tit"
@click="handlePath('/about')" @click="handlePath('/about')"
> >
关于我们 关于我们
@ -101,8 +101,8 @@
<li class="menu-item1 profile-menu-group" style="display: flex"> <li class="menu-item1 profile-menu-group" style="display: flex">
<div <div
v-if="!userStore.avatar" v-if="!userStore.avatar"
class="menu-item-tit"
:class="pagePath == '/login' ? 'active' : ''" :class="pagePath == '/login' ? 'active' : ''"
class="menu-item-tit"
@click="handlePath('/login')" @click="handlePath('/login')"
> >
登录注册 登录注册
@ -117,23 +117,26 @@
<!-- content="this is content, this is content, this is content" --> <!-- content="this is content, this is content, this is content" -->
<!-- <template #reference> --> <!-- <template #reference> -->
<div v-else class="avatar-wrapper"> <div v-else class="avatar-wrapper">
<img :src="userStore.avatar" class="user-avatar" /> <img
:src="`${baseUrl}/file${userStore.avatar}`"
class="user-avatar"
/>
<i class="el-icon-caret-bottom" /> <i class="el-icon-caret-bottom" />
</div> </div>
<!-- </template> --> <!-- </template> -->
<!-- </el-popover> --> <!-- </el-popover> -->
<div <div
v-if="userStore.avatar" v-if="userStore.avatar"
class="menu-item-tit"
:class="pagePath == '/login' ? 'active' : ''" :class="pagePath == '/login' ? 'active' : ''"
class="menu-item-tit"
@click="handlePage" @click="handlePage"
> >
个人中心 个人中心
</div> </div>
<div <div
v-if="userStore.avatar" v-if="userStore.avatar"
class="menu-item-tit"
:class="pagePath == '/login' ? 'active' : ''" :class="pagePath == '/login' ? 'active' : ''"
class="menu-item-tit"
@click="logout" @click="logout"
> >
退出登录 退出登录
@ -169,7 +172,7 @@
<script setup> <script setup>
import { ElMessageBox } from "element-plus"; import { ElMessageBox } from "element-plus";
import { defineComponent, onMounted, reactive, watch } from "vue"; import { reactive, watch } from "vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import useUserStore from "@/store/modules/user"; import useUserStore from "@/store/modules/user";
@ -180,7 +183,7 @@ let state = reactive({});
let pagePath = ref(""); let pagePath = ref("");
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
const categoryList = ref([]); const categoryList = ref([]);
const loadCategoryList = async () => { const loadCategoryList = async () => {
const { data } = await getCategory(); const { data } = await getCategory();
@ -215,6 +218,7 @@ function handlePath(path) {
router.push(path); router.push(path);
// window.open(path, "_blank"); // window.open(path, "_blank");
} }
function logout() { function logout() {
ElMessageBox.confirm("确定注销并退出系统吗?", "提示", { ElMessageBox.confirm("确定注销并退出系统吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
@ -239,6 +243,7 @@ dl {
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
li, li,
dd, dd,
dt { dt {
@ -246,6 +251,7 @@ dt {
margin: 0; margin: 0;
list-style: none; list-style: none;
} }
.webHead { .webHead {
position: fixed; position: fixed;
z-index: 2001; z-index: 2001;
@ -257,15 +263,18 @@ dt {
box-sizing: border-box; box-sizing: border-box;
background: #ffffff; background: #ffffff;
box-shadow: 0px 0px 43px 0px rgba(0, 42, 255, 0.09); box-shadow: 0px 0px 43px 0px rgba(0, 42, 255, 0.09);
.logo { .logo {
height: 30px; height: 30px;
margin: 25px 0; margin: 25px 0;
} }
.menu { .menu {
display: flex; display: flex;
// justify-content: space-between; // justify-content: space-between;
.solution { .solution {
position: relative; position: relative;
.show_box { .show_box {
display: none; display: none;
position: absolute; position: absolute;
@ -273,6 +282,7 @@ dt {
width: 100%; width: 100%;
text-align: center; text-align: center;
background-color: red; background-color: red;
div { div {
// height: 42px; // height: 42px;
// line-height: 42px; // line-height: 42px;
@ -281,19 +291,23 @@ dt {
color: #666666; color: #666666;
background-color: #f2f6ff; background-color: #f2f6ff;
} }
._active { ._active {
background-color: #fff; background-color: #fff;
} }
} }
&:hover { &:hover {
.show_box { .show_box {
display: block; display: block;
} }
} }
} }
.menu-item1 { .menu-item1 {
flex: 1; flex: 1;
text-align: center; text-align: center;
.menu-item-tit { .menu-item-tit {
display: inline-block; display: inline-block;
padding: 25px 0; padding: 25px 0;
@ -303,6 +317,7 @@ dt {
color: #000; color: #000;
cursor: pointer; cursor: pointer;
} }
.menu-item-tit:hover { .menu-item-tit:hover {
opacity: 0.8; opacity: 0.8;
} }
@ -313,6 +328,7 @@ dt {
border-bottom: 2.5px solid #000; border-bottom: 2.5px solid #000;
} }
} }
.profile-menu-group { .profile-menu-group {
height: 71px; height: 71px;
flex: 2; flex: 2;

View File

@ -42,7 +42,12 @@
@command="handleCommand" @command="handleCommand"
> >
<div class="avatar-wrapper"> <div class="avatar-wrapper">
<img :src="userStore.avatar" class="user-avatar" /> <img
v-if="userStore.avatar"
:src="`${baseUrl}/file${userStore.avatar}`"
class="user-avatar"
/>
<img v-else :src="defAva" class="user-avatar" />
<el-icon> <el-icon>
<caret-bottom /> <caret-bottom />
</el-icon> </el-icon>
@ -75,6 +80,7 @@
<script setup> <script setup>
import UserAvatar from "@/views/system/user/profile/userAvatar.vue"; import UserAvatar from "@/views/system/user/profile/userAvatar.vue";
import defAva from "@/assets/logo/avatar.png";
import { ElMessageBox } from "element-plus"; import { ElMessageBox } from "element-plus";
import Breadcrumb from "@/components/Breadcrumb"; import Breadcrumb from "@/components/Breadcrumb";
import TopNav from "@/components/TopNav"; import TopNav from "@/components/TopNav";
@ -90,6 +96,7 @@ const appStore = useAppStore();
const userStore = useUserStore(); const userStore = useUserStore();
const settingsStore = useSettingsStore(); const settingsStore = useSettingsStore();
const avatarRef = ref(null); const avatarRef = ref(null);
const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
function toggleSideBar() { function toggleSideBar() {
appStore.toggleSideBar(); appStore.toggleSideBar();

View File

@ -1,7 +1,6 @@
import { login, logout, getInfo } from "@/api/login"; import { getInfo, login, logout } from "@/api/login";
import { getToken, setToken, removeToken } from "@/utils/auth"; import { getToken, removeToken, setToken } from "@/utils/auth";
// import defAva from "@/assets/images/profile.jpg"; // import defAva from "@/assets/images/profile.jpg";
import defAva from "@/assets/logo/avatar.png";
const useUserStore = defineStore("user", { const useUserStore = defineStore("user", {
state: () => ({ state: () => ({
@ -43,9 +42,9 @@ const useUserStore = defineStore("user", {
const enterprise = res.data.enterprise; const enterprise = res.data.enterprise;
const userId = user.userId; const userId = user.userId;
const avatar = const avatar =
user.avatar == "" || user.avatar == null /*user.avatar == "" || user.avatar == null
? defAva ? defAva
: import.meta.env.VITE_APP_BASE_API + user.avatar; :*/ user.avatar;
if (res.roles && res.roles.length > 0) { if (res.roles && res.roles.length > 0) {
// 验证返回的roles是否是一个非空数组 // 验证返回的roles是否是一个非空数组

View File

@ -1,5 +1,5 @@
<template> <template>
<el-row type="flex" style="padding: 40px 20px"> <el-row style="padding: 40px 20px" type="flex">
<div class="img"> <div class="img">
<el-image :src="data.image" alt /> <el-image :src="data.image" alt />
</div> </div>
@ -21,8 +21,9 @@
> >
</div> </div>
</div> </div>
<div class="keywords" style="flex: 1"> <div class="keywords" style="/*flex: 1; */ width: 360px">
<wordcloud <wordcloud
:width="360"
:data="createdData(data.keyword?.split(',') ?? [])" :data="createdData(data.keyword?.split(',') ?? [])"
></wordcloud> ></wordcloud>
</div> </div>
@ -32,7 +33,7 @@
<script setup> <script setup>
import wordcloud from "./wordcloud.vue"; import wordcloud from "./wordcloud.vue";
import { useRoute, useRouter } from "vue-router"; import { useRoute, useRouter } from "vue-router";
import { addViewHistory } from "@/utils/view_history";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const props = defineProps({ const props = defineProps({
@ -41,6 +42,7 @@ const props = defineProps({
required: true, required: true,
}, },
}); });
function createdData(arr) { function createdData(arr) {
let l = []; let l = [];
let snap = JSON.parse(JSON.stringify(arr)); let snap = JSON.parse(JSON.stringify(arr));
@ -50,6 +52,7 @@ function createdData(arr) {
}); });
return l; return l;
} }
function handleDetail(id) { function handleDetail(id) {
let routeData = router.resolve({ let routeData = router.resolve({
path: `/searchList/enterprise/detail/${id}`, path: `/searchList/enterprise/detail/${id}`,
@ -62,17 +65,22 @@ function handleDetail(id) {
} }
</script> </script>
<style scoped lang="scss"> <style lang="scss" scoped>
.img { .img {
width: 90px; width: 90px;
margin-right: 12px; margin-right: 12px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
:deep(.el-image) { :deep(.el-image) {
width: 90px; width: 90px;
height: 90px; height: 90px;
border-radius: 50%; border-radius: 50%;
} }
} }
.content {
flex: 1;
}
</style> </style>

View File

@ -2,7 +2,7 @@
<div class="wordcloud"> <div class="wordcloud">
<div <div
class="wordCloud__tagBall" class="wordCloud__tagBall"
:style="{ width: `${this.width}px`, height: `${this.height}px` }" :style="{ width: `${width}px`, height: `${height}px` }"
@mouseenter="stop" @mouseenter="stop"
@mouseleave="start" @mouseleave="start"
> >
@ -195,7 +195,7 @@ button {
top: 0px; top: 0px;
color: green; color: green;
text-decoration: none; text-decoration: none;
font-size: 12px; font-size: 16px;
font-family: "微软雅黑"; font-family: "微软雅黑";
font-weight: bold; font-weight: bold;
} }

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import StatisticsPanel from "@/views/components/StatisticsPanel.vue"; import StatisticsPanel from "@/views/components/StatisticsPanel.vue";
import { ref } from "vue"; import { ref } from "vue";
import { getLaboratoryStatistic } from "@/api/admin/laboratory/home";
const statisticsList = ref([ const statisticsList = ref([
{ {
@ -24,6 +25,14 @@ const statisticsList = ref([
unit: "篇", unit: "篇",
}, },
]); ]);
const loadLabStatisticsData = () => {
getLaboratoryStatistic().then((resp) => {
console.log(resp);
});
};
loadLabStatisticsData();
</script> </script>
<template> <template>

View File

@ -1,6 +1,7 @@
<script setup> <script setup>
import StatisticsPanel from "@/views/components/StatisticsPanel.vue"; import StatisticsPanel from "@/views/components/StatisticsPanel.vue";
import { ref } from "vue"; import { ref } from "vue";
import { getResearchStatistic } from "@/api/admin/research/home";
const statisticsList = ref([ const statisticsList = ref([
{ {
@ -24,6 +25,14 @@ const statisticsList = ref([
unit: "家", unit: "家",
}, },
]); ]);
const loadResearchStatisticsData = () => {
getResearchStatistic().then((resp) => {
console.log(resp);
});
};
loadResearchStatisticsData();
</script> </script>
<template> <template>

View File

@ -187,7 +187,7 @@ const props = defineProps({
}); });
const formRef = ref(); const formRef = ref();
const cityFormRef = ref(); // const cityFormRef = ref();
const fieldFormRef = ref(); const fieldFormRef = ref();
const keywordsFormRef = ref(); const keywordsFormRef = ref();
const directionsFormRef = ref(); const directionsFormRef = ref();
@ -255,13 +255,13 @@ const validateForm = async () => {
} catch (error) { } catch (error) {
formValid = false; formValid = false;
} }
const cityFormValid = await cityFormRef.value.validateForm(); // 城市选择表单验证 // const cityFormValid = await cityFormRef.value.validateForm(); // 城市选择表单验证
const fieldFormValid = await fieldFormRef.value.validateForm(); // 领域选择表单验证 const fieldFormValid = await fieldFormRef.value.validateForm(); // 领域选择表单验证
const keywordsFormValid = await keywordsFormRef.value.validateForm(); // 关键词表单验证 const keywordsFormValid = await keywordsFormRef.value.validateForm(); // 关键词表单验证
const directionsFormValid = await directionsFormRef.value.validateForm(); // 研究方向表单验证 const directionsFormValid = await directionsFormRef.value.validateForm(); // 研究方向表单验证
return ( return (
formValid && formValid &&
cityFormValid && // cityFormValid &&
fieldFormValid && fieldFormValid &&
keywordsFormValid && keywordsFormValid &&
directionsFormValid directionsFormValid

View File

@ -72,7 +72,9 @@ import { VueCropper } from "vue-cropper";
import useUserStore from "@/store/modules/user"; import useUserStore from "@/store/modules/user";
import { upload } from "@/api/common"; import { upload } from "@/api/common";
import { updateAvatar } from "@/api/login"; import { updateAvatar } from "@/api/login";
import defaultAvatar from "@/assets/logo/avatar.png";
const baseUrl = ref(import.meta.env.VITE_APP_BASE_API);
const userStore = useUserStore(); const userStore = useUserStore();
const { proxy } = getCurrentInstance(); const { proxy } = getCurrentInstance();
const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload"); const uploadImgUrl = ref(import.meta.env.VITE_APP_BASE_API + "/common/upload");
@ -82,7 +84,9 @@ const title = ref("修改头像");
//图片裁剪数据 //图片裁剪数据
const options = reactive({ const options = reactive({
img: userStore.avatar, // 裁剪图片的地址 img: userStore.avatar
? `${baseUrl.value}/file/${userStore.avatar}`
: defaultAvatar, // 裁剪图片的地址
autoCrop: true, // 是否默认生成截图框 autoCrop: true, // 是否默认生成截图框
autoCropWidth: 200, // 默认生成截图框宽度 autoCropWidth: 200, // 默认生成截图框宽度
autoCropHeight: 200, // 默认生成截图框高度 autoCropHeight: 200, // 默认生成截图框高度
@ -142,16 +146,16 @@ function uploadImg() {
upload(formData) upload(formData)
.then((uploadResp) => { .then((uploadResp) => {
console.log(uploadResp); console.log(uploadResp);
return uploadResp.url; return uploadResp.fileName;
}) })
.then((url) => { .then((fileName) => {
console.log(url); console.log(fileName);
updateAvatar({ updateAvatar({
avatar: url, avatar: fileName,
}); });
open.value = false; open.value = false;
options.img = url; options.img = `${baseUrl.value}/file/${fileName}`;
userStore.avatar = url; userStore.avatar = fileName;
proxy.$modal.msgSuccess("修改成功"); proxy.$modal.msgSuccess("修改成功");
visible.value = false; visible.value = false;
}); });
@ -172,7 +176,9 @@ function realTime(data) {
/** 关闭窗口 */ /** 关闭窗口 */
function closeDialog() { function closeDialog() {
options.img = userStore.avatar; options.img = userStore.avatar
? `${baseUrl.value}/file/${userStore.avatar}`
: defaultAvatar;
options.visible = false; options.visible = false;
} }

View File

@ -195,7 +195,7 @@ button {
top: 0px; top: 0px;
color: green; color: green;
text-decoration: none; text-decoration: none;
font-size: 12px; font-size: 16px;
font-family: "微软雅黑"; font-family: "微软雅黑";
font-weight: bold; font-weight: bold;
} }

View File

@ -31,9 +31,9 @@ export default defineConfig(({ mode, command }) => {
proxy: { proxy: {
// https://cn.vitejs.dev/config/#server-proxy // https://cn.vitejs.dev/config/#server-proxy
"/dev-api": { "/dev-api": {
target: "http://101.34.131.16:1618",
// target: "http://101.34.131.16:1618", // target: "http://101.34.131.16:1618",
// target: "http://101.34.131.16:1618", // target: "http://192.168.0.201:1618",
target: "http://192.168.0.201:1618",
// target: 'http://172.18.3.127:1618', // target: 'http://172.18.3.127:1618',
changeOrigin: true, changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, ""), rewrite: (p) => p.replace(/^\/dev-api/, ""),