會員中心

main
tamguo 7 years ago
parent 772f1fed6e
commit 08b94e54f2

@ -10,6 +10,23 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>com.bladejava</groupId>
<artifactId>blade-patchca</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>3.2.8</version>
</dependency>
</dependencies>
<build>

@ -1,7 +1,7 @@
/**
* Copyright (c) 2013-Now http://jeesite.com All rights reserved.
*/
package com.tamguo.config.image;
package com.tamguo.common.image;
import java.awt.Color;
import java.awt.Graphics;

@ -0,0 +1,5 @@
package com.tamguo.common.utils;
public enum Status {
SUCCESS , ERROR
}

@ -58,4 +58,25 @@ public class SystemConstant {
/** 名校缓存KEY*/
public static final String ELITE_PAPER = "ElitePaper:";
/** 安全验证前缀*/
public static final String SECURITY_CHECK_PREFIX = "securityCheck:";
/** 短信找回密码前缀*/
public static final String ALIYUN_MOBILE_SMS_PREFIX = "MOBILE_SMS_PREKEY_";
/** 邮箱找回密码前缀*/
public static final String ALIYUN_MAIL_FIND_PASSWORD_PREFIX = "EMAIL_FIND_PASSWORD_";
/** 默认会员头像*/
public static final String DEFAULT_MEMBER_AVATAR = "images/avatar.png";
/** 登录错误次数*/
public static final String LOGIN_FAILURE_COUNT = "loginFailureCount:";
/** ALIYUN */
public static final String ALIYUN_ACCESS_KEY_ID = "LTAINGkheMeWtxUR";
/** ALIYUN*/
public static final String ALIYUN_ACCESS_KEY_SECRET = "ONUKuCz85kU4In07y4dvpM28mfWOGa";
}

