Merge branch 'gst4base' of http://182.92.169.222:3000/zhc077/hnjd_comp into gst4base

gst4base
JayChou 2 months ago
commit 32f80d0c05
  1. 180
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/controller/AwardPersionController.java
  2. 2
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/awardpersion/entity/AwardPersion.java
  3. 16
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/controller/TeamSeqController.java
  4. 2
      jeecg-boot-master/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/teamseq/service/impl/TeamSeqServiceImpl.java
  5. 8
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/sysconfiguration/controller/SysConfigurationController.java
  6. 3
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/sysconfiguration/mapper/SysConfigurationMapper.java
  7. 1
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/sysconfiguration/service/ISysConfigurationService.java
  8. 8
      jeecg-boot-master/jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/sysconfiguration/service/impl/SysConfigurationServiceImpl.java
  9. 2
      jeecgboot-vue3-master/index.html
  10. 14446
      jeecgboot-vue3-master/pnpm-lock.yaml
  11. 10
      jeecgboot-vue3-master/src/App.vue
  12. 4
      jeecgboot-vue3-master/src/components/Application/src/AppLogo.vue
  13. 9
      jeecgboot-vue3-master/src/hooks/setting/index.ts
  14. 35
      jeecgboot-vue3-master/src/store/modules/useSettingStore.ts
  15. 161
      jeecgboot-vue3-master/vite.config.ts

