Merge pull request"更新注释文档"(#11) from feature/wy into develop

feature/wyh
王勇 3 days ago committed by 王奕辉
parent db8aaf463e
commit e8b4b16459

@ -13,5 +13,8 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class DownloadQo { public class DownloadQo {
/**
*
*/
String path; String path;
} }

@ -8,6 +8,8 @@ package lsgwr.exam.repository;
import lsgwr.exam.entity.Page; import lsgwr.exam.entity.Page;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
/**
*
*/
public interface PageRepository extends JpaRepository<Page, Integer> { public interface PageRepository extends JpaRepository<Page, Integer> {
} }

@ -8,6 +8,8 @@ package lsgwr.exam.repository;
import lsgwr.exam.entity.QuestionCategory; import lsgwr.exam.entity.QuestionCategory;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
/**
*
*/
public interface QuestionCategoryRepository extends JpaRepository<QuestionCategory, Integer> { public interface QuestionCategoryRepository extends JpaRepository<QuestionCategory, Integer> {
} }

@ -8,6 +8,8 @@ package lsgwr.exam.repository;
import lsgwr.exam.entity.QuestionLevel; import lsgwr.exam.entity.QuestionLevel;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
/**
*
*/
public interface QuestionLevelRepository extends JpaRepository<QuestionLevel, Integer> { public interface QuestionLevelRepository extends JpaRepository<QuestionLevel, Integer> {
} }

@ -8,6 +8,8 @@ package lsgwr.exam.repository;
import lsgwr.exam.entity.QuestionOption; import lsgwr.exam.entity.QuestionOption;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
/**
*
*/
public interface QuestionOptionRepository extends JpaRepository<QuestionOption, String> { public interface QuestionOptionRepository extends JpaRepository<QuestionOption, String> {
} }

@ -11,7 +11,9 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import java.util.List; import java.util.List;
/**
*
*/
public interface QuestionRepository extends JpaRepository<Question, String> { public interface QuestionRepository extends JpaRepository<Question, String> {
List<Question> findByQuestionTypeId(Integer id); List<Question> findByQuestionTypeId(Integer id);
@Query("select q from Question q order by q.updateTime desc") @Query("select q from Question q order by q.updateTime desc")

@ -8,6 +8,8 @@ package lsgwr.exam.repository;
import lsgwr.exam.entity.QuestionType; import lsgwr.exam.entity.QuestionType;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
/**
*
*/
public interface QuestionTypeRepository extends JpaRepository<QuestionType, Integer> { public interface QuestionTypeRepository extends JpaRepository<QuestionType, Integer> {
} }

@ -9,5 +9,8 @@ package lsgwr.exam.repository;
import lsgwr.exam.entity.Role; import lsgwr.exam.entity.Role;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
/**
*
*/
public interface RoleRepository extends JpaRepository<Role, Integer> { public interface RoleRepository extends JpaRepository<Role, Integer> {
} }

@ -8,7 +8,9 @@ package lsgwr.exam.repository;
import lsgwr.exam.entity.User; import lsgwr.exam.entity.User;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
/**
*
*/
public interface UserRepository extends JpaRepository<User, String> { public interface UserRepository extends JpaRepository<User, String> {
/** /**
* *

@ -47,7 +47,12 @@ public class UserServiceImpl implements UserService {
@Autowired @Autowired
ActionRepository actionRepository; ActionRepository actionRepository;
/**
*
*
* @param registerDTO
* @return null
*/
@Override @Override
public User register(RegisterDTO registerDTO) { public User register(RegisterDTO registerDTO) {
try { try {
@ -106,7 +111,12 @@ public class UserServiceImpl implements UserService {
} }
return null; return null;
} }
/**
*
*
* @param userId id
* @return
*/
@Override @Override
public UserVo getUserInfo(String userId) { public UserVo getUserInfo(String userId) {
User user = userRepository.findById(userId).orElse(null); User user = userRepository.findById(userId).orElse(null);
@ -115,7 +125,12 @@ public class UserServiceImpl implements UserService {
BeanUtils.copyProperties(user, userVo); BeanUtils.copyProperties(user, userVo);
return userVo; return userVo;
} }
/**
*
*
* @param userId id
* @return
*/
@Override @Override
public UserInfoVo getInfo(String userId) { public UserInfoVo getInfo(String userId) {
User user = userRepository.findById(userId).orElse(null); User user = userRepository.findById(userId).orElse(null);

@ -7,22 +7,32 @@
package lsgwr.exam.utils; package lsgwr.exam.utils;
import lsgwr.exam.vo.ResultVO; import lsgwr.exam.vo.ResultVO;
/**
*
*/
public class ResultVOUtil { public class ResultVOUtil {
/**
*
*/
public static ResultVO success(Integer code, String msg, Object object) { public static ResultVO success(Integer code, String msg, Object object) {
return new ResultVO(code, msg, object); return new ResultVO(code, msg, object);
} }
/**
*
*/
public static ResultVO success(Object object) { public static ResultVO success(Object object) {
return new ResultVO(0, "成功", object); return new ResultVO(0, "成功", object);
} }
/**
*
*/
public static ResultVO success() { public static ResultVO success() {
return new ResultVO(0, "成功", null); return new ResultVO(0, "成功", null);
} }
/**
*
*/
public static ResultVO error(Integer code, String msg) { public static ResultVO error(Integer code, String msg) {
return new ResultVO(code, msg, null); return new ResultVO(code, msg, null);
} }

@ -8,15 +8,24 @@ package lsgwr.exam.vo;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
/**
* Action
*/
@Data @Data
public class ActionVo { public class ActionVo {
/**
*
*/
@JsonProperty("action") @JsonProperty("action")
private String actionName; private String actionName;
/**
*
*/
@JsonProperty("describe") @JsonProperty("describe")
private String actionDescription; private String actionDescription;
/**
*
*/
@JsonProperty("defaultCheck") @JsonProperty("defaultCheck")
private Boolean defaultCheck; private Boolean defaultCheck;
} }

@ -16,7 +16,9 @@ import java.io.Serializable;
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
public class JsonData implements Serializable { public class JsonData implements Serializable {
/**
* id
*/
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**

@ -10,15 +10,24 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/**
*
*/
@Data @Data
public class PageVo { public class PageVo {
/**
*
*/
@JsonProperty("actionEntitySet") @JsonProperty("actionEntitySet")
private List<ActionVo> actionVoList; private List<ActionVo> actionVoList;
/**
*
*/
@JsonProperty("permissionId") @JsonProperty("permissionId")
private String pageName; private String pageName;
/**
*
*/
@JsonProperty("permissionName") @JsonProperty("permissionName")
private String pageDescription; private String pageDescription;
} }

@ -10,7 +10,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/**
* ,
*/
@Data @Data
public class QuestionCreateSimplifyVo { public class QuestionCreateSimplifyVo {
/** /**

@ -10,7 +10,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/**
*
*/
@Data @Data
public class QuestionCreateVo { public class QuestionCreateVo {
/** /**

@ -11,7 +11,9 @@ import lombok.Data;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/**
*
*/
@Data @Data
public class QuestionDetailVo { public class QuestionDetailVo {
/** /**

@ -8,7 +8,9 @@ package lsgwr.exam.vo;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
/**
*
*/
@Data @Data
public class QuestionOptionCreateVo { public class QuestionOptionCreateVo {

@ -8,18 +8,29 @@ package lsgwr.exam.vo;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
/**
*
*/
@Data @Data
public class QuestionOptionVo { public class QuestionOptionVo {
/**
* id
*/
@JsonProperty("id") @JsonProperty("id")
private String questionOptionId; private String questionOptionId;
/**
*
*/
@JsonProperty("content") @JsonProperty("content")
private String questionOptionContent; private String questionOptionContent;
/**
*
*/
@JsonProperty("answer") @JsonProperty("answer")
private Boolean answer = false; private Boolean answer = false;
/**
*
*/
@JsonProperty("description") @JsonProperty("description")
private String questionOptionDescription; private String questionOptionDescription;
} }

@ -10,7 +10,9 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/**
*
*/
@Data @Data
public class QuestionPageVo { public class QuestionPageVo {

@ -13,15 +13,24 @@ import lsgwr.exam.entity.QuestionType;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/**
*
*/
@Data @Data
public class QuestionSelectionVo { public class QuestionSelectionVo {
/**
*
*/
@JsonProperty("types") @JsonProperty("types")
private List<QuestionType> questionTypeList; private List<QuestionType> questionTypeList;
/**
*
*/
@JsonProperty("categories") @JsonProperty("categories")
private List<QuestionCategory> questionCategoryList; private List<QuestionCategory> questionCategoryList;
/**
*
*/
@JsonProperty("levels") @JsonProperty("levels")
private List<QuestionLevel> questionLevelList; private List<QuestionLevel> questionLevelList;
} }

@ -12,15 +12,24 @@ import lombok.Data;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
/**
* VO
*/
@Data @Data
public class QuestionVo { public class QuestionVo {
/**
* idquestion
*/
@JsonProperty("id") @JsonProperty("id")
private String questionId; private String questionId;
/**
* question
*/
@JsonProperty("name") @JsonProperty("name")
private String questionName; private String questionName;
/**
* question
*/
@JsonProperty("score") @JsonProperty("score")
private Integer questionScore; private Integer questionScore;

@ -11,7 +11,9 @@ import lombok.Data;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
/**
* VO
*/
@Data @Data
public class RecordDetailVo { public class RecordDetailVo {
/** /**

@ -13,7 +13,12 @@ import lombok.Data;
@JsonInclude(JsonInclude.Include.NON_NULL) // 避免返回NULL的字段 @JsonInclude(JsonInclude.Include.NON_NULL) // 避免返回NULL的字段
public class ResultVO<T> { public class ResultVO<T> {
/**
*
* @param code
* @param msg
* @param data
*/
public ResultVO(Integer code, String msg, T data) { public ResultVO(Integer code, String msg, T data) {
this.code = code; this.code = code;
this.msg = msg; this.msg = msg;

@ -10,18 +10,29 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
/**
* VO
*/
@Data @Data
public class RoleVo { public class RoleVo {
/**
*
*/
@JsonProperty("id") @JsonProperty("id")
private String roleName; private String roleName;
/**
*
*/
@JsonProperty("name") @JsonProperty("name")
private String roleDescription; private String roleDescription;
/**
*
*/
@JsonProperty("describe") @JsonProperty("describe")
private String roleDetail; private String roleDetail;
/**
*
*/
@JsonProperty("permissions") @JsonProperty("permissions")
private List<PageVo> pageVoList; private List<PageVo> pageVoList;
} }

@ -8,19 +8,29 @@ package lsgwr.exam.vo;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
/**
*
*/
@Data @Data
public class UserInfoVo { public class UserInfoVo {
/**
* ID
*/
@JsonProperty("id") @JsonProperty("id")
private String userId; private String userId;
/**
* URL
*/
@JsonProperty("avatar") @JsonProperty("avatar")
private String userAvatar; private String userAvatar;
/**
*
*/
@JsonProperty("name") @JsonProperty("name")
private String userNickname; private String userNickname;
/**
*
*/
@JsonProperty("username") @JsonProperty("username")
private String userUsername; private String userUsername;

@ -8,30 +8,49 @@ package lsgwr.exam.vo;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data; import lombok.Data;
/**
*
*/
@Data @Data
public class UserVo { public class UserVo {
/**
* ID
*/
@JsonProperty("id") @JsonProperty("id")
private String userId; private String userId;
/**
*
*/
@JsonProperty("username") @JsonProperty("username")
private String userUsername; private String userUsername;
/**
*
*/
@JsonProperty("nickname") @JsonProperty("nickname")
private String userNickname; private String userNickname;
/**
* ID
*/
@JsonProperty("role") @JsonProperty("role")
private Integer userRoleId; private Integer userRoleId;
/**
*
*/
@JsonProperty("avatar") @JsonProperty("avatar")
private String userAvatar; private String userAvatar;
/**
*
*/
@JsonProperty("description") @JsonProperty("description")
private String userDescription; private String userDescription;
/**
*
*/
@JsonProperty("email") @JsonProperty("email")
private String userEmail; private String userEmail;
/**
*
*/
@JsonProperty("phone") @JsonProperty("phone")
private String userPhone; private String userPhone;
} }

@ -6,13 +6,91 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>logo.png"> <link rel="icon" href="<%= BASE_URL %>logo.png">
<title>在线考试系统</title> <title>在线考试系统</title>
<style>#loading-mask{position:fixed;left:0;top:0;height:100%;width:100%;background:#fff;user-select:none;z-index:9999;overflow:hidden}.loading-wrapper{position:absolute;top:50%;left:50%;transform:translate(-50%,-100%)}.loading-dot{animation:antRotate 1.2s infinite linear;transform:rotate(45deg);position:relative;display:inline-block;font-size:64px;width:64px;height:64px;box-sizing:border-box}.loading-dot i{width:22px;height:22px;position:absolute;display:block;background-color:#1890ff;border-radius:100%;transform:scale(.75);transform-origin:50% 50%;opacity:.3;animation:antSpinMove 1s infinite linear alternate}.loading-dot i:nth-child(1){top:0;left:0}.loading-dot i:nth-child(2){top:0;right:0;-webkit-animation-delay:.4s;animation-delay:.4s}.loading-dot i:nth-child(3){right:0;bottom:0;-webkit-animation-delay:.8s;animation-delay:.8s}.loading-dot i:nth-child(4){bottom:0;left:0;-webkit-animation-delay:1.2s;animation-delay:1.2s}@keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@-webkit-keyframes antRotate{to{-webkit-transform:rotate(405deg);transform:rotate(405deg)}}@keyframes antSpinMove{to{opacity:1}}@-webkit-keyframes antSpinMove{to{opacity:1}}</style> <!-- 定义加载中的样式 -->
<style>#loading-mask{
position:fixed;left:0;top:0;height:100%;
width:100%;background:#fff;user-select:none;
z-index:9999;overflow:hidden}
.loading-wrapper{
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-100%)
}
.loading-dot{
animation:antRotate 1.2s infinite linear;
transform:rotate(45deg);
position:relative;
display:inline-block;
font-size:64px;
width:64px;
height:64px;
box-sizing:border-box}
.loading-dot i{
width:22px;
height:22px;
position:absolute;
display:block;
background-color:#1890ff;
border-radius:100%;
transform:scale(.75);
transform-origin:50% 50%;
opacity:.3;
animation:antSpinMove 1s infinite linear alternate
}
.loading-dot i:nth-child(1){
top:0;
left:0
}
.loading-dot i:nth-child(2){
top:0;
right:0;
-webkit-animation-delay:.4s;
animation-delay:.4s
}
.loading-dot i:nth-child(3){
right:0;
bottom:0;
-webkit-animation-delay:.8s;
animation-delay:.8s
}
.loading-dot i:nth-child(4){
bottom:0;
left:0;
-webkit-animation-delay:1.2s;
animation-delay:1.2s
}
@keyframes antRotate{
to{
-webkit-transform:rotate(405deg);
transform:rotate(405deg)
}
}
@-webkit-keyframes antRotate{to{
-webkit-transform:rotate(405deg);
transform:rotate(405deg)
}
}
@keyframes antSpinMove{
to{
opacity:1
}
}
@-webkit-keyframes antSpinMove{
to{
opacity:1
}
}
</style>
</head> </head>
<body> <body>
<!-- 当JavaScript被禁用时显示提示信息 -->
<noscript> <noscript>
<strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong> <strong>We're sorry but vue-antd-pro doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript> </noscript>
<!-- 应用的主容器 -->
<div id="app"> <div id="app">
<!-- 加载中的遮罩层 -->
<div id="loading-mask"> <div id="loading-mask">
<div class="loading-wrapper"> <div class="loading-wrapper">
<span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span> <span class="loading-dot loading-dot-spin"><i></i><i></i><i></i><i></i></span>

@ -1 +1,52 @@
#preloadingAnimation{position:fixed;left:0;top:0;height:100%;width:100%;background:#ffffff;user-select:none;z-index: 9999;overflow: hidden}.lds-roller{display:inline-block;position:relative;left:50%;top:50%;transform:translate(-50%,-50%);width:64px;height:64px;}.lds-roller div{animation:lds-roller 1.2s cubic-bezier(0.5,0,0.5,1) infinite;transform-origin:32px 32px;}.lds-roller div:after{content:" ";display:block;position:absolute;width:6px;height:6px;border-radius:50%;background:#13c2c2;margin:-3px 0 0 -3px;}.lds-roller div:nth-child(1){animation-delay:-0.036s;}.lds-roller div:nth-child(1):after{top:50px;left:50px;}.lds-roller div:nth-child(2){animation-delay:-0.072s;}.lds-roller div:nth-child(2):after{top:54px;left:45px;}.lds-roller div:nth-child(3){animation-delay:-0.108s;}.lds-roller div:nth-child(3):after{top:57px;left:39px;}.lds-roller div:nth-child(4){animation-delay:-0.144s;}.lds-roller div:nth-child(4):after{top:58px;left:32px;}.lds-roller div:nth-child(5){animation-delay:-0.18s;}.lds-roller div:nth-child(5):after{top:57px;left:25px;}.lds-roller div:nth-child(6){animation-delay:-0.216s;}.lds-roller div:nth-child(6):after{top:54px;left:19px;}.lds-roller div:nth-child(7){animation-delay:-0.252s;}.lds-roller div:nth-child(7):after{top:50px;left:14px;}.lds-roller div:nth-child(8){animation-delay:-0.288s;}.lds-roller div:nth-child(8):after{top:45px;left:10px;}#preloadingAnimation .load-tips{color: #13c2c2;font-size:2rem;position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);margin-top:80px;text-align:center;width:400px;height:64px;} @keyframes lds-roller{0%{transform:rotate(0deg);} 100%{transform:rotate(360deg);}} #preloadingAnimation{
position:fixed;left:0;top:0;height:100%;width:100%;background:#ffffff;user-select:none;
z-index: 9999;overflow: hidden}
.lds-roller{
display:inline-block;
position:relative;
left:50%;
top:50%;
transform:translate(-50%,-50%);
width:64px;
height:64px;
}
.lds-roller div{
animation:lds-roller 1.2s cubic-bezier(0.5,0,0.5,1) infinite;
transform-origin:32px 32px;
}
.lds-roller div:after{
content:" ";
display:block;
position:absolute;
width:6px;
height:6px;
border-radius:50%;
background:#13c2c2;
margin:-3px 0 0 -3px;
}
.lds-roller div:nth-child(1){animation-delay:-0.036s;}
.lds-roller div:nth-child(1):after{top:50px;left:50px;}
.lds-roller div:nth-child(2){animation-delay:-0.072s;}
.lds-roller div:nth-child(2):after{top:54px;left:45px;}
.lds-roller div:nth-child(3){animation-delay:-0.108s;}
.lds-roller div:nth-child(3):after{top:57px;left:39px;}
.lds-roller div:nth-child(4){animation-delay:-0.144s;}
.lds-roller div:nth-child(4):after{top:58px;left:32px;}
.lds-roller div:nth-child(5){animation-delay:-0.18s;}
.lds-roller div:nth-child(5):after{top:57px;left:25px;}
.lds-roller div:nth-child(6){animation-delay:-0.216s;}
.lds-roller div:nth-child(6):after{top:54px;left:19px;}
.lds-roller div:nth-child(7){animation-delay:-0.252s;}
.lds-roller div:nth-child(7):after{top:50px;left:14px;}
.lds-roller div:nth-child(8){animation-delay:-0.288s;}
.lds-roller div:nth-child(8):after{top:45px;left:10px;}
#preloadingAnimation .load-tips{
color: #13c2c2;
font-size:2rem;
position:absolute;
left:50%;
top:50%;
transform:translate(-50%,-50%);margin-top:80px;
text-align:center;width:400px;height:64px;}
@keyframes lds-roller{0%{transform:rotate(0deg);}
100%{transform:rotate(360deg);}}

@ -1 +1,27 @@
<div id="preloadingAnimation"><div class=lds-roller><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div><div class=load-tips>Loading</div></div> <div id="preloadingAnimation"><div class=lds-roller><div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
</div>
<div class=load-tips>Loading</div>
</div>

@ -1,5 +1,31 @@
/**
* 预加载动画
*/
<div class="preloading-animate"> <div class="preloading-animate">
<!--预加载的包装容器 -->
<div class="preloading-wrapper"> <div class="preloading-wrapper">
<svg class="preloading-balls" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid"><circle cx="67.802" cy="59.907" r="6" fill="#51CACC"><animate attributeName="cx" values="75;57.72542485937369" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="cy" values="50;73.77641290737884" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="fill" values="#51CACC;#9DF871" keyTimes="0;1" dur="1s" repeatCount="indefinite"/></circle><circle cx="46.079" cy="69.992" r="6" fill="#9DF871"><animate attributeName="cx" values="57.72542485937369;29.774575140626318" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="cy" values="73.77641290737884;64.69463130731182" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="fill" values="#9DF871;#E0FF77" keyTimes="0;1" dur="1s" repeatCount="indefinite"/></circle><circle cx="29.775" cy="52.449" r="6" fill="#E0FF77"><animate attributeName="cx" values="29.774575140626318;29.774575140626315" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="cy" values="64.69463130731182;35.30536869268818" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="fill" values="#E0FF77;#DE9DD6" keyTimes="0;1" dur="1s" repeatCount="indefinite"/></circle><circle cx="41.421" cy="31.521" r="6" fill="#DE9DD6"><animate attributeName="cx" values="29.774575140626315;57.72542485937368" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="cy" values="35.30536869268818;26.22358709262116" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="fill" values="#DE9DD6;#FF708E" keyTimes="0;1" dur="1s" repeatCount="indefinite"/></circle><circle cx="64.923" cy="36.13" r="6" fill="#FF708E"><animate attributeName="cx" values="57.72542485937368;75" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="cy" values="26.22358709262116;49.99999999999999" keyTimes="0;1" dur="1s" repeatCount="indefinite"/><animate attributeName="fill" values="#FF708E;#51CACC" keyTimes="0;1" dur="1s" repeatCount="indefinite"/></circle></svg> <svg class="preloading-balls"
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<circle cx="67.802" cy="59.907" r="6" fill="#51CACC">
<animate attributeName="cx" values="75;57.72542485937369" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="cy" values="50;73.77641290737884" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="fill" values="#51CACC;#9DF871" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
</circle>
<circle cx="46.079" cy="69.992" r="6" fill="#9DF871"><animate attributeName="cx" values="57.72542485937369;29.774575140626318" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="cy" values="73.77641290737884;64.69463130731182" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="fill" values="#9DF871;#E0FF77" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
</circle><circle cx="29.775" cy="52.449" r="6" fill="#E0FF77">
<animate attributeName="cx" values="29.774575140626318;29.774575140626315" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="cy" values="64.69463130731182;35.30536869268818" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="fill" values="#E0FF77;#DE9DD6" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
</circle><circle cx="41.421" cy="31.521" r="6" fill="#DE9DD6"><animate attributeName="cx" values="29.774575140626315;57.72542485937368" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="cy" values="35.30536869268818;26.22358709262116" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="fill" values="#DE9DD6;#FF708E" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
</circle>
<circle cx="64.923" cy="36.13" r="6" fill="#FF708E"><animate attributeName="cx" values="57.72542485937368;75" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="cy" values="26.22358709262116;49.99999999999999" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
<animate attributeName="fill" values="#FF708E;#51CACC" keyTimes="0;1" dur="1s" repeatCount="indefinite"/>
</circle>
</svg>
</div> </div>
</div> </div>

@ -1 +1,20 @@
.preloading-animate{background:#ffffff;width:100%;height:100%;position:fixed;left:0;top:0;z-index:299;}.preloading-animate .preloading-wrapper{position:absolute;width:5rem;height:5rem;left:50%;top:50%;transform:translate(-50%,-50%);}.preloading-animate .preloading-wrapper .preloading-balls{font-size:5rem;} .preloading-animate{
background:#ffffff;
width:100%;
height:100%;
position:fixed;
left:0;
top:0;
z-index:299;
}
.preloading-animate .preloading-wrapper{
position:absolute;
width:5rem;
height:5rem;
left:50%;
top:50%;
transform:translate(-50%,-50%);
}
.preloading-animate .preloading-wrapper .preloading-balls{
font-size:5rem;
}

@ -1,24 +1,33 @@
<template> <template>
<!--异常页面-->
<div class="exception"> <div class="exception">
<!--背景图-->
<div class="imgBlock"> <div class="imgBlock">
<!-- 图片元素根据传入的type动态设置背景图片 -->
<div class="imgEle" :style="{backgroundImage: `url(${config[type].img})`}"> <div class="imgEle" :style="{backgroundImage: `url(${config[type].img})`}">
</div> </div>
</div> </div>
<!-- 内容区块 -->
<div class="content"> <div class="content">
<!-- 根据传入的type动态显示标题 -->
<h1>{{ config[type].title }}</h1> <h1>{{ config[type].title }}</h1>
<!-- 根据传入的type动态显示描述 -->
<div class="desc">{{ config[type].desc }}</div> <div class="desc">{{ config[type].desc }}</div>
<!-- 操作按钮区块 -->
<div class="actions"> <div class="actions">
<!-- 点击按钮返回首页 -->
<a-button type="primary" @click="handleToHome"></a-button> <a-button type="primary" @click="handleToHome"></a-button>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>//
import types from './type' import types from './type'
export default { export default {
name: 'Exception', name: 'Exception',
//
props: { props: {
type: { type: {
type: String, type: String,
@ -27,11 +36,14 @@ export default {
}, },
data () { data () {
return { return {
//
config: types config: types
} }
}, },
methods: { methods: {
//
handleToHome () { handleToHome () {
// 使Vue Routerdashboard
this.$router.push({ name: 'dashboard' }) this.$router.push({ name: 'dashboard' })
} }
} }

@ -1,19 +1,27 @@
/**
* 定义一个常量对象types用于存储不同HTTP状态码的信息
* 每个状态码都包含一个图片URL状态码标题和描述信息
* 这些信息可以用于在界面上展示更友好的错误提示
*/
const types = { const types = {
// 403状态码信息禁止访问
403: { 403: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg', img: 'https://gw.alipayobjects.com/zos/rmsportal/wZcnGqRDyhPOEYFcZDnb.svg',
title: '403', title: '403',
desc: '抱歉,你无权访问该页面' desc: '抱歉,你无权访问该页面'
}, },
// 404状态码信息页面未找到
404: { 404: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg', img: 'https://gw.alipayobjects.com/zos/rmsportal/KpnpchXsobRgLElEozzI.svg',
title: '404', title: '404',
desc: '抱歉,你访问的页面不存在或仍在开发中' desc: '抱歉,你访问的页面不存在或仍在开发中'
}, },
// 500状态码信息服务器内部错误
500: { 500: {
img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg', img: 'https://gw.alipayobjects.com/zos/rmsportal/RVRUAYdCGeYNBWoKiIwB.svg',
title: '500', title: '500',
desc: '抱歉,服务器出错了' desc: '抱歉,服务器出错了'
} }
} }
// 将types对象导出以便在其他模块中使用
export default types export default types

@ -1,18 +1,25 @@
<template> <template>
<!-- 底部信息栏 -->
<div class="footer"> <div class="footer">
<!-- 友情链接区域 -->
<div class="links"> <div class="links">
<!-- 链接项目代码仓库 -->
<a href="https://github.com/19920625lsg/spring-boot-online-exam" target="_blank">代码仓</a> <a href="https://github.com/19920625lsg/spring-boot-online-exam" target="_blank">代码仓</a>
<!-- 链接关于我的页面 -->
<a href="https://19920625lsg.github.io" target="_blank">关于我</a> <a href="https://19920625lsg.github.io" target="_blank">关于我</a>
<!-- 链接联系我 -->
<a href="mailto:liangshanguang2@gmail.com">联系我</a> <a href="mailto:liangshanguang2@gmail.com">联系我</a>
</div> </div>
<!-- 版权信息区域 -->
<div class="copyright"> <div class="copyright">
Copyright Copyright
<!-- 版权图标 -->
<a-icon type="copyright" /> 2020 <span>Liang Shan Guang</span> <a-icon type="copyright" /> 2020 <span>Liang Shan Guang</span>
</div> </div>
</div> </div>
</template> </template>
<script> <script>//
export default { export default {
name: 'GlobalFooter', name: 'GlobalFooter',
data () { data () {
@ -21,7 +28,7 @@ export default {
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>//
.footer { .footer {
padding: 0 16px; padding: 0 16px;
margin: 24px 0 24px; margin: 24px 0 24px;

@ -1,22 +1,31 @@
<template> <template>
<!-- 使用 transition 组件为头部添加动画效果 -->
<transition name="showHeader"> <transition name="showHeader">
<!-- 根据 visible 属性控制头部的显示与隐藏 -->
<div v-if="visible" class="header-animat"> <div v-if="visible" class="header-animat">
<!-- 根据 visible 属性fixedHeadersidebarOpened 等属性动态设置头部样式 -->
<a-layout-header <a-layout-header
v-if="visible" v-if="visible"
:class="[fixedHeader && 'ant-header-fixedHeader', sidebarOpened ? 'ant-header-side-opened' : 'ant-header-side-closed', ]" :class="[fixedHeader && 'ant-header-fixedHeader', sidebarOpened ? 'ant-header-side-opened' : 'ant-header-side-closed', ]"
:style="{ padding: '0' }"> :style="{ padding: '0' }">
<!-- 根据 mode 属性判断菜单类型并根据不同设备类型显示不同的折叠/展开图标 -->
<div v-if="mode === 'sidemenu'" class="header"> <div v-if="mode === 'sidemenu'" class="header">
<a-icon v-if="device==='mobile'" class="trigger" :type="collapsed ? 'menu-fold' : 'menu-unfold'" @click="toggle"/> <a-icon v-if="device==='mobile'" class="trigger" :type="collapsed ? 'menu-fold' : 'menu-unfold'" @click="toggle"/>
<a-icon v-else class="trigger" :type="collapsed ? 'menu-unfold' : 'menu-fold'" @click="toggle"/> <a-icon v-else class="trigger" :type="collapsed ? 'menu-unfold' : 'menu-fold'" @click="toggle"/>
<!-- 渲染用户菜单组件 -->
<user-menu></user-menu> <user-menu></user-menu>
</div> </div>
<!-- 对于顶部菜单根据设备类型和折叠状态显示不同布局和图标 -->
<div v-else :class="['top-nav-header-index', theme]"> <div v-else :class="['top-nav-header-index', theme]">
<div class="header-index-wide"> <div class="header-index-wide">
<div class="header-index-left"> <div class="header-index-left">
<!-- 渲染 logo 组件根据设备类型决定是否显示标题 -->
<logo class="top-nav-header" :show-title="device !== 'mobile'"/> <logo class="top-nav-header" :show-title="device !== 'mobile'"/>
<!-- 根据设备类型和折叠状态渲染菜单 -->
<s-menu v-if="device !== 'mobile'" mode="horizontal" :menu="menus" :theme="theme" /> <s-menu v-if="device !== 'mobile'" mode="horizontal" :menu="menus" :theme="theme" />
<a-icon v-else class="trigger" :type="collapsed ? 'menu-fold' : 'menu-unfold'" @click="toggle" /> <a-icon v-else class="trigger" :type="collapsed ? 'menu-fold' : 'menu-unfold'" @click="toggle" />
</div> </div>
<!-- 渲染用户菜单组件 -->
<user-menu class="header-index-right"></user-menu> <user-menu class="header-index-right"></user-menu>
</div> </div>
</div> </div>
@ -25,10 +34,11 @@
</transition> </transition>
</template> </template>
<script> <script>// logo
import UserMenu from '../tools/UserMenu' import UserMenu from '../tools/UserMenu'
import SMenu from '../Menu/' import SMenu from '../Menu/'
import Logo from '../tools/Logo' import Logo from '../tools/Logo'
// 使
import { mixin } from '../../utils/mixin' import { mixin } from '../../utils/mixin'
export default { export default {
@ -39,6 +49,7 @@ export default {
Logo Logo
}, },
mixins: [mixin], mixins: [mixin],
//
props: { props: {
mode: { mode: {
type: String, type: String,
@ -67,14 +78,18 @@ export default {
}, },
data () { data () {
return { return {
//
visible: true, visible: true,
//
oldScrollTop: 0 oldScrollTop: 0
} }
}, },
// /
mounted () { mounted () {
document.body.addEventListener('scroll', this.handleScroll, { passive: true }) document.body.addEventListener('scroll', this.handleScroll, { passive: true })
}, },
methods: { methods: {
//
handleScroll () { handleScroll () {
if (!this.autoHideHeader) { if (!this.autoHideHeader) {
return return
@ -96,17 +111,19 @@ export default {
}) })
} }
}, },
// toggle
toggle () { toggle () {
this.$emit('toggle') this.$emit('toggle')
} }
}, },
//
beforeDestroy () { beforeDestroy () {
document.body.removeEventListener('scroll', this.handleScroll, true) document.body.removeEventListener('scroll', this.handleScroll, true)
} }
} }
</script> </script>
<style lang="less"> <style lang="less">//
.header-animat{ .header-animat{
position: relative; position: relative;
z-index: 2; z-index: 2;

@ -1,11 +1,14 @@
<template> <template>
<!-- 侧边栏组件包含logo和菜单 -->
<a-layout-sider <a-layout-sider
:class="['sider', isDesktop() ? null : 'shadow', theme, fixSiderbar ? 'ant-fixed-sidemenu' : null ]" :class="['sider', isDesktop() ? null : 'shadow', theme, fixSiderbar ? 'ant-fixed-sidemenu' : null ]"
width="256px" width="256px"
:collapsible="collapsible" :collapsible="collapsible"
v-model="collapsed" v-model="collapsed"
:trigger="null"> :trigger="null">
<!-- Logo组件 -->
<logo /> <logo />
<!-- 菜单组件 -->
<s-menu <s-menu
:collapsed="collapsed" :collapsed="collapsed"
:menu="menus" :menu="menus"
@ -17,7 +20,7 @@
</template> </template>
<script> <script>// LogoSMenu
import Logo from '../../components/tools/Logo' import Logo from '../../components/tools/Logo'
import SMenu from './index' import SMenu from './index'
import { mixin, mixinDevice } from '../../utils/mixin' import { mixin, mixinDevice } from '../../utils/mixin'

@ -26,22 +26,35 @@
--> -->
<script> <script>
/**
* 多标签页组件
*/
export default { export default {
name: 'MultiTab', name: 'MultiTab',
data () { data () {
return { return {
// fullPath
fullPathList: [], fullPathList: [],
//
pages: [], pages: [],
// fullPath
activeKey: '', activeKey: '',
//
newTabIndex: 0 newTabIndex: 0
} }
}, },
created () { created () {
//
this.pages.push(this.$route) this.pages.push(this.$route)
this.fullPathList.push(this.$route.fullPath) this.fullPathList.push(this.$route.fullPath)
this.selectedLastPath() this.selectedLastPath()
}, },
methods: { methods: {
/**
* 处理标签页编辑事件
* @param {String} targetKey - 目标标签页的 fullPath
* @param {String} action - 操作类型例如'remove'
*/
onEdit (targetKey, action) { onEdit (targetKey, action) {
this[action](targetKey) this[action](targetKey)
}, },
@ -53,11 +66,14 @@ export default {
this.selectedLastPath() this.selectedLastPath()
} }
}, },
/**
* 选择最后一个标签页
*/
selectedLastPath () { selectedLastPath () {
this.activeKey = this.fullPathList[this.fullPathList.length - 1] this.activeKey = this.fullPathList[this.fullPathList.length - 1]
}, },
// content menu //
closeThat (e) { closeThat (e) {
this.remove(e) this.remove(e)
}, },
@ -93,6 +109,10 @@ export default {
} }
}) })
}, },
/**
* 处理右键菜单点击事件
* @param {Object} { key, item, domEvent } - 菜单项的相关信息
*/
closeMenuClick ({ key, item, domEvent }) { closeMenuClick ({ key, item, domEvent }) {
const vkey = domEvent.target.getAttribute('data-vkey') const vkey = domEvent.target.getAttribute('data-vkey')
switch (key) { switch (key) {
@ -111,6 +131,10 @@ export default {
break break
} }
}, },
/**
* 渲染标签页右键菜单
* @param {String} e - 标签页的 fullPath
*/
renderTabPaneMenu (e) { renderTabPaneMenu (e) {
return ( return (
<a-menu {...{ on: { click: this.closeMenuClick } }}> <a-menu {...{ on: { click: this.closeMenuClick } }}>
@ -122,6 +146,11 @@ export default {
) )
}, },
// render // render
/**
* 渲染标签页
* @param {String} title - 标签页的标题
* @param {String} keyPath - 标签页的 fullPath
*/
renderTabPane (title, keyPath) { renderTabPane (title, keyPath) {
const menu = this.renderTabPaneMenu(keyPath) const menu = this.renderTabPaneMenu(keyPath)
@ -133,6 +162,10 @@ export default {
} }
}, },
watch: { watch: {
/**
* 监听路由变化更新标签页列表和激活的标签页
* @param {Object} newVal - 新的路由信息
*/
'$route': function (newVal) { '$route': function (newVal) {
this.activeKey = newVal.fullPath this.activeKey = newVal.fullPath
if (this.fullPathList.indexOf(newVal.fullPath) < 0) { if (this.fullPathList.indexOf(newVal.fullPath) < 0) {
@ -140,6 +173,10 @@ export default {
this.pages.push(newVal) this.pages.push(newVal)
} }
}, },
/**
* 监听激活的标签页变化更新路由
* @param {String} newPathKey - 新的激活标签页的 fullPath
*/
activeKey: function (newPathKey) { activeKey: function (newPathKey) {
this.$router.push({ path: newPathKey }) this.$router.push({ path: newPathKey })
} }

@ -1,28 +1,38 @@
<template> <template>
<!-- 页面头部组件 -->
<div class="page-header"> <div class="page-header">
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<!-- 面包屑导航 -->
<s-breadcrumb /> <s-breadcrumb />
<div class="detail"> <div class="detail">
<!-- 主要内容区域 -->
<div class="main" v-if="!$route.meta.hiddenHeaderContent"> <div class="main" v-if="!$route.meta.hiddenHeaderContent">
<div class="row"> <div class="row">
<!-- Logo图片 -->
<img v-if="logo" :src="logo" class="logo"/> <img v-if="logo" :src="logo" class="logo"/>
<!-- 页面标题 -->
<h1 v-if="title" class="title">{{ title }}</h1> <h1 v-if="title" class="title">{{ title }}</h1>
<!-- 自定义操作区域 -->
<div class="action"> <div class="action">
<slot name="action"></slot> <slot name="action"></slot>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<!-- 头像 -->
<div v-if="avatar" class="avatar"> <div v-if="avatar" class="avatar">
<a-avatar :src="avatar" /> <a-avatar :src="avatar" />
</div> </div>
<!-- 自定义内容区域 -->
<div v-if="this.$slots.content" class="headerContent"> <div v-if="this.$slots.content" class="headerContent">
<slot name="content"></slot> <slot name="content"></slot>
</div> </div>
<!-- 额外的自定义区域 -->
<div v-if="this.$slots.extra" class="extra"> <div v-if="this.$slots.extra" class="extra">
<slot name="extra"></slot> <slot name="extra"></slot>
</div> </div>
</div> </div>
<div> <div>
<!-- 页面菜单 -->
<slot name="pageMenu"></slot> <slot name="pageMenu"></slot>
</div> </div>
</div> </div>
@ -31,25 +41,28 @@
</div> </div>
</template> </template>
<script> <script>//
import Breadcrumb from '../../components/tools/Breadcrumb' import Breadcrumb from '../../components/tools/Breadcrumb'
//
export default { export default {
name: 'PageHeader', name: 'PageHeader',
components: { components: {
's-breadcrumb': Breadcrumb 's-breadcrumb': Breadcrumb
}, },
props: { props: {
// true
title: { title: {
type: [String, Boolean], type: [String, Boolean],
default: true, default: true,
required: false required: false
}, },
// Logo
logo: { logo: {
type: String, type: String,
default: '', default: '',
required: false required: false
}, },
//
avatar: { avatar: {
type: String, type: String,
default: '', default: '',
@ -62,7 +75,7 @@ export default {
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>//
.page-header { .page-header {
background: #fff; background: #fff;
padding: 16px 32px 0; padding: 16px 32px 0;
@ -152,7 +165,7 @@ export default {
} }
} }
} }
//
.mobile .page-header { .mobile .page-header {
.main { .main {
.row { .row {

@ -1,28 +1,34 @@
<template> <template>
<!-- 结果展示组件 -->
<div class="result"> <div class="result">
<!-- 根据成功或错误状态动态显示对应图标 -->
<div> <div>
<a-icon :class="{ 'icon': true, [`${type}`]: true }" :type="localIsSuccess ? 'check-circle' : 'close-circle'"/> <a-icon :class="{ 'icon': true, [`${type}`]: true }" :type="localIsSuccess ? 'check-circle' : 'close-circle'"/>
</div> </div>
<!-- 标题区域支持自定义插槽内容 -->
<div class="title"> <div class="title">
<slot name="title"> <slot name="title">
{{ title }} {{ title }}
</slot> </slot>
</div> </div>
<!-- 描述区域支持自定义插槽内容 -->
<div class="description"> <div class="description">
<slot name="description"> <slot name="description">
{{ description }} {{ description }}
</slot> </slot>
</div> </div>
<!-- 额外信息区域根据插槽内容动态显示 -->
<div class="extra" v-if="$slots.default"> <div class="extra" v-if="$slots.default">
<slot></slot> <slot></slot>
</div> </div>
<!-- 操作区域根据插槽内容动态显示 -->
<div class="action" v-if="$slots.action"> <div class="action" v-if="$slots.action">
<slot name="action"></slot> <slot name="action"></slot>
</div> </div>
</div> </div>
</template> </template>
<script> <script>//
const resultEnum = ['success', 'error'] const resultEnum = ['success', 'error']
export default { export default {
@ -33,6 +39,7 @@ export default {
type: Boolean, type: Boolean,
default: false default: false
}, },
// success error
type: { type: {
type: String, type: String,
default: resultEnum[0], default: resultEnum[0],
@ -40,16 +47,19 @@ export default {
return (val) => resultEnum.includes(val) return (val) => resultEnum.includes(val)
} }
}, },
//
title: { title: {
type: String, type: String,
default: '' default: ''
}, },
//
description: { description: {
type: String, type: String,
default: '' default: ''
} }
}, },
computed: { computed: {
//
localIsSuccess: function () { localIsSuccess: function () {
return this.type === resultEnum[0] return this.type === resultEnum[0]
} }
@ -69,9 +79,11 @@ export default {
line-height: 72px; line-height: 72px;
margin-bottom: 24px; margin-bottom: 24px;
} }
//
.success { .success {
color: #52c41a; color: #52c41a;
} }
//
.error { .error {
color: red; color: red;
} }

@ -1,12 +1,22 @@
<template> <template>
<!-- 设置项容器 -->
<div class="setting-drawer-index-item"> <div class="setting-drawer-index-item">
<!-- 设置项标题 -->
<h3 class="setting-drawer-index-title">{{ title }}</h3> <h3 class="setting-drawer-index-title">{{ title }}</h3>
<!-- 插槽内容用于显示设置项的具体内容 -->
<slot></slot> <slot></slot>
<!-- 根据props中的divider决定是否显示分割线 -->
<a-divider v-if="divider"/> <a-divider v-if="divider"/>
</div> </div>
</template> </template>
<script> <script>
/**
* 设置项组件
*
* @param {String} title - 设置项的标题默认为空字符串
* @param {Boolean} divider - 是否显示设置项后的分割线默认不显示
*/
export default { export default {
name: 'SettingItem', name: 'SettingItem',
props: { props: {
@ -22,11 +32,11 @@ export default {
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>/* 设置项样式 */
.setting-drawer-index-item { .setting-drawer-index-item {
margin-bottom: 24px; margin-bottom: 24px;
/* 设置项标题样式 */
.setting-drawer-index-title { .setting-drawer-index-title {
font-size: 14px; font-size: 14px;
color: rgba(0, 0, 0, .85); color: rgba(0, 0, 0, .85);

@ -1,15 +1,18 @@
<template> <template>
<!-- 标准表单行组件根据不同的属性组合有不同的样式表现 -->
<div :class="[prefixCls, lastCls, blockCls, gridCls]"> <div :class="[prefixCls, lastCls, blockCls, gridCls]">
<!-- 标题部分只有当title属性存在时才显示 -->
<div v-if="title" class="antd-pro-components-standard-form-row-index-label"> <div v-if="title" class="antd-pro-components-standard-form-row-index-label">
<span>{{ title }}</span> <span>{{ title }}</span>
</div> </div>
<!-- 内容部分使用slot以便于自定义内容 -->
<div class="antd-pro-components-standard-form-row-index-content"> <div class="antd-pro-components-standard-form-row-index-content">
<slot></slot> <slot></slot>
</div> </div>
</div> </div>
</template> </template>
<script> <script>//
const classes = [ const classes = [
'antd-pro-components-standard-form-row-index-standardFormRowBlock', 'antd-pro-components-standard-form-row-index-standardFormRowBlock',
'antd-pro-components-standard-form-row-index-standardFormRowGrid', 'antd-pro-components-standard-form-row-index-standardFormRowGrid',
@ -17,6 +20,7 @@ const classes = [
] ]
export default { export default {
name: 'StandardFormRow', name: 'StandardFormRow',
//
props: { props: {
prefixCls: { prefixCls: {
type: String, type: String,
@ -36,6 +40,7 @@ export default {
type: Boolean type: Boolean
} }
}, },
// props
computed: { computed: {
lastCls () { lastCls () {
return this.last ? classes[2] : null return this.last ? classes[2] : null
@ -50,9 +55,9 @@ export default {
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>//
@import '../index.less'; @import '../index.less';
//
.antd-pro-components-standard-form-row-index-standardFormRow { .antd-pro-components-standard-form-row-index-standardFormRow {
display: flex; display: flex;
margin-bottom: 16px; margin-bottom: 16px;
@ -71,7 +76,7 @@ export default {
padding: 0; padding: 0;
line-height: 32px; line-height: 32px;
} }
//
.antd-pro-components-standard-form-row-index-label { .antd-pro-components-standard-form-row-index-label {
flex: 0 0 auto; flex: 0 0 auto;
margin-right: 24px; margin-right: 24px;
@ -87,27 +92,27 @@ export default {
} }
} }
} }
//
.antd-pro-components-standard-form-row-index-content { .antd-pro-components-standard-form-row-index-content {
flex: 1 1 0; flex: 1 1 0;
/deep/ .ant-form-item:last-child { /deep/ .ant-form-item:last-child {
margin-right: 0; margin-right: 0;
} }
} }
//
&.antd-pro-components-standard-form-row-index-standardFormRowLast { &.antd-pro-components-standard-form-row-index-standardFormRowLast {
margin-bottom: 0; margin-bottom: 0;
padding-bottom: 0; padding-bottom: 0;
border: none; border: none;
} }
// 使block
&.antd-pro-components-standard-form-row-index-standardFormRowBlock { &.antd-pro-components-standard-form-row-index-standardFormRowBlock {
/deep/ .ant-form-item, /deep/ .ant-form-item,
div.ant-form-item-control-wrapper { div.ant-form-item-control-wrapper {
display: block; display: block;
} }
} }
// 使grid
&.antd-pro-components-standard-form-row-index-standardFormRowGrid { &.antd-pro-components-standard-form-row-index-standardFormRowGrid {
/deep/ .ant-form-item, /deep/ .ant-form-item,
div.ant-form-item-control-wrapper { div.ant-form-item-control-wrapper {

@ -1,6 +1,9 @@
<template> <template>
<!-- 面包屑组件 -->
<a-breadcrumb class="breadcrumb"> <a-breadcrumb class="breadcrumb">
<!-- 遍历面包屑列表生成每个面包屑项 -->
<a-breadcrumb-item v-for="(item, index) in breadList" :key="item.name"> <a-breadcrumb-item v-for="(item, index) in breadList" :key="item.name">
<!-- 根据条件渲染面包屑项的链接或文本 -->
<router-link <router-link
v-if="item.name != name && index != 1" v-if="item.name != name && index != 1"
:to="{ path: item.path === '' ? '/' : item.path }" :to="{ path: item.path === '' ? '/' : item.path }"
@ -14,26 +17,35 @@
export default { export default {
data () { data () {
return { return {
//
name: '', name: '',
//
breadList: [] breadList: []
} }
}, },
created () { created () {
//
this.getBreadcrumb() this.getBreadcrumb()
}, },
methods: { methods: {
/**
* 获取面包屑信息
* 该方法根据当前路由生成面包屑列表
*/
getBreadcrumb () { getBreadcrumb () {
this.breadList = [] this.breadList = []
// this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: ''}}) // this.breadList.push({name: 'index', path: '/dashboard/', meta: {title: ''}})
//
this.name = this.$route.name this.name = this.$route.name
this.$route.matched.forEach(item => { this.$route.matched.forEach(item => {
// item.name !== 'index' && this.breadList.push(item) // item.name !== 'index' && this.breadList.push(item)
//
this.breadList.push(item) this.breadList.push(item)
}) })
} }
}, },
watch: { watch: {
//
$route () { $route () {
this.getBreadcrumb() this.getBreadcrumb()
} }

@ -1,14 +1,19 @@
<template> <template>
<!-- 头部信息组件根据props调整样式和布局 -->
<div class="head-info" :class="center && 'center'"> <div class="head-info" :class="center && 'center'">
<!-- 显示标题 -->
<span>{{ title }}</span> <span>{{ title }}</span>
<!-- 显示内容 -->
<p>{{ content }}</p> <p>{{ content }}</p>
<!-- 根据bordered prop决定是否显示边框 -->
<em v-if="bordered"/> <em v-if="bordered"/>
</div> </div>
</template> </template>
<script> <script>//
export default { export default {
name: 'HeadInfo', name: 'HeadInfo',
//
props: { props: {
title: { title: {
type: String, type: String,

@ -1,26 +1,34 @@
<template> <template>
<!-- Logo组件主体 -->
<div class="logo"> <div class="logo">
<!-- 使用router-link组件创建到dashboard的链接 -->
<router-link :to="{name:'dashboard'}"> <router-link :to="{name:'dashboard'}">
<!-- 渲染LogoSvg组件带alt属性说明 -->
<LogoSvg alt="logo" /> <LogoSvg alt="logo" />
<!-- 根据showTitle属性决定是否显示标题 -->
<h1 v-if="showTitle">{{ title }}</h1> <h1 v-if="showTitle">{{ title }}</h1>
</router-link> </router-link>
</div> </div>
</template> </template>
<script> <script>// logo.svg
import LogoSvg from '../../assets/logo.svg?inline' import LogoSvg from '../../assets/logo.svg?inline'
// Logo
export default { export default {
name: 'Logo', name: 'Logo',
//
components: { components: {
LogoSvg LogoSvg
}, },
props: { props: {
// titleString'Online Exam'
title: { title: {
type: String, type: String,
default: 'Online Exam', default: 'Online Exam',
required: false required: false
}, },
// showTitleBooleantrue
showTitle: { showTitle: {
type: Boolean, type: Boolean,
default: true, default: true,

@ -1,19 +1,28 @@
<template> <template>
<!-- 用户信息和操作菜单的容器 -->
<div class="user-wrapper"> <div class="user-wrapper">
<div class="content-box"> <div class="content-box">
<!-- 用户下拉菜单 -->
<a-dropdown> <a-dropdown>
<!-- 用户信息展示区域 -->
<span class="action ant-dropdown-link user-dropdown-menu"> <span class="action ant-dropdown-link user-dropdown-menu">
<!-- 用户头像 -->
<a-avatar class="avatar" size="small" :src="avatar()"/> <a-avatar class="avatar" size="small" :src="avatar()"/>
<!-- 用户昵称 -->
<span>{{ nickname() }}</span> <span>{{ nickname() }}</span>
</span> </span>
<!-- 下拉菜单内容 -->
<a-menu slot="overlay" class="user-dropdown-menu-wrapper"> <a-menu slot="overlay" class="user-dropdown-menu-wrapper">
<!-- 账户设置菜单项 -->
<a-menu-item key="1"> <a-menu-item key="1">
<router-link :to="{ name: 'settings' }"> <router-link :to="{ name: 'settings' }">
<a-icon type="setting"/> <a-icon type="setting"/>
<span>账户设置</span> <span>账户设置</span>
</router-link> </router-link>
</a-menu-item> </a-menu-item>
<!-- 菜单分割符 -->
<a-menu-divider/> <a-menu-divider/>
<!-- 退出登录菜单项 -->
<a-menu-item key="3"> <a-menu-item key="3">
<a href="javascript:;" @click="handleLogout"> <a href="javascript:;" @click="handleLogout">
<a-icon type="logout"/> <a-icon type="logout"/>
@ -44,6 +53,7 @@ export default {
return that.Logout({}).then(() => { return that.Logout({}).then(() => {
window.location.reload() window.location.reload()
}).catch(err => { }).catch(err => {
//
that.$message.error({ that.$message.error({
title: '错误', title: '错误',
description: err.message description: err.message
@ -51,6 +61,7 @@ export default {
}) })
}, },
onCancel () { onCancel () {
//
} }
}) })
} }

@ -14,16 +14,26 @@ import store from '../../store'
* *
* @see https://github.com/sendya/ant-design-pro-vue/pull/53 * @see https://github.com/sendya/ant-design-pro-vue/pull/53
*/ */
/**
* 创建一个 Vue 自定义指令 'action'用于控制元素基于用户权限的显示
*/
const action = Vue.directive('action', { const action = Vue.directive('action', {
inserted: function (el, binding, vnode) { inserted: function (el, binding, vnode) {
// 获取指令的参数,即动作名称
const actionName = binding.arg const actionName = binding.arg
// 从 Vuex store 中获取当前用户的角色信息
const roles = store.getters.roles const roles = store.getters.roles
// 获取当前路由的权限配置
const elVal = vnode.context.$route.meta.permission const elVal = vnode.context.$route.meta.permission
// 确保权限配置为数组形式
const permissionId = elVal instanceof String && [elVal] || elVal const permissionId = elVal instanceof String && [elVal] || elVal
// 遍历用户角色的权限列表
roles.permissions.forEach(p => { roles.permissions.forEach(p => {
// 如果当前权限ID不在元素的权限配置中直接返回
if (!permissionId.includes(p.permissionId)) { if (!permissionId.includes(p.permissionId)) {
return return
} }
// 如果当前权限有动作列表限制,且动作列表中不包含指令的参数,移除或隐藏元素
if (p.actionList && !p.actionList.includes(actionName)) { if (p.actionList && !p.actionList.includes(actionName)) {
el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none') el.parentNode && el.parentNode.removeChild(el) || (el.style.display = 'none')
} }

@ -1,16 +1,20 @@
<template> <template>
<!-- 主要用于渲染子路由组件 -->
<div> <div>
<router-view /> <router-view />
</div> </div>
</template> </template>
<script> <script>
/**
* 定义一个名为 BlankLayout Vue 组件
* 该组件用作空白布局通常用于需要一个干净的页面来进行特定的功能或展示
*/
export default { export default {
name: 'BlankLayout' name: 'BlankLayout'
} }
</script> </script>
<style scoped> <style scoped>
/* 此处添加特定于组件的样式,使用 scoped 属性确保样式仅在本组件内生效 */
</style> </style>

@ -1,10 +1,16 @@
<template> <template>
<!-- 根据路由元数据决定是否显示页面头部内容 -->
<div :style="!$route.meta.hiddenHeaderContent ? 'margin: -24px -24px 0px;' : null"> <div :style="!$route.meta.hiddenHeaderContent ? 'margin: -24px -24px 0px;' : null">
<!-- pageHeader , route meta :true on hide --> <!-- pageHeader , route meta :true on hide -->
<!-- 条件渲染页面头部组件 -->
<page-header v-if="!$route.meta.hiddenHeaderContent" :title="pageTitle" :logo="logo" :avatar="avatar"> <page-header v-if="!$route.meta.hiddenHeaderContent" :title="pageTitle" :logo="logo" :avatar="avatar">
<!-- 插槽用于自定义操作按钮 -->
<slot slot="action" name="action"></slot> <slot slot="action" name="action"></slot>
<!-- 插槽用于自定义头部内容 -->
<slot slot="content" name="headerContent"></slot> <slot slot="content" name="headerContent"></slot>
<!-- 默认头部内容当没有自定义头部内容且存在描述时显示 -->
<div slot="content" v-if="!this.$slots.headerContent && description"> <div slot="content" v-if="!this.$slots.headerContent && description">
<!-- 显示链接列表 -->
<p style="font-size: 14px;color: rgba(0,0,0,.65)">{{ description }}</p> <p style="font-size: 14px;color: rgba(0,0,0,.65)">{{ description }}</p>
<div class="link"> <div class="link">
<template v-for="(link, index) in linkList"> <template v-for="(link, index) in linkList">
@ -15,12 +21,15 @@
</template> </template>
</div> </div>
</div> </div>
<!-- 插槽用于自定义额外内容 -->
<slot slot="extra" name="extra"> <slot slot="extra" name="extra">
<div class="extra-img"> <div class="extra-img">
<img v-if="typeof extraImage !== 'undefined'" :src="extraImage"/> <img v-if="typeof extraImage !== 'undefined'" :src="extraImage"/>
</div> </div>
</slot> </slot>
<!-- 页面菜单区域 -->
<div slot="pageMenu"> <div slot="pageMenu">
<!-- 条件渲染搜索框 -->
<div class="page-menu-search" v-if="search"> <div class="page-menu-search" v-if="search">
<a-input-search <a-input-search
style="width: 80%; max-width: 522px;" style="width: 80%; max-width: 522px;"
@ -29,6 +38,7 @@
enterButton="搜索" enterButton="搜索"
/> />
</div> </div>
<!-- 条件渲染标签页 -->
<div class="page-menu-tabs" v-if="tabs && tabs.items"> <div class="page-menu-tabs" v-if="tabs && tabs.items">
<!-- @change="callback" :activeKey="activeKey" --> <!-- @change="callback" :activeKey="activeKey" -->
<a-tabs :tabBarStyle="{margin: 0}" :activeKey="tabs.active()" @change="tabs.callback"> <a-tabs :tabBarStyle="{margin: 0}" :activeKey="tabs.active()" @change="tabs.callback">
@ -37,10 +47,13 @@
</div> </div>
</div> </div>
</page-header> </page-header>
<!-- 主要内容区域 -->
<div class="content"> <div class="content">
<!-- 插槽用于自定义页面内容 -->
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<slot> <slot>
<!-- keep-alive --> <!-- keep-alive -->
<!-- 条件渲染路由视图支持多页签 -->
<keep-alive v-if="multiTab"> <keep-alive v-if="multiTab">
<router-view ref="content" /> <router-view ref="content" />
</keep-alive> </keep-alive>
@ -96,15 +109,19 @@ export default {
this.getPageMeta() this.getPageMeta()
}, },
methods: { methods: {
//
getPageMeta () { getPageMeta () {
// eslint-disable-next-line // eslint-disable-next-line
// title
this.pageTitle = (typeof(this.title) === 'string' || !this.title) ? this.title : this.$route.meta.title this.pageTitle = (typeof(this.title) === 'string' || !this.title) ? this.title : this.$route.meta.title
const content = this.$refs.content const content = this.$refs.content
if (content) { if (content) {
if (content.pageMeta) { if (content.pageMeta) {
// pageMeta
Object.assign(this, content.pageMeta) Object.assign(this, content.pageMeta)
} else { } else {
//
this.description = content.description this.description = content.description
this.linkList = content.linkList this.linkList = content.linkList
this.extraImage = content.extraImage this.extraImage = content.extraImage

@ -1,22 +1,32 @@
<script> <script>
/**
* 定义一个名为 RouteView Vue 组件
* 该组件根据路由的 meta 信息和 store 中的 multiTab 状态决定是否缓存路由视图
*/
export default { export default {
//
name: 'RouteView', name: 'RouteView',
props: { props: {
// true
keepAlive: { keepAlive: {
type: Boolean, type: Boolean,
default: true default: true
} }
}, },
//
data () { data () {
return {} return {}
}, },
//
render () { render () {
// meta store getters
const { $route: { meta }, $store: { getters } } = this const { $route: { meta }, $store: { getters } } = this
const inKeep = ( const inKeep = (
<keep-alive> <keep-alive>
<router-view /> <router-view />
</keep-alive> </keep-alive>
) )
//
const notKeep = ( const notKeep = (
<router-view /> <router-view />
) )
@ -26,6 +36,7 @@ export default {
if (!getters.multiTab && meta.keepAlive === false) { if (!getters.multiTab && meta.keepAlive === false) {
return notKeep return notKeep
} }
// keepAlive multiTab keepAlive
return this.keepAlive || getters.multiTab || meta.keepAlive ? inKeep : notKeep return this.keepAlive || getters.multiTab || meta.keepAlive ? inKeep : notKeep
} }
} }

@ -1,34 +1,39 @@
<template> <template>
<!-- 用户布局模板根据设备类型调整样式 -->
<div id="userLayout" :class="['user-layout-wrapper', device]"> <div id="userLayout" :class="['user-layout-wrapper', device]">
<div class="container"> <div class="container">
<div class="top"> <div class="top">
<div class="header"> <div class="header">
<!-- 顶部标题和logo -->
<a href="/"> <a href="/">
<img src="../assets/logo.svg" class="logo" alt="logo"> <img src="../assets/logo.svg" class="logo" alt="logo">
<span class="title">Online Exam</span> <span class="title">Online Exam</span>
</a> </a>
</div> </div>
<div class="desc"> <div class="desc">
<!-- 系统描述 -->
基于SpringBoot+Vue实现的在线考试系统 基于SpringBoot+Vue实现的在线考试系统
</div> </div>
</div> </div>
<!-- 路由视图用于显示子路由的内容 -->
<route-view></route-view> <route-view></route-view>
<div class="footer"> <div class="footer">
<div class="links"> <div class="links">
<!-- 底部链接 -->
<a href="https://github.com/19920625lsg/spring-boot-online-exam" target="_blank">代码仓</a> <a href="https://github.com/19920625lsg/spring-boot-online-exam" target="_blank">代码仓</a>
<a href="https://19920625lsg.github.io" target="_blank">关于我</a> <a href="https://19920625lsg.github.io" target="_blank">关于我</a>
<a href="mailto:liangshanguang2@gmail.com">联系我</a> <a href="mailto:liangshanguang2@gmail.com">联系我</a>
</div> </div>
<div class="copyright"> <div class="copyright">
<!-- 版权信息 -->
Copyright &copy; 2020 Liang Shan Guang Copyright &copy; 2020 Liang Shan Guang
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
// RouteView
<script> <script>
import RouteView from './RouteView' import RouteView from './RouteView'
import { mixinDevice } from '../utils/mixin' import { mixinDevice } from '../utils/mixin'
@ -41,9 +46,11 @@ export default {
return {} return {}
}, },
mounted () { mounted () {
// bodyuserLayout
document.body.classList.add('userLayout') document.body.classList.add('userLayout')
}, },
beforeDestroy () { beforeDestroy () {
// bodyuserLayout
document.body.classList.remove('userLayout') document.body.classList.remove('userLayout')
} }
} }
@ -52,7 +59,7 @@ export default {
<style lang="less" scoped> <style lang="less" scoped>
#userLayout.user-layout-wrapper { #userLayout.user-layout-wrapper {
height: 100%; height: 100%;
//
&.mobile { &.mobile {
.container { .container {
.main { .main {

@ -1,11 +1,14 @@
<template> <template>
<!-- 使用 ExceptionPage 组件来显示 404 错误页面 -->
<exception-page type="404" /> <exception-page type="404" />
</template> </template>
<script> <script>
// ../../componentsExceptionPage
import { ExceptionPage } from '../../components' import { ExceptionPage } from '../../components'
// components
export default { export default {
//
components: { components: {
ExceptionPage ExceptionPage
} }
@ -13,5 +16,5 @@ export default {
</script> </script>
<style scoped> <style scoped>
/* 此处写入组件的样式scoped属性确保样式仅在本组件生效 */
</style> </style>

@ -1,10 +1,12 @@
<template> <template>
<!-- 使用 ExceptionPage 组件来显示 500 错误页面 -->
<exception-page type="500" /> <exception-page type="500" />
</template> </template>
<script> <script>
// ExceptionPage
import { ExceptionPage } from '../../components' import { ExceptionPage } from '../../components'
// components ExceptionPage
export default { export default {
components: { components: {
ExceptionPage ExceptionPage
@ -13,5 +15,5 @@ export default {
</script> </script>
<style scoped> <style scoped>
>/* 此处添加组件的样式,由于没有样式内容,所以留空 */
</style> </style>

@ -1,24 +1,35 @@
<template> <template>
<!-- 头部区域 -->
<div class="banner-wrapper"> <div class="banner-wrapper">
<!-- 标题区域 -->
<div class="banner-title-wrapper"> <div class="banner-title-wrapper">
<!-- 标题线动画效果 -->
<div class="title-line-wrapper" style="opacity: 1; transform: translate(0px, 0px);"> <div class="title-line-wrapper" style="opacity: 1; transform: translate(0px, 0px);">
<div class="title-line" style="transform: translateX(-64px);"></div> <div class="title-line" style="transform: translateX(-64px);"></div>
</div> </div>
<!-- 主标题 -->
<h1 class="" style="opacity: 1; transform: translate(0px, 0px);">Online Exam</h1> <h1 class="" style="opacity: 1; transform: translate(0px, 0px);">Online Exam</h1>
<!-- 副标题 -->
<p style="opacity: 1; transform: translate(0px, 0px);"> <p style="opacity: 1; transform: translate(0px, 0px);">
<span>基于SpringBoot+Vue技术栈开发的在线考试系统</span> <span>基于SpringBoot+Vue技术栈开发的在线考试系统</span>
</p> </p>
<!-- 按钮区域 -->
<div class="button-wrapper"> <div class="button-wrapper">
<!-- 预览按钮链接到GitHub页面 -->
<a href="https://github.com/19920625lsg"> <a href="https://github.com/19920625lsg">
<a-button type="primary">预览</a-button> <a-button type="primary">预览</a-button>
</a> </a>
<!-- 开始使用按钮点击后导航到文档页面 -->
<a @click="$router.push({ name: 'docs' })"> <a @click="$router.push({ name: 'docs' })">
<a-button style="margin: 0 16px;">开始使用</a-button> <a-button style="margin: 0 16px;">开始使用</a-button>
</a> </a>
</div> </div>
</div> </div>
<!-- 图片轮播区域 -->
<div class="banner-image-wrapper" style="opacity: 1;"> <div class="banner-image-wrapper" style="opacity: 1;">
<!-- 图片轮播组件设置自动播放和显示箭头 -->
<a-carousel arrows autoplay> <a-carousel arrows autoplay>
<!-- 动态生成轮播图片 -->
<div v-for="i in 5" :key="i"> <div v-for="i in 5" :key="i">
<img :src="`/home/cover${i}.jpg`" style="height: 324px"/> <img :src="`/home/cover${i}.jpg`" style="height: 324px"/>
</div> </div>
@ -28,11 +39,12 @@
</template> </template>
<script> <script>
// 'Banner'
export default { export default {
name: 'Banner' name: 'Banner'
} }
</script> </script>
//
<style lang="less"> <style lang="less">
@import "home"; @import "home";
</style> </style>

@ -1,6 +1,8 @@
<template> <template>
<!-- 使用 v-for 遍历 dataSource 数组为每个列表生成一个 ul 元素 -->
<div> <div>
<ul class="page1-box-wrapper" v-for="(list, index) in dataSource" :key="index"> <ul class="page1-box-wrapper" v-for="(list, index) in dataSource" :key="index">
<!-- 使用 v-for 遍历当前列表为每个项生成一个 listItem 组件 -->
<template v-for="item in list"> <template v-for="item in list">
<list-item :item="item" :key="item.title"/> <list-item :item="item" :key="item.title"/>
</template> </template>
@ -9,14 +11,18 @@
</template> </template>
<script> <script>
// ListItem
import ListItem from './ListItem' import ListItem from './ListItem'
// List Vue
export default { export default {
name: 'List', name: 'List',
components: { components: {
// ListItem
ListItem ListItem
}, },
props: { props: {
// dataSource
dataSource: { dataSource: {
type: Array, type: Array,
requited: true, requited: true,
@ -26,6 +32,7 @@ export default {
} }
}, },
watch: { watch: {
// dataSource
dataSource (val) { dataSource (val) {
console.log('dataSource::update', val) console.log('dataSource::update', val)
} }
@ -34,5 +41,5 @@ export default {
</script> </script>
<style scoped> <style scoped>
/* 此处添加组件的样式,使用 scoped 属性限制样式仅在当前组件生效 */
</style> </style>

@ -1,19 +1,28 @@
<template> <template>
<!-- 使用 :key 动态绑定列表项的唯一键值以优化渲染性能 -->
<li :key="item.title"> <li :key="item.title">
<div class="page1-box"> <div class="page1-box">
<!-- 用于装饰或布局的 div可能包含一些样式或动画效果 -->
<div class="page1-point-wrapper"></div> <div class="page1-point-wrapper"></div>
<!-- 使用 :style 动态绑定图片框的阴影颜色增强视觉效果 -->
<div class="page1-image" :style="{ boxShadow: `${item.shadowColor} 0px 6px 12px` }"> <div class="page1-image" :style="{ boxShadow: `${item.shadowColor} 0px 6px 12px` }">
<!-- 动态加载图片资源 -->
<img :src="item.src" /> <img :src="item.src" />
</div> </div>
<!-- 显示列表项的标题 -->
<h3>{{ item.title }}</h3> <h3>{{ item.title }}</h3>
<!-- 显示列表项的内容 -->
<p>{{ item.content }}</p> <p>{{ item.content }}</p>
</div> </div>
</li> </li>
</template> </template>
<script> <script>
// Vue ListItem
export default { export default {
//
name: 'ListItem', name: 'ListItem',
// item
props: { props: {
item: { item: {
type: Object, type: Object,

@ -1,17 +1,26 @@
<template> <template>
<!-- HomePage的主布局 -->
<div class="home-page page1"> <div class="home-page page1">
<!-- 内容包装器用于承载页面元素 -->
<div class="home-page-wrapper" id="page1-wrapper"> <div class="home-page-wrapper" id="page1-wrapper">
<!-- 背景文本通过样式进行位置调整 -->
<div class="page1-bg" style="transform: translate(0px, 200.953px);">Feature</div> <div class="page1-bg" style="transform: translate(0px, 200.953px);">Feature</div>
<!-- 主标题描述页面核心内容 -->
<h2>What can <span>Online System</span> do for you </h2> <h2>What can <span>Online System</span> do for you </h2>
<!-- 标题下装饰线 -->
<div class="title-line-wrapper page1-line"></div> <div class="title-line-wrapper page1-line"></div>
<!-- 使用List组件展示特性列表 -->
<list :data-source="features" /> <list :data-source="features" />
</div> </div>
</div> </div>
</template> </template>
<script> <script>
// List
import List from './List' import List from './List'
//
const featuresCN = [ const featuresCN = [
//
{ {
title: '优雅美观', title: '优雅美观',
content: '基于 Ant Design 体系精心设计', content: '基于 Ant Design 体系精心设计',
@ -19,6 +28,7 @@ const featuresCN = [
color: '#13C2C2', color: '#13C2C2',
shadowColor: 'rgba(19,194,194,.12)' shadowColor: 'rgba(19,194,194,.12)'
}, },
//
{ {
title: '常见设计模式', title: '常见设计模式',
content: '提炼自中后台应用的典型页面和场景', content: '提炼自中后台应用的典型页面和场景',
@ -26,6 +36,7 @@ const featuresCN = [
color: '#2F54EB', color: '#2F54EB',
shadowColor: 'rgba(47,84,235,.12)' shadowColor: 'rgba(47,84,235,.12)'
}, },
//
{ {
title: '最新技术栈', title: '最新技术栈',
content: '使用 Vue/vuex/antd 等前端前沿技术开发', content: '使用 Vue/vuex/antd 等前端前沿技术开发',
@ -33,6 +44,7 @@ const featuresCN = [
color: '#F5222D', color: '#F5222D',
shadowColor: 'rgba(245,34,45,.12)' shadowColor: 'rgba(245,34,45,.12)'
}, },
//
{ {
title: '响应式', title: '响应式',
content: '针对不同屏幕大小设计', content: '针对不同屏幕大小设计',
@ -40,6 +52,7 @@ const featuresCN = [
color: '#1AC44D', color: '#1AC44D',
shadowColor: 'rgba(26,196,77,.12)' shadowColor: 'rgba(26,196,77,.12)'
}, },
//
{ {
title: '最佳实践', title: '最佳实践',
content: '良好的工程实践助你持续产出高质量代码', content: '良好的工程实践助你持续产出高质量代码',
@ -47,6 +60,7 @@ const featuresCN = [
color: '#FA8C16', color: '#FA8C16',
shadowColor: 'rgba(250,140,22,.12)' shadowColor: 'rgba(250,140,22,.12)'
}, },
// UI
{ {
title: 'UI 测试', title: 'UI 测试',
content: '自动化测试保障前端产品质量', content: '自动化测试保障前端产品质量',
@ -57,19 +71,25 @@ const featuresCN = [
] ]
export default { export default {
//
name: 'Page1', name: 'Page1',
//
components: { components: {
List List
}, },
//
data () { data () {
return { return {
features: featuresCN features: featuresCN
} }
}, },
//
created () { created () {
this.updateFeatures() this.updateFeatures()
}, },
//
methods: { methods: {
// 便
updateFeatures () { updateFeatures () {
const arr = featuresCN const arr = featuresCN
const newArr = [[], [], []] const newArr = [[], [], []]

@ -1,7 +1,11 @@
<template> <template>
<!-- 使用Ant Design的a-card组件作为外层容器设置无边框 -->
<a-card :bordered="false"> <a-card :bordered="false">
<!-- 定义操作按钮的工具栏区域 -->
<div id="toolbar"> <div id="toolbar">
<!-- 新建按钮类型为主要按钮primary带有加号图标点击时调用$refs.createQuestionModal.create()方法来触发新建操作 -->
<a-button type="primary" icon="plus" @click="$refs.createQuestionModal.create()"></a-button>&nbsp; <a-button type="primary" icon="plus" @click="$refs.createQuestionModal.create()"></a-button>&nbsp;
<!-- 全量刷新按钮类型为主要按钮primary带有刷新图标点击时调用loadAll()方法来重新加载所有题目数据 -->
<a-button type="primary" icon="reload" @click="loadAll()"></a-button> <a-button type="primary" icon="reload" @click="loadAll()"></a-button>
</div> </div>
<BootstrapTable <BootstrapTable
@ -12,8 +16,11 @@
/> />
<!-- ref是为了方便用this.$refs.modal直接引用下同 --> <!-- ref是为了方便用this.$refs.modal直接引用下同 -->
<step-by-step-question-modal ref="createQuestionModal" @ok="handleOk" /> <step-by-step-question-modal ref="createQuestionModal" @ok="handleOk" />
<!-- 更新题目模态框 -->
<summernote-update-modal ref="questionUpdateModal" @ok="handleOk" /> <summernote-update-modal ref="questionUpdateModal" @ok="handleOk" />
<!-- 查看题目模态框 -->
<question-view-modal ref="modalView" @ok="handleOk" /> <question-view-modal ref="modalView" @ok="handleOk" />
<!-- 编辑题目模态框 -->
<question-edit-modal ref="modalEdit" @ok="handleOk" /> <question-edit-modal ref="modalEdit" @ok="handleOk" />
</a-card> </a-card>
</template> </template>
@ -28,6 +35,15 @@ import SummernoteUpdateModal from '@views/list/modules/SummernoteUpdateModal'
import $ from 'jquery' import $ from 'jquery'
export default { export default {
/**
* 名称QuestionTableList 组件
* 描述此组件用于显示问题表格列表并提供对问题进行详细操作的功能
* 组件包含
* - SummernoteUpdateModal: 用于更新问题描述的模态框
* - StepByStepQuestionModal: 用于逐步解答问题的模态框
* - QuestionViewModal: 用于查看问题详情的模态框
* - QuestionEditModal: 用于编辑问题的模态框
*/
name: 'QuestionTableList', name: 'QuestionTableList',
components: { components: {
SummernoteUpdateModal, SummernoteUpdateModal,
@ -44,69 +60,113 @@ export default {
title: '序号', title: '序号',
field: 'serial', field: 'serial',
formatter: function (value, row, index) { formatter: function (value, row, index) {
//
// :
// value:
// row:
// index:
return index + 1 // 1 return index + 1 // 1
//
} }
}, },
//
{ {
//
title: '题干', title: '题干',
//
field: 'name', field: 'name',
//
width: 200, width: 200,
formatter: (value, row) => { formatter: (value, row) => {
// HTMLdiv
return '<div class="question-name" style="height: 100%;width: 100%">' + value + '</div>' return '<div class="question-name" style="height: 100%;width: 100%">' + value + '</div>'
}, },
//
events: { events: {
'click .question-name': function (e, value, row, index) { 'click .question-name': function (e, value, row, index) {
//
that.$refs.questionUpdateModal.edit('summernote-question-name-update', row, 'name', '更新题干', questionUpdate) that.$refs.questionUpdateModal.edit('summernote-question-name-update', row, 'name', '更新题干', questionUpdate)
} }
} }
}, },
{ {
//
title: '解析', title: '解析',
//
field: 'description', field: 'description',
//
width: 200, width: 200,
formatter: (value, row) => { formatter: (value, row) => {
// question-descdiv
return '<div class="question-desc">' + value + '</div>' return '<div class="question-desc">' + value + '</div>'
}, },
//
events: { events: {
// question-desc
'click .question-desc': function (e, value, row, index) { 'click .question-desc': function (e, value, row, index) {
that.$refs.questionUpdateModal.edit('summernote-question-desc-update', row, 'description', '更新题目解析', questionUpdate) that.$refs.questionUpdateModal.edit('summernote-question-desc-update', row, 'description', '更新题目解析', questionUpdate)
} }
} }
}, },
{ {
//
title: '分数', title: '分数',
//
field: 'score', field: 'score',
//
formatter: (value, row) => { formatter: (value, row) => {
// div便
return '<div class="question-score">' + value + '</div>' return '<div class="question-score">' + value + '</div>'
}, },
//
events: { events: {
//
'click .question-score': function (e, value, row, index) { 'click .question-score': function (e, value, row, index) {
// jQuery便使jQuery
const $element = $(e.target) // html const $element = $(e.target) // html
$element.html('<input type="text" value="' + value + '">') $element.html('<input type="text" value="' + value + '">')
} }
} }
}, },
{ {
/**
* 配置表格列标题和数据字段
*
* @param {String} title - 表格列的标题用于显示在表头
* @param {String} field - 表格列的数据字段用于绑定数据源中的属性
*/
title: '创建人', title: '创建人',
field: 'creator' field: 'creator'
}, },
{ {
//
title: '难度', title: '难度',
//
field: 'level', field: 'level',
formatter: (value, row) => { formatter: (value, row) => {
//
// value:
// row:
return '<div class="question-level">' + value + '</div>' return '<div class="question-level">' + value + '</div>'
}, },
events: { events: {
'click .question-level': function (e, value, row, index) { 'click .question-level': function (e, value, row, index) {
//
// e:
// value:
// row:
// index:
const $element = $(e.target) // html const $element = $(e.target) // html
if ($element.children().length > 0) return // if ($element.children().length > 0) return //
getQuestionSelection().then(res => { getQuestionSelection().then(res => {
//
console.log(res) console.log(res)
if (res.code === 0) { if (res.code === 0) {
console.log(res.data) console.log(res.data)
const levels = res.data.levels const levels = res.data.levels
let inner = '<select>' let inner = '<select>'
for (let i = 0; i < levels.length; i++) { for (let i = 0; i < levels.length; i++) {
//
if (levels[i].description === value) { if (levels[i].description === value) {
// //
inner += '<option value ="' + levels[i].id + '" name="' + levels[i].name + '" selected="selected">' + levels[i].description + '</option>' inner += '<option value ="' + levels[i].id + '" name="' + levels[i].name + '" selected="selected">' + levels[i].description + '</option>'
@ -117,6 +177,7 @@ export default {
inner += '</select>' inner += '</select>'
$element.html(inner) $element.html(inner)
} else { } else {
//
that.$notification.error({ that.$notification.error({
message: '获取问题下拉选项失败', message: '获取问题下拉选项失败',
description: res.msg description: res.msg
@ -127,16 +188,27 @@ export default {
} }
}, },
{ {
//
title: '题型', title: '题型',
//
field: 'type', field: 'type',
formatter: (value, row) => { formatter: (value, row) => {
//
// value:
// row:
return '<div class="question-type">' + value + '</div>' return '<div class="question-type">' + value + '</div>'
}, },
events: { events: {
'click .question-type': function (e, value, row, index) { 'click .question-type': function (e, value, row, index) {
//
// e:
// value:
// row:
// index:
const $element = $(e.target) // html const $element = $(e.target) // html
if ($element.children().length > 0) return // if ($element.children().length > 0) return //
getQuestionSelection().then(res => { getQuestionSelection().then(res => {
//
console.log(res) console.log(res)
if (res.code === 0) { if (res.code === 0) {
console.log(res.data) console.log(res.data)
@ -163,21 +235,27 @@ export default {
} }
}, },
{ {
//
title: '学科', title: '学科',
//
field: 'category', field: 'category',
formatter: (value, row) => { formatter: (value, row) => {
//
// HTML
return '<div class="question-category">' + value + '</div>' return '<div class="question-category">' + value + '</div>'
}, },
events: { events: {
'click .question-category': function (e, value, row, index) { 'click .question-category': function (e, value, row, index) {
const $element = $(e.target) // html const $element = $(e.target) // html
if ($element.children().length > 0) return // if ($element.children().length > 0) return //
//
getQuestionSelection().then(res => { getQuestionSelection().then(res => {
console.log(res) console.log(res)
if (res.code === 0) { if (res.code === 0) {
console.log(res.data) console.log(res.data)
const categories = res.data.categories const categories = res.data.categories
let inner = '<select>' let inner = '<select>'
// <option>
for (let i = 0; i < categories.length; i++) { for (let i = 0; i < categories.length; i++) {
if (categories[i].name === value) { // if (categories[i].name === value) { //
// //
@ -189,6 +267,7 @@ export default {
inner += '</select>' inner += '</select>'
$element.html(inner) $element.html(inner)
} else { } else {
//
that.$notification.error({ that.$notification.error({
message: '获取问题下拉选项失败', message: '获取问题下拉选项失败',
description: res.msg description: res.msg
@ -199,22 +278,32 @@ export default {
} }
}, },
{ {
//
title: '更新时间', title: '更新时间',
//
field: 'updateTime' field: 'updateTime'
}, },
{ {
//
title: '操作', title: '操作',
//
field: 'action', field: 'action',
//
align: 'center', align: 'center',
//
formatter: (value, row) => { formatter: (value, row) => {
// HTML
return '<button type="button" class="btn btn-success view-question">详情</button>' + return '<button type="button" class="btn btn-success view-question">详情</button>' +
'&nbsp;&nbsp;' + '&nbsp;&nbsp;' +
'<button type="button" class="btn btn-success edit-question">编辑</button>' '<button type="button" class="btn btn-success edit-question">编辑</button>'
}, },
//
events: { events: {
//
'click .view-question': function (e, value, row, index) { 'click .view-question': function (e, value, row, index) {
that.handleSub(row) that.handleSub(row)
}, },
//
'click .edit-question': function (e, value, row, index) { 'click .edit-question': function (e, value, row, index) {
that.handleEdit(row) that.handleEdit(row)
} }
@ -223,14 +312,20 @@ export default {
], ],
tableData: [], // bootstrap-table tableData: [], // bootstrap-table
// custom bootstrap-table // custom bootstrap-table
// bootstrap-table
options: { options: {
//
search: true, search: true,
//
showColumns: true, showColumns: true,
//
showExport: true, showExport: true,
//
pagination: true, pagination: true,
toolbar: '#toolbar', toolbar: '#toolbar',
// //
advancedSearch: true, advancedSearch: true,
//
idTable: 'advancedTable', idTable: 'advancedTable',
// http://www.itxst.com/bootstrap-table-events/tutorial.html // http://www.itxst.com/bootstrap-table-events/tutorial.html
// onClickRow: that.clickRow, // onClickRow: that.clickRow,
@ -243,17 +338,35 @@ export default {
this.loadAll() // this.loadAll() //
}, },
methods: { methods: {
/**
* 编辑问题
* @param {Object} record - 问题记录
*/
handleEdit (record) { handleEdit (record) {
this.$refs.modalEdit.edit(record) this.$refs.modalEdit.edit(record)
}, },
handleSub (record) { handleSub (record) {
// //
/**
* 查看问题
* @param {Object} record - 问题记录
*/
console.log(record) console.log(record)
this.$refs.modalView.edit(record) this.$refs.modalView.edit(record)
}, },
/**
* 确认操作后重新加载数据
*/
handleOk () { handleOk () {
this.loadAll() // this.loadAll() //
}, },
/**
* 双击表格单元格进行编辑
* @param {String} field - 字段名
* @param {String} value - 字段值
* @param {Object} row - 行记录
* @param {Object} $element - DOM元素
*/
dblClickCell (field, value, row, $element) { dblClickCell (field, value, row, $element) {
if (field === 'score') { // if (field === 'score') { //
const childrenInput = $element.children('.question-score').children('input') // const childrenInput = $element.children('.question-score').children('input') //
@ -274,18 +387,24 @@ export default {
} }
if (field === 'level') { // if (field === 'level') { //
//
const childrenSelect = $element.children('.question-level').children('select') // const childrenSelect = $element.children('.question-level').children('select') //
if (childrenSelect.length === 0) return if (childrenSelect.length === 0) return
//
const optionSelected = $(childrenSelect[0]).find('option:selected') const optionSelected = $(childrenSelect[0]).find('option:selected')
// ID
row.levelId = optionSelected.val() row.levelId = optionSelected.val()
console.log(row.levelId) console.log(row.levelId)
// API
row.level = optionSelected.text() row.level = optionSelected.text()
//
console.log(row.level) console.log(row.level)
const that = this const that = this
questionUpdate(row).then(res => { questionUpdate(row).then(res => {
// //
console.log(res) console.log(res)
if (res.code === 0) { if (res.code === 0) {
//
$element.children('.question-level').text(row.level) $element.children('.question-level').text(row.level)
that.$notification.success({ that.$notification.success({
message: '更新成功', message: '更新成功',
@ -296,17 +415,24 @@ export default {
} }
if (field === 'type') { // if (field === 'type') { //
//
const childrenSelect = $element.children('.question-type').children('select') // const childrenSelect = $element.children('.question-type').children('select') //
if (childrenSelect.length === 0) return if (childrenSelect.length === 0) return
//
const optionSelected = $(childrenSelect[0]).find('option:selected') const optionSelected = $(childrenSelect[0]).find('option:selected')
// rowtypeIdtype
row.typeId = optionSelected.val() row.typeId = optionSelected.val()
row.type = optionSelected.text() row.type = optionSelected.text()
// this便promise使
const that = this const that = this
// questionUpdate
questionUpdate(row).then(res => { questionUpdate(row).then(res => {
// //
console.log(res) console.log(res)
if (res.code === 0) { if (res.code === 0) {
//
$element.children('.question-type').text(row.type) $element.children('.question-type').text(row.type)
//
that.$notification.success({ that.$notification.success({
message: '更新成功', message: '更新成功',
description: '更新成功' description: '更新成功'
@ -316,18 +442,24 @@ export default {
} }
if (field === 'category') { // if (field === 'category') { //
//
const childrenSelect = $element.children('.question-category').children('select') // const childrenSelect = $element.children('.question-category').children('select') //
console.log(childrenSelect) console.log(childrenSelect)
if (childrenSelect.length === 0) return if (childrenSelect.length === 0) return
//
const optionSelected = $(childrenSelect[0]).find('option:selected') const optionSelected = $(childrenSelect[0]).find('option:selected')
// ID
row.categoryId = optionSelected.val() row.categoryId = optionSelected.val()
row.category = optionSelected.text() row.category = optionSelected.text()
const that = this const that = this
// API
questionUpdate(row).then(res => { questionUpdate(row).then(res => {
// //
console.log(res) console.log(res)
if (res.code === 0) { if (res.code === 0) {
//
$element.children('.question-category').text(row.category) $element.children('.question-category').text(row.category)
//
that.$notification.success({ that.$notification.success({
message: '更新成功', message: '更新成功',
description: '更新成功' description: '更新成功'
@ -336,14 +468,24 @@ export default {
}) })
} }
}, },
/**
* 加载所有问题数据
* 此方法通过调用后端API来获取所有问题的列表并将其用于更新表格数据
*/
loadAll () { loadAll () {
// 使this
const that = this const that = this
// API
getQuestionAll() getQuestionAll()
.then(res => { .then(res => {
//
if (res.code === 0) { if (res.code === 0) {
//
that.tableData = res.data that.tableData = res.data
//
that.$refs.table._initTable() that.$refs.table._initTable()
} else { } else {
//
that.$notification.error({ that.$notification.error({
message: '获取全部问题的列表失败', message: '获取全部问题的列表失败',
description: res.msg description: res.msg

@ -1,6 +1,9 @@
<!-- 问题编辑模态框组件 -->
<template> <template>
<!-- 模态框主体 -->
<a-modal title="编辑题目" :width="640" :visible="visible" :confirmLoading="confirmLoading" @cancel="handleCancel"> <a-modal title="编辑题目" :width="640" :visible="visible" :confirmLoading="confirmLoading" @cancel="handleCancel">
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<!-- 问题编辑表单 -->
<a-form :form="form"> <a-form :form="form">
<h3><b>题干</b></h3> <h3><b>题干</b></h3>
<div id="summernote-question-name-edit" /> <div id="summernote-question-name-edit" />
@ -48,6 +51,7 @@
<div id="summernote-question-desc-edit" /> <div id="summernote-question-desc-edit" />
</a-form> </a-form>
</a-spin> </a-spin>
<!-- 模态框底部按钮区域 -->
<template slot="footer"> <template slot="footer">
<a-button key="cancel" @click="handleCancel"></a-button> <a-button key="cancel" @click="handleCancel"></a-button>
<a-button key="update" type="primary" @click="handleUpdate"></a-button> <a-button key="update" type="primary" @click="handleUpdate"></a-button>
@ -56,6 +60,7 @@
</template> </template>
<script> <script>
// API
import '../../../plugins/summernote' import '../../../plugins/summernote'
import $ from 'jquery' import $ from 'jquery'
import { questionUpdate } from '../../../api/exam' import { questionUpdate } from '../../../api/exam'
@ -65,10 +70,13 @@ export default {
name: 'QuestionEditModal', name: 'QuestionEditModal',
data () { data () {
return { return {
//
visible: false, visible: false,
//
size: 'default', size: 'default',
//
confirmLoading: false, confirmLoading: false,
//
form: this.$form.createForm(this), form: this.$form.createForm(this),
// //
question: {}, question: {},
@ -85,7 +93,7 @@ export default {
desc: '' desc: ''
} }
}, },
//
updated () { updated () {
this.initSummernote('summernote-question-name-edit') this.initSummernote('summernote-question-name-edit')
this.initSummernote('summernote-question-desc-edit') this.initSummernote('summernote-question-desc-edit')
@ -93,6 +101,7 @@ export default {
this.setSummernoteContent('summernote-question-desc-edit', this.desc) this.setSummernoteContent('summernote-question-desc-edit', this.desc)
}, },
methods: { methods: {
//
initSummernote (divId) { initSummernote (divId) {
console.log('初始化富文本插件:' + divId) console.log('初始化富文本插件:' + divId)
$('#' + divId).summernote({ $('#' + divId).summernote({
@ -120,9 +129,11 @@ export default {
} }
}) })
}, },
//
getSummernoteContent (divId) { getSummernoteContent (divId) {
return $('#' + divId).summernote('code') return $('#' + divId).summernote('code')
}, },
//
setSummernoteContent (divId, content) { setSummernoteContent (divId, content) {
return $('#' + divId).summernote('code', content) return $('#' + divId).summernote('code', content)
}, },
@ -166,7 +177,7 @@ export default {
} }
console.log(`Selected: ${value}`) console.log(`Selected: ${value}`)
}, },
//
handleMultiChange (values) { handleMultiChange (values) {
console.log(values) console.log(values)
// id // id
@ -191,11 +202,11 @@ export default {
} }
} }
}, },
//
popupScroll () { popupScroll () {
console.log('popupScroll') console.log('popupScroll')
}, },
//
handleUpdate () { handleUpdate () {
const that = this const that = this
that.question.name = that.getSummernoteContent('summernote-question-name-edit') that.question.name = that.getSummernoteContent('summernote-question-name-edit')

@ -1,24 +1,32 @@
<template> <template>
<!-- 题目信息模态框 -->
<a-modal title="题目信息" :width="640" :visible="visible" :confirmLoading="confirmLoading" @cancel="handleCancel"> <a-modal title="题目信息" :width="640" :visible="visible" :confirmLoading="confirmLoading" @cancel="handleCancel">
<!-- 加载状态 -->
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<!-- 表单 -->
<a-form :form="form"> <a-form :form="form">
<!-- 题干 -->
<h3><b>题干</b></h3> <h3><b>题干</b></h3>
<div v-html="question.name"></div> <div v-html="question.name"></div>
<br> <br>
<!-- 选项 -->
<h3><b>选项</b></h3> <h3><b>选项</b></h3>
<ul> <ul>
<li v-for="option in question.options" :key="option.id" v-html="option.content"/> <li v-for="option in question.options" :key="option.id" v-html="option.content"/>
</ul> </ul>
<br> <br>
<!-- 答案 -->
<h3><b>答案</b></h3> <h3><b>答案</b></h3>
<ul> <ul>
<li v-for="option in question.options" :key="option.id" v-show="option.answer===true" v-html="option.content"/> <li v-for="option in question.options" :key="option.id" v-show="option.answer===true" v-html="option.content"/>
</ul> </ul>
<br> <br>
<!-- 解析 -->
<h3><b>解析</b></h3> <h3><b>解析</b></h3>
<div v-html="question.description"></div> <div v-html="question.description"></div>
</a-form> </a-form>
</a-spin> </a-spin>
<!-- 模态框底部按钮 -->
<template slot="footer"> <template slot="footer">
<a-button key="cancel" @click="handleCancel"></a-button> <a-button key="cancel" @click="handleCancel"></a-button>
</template> </template>
@ -32,23 +40,28 @@ export default {
name: 'QuestionViewModal', name: 'QuestionViewModal',
data () { data () {
return { return {
//
visible: false, visible: false,
//
confirmLoading: false, confirmLoading: false,
//
form: this.$form.createForm(this), form: this.$form.createForm(this),
// //
question: {}, question: {},
//
options: [], options: [],
//
answerOption: '' answerOption: ''
} }
}, },
methods: { methods: {
//
edit (record) { edit (record) {
this.visible = true this.visible = true
// data // data
this.question = record this.question = record
}, },
//
handleCancel () { handleCancel () {
// clear form & currentStep // clear form & currentStep
this.visible = false this.visible = false

Loading…
Cancel
Save