@ -0,0 +1,67 @@
package com.tamguo.common.utils;
import java.util.ArrayList;
public class UploaderMessage {
private Status status;
private String statusMsg = "";
private ArrayList<Integer> errorKys;
private String error = "";
private String filePath = "";
private String fileDomain = "";
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getStatusMsg() {
return statusMsg;
}
public void setStatusMsg(String statusMsg) {
this.statusMsg = statusMsg;
}
public ArrayList<Integer> getErrorKys() {
return errorKys;
}
public void setErrorKys(ArrayList<Integer> errorKys) {
this.errorKys = errorKys;
}
public String getError() {
return error;
}
public void setError(String error) {
this.error = error;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getFileDomain() {
return fileDomain;
}
public void setFileDomain(String fileDomain) {
this.fileDomain = fileDomain;
}
}

@ -51,6 +51,17 @@
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-spring</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-ehcache</artifactId>
<version>1.2.5</version>
</dependency>
</dependencies>
<build>

@ -0,0 +1,8 @@
package com.tamguo.modules.member.dao;
import com.tamguo.config.dao.SuperMapper;
import com.tamguo.modules.member.model.MemberEntity;
public interface MemberMapper extends SuperMapper<MemberEntity>{
}

@ -0,0 +1,189 @@
package com.tamguo.modules.member.model;
import java.io.Serializable;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.tamguo.config.dao.SuperEntity;
/**
* The persistent class for the tiku_ad database table.
*
*/
@TableName(value="tiku_member")
public class MemberEntity extends SuperEntity<MemberEntity> implements Serializable {
private static final long serialVersionUID = 1L;
private String subjectId;
private String courseId;
private String username;
private String nickName;
private String password;
private String avatar;
private String mobile;
private String email;
private Integer point;
private BigDecimal amount;
private Long lastLoginTime;
private Integer paperNum;
private Integer questionNum;
private Integer downNum;
private Integer hitsNum;
@TableField(exist=false)
private String verifyCode;
@TableField(exist=false)
private String nowPassword;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Integer getPoint() {
return point;
}
public void setPoint(Integer point) {
this.point = point;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public Long getLastLoginTime() {
return lastLoginTime;
}
public void setLastLoginTime(Long lastLoginTime) {
this.lastLoginTime = lastLoginTime;
}
public Integer getPaperNum() {
return paperNum;
}
public void setPaperNum(Integer paperNum) {
this.paperNum = paperNum;
}
public Integer getQuestionNum() {
return questionNum;
}
public void setQuestionNum(Integer questionNum) {
this.questionNum = questionNum;
}
public Integer getHitsNum() {
return hitsNum;
}
public void setHitsNum(Integer hitsNum) {
this.hitsNum = hitsNum;
}
public Integer getDownNum() {
return downNum;
}
public void setDownNum(Integer downNum) {
this.downNum = downNum;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getVerifyCode() {
return verifyCode;
}
public void setVerifyCode(String verifyCode) {
this.verifyCode = verifyCode;
}
public String getSubjectId() {
return subjectId;
}
public void setSubjectId(String subjectId) {
this.subjectId = subjectId;
}
public String getCourseId() {
return courseId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public String getNowPassword() {
return nowPassword;
}
public void setNowPassword(String nowPassword) {
this.nowPassword = nowPassword;
}
}

@ -0,0 +1,44 @@
package com.tamguo.modules.member.service;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.member.model.MemberEntity;
public interface IMemberService {
public Result login(String username , String password);
public Result checkUsername(String username);
public Result checkMobile(String mobile);
public Result register(MemberEntity member);
public Result checkAccount(String account);
public Result confirmAccount(String account , String veritycode);
public Result securityCheck(String username , String isEmail , String vcode);
public Result resetPassword(String resetPasswordKey , String username , String password, String verifypwd);
public Integer getLoginFailureCount(MemberEntity member);
public void updateMember(MemberEntity member);
public MemberEntity findByUid(String uid);
public MemberEntity findByUsername(String username);
public void updateLoginFailureCount(MemberEntity member , Integer loginFailureCount);
public void updateLastLoginTime(String string);
public MemberEntity findCurrMember(String id);
/**
*
* @param member
* @return
*/
public Result updatePwd(MemberEntity member);
}

@ -0,0 +1,243 @@
package com.tamguo.modules.member.service.impl;
import java.util.List;
import java.util.UUID;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.common.utils.DateUtil;
import com.tamguo.common.utils.Result;
import com.tamguo.common.utils.SystemConstant;
import com.tamguo.config.redis.CacheService;
import com.tamguo.modules.member.dao.MemberMapper;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.member.service.IMemberService;
@Service
public class MemberService extends ServiceImpl<MemberMapper, MemberEntity> implements IMemberService{
@Autowired
private MemberMapper memberMapper;
@Autowired
private CacheService cacheService;
@Override
public Result login(String username, String password) {
MemberEntity condition = new MemberEntity();
condition.setUsername(username);
MemberEntity member = memberMapper.selectOne(condition);
if(member == null){
return Result.result(201, member, "用户名或密码有误,请重新输入或找回密码");
}
Integer loginFailureCount = this.getLoginFailureCount(member);
if(!new Sha256Hash(password).toHex().equals(member.getPassword())){
loginFailureCount++;
this.updateLoginFailureCount(member , loginFailureCount);
return Result.result(202, member, "用户名或密码有误,请重新输入或找回密码");
}
this.updateLoginFailureCount(member , 0);
return Result.result(200, member, "登录成功");
}
public void updateLoginFailureCount(MemberEntity member , Integer loginFailureCount){
cacheService.setObject(SystemConstant.LOGIN_FAILURE_COUNT + member.getId(), loginFailureCount , 2 * 60 * 60);
}
public Integer getLoginFailureCount(MemberEntity member){
if(member == null){
return 0;
}
if(!cacheService.isExist(SystemConstant.LOGIN_FAILURE_COUNT + member.getId())){
return 0;
}
return (Integer)cacheService.getObject(SystemConstant.LOGIN_FAILURE_COUNT + member.getId());
}
@Override
public Result checkUsername(String username) {
MemberEntity condition = new MemberEntity();
condition.setUsername(username);
MemberEntity member = memberMapper.selectOne(condition);
if(member != null){
return Result.result(201, null, "该用户名已经存在");
}
return Result.result(200, null, "该用户名可用");
}
@Override
public Result checkMobile(String mobile) {
MemberEntity condition = new MemberEntity();
condition.setMobile(mobile);
MemberEntity member = memberMapper.selectOne(condition);
if(member != null){
return Result.result(201, null, "该手机号已经存在");
}
return Result.result(200, null, "该手机号可用");
}
@Transactional(readOnly=false)
@Override
public Result register(MemberEntity member) {
MemberEntity condition = new MemberEntity();
condition.setUsername(member.getUsername());
MemberEntity m = memberMapper.selectOne(condition);
if(m != null){
return Result.result(201, null, "该用户已经存在");
}
condition = new MemberEntity();
condition.setMobile(member.getMobile());
m = memberMapper.selectOne(condition);
if(m != null){
return Result.result(202, null, "该手机号已经存在");
}
if(!cacheService.isExist(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + member.getMobile())){
return Result.result(203, null, "验证码错误");
}
String code = (String) cacheService.getObject(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + member.getMobile());
if(!code.equals(member.getVerifyCode())){
return Result.result(204, null, "验证码错误");
}
MemberEntity entity = new MemberEntity();
entity.setAvatar(SystemConstant.DEFAULT_MEMBER_AVATAR);
entity.setMobile(member.getMobile());
entity.setPassword(new Sha256Hash(member.getPassword()).toHex());
entity.setUsername(member.getUsername());
entity.setNickName(member.getUsername());
entity.setSubjectId(member.getSubjectId());
entity.setCourseId(member.getCourseId());
entity.setEmail(member.getEmail());
memberMapper.insert(entity);
return Result.result(200, entity, "注册成功");
}
@SuppressWarnings("unchecked")
@Override
public Result checkAccount(String account) {
if(StringUtils.isEmpty(account)){
return Result.result(201, null, "帐号不存在!");
}
List<MemberEntity> members = memberMapper.selectList(Condition.create().eq("user_name", account).or().eq("mobile", account));
if(members.size() == 0){
return Result.result(201, null, "帐号不存在!");
}
return Result.result(200, members.get(0), "该帐号存在");
}
@SuppressWarnings("unchecked")
@Override
public Result confirmAccount(String account, String veritycode) {
if(StringUtils.isEmpty(account)){
return Result.result(201, null, "帐号不存在!");
}
List<MemberEntity> members = memberMapper.selectList(Condition.create().eq("user_name", account).or().eq("mobile", account));
if(members.size() == 0){
return Result.result(201, null, "帐号不存在!");
}
return Result.result(200, members.get(0), "该帐号存在");
}
@Override
public Result securityCheck(String username , String isEmail , String vcode) {
MemberEntity condition = new MemberEntity();
condition.setUsername(username);
MemberEntity member = memberMapper.selectOne(condition);
if("1".equals(isEmail)){
if(!cacheService.isExist(SystemConstant.ALIYUN_MAIL_FIND_PASSWORD_PREFIX + member.getEmail())){
return Result.result(201, member, "验证码错误");
}
String code = (String) cacheService.getObject(SystemConstant.ALIYUN_MAIL_FIND_PASSWORD_PREFIX + member.getEmail());
if(!code.equals(vcode)){
return Result.result(202, member, "验证码错误");
}
}else{
if(!cacheService.isExist(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + member.getMobile())){
return Result.result(203, member, "验证码错误");
}
String code = (String) cacheService.getObject(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + member.getMobile());
if(!code.equals(vcode)){
return Result.result(204, member, "验证码错误");
}
}
String key = UUID.randomUUID().toString();
cacheService.setObject(SystemConstant.SECURITY_CHECK_PREFIX + key, username , 2 * 60 * 60);
return Result.result(200, key, "安全验证通过");
}
@Override
public Result resetPassword(String resetPasswordKey , String username , String password, String verifypwd) {
if(cacheService.isExist(SystemConstant.SECURITY_CHECK_PREFIX + resetPasswordKey)){
MemberEntity condition = new MemberEntity();
condition.setUsername(username);
MemberEntity member = memberMapper.selectOne(condition);
if(password.equals(verifypwd)){
member.setPassword(new Sha256Hash(password).toHex());
memberMapper.updateById(member);
}
}
return Result.result(200, null, "更新成功");
}
@Transactional(readOnly=false)
@Override
public void updateMember(MemberEntity member) {
MemberEntity entity = memberMapper.selectById(member.getId());
entity.setAvatar(member.getAvatar());
entity.setEmail(member.getEmail());
entity.setMobile(member.getMobile());
entity.setCourseId(member.getCourseId());
entity.setSubjectId(member.getSubjectId());
entity.setNickName(member.getNickName());
memberMapper.updateById(entity);
}
@Transactional(readOnly=true)
@Override
public MemberEntity findByUid(String uid) {
return memberMapper.selectById(uid);
}
@Transactional(readOnly=true)
@Override
public MemberEntity findByUsername(String username) {
MemberEntity condition = new MemberEntity();
condition.setUsername(username);
return memberMapper.selectOne(condition);
}
@Transactional(readOnly=false)
@Override
public void updateLastLoginTime(String uid) {
MemberEntity member = memberMapper.selectById(uid);
member.setLastLoginTime(DateUtil.getTime());
memberMapper.updateById(member);
}
@Override
public MemberEntity findCurrMember(String id) {
MemberEntity member = memberMapper.selectById(id);
member.setPassword(null);
return member;
}
@Transactional(readOnly=false)
@Override
public Result updatePwd(MemberEntity member) {
MemberEntity entity = memberMapper.selectById(member.getId());
if(!entity.getPassword().equals(new Sha256Hash(member.getPassword()).toHex())) {
return Result.result(501, null, "旧密码错误!");
}
if(!cacheService.isExist(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + member.getMobile())){
return Result.result(502, null, "验证码错误");
}
entity.setPassword(new Sha256Hash(member.getNowPassword()).toHex());
return Result.result(0, null, "修改成功");
}
}

@ -0,0 +1,10 @@
package com.tamguo.modules.sys.service;
import com.aliyuncs.exceptions.ClientException;
import com.tamguo.common.utils.Result;
public interface ISmsService {
public Result sendFindPasswordSms(String mobile) throws ClientException;
}

@ -0,0 +1,62 @@
package com.tamguo.modules.sys.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest;
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile;
import com.tamguo.common.utils.Result;
import com.tamguo.common.utils.SystemConstant;
import com.tamguo.config.redis.CacheService;
import com.tamguo.modules.sys.service.ISmsService;
@Service
public class SmsServiceImpl implements ISmsService{
@Autowired
private CacheService cacheService;
@Override
public Result sendFindPasswordSms(String mobile) throws ClientException {
//可自助调整超时时间
System.setProperty("sun.net.client.defaultConnectTimeout", "10000");
System.setProperty("sun.net.client.defaultReadTimeout", "10000");
//初始化acsClient,暂不支持region化
IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", SystemConstant.ALIYUN_ACCESS_KEY_ID, SystemConstant.ALIYUN_ACCESS_KEY_SECRET);
DefaultProfile.addEndpoint("cn-hangzhou", "cn-hangzhou", "Dysmsapi", "dysmsapi.aliyuncs.com");
IAcsClient acsClient = new DefaultAcsClient(profile);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest request = new SendSmsRequest();
//必填:待发送手机号
request.setPhoneNumbers(mobile);
//必填:短信签名-可在短信控制台中找到
request.setSignName("探果网");
//必填:短信模板-可在短信控制台中找到
request.setTemplateCode("SMS_127152965");
Integer vcode = (int) ((Math.random()*9+1)*100000);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request.setTemplateParam("{\"code\":\""+vcode+"\"}");
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
request.setOutId("yourOutId");
//hint 此处可能会抛出异常注意catch
SendSmsResponse response = acsClient.getAcsResponse(request);
if("OK".equals(response.getCode())) {
cacheService.setObject(SystemConstant.ALIYUN_MOBILE_SMS_PREFIX + mobile , vcode.toString() , 10 * 60);
return Result.result(200, null, "发送成功");
}
return Result.result(501, null, response.getMessage());
}
}

@ -0,0 +1,54 @@
package com.tamguo.modules.tiku.model.enums;
import java.io.Serializable;
/**
* (1.2.; 3.)
*
* @author tamguo
*
*/
public enum QuestionTypeEnum {
DANXUANTI("1", "单选题"),
DUOXUANTI("2", "多选题"),
TIANKONGTI("3", "填空题"),
PANDUANTI("4", "判断题"),
WENDATI("5", "问答题");
private String value;
private String desc;
QuestionTypeEnum(final String value, final String desc) {
this.value = value;
this.desc = desc;
}
public static QuestionTypeEnum getQuestionType(String value) {
if("1".equals(value)) {
return DANXUANTI;
}else if("2".equals(value)) {
return DUOXUANTI;
}else if("3".equals(value)) {
return TIANKONGTI;
}else if("4".equals(value)) {
return PANDUANTI;
}else if("5".equals(value)) {
return WENDATI;
}
return WENDATI;
}
public Serializable getValue() {
return this.value;
}
public String getDesc(){
return this.desc;
}
@Override
public String toString() {
return this.value;
}
}

@ -1,8 +1,8 @@
package com.tamguo.modules.tiku.service;
import java.util.List;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.tiku.model.PaperEntity;
public interface IPaperService extends IService<PaperEntity>{
@ -12,5 +12,17 @@ public interface IPaperService extends IService<PaperEntity>{
List<PaperEntity> findSimulationPaper();
List<PaperEntity> findHotPaper(String areaId);
void addPaperQuestionInfo(String paperId, String title, String name, String type);
void updatePaperQuestionInfo(String paperId, String title, String name,
String type, String uid);
Result deletePaper(String deletePaper , String paperId);
Result deletePaperQuestionInfoBtn(String currMemberId , String paperId, String cuid);
void addPaper(PaperEntity paper);
Result updatePaper(PaperEntity paper , String currMemberId);
}

@ -1,8 +1,18 @@
package com.tamguo.modules.tiku.service;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.tiku.model.QuestionEntity;
public interface IQuestionService extends IService<QuestionEntity>{
public Result addQuestion(QuestionEntity question , String currMemberId);
public Page<QuestionEntity> queryQuestionList(String questionType, String uid, String content, String paperId, String currMemberId ,
Page<QuestionEntity> p);
public Result updateQuestion(QuestionEntity question, String currMemberId);
public Result delete(String uid, String currMemberId);
}

@ -1,5 +1,6 @@
package com.tamguo.modules.tiku.service;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.IService;
import com.tamguo.modules.tiku.model.SubjectEntity;
@ -24,4 +25,6 @@ public interface ISubjectService extends IService<SubjectEntity>{
/** 删除分类*/
void delete(String uid);
JSONArray getCourseCascaderTree();
}

@ -1,15 +1,22 @@
package com.tamguo.modules.tiku.service.impl;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.common.utils.Result;
import com.tamguo.common.utils.SystemConstant;
import com.tamguo.config.redis.CacheService;
import com.tamguo.modules.tiku.dao.PaperMapper;
import com.tamguo.modules.tiku.dao.QuestionMapper;
import com.tamguo.modules.tiku.model.PaperEntity;
import com.tamguo.modules.tiku.service.IPaperService;
@ -20,6 +27,9 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
private PaperMapper paperMapper;
@Autowired
private CacheService cacheService;
@Autowired
private QuestionMapper questionMapper;
@SuppressWarnings("unchecked")
@Override
public List<PaperEntity> findHistoryPaper() {
@ -56,4 +66,97 @@ public class PaperServiceImpl extends ServiceImpl<PaperMapper, PaperEntity> impl
return paperList;
}
@Transactional(readOnly=false)
@Override
public void addPaperQuestionInfo(String paperId, String title, String name, String type) {
PaperEntity paper = paperMapper.selectById(paperId);
String questionInfo = paper.getQuestionInfo();
JSONArray qList = JSONArray.parseArray(questionInfo);
JSONObject entity = new JSONObject();
entity.put("name", name);
entity.put("title", title);
entity.put("type", type);
entity.put("id", UUID.randomUUID().toString());
qList.add(entity);
paper.setQuestionInfo(qList.toString());
paperMapper.updateById(paper);
}
@Transactional(readOnly=false)
@Override
public void updatePaperQuestionInfo(String paperId, String title, String name, String type, String uid) {
PaperEntity paper = paperMapper.selectById(paperId);
JSONArray qList = JSONArray.parseArray(paper.getQuestionInfo());
for(int i =0 ; i<qList.size() ; i++){
JSONObject q = qList.getJSONObject(i);
if(q.getString("id").equals(uid)){
q.put("name", name);
q.put("title", title);
q.put("type", type);
}
}
paper.setQuestionInfo(qList.toString());
paperMapper.updateById(paper);
}
@SuppressWarnings("unchecked")
@Override
public Result deletePaper(String currMemberId , String paperId) {
PaperEntity paper = paperMapper.selectById(paperId);
if(!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null , "不能删除其他人的试卷!");
}
paperMapper.deleteById(paperId);
// 删除试题
questionMapper.delete(Condition.create().eq("paper_id", paperId));
return Result.result(Result.SUCCESS_CODE, null , "删除成功!");
}
@Transactional(readOnly=false)
@Override
public Result deletePaperQuestionInfoBtn(String currMemberId , String paperId, String cuid) {
PaperEntity paper = paperMapper.selectById(paperId);
if(!paper.getCreaterId().equals(currMemberId)) {
return Result.failResult("试卷属于当前用户,不能修改!");
}
JSONArray qList = JSONArray.parseArray(paper.getQuestionInfo());
for(int i =0 ; i<qList.size() ; i++){
JSONObject q = qList.getJSONObject(i);
if(q.getString("uid").equals(cuid)){
qList.remove(i);
}
}
paper.setQuestionInfo(qList.toString());
paperMapper.updateById(paper);
return Result.result(Result.SUCCESS_CODE, null, "删除子卷成功");
}
@Transactional(readOnly=false)
@Override
public void addPaper(PaperEntity paper) {
paper.setDownHits(0);
paper.setOpenHits(0);
paper.setQuestionInfo("[]");
// 写入seo信息
paper.setSeoTitle(paper.getName());
paper.setSeoKeywords(paper.getName());
paper.setSeoDescription(paper.getName());
paperMapper.insert(paper);
}
@Override
public Result updatePaper(PaperEntity paper ,String currMemberId) {
PaperEntity entity = paperMapper.selectById(paper.getId());
if(!entity.getCreaterId().equals(currMemberId)) {
return Result.failResult("试卷属于当前用户,不能修改!");
}
paper.setCreaterId(currMemberId);
paperMapper.updateById(paper);
return Result.result(Result.SUCCESS_CODE, paper, "修改成功");
}
}

@ -1,12 +1,81 @@
package com.tamguo.modules.tiku.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.tiku.dao.PaperMapper;
import com.tamguo.modules.tiku.dao.QuestionMapper;
import com.tamguo.modules.tiku.model.PaperEntity;
import com.tamguo.modules.tiku.model.QuestionEntity;
import com.tamguo.modules.tiku.service.IQuestionService;
@Service
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, QuestionEntity> implements IQuestionService{
@Autowired
private PaperMapper paperMapper;
@Autowired
private QuestionMapper questionMapper;
@Override
public Result addQuestion(QuestionEntity question , String currMemberId) {
PaperEntity paper = paperMapper.selectById(question.getPaperId().toString());
if(!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null, "改试卷不属于您!");
}
question.setCourseId(paper.getCourseId());
questionMapper.insert(question);
return Result.result(0, null, "添加成功!");
}
@SuppressWarnings("unchecked")
@Override
public Page<QuestionEntity> queryQuestionList(String questionType, String id, String content, String paperId, String currMemberId ,
Page<QuestionEntity> p) {
if(!currMemberId.equals(paperMapper.selectById(paperId).getCreaterId())) {
return p.setRecords(null);
}
Condition condition = new Condition();
if(!StringUtils.isEmpty(questionType)) {
condition.eq("question_type", questionType);
}
if(!StringUtils.isEmpty(id)) {
condition.eq("id", id);
}
if(!StringUtils.isEmpty(content)) {
condition.like("content", content);
}
condition.eq("paper_id", paperId);
return p.setRecords(questionMapper.selectPage(p, condition));
}
@Transactional(readOnly=false)
@Override
public Result updateQuestion(QuestionEntity question , String currMemberId) {
PaperEntity paper = paperMapper.selectById(question.getPaperId().toString());
if(!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null, "改试卷不属于您!");
}
questionMapper.updateById(question);
return Result.result(0, null, "修改成功!");
}
@Transactional(readOnly=false)
@Override
public Result delete(String uid , String currMemberId) {
QuestionEntity question = questionMapper.selectById(uid);
PaperEntity paper = paperMapper.selectById(question.getPaperId().toString());
if(!currMemberId.equals(paper.getCreaterId())) {
return Result.result(501, null, "改试卷不属于您!");
}
questionMapper.deleteById(uid);
return Result.result(0, null, "删除成功!");
}
}

@ -1,14 +1,19 @@
package com.tamguo.modules.tiku.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.tamguo.modules.tiku.dao.CourseMapper;
import com.tamguo.modules.tiku.dao.SubjectMapper;
import com.tamguo.modules.tiku.model.CourseEntity;
import com.tamguo.modules.tiku.model.SubjectEntity;
import com.tamguo.modules.tiku.model.condition.SubjectCondition;
import com.tamguo.modules.tiku.model.enums.SubjectStatusEnum;
@ -19,6 +24,8 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
@Autowired
private SubjectMapper subjectMapper;
@Autowired
private CourseMapper courseMapper;
@Transactional(readOnly=false)
@SuppressWarnings("unchecked")
@ -78,4 +85,31 @@ public class SubjectServiceImpl extends ServiceImpl<SubjectMapper, SubjectEntity
subjectMapper.updateById(entity);
}
@SuppressWarnings("unchecked")
@Override
public JSONArray getCourseCascaderTree() {
JSONArray courseTree = new JSONArray();
List<SubjectEntity> subjectList = subjectMapper.selectList(Condition.EMPTY);
for(int i=0 ; i<subjectList.size() ; i++){
SubjectEntity subject = subjectList.get(i);
JSONObject node = new JSONObject();
node.put("value", subject.getId());
node.put("label", subject.getName());
JSONArray children = new JSONArray();
List<CourseEntity> courseList = courseMapper.selectList(Condition.create().eq("subject_id", subject.getId()));
for(int k=0 ; k<courseList.size() ; k++){
CourseEntity course = courseList.get(k);
JSONObject no = new JSONObject();
no.put("value", course.getId());
no.put("label", course.getName());
children.add(no);
}
node.put("children", children);
courseTree.add(node);
}
return courseTree;
}
}