@ -459,8 +459,184 @@ public class AwardPersionController extends JeecgController<AwardPersion, IAward
//@RequiresPermissions("awardpersion:award_persion:exportXls") //@RequiresPermissions("awardpersion:award_persion:exportXls")
@RequestMapping(value = "/exportXls") @RequestMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, AwardPersion awardPersion) { public ModelAndView exportXls(HttpServletRequest request, AwardPersion awardPersion) {
return super.exportXls(request, awardPersion, AwardPersion.class, "获奖管理");
} //逻辑变动:奖项管理针对学生(上传证书和查询),组委会(全部都可以),学院(上传和查询),学校(教务处)(全部都可以),做一下数据筛选以及操作列权限
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<SysRole> sysRoleList = sysUserRoleService.getUserRoleByUserId(user.getId());
if(sysRoleList.get(0).getId().equals("1724327596426760194")){
//学生(上传证书和查询)(根据学号查询筛选)
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap());
queryWrapper.eq("studentcode",sysUserService.getById(user.getId()).getWorkNo());
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
// Step.2 获取导出数据
List<AwardPersion> exportList = awardPersionService.list(queryWrapper);
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理");
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.class);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams("获奖管理" + "报表", "导出人:" + user.getRealname(), "获奖管理");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}else if(sysRoleList.get(0).getId().equals("1693451972151386114")){
//组委会(全部都可以)(根据比赛负责人查询比赛id筛选)
Comp comp = new Comp();
QueryWrapper<Comp> queryWrappercomp = QueryGenerator.initQueryWrapper(comp, request.getParameterMap());
queryWrappercomp.eq("comp_admin",user.getUsername());
if(awardPersion.getComType()!=null){
queryWrappercomp.eq("comp_type_id",awardPersion.getComType());
}
List<Comp> list = compService.list(queryWrappercomp);
if(list.size()==0){
return null;
/* if(awardPersion.getComType()==null){
return Result.error("未绑定比赛");
}else {
return Result.error("未绑定该比赛类型的比赛");
}*/
}
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList());
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>();
queryWrapperAnnual.in("compid",ids);
List<AnnualComp> listAnnual = annualCompService.list(queryWrapperAnnual);
if(listAnnual.size()==0){
/*return Result.error("未创建年度比赛");*/
return null;
}
List<String> annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList());
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap());
queryWrapper.in("annal_comp",annualIds);
AnnualCompPoint annualCompPoint = new AnnualCompPoint();
QueryWrapper<AnnualCompPoint> queryWrapperacp = QueryGenerator.initQueryWrapper(annualCompPoint, request.getParameterMap());
queryWrapperacp.in("annual_comp_id",annualIds);
queryWrapperacp.eq("annual_comp_switch","Y"); // 比赛必须是开启的
if(awardPersion.getObjLevel()!=null){
queryWrapperacp.eq("obj_level",awardPersion.getObjLevel());
}
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp);
if(listacp.size()==0){
/*if(awardPersion.getObjLevel()==null){
return Result.error("未创建年度比赛项目");
}else {
return Result.error("未创建该项目层次的年度比赛项目");
}*/
return null;
}
List<String> acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList());
queryWrapper.in("annual_comp_p",acpIds);
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
// Step.2 获取导出数据
List<AwardPersion> exportList = awardPersionService.list(queryWrapper);
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理");
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.class);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams("获奖管理" + "报表", "导出人:" + user.getRealname(), "获奖管理");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}else if(sysRoleList.get(0).getId().equals("1693452352310517762")){
//学院(上传和查询)(根据部门查询数据,该学院下所有学生的获奖信息)
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap());
queryWrapper.eq("studentorg",sysDepartService.queryDepartsByUsername(user.getUsername()).get(0).getId());
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id",selectionList);
}
// Step.2 获取导出数据
List<AwardPersion> exportList = awardPersionService.list(queryWrapper);
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理");
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.class);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams("获奖管理" + "报表", "导出人:" + user.getRealname(), "获奖管理");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS,exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}else {
//学校和超级管理员(全部都可以)(查全部数据)
QueryWrapper<AwardPersion> queryWrapper = QueryGenerator.initQueryWrapper(awardPersion, request.getParameterMap());
if (awardPersion.getComType() != null) {
QueryWrapper<Comp> queryWrappercomp = new QueryWrapper<>();
queryWrappercomp.eq("comp_type_id", awardPersion.getComType());
List<Comp> list = compService.list(queryWrappercomp);
if (list.size() == 0) {
return null;
}
List<String> ids = list.stream().map(Comp::getId).collect(Collectors.toList());
QueryWrapper<AnnualComp> queryWrapperAnnual = new QueryWrapper<>();
queryWrapperAnnual.in("compid", ids);
List<AnnualComp> listAnnual = annualCompService.list(queryWrapperAnnual);
if (listAnnual.size() == 0) {
return null;
}
List<String> annualIds = listAnnual.stream().map(AnnualComp::getId).collect(Collectors.toList());
queryWrapper.in("annal_comp", annualIds);
}
if (awardPersion.getObjLevel() != null) {
QueryWrapper<AnnualCompPoint> queryWrapperacp = new QueryWrapper<>();
queryWrapperacp.eq("obj_level", awardPersion.getObjLevel());
List<AnnualCompPoint> listacp = annualCompPointService.list(queryWrapperacp);
if (listacp.size() == 0) {
return null;
}
List<String> acpIds = listacp.stream().map(AnnualCompPoint::getId).collect(Collectors.toList());
queryWrapper.in("annual_comp_p", acpIds);
}
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
queryWrapper.in("id", selectionList);
}
// Step.2 获取导出数据
List<AwardPersion> exportList = awardPersionService.list(queryWrapper);
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
//此处设置的filename无效 ,前端会重更新设置一下
mv.addObject(NormalExcelConstants.FILE_NAME, "获奖管理");
mv.addObject(NormalExcelConstants.CLASS, AwardPersion.class);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams = new ExportParams("获奖管理" + "报表", "导出人:" + user.getRealname(), "获奖管理");
exportParams.setImageBasePath(jeecgBaseConfig.getPath().getUpload());
//update-end--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置----------------------
mv.addObject(NormalExcelConstants.PARAMS, exportParams);
mv.addObject(NormalExcelConstants.DATA_LIST, exportList);
return mv;
}
}
/** /**
* 奖项推荐导出excel * 奖项推荐导出excel

@ -118,7 +118,7 @@ public class AwardPersion implements Serializable {
private String sczs; private String sczs;
/**推荐*/ /**推荐*/
@Excel(name = "是否推荐", width = 15, dicCode = "yn") //@Excel(name = "是否推荐", width = 15, dicCode = "yn")
@Dict(dicCode = "yn") @Dict(dicCode = "yn")
@ApiModelProperty(value = "推荐") @ApiModelProperty(value = "推荐")
private String tj; private String tj;

