框架升级

main
lj7788 2025-08-23 20:39:24 +08:00
parent 2e0c93ceb7
commit 302de3c0f0
18 changed files with 754 additions and 814 deletions

View File

@ -3,7 +3,7 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<!-- <groupId>com.hig</groupId> -->
<artifactId>hig-application</artifactId>
@ -11,35 +11,29 @@
<description>应用扩展包</description>
<properties>
<java.version>1.8</java.version>
<fastjson.version>1.2.47</fastjson.version>
<fastjson.version>1.2.83</fastjson.version>
<lombok.version>1.18.30</lombok.version>
<oracle.version>12.2.0.1.0</oracle.version>
<druid.version>1.1.13</druid.version>
<mybatis.version>2.1.1</mybatis.version>
<gson.version>2.8.6</gson.version>
<jasypt.version>3.0.2</jasypt.version>
<druid.version>1.2.20</druid.version>
<mybatis.version>2.3.2</mybatis.version>
<gson.version>2.10.1</gson.version>
<jasypt.version>3.0.5</jasypt.version>
<quartz.version>2.3.2</quartz.version>
<httpclient.version>4.5.10</httpclient.version>
<httpmime.version>4.5.10</httpmime.version>
<httpcore.version>4.4.12</httpcore.version>
<commons-codec.version>1.9</commons-codec.version>
<httpclient.version>4.5.14</httpclient.version>
<httpmime.version>4.5.14</httpmime.version>
<httpcore.version>4.4.16</httpcore.version>
<commons-codec.version>1.15</commons-codec.version>
<commons-logging.version>1.2</commons-logging.version>
<commons-io.version>2.8.0</commons-io.version>
<commons-lang3.version>3.4</commons-lang3.version>
<commons-lang.version>3.4</commons-lang.version>
<weixin-java-cp.version>4.1.0</weixin-java-cp.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-lang.version>3.12.0</commons-lang.version>
<weixin-java-cp.version>4.5.0</weixin-java-cp.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 发war包的时侯排除tomcat -->
<dependency>
@ -137,7 +131,7 @@
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.14</version>
<version>1.4.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
@ -177,7 +171,7 @@
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20210307</version>
<version>20231013</version>
</dependency>
<dependency>
<groupId>com.ruoyi</groupId>

View File