@ -9,9 +9,9 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.tamguo.common.image.CaptchaUtils;
import com.tamguo.common.utils.ExceptionSupport;
import com.tamguo.common.utils.SystemConstant;
import com.tamguo.config.image.CaptchaUtils;
import com.tamguo.modules.sys.utils.ShiroUtils;
@Controller

@ -63,6 +63,11 @@
<groupId>org.springframework.session</groupId>
<artifactId>spring-session-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
@ -124,18 +129,13 @@
<artifactId>commons-email</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.github.theborakompanioni</groupId>
<artifactId>thymeleaf-extras-shiro</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>com.bladejava</groupId>
<artifactId>blade-patchca</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.tamguo</groupId>
<artifactId>tamguo-modules-core</artifactId>

@ -0,0 +1,72 @@
package com.tamguo.config.shiro;
import java.util.Set;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.springframework.beans.factory.annotation.Autowired;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.member.service.IMemberService;
/**
*
*
*/
public class MemberRealm extends AuthorizingRealm {
@Autowired
private IMemberService iMemberService;
/**
* ()
*/
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
Set<String > permsSet = null;
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
info.setStringPermissions(permsSet);
return info;
}
/**
* ()
*/
@Override
protected AuthenticationInfo doGetAuthenticationInfo(
AuthenticationToken token) throws AuthenticationException {
String username = (String) token.getPrincipal();
String password = new String((char[]) token.getCredentials());
MemberEntity member = iMemberService.findByUsername(username);
if(member == null) {
throw new UnknownAccountException("用户名或密码有误,请重新输入或找回密码");
}
Integer loginFailureCount = iMemberService.getLoginFailureCount(member);
if(loginFailureCount > 10) {
throw new LockedAccountException("账号被锁定");
}
if(!new Sha256Hash(password).toHex().equals(member.getPassword())){
loginFailureCount++;
iMemberService.updateLoginFailureCount(member , loginFailureCount);
throw new IncorrectCredentialsException("用户名或密码有误,请重新输入或找回密码");
}
// 更新登录时间
iMemberService.updateLastLoginTime(member.getId());
SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(member, password, getName());
return info;
}
}