@ -77,14 +77,14 @@ public class TeamSeqController extends JeecgController<TeamSeq, ITeamSeqService>
* @param teamSeq * @param teamSeq
* @return * @return
*/ */
@AutoLog(value = "团队赛队员积分计算配置-添加") // @AutoLog(value = "团队赛队员积分计算配置-添加")
@ApiOperation(value = "团队赛队员积分计算配置-添加", notes = "团队赛队员积分计算配置-添加") // @ApiOperation(value = "团队赛队员积分计算配置-添加", notes = "团队赛队员积分计算配置-添加")
// @RequiresPermissions("teamseq:team_seq:add") //// @RequiresPermissions("teamseq:team_seq:add")
@PostMapping(value = "/add") // @PostMapping(value = "/add")
public Result<String> add(@RequestBody TeamSeq teamSeq) { // public Result<String> add(@RequestBody TeamSeq teamSeq) {
teamSeqService.save(teamSeq); // teamSeqService.save(teamSeq);
return Result.OK("添加成功!"); // return Result.OK("添加成功!");
} // }
@AutoLog(value = "团队赛队员积分计算配置-添加") @AutoLog(value = "团队赛队员积分计算配置-添加")
@ApiOperation(value = "团队赛队员积分计算配置-添加", notes = "团队赛队员积分计算配置-添加") @ApiOperation(value = "团队赛队员积分计算配置-添加", notes = "团队赛队员积分计算配置-添加")

@ -28,7 +28,7 @@ public class TeamSeqServiceImpl extends ServiceImpl<TeamSeqMapper, TeamSeq> impl
} }
String pointId = list.get(0).getPointId(); String pointId = list.get(0).getPointId();
if (StrUtil.isEmpty(pointId)) { if (StrUtil.isEmpty(pointId)) {
throw new JeecgBootException("比赛项目不能为空!"); throw new JeecgBootException("比赛项目未创建完成,请在编辑操作中配置!");
} }
this.remove(new LambdaQueryWrapper<TeamSeq>().eq(TeamSeq::getPointId, pointId)); this.remove(new LambdaQueryWrapper<TeamSeq>().eq(TeamSeq::getPointId, pointId));

@ -173,4 +173,12 @@ public class SysConfigurationController extends JeecgController<SysConfiguration
return super.importExcel(request, response, SysConfiguration.class); return super.importExcel(request, response, SysConfiguration.class);
} }
//提取获取数据
@AutoLog(value = "系统配置-获取")
@ApiOperation(value="系统配置-获取", notes="系统配置-获取")
@RequestMapping(value = "/findconfig", method = RequestMethod.POST)
public Result<SysConfiguration> findconfig(){
SysConfiguration sysConfiguration = sysConfigurationService.findconfig();
return Result.ok(sysConfiguration);
}
} }

@ -3,6 +3,7 @@ package org.jeecg.modules.sysconfiguration.mapper;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.sysconfiguration.entity.SysConfiguration; import org.jeecg.modules.sysconfiguration.entity.SysConfiguration;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@ -14,4 +15,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface SysConfigurationMapper extends BaseMapper<SysConfiguration> { public interface SysConfigurationMapper extends BaseMapper<SysConfiguration> {
@Select("select * from sys_configuration ")
SysConfiguration findconfig();
} }

@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/ */
public interface ISysConfigurationService extends IService<SysConfiguration> { public interface ISysConfigurationService extends IService<SysConfiguration> {
SysConfiguration findconfig();
} }

