From 14c8ee028aeba1956419dd0d5226a3393d81bc90 Mon Sep 17 00:00:00 2001
From: quantulr <35954003+quantulr@users.noreply.github.com>
Date: Mon, 11 Dec 2023 15:25:14 +0800
Subject: [PATCH] update
---
src/components/ImagePreview/index.vue | 28 +-
src/store/modules/user.js | 328 +++++++++---------
src/utils/uri.js | 9 +
src/views/website/siteSet/banner/index.vue | 227 ++++++------
src/views/website/solution/service/index.vue | 179 +++++-----
.../website/solution/serviceCase/index.vue | 3 +-
vite.config.js | 2 +-
7 files changed, 405 insertions(+), 371 deletions(-)
create mode 100644 src/utils/uri.js
diff --git a/src/components/ImagePreview/index.vue b/src/components/ImagePreview/index.vue
index f402470..a234edd 100644
--- a/src/components/ImagePreview/index.vue
+++ b/src/components/ImagePreview/index.vue
@@ -1,21 +1,24 @@
@@ -66,13 +69,16 @@ const realHeight = computed(() =>
border-radius: 5px;
background-color: #ebeef5;
box-shadow: 0 0 5px 1px #ccc;
+
:deep(.el-image__inner) {
transition: all 0.3s;
cursor: pointer;
+
&:hover {
transform: scale(1.2);
}
}
+
:deep(.image-slot) {
display: flex;
justify-content: center;
diff --git a/src/store/modules/user.js b/src/store/modules/user.js
index bc56801..9bd6560 100644
--- a/src/store/modules/user.js
+++ b/src/store/modules/user.js
@@ -1,179 +1,179 @@
-import { getInfo, login, logout } from "@/api/login";
-import { getToken, removeToken, setToken } 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 md5 from "js-md5";
-import { companyList } from "@/api/dataList/enterprise";
-import { expertList } from "@/api/expert/expert";
-import { listCasDemand } from "../../api/dataApproval/enterpriseServiceDemand";
-import { expertAchievementList } from "../../api/dataApproval/achivement";
-import { businessList } from "../../api/Businessneeds";
-import { enterpriseProductApprovalList } from "../../api/dataApproval/enterpriseProduct";
+import {companyList} from "@/api/dataList/enterprise";
+import {expertList} from "@/api/expert/expert";
+import {listCasDemand} from "../../api/dataApproval/enterpriseServiceDemand";
+import {expertAchievementList} from "../../api/dataApproval/achivement";
+import {businessList} from "../../api/Businessneeds";
+import {enterpriseProductApprovalList} from "../../api/dataApproval/enterpriseProduct";
import {
- getUnApprovalCount,
- resetUnApprovalCount,
+ getUnApprovalCount,
+ resetUnApprovalCount,
} from "../../api/dataApproval/count";
-import { casLaboratoryList } from "@/api/dataList/laboratory";
+import {casLaboratoryList} from "@/api/dataList/laboratory";
const useUserStore = defineStore("user", {
- state: () => ({
- token: getToken(),
- name: "",
- avatar: "",
- roles: [],
- permissions: [],
- unApprovedBusiness: 0,
- unApprovedExpert: 0,
- unApprovedAchivement: 0,
- unApprovedTechnology: 0,
- unApprovedService: 0,
- unApprovedProduct: 0,
- unApprovedLab: 0,
- serviceDemandTotal: 0,
- achievementTotal: 0,
- technologyTotal: 0,
- productTotal: 0,
- }),
- actions: {
- // 登录
- login(userInfo) {
- const username = userInfo.username.trim();
- const password = md5(userInfo.password);
- const code = userInfo.code;
- const uuid = userInfo.uuid;
- return new Promise((resolve, reject) => {
- login(username, password, code, uuid)
- .then((res) => {
- setToken(res.token);
- this.token = res.token;
- resolve();
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- // 获取用户信息
- getInfo() {
- return new Promise((resolve, reject) => {
- getInfo()
- .then((res) => {
- const user = res.user;
- const avatar =
- /* user.avatar == "" || user.avatar == null
- ? defAva
- : import.meta.env.VITE_APP_BASE_API + */user.avatar;
+ state: () => ({
+ token: getToken(),
+ name: "",
+ avatar: "",
+ roles: [],
+ permissions: [],
+ unApprovedBusiness: 0,
+ unApprovedExpert: 0,
+ unApprovedAchivement: 0,
+ unApprovedTechnology: 0,
+ unApprovedService: 0,
+ unApprovedProduct: 0,
+ unApprovedLab: 0,
+ serviceDemandTotal: 0,
+ achievementTotal: 0,
+ technologyTotal: 0,
+ productTotal: 0,
+ }),
+ actions: {
+ // 登录
+ login(userInfo) {
+ const username = userInfo.username.trim();
+ const password = md5(userInfo.password);
+ const code = userInfo.code;
+ const uuid = userInfo.uuid;
+ return new Promise((resolve, reject) => {
+ login(username, password, code, uuid)
+ .then((res) => {
+ setToken(res.token);
+ this.token = res.token;
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
+ },
+ // 获取用户信息
+ getInfo() {
+ return new Promise((resolve, reject) => {
+ getInfo()
+ .then((res) => {
+ const user = res.user;
+ const avatar =
+ !user.avatar
+ ? defAva
+ : import.meta.env.VITE_APP_BASE_API + user.avatar.substring(user.avatar.indexOf("/file"));
- if (res.roles && res.roles.length > 0) {
- // 验证返回的roles是否是一个非空数组
- this.roles = res.roles;
- this.permissions = res.permissions;
- } else {
- this.roles = ["ROLE_DEFAULT"];
- }
- this.name = user.userName;
- this.avatar = avatar;
- resolve(res);
- // return res;
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
+ if (res.roles && res.roles.length > 0) {
+ // 验证返回的roles是否是一个非空数组
+ this.roles = res.roles;
+ this.permissions = res.permissions;
+ } else {
+ this.roles = ["ROLE_DEFAULT"];
+ }
+ this.name = user.userName;
+ this.avatar = avatar;
+ resolve(res);
+ // return res;
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
+ },
- async getApprovalCount() {
- this.getUnApprovedBusiness();
- this.getUnApprovedExpert();
- this.getUnApprovedAchivement();
- this.getUnApprovedTechnology();
- this.getUnApprovedService();
- this.getUnApprovedProduct();
- this.getServiceDemandTotal();
- this.getAchievementTotal();
- this.getProductTotal();
- this.getTechnologyTotal();
- this.getUnApprovedLab();
- },
+ async getApprovalCount() {
+ this.getUnApprovedBusiness();
+ this.getUnApprovedExpert();
+ this.getUnApprovedAchivement();
+ this.getUnApprovedTechnology();
+ this.getUnApprovedService();
+ this.getUnApprovedProduct();
+ this.getServiceDemandTotal();
+ this.getAchievementTotal();
+ this.getProductTotal();
+ this.getTechnologyTotal();
+ this.getUnApprovedLab();
+ },
- async resetUnApproval(name, field) {
- await resetUnApprovalCount(name);
- this[field] = 0;
- },
+ async resetUnApproval(name, field) {
+ await resetUnApprovalCount(name);
+ this[field] = 0;
+ },
- async getUnApprovedBusiness() {
- const resp = await companyList({
- examineStatus: 0,
- pageSize: 1,
- pageNum: 10,
- });
- this.unApprovedBusiness = resp.total;
- },
- async getUnApprovedExpert() {
- const resp = await expertList({
- examineStatus: 0,
- pageSize: 1,
- pageNum: 10,
- });
- this.unApprovedExpert = resp.total;
- },
- async getUnApprovedAchivement() {
- const resp = await getUnApprovalCount("achievement");
- this.unApprovedAchivement = resp.data ?? 0;
- },
- async getUnApprovedTechnology() {
- const resp = await getUnApprovalCount("technology");
- this.unApprovedTechnology = resp.data ?? 0;
- },
- async getUnApprovedService() {
- const resp = await getUnApprovalCount("service");
- this.unApprovedService = resp.data ?? 0;
- },
- async getUnApprovedProduct() {
- const resp = await getUnApprovalCount("product");
- this.unApprovedProduct = resp.data ?? 0;
- },
+ async getUnApprovedBusiness() {
+ const resp = await companyList({
+ examineStatus: 0,
+ pageSize: 1,
+ pageNum: 10,
+ });
+ this.unApprovedBusiness = resp.total;
+ },
+ async getUnApprovedExpert() {
+ const resp = await expertList({
+ examineStatus: 0,
+ pageSize: 1,
+ pageNum: 10,
+ });
+ this.unApprovedExpert = resp.total;
+ },
+ async getUnApprovedAchivement() {
+ const resp = await getUnApprovalCount("achievement");
+ this.unApprovedAchivement = resp.data ?? 0;
+ },
+ async getUnApprovedTechnology() {
+ const resp = await getUnApprovalCount("technology");
+ this.unApprovedTechnology = resp.data ?? 0;
+ },
+ async getUnApprovedService() {
+ const resp = await getUnApprovalCount("service");
+ this.unApprovedService = resp.data ?? 0;
+ },
+ async getUnApprovedProduct() {
+ const resp = await getUnApprovalCount("product");
+ this.unApprovedProduct = resp.data ?? 0;
+ },
- async getServiceDemandTotal() {
- const resp = await listCasDemand();
- this.serviceDemandTotal = resp.total;
+ async getServiceDemandTotal() {
+ const resp = await listCasDemand();
+ this.serviceDemandTotal = resp.total;
+ },
+ async getAchievementTotal() {
+ const resp = await expertAchievementList();
+ this.achievementTotal = resp.total;
+ },
+ async getTechnologyTotal() {
+ const resp = await businessList();
+ this.technologyTotal = resp.total;
+ },
+ async getProductTotal() {
+ const resp = await enterpriseProductApprovalList();
+ this.productTotal = resp.total;
+ },
+ async getUnApprovedLab() {
+ const resp = await casLaboratoryList({
+ examineStatus: 0,
+ pageSize: 1,
+ pageNum: 10,
+ });
+ this.unApprovedBusiness = resp.total;
+ },
+ // 退出系统
+ logOut() {
+ return new Promise((resolve, reject) => {
+ logout(this.token)
+ .then(() => {
+ this.token = "";
+ this.roles = [];
+ this.permissions = [];
+ removeToken();
+ resolve();
+ })
+ .catch((error) => {
+ reject(error);
+ });
+ });
+ },
},
- async getAchievementTotal() {
- const resp = await expertAchievementList();
- this.achievementTotal = resp.total;
- },
- async getTechnologyTotal() {
- const resp = await businessList();
- this.technologyTotal = resp.total;
- },
- async getProductTotal() {
- const resp = await enterpriseProductApprovalList();
- this.productTotal = resp.total;
- },
- async getUnApprovedLab() {
- const resp = await casLaboratoryList({
- examineStatus: 0,
- pageSize: 1,
- pageNum: 10,
- });
- this.unApprovedBusiness = resp.total;
- },
- // 退出系统
- logOut() {
- return new Promise((resolve, reject) => {
- logout(this.token)
- .then(() => {
- this.token = "";
- this.roles = [];
- this.permissions = [];
- removeToken();
- resolve();
- })
- .catch((error) => {
- reject(error);
- });
- });
- },
- },
});
export default useUserStore;
diff --git a/src/utils/uri.js b/src/utils/uri.js
new file mode 100644
index 0000000..3a39fe4
--- /dev/null
+++ b/src/utils/uri.js
@@ -0,0 +1,9 @@
+export const resolveStaticUrl = (url) => {
+ const fileIndex = url.indexOf('/file')
+
+ if (fileIndex > 0) {
+ return `${import.meta.env.VITE_APP_BASE_API}/${url.substring(fileIndex)}`
+ } else {
+ return `${import.meta.env.VITE_APP_BASE_API}/file${url}`
+ }
+}
diff --git a/src/views/website/siteSet/banner/index.vue b/src/views/website/siteSet/banner/index.vue
index 0f9ccd8..3358208 100644
--- a/src/views/website/siteSet/banner/index.vue
+++ b/src/views/website/siteSet/banner/index.vue
@@ -1,11 +1,11 @@
搜索搜索
+
重置重置
+
@@ -61,24 +63,25 @@
新增新增
+
-
-
-
+
+
+
{{ row.multipleFlag === "1" ? "是" : "否" }}
@@ -86,10 +89,11 @@
-
+
-
+
{{ siteList.find((el) => el.id === row.tenantId)?.name || "无" }}
@@ -101,78 +105,81 @@
编辑编辑
+
删除删除
+
添加子节点添加子节点
+
删除删除
+
添加添加
+
-
+
-
+
-
+
是
@@ -223,9 +232,10 @@ import {
bannerEdit,
bannerDelete,
} from "@/api/website/siteSet";
-import { tenantSelect } from "@/api/subPlatform/tenant";
-import { reactive, toRefs } from "vue";
-import { ElMessage, ElMessageBox } from "element-plus";
+import {tenantSelect} from "@/api/subPlatform/tenant";
+import {reactive, toRefs} from "vue";
+import {ElMessage, ElMessageBox} from "element-plus";
+import {resolveStaticUrl} from "@/utils/uri";
const loading = ref(true); // 是否正在加载
const showSearch = ref(true); // 是否显示搜索栏
@@ -258,9 +268,9 @@ const data = reactive({
trigger: ["blur", "change"],
},
],
- local: [{ required: true, message: "所在位置不能为空", trigger: "change" }],
- title: [{ required: true, message: "数据名称不能为空", trigger: "blur" }],
- sizes: [{ required: true, message: "建议尺寸不能为空", trigger: "blur" }],
+ local: [{required: true, message: "所在位置不能为空", trigger: "change"}],
+ title: [{required: true, message: "数据名称不能为空", trigger: "blur"}],
+ // sizes: [{required: true, message: "建议尺寸不能为空", trigger: "blur"}],
images: [
{
required: true,
@@ -270,14 +280,14 @@ const data = reactive({
],
},
});
-const { queryParams, form, rules } = toRefs(data);
+const {queryParams, form, rules} = toRefs(data);
const filterLocal = (data, parentTitle, out) => {
data.forEach((item) => {
let title = item.title;
if (parentTitle != "") title = parentTitle + ">" + item.title;
- out.push({ title: title });
+ out.push({title: title});
if (item.children && item.children.length > 0) {
this.filterLocal(item.children, title, out);
@@ -344,15 +354,15 @@ const handleAdd = () => {
const querySearch = (queryString, cb) => {
let _restaurants = restaurants.value;
let results = queryString
- ? _restaurants.filter(createFilter(queryString))
- : _restaurants;
+ ? _restaurants.filter(createFilter(queryString))
+ : _restaurants;
// 调用 callback 返回建议列表的数据
cb(results);
};
const createFilter = (queryString) => {
return (restaurant) => {
return (
- restaurant.title.toLowerCase().indexOf(queryString.toLowerCase()) != -1
+ restaurant.title.toLowerCase().indexOf(queryString.toLowerCase()) != -1
);
};
};
@@ -377,7 +387,7 @@ const handleUpdate = (row) => {
// form.value.local = arr[0];
form.value.locals = arr[0];
for (let i = 1; i < arr.length; i++) {
- form.value.domains.push({ title: arr[i] });
+ form.value.domains.push({title: arr[i]});
}
showEditDialog.value = true;
title.value = "修改";
@@ -406,12 +416,13 @@ const submitForm = async () => {
/** 删除按钮操作 */
const handleDelete = (row) => {
ElMessageBox.confirm(`是否确认删除编号为${row.id}的数据项?`)
- .then(async () => {
- await bannerDelete(row.id);
- getList();
- ElMessage.success("删除成功");
- })
- .catch(() => {});
+ .then(async () => {
+ await bannerDelete(row.id);
+ getList();
+ ElMessage.success("删除成功");
+ })
+ .catch(() => {
+ });
};
getList();
getSiteList();
diff --git a/src/views/website/solution/service/index.vue b/src/views/website/solution/service/index.vue
index 6f43823..7ad79c4 100644
--- a/src/views/website/solution/service/index.vue
+++ b/src/views/website/solution/service/index.vue
@@ -1,30 +1,30 @@
-
+
搜索搜索
+
重置重置
+
@@ -62,30 +64,31 @@
新增新增
+
-
-
+
+
@@ -107,53 +110,55 @@
编辑编辑
+
删除删除
+
-
+
-
+