@ -0,0 +1,69 @@
package com.tamguo.config.shiro;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.shiro.cache.ehcache.EhCacheManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ShiroConfiguration {
private static Map<String, String> filterChainDefinitionMap = new LinkedHashMap<String, String>();
@Bean(name = "shiroRealm")
public MemberRealm getShiroRealm() {
return new MemberRealm();
}
@Bean(name = "shiroEhcacheManager")
public EhCacheManager getEhCacheManager() {
EhCacheManager em = new EhCacheManager();
em.setCacheManagerConfigFile("classpath:ehcache-shiro.xml");
return em;
}
@Bean(name = "lifecycleBeanPostProcessor")
public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() {
return new LifecycleBeanPostProcessor();
}
@Bean
public DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator() {
DefaultAdvisorAutoProxyCreator daap = new DefaultAdvisorAutoProxyCreator();
daap.setProxyTargetClass(true);
return daap;
}
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManager() {
DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
dwsm.setRealm(getShiroRealm());
dwsm.setCacheManager(getEhCacheManager());
return dwsm;
}
@Bean
public AuthorizationAttributeSourceAdvisor getAuthorizationAttributeSourceAdvisor() {
AuthorizationAttributeSourceAdvisor aasa = new AuthorizationAttributeSourceAdvisor();
aasa.setSecurityManager(getDefaultWebSecurityManager());
return new AuthorizationAttributeSourceAdvisor();
}
@Bean(name = "shiroFilter")
public ShiroFilterFactoryBean getShiroFilterFactoryBean() {
ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
shiroFilterFactoryBean.setSecurityManager(getDefaultWebSecurityManager());
shiroFilterFactoryBean.setLoginUrl("/login");
shiroFilterFactoryBean.setSuccessUrl("/index");
filterChainDefinitionMap.put("/member/**", "authc");
filterChainDefinitionMap.put("/**", "anon");
shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap);
return shiroFilterFactoryBean;
}
}

@ -0,0 +1,49 @@
package com.tamguo.utils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;
import com.tamguo.modules.member.model.MemberEntity;
public class ShiroUtils {
public static Session getSession() {
return SecurityUtils.getSubject().getSession();
}
public static Subject getSubject() {
return SecurityUtils.getSubject();
}
public static MemberEntity getMember() {
return (MemberEntity)SecurityUtils.getSubject().getPrincipal();
}
public static String getMemberId() {
return getMember().getId();
}
public static void setSessionAttribute(Object key, Object value) {
getSession().setAttribute(key, value);
}
public static Object getSessionAttribute(Object key) {
return getSession().getAttribute(key);
}
public static boolean isLogin() {
return SecurityUtils.getSubject().getPrincipal() != null;
}
public static void logout() {
SecurityUtils.getSubject().logout();
}
public static String getKaptcha(String key) {
String kaptcha = getSessionAttribute(key).toString();
// getSession().removeAttribute(key);
return kaptcha;
}
}

@ -0,0 +1,149 @@
package com.tamguo.web.member;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.common.utils.DateUtils;
import com.tamguo.common.utils.Result;
import com.tamguo.common.utils.Status;
import com.tamguo.common.utils.UploaderMessage;
import com.tamguo.config.redis.CacheService;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.member.service.IMemberService;
import com.tamguo.utils.ShiroUtils;
@Controller
public class AccountController {
@Autowired
public IMemberService memberService;
@Value("${file.storage.path}")
private String fileStoragePath;
@Value("${domain.name}")
private String domainName;
@Autowired
private CacheService cacheService;
private static final String AVATOR_NO_FORMAT = "00000";
private static final String AVATOR_PREFIX = "MTX";
public Logger logger = LoggerFactory.getLogger(getClass());
@RequestMapping(value = "member/account.html", method = RequestMethod.GET)
public ModelAndView index(ModelAndView model , HttpSession session){
model.setViewName("member/account");
MemberEntity member = (MemberEntity) session.getAttribute("currMember");
model.addObject("member" , memberService.findByUid(member.getId()));
return model;
}
@RequestMapping(value = "member/account/update.html", method = RequestMethod.POST)
@ResponseBody
public Result updateMember(@RequestBody MemberEntity member){
member.setId(ShiroUtils.getMemberId());
memberService.updateMember(member);
return Result.successResult(member);
}
@RequestMapping(value = "member/password.html", method = RequestMethod.GET)
public ModelAndView password(ModelAndView model){
model.setViewName("member/password");
return model;
}
@RequestMapping(value = "member/password/update.html", method = RequestMethod.POST)
@ResponseBody
public Result updatePwd(@RequestBody MemberEntity member){
member.setId(ShiroUtils.getMemberId());
return memberService.updatePwd(member);
}
@RequestMapping(value = "/member/uploadFile.html", method = RequestMethod.POST)
@ResponseBody
public UploaderMessage uploadFileHandler(@RequestParam("file") MultipartFile file,HttpServletRequest request) throws IOException {
if (!file.isEmpty()) {
InputStream in = null;
OutputStream out = null;
try {
String path = fileStoragePath + DateUtils.format(new Date(), "yyyyMMdd");
File dir = new File(path);
if (!dir.exists()) {
dir.mkdirs();
}
String avatorName = this.getAvatorNo() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
in = file.getInputStream();
out = new FileOutputStream(path + "/" + avatorName);
byte[] b = new byte[1024];
int len = 0;
while ((len = in.read(b)) > 0) {
out.write(b, 0, len);
}
out.close();
in.close();
logger.info("Server File Location=" + path + avatorName);
UploaderMessage msg = new UploaderMessage();
msg.setStatus(Status.SUCCESS);
msg.setStatusMsg("File upload success");
msg.setFilePath("files/" + DateUtils.format(new Date(), "yyyyMMdd") + "/" + avatorName);
msg.setFileDomain(domainName);
return msg;
} catch (Exception e) {
UploaderMessage msg = new UploaderMessage();
msg.setStatus(Status.ERROR);
msg.setError("File upload file");
return msg;
} finally {
if (out != null) {
out.close();
out = null;
}
if (in != null) {
in.close();
in = null;
}
}
} else {
UploaderMessage msg = new UploaderMessage();
msg.setStatus(Status.ERROR);
msg.setError("File is empty");
return msg;
}
}
private String getAvatorNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
String format = sdf.format(new Date());
DecimalFormat df = new DecimalFormat(AVATOR_NO_FORMAT);
String key = AVATOR_PREFIX + format;
Long incr = cacheService.incr(key);
String avatorNo = AVATOR_PREFIX + df.format(incr);
return avatorNo;
}
}

@ -0,0 +1,107 @@
package com.tamguo.web.member;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.common.image.CaptchaUtils;
import com.tamguo.common.utils.Result;
import com.tamguo.common.utils.SystemConstant;
import com.tamguo.utils.ShiroUtils;
@Controller
public class LoginController {
@RequestMapping("captcha.jpg")
public void captcha(HttpServletResponse response) throws ServletException, IOException {
response.setHeader("Cache-Control", "no-store, no-cache");
response.setContentType("image/jpeg");
String a = CaptchaUtils.generateCaptcha(response.getOutputStream());
ShiroUtils.setSessionAttribute(SystemConstant.KAPTCHA_SESSION_KEY, a);
}
@RequestMapping(value = "/login.html", method = RequestMethod.GET)
public ModelAndView login(ModelAndView model){
model.setViewName("login");
model.addObject("isVerifyCode" , "0");
return model;
}
@RequestMapping(value = "/submitLogin.html", method = RequestMethod.POST)
public ModelAndView submitLogin(String username , String password , String verifyCode , ModelAndView model , HttpSession session , HttpServletResponse response) throws IOException{
Result result = Result.successResult(null);
if(StringUtils.isEmpty(verifyCode)) {
result = Result.result(202, null, "请输入验证码");
} else if(StringUtils.isNotEmpty(verifyCode)){
String kaptcha = ShiroUtils.getKaptcha(SystemConstant.KAPTCHA_SESSION_KEY);
if (!verifyCode.equalsIgnoreCase(kaptcha)) {
result = Result.result(205, null, "验证码错误");
} else {
Subject subject = ShiroUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
subject.login(token);
session.setAttribute("currMember", ShiroUtils.getMember());
response.sendRedirect("member/index.html");
return null;
} catch (UnknownAccountException e) {
result = Result.result(201, null, "用户名或密码有误,请重新输入或找回密码");
} catch (IncorrectCredentialsException e) {
result = Result.result(202, null, "用户名或密码有误,请重新输入或找回密码");
} catch (LockedAccountException e) {
result = Result.result(203, null, "账号被锁定");
}
}
}
model.setViewName("login");
model.addObject("code", result.getCode());
model.addObject("msg" , result.getMessage());
model.addObject("username", username);
return model;
}
@RequestMapping(value = "/miniLogin.html", method = RequestMethod.GET)
@ResponseBody
public Result miniLogin(String username , String password , String captcha, ModelAndView model , HttpSession session) {
Result result = null;
if(StringUtils.isEmpty(captcha)) {
result = Result.result(204, null, "请输入验证码");
} else if(StringUtils.isNotEmpty(captcha)){
String kaptcha = ShiroUtils.getKaptcha(SystemConstant.KAPTCHA_SESSION_KEY);
if (!captcha.equalsIgnoreCase(kaptcha)) {
result = Result.result(205, null, "验证码错误");
}else {
Subject subject = ShiroUtils.getSubject();
UsernamePasswordToken token = new UsernamePasswordToken(username, password);
try {
subject.login(token);
session.setAttribute("currMember", ShiroUtils.getMember());
result = Result.successResult(ShiroUtils.getMember());
} catch (UnknownAccountException e) {
result = Result.result(201, null, "用户名或密码有误,请重新输入或找回密码");
} catch (IncorrectCredentialsException e) {
result = Result.result(202, null, "用户名或密码有误,请重新输入或找回密码");
} catch (LockedAccountException e) {
result = Result.result(203, null, "账号被锁定");
}
}
}
return result;
}
}