@ -31,7 +31,7 @@ import com.hig.ueditor.define.State;
@RestController
@RequestMapping("/ueditor")
@CrossOrigin(allowCredentials = "true")
@CrossOrigin(allowCredentials = "true", originPatterns = "*")
public class UEditorController {
@Autowired
private UEditorUpload uEditorUpload;

View File

@ -3,36 +3,30 @@
<parent>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<artifactId>hig-common</artifactId>
<name>hig-common</name>
<description>应用框架公用部分</description>
<properties>
<java.version>1.8</java.version>
<fastjson.version>1.2.47</fastjson.version>
<lombok.version>1.18.4</lombok.version>
<gson.version>2.8.6</gson.version>
<jasypt.version>3.0.2</jasypt.version>
<httpclient.version>4.5.10</httpclient.version>
<httpmime.version>4.5.10</httpmime.version>
<httpcore.version>4.4.12</httpcore.version>
<commons-codec.version>1.9</commons-codec.version>
<fastjson.version>1.2.83</fastjson.version>
<lombok.version>1.18.30</lombok.version>
<gson.version>2.10.1</gson.version>
<jasypt.version>3.0.5</jasypt.version>
<httpclient.version>4.5.14</httpclient.version>
<httpmime.version>4.5.14</httpmime.version>
<httpcore.version>4.4.16</httpcore.version>
<commons-codec.version>1.15</commons-codec.version>
<commons-logging.version>1.2</commons-logging.version>
<commons-io.version>2.8.0</commons-io.version>
<commons-lang3.version>3.4</commons-lang3.version>
<commons-io.version>2.11.0</commons-io.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- 发war包的时侯排除tomcat -->
<dependency>
@ -101,7 +95,7 @@
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.14</version>
<version>1.4.20</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
@ -127,5 +121,9 @@
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -6,34 +6,35 @@
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi</artifactId>
<version>3.6.0</version>
<version>3.8.6</version>
<name>ruoyi</name>
<url>http://www.ruoyi.vip</url>
<description>新框架扩展应用</description>
<properties>
<ruoyi.version>3.6.0</ruoyi.version>
<ruoyi.version>3.8.6</ruoyi.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>
<druid.version>1.2.6</druid.version>
<druid.version>1.2.16</druid.version>
<bitwalker.version>1.21</bitwalker.version>
<swagger.version>3.0.0</swagger.version>
<kaptcha.version>2.3.2</kaptcha.version>
<mybatis-spring-boot.version>2.1.4</mybatis-spring-boot.version>
<mybatis-spring-boot.version>2.3.2</mybatis-spring-boot.version>
<!-- <oracle.version>12.2.0.1.0</oracle.version> -->
<pagehelper.boot.version>1.3.1</pagehelper.boot.version>
<fastjson.version>1.2.76</fastjson.version>
<oshi.version>5.7.5</oshi.version>
<jna.version>5.8.0</jna.version>
<commons.io.version>2.10.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version>
<pagehelper.boot.version>1.4.7</pagehelper.boot.version>
<fastjson.version>1.2.83</fastjson.version>
<oshi.version>6.4.6</oshi.version>
<jna.version>5.13.0</jna.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.fileupload.version>1.5</commons.fileupload.version>
<commons.collections.version>3.2.2</commons.collections.version>
<poi.version>4.1.2</poi.version>
<velocity.version>1.7</velocity.version>
<poi.version>5.2.4</poi.version>
<velocity.version>2.3</velocity.version>
<jwt.version>0.9.1</jwt.version>
<mysql.version>8.0.33</mysql.version>
</properties>
<!-- 依赖声明 -->
@ -44,7 +45,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.2.13.RELEASE</version>
<version>2.5.15</version>
<type>pom</type>
<scope>import</scope>
</dependency>
@ -140,14 +141,8 @@
<!-- velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<artifactId>velocity-engine-core</artifactId>
<version>${velocity.version}</version>
<exclusions>
<exclusion>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- collections工具类 -->
@ -164,6 +159,13 @@
<version>${fastjson.version}</version>
</dependency>
<!-- MySQL驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- Token生成与解析-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
@ -256,7 +258,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<version>3.8.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
@ -270,7 +272,7 @@
<repository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
@ -281,7 +283,7 @@
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
@ -80,7 +80,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<version>2.5.15</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
</configuration>
@ -95,7 +95,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>examapi</warName>

View File

@ -4,7 +4,8 @@ import java.io.UnsupportedEncodingException;
import java.util.Base64;
import java.util.List;
import java.util.Set;
import org.springframework.beans.factory.annotation.Autowired;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -29,6 +30,7 @@ import com.ruoyi.system.service.ISysMenuService;
@RestController
public class SysLoginController
{
private static final Logger log = LoggerFactory.getLogger(SysLoginController.class);
@Autowired
private SysLoginService loginService;
@ -87,7 +89,7 @@ public class SysLoginController
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
System.out.println("ajax:" + ajax.toString());
log.debug("ajax:{}", ajax.toString());
return ajax;
}

View File

@ -57,7 +57,7 @@ spring:
# host: localhost # Redis服务器地址
host: 127.0.0.1
port: 6379 # Redis服务器连接端口
password: # Redis服务器连接密码默认为空
password: 123456 # Redis服务器连接密码默认为空
timeout: 20000 # 连接超时时间(毫秒)
jedis:
pool:

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -99,7 +99,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<version>1.5.22.RELEASE</version>
</dependency>
<!-- pool 对象池 -->

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -21,12 +21,6 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- SpringBoot 拦截器 -->

View File

@ -52,17 +52,20 @@ public class ResourcesConfig implements WebMvcConfigurer
@Bean
public CorsFilter corsFilter()
{
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
// 设置访问源地址
config.addAllowedOrigin("*");
config.addAllowedOriginPattern("*");
// 设置访问源请求头
config.addAllowedHeader("*");
// 设置访问源请求方法
config.addAllowedMethod("*");
// 对接口配置跨域设置
// 有效期 1800秒
config.setMaxAge(1800L);
// 添加映射路径,拦截一切请求
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
// 返回新的CorsFilter
return new CorsFilter(source);
}
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -20,7 +20,7 @@
<!--velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<artifactId>velocity-engine-core</artifactId>
</dependency>
<!-- collections工具类 -->

View File

@ -2,6 +2,7 @@ package com.ruoyi.generator.util;
import java.util.Properties;
import org.apache.velocity.app.Velocity;
import org.apache.velocity.runtime.RuntimeConstants;
import com.ruoyi.common.constant.Constants;
/**
@ -19,11 +20,10 @@ public class VelocityInitializer
Properties p = new Properties();
try
{
// 加载classpath目录下的vm文件
p.setProperty("file.resource.loader.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
// 定义字符集
p.setProperty(Velocity.INPUT_ENCODING, Constants.UTF8);
p.setProperty(Velocity.OUTPUT_ENCODING, Constants.UTF8);
p.setProperty(RuntimeConstants.INPUT_ENCODING, Constants.UTF8);
p.setProperty(RuntimeConstants.RESOURCE_LOADERS, "class");
p.setProperty("resource.loader.class.class", "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
// 初始化Velocity引擎指定配置Properties
Velocity.init(p);
}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -1,57 +1,57 @@
package com.ruoyi.quartz.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.SchedulerFactoryBean;
import javax.sql.DataSource;
import java.util.Properties;
/**
*
*
* @author ruoyi
*/
@Configuration
public class ScheduleConfig
{
@Bean
public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource)
{
SchedulerFactoryBean factory = new SchedulerFactoryBean();
factory.setDataSource(dataSource);
// quartz参数
Properties prop = new Properties();
prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler");
prop.put("org.quartz.scheduler.instanceId", "AUTO");
// 线程池配置
prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
prop.put("org.quartz.threadPool.threadCount", "20");
prop.put("org.quartz.threadPool.threadPriority", "5");
// JobStore配置
prop.put("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
// 集群配置
prop.put("org.quartz.jobStore.isClustered", "true");
prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
// sqlserver 启用
// prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
prop.put("org.quartz.jobStore.misfireThreshold", "12000");
prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
factory.setQuartzProperties(prop);
factory.setSchedulerName("RuoyiScheduler");
// 延时启动
factory.setStartupDelay(1);
factory.setApplicationContextSchedulerContextKey("applicationContextKey");
// 可选QuartzScheduler
// 启动时更新己存在的Job这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
factory.setOverwriteExistingJobs(true);
// 设置自动启动默认为true
factory.setAutoStartup(true);
return factory;
}
}
//package com.ruoyi.quartz.config;
//
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.quartz.SchedulerFactoryBean;
//import javax.sql.DataSource;
//import java.util.Properties;
//
///**
// * 定时任务配置单机部署建议删除此类和qrtz数据库表默认走内存会最高效
// *
// * @author ruoyi
// */
//@Configuration
//public class ScheduleConfig
//{
// @Bean
// public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource)
// {
// SchedulerFactoryBean factory = new SchedulerFactoryBean();
// factory.setDataSource(dataSource);
//
// // quartz参数
// Properties prop = new Properties();
// prop.put("org.quartz.scheduler.instanceName", "RuoyiScheduler");
// prop.put("org.quartz.scheduler.instanceId", "AUTO");
// // 线程池配置
// prop.put("org.quartz.threadPool.class", "org.quartz.simpl.SimpleThreadPool");
// prop.put("org.quartz.threadPool.threadCount", "20");
// prop.put("org.quartz.threadPool.threadPriority", "5");
// // JobStore配置
// prop.put("org.quartz.jobStore.class", "org.springframework.scheduling.quartz.LocalDataSourceJobStore");
// // 集群配置
// prop.put("org.quartz.jobStore.isClustered", "true");
// prop.put("org.quartz.jobStore.clusterCheckinInterval", "15000");
// prop.put("org.quartz.jobStore.maxMisfiresToHandleAtATime", "1");
// prop.put("org.quartz.jobStore.txIsolationLevelSerializable", "true");
//
// // sqlserver 启用
// // prop.put("org.quartz.jobStore.selectWithLockSQL", "SELECT * FROM {0}LOCKS UPDLOCK WHERE LOCK_NAME = ?");
// prop.put("org.quartz.jobStore.misfireThreshold", "12000");
// prop.put("org.quartz.jobStore.tablePrefix", "QRTZ_");
//
// factory.setQuartzProperties(prop);
// factory.setSchedulerName("RuoyiScheduler");
// // 延时启动
// factory.setStartupDelay(1);
// factory.setApplicationContextSchedulerContextKey("applicationContextKey");
// // 可选QuartzScheduler
// // 启动时更新己存在的Job这样就不用每次修改targetObject后删除qrtz_job_details表对应记录了
// factory.setOverwriteExistingJobs(true);
// // 设置自动启动默认为true
// factory.setAutoStartup(true);
//
// return factory;
// }
//}

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.6.0</version>
<version>3.8.6</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -3,21 +3,10 @@
<div style="margin-left: 15px">
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
@click="onClose"
plain
icon="el-icon-s-home"
size="mini"
>返回</el-button>
<el-button @click="onClose" plain icon="el-icon-s-home" size="mini">返回</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
@click="handleSave"
>保存</el-button>
<el-button type="success" plain icon="el-icon-edit" size="mini" @click="handleSave"></el-button>
</el-col>
</el-row>
</div>
@ -25,29 +14,23 @@
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="试题类型" prop="questionsType">
<el-select v-model="form.questionsType" @change="onChoice" placeholder="请选择试题类型">
<el-option
v-for="dict in questionsTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="parseInt(dict.dictValue)"
></el-option>
<el-option v-for="dict in questionsTypeOptions" :key="dict.dictValue" :label="dict.dictLabel"
:value="parseInt(dict.dictValue)"></el-option>
</el-select>
</el-form-item>
<div class="ueditor-area">
<span class="star-text">*</span>
<span class="ueditor-title">试题题目</span>
</div>
<vue-ueditor-wrap v-model="textValue" :config="editConfig" @ready="onEditorReady" :destroy="true"></vue-ueditor-wrap>
<br>
<vue-ueditor-wrap v-model="textValue" :config="editConfig" @ready="onEditorReady"
:destroy="true"></vue-ueditor-wrap>
<br />
<el-form-item label="题目分数" prop="questionsScore">
<el-input-number v-model="form.questionsScore" :min="1" :max="20" label="请输入题目分数"></el-input-number>
</el-form-item>
<el-form-item label="复杂度 " prop="rateNumber">
<div class="rate-area">
<el-rate
v-model="form.rateNumber"
show-score
text-color="#ff9900">
<el-rate v-model="form.rateNumber" show-score text-color="#ff9900">
</el-rate>
</div>
</el-form-item>
@ -66,18 +49,12 @@
</el-table-column>
<el-table-column label="操作" width="100px" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button v-if = "choiceNumber > 1 && answerList.indexOf(scope.row) === answerList.length - 1"
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd()"
>增加</el-button>
<el-button v-if = "answerList.indexOf(scope.row) > 1"
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
<el-button v-if="
choiceNumber > 1 &&
answerList.indexOf(scope.row) === answerList.length - 1
" size="mini" type="text" icon="el-icon-plus" @click="handleAdd()">增加</el-button>
<el-button v-if="answerList.indexOf(scope.row) > 1" size="mini" type="text" icon="el-icon-delete"
@click="handleDelete(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -86,22 +63,16 @@
<template v-if="isRadio">
<el-form-item label="正确答案" prop="rightAnswer">
<el-radio-group v-model="radioValue">
<el-radio
v-for="item in answerList"
:key="item.orderId"
:label="item.optionCode"
>{{item.optionCode}} 选项</el-radio>
<el-radio v-for="item in answerList" :key="item.orderId" :label="item.optionCode">{{ item.optionCode }}
选项</el-radio>
</el-radio-group>
</el-form-item>
</template>
<template v-else>
<el-form-item label="正确答案" prop="rightAnswer">
<el-checkbox-group v-model="checkItem">
<el-checkbox
v-for="item in answerList"
:key="item.orderId"
:label="item.optionCode"
>{{item.optionCode}} 选项</el-checkbox>
<el-checkbox v-for="item in answerList" :key="item.orderId" :label="item.optionCode">{{ item.optionCode }}
选项</el-checkbox>
</el-checkbox-group>
</el-form-item>
</template>
@ -110,11 +81,9 @@
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in statusOptions"
:key="dict.dictValue"
:label="parseInt(dict.dictValue)"
>{{dict.dictLabel}}</el-radio>
<el-radio v-for="dict in statusOptions" :key="dict.dictValue" :label="parseInt(dict.dictValue)">{{
dict.dictLabel
}}</el-radio>
</el-radio-group>
</el-form-item>
</el-form>
@ -123,12 +92,33 @@
</template>
<script>
import VueUeditorWrap from 'vue-ueditor-wrap'
import { baseApiUrl, uiUrl } from '@/config/sysinfo'
import { newS4Guid, newGuid } from '@/utils/guidtool'
import { listExamquestions, getExamquestions, delExamquestions, addExamquestions, updateExamquestions, exportExamquestions } from "@/api/questions/examquestions";
import { listQuestionscontent, getQuestionscontent, delQuestionscontent, addQuestionscontent, updateQuestionscontent, exportQuestionscontent } from "@/api/questions/questionscontent";
import { listAnswer, getAnswer, delAnswer, addAnswer, updateAnswer, exportAnswer } from "@/api/questions/answer";
import VueUeditorWrap from "vue-ueditor-wrap";
import { baseApiUrl, uiUrl } from "@/config/sysinfo";
import { newS4Guid, newGuid } from "@/utils/guidtool";
import {
listExamquestions,
getExamquestions,
delExamquestions,
addExamquestions,
updateExamquestions,
exportExamquestions,
} from "@/api/questions/examquestions";
import {
listQuestionscontent,
getQuestionscontent,
delQuestionscontent,
addQuestionscontent,
updateQuestionscontent,
exportQuestionscontent,
} from "@/api/questions/questionscontent";
import {
listAnswer,
getAnswer,
delAnswer,
addAnswer,
updateAnswer,
exportAnswer,
} from "@/api/questions/answer";
export default {
name: "Examquestions",
@ -140,9 +130,9 @@ export default {
anylyseForm: {},
//
questionsTypeOptions: [
{dictValue: 1, dictLabel: '判断题'},
{dictValue: 2, dictLabel: '单选题'},
{dictValue: 3, dictLabel: '多选题'}
{ dictValue: 1, dictLabel: "判断题" },
{ dictValue: 2, dictLabel: "单选题" },
{ dictValue: 3, dictLabel: "多选题" },
],
//
statusOptions: [],
@ -150,19 +140,19 @@ export default {
questionsData: {},
rules: {
questionsTitle: [
{ required: true, message: "试题题目不能为空", trigger: "blur" }
{ required: true, message: "试题题目不能为空", trigger: "blur" },
],
questionsType: [
{ required: true, message: "试题类型不能为空", trigger: "change" }
{ required: true, message: "试题类型不能为空", trigger: "change" },
],
questionsScore: [
{ required: true, message: "题目分数不能为空", trigger: "blur" }
{ required: true, message: "题目分数不能为空", trigger: "blur" },
],
rateNumber: [
{ required: true, message: "复杂度不能为空", trigger: "blur" }
{ required: true, message: "复杂度不能为空", trigger: "blur" },
],
rightAnswer: [
{ required: true, message: "正确答案不能为空", trigger: "blur" }
{ required: true, message: "正确答案不能为空", trigger: "blur" },
],
},
//
@ -173,8 +163,35 @@ export default {
single: true,
//
multiple: true,
optionItem: ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'],
choiceText: '题目选项',
optionItem: [
"A",
"B",
"C",
"D",
"E",
"F",
"G",
"H",
"I",
"J",
"K",
"L",
"M",
"N",
"O",
"P",
"Q",
"R",
"S",
"T",
"U",
"V",
"W",
"X",
"Y",
"Z",
],
choiceText: "题目选项",
choiceNumber: 0,
isRadio: true,
radioValue: null,
@ -186,11 +203,11 @@ export default {
//
initialFrameHeight: 200,
//
initialFrameWidth: '100%',
initialFrameWidth: "100%",
// 便使
serverUrl: baseApiUrl + '/ueditor/config',
serverUrl: baseApiUrl + "/ueditor/config",
// UEditor 使 vue-cli vue-ueditor-wrap 2
UEDITOR_HOME_URL: '/examui/UEditor/'
UEDITOR_HOME_URL: "/examui/UEditor/",
},
Ueditor: null,
isNew: false,
@ -201,27 +218,27 @@ export default {
questionsCode: null,
optionDescribe: null,
},
}
};
},
created() {
this.getDicts("sys_normal_disable").then(response => {
this.getDicts("sys_normal_disable").then((response) => {
this.statusOptions = response.data;
});
},
methods: {
/** 查询考试题目列表 */
init_data(bankrow, row) {
this.bankData = bankrow
this.bankData = bankrow;
if (row === null) {
this.form.status = 0
this.form.bankCode = bankrow.bankCode
this.form.questionsCode = newGuid()
this.isNew = true
this.form.status = 0;
this.form.bankCode = bankrow.bankCode;
this.form.questionsCode = newGuid();
this.isNew = true;
} else {
this.form = row
this.isNew = false
this.queryParams.questionsCode = this.form.questionsCode
this.getList()
this.form = row;
this.isNew = false;
this.queryParams.questionsCode = this.form.questionsCode;
this.getList();
}
},
//
@ -237,63 +254,73 @@ export default {
rightAnswer: null,
answerAnalyse: null,
status: 0,
createDept:null
}
createDept: null,
};
this.resetForm("form");
},
/** 查询考试题目答案列表 */
getList() {
listAnswer(this.queryParams).then(response => {
listAnswer(this.queryParams).then((response) => {
this.answerList = response.rows;
this.showData()
this.getContent()
this.showData();
this.getContent();
});
},
showData() {
if (this.form.questionsType === 1 || this.form.questionsType === 2) {
//
this.isRadio = true
this.radioValue = this.form.rightAnswer
this.isRadio = true;
this.radioValue = this.form.rightAnswer;
} else if (this.form.questionsType === 3) {
this.isRadio = false
this.checkItem = this.form.rightAnswer.split(",")
this.isRadio = false;
this.checkItem = this.form.rightAnswer.split(",");
}
},
getContent() {
getQuestionscontent(this.form.questionsCode).then(response => {
this.textValue = response.data.questionsContent
getQuestionscontent(this.form.questionsCode).then((response) => {
this.textValue = response.data.questionsContent;
});
},
onClose() {
this.$emit('refreshData')
this.$emit("refreshData");
},
checkData() {
if (this.form.questionsType === undefined || this.form.questionsType === null) {
this.$message.error('未选择题目类型')
return false
if (
this.form.questionsType === undefined ||
this.form.questionsType === null
) {
this.$message.error("未选择题目类型");
return false;
}
if (this.Ueditor.getContentTxt() === null || this.Ueditor.getContentTxt() === '') {
this.$message.error('未输入试题题目')
return false
if (
this.Ueditor.getContentTxt() === null ||
this.Ueditor.getContentTxt() === ""
) {
this.$message.error("未输入试题题目");
return false;
}
this.form.questionsTitle = this.Ueditor.getContentTxt()
this.form.questionsContent = this.textValue
if (this.form.questionsScore === undefined || this.form.questionsScore === null || this.form.questionsScore <= 0) {
this.$message.error('题目分数不能为零')
return false
this.form.questionsTitle = this.Ueditor.getContentTxt();
this.form.questionsContent = this.textValue;
if (
this.form.questionsScore === undefined ||
this.form.questionsScore === null ||
this.form.questionsScore <= 0
) {
this.$message.error("题目分数不能为零");
return false;
}
if (this.form.rateNumber === 0) {
this.$message.error('复杂度需要维护')
return false
this.$message.error("复杂度需要维护");
return false;
}
//
for (let i = 0; i < this.answerList.length; i++) {
if (this.answerList[i].optionDescribe === null) {
this.$message.error('题目选项描述不能为空')
return false
this.$message.error("题目选项描述不能为空");
return false;
}
}
@ -301,140 +328,148 @@ export default {
if (this.form.questionsType === 1 || this.form.questionsType === 2) {
//
if (this.radioValue === null) {
this.$message.error('判断题或单选题答案必须选择')
return false
this.$message.error("判断题或单选题答案必须选择");
return false;
}
} else if (this.form.questionsType === 3) {
if (this.checkItem === [] || this.checkItem.length === 0) {
this.$message.error('多选题答案必须选择')
return false
this.$message.error("多选题答案必须选择");
return false;
}
} else {
this.$message.error('系统不识别的题目类型')
return false
this.$message.error("系统不识别的题目类型");
return false;
}
return true
return true;
},
handleData() {
if (this.form.questionsType === 1 || this.form.questionsType === 2) {
//
this.form.rightAnswer = this.radioValue
this.form.rightAnswer = this.radioValue;
for (let i = 0; i < this.answerList.length; i++) {
if (this.answerList[i].optionCode === this.radioValue) {
this.answerList[i].isRight = 0
break
this.answerList[i].isRight = 0;
break;
}
}
} else if (this.form.questionsType === 3) {
let count = 0
let count = 0;
for (let i = 0; i < this.checkItem.length; i++) {
for (let j = 0; j < this.answerList.length; j++) {
if (this.checkItem[i] === this.answerList[j].optionCode) {
this.answerList[j].isRight = 0
count ++
this.answerList[j].isRight = 0;
count++;
}
}
}
this.form.rightAnswer = ''
this.form.rightAnswer = "";
for (let i = 0; i < this.answerList.length; i++) {
if (this.answerList[i].isRight === 0) {
this.form.rightAnswer += this.answerList[i].optionCode
this.form.rightAnswer += this.answerList[i].optionCode;
if (count > 1) {
this.form.rightAnswer += ','
this.form.rightAnswer += ",";
}
count --
count--;
}
}
}
},
handleSave() {
this.doSave(1)
this.doSave(1);
},
handleSaveOrExit() {
this.doSave(2)
this.doSave(2);
},
doSave(type) {
if (this.checkData()) {
this.handleData()
this.form.answerList = this.answerList
this.handleData();
this.form.answerList = this.answerList;
if (this.isNew) {
addExamquestions(this.form).then(response => {
addExamquestions(this.form).then((response) => {
this.msgSuccess("保存成功");
});
console.log('清除数据')
console.log("清除数据");
} else {
updateExamquestions(this.form).then(response => {
updateExamquestions(this.form).then((response) => {
this.msgSuccess("修改成功");
});
}
}
},
onChoice(choice) {
if (choice === 1) {
if (this.bankData.judgeScore !== undefined && this.bankData.judgeScore !== null ) {
this.form.questionsScore = this.bankData.judgeScore
this.choiceText = '判断题选项'
this.choiceNumber = 1
this.init_Table()
this.isRadio = true
if (
this.bankData.judgeScore !== undefined &&
this.bankData.judgeScore !== null
) {
this.form.questionsScore = this.bankData.judgeScore;
this.choiceText = "判断题选项";
this.choiceNumber = 1;
this.init_Table();
this.isRadio = true;
}
} else if (choice === 2) {
//
if (this.bankData.radioScore !== undefined && this.bankData.radioScore !== null ) {
this.form.questionsScore = this.bankData.radioScore
this.choiceText = '单选题选项'
this.choiceNumber = 2
this.init_Table()
this.isRadio = true
if (
this.bankData.radioScore !== undefined &&
this.bankData.radioScore !== null
) {
this.form.questionsScore = this.bankData.radioScore;
this.choiceText = "单选题选项";
this.choiceNumber = 2;
this.init_Table();
this.isRadio = true;
}
} else {
//
if (this.bankData.choiceScore !== undefined && this.bankData.choiceScore !== null ) {
this.form.questionsScore = this.bankData.choiceScore
this.choiceText = '多选题选项'
this.choiceNumber = 3
this.init_Table()
this.isRadio = false
if (
this.bankData.choiceScore !== undefined &&
this.bankData.choiceScore !== null
) {
this.form.questionsScore = this.bankData.choiceScore;
this.choiceText = "多选题选项";
this.choiceNumber = 3;
this.init_Table();
this.isRadio = false;
}
}
},
init_Table() {
this.answerList = []
this.answerList = [];
const answerData = {
questionsCode: this.form.questionsCode,
orderId: 1,
optionCode: 'A',
optionCode: "A",
isRight: 1,
optionDescribe: null
}
optionDescribe: null,
};
this.answerList.push(answerData)
this.answerList.push(answerData);
const answerData1 = {
questionsCode: this.form.questionsCode,
orderId: 2,
optionCode: 'B',
optionCode: "B",
isRight: 1,
optionDescribe: null
}
optionDescribe: null,
};
this.answerList.push(answerData1)
this.answerList.push(answerData1);
},
handleAdd() {
if (this.answerList > 10) {
this.$message.error('题目选项不能超过10项')
return
this.$message.error("题目选项不能超过10项");
return;
}
for (let i = 0; i < this.answerList.length; i++) {
if (this.answerList[i].optionDescribe === null) {
this.$message.error('题目选项描述不能为空')
return
this.$message.error("题目选项描述不能为空");
return;
}
}
@ -443,27 +478,26 @@ export default {
orderId: this.answerList.length + 1,
optionCode: this.optionItem[this.answerList.length],
isRight: 1,
optionDescribe: null
}
this.answerList.push(answerData)
optionDescribe: null,
};
this.answerList.push(answerData);
},
handleDelete(row) {
this.answerList.splice(this.answerList.indexOf(row), 1)
this.resetOption()
this.answerList.splice(this.answerList.indexOf(row), 1);
this.resetOption();
},
resetOption() {
for (let i = 0; i < this.answerList.length; i++) {
this.answerList[i].orderId = i + 1
this.answerList[i].isRight = 1
this.answerList[i].optionCode = this.optionItem[i]
this.answerList[i].orderId = i + 1;
this.answerList[i].isRight = 1;
this.answerList[i].optionCode = this.optionItem[i];
}
},
onEditorReady(editor) {
this.Ueditor = editor
}
}
this.Ueditor = editor;
},
},
};
</script>
@ -493,7 +527,6 @@ export default {
box-sizing: border-box;
}
.ueditor-title {
font-size: 14px;
color: #606266;

View File

@ -5,38 +5,20 @@
<!--部门数据-->
<el-col :span="4" :xs="24">
<div class="head-container">
<el-input
v-model="typeName"
placeholder="请输入类型名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
<el-input v-model="typeName" placeholder="请输入类型名称" clearable size="small" prefix-icon="el-icon-search"
style="margin-bottom: 20px" />
</div>
<div class="head-container">
<el-tree
:data="examtypeList"
:props="defaultProps"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
default-expand-all
@node-click="handleNodeClick"
/>
<el-tree :data="examtypeList" :props="defaultProps" :expand-on-click-node="false"
:filter-node-method="filterNode" ref="tree" default-expand-all @node-click="handleNodeClick" />
</div>
</el-col>
<!--用户数据-->
<el-col :span="20" :xs="24">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="题库名称" prop="bankName">
<el-input
v-model="queryParams.bankName"
placeholder="请输入题库名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.bankName" placeholder="请输入题库名称" clearable size="small"
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
@ -46,11 +28,8 @@
<div class="banklist">
<div>
<ul style="padding: 0">
<li style = "list-style-type:none;"
v-for="(item,index) in questionsbankList"
:key="index"
class="new border-1px"
>
<li style="list-style-type:none;" v-for="(item, index) in questionsbankList" :key="index"
class="new border-1px">
<el-row :gutter="20" :key="index" v-if='index % 2 == 0'>
<el-col :span="12">
<div class="bank-panel">
@ -64,15 +43,11 @@
<div class="nickname-text">{{ item.createBy }}</div>
</div>
<div class="data-area">
<div class= "memo-text" >判断题:{{item.judgeNumber}} 单选题:{{item.radioNumber}} 多选题:{{item.choiceNumber}}</div>
<div class="memo-text">判断题:{{ item.judgeNumber }} 单选题:{{ item.radioNumber }}
多选题:{{ item.choiceNumber }}</div>
<div class="button-area">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleEdit(item)"
v-hasPermi="['questions:questionsbank:edit']"
>编辑</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleEdit(item)"
v-hasPermi="['questions:questionsbank:edit']">编辑</el-button>
</div>
</div>
</div>
@ -90,15 +65,13 @@
<div class="nickname-text">{{ questionsbankList[index + 1].createBy }}</div>
</div>
<div class="data-area">
<div class= "memo-text" >判断题:{{questionsbankList[index + 1].judgeNumber}} 单选题:{{questionsbankList[index + 1].radioNumber}} 多选题:{{questionsbankList[index + 1].choiceNumber}}</div>
<div class="memo-text">判断题:{{ questionsbankList[index + 1].judgeNumber }}
单选题:{{ questionsbankList[index + 1].radioNumber }} 多选题:{{ questionsbankList[index +
1].choiceNumber}}</div>
<div class="button-area">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
<el-button size="mini" type="text" icon="el-icon-edit"
@click="handleEdit(questionsbankList[index + 1])"
v-hasPermi="['questions:questionsbank:edit']"
>编辑</el-button>
v-hasPermi="['questions:questionsbank:edit']">编辑</el-button>
</div>
</div>
</div>
@ -109,13 +82,8 @@
</ul>
</div>
</div>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" @pagination="getList" />
</el-col>
</el-row>
</div>
@ -334,7 +302,6 @@ export default {
</script>
<style scoped lang="scss">
.el-form-item {
margin-bottom: -1px;
}

View File

@ -2,33 +2,19 @@
<div>
<div v-if="editVisible">
<div style="margin-left: 15px">
<el-button
@click="onClose"
plain
icon="el-icon-s-home"
size="mini"
>返回</el-button>
<el-button @click="onClose" plain icon="el-icon-s-home" size="mini">返回</el-button>
</div>
<div class="form-panel">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="试题题目" prop="questionsTitle">
<el-input
v-model="queryParams.questionsTitle"
placeholder="请输入试题题目"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
<el-input v-model="queryParams.questionsTitle" placeholder="请输入试题题目" clearable size="small"
@keyup.enter.native="handleQuery" />
</el-form-item>
<el-form-item label="试题类型" prop="questionsType">
<el-select v-model="queryParams.questionsType" placeholder="请选择试题类型" clearable size="small">
<el-option
v-for="dict in questionsTypeOptions"
:key="dict.dictValue"
:label="dict.dictLabel"
:value="dict.dictValue"
/>
<el-option v-for="dict in questionsTypeOptions" :key="dict.dictValue" :label="dict.dictLabel"
:value="dict.dictValue" />
</el-select>
</el-form-item>
<el-form-item>
@ -39,36 +25,16 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['questions:examquestions:add']"
>新增</el-button>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['questions:examquestions:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['questions:examquestions:remove']"
>删除</el-button>
<el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
v-hasPermi="['questions:examquestions:remove']">删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
:loading="exportLoading"
@click="handleExport"
v-hasPermi="['questions:examquestions:export']"
>导出</el-button>
<el-button type="warning" plain icon="el-icon-download" size="mini" :loading="exportLoading"
@click="handleExport" v-hasPermi="['questions:examquestions:export']">导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -77,44 +43,27 @@
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" width="60" align="center" prop="rownum" />
<el-table-column label="试题题目" align="center" prop="questionsTitle" />
<el-table-column label="试题类型" width = "80" align="center" prop="questionsType" :formatter="questionsTypeFormat" />
<el-table-column label="试题类型" width="80" align="center" prop="questionsType"
:formatter="questionsTypeFormat" />
<el-table-column label="分数" width="60" align="center" prop="questionsScore" />
<el-table-column label="复杂度" width="150" align="center">
<template slot-scope="scope">
<el-rate
v-model="scope.row.rateNumber"
disabled
text-color="#ff9900">
<el-rate v-model="scope.row.rateNumber" disabled text-color="#ff9900">
</el-rate>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="100" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['questions:examquestions:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['questions:examquestions:remove']"
>删除</el-button>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['questions:examquestions:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['questions:examquestions:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
@pagination="getList" />
</div>
</div>
<div v-else>
@ -399,4 +348,3 @@ export default {
margin: 10px 0px 20px 15px;
}
</style>