@ -3,6 +3,7 @@ package org.jeecg.modules.sysconfiguration.service.impl;
import org.jeecg.modules.sysconfiguration.entity.SysConfiguration; import org.jeecg.modules.sysconfiguration.entity.SysConfiguration;
import org.jeecg.modules.sysconfiguration.mapper.SysConfigurationMapper; import org.jeecg.modules.sysconfiguration.mapper.SysConfigurationMapper;
import org.jeecg.modules.sysconfiguration.service.ISysConfigurationService; import org.jeecg.modules.sysconfiguration.service.ISysConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -16,4 +17,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class SysConfigurationServiceImpl extends ServiceImpl<SysConfigurationMapper, SysConfiguration> implements ISysConfigurationService { public class SysConfigurationServiceImpl extends ServiceImpl<SysConfigurationMapper, SysConfiguration> implements ISysConfigurationService {
@Autowired
private SysConfigurationMapper sysConfigurationMapper;
@Override
public SysConfiguration findconfig() {
return sysConfigurationMapper.findconfig();
}
} }

@ -10,7 +10,7 @@
/> />
<title><%= title %></title> <title><%= title %></title>
<link rel="icon" href="/logo.png" /> <!-- <link rel="icon" href="/logo.png" /> -->
<!-- 全局配置 --> <!-- 全局配置 -->
<script> <script>
window._CONFIG = {}; window._CONFIG = {};

File diff suppressed because it is too large Load Diff

@ -11,6 +11,16 @@
import { AppProvider } from '/@/components/Application'; import { AppProvider } from '/@/components/Application';
import { useTitle } from '/@/hooks/web/useTitle'; import { useTitle } from '/@/hooks/web/useTitle';
import { useLocale } from '/@/locales/useLocale'; import { useLocale } from '/@/locales/useLocale';
import { useSettingStore } from '/@/store/modules/useSettingStore';
const { setting } = useSettingStore();
(function () {
const link = document.createElement('link');
link.rel = 'icon';
link.href = setting.logo;
const head = document.head || document.getElementsByTagName('head')[0];
head.appendChild(link);
})();
// //
import 'dayjs/locale/zh-cn'; import 'dayjs/locale/zh-cn';