@ -0,0 +1,28 @@
package com.tamguo.web.member;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.tamguo.utils.ShiroUtils;
@Controller
public class LogoutController {
/**
*
*/
@RequestMapping(value = "logout.html", method = RequestMethod.GET)
public String logout(HttpServletRequest request, HttpServletResponse response, HttpSession session) {
if (session.getAttribute("currMember") != null) {
session.removeAttribute("currMember");
ShiroUtils.logout();
}
return "redirect:/";
}
}

@ -0,0 +1,32 @@
package com.tamguo.web.member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.member.service.IMemberService;
import com.tamguo.utils.ShiroUtils;
@Controller
public class MemberController {
@Autowired
IMemberService iMemberService;
@RequestMapping(value = "/member/index.html", method = RequestMethod.GET)
public ModelAndView index(ModelAndView model){
model.setViewName("member/index");
model.addObject("member" , iMemberService.findByUid(ShiroUtils.getMember().getId()));
return model;
}
@RequestMapping(value = "/member/findCurrMember.html", method = RequestMethod.GET)
@ResponseBody
public Result findCurrMember() {
return Result.successResult(iMemberService.findCurrMember(ShiroUtils.getMemberId()));
}
}

@ -0,0 +1,127 @@
package com.tamguo.web.member;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.Condition;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.common.utils.ExceptionSupport;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.tiku.model.PaperEntity;
import com.tamguo.modules.tiku.model.enums.QuestionTypeEnum;
import com.tamguo.modules.tiku.service.IPaperService;
import com.tamguo.utils.ShiroUtils;
@Controller
public class MemberPaperController {
@Autowired
private IPaperService iPaperService;
@RequestMapping(value = "/member/paper.html", method = RequestMethod.GET)
public ModelAndView paper(ModelAndView model, HttpSession session){
model.setViewName("member/paperList");
return model;
}
@RequestMapping(value = "/member/findPaper.html", method = RequestMethod.GET)
@ResponseBody
public Result findPaper(String paperId) {
return Result.successResult(iPaperService.selectById(paperId));
}
@SuppressWarnings({ "unchecked"})
@RequestMapping(value = "member/paper/list.html" , method = RequestMethod.GET)
@ResponseBody
public Map<String, Object> paperList(String name , Integer page , Integer limit , HttpSession session){
MemberEntity member = ((MemberEntity)session.getAttribute("currMember"));
Page<PaperEntity> list = iPaperService.selectPage(new Page<>(page , limit) , Condition.create().like("name", name).eq("creater_id", member.getId()));
return Result.jqGridResult(list.getRecords(), list.getTotal(), limit, page, list.getPages());
}
@RequestMapping(value="member/paperList/addPaperQuestionInfo.html",method=RequestMethod.POST)
@ResponseBody
public Result addPaperQuestionInfo(@RequestBody JSONObject data){
try {
String paperId ; String title ; String name ;String type;
paperId = data.getString("uid");
title = data.getString("title");
type = data.getString("type");
name = QuestionTypeEnum.getQuestionType(type).getDesc();
iPaperService.addPaperQuestionInfo(paperId , title , name , type);
return Result.result(0, null, "修改成功");
} catch (Exception e) {
return ExceptionSupport.resolverResult("添加questionInfo", this.getClass(), e);
}
}
@RequestMapping("member/paperList/updatePaperQuestionInfo.html")
@ResponseBody
public Result updatePaperQuestionInfo(@RequestBody JSONObject data){
try {
String paperId ; String title ; String name ; String type ; String uid;
paperId = data.getString("uid");
title = data.getString("title");
type = data.getString("type");
name = QuestionTypeEnum.getQuestionType(type).getDesc();
uid = data.getString("infoUid");
iPaperService.updatePaperQuestionInfo(paperId , title , name , type , uid);
return Result.result(0, null, "修改成功");
} catch (Exception e) {
return ExceptionSupport.resolverResult("修改questionInfo", this.getClass(), e);
}
}
@RequestMapping("member/paperList/deletePaper")
@ResponseBody
public Result deletePaper(String paperId){
try {
return iPaperService.deletePaper(ShiroUtils.getMemberId() , paperId);
} catch (Exception e) {
return ExceptionSupport.resolverResult("删除试卷", this.getClass(), e);
}
}
@RequestMapping("member/paperList/deletePaperQuestionInfoBtn.html")
@ResponseBody
public Result deletePaperQuestionInfoBtn(String paperId , String uid){
try {
return iPaperService.deletePaperQuestionInfoBtn(ShiroUtils.getMemberId() , paperId , uid);
} catch (Exception e) {
return ExceptionSupport.resolverResult("删除子卷", this.getClass(), e);
}
}
@RequestMapping(value="member/paperList/addPaper.html",method=RequestMethod.POST)
@ResponseBody
public Result addPaper(@RequestBody PaperEntity paper,HttpSession session){
try {
MemberEntity member = (MemberEntity) session.getAttribute("currMember");
paper.setCreaterId(member.getId());
iPaperService.addPaper(paper);
return Result.result(Result.SUCCESS_CODE, paper, "添加成功");
} catch (Exception e) {
return ExceptionSupport.resolverResult("添加试卷", this.getClass(), e);
}
}
@RequestMapping(value="member/paperList/updatePaper.html",method=RequestMethod.POST)
@ResponseBody
public Result updatePaper(@RequestBody PaperEntity paper){
try {
return iPaperService.updatePaper(paper , ShiroUtils.getMemberId());
} catch (Exception e) {
return ExceptionSupport.resolverResult("修改试卷", this.getClass(), e);
}
}
}

@ -0,0 +1,81 @@
package com.tamguo.web.member;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.common.utils.Result;
import com.tamguo.common.utils.SystemConstant;
import com.tamguo.modules.member.service.IMemberService;
import com.tamguo.utils.ShiroUtils;
@Controller
public class PasswordController {
@Autowired
private IMemberService iMemberService;
@RequestMapping(value = "password/find.html", method = RequestMethod.GET)
public ModelAndView confirmAccount(ModelAndView model){
model.setViewName("password/confirmAccount");
return model;
}
@RequestMapping(value = "password/confirmAccount.html", method = RequestMethod.POST)
public ModelAndView submitConfirmAccount(String username , String veritycode , ModelAndView model){
Result result = iMemberService.confirmAccount(username, veritycode);
String kaptcha = ShiroUtils.getKaptcha(SystemConstant.KAPTCHA_SESSION_KEY);
if (!veritycode.equalsIgnoreCase(kaptcha)) {
result = Result.result(202, null, "验证码错误");
}
if(result.getCode() == 200){
model.setViewName("password/securityCheck");
model.addObject("result", result);
model.addObject("isEmail", username.contains("@") ? "1" : "0");
}else{
model.setViewName("password/confirmAccount");
model.addObject("account", username);
model.addObject("username",username);
model.addObject("veritycode", veritycode);
model.addObject("code", result.getCode());
}
return model;
}
@RequestMapping(value = "password/securityCheck.html", method = RequestMethod.POST)
public ModelAndView securityCheck(String username , String isEmail , String mobileVcode , ModelAndView model){
Result result = iMemberService.securityCheck(username , isEmail , mobileVcode);
if(result.getCode() == 200){
model.addObject("username", username);
model.addObject("resetPasswordKey" , result.getResult());
model.setViewName("password/resetPassword");
}else{
model.addObject("result", result);
model.addObject("isEmail", isEmail);
model.addObject("codeError", "1");
model.setViewName("password/securityCheck");
}
return model;
}
@RequestMapping(value = "password/resetPassword.html", method = RequestMethod.POST)
public ModelAndView resetPassword(String resetPasswordKey , String username , String password , String verifypwd , ModelAndView model){
Result result = iMemberService.resetPassword(resetPasswordKey , username , password , verifypwd);
if(result.getCode() == 200){
model.setViewName("password/resetPwSuccess");
}else{
model.setViewName("password/resetPassword");
}
return model;
}
@RequestMapping(value = "password/checkAccount.html", method = RequestMethod.GET)
@ResponseBody
public Result checkAccount(String account){
return iMemberService.checkAccount(account);
}
}

