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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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