@ -5,7 +5,7 @@
<template> <template>
<div class="anticon" :class="getAppLogoClass" @click="goHome"> <div class="anticon" :class="getAppLogoClass" @click="goHome">
<!-- <img src="../../../assets/images/logo.png" />--> <!-- <img src="../../../assets/images/logo.png" />-->
<img src="../../../assets/images/comp/appLogo.png" /> <img :src="setting.logo" />
<div class="ml-2 truncate md:opacity-100" :class="getTitleClass" v-show="showTitle"> <div class="ml-2 truncate md:opacity-100" :class="getTitleClass" v-show="showTitle">
{{ title }} {{ title }}
</div> </div>
@ -19,6 +19,8 @@
import { useDesign } from '/@/hooks/web/useDesign'; import { useDesign } from '/@/hooks/web/useDesign';
import { PageEnum } from '/@/enums/pageEnum'; import { PageEnum } from '/@/enums/pageEnum';
import { useUserStore } from '/@/store/modules/user'; import { useUserStore } from '/@/store/modules/user';
import { useSettingStore } from '/@/store/modules/useSettingStore';
const { setting } = useSettingStore();
const props = defineProps({ const props = defineProps({
/** /**

@ -2,6 +2,12 @@ import type { GlobConfig } from '/#/config';
import { getAppEnvConfig } from '/@/utils/env'; import { getAppEnvConfig } from '/@/utils/env';
import { useSettingStore } from '/@/store/modules/useSettingStore';
import { store } from '/@/store';
const settingStore = useSettingStore(store);
export const useGlobSetting = (): Readonly<GlobConfig> => { export const useGlobSetting = (): Readonly<GlobConfig> => {
const { const {
VITE_GLOB_APP_TITLE, VITE_GLOB_APP_TITLE,
@ -22,7 +28,7 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
} }
// Take global configuration // Take global configuration
const glob: Readonly<GlobConfig> = { const glob: GlobConfig = {
title: VITE_GLOB_APP_TITLE, title: VITE_GLOB_APP_TITLE,
domainUrl: VITE_GLOB_DOMAIN_URL, domainUrl: VITE_GLOB_DOMAIN_URL,
apiUrl: VITE_GLOB_API_URL, apiUrl: VITE_GLOB_API_URL,
@ -35,5 +41,6 @@ export const useGlobSetting = (): Readonly<GlobConfig> => {
viewUrl: VITE_GLOB_ONLINE_VIEW_URL, viewUrl: VITE_GLOB_ONLINE_VIEW_URL,
}; };
window._CONFIG['domianURL'] = VITE_GLOB_DOMAIN_URL; window._CONFIG['domianURL'] = VITE_GLOB_DOMAIN_URL;
Object.defineProperty(glob, 'title', settingStore.getDescriptor('name'));
return glob as Readonly<GlobConfig>; return glob as Readonly<GlobConfig>;
}; };

@ -0,0 +1,35 @@
import { defineStore } from 'pinia';
import axios from 'axios';
const setting = {
id: '',
createBy: '',
createTime: '',
updateBy: '',
updateTime: '',
sysOrgCode: '',
name: '',
logo: '',
newsPage: '',
recordNumber: '',
copyright: '',
certificate: '',
composition: '',
};
async function getSetting(setting) {
console.count('请求---');
const res = await axios({ method: 'post', url: `${import.meta.env.VITE_GLOB_DOMAIN_URL}/sysconfiguration/sysConfiguration/findconfig` });
Object.assign(setting, res.data.result);
setting.logo = import.meta.env.VITE_GLOB_DOMAIN_URL + '/' + setting.logo;
}
export const useSettingStore = defineStore('setting', {
state: () => {
getSetting(setting);
const getDescriptor = (prop: string) => {
return { get: () => setting[prop] };
};
return { setting, getDescriptor };
},
});

@ -1,13 +1,14 @@
import type { UserConfig, ConfigEnv } from 'vite'; import type { UserConfig, ConfigEnv } from 'vite';
import pkg from './package.json'; import pkg from './package.json';
import dayjs from 'dayjs'; import dayjs from 'dayjs';
import { loadEnv } from 'vite'; import { loadEnv, defineConfig } from 'vite';
import { resolve } from 'path'; import { resolve } from 'path';
import { generateModifyVars } from './build/generate/generateModifyVars'; import { generateModifyVars } from './build/generate/generateModifyVars';
import { createProxy } from './build/vite/proxy'; import { createProxy } from './build/vite/proxy';
import { wrapperEnv } from './build/utils'; import { wrapperEnv } from './build/utils';
import { createVitePlugins } from './build/vite/plugin'; import { createVitePlugins } from './build/vite/plugin';
import { OUTPUT_DIR } from './build/constant'; import { OUTPUT_DIR } from './build/constant';
import axios from 'axios';
function pathResolve(dir: string) { function pathResolve(dir: string) {
return resolve(process.cwd(), '.', dir); return resolve(process.cwd(), '.', dir);
@ -19,94 +20,98 @@ const __APP_INFO__ = {
lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'), lastBuildTime: dayjs().format('YYYY-MM-DD HH:mm:ss'),
}; };
export default ({ command, mode }: ConfigEnv): UserConfig => { export default defineConfig(async ({ command, mode }: ConfigEnv): Promise<UserConfig> => {
const root = process.cwd(); const root = process.cwd();
const env = loadEnv(mode, root); const env = loadEnv(mode, root);
// The boolean type read by loadEnv is a string. This function can be converted to boolean type // The boolean type read by loadEnv is a string. This function can be converted to boolean type
const viteEnv = wrapperEnv(env); const viteEnv = wrapperEnv(env);
try {
const res = await axios({ method: 'post', url: `${env.VITE_GLOB_DOMAIN_URL}/sysconfiguration/sysConfiguration/findconfig` });
// @ts-ignore
viteEnv.VITE_GLOB_APP_TITLE = res.data.result.name;
} finally {
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_DROP_CONSOLE } = viteEnv;
const { VITE_PORT, VITE_PUBLIC_PATH, VITE_PROXY, VITE_DROP_CONSOLE } = viteEnv; const isBuild = command === 'build';
const isBuild = command === 'build';
return { return {
base: VITE_PUBLIC_PATH, base: VITE_PUBLIC_PATH,
root, root,
resolve: { resolve: {
alias: [ alias: [
{ {
find: 'vue-i18n', find: 'vue-i18n',
replacement: 'vue-i18n/dist/vue-i18n.cjs.js', replacement: 'vue-i18n/dist/vue-i18n.cjs.js',
}, },
// /@/xxxx => src/xxxx // /@/xxxx => src/xxxx
{ {
find: /\/@\//, find: /\/@\//,
replacement: pathResolve('src') + '/', replacement: pathResolve('src') + '/',
}, },
// /#/xxxx => types/xxxx // /#/xxxx => types/xxxx
{ {
find: /\/#\//, find: /\/#\//,
replacement: pathResolve('types') + '/', replacement: pathResolve('types') + '/',
}, },
], ],
}, },
server: { server: {
// Listening on all local IPs // Listening on all local IPs
host: true, host: true,
https: false, https: false,
port: VITE_PORT, port: VITE_PORT,
// Load proxy configuration from .env // Load proxy configuration from .env
proxy: createProxy(VITE_PROXY), proxy: createProxy(VITE_PROXY),
}, },
build: { build: {
minify: 'esbuild', minify: 'esbuild',
target: 'es2015', target: 'es2015',
cssTarget: 'chrome80', cssTarget: 'chrome80',
outDir: OUTPUT_DIR, outDir: OUTPUT_DIR,
terserOptions: { terserOptions: {
compress: { compress: {
keep_infinity: true, keep_infinity: true,
// Used to delete console in production environment // Used to delete console in production environment
drop_console: VITE_DROP_CONSOLE, drop_console: VITE_DROP_CONSOLE,
drop_debugger: true, drop_debugger: true,
},
}, },
// Turning off brotliSize display can slightly reduce packaging time
reportCompressedSize: false,
chunkSizeWarningLimit: 2000,
},
define: {
// setting vue-i18-next
// Suppress warning
__INTLIFY_PROD_DEVTOOLS__: false,
__APP_INFO__: JSON.stringify(__APP_INFO__),
}, },
// Turning off brotliSize display can slightly reduce packaging time css: {
reportCompressedSize: false, preprocessorOptions: {
chunkSizeWarningLimit: 2000, less: {
}, modifyVars: generateModifyVars(),
define: { javascriptEnabled: true,
// setting vue-i18-next },
// Suppress warning
__INTLIFY_PROD_DEVTOOLS__: false,
__APP_INFO__: JSON.stringify(__APP_INFO__),
},
css: {
preprocessorOptions: {
less: {
modifyVars: generateModifyVars(),
javascriptEnabled: true,
}, },
}, },
},
// The vite plugin used by the project. The quantity is large, so it is separately extracted and managed // The vite plugin used by the project. The quantity is large, so it is separately extracted and managed
plugins: createVitePlugins(viteEnv, isBuild), plugins: createVitePlugins(viteEnv, isBuild),
optimizeDeps: { optimizeDeps: {
esbuildOptions: { esbuildOptions: {
target: 'es2020', target: 'es2020',
},
// @iconify/iconify: The dependency is dynamically and virtually loaded by @purge-icons/generated, so it needs to be specified explicitly
include: [
'@vue/runtime-core',
'@vue/shared',
'@iconify/iconify',
'ant-design-vue/es/locale/zh_CN',
'ant-design-vue/es/locale/en_US',
],
}, },
// @iconify/iconify: The dependency is dynamically and virtually loaded by @purge-icons/generated, so it needs to be specified explicitly };
include: [ }
'@vue/runtime-core', });
'@vue/shared',
'@iconify/iconify',
'ant-design-vue/es/locale/zh_CN',
'ant-design-vue/es/locale/en_US',
],
},
};
};

Loading…
Cancel
Save