@ -0,0 +1,97 @@
package com.tamguo.web.member;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.plugins.Page;
import com.tamguo.common.utils.ExceptionSupport;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.tiku.model.QuestionEntity;
import com.tamguo.modules.tiku.service.IPaperService;
import com.tamguo.modules.tiku.service.IQuestionService;
import com.tamguo.utils.ShiroUtils;
@Controller(value="memberQuestionController")
public class QuestionController {
@Autowired
private IQuestionService iQuestionService;
@Autowired
private IPaperService iPaperService;
@RequestMapping(value = "/member/addQuestion.html", method = RequestMethod.GET)
public ModelAndView index(String paperId , ModelAndView model){
model.setViewName("member/addQuestion");
model.addObject("paper", iPaperService.selectById(paperId));
return model;
}
@RequestMapping(value = "/member/submitQuestion.html", method = RequestMethod.POST)
@ResponseBody
public Result submitQuestion(QuestionEntity question){
try {
return iQuestionService.addQuestion(question , ShiroUtils.getMemberId());
} catch (Exception e) {
return ExceptionSupport.resolverResult("添加试题", this.getClass(), e);
}
}
@RequestMapping(value = "/member/questionList.html", method = RequestMethod.GET)
public ModelAndView questionList(String paperId , ModelAndView model){
model.addObject("paper", iPaperService.selectById(paperId));
model.setViewName("member/questionList");
return model;
}
@RequestMapping(value = "/member/queryQuestionList.html" , method=RequestMethod.POST)
@ResponseBody
public Map<String, Object> queryQuestionList(@RequestBody JSONObject data){
String questionType ; String uid ; String content ; String paperId ;
Integer page ; Integer limit;
questionType = data.getString("questionType");
uid = data.getString("uid");
content = data.getString("content");
paperId = data.getString("paperId");
page = data.getInteger("page");
limit = data.getInteger("limit");
Page<QuestionEntity> p = new Page<>();
p.setCurrent(page);
p.setSize(limit);
Page<QuestionEntity> list = iQuestionService.queryQuestionList(questionType , uid , content , paperId , ShiroUtils.getMemberId() , p);
return Result.jqGridResult(list.getRecords(), list.getTotal(), limit, page, list.getPages());
}
@RequestMapping(value = "/member/editQuestion.html", method = RequestMethod.GET)
public ModelAndView editQuestion(String paperId , String questionId , ModelAndView model){
model.setViewName("member/editQuestion");
model.addObject("paper", iPaperService.selectById(paperId));
model.addObject("questionId" , questionId);
return model;
}
@RequestMapping(value = "/member/getQuestion.html", method = RequestMethod.GET)
@ResponseBody
public Result getQuestion(String questionId) {
return Result.successResult(iQuestionService.selectById(questionId));
}
@RequestMapping(value = "/member/updateQuestion.html", method = RequestMethod.POST)
@ResponseBody
public Result updateQuestion(QuestionEntity question) {
return iQuestionService.updateQuestion(question , ShiroUtils.getMemberId());
}
@RequestMapping(value = "/member/deleteQuestion.html", method = RequestMethod.GET)
@ResponseBody
public Result deleteQuestion(@RequestBody String uid) {
return iQuestionService.delete(uid , ShiroUtils.getMemberId());
}
}

@ -0,0 +1,69 @@
package com.tamguo.web.member;
import javax.servlet.http.HttpSession;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.member.model.MemberEntity;
import com.tamguo.modules.member.service.IMemberService;
import com.tamguo.utils.ShiroUtils;
@Controller
public class RegisterController {
@Autowired
private IMemberService iMemberService;
@RequestMapping(value = "/register.html", method = RequestMethod.GET)
public ModelAndView register(ModelAndView model , HttpSession session) {
model.setViewName("register");
return model;
}
@RequestMapping(value = "/checkUsername.html", method = RequestMethod.GET)
@ResponseBody
public Result checkUsername(String username){
return iMemberService.checkUsername(username);
}
@RequestMapping(value = "/checkMobile.html", method = RequestMethod.GET)
@ResponseBody
public Result checkMobile(String mobile){
return iMemberService.checkMobile(mobile);
}
@RequestMapping(value = "/subRegister.html", method = RequestMethod.POST)
@ResponseBody
public Result subRegister(@RequestBody MemberEntity member , HttpSession session){
Result result = iMemberService.register(member);
if(result.getCode() == 200) {
Subject subject = ShiroUtils.getSubject();
MemberEntity memberEntity = (MemberEntity) result.getResult();
UsernamePasswordToken token = new UsernamePasswordToken(memberEntity.getUsername(), member.getPassword());
try {
subject.login(token);
session.setAttribute("currMember", ShiroUtils.getMember());
} catch (UnknownAccountException e) {
return Result.result(201, null, "用户名或密码有误,请重新输入或找回密码");
} catch (IncorrectCredentialsException e) {
return Result.result(202, null, "用户名或密码有误,请重新输入或找回密码");
} catch (LockedAccountException e) {
return Result.result(203, null, "账号被锁定");
}
}
return result;
}
}

@ -0,0 +1,30 @@
package com.tamguo.web.tiku;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.aliyuncs.exceptions.ClientException;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.sys.service.ISmsService;
@Controller
public class SmsController {
@Autowired
ISmsService iSmsService;
@RequestMapping(value = {"sms/sendFindPasswordSms.html"}, method = RequestMethod.GET)
@ResponseBody
public Result sendFindPasswordSms(String mobile){
try {
return iSmsService.sendFindPasswordSms(mobile);
} catch (ClientException e) {
e.printStackTrace();
}
return Result.result(500, null, "");
}
}

@ -8,9 +8,12 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.mapper.Condition;
import com.tamguo.common.utils.Result;
import com.tamguo.modules.sys.service.ISysAreaService;
import com.tamguo.modules.tiku.model.BookEntity;
import com.tamguo.modules.tiku.model.ChapterEntity;
@ -71,6 +74,13 @@ public class SubjectController {
model.setViewName("500");
return model;
}
}
// [{"value":"11","label":"北京市","children":[{"value":"1101","label":"市辖区"}]}]
@RequestMapping(value = {"subject/getCourseCascaderTree.html"}, method = RequestMethod.GET)
@ResponseBody
public Result getCourseCascaderTree() {
JSONArray list = iSubjectService.getCourseCascaderTree();
return Result.successResult(list);
}
}

@ -77,10 +77,10 @@ var vm = new Vue({
methods: {
reload: function (currPage) {
vm.loading = true;
axios({method: 'get',url: mainHttp + "/member/paper/list.html?name="+vm.q.name+"&page="+currPage+"&limit=6"}).then(function(response){
axios({method: 'get',url: mainHttp + "member/paper/list.html?name="+vm.q.name+"&page="+currPage+"&limit=6"}).then(function(response){
vm.paperList = response.data.list;
if(vm.paperList != null && vm.paperList.length > 0 ){
vm.currPaperUid = vm.paperList[0].uid;
vm.currPaperUid = vm.paperList[0].id;
}
vm.totalCount = response.data.totalCount;
vm.loading = false;
@ -126,7 +126,7 @@ var vm = new Vue({
vm.paper.schoolId = vm.paper.schoolIdList.join(",");
}
var url = null;
if(/^(undefined|null|\s*)?$/.test(vm.paper.uid)){
if(/^(undefined|null|\s*)?$/.test(vm.paper.id)){
url = mainHttp + 'member/paperList/addPaper.html';
}else {
url = mainHttp + 'member/paperList/updatePaper.html';
@ -176,7 +176,7 @@ var vm = new Vue({
showPaperInfo:function(uid , queInfo){
vm.paperInfo.flag = true;
vm.paperInfo.uid = uid;
vm.paperInfo.id = uid;
vm.paperInfo.queInfo = queInfo;
@ -216,7 +216,7 @@ var vm = new Vue({
// 实现修改试卷
showUpdatePaperInfo:function(uid , type , title , infoUid){
vm.paperInfo.flag = false;
vm.paperInfo.uid = uid;
vm.paperInfo.id = uid;
vm.paperInfoDialogFormVisible = true
vm.paperInfo.name = name;

@ -3,10 +3,10 @@
<head>
<title>探果题库_资源不存在</title>
<meta charset="utf-8">
<link type="favicon" rel="shortcut icon" th:href="${setting.domain + 'images/favicon.png'}" />
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
</head>
<body>
访问的内容不存在!
<a th:href="${setting.domain}">返回首页</a>
<a th:href="${domainName}">返回首页</a>
</body>
</html>

@ -7,6 +7,6 @@
</head>
<body>
服务器异常!
<a th:href="${setting.domain}">返回首页</a>
<a th:href="${domainName}">返回首页</a>
</body>
</html>

@ -32,7 +32,7 @@
</div>
<div class="clearfix submenu-container" data-id="submenu">
<div class="submenu clearfix" id="submenu" data-id="submenu">
<ul th:class="${m.pinyin + ' subm-ul dis-none'}" th:each="m,mStat:${application.menuList}" data-id="submenu">
<ul th:class="${m.pinyin + ' subm-ul dis-none'}" th:each="m,mStat:${menuList}" data-id="submenu">
<li class="subm-li" th:each="c,cmStat:${m.childSubjects}"><a th:href="${domainName + c.url}" target="_blank" th:text="${c.name}">高考</a></li>
</ul>
<div class="all-exm all dis-none" data-id="submenu">

@ -16,7 +16,6 @@
<link rel="stylesheet" th:href="${domainName + 'css/footer.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/minilogin.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
</head>
<body>
<!-- 头部-->

@ -3,11 +3,11 @@
<head>
<meta charset="UTF-8">
<title>会员中心_探果题库</title>
<link rel="stylesheet" th:href="${setting.domain + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/iconfont.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/account.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/memberMain.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${setting.domain + 'images/favicon.png'}" />
<link rel="stylesheet" th:href="${domainName + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/iconfont.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/account.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/memberMain.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
<!-- 引入样式 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/theme-chalk/index.css">
<style type="text/css">
@ -43,20 +43,20 @@
<div class="head" th:fragment="memberHeader">
<div class="head-bar public">
<div class="logo">
<a target="_blank" th:href="${setting.domain}">
<img th:src="${setting.domain + 'images/logo_731bc32.png'}">
<a target="_blank" th:href="${domainName}">
<img th:src="${domainName + 'images/logo_731bc32.png'}">
</a>
<p><span>考试中心</span></p>
</div>
<ul class="nav">
<li><a th:href="${setting.domain + 'member/index.html'}">首页</a></li>
<li><a th:href="${setting.domain + 'member/paper.html'}">试卷</a></li>
<li class="active"><a th:href="${setting.domain + 'member/account.html'}">帐号</a></li>
<li><a th:href="${domainName + 'member/index.html'}">首页</a></li>
<li><a th:href="${domainName + 'member/paper.html'}">试卷</a></li>
<li class="active"><a th:href="${domainName + 'member/account.html'}">帐号</a></li>
</ul>
<div class="mguser">
<div class="mguser-box">
<span th:text="${session.currMember.username}">tamguo</span>
<a th:href="${setting.domain + 'logout.html'}">退出</a>
<a th:href="${domainName + 'logout.html'}">退出</a>
</div>
</div>
</div>
@ -85,14 +85,14 @@
<div class="navLeft">
<dl>
<dt class="down">
<img th:src="${setting.domain + 'images/member/index/person.png'}" style="width: 14px;margin-right: 6px;margin-top: -5px;"> 个人信息 <i class="fa fa-minus icon-w"></i>
<img th:src="${domainName + 'images/member/index/person.png'}" style="width: 14px;margin-right: 6px;margin-top: -5px;"> 个人信息 <i class="fa fa-minus icon-w"></i>
</dt>
<div class="list">
<a th:href="${setting.domain + 'member/account.html'}"><dd class="activeDd"><i></i>基本信息</dd></a>
<a th:href="${setting.domain + 'member/password.html'}"><dd><i></i>修改密码</dd></a>
<a th:href="${domainName + 'member/account.html'}"><dd class="activeDd"><i></i>基本信息</dd></a>
<a th:href="${domainName + 'member/password.html'}"><dd><i></i>修改密码</dd></a>
</div>
<dt class="down">
<img th:src="${setting.domain + 'images/member/index/compnew.png'}" style="width: 14px;
<img th:src="${domainName + 'images/member/index/compnew.png'}" style="width: 14px;
margin-right: 6px;margin-top: -5px;"> 我的钱包 <i class="fa fa-minus icon-w"></i>
</dt>
<div class="list">
@ -100,7 +100,7 @@
<a href="/b/entInfo"><dd><i></i>我的现金</dd></a>
</div>
<dt class="down">
<img th:src="${setting.domain + 'images/member/account/cog.png'}" style="width: 14px;
<img th:src="${domainName + 'images/member/account/cog.png'}" style="width: 14px;
margin-right: 6px;"> 账户信息 <i class="fa fa-minus icon-w"></i>
</dt>
<div class="list">
@ -157,11 +157,11 @@
<div th:replace="include/memberFooter :: memberFooter"></div>
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${setting.domain}]];
var mainHttp = [[${domainName}]];
</script>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script type="text/javascript" th:src="${setting.domain + 'js/member/account.js'}"></script>
<script type="text/javascript" th:src="${domainName + 'js/member/account.js'}"></script>
</body>
</html>

@ -3,31 +3,31 @@
<head>
<meta charset="UTF-8">
<title>探果-科目</title>
<link rel="stylesheet" th:href="${setting.domain + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/iconfont.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/index.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/memberMain.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${setting.domain + 'images/favicon.png'}" />
<link rel="stylesheet" th:href="${domainName + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/iconfont.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/index.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/memberMain.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
</head>
<body>
<!-- 头部-->
<div class="head" th:fragment="memberHeader">
<div class="head-bar public">
<div class="logo">
<a target="_blank" th:href="${setting.domain}">
<img th:src="${setting.domain + 'images/logo_731bc32.png'}">
<a target="_blank" th:href="${domainName}">
<img th:src="${domainName + 'images/logo_731bc32.png'}">
</a>
<p><span>考试中心</span></p>
</div>
<ul class="nav">
<li class="active"><a th:href="${setting.domain + 'member/index.html'}">首页</a></li>
<li><a th:href="${setting.domain + 'member/paper.html'}">试卷</a></li>
<li><a th:href="${setting.domain + 'member/account.html'}">帐号</a></li>
<li class="active"><a th:href="${domainName + 'member/index.html'}">首页</a></li>
<li><a th:href="${domainName + 'member/paper.html'}">试卷</a></li>
<li><a th:href="${domainName + 'member/account.html'}">帐号</a></li>
</ul>
<div class="mguser">
<div class="mguser-box">
<span th:text="${member.username}">tamguo</span>
<a th:href="${setting.domain + 'logout.html'}">退出</a>
<a th:href="${domainName + 'logout.html'}">退出</a>
</div>
</div>
</div>
@ -54,7 +54,7 @@
<div class="PCshow hide" style="display: block;">
<div class="examContent public">
<h2>
<img th:src="${setting.domain + 'images/member/index/face-xiao.png'}"
<img th:src="${domainName + 'images/member/index/face-xiao.png'}"
style="position: relative; top: -2px;"> &nbsp;<span
style="letter-spacing: 4px;">
<b id="userName" style="font-weight: normal; color: #2abcb8" th:text="${member.nickName}">tamguo</b>,您好!欢迎来到探果题库会员中心
@ -69,13 +69,13 @@
<tbody><tr>
<td>
<span class="logoV">
<img th:src="${setting.domain + member.avatar}">
<img th:src="${domainName + member.avatar}">
</span>
</td>
</tr>
</tbody></table>
<b th:title="${member.username}" style="font-size: 16px; margin-left: 14px;float: left;display: inline-block;font-weight: normal;max-width: 100px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" th:text="${member.username}">盘诚软件</b>
<a style="font-size: 12px;" th:href="${setting.domain + 'member/account.html'}"><i class="iconfont icon-icon_edit"></i> 编辑</a>
<a style="font-size: 12px;" th:href="${domainName + 'member/account.html'}"><i class="iconfont icon-icon_edit"></i> 编辑</a>
</div>
<p style="clear: both;height: 0px;"></p>
</div>
@ -89,7 +89,7 @@
<li style="padding-left: 24px;">余额:<b style="margin-left: 19px;color:#009688;" th:text="${#numbers.formatDecimal(member.amount,1,2) + ' '}">50</b></li>
<li style="padding-left: 21px;">最近登录时间:<b style="margin-left: 13px;" th:text="${#dates.format(member.lastLoginTime * 1000, 'yyyy/MM/ss HH:mm')}">2018-04-27 10:32</b></li>
</ul>
<a th:href="${setting.domain}" target="_blank" id="addMoney">我的钱包</a>
<a th:href="${domainName}" target="_blank" id="addMoney">我的钱包</a>
</div>
</div>
<!-- 右侧信息显示 -->
@ -97,31 +97,31 @@
<div class="topNews" id="numList1">
<ul>
<li>
<img th:src="${setting.domain + 'images/member/index/peneil.png'}" style="margin-top: 26px;position: relative;top: -4px;"><br>
<img th:src="${domainName + 'images/member/index/peneil.png'}" style="margin-top: 26px;position: relative;top: -4px;"><br>
<span><b id="datab1" th:text="${member.downNum}">0</b></span><br>
<span>下载总数</span>
</li>
<li>
<img th:src="${setting.domain + 'images/member/index/paperm.png'}" style="margin-top: 26px;position: relative;top: -4px;"><br>
<img th:src="${domainName + 'images/member/index/paperm.png'}" style="margin-top: 26px;position: relative;top: -4px;"><br>
<span><b id="datab2" th:text="${member.paperNum}">1</b></span><br>
<span>试卷总数</span>
</li>
<li>
<img th:src="${setting.domain + 'images/member/index/peoplem.png'}" style="margin-top: 26px;position: relative;top: -4px;"><br>
<img th:src="${domainName + 'images/member/index/peoplem.png'}" style="margin-top: 26px;position: relative;top: -4px;"><br>
<span><b id="datab3" th:text="${member.hitsNum}">0</b></span><br>
<span>阅读总数</span>
</li>
<li>
<img th:src="${setting.domain + 'images/member/index/testnew.png'}" style="margin-top: 26px;position: relative;top: -6px;"><br>
<img th:src="${domainName + 'images/member/index/testnew.png'}" style="margin-top: 26px;position: relative;top: -6px;"><br>
<span><b id="datab4" th:text="${member.questionNum}">19</b></span><br>
<span>试题总数</span>
</li>
</ul>
<div class="newExam">
<div class="add-p">
<a th:href="${setting.domain + 'member/paper.html'}"><i class="iconfont icon-jia" style="font-size:130px;"></i></a>
<a th:href="${domainName + 'member/paper.html'}"><i class="iconfont icon-jia" style="font-size:130px;"></i></a>
</div>
<a th:href="${setting.domain + 'member/paper.html'}">开始新建试卷</a>
<a th:href="${domainName + 'member/paper.html'}">开始新建试卷</a>
</div>
</div>
</div>

@ -3,11 +3,11 @@
<head>
<meta charset="UTF-8">
<title>会员中心-试卷列表</title>
<link rel="stylesheet" th:href="${setting.domain + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/iconfont.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/paperList.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/memberMain.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${setting.domain + 'images/favicon.png'}" />
<link rel="stylesheet" th:href="${domainName + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/iconfont.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/paperList.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/memberMain.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
<!-- 引入样式 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/theme-chalk/index.css">
</head>
@ -16,20 +16,20 @@
<div class="head" th:fragment="memberHeader">
<div class="head-bar public">
<div class="logo">
<a target="_blank" th:href="${setting.domain}">
<img th:src="${setting.domain + 'images/logo_731bc32.png'}">
<a target="_blank" th:href="${domainName}">
<img th:src="${domainName + 'images/logo_731bc32.png'}">
</a>
<p><span>考试中心</span></p>
</div>
<ul class="nav">
<li><a th:href="${setting.domain + 'member/index.html'}">首页</a></li>
<li class="active"><a th:href="${setting.domain + 'member/paper.html'}">试卷</a></li>
<li><a th:href="${setting.domain + 'member/account.html'}">帐号</a></li>
<li><a th:href="${domainName + 'member/index.html'}">首页</a></li>
<li class="active"><a th:href="${domainName + 'member/paper.html'}">试卷</a></li>
<li><a th:href="${domainName + 'member/account.html'}">帐号</a></li>
</ul>
<div class="mguser">
<div class="mguser-box">
<span th:text="${session.currMember.username}">tamguo</span>
<a th:href="${setting.domain + 'logout.html'}">退出</a>
<a th:href="${domainName + 'logout.html'}">退出</a>
</div>
</div>
</div>
@ -88,7 +88,7 @@
<tbody>
<tr align="center" valign="middle" style="height:66px">
<td width="300" class="plist-bt">
<span @click="openPaperInfo(paper.uid)">{{paper.uid == currPaperUid ? '-' : '+'}}</span>
<span @click="openPaperInfo(paper.id)">{{paper.id == currPaperUid ? '-' : '+'}}</span>
<div class="M ng-binding" style="line-height: 40px;" title="软件JAVA">{{paper.name}}
</div>
</td>
@ -103,10 +103,10 @@
<td class="plist-x">
<span>
<a href="javascript:void(0)" v-on:click="updatePaper(paper.uid , paper.name)">编辑</a>|<a href="javascript:void(0)" v-on:click="showDeleteDialog(paper.uid , paper.name)">删除</a>
<a href="javascript:void(0)" v-on:click="updatePaper(paper.id , paper.name)">编辑</a>|<a href="javascript:void(0)" v-on:click="showDeleteDialog(paper.id , paper.name)">删除</a>
</span>
<ul class="testPaper-list">
<li><a class="addPaperQuestionInfoBtn" v-on:click="showPaperInfo(paper.uid,paper.queInfo)">添加子卷</a>
<li><a class="addPaperQuestionInfoBtn" v-on:click="showPaperInfo(paper.id,paper.queInfo)">添加子卷</a>
</li>
<li><a href="#" target="_blank" class="ng-scope">预览试卷</a>
</ul>
@ -114,7 +114,7 @@
</tr>
</tbody>
</table>
<div v-bind:style="{ display: paper.uid == currPaperUid ? 'block' : 'none'}">
<div v-bind:style="{ display: paper.id == currPaperUid ? 'block' : 'none'}">
<table class="plist-ctab2 able">
<tbody>
<tr class="tr_header" align="center" valign="middle">
@ -132,13 +132,13 @@
<td class="plist-x" style="float:none">
<div>
<span style="margin-left:0;">
<a href="javascript:void(0)" class="update_paper2" v-on:click="showUpdatePaperInfo(paper.uid, qInfo.type,qInfo.title,qInfo.uid)">编辑</a>|
<a href="javascript:void(0)" class="del" v-on:click="showPaperInfoDeleteDialog(paper.uid , qInfo.title , qInfo.uid)">删除</a>
<a href="javascript:void(0)" class="update_paper2" v-on:click="showUpdatePaperInfo(paper.id, qInfo.type,qInfo.title,qInfo.id)">编辑</a>|
<a href="javascript:void(0)" class="del" v-on:click="showPaperInfoDeleteDialog(paper.id , qInfo.title , qInfo.id)">删除</a>
</span>
<ul class="addQuestion" style="margin:-3px 0 0;float:none">
<li class="ng-scope"><a class="add able" v-on:click="addPaperQuestionFn(paper.uid)" href="javascript:(0);">添加试题</a>
<li class="ng-scope"><a class="add able" v-on:click="addPaperQuestionFn(paper.id)" href="javascript:(0);">添加试题</a>
</li>
<li class="ng-scope"><a class="edit able" :href="'questionList.html?paperId=' + paper.uid">管理试题</a>
<li class="ng-scope"><a class="edit able" :href="'questionList.html?paperId=' + paper.id">管理试题</a>
</li>
</ul>
</div>
@ -174,9 +174,9 @@
<el-select v-model="paper.schoolIdList" multiple placeholder="请选择">
<el-option
v-for="school in schools"
:key="school.uid"
:key="school.id"
:label="school.name"
:value="school.uid">
:value="school.id">
</el-option>
</el-select>
</el-form-item>
@ -243,11 +243,11 @@
</body>
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${setting.domain}]];
var mainHttp = [[${domainName}]];
</script>
<!-- import JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script type="text/javascript" th:src="${setting.domain + 'js/member/paperList.js'}" ></script>
<script type="text/javascript" th:src="${domainName + 'js/member/paperList.js'}" ></script>
</html>

@ -7,17 +7,17 @@
<meta name="keyword" content="探果题库,数学试卷,高校试题,名校,名校试题,名校试卷,高校名师,名师专访,名师教案,名师课堂试题库,试卷库,智能题库,历年真题,模拟试题,押题,预测试题,高考,会计证,会计从业,会计师,经济师,施工员,建造师,建筑师,造价师,职业资格,证券资格,考研,计算机考试,建筑考试,财会类,医卫类,护士资格,公务员,知识点,试题,试卷"/>
<meta name="author" content="Tamguo Team" />
<meta name="copyright" content="Tamguo" />
<link rel="stylesheet" th:href="${setting.domain + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${setting.domain + 'css/member/register.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${setting.domain + 'images/favicon.png'}" />
<link rel="stylesheet" th:href="${domainName + 'css/reset.css'}" />
<link rel="stylesheet" th:href="${domainName + 'css/member/register.css'}" />
<link type="favicon" rel="shortcut icon" th:href="${domainName + 'images/favicon.png'}" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/theme-chalk/index.css">
</head>
<body>
<div id="wrapper" class="">
<div id="head">
<div class="mod-header">
<a th:href="${setting.domain}" style="display: block;">
<img th:src="${setting.domain + 'images/logo_731bc32.png'}" alt="logo"></a>
<a th:href="${domainName}" style="display: block;">
<img th:src="${domainName + 'images/logo_731bc32.png'}" alt="logo"></a>
</div>
</div>
<div id="nav">
@ -64,7 +64,7 @@
</div>
<div class="login-link" id="login_link">
<span>我已注册,现在就</span>
<button class="login-btn" id="login_btn"><a title="探果网登录" th:href="${setting.domain + 'login.html'}">登录</a></button></div>
<button class="login-btn" id="login_btn"><a title="探果网登录" th:href="${domainName + 'login.html'}">登录</a></button></div>
</div>
<div id="foot">
<div class="mod-footer">
@ -74,11 +74,11 @@
</div>
</body>
<script type="text/javascript" th:inline="javascript">
var mainHttp = [[${setting.domain}]];
var mainHttp = [[${domainName}]];
</script>
<!-- import JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16"></script>
<script src="https://cdn.jsdelivr.net/npm/element-ui@2.4.2/lib/index.js"></script>
<script src="https://cdn.jsdelivr.net/npm/axios@0.18.0/dist/axios.min.js"></script>
<script type="text/javascript" th:src="${setting.domain + 'js/member/register.js'}"></script>
<script type="text/javascript" th:src="${domainName + 'js/member/register.js'}"></script>
</html>

@ -177,7 +177,7 @@
<p class="title-detail">一考知底,高分必刷,全面提分</p>
<div class="title-underline"></div>
<div class="cityArea">
<a th:class="${a.id == '1'} ? 'cityname selected' : 'cityname'" th:attr="provinceid=${a.id},data-provinceid=${a.id}" th:each="a,aStat:${areaList}" th:text="${a.name}">北京</a>
<a th:class="${a.id == '1'} ? 'cityname selected' : 'cityname'" th:attr="provinceid=${a.id},data-provinceid=${a.id}" th:each="a,aStat:${areaList}" th:text="${a.areaName}">北京</a>
</div>
<div class="paper-main">
<div class="paper-box zhenti-box homepage-zhenti-box">
@ -192,8 +192,9 @@
</p>
<p class="list-item-detail">
<a class="list-item-link list-item-link-jiexi" th:href="${domainName + 'paper/'+h.id+'.html'}" data-paperid="d08fb966f5335a8102d220a5" target="_blank">解析</a><span class="item-separate">|</span>
<a th:href="${domainName + 'paper/'+h.id+'.html'}" class=" list-item-link list-item-link-xiazai" "=" " data-paperid="d08fb966f5335a8102d220a5 " target="_blank ">下载</a>
</li>
<a th:href="${domainName + 'paper/'+h.id+'.html'}" class=" list-item-link list-item-link-xiazai" data-paperid="d08fb966f5335a8102d220a5 " target="_blank ">下载</a>
</p>
</li>
</ul>
</div>
</div>
@ -209,7 +210,7 @@
</p>
<p class="list-item-detail">
<a class="list-item-link list-item-link-jiexi" th:href="${domainName + 'paper/'+s.id+'.html'}" data-paperid="19f2517101f69e31433294f3" target="_blank">解析</a><span class="item-separate">|</span>
<a th:href="${domainName + 'paper/'+s.id+'.html'}" class=" list-item-link list-item-link-xiazai" "=" " data-paperid="19f2517101f69e31433294f3 " target="_blank ">下载</a></p>
<a th:href="${domainName + 'paper/'+s.id+'.html'}" class=" list-item-link list-item-link-xiazai" data-paperid="19f2517101f69e31433294f3 " target="_blank ">下载</a></p>
</li>
</ul>
</div>

Loading…
Cancel
Save