Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
ddf36c73ae
Bump minimist from 1.2.5 to 1.2.6 in /HSLink-front
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-26 11:15:08 +00:00
71 changed files with 1263 additions and 20267 deletions

View File

@ -1,4 +1,5 @@
const baseUrl = 'http://127.0.0.1:8048'; //服务器地址 const baseUrl = 'http://192.168.10.29:8048'; //服务器地址
// const baseUrl = 'http://127.0.0.1:8048'; //服务器地址
const get = (url, data) => { const get = (url, data) => {
let httpDefaultOpts = { let httpDefaultOpts = {

View File

@ -71,18 +71,10 @@
<resource> <resource>
<directory>src/main/java</directory> <directory>src/main/java</directory>
<includes> <includes>
<include>**/*.yml</include> <include>**/*.properties</include>
<include>**/*.xml</include> <include>**/*.xml</include>
</includes> </includes>
<filtering>false</filtering> <filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.yml</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource> </resource>
</resources> </resources>
</build> </build>

View File

@ -1,25 +1,24 @@
package com.qinxx.hslink.controller; package com.qinxx.hslink.controller;
import com.qinxx.hslink.model.HsWinners;
import com.qinxx.hslink.model.base.AjaxResult;
import com.qinxx.hslink.service.AdminHSService; import com.qinxx.hslink.service.AdminHSService;
import com.qinxx.hslink.service.IHsWinnersService;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author PHY * @author PHY
*/ */
@RestController @Controller
@RequestMapping("/admin") @RequestMapping("/admin")
public class AdminHSController extends BaseController { public class AdminHSController {
/** /**
* 日志 * 日志
@ -27,10 +26,7 @@ public class AdminHSController extends BaseController {
private static Logger logger = LogManager.getLogger(HSController.class); private static Logger logger = LogManager.getLogger(HSController.class);
@Resource @Resource
AdminHSService adminhsService; AdminHSService AdminhsService;
@Resource
private IHsWinnersService hsWinnersService;
/** /**
* 获取待审核文章列表 * 获取待审核文章列表
@ -38,9 +34,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/getVerifyList") @PostMapping("/getVerifyList")
@ResponseBody
public Map<String, Object> getVerifyList(@RequestBody Map<String,Object> param){ public Map<String, Object> getVerifyList(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.getVerifyList(param); result = AdminhsService.getVerifyList(param);
return result; return result;
} }
@ -50,9 +47,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/verifyArticle") @PostMapping("/verifyArticle")
@ResponseBody
public Map<String, Object> verifyArticle(@RequestBody Map<String,Object> param){ public Map<String, Object> verifyArticle(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.verifyArticle(param); result = AdminhsService.verifyArticle(param);
return result; return result;
} }
@ -62,30 +60,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/getPersonnelManagement") @PostMapping("/getPersonnelManagement")
@ResponseBody
public Map<String, Object> getPersonnelManagement(@RequestBody Map<String,Object> param){ public Map<String, Object> getPersonnelManagement(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.getPersonnelManagement(param); result = AdminhsService.getPersonnelManagement(param);
return result;
}
/**
* 删除人员信息
*/
@DeleteMapping("/person/{ids}")
public AjaxResult removePerson(@PathVariable String[] ids)
{
return toAjax(adminhsService.deletePersonByIds(ids));
}
/**
* 获取人员详情
* @param param
* @return
*/
@PostMapping("/getPersonInfo")
public Map<String, Object> getPersonInfo(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = adminhsService.getPersonInfo(param);
return result; return result;
} }
@ -95,9 +73,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/peopleManagement") @PostMapping("/peopleManagement")
@ResponseBody
public Map<String, Object> peopleManagement(@RequestBody Map<String,Object> param){ public Map<String, Object> peopleManagement(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.peopleManagement(param); result = AdminhsService.peopleManagement(param);
return result; return result;
} }
@ -107,9 +86,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/getHelpAnswerList") @PostMapping("/getHelpAnswerList")
@ResponseBody
public Map<String, Object> getHelpAnswerList(@RequestBody Map<String,Object> param){ public Map<String, Object> getHelpAnswerList(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.getHelpAnswerList(param); result = AdminhsService.getHelpAnswerList(param);
return result; return result;
} }
@ -119,9 +99,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/answerHelp") @PostMapping("/answerHelp")
@ResponseBody
public Map<String, Object> answerHelp(@RequestBody Map<String,Object> param){ public Map<String, Object> answerHelp(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.answerHelp(param); result = AdminhsService.answerHelp(param);
return result; return result;
} }
@ -131,9 +112,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/getRegisterManagementData") @PostMapping("/getRegisterManagementData")
@ResponseBody
public Map<String, Object> getRegisterManagementData(@RequestBody Map<String,Object> param){ public Map<String, Object> getRegisterManagementData(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.getRegisterManagementData(param); result = AdminhsService.getRegisterManagementData(param);
return result; return result;
} }
@ -143,9 +125,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/passRegister") @PostMapping("/passRegister")
@ResponseBody
public Map<String, Object> passRegister(@RequestBody Map<String,Object> param){ public Map<String, Object> passRegister(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.passRegister(param); result = AdminhsService.passRegister(param);
return result; return result;
} }
@ -155,9 +138,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/getMyPageNumber") @PostMapping("/getMyPageNumber")
@ResponseBody
public Map<String, Object> getMyPageNumber(@RequestBody Map<String,Object> param){ public Map<String, Object> getMyPageNumber(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.getMyPageNumber(param); result = AdminhsService.getMyPageNumber(param);
return result; return result;
} }
@ -167,9 +151,10 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/uploadRotationPhoto") @PostMapping("/uploadRotationPhoto")
@ResponseBody
public Map<String, Object> uploadRotationPhoto(@RequestBody Map<String,Object> param){ public Map<String, Object> uploadRotationPhoto(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.uploadRotationPhoto(param); result = AdminhsService.uploadRotationPhoto(param);
return result; return result;
} }
@ -179,67 +164,11 @@ public class AdminHSController extends BaseController {
* @return * @return
*/ */
@PostMapping("/deleteRotationPhoto") @PostMapping("/deleteRotationPhoto")
@ResponseBody
public Map<String, Object> deleteRotationPhoto(@RequestBody Map<String,Object> param){ public Map<String, Object> deleteRotationPhoto(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
result = adminhsService.deleteRotationPhoto(param); result = AdminhsService.deleteRotationPhoto(param);
return result; return result;
} }
/**
* 查询获奖列表
*/
@GetMapping("/winners/list")
public AjaxResult listWinners(HsWinners hsWinners)
{
List<HsWinners> list = hsWinnersService.selectHsWinnersList(hsWinners);
return AjaxResult.success(list);
}
/**
* 新增获奖
*/
@PostMapping("/winners")
public AjaxResult addWinners(@RequestBody HsWinners hsWinners)
{
return toAjax(hsWinnersService.insertHsWinners(hsWinners));
}
/**
* 修改获奖
*/
@PutMapping("/winners")
public AjaxResult editWinners(@RequestBody HsWinners hsWinners)
{
return toAjax(hsWinnersService.updateHsWinners(hsWinners));
}
/**
* 删除获奖
*/
@DeleteMapping("/winners/{ids}")
public AjaxResult removeWinners(@PathVariable Long[] ids)
{
return toAjax(hsWinnersService.deleteHsWinnersByIds(ids));
}
/**
* 查询班级列表
*/
@PostMapping("/class/list")
public AjaxResult listClass(@RequestBody Map<String, Object> params)
{
List<Map<String, Object>> list = adminhsService.selectClassList(params);
return AjaxResult.success(list);
}
/**
* 查询职务列表
*/
@PostMapping("/post/list")
public AjaxResult listPost(@RequestBody Map<String, Object> params)
{
List<Map<String, Object>> list = adminhsService.selectPostList(params);
return AjaxResult.success(list);
}
} }

View File

@ -1,28 +0,0 @@
package com.qinxx.hslink.controller;
import com.qinxx.hslink.model.base.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* web层通用数据处理
*
* @author ruoyi
*/
public class BaseController
{
protected final Logger logger = LoggerFactory.getLogger(BaseController.class);
/**
* 响应返回结果
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}
}

View File

@ -482,8 +482,11 @@ public class HSController {
* @throws IOException * @throws IOException
*/ */
@RequestMapping("/showImg/{fileName}") @RequestMapping("/showImg/{fileName}")
private void showImg(HttpServletResponse response, @PathVariable(value = "fileName") String fileName) throws IOException { private void responPhoto(HttpServletResponse response, @PathVariable(value = "fileName") String fileName) throws IOException {
String filePath = filesPath + fileName; //Linux环境下的路径
// String filePath = filesPath + "/" + fileName;
//Window环境下的路径
String filePath = filesPath + "\\" + fileName;
File imageFile = new File(filePath); File imageFile = new File(filePath);
if (imageFile.exists()) { if (imageFile.exists()) {
FileInputStream fis = null; FileInputStream fis = null;

View File

@ -94,32 +94,4 @@ public interface AdminHSMapper {
* @return * @return
*/ */
int deleteRotationPhoto(Map<String, Object> param); int deleteRotationPhoto(Map<String, Object> param);
/**
* 获取人员详情
* @param param
* @return
*/
Map<String, Object> getPersonInfo(Map<String, Object> param);
/***
* 删除人员
* @param ids
* @return
*/
int deletePersonByIds(String[] ids);
/**
* 获取班级列表
* @param params
* @return
*/
List<Map<String, Object>> selectClassList(Map<String, Object> params);
/**
* 获取职务列表
* @param params
* @return
*/
List<Map<String, Object>> selectPostList(Map<String, Object> params);
} }

View File

@ -1,55 +0,0 @@
package com.qinxx.hslink.dao;
import com.qinxx.hslink.model.HsWinners;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author by PHY
* @Classname HsWinnersMapper
* @date 2021-06-02 11:42
*/
@Mapper
public interface HsWinnersMapper {
/**
* 查询获奖列表
*
* @param hsWinners 获奖
* @return 获奖集合
*/
public List<HsWinners> selectHsWinnersList(HsWinners hsWinners);
/**
* 新增获奖
*
* @param hsWinners 获奖
* @return 结果
*/
public int insertHsWinners(HsWinners hsWinners);
/**
* 修改获奖
*
* @param hsWinners 获奖
* @return 结果
*/
public int updateHsWinners(HsWinners hsWinners);
/**
* 删除获奖
*
* @param id 获奖ID
* @return 结果
*/
public int deleteHsWinnersById(Long id);
/**
* 批量删除获奖
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteHsWinnersByIds(Long[] ids);
}

View File

@ -64,10 +64,8 @@
<if test="content != '' and content != null"> <if test="content != '' and content != null">
and title like CONCAT('%',#{content},'%') and title like CONCAT('%',#{content},'%')
</if> </if>
<if test="author != '' and author != null">
and u.real_name like CONCAT('%',#{author},'%')
</if>
AND is_pass = '0' AND is_pass = '0'
and type != "班级通知"
ORDER BY release_time desc ORDER BY release_time desc
</select> </select>
@ -78,25 +76,10 @@
(SELECT count(*) from hs_follow f where f.follow_id = u.user_id) fansNumber (SELECT count(*) from hs_follow f where f.follow_id = u.user_id) fansNumber
FROM hs_user u where FROM hs_user u where
u.user_type != "管理员" u.user_type != "管理员"
<if test="name != '' and name != null"> <if test="content != '' and content != null">
and u.real_name like CONCAT('%',#{name},'%') and u.real_name like CONCAT('%',#{name},'%')
</if> </if>
<if test="userType != '' and userType != null"> and u.take_effect = "1" order by u.frozen_state
and u.user_type = #{userType}
</if>
<if test="className != '' and className != null">
and u.class_name = #{className}
</if>
<if test="className == ''">
and (u.class_name = '' or u.class_name is null)
</if>
<if test="takeEffect != '' and takeEffect != null">
and u.take_effect = #{takeEffect}
</if>
<if test="takeEffect == '' or takeEffect == null">
and u.take_effect = '1'
</if>
order by u.frozen_state
</select> </select>
<!--获取帮助答复列表--> <!--获取帮助答复列表-->
@ -124,27 +107,4 @@
select * from hs_user where take_effect = '0' select * from hs_user where take_effect = '0'
</select> </select>
<!--获取人员详情--> </mapper>
<select id="getPersonInfo" resultType="map" parameterType="map">
select * from hs_user where user_id = #{userId}
</select>
<!--获取班级列表-->
<select id="selectClassList" resultType="map" parameterType="map">
select DISTINCT class_name from hs_user
</select>
<!--获取职务列表-->
<select id="selectPostList" resultType="map" parameterType="map">
select DISTINCT post from hs_user where class_name = #{className}
</select>
<!--删除人员信息-->
<delete id="deletePersonByIds" parameterType="String">
delete from hs_user where user_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -10,11 +10,7 @@
<!--注册--> <!--注册-->
<insert id="register" parameterType="map"> <insert id="register" parameterType="map">
INSERT INTO hs_user ( user_id, pass_word,real_name, mobile, user_type, INSERT INTO hs_user ( user_id, pass_word,real_name, mobile, user_type, create_time)
<if test="takeEffect != '' and takeEffect != null">
take_effect,
</if>
create_time)
VALUES VALUES
( (
uuid(), uuid(),
@ -22,9 +18,6 @@
#{realname}, #{realname},
#{mobile}, #{mobile},
#{type}, #{type},
<if test="takeEffect != '' and takeEffect != null">
#{takeEffect},
</if>
now() now()
) )
</insert> </insert>
@ -113,8 +106,6 @@
read_number, read_number,
case when (select count(*) from hs_collection where user_id = #{userId} and article_id = #{id}) > 0 case when (select count(*) from hs_collection where user_id = #{userId} and article_id = #{id}) > 0
then 1 else 0 end isCollection, then 1 else 0 end isCollection,
case when (select count(*) from hs_follow where user_id = '201610060129' and follow_id = author_id) > 0
then 1 else 0 end isFollow,
is_pass is_pass
from hs_notice n left join hs_user u on n.release_id = u.user_id from hs_notice n left join hs_user u on n.release_id = u.user_id
where id = #{id} where id = #{id}
@ -193,11 +184,9 @@
<!--新增一条班级通知--> <!--新增一条班级通知-->
<insert id="addClassNotice" parameterType="map"> <insert id="addClassNotice" parameterType="map">
insert into hs_notice (id,class_id,class_name,label, insert into hs_notice (id,class_id,class_name,label,title,content,release_id,release_time,type)
title,content,release_id,release_time,is_pass,type)
values values
(uuid(),#{classId},#{className},#{label},#{title}, (uuid(),#{classId},#{className},#{label},#{title},#{content},#{releaseId},#{release_time},"班级通知")
#{content},#{releaseId},#{release_time},'1',"班级通知")
</insert> </insert>
<!--获取班级公告--> <!--获取班级公告-->
@ -342,31 +331,10 @@
<!--编辑个人信息--> <!--编辑个人信息-->
<update id="updatePersonalInfo" parameterType="map"> <update id="updatePersonalInfo" parameterType="map">
update hs_user set update hs_user set
<if test="sex != '' and sex != null"> sex = #{sex},
sex = #{sex}, birthday = #{birthday},
</if> address = #{address},
<if test="studentNumber != '' and studentNumber != null"> signature = #{signature}
student_number = #{studentNumber},
</if>
<if test="birthday != '' and birthday != null">
birthday = #{birthday},
</if>
<if test="address != '' and address != null">
address = #{address},
</if>
<if test="signature != '' and signature != null">
signature = #{signature},
</if>
<if test="post != '' and post != null">
post = #{post},
</if>
<if test="className != null">
class_name = #{className},
</if>
<if test="takeEffect != '' and takeEffect != null">
take_effect = #{takeEffect},
</if>
error_times=0
where user_id = #{userId} where user_id = #{userId}
</update> </update>
@ -599,9 +567,6 @@
left join hs_collection c on p.id = c.article_id left join hs_collection c on p.id = c.article_id
WHERE WHERE
c.user_id = #{userId} c.user_id = #{userId}
<if test="text != null and text != ''">
and (title like CONCAT('%',#{text},'%') or content like CONCAT('%',#{text}, '%'))
</if>
AND STATUS = "1" and is_pass ="1" AND STATUS = "1" and is_pass ="1"
ORDER BY ORDER BY
release_time DESC release_time DESC
@ -639,4 +604,4 @@
and is_read = '0' and is_read = '0'
</select> </select>
</mapper> </mapper>

View File

@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.qinxx.hslink.dao.HsWinnersMapper">
<resultMap type="com.qinxx.hslink.model.HsWinners" id="HsWinnersResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="type" column="type" />
<result property="post" column="post" />
<result property="version" column="version" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectHsWinnersVo">
select id, user_id, user_name, type, post, version, create_by, create_time, update_by, update_time, remark from hs_winners
</sql>
<select id="selectHsWinnersList" parameterType="com.qinxx.hslink.model.HsWinners" resultMap="HsWinnersResult">
<include refid="selectHsWinnersVo"/>
<where>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="post != null and post != ''"> and post = #{post}</if>
<if test="version != null and version != ''"> and version = #{version}</if>
</where>
</select>
<insert id="insertHsWinners" parameterType="com.qinxx.hslink.model.HsWinners" useGeneratedKeys="true" keyProperty="id">
insert into hs_winners
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="userName != null">user_name,</if>
<if test="type != null">type,</if>
<if test="post != null">post,</if>
<if test="version != null">version,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="userName != null">#{userName},</if>
<if test="type != null">#{type},</if>
<if test="post != null">#{post},</if>
<if test="version != null">#{version},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateHsWinners" parameterType="com.qinxx.hslink.model.HsWinners">
update hs_winners
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null">user_name = #{userName},</if>
<if test="type != null">type = #{type},</if>
<if test="post != null">post = #{post},</if>
<if test="version != null">version = #{version},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteHsWinnersById" parameterType="Long">
delete from hs_winners where id = #{id}
</delete>
<delete id="deleteHsWinnersByIds" parameterType="String">
delete from hs_winners where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -1,99 +0,0 @@
package com.qinxx.hslink.model;
import com.qinxx.hslink.model.base.BaseEntity;
/**
* @author by PHY
* @Classname HsWinners
* @date 2021-06-02 11:31
*/
public class HsWinners extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 人员id
*/
private String userId;
/** 人员姓名 */
private String userName;
/** 获奖类型 */
private String type;
/** 获奖人职务 */
private String post;
/** 版本号 */
private String version;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(String userId)
{
this.userId = userId;
}
public String getUserId()
{
return userId;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserName()
{
return userName;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setPost(String post)
{
this.post = post;
}
public String getPost()
{
return post;
}
public void setVersion(String version)
{
this.version = version;
}
public String getVersion()
{
return version;
}
@Override
public String toString() {
return "HsWinners{" +
"id=" + id +
", userId='" + userId + '\'' +
", userName='" + userName + '\'' +
", type='" + type + '\'' +
", post='" + post + '\'' +
", version='" + version + '\'' +
'}';
}
}

View File

@ -1,149 +0,0 @@
package com.qinxx.hslink.model.base;
import com.qinxx.hslink.util.HttpStatus;
import com.qinxx.hslink.util.StringUtils;
import java.util.HashMap;
/**
* 操作消息提醒
*
* @author ruoyi
*/
public class AjaxResult extends HashMap<String, Object>
{
private static final long serialVersionUID = 1L;
/** 状态码 */
public static final String CODE_TAG = "code";
/** 返回内容 */
public static final String MSG_TAG = "msg";
/** 数据对象 */
public static final String DATA_TAG = "data";
/**
* 初始化一个新创建的 AjaxResult 对象使其表示一个空消息
*/
public AjaxResult()
{
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
*/
public AjaxResult(int code, String msg)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
}
/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
* @param data 数据对象
*/
public AjaxResult(int code, String msg, Object data)
{
super.put(CODE_TAG, code);
super.put(MSG_TAG, msg);
if (StringUtils.isNotNull(data))
{
super.put(DATA_TAG, data);
}
}
/**
* 返回成功消息
*
* @return 成功消息
*/
public static AjaxResult success()
{
return AjaxResult.success("操作成功");
}
/**
* 返回成功数据
*
* @return 成功消息
*/
public static AjaxResult success(Object data)
{
return AjaxResult.success("操作成功", data);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @return 成功消息
*/
public static AjaxResult success(String msg)
{
return AjaxResult.success(msg, null);
}
/**
* 返回成功消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 成功消息
*/
public static AjaxResult success(String msg, Object data)
{
return new AjaxResult(HttpStatus.SUCCESS, msg, data);
}
/**
* 返回错误消息
*
* @return
*/
public static AjaxResult error()
{
return AjaxResult.error("操作失败");
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult error(String msg)
{
return AjaxResult.error(msg, null);
}
/**
* 返回错误消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static AjaxResult error(String msg, Object data)
{
return new AjaxResult(HttpStatus.ERROR, msg, data);
}
/**
* 返回错误消息
*
* @param code 状态码
* @param msg 返回内容
* @return 警告消息
*/
public static AjaxResult error(int code, String msg)
{
return new AjaxResult(code, msg, null);
}
}

View File

@ -1,115 +0,0 @@
package com.qinxx.hslink.model.base;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* Entity基类
*
* @author ruoyi
*/
public class BaseEntity implements Serializable
{
private static final long serialVersionUID = 1L;
/** 搜索值 */
private String searchValue;
/** 创建者 */
private String createBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/** 更新者 */
private String updateBy;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/** 备注 */
private String remark;
/** 请求参数 */
private Map<String, Object> params;
public String getSearchValue()
{
return searchValue;
}
public void setSearchValue(String searchValue)
{
this.searchValue = searchValue;
}
public String getCreateBy()
{
return createBy;
}
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public String getUpdateBy()
{
return updateBy;
}
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
public Map<String, Object> getParams()
{
if (params == null)
{
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params)
{
this.params = params;
}
}

View File

@ -1,6 +1,5 @@
package com.qinxx.hslink.service; package com.qinxx.hslink.service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -22,13 +21,6 @@ public interface AdminHSService {
*/ */
Map<String, Object> getPersonnelManagement(Map<String, Object> param); Map<String, Object> getPersonnelManagement(Map<String, Object> param);
/**
* 获取人员详情
* @param param
* @return
*/
Map<String, Object> getPersonInfo(Map<String, Object> param);
/** /**
* 审核文章通过/驳回 * 审核文章通过/驳回
* @param param * @param param
@ -91,26 +83,4 @@ public interface AdminHSService {
* @return * @return
*/ */
Map<String, Object> deleteRotationPhoto(Map<String, Object> param); Map<String, Object> deleteRotationPhoto(Map<String, Object> param);
/**
* 删除人员
* @param ids
* @return
*/
int deletePersonByIds(String[] ids);
/**
* 获取班级列表
* @param params
* @return
*/
List<Map<String, Object>> selectClassList(Map<String, Object> params);
/**
* 获取职务列表
* @param params
* @return
*/
List<Map<String, Object>> selectPostList(Map<String, Object> params);
} }

View File

@ -1,53 +0,0 @@
package com.qinxx.hslink.service;
import com.qinxx.hslink.model.HsWinners;
import java.util.List;
/**
* @author by PHY
* @Classname HsWinnersService
* @date 2021-06-02 11:40
*/
public interface IHsWinnersService {
/**
* 查询获奖列表
*
* @param hsWinners 获奖
* @return 获奖集合
*/
public List<HsWinners> selectHsWinnersList(HsWinners hsWinners);
/**
* 新增获奖
*
* @param hsWinners 获奖
* @return 结果
*/
public int insertHsWinners(HsWinners hsWinners);
/**
* 修改获奖
*
* @param hsWinners 获奖
* @return 结果
*/
public int updateHsWinners(HsWinners hsWinners);
/**
* 批量删除获奖
*
* @param ids 需要删除的获奖ID
* @return 结果
*/
public int deleteHsWinnersByIds(Long[] ids);
/**
* 删除获奖信息
*
* @param id 获奖ID
* @return 结果
*/
public int deleteHsWinnersById(Long id);
}

View File

@ -57,20 +57,6 @@ public class AdminHSServiceImpl implements AdminHSService {
return result; return result;
} }
/**
* 获取人员详情
* @param param
* @return
*/
@Override
public Map<String, Object> getPersonInfo(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
Map<String, Object> res = adminHSMapper.getPersonInfo(param);
result.put("data",res);
result.put("success",true);
return result;
}
/** /**
* 审核文章通过/驳回 * 审核文章通过/驳回
* @param param * @param param
@ -217,7 +203,10 @@ public class AdminHSServiceImpl implements AdminHSService {
@Override @Override
public Map<String, Object> deleteRotationPhoto(Map<String, Object> param) { public Map<String, Object> deleteRotationPhoto(Map<String, Object> param) {
int res = 0; int res = 0;
File file = new File(filesPath + param.get("fileEncryption")); //Linux环境下的路径
// File file = new File(filesPath + "/" + param.get("fileEncryption"));
//Window环境下的路径
File file = new File(filesPath + "\\" + param.get("fileEncryption"));
// 路径为文件且不为空则进行删除 // 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) { if (file.isFile() && file.exists()) {
file.delete(); file.delete();
@ -233,36 +222,4 @@ public class AdminHSServiceImpl implements AdminHSService {
result.put("success",true); result.put("success",true);
return result; return result;
} }
/**
* 删除人员信息
*
* @param ids ID
* @return 结果
*/
@Override
public int deletePersonByIds(String[] ids)
{
return adminHSMapper.deletePersonByIds(ids);
}
/**
* 获取班级列表
* @param params
* @return
*/
@Override
public List<Map<String, Object>> selectClassList(Map<String, Object> params) {
return adminHSMapper.selectClassList(params);
}
/**
* 获取职务列表
* @param params
* @return
*/
@Override
public List<Map<String, Object>> selectPostList(Map<String, Object> params) {
return adminHSMapper.selectPostList(params);
}
} }

View File

@ -1,85 +0,0 @@
package com.qinxx.hslink.service.impl;
import com.qinxx.hslink.dao.HsWinnersMapper;
import com.qinxx.hslink.model.HsWinners;
import com.qinxx.hslink.service.IHsWinnersService;
import com.qinxx.hslink.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author by PHY
* @Classname HsWinnersServiceImpl
* @date 2021-06-02 11:40
*/
@Service
public class HsWinnersServiceImpl implements IHsWinnersService {
@Resource
private HsWinnersMapper hsWinnersMapper;
/**
* 查询获奖列表
*
* @param hsWinners 获奖
* @return 获奖
*/
@Override
public List<HsWinners> selectHsWinnersList(HsWinners hsWinners)
{
return hsWinnersMapper.selectHsWinnersList(hsWinners);
}
/**
* 新增获奖
*
* @param hsWinners 获奖
* @return 结果
*/
@Override
public int insertHsWinners(HsWinners hsWinners)
{
hsWinners.setCreateTime(DateUtils.getNowDate());
return hsWinnersMapper.insertHsWinners(hsWinners);
}
/**
* 修改获奖
*
* @param hsWinners 获奖
* @return 结果
*/
@Override
public int updateHsWinners(HsWinners hsWinners)
{
hsWinners.setUpdateTime(DateUtils.getNowDate());
return hsWinnersMapper.updateHsWinners(hsWinners);
}
/**
* 批量删除获奖
*
* @param ids 需要删除的获奖ID
* @return 结果
*/
@Override
public int deleteHsWinnersByIds(Long[] ids)
{
return hsWinnersMapper.deleteHsWinnersByIds(ids);
}
/**
* 删除获奖信息
*
* @param id 获奖ID
* @return 结果
*/
@Override
public int deleteHsWinnersById(Long id)
{
return hsWinnersMapper.deleteHsWinnersById(id);
}
}

View File

@ -1,95 +0,0 @@
package com.qinxx.hslink.util;
/**
* 基础异常
*
* @author ruoyi
*/
public class BaseException extends RuntimeException
{
private static final long serialVersionUID = 1L;
/**
* 所属模块
*/
private String module;
/**
* 错误码
*/
private String code;
/**
* 错误码对应的参数
*/
private Object[] args;
/**
* 错误消息
*/
private String defaultMessage;
public BaseException(String module, String code, Object[] args, String defaultMessage)
{
this.module = module;
this.code = code;
this.args = args;
this.defaultMessage = defaultMessage;
}
public BaseException(String module, String code, Object[] args)
{
this(module, code, args, null);
}
public BaseException(String module, String defaultMessage)
{
this(module, null, null, defaultMessage);
}
public BaseException(String code, Object[] args)
{
this(null, code, args, null);
}
public BaseException(String defaultMessage)
{
this(null, null, null, defaultMessage);
}
@Override
public String getMessage()
{
String message = null;
if (!StringUtils.isEmpty(code))
{
message = MessageUtils.message(code, args);
}
if (message == null)
{
message = defaultMessage;
}
return message;
}
public String getModule()
{
return module;
}
public String getCode()
{
return code;
}
public Object[] getArgs()
{
return args;
}
public String getDefaultMessage()
{
return defaultMessage;
}
}

View File

@ -1,986 +0,0 @@
package com.qinxx.hslink.util;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.text.NumberFormat;
import java.util.Set;
/**
* 类型转换器
*
* @author ruoyi
*/
public class Convert
{
/**
* 转换为字符串<br>
* 如果给定的值为null或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static String toStr(Object value, String defaultValue)
{
if (null == value)
{
return defaultValue;
}
if (value instanceof String)
{
return (String) value;
}
return value.toString();
}
/**
* 转换为字符串<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static String toStr(Object value)
{
return toStr(value, null);
}
/**
* 转换为字符<br>
* 如果给定的值为null或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Character toChar(Object value, Character defaultValue)
{
if (null == value)
{
return defaultValue;
}
if (value instanceof Character)
{
return (Character) value;
}
final String valueStr = toStr(value, null);
return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0);
}
/**
* 转换为字符<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Character toChar(Object value)
{
return toChar(value, null);
}
/**
* 转换为byte<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Byte toByte(Object value, Byte defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Byte)
{
return (Byte) value;
}
if (value instanceof Number)
{
return ((Number) value).byteValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return Byte.parseByte(valueStr);
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为byte<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Byte toByte(Object value)
{
return toByte(value, null);
}
/**
* 转换为Short<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Short toShort(Object value, Short defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Short)
{
return (Short) value;
}
if (value instanceof Number)
{
return ((Number) value).shortValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return Short.parseShort(valueStr.trim());
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为Short<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Short toShort(Object value)
{
return toShort(value, null);
}
/**
* 转换为Number<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Number toNumber(Object value, Number defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Number)
{
return (Number) value;
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return NumberFormat.getInstance().parse(valueStr);
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为Number<br>
* 如果给定的值为空或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Number toNumber(Object value)
{
return toNumber(value, null);
}
/**
* 转换为int<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Integer toInt(Object value, Integer defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Integer)
{
return (Integer) value;
}
if (value instanceof Number)
{
return ((Number) value).intValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return Integer.parseInt(valueStr.trim());
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为int<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Integer toInt(Object value)
{
return toInt(value, null);
}
/**
* 转换为Integer数组<br>
*
* @param str 被转换的值
* @return 结果
*/
public static Integer[] toIntArray(String str)
{
return toIntArray(",", str);
}
/**
* 转换为Long数组<br>
*
* @param str 被转换的值
* @return 结果
*/
public static Long[] toLongArray(String str)
{
return toLongArray(",", str);
}
/**
* 转换为Integer数组<br>
*
* @param split 分隔符
* @param split 被转换的值
* @return 结果
*/
public static Integer[] toIntArray(String split, String str)
{
if (StringUtils.isEmpty(str))
{
return new Integer[] {};
}
String[] arr = str.split(split);
final Integer[] ints = new Integer[arr.length];
for (int i = 0; i < arr.length; i++)
{
final Integer v = toInt(arr[i], 0);
ints[i] = v;
}
return ints;
}
/**
* 转换为Long数组<br>
*
* @param split 分隔符
* @param str 被转换的值
* @return 结果
*/
public static Long[] toLongArray(String split, String str)
{
if (StringUtils.isEmpty(str))
{
return new Long[] {};
}
String[] arr = str.split(split);
final Long[] longs = new Long[arr.length];
for (int i = 0; i < arr.length; i++)
{
final Long v = toLong(arr[i], null);
longs[i] = v;
}
return longs;
}
/**
* 转换为String数组<br>
*
* @param str 被转换的值
* @return 结果
*/
public static String[] toStrArray(String str)
{
return toStrArray(",", str);
}
/**
* 转换为String数组<br>
*
* @param split 分隔符
* @param split 被转换的值
* @return 结果
*/
public static String[] toStrArray(String split, String str)
{
return str.split(split);
}
/**
* 转换为long<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Long toLong(Object value, Long defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Long)
{
return (Long) value;
}
if (value instanceof Number)
{
return ((Number) value).longValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
// 支持科学计数法
return new BigDecimal(valueStr.trim()).longValue();
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为long<br>
* 如果给定的值为<code>null</code>或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Long toLong(Object value)
{
return toLong(value, null);
}
/**
* 转换为double<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Double toDouble(Object value, Double defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Double)
{
return (Double) value;
}
if (value instanceof Number)
{
return ((Number) value).doubleValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
// 支持科学计数法
return new BigDecimal(valueStr.trim()).doubleValue();
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为double<br>
* 如果给定的值为空或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Double toDouble(Object value)
{
return toDouble(value, null);
}
/**
* 转换为Float<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Float toFloat(Object value, Float defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Float)
{
return (Float) value;
}
if (value instanceof Number)
{
return ((Number) value).floatValue();
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return Float.parseFloat(valueStr.trim());
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为Float<br>
* 如果给定的值为空或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Float toFloat(Object value)
{
return toFloat(value, null);
}
/**
* 转换为boolean<br>
* String支持的值为truefalseyesokno1,0 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static Boolean toBool(Object value, Boolean defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof Boolean)
{
return (Boolean) value;
}
String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
valueStr = valueStr.trim().toLowerCase();
switch (valueStr)
{
case "true":
return true;
case "false":
return false;
case "yes":
return true;
case "ok":
return true;
case "no":
return false;
case "1":
return true;
case "0":
return false;
default:
return defaultValue;
}
}
/**
* 转换为boolean<br>
* 如果给定的值为空或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static Boolean toBool(Object value)
{
return toBool(value, null);
}
/**
* 转换为Enum对象<br>
* 如果给定的值为空或者转换失败返回默认值<br>
*
* @param clazz Enum的Class
* @param value
* @param defaultValue 默认值
* @return Enum
*/
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value, E defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (clazz.isAssignableFrom(value.getClass()))
{
@SuppressWarnings("unchecked")
E myE = (E) value;
return myE;
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return Enum.valueOf(clazz, valueStr);
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为Enum对象<br>
* 如果给定的值为空或者转换失败返回默认值<code>null</code><br>
*
* @param clazz Enum的Class
* @param value
* @return Enum
*/
public static <E extends Enum<E>> E toEnum(Class<E> clazz, Object value)
{
return toEnum(clazz, value, null);
}
/**
* 转换为BigInteger<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static BigInteger toBigInteger(Object value, BigInteger defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof BigInteger)
{
return (BigInteger) value;
}
if (value instanceof Long)
{
return BigInteger.valueOf((Long) value);
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return new BigInteger(valueStr);
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为BigInteger<br>
* 如果给定的值为空或者转换失败返回默认值<code>null</code><br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static BigInteger toBigInteger(Object value)
{
return toBigInteger(value, null);
}
/**
* 转换为BigDecimal<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @param defaultValue 转换错误时的默认值
* @return 结果
*/
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
{
if (value == null)
{
return defaultValue;
}
if (value instanceof BigDecimal)
{
return (BigDecimal) value;
}
if (value instanceof Long)
{
return new BigDecimal((Long) value);
}
if (value instanceof Double)
{
return new BigDecimal((Double) value);
}
if (value instanceof Integer)
{
return new BigDecimal((Integer) value);
}
final String valueStr = toStr(value, null);
if (StringUtils.isEmpty(valueStr))
{
return defaultValue;
}
try
{
return new BigDecimal(valueStr);
}
catch (Exception e)
{
return defaultValue;
}
}
/**
* 转换为BigDecimal<br>
* 如果给定的值为空或者转换失败返回默认值<br>
* 转换失败不会报错
*
* @param value 被转换的值
* @return 结果
*/
public static BigDecimal toBigDecimal(Object value)
{
return toBigDecimal(value, null);
}
/**
* 将对象转为字符串<br>
* 1Byte数组和ByteBuffer会被转换为对应字符串的数组 2对象数组会调用Arrays.toString方法
*
* @param obj 对象
* @param charsetName 字符集
* @return 字符串
*/
public static String str(Object obj, String charsetName)
{
return str(obj, Charset.forName(charsetName));
}
/**
* 将对象转为字符串<br>
* 1Byte数组和ByteBuffer会被转换为对应字符串的数组 2对象数组会调用Arrays.toString方法
*
* @param obj 对象
* @param charset 字符集
* @return 字符串
*/
public static String str(Object obj, Charset charset)
{
if (null == obj)
{
return null;
}
if (obj instanceof String)
{
return (String) obj;
}
else if (obj instanceof byte[] || obj instanceof Byte[])
{
return str((Byte[]) obj, charset);
}
else if (obj instanceof ByteBuffer)
{
return str((ByteBuffer) obj, charset);
}
return obj.toString();
}
/**
* 将byte数组转为字符串
*
* @param bytes byte数组
* @param charset 字符集
* @return 字符串
*/
public static String str(byte[] bytes, String charset)
{
return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset));
}
/**
* 解码字节码
*
* @param data 字符串
* @param charset 字符集如果此字段为空则解码的结果取决于平台
* @return 解码后的字符串
*/
public static String str(byte[] data, Charset charset)
{
if (data == null)
{
return null;
}
if (null == charset)
{
return new String(data);
}
return new String(data, charset);
}
/**
* 将编码的byteBuffer数据转换为字符串
*
* @param data 数据
* @param charset 字符集如果为空使用当前系统字符集
* @return 字符串
*/
public static String str(ByteBuffer data, String charset)
{
if (data == null)
{
return null;
}
return str(data, Charset.forName(charset));
}
/**
* 将编码的byteBuffer数据转换为字符串
*
* @param data 数据
* @param charset 字符集如果为空使用当前系统字符集
* @return 字符串
*/
public static String str(ByteBuffer data, Charset charset)
{
if (null == charset)
{
charset = Charset.defaultCharset();
}
return charset.decode(data).toString();
}
// ----------------------------------------------------------------------- 全角半角转换
/**
* 半角转全角
*
* @param input String.
* @return 全角字符串.
*/
public static String toSBC(String input)
{
return toSBC(input, null);
}
/**
* 半角转全角
*
* @param input String
* @param notConvertSet 不替换的字符集合
* @return 全角字符串.
*/
public static String toSBC(String input, Set<Character> notConvertSet)
{
char c[] = input.toCharArray();
for (int i = 0; i < c.length; i++)
{
if (null != notConvertSet && notConvertSet.contains(c[i]))
{
// 跳过不替换的字符
continue;
}
if (c[i] == ' ')
{
c[i] = '\u3000';
}
else if (c[i] < '\177')
{
c[i] = (char) (c[i] + 65248);
}
}
return new String(c);
}
/**
* 全角转半角
*
* @param input String.
* @return 半角字符串
*/
public static String toDBC(String input)
{
return toDBC(input, null);
}
/**
* 替换全角为半角
*
* @param text 文本
* @param notConvertSet 不替换的字符集合
* @return 替换后的字符
*/
public static String toDBC(String text, Set<Character> notConvertSet)
{
char c[] = text.toCharArray();
for (int i = 0; i < c.length; i++)
{
if (null != notConvertSet && notConvertSet.contains(c[i]))
{
// 跳过不替换的字符
continue;
}
if (c[i] == '\u3000')
{
c[i] = ' ';
}
else if (c[i] > '\uFF00' && c[i] < '\uFF5F')
{
c[i] = (char) (c[i] - 65248);
}
}
String returnString = new String(c);
return returnString;
}
/**
* 数字金额大写转换 先写个完整的然后将如零拾替换成零
*
* @param n 数字
* @return 中文大写数字
*/
public static String digitUppercase(double n)
{
String[] fraction = { "", "" };
String[] digit = { "", "", "", "", "", "", "", "", "", "" };
String[][] unit = { { "", "", "亿" }, { "", "", "", "" } };
String head = n < 0 ? "" : "";
n = Math.abs(n);
String s = "";
for (int i = 0; i < fraction.length; i++)
{
s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", "");
}
if (s.length() < 1)
{
s = "";
}
int integerPart = (int) Math.floor(n);
for (int i = 0; i < unit[0].length && integerPart > 0; i++)
{
String p = "";
for (int j = 0; j < unit[1].length && n > 0; j++)
{
p = digit[integerPart % 10] + unit[1][j] + p;
integerPart = integerPart / 10;
}
s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "") + unit[0][i] + s;
}
return head + s.replaceAll("(零.)*零元", "").replaceFirst("(零.)+", "").replaceAll("(零.)+", "").replaceAll("^整$", "零元整");
}
}

View File

@ -1,117 +0,0 @@
package com.qinxx.hslink.util;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 时间工具类
*
* @author ruoyi
*/
public class DateUtils
{
public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public static Date getNowDate()
{
return new Date();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return String
*/
public static String getDate()
{
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime()
{
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow()
{
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow(final String format)
{
return parseDateToStr(format, new Date());
}
public static final String dateTime(final Date date)
{
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr(final String format, final Date date)
{
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime(final String format, final String ts)
{
try
{
return new SimpleDateFormat(format).parse(ts);
}
catch (ParseException e)
{
throw new RuntimeException(e);
}
}
/**
* 获取服务器启动时间
*/
public static Date getServerStartDate()
{
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
/**
* 计算两个时间差
*/
public static String getDatePoor(Date endDate, Date nowDate)
{
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "" + hour + "小时" + min + "分钟";
}
}

View File

@ -1,89 +0,0 @@
package com.qinxx.hslink.util;
/**
* 返回状态码
*
* @author ruoyi
*/
public class HttpStatus
{
/**
* 操作成功
*/
public static final int SUCCESS = 200;
/**
* 对象创建成功
*/
public static final int CREATED = 201;
/**
* 请求已经被接受
*/
public static final int ACCEPTED = 202;
/**
* 操作已经执行成功但是没有返回数据
*/
public static final int NO_CONTENT = 204;
/**
* 资源已被移除
*/
public static final int MOVED_PERM = 301;
/**
* 重定向
*/
public static final int SEE_OTHER = 303;
/**
* 资源没有被修改
*/
public static final int NOT_MODIFIED = 304;
/**
* 参数列表错误缺少格式不匹配
*/
public static final int BAD_REQUEST = 400;
/**
* 未授权
*/
public static final int UNAUTHORIZED = 401;
/**
* 访问受限授权过期
*/
public static final int FORBIDDEN = 403;
/**
* 资源服务未找到
*/
public static final int NOT_FOUND = 404;
/**
* 不允许的http方法
*/
public static final int BAD_METHOD = 405;
/**
* 资源冲突或者资源被锁
*/
public static final int CONFLICT = 409;
/**
* 不支持的数据媒体类型
*/
public static final int UNSUPPORTED_TYPE = 415;
/**
* 系统内部错误
*/
public static final int ERROR = 500;
/**
* 接口未实现
*/
public static final int NOT_IMPLEMENTED = 501;
}

View File

@ -1,25 +0,0 @@
package com.qinxx.hslink.util;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
/**
* 获取i18n资源文件
*
* @author ruoyi
*/
public class MessageUtils
{
/**
* 根据消息键和参数 获取消息 委托给spring messageSource
*
* @param code 消息键
* @param args 参数
* @return 获取国际化翻译值
*/
public static String message(String code, Object... args)
{
MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
}
}

View File

@ -1,70 +0,0 @@
package com.qinxx.hslink.util;
/**
* 分页数据
*
* @author ruoyi
*/
public class PageDomain
{
/** 当前记录起始索引 */
private Integer pageNum;
/** 每页显示记录数 */
private Integer pageSize;
/** 排序列 */
private String orderByColumn;
/** 排序的方向desc或者asc */
private String isAsc = "asc";
public String getOrderBy()
{
if (StringUtils.isEmpty(orderByColumn))
{
return "";
}
return StringUtils.toUnderScoreCase(orderByColumn) + " " + isAsc;
}
public Integer getPageNum()
{
return pageNum;
}
public void setPageNum(Integer pageNum)
{
this.pageNum = pageNum;
}
public Integer getPageSize()
{
return pageSize;
}
public void setPageSize(Integer pageSize)
{
this.pageSize = pageSize;
}
public String getOrderByColumn()
{
return orderByColumn;
}
public void setOrderByColumn(String orderByColumn)
{
this.orderByColumn = orderByColumn;
}
public String getIsAsc()
{
return isAsc;
}
public void setIsAsc(String isAsc)
{
this.isAsc = isAsc;
}
}

View File

@ -1,136 +0,0 @@
package com.qinxx.hslink.util;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
/**
* 客户端工具类
*
* @author ruoyi
*/
public class ServletUtils
{
/**
* 获取String参数
*/
public static String getParameter(String name)
{
return getRequest().getParameter(name);
}
/**
* 获取String参数
*/
public static String getParameter(String name, String defaultValue)
{
return Convert.toStr(getRequest().getParameter(name), defaultValue);
}
/**
* 获取Integer参数
*/
public static Integer getParameterToInt(String name)
{
return Convert.toInt(getRequest().getParameter(name));
}
/**
* 获取Integer参数
*/
public static Integer getParameterToInt(String name, Integer defaultValue)
{
return Convert.toInt(getRequest().getParameter(name), defaultValue);
}
/**
* 获取request
*/
public static HttpServletRequest getRequest()
{
return getRequestAttributes().getRequest();
}
/**
* 获取response
*/
public static HttpServletResponse getResponse()
{
return getRequestAttributes().getResponse();
}
/**
* 获取session
*/
public static HttpSession getSession()
{
return getRequest().getSession();
}
public static ServletRequestAttributes getRequestAttributes()
{
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
return (ServletRequestAttributes) attributes;
}
/**
* 将字符串渲染到客户端
*
* @param response 渲染对象
* @param string 待渲染的字符串
* @return null
*/
public static String renderString(HttpServletResponse response, String string)
{
try
{
response.setStatus(200);
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
response.getWriter().print(string);
}
catch (IOException e)
{
e.printStackTrace();
}
return null;
}
/**
* 是否是Ajax异步请求
*
* @param request
*/
public static boolean isAjaxRequest(HttpServletRequest request)
{
String accept = request.getHeader("accept");
if (accept != null && accept.indexOf("application/json") != -1)
{
return true;
}
String xRequestedWith = request.getHeader("X-Requested-With");
if (xRequestedWith != null && xRequestedWith.indexOf("XMLHttpRequest") != -1)
{
return true;
}
String uri = request.getRequestURI();
if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml"))
{
return true;
}
String ajax = request.getParameter("__ajax");
if (StringUtils.inStringIgnoreCase(ajax, "json", "xml"))
{
return true;
}
return false;
}
}

View File

@ -1,145 +0,0 @@
package com.qinxx.hslink.util;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
/**
* spring工具类 方便在非spring管理环境中获取bean
*
* @author ruoyi
*/
@Component
public final class SpringUtils implements BeanFactoryPostProcessor, ApplicationContextAware
{
/** Spring应用上下文环境 */
private static ConfigurableListableBeanFactory beanFactory;
private static ApplicationContext applicationContext;
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException
{
SpringUtils.beanFactory = beanFactory;
}
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
{
SpringUtils.applicationContext = applicationContext;
}
/**
* 获取对象
*
* @param name
* @return Object 一个以所给名字注册的bean的实例
* @throws org.springframework.beans.BeansException
*
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) throws BeansException
{
return (T) beanFactory.getBean(name);
}
/**
* 获取类型为requiredType的对象
*
* @param clz
* @return
* @throws org.springframework.beans.BeansException
*
*/
public static <T> T getBean(Class<T> clz) throws BeansException
{
T result = (T) beanFactory.getBean(clz);
return result;
}
/**
* 如果BeanFactory包含一个与所给名称匹配的bean定义则返回true
*
* @param name
* @return boolean
*/
public static boolean containsBean(String name)
{
return beanFactory.containsBean(name);
}
/**
* 判断以给定名字注册的bean定义是一个singleton还是一个prototype 如果与给定名字相应的bean定义没有被找到将会抛出一个异常NoSuchBeanDefinitionException
*
* @param name
* @return boolean
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*
*/
public static boolean isSingleton(String name) throws NoSuchBeanDefinitionException
{
return beanFactory.isSingleton(name);
}
/**
* @param name
* @return Class 注册对象的类型
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*
*/
public static Class<?> getType(String name) throws NoSuchBeanDefinitionException
{
return beanFactory.getType(name);
}
/**
* 如果给定的bean名字在bean定义中有别名则返回这些别名
*
* @param name
* @return
* @throws org.springframework.beans.factory.NoSuchBeanDefinitionException
*
*/
public static String[] getAliases(String name) throws NoSuchBeanDefinitionException
{
return beanFactory.getAliases(name);
}
/**
* 获取aop代理对象
*
* @param invoker
* @return
*/
@SuppressWarnings("unchecked")
public static <T> T getAopProxy(T invoker)
{
return (T) AopContext.currentProxy();
}
/**
* 获取当前的环境配置无配置返回null
*
* @return 当前的环境配置
*/
public static String[] getActiveProfiles()
{
return applicationContext.getEnvironment().getActiveProfiles();
}
/**
* 获取当前的环境配置当有多个环境配置时只获取第一个
*
* @return 当前的环境配置
*/
public static String getActiveProfile()
{
final String[] activeProfiles = getActiveProfiles();
return StringUtils.isNotEmpty(activeProfiles) ? activeProfiles[0] : null;
}
}

View File

@ -1,35 +0,0 @@
package com.qinxx.hslink.util;
/**
* sql操作工具类
*
* @author ruoyi
*/
public class SqlUtil
{
/**
* 仅支持字母数字下划线空格逗号小数点支持多个字段排序
*/
public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+";
/**
* 检查字符防止注入绕过
*/
public static String escapeOrderBySql(String value)
{
if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value))
{
throw new BaseException("参数不符合规范,不能进行查询");
}
return value;
}
/**
* 验证 order by 语法是否符合规范
*/
public static boolean isValidOrderBySql(String value)
{
return value.matches(SQL_PATTERN);
}
}

View File

@ -1,413 +0,0 @@
package com.qinxx.hslink.util;
import java.util.*;
/**
* 字符串工具类
*
* @author ruoyi
*/
public class StringUtils
{
/** 空字符串 */
private static final String NULLSTR = "";
/** 下划线 */
private static final char SEPARATOR = '_';
/**
* 获取参数不为空值
*
* @param value defaultValue 要判断的value
* @return value 返回值
*/
public static <T> T nvl(T value, T defaultValue)
{
return value != null ? value : defaultValue;
}
/**
* * 判断一个Collection是否为空 包含ListSetQueue
*
* @param coll 要判断的Collection
* @return true为空 false非空
*/
public static boolean isEmpty(Collection<?> coll)
{
return isNull(coll) || coll.isEmpty();
}
/**
* * 判断一个Collection是否非空包含ListSetQueue
*
* @param coll 要判断的Collection
* @return true非空 false
*/
public static boolean isNotEmpty(Collection<?> coll)
{
return !isEmpty(coll);
}
/**
* * 判断一个对象数组是否为空
*
* @param objects 要判断的对象数组
** @return true为空 false非空
*/
public static boolean isEmpty(Object[] objects)
{
return isNull(objects) || (objects.length == 0);
}
/**
* * 判断一个对象数组是否非空
*
* @param objects 要判断的对象数组
* @return true非空 false
*/
public static boolean isNotEmpty(Object[] objects)
{
return !isEmpty(objects);
}
/**
* * 判断一个Map是否为空
*
* @param map 要判断的Map
* @return true为空 false非空
*/
public static boolean isEmpty(Map<?, ?> map)
{
return isNull(map) || map.isEmpty();
}
/**
* * 判断一个Map是否为空
*
* @param map 要判断的Map
* @return true非空 false
*/
public static boolean isNotEmpty(Map<?, ?> map)
{
return !isEmpty(map);
}
/**
* * 判断一个字符串是否为空串
*
* @param str String
* @return true为空 false非空
*/
public static boolean isEmpty(String str)
{
return isNull(str) || NULLSTR.equals(str.trim());
}
/**
* * 判断一个字符串是否为非空串
*
* @param str String
* @return true非空串 false空串
*/
public static boolean isNotEmpty(String str)
{
return !isEmpty(str);
}
/**
* * 判断一个对象是否为空
*
* @param object Object
* @return true为空 false非空
*/
public static boolean isNull(Object object)
{
return object == null;
}
/**
* * 判断一个对象是否非空
*
* @param object Object
* @return true非空 false
*/
public static boolean isNotNull(Object object)
{
return !isNull(object);
}
/**
* * 判断一个对象是否是数组类型Java基本型别的数组
*
* @param object 对象
* @return true是数组 false不是数组
*/
public static boolean isArray(Object object)
{
return isNotNull(object) && object.getClass().isArray();
}
/**
* 去空格
*/
public static String trim(String str)
{
return (str == null ? "" : str.trim());
}
/**
* 截取字符串
*
* @param str 字符串
* @param start 开始
* @return 结果
*/
public static String substring(final String str, int start)
{
if (str == null)
{
return NULLSTR;
}
if (start < 0)
{
start = str.length() + start;
}
if (start < 0)
{
start = 0;
}
if (start > str.length())
{
return NULLSTR;
}
return str.substring(start);
}
/**
* 截取字符串
*
* @param str 字符串
* @param start 开始
* @param end 结束
* @return 结果
*/
public static String substring(final String str, int start, int end)
{
if (str == null)
{
return NULLSTR;
}
if (end < 0)
{
end = str.length() + end;
}
if (start < 0)
{
start = str.length() + start;
}
if (end > str.length())
{
end = str.length();
}
if (start > end)
{
return NULLSTR;
}
if (start < 0)
{
start = 0;
}
if (end < 0)
{
end = 0;
}
return str.substring(start, end);
}
/**
* 字符串转set
*
* @param str 字符串
* @param sep 分隔符
* @return set集合
*/
public static final Set<String> str2Set(String str, String sep)
{
return new HashSet<String>(str2List(str, sep, true, false));
}
/**
* 字符串转list
*
* @param str 字符串
* @param sep 分隔符
* @param filterBlank 过滤纯空白
* @param trim 去掉首尾空白
* @return list集合
*/
public static final List<String> str2List(String str, String sep, boolean filterBlank, boolean trim)
{
List<String> list = new ArrayList<String>();
if (StringUtils.isEmpty(str))
{
return list;
}
return list;
}
/**
* 下划线转驼峰命名
*/
public static String toUnderScoreCase(String str)
{
if (str == null)
{
return null;
}
StringBuilder sb = new StringBuilder();
// 前置字符是否大写
boolean preCharIsUpperCase = true;
// 当前字符是否大写
boolean curreCharIsUpperCase = true;
// 下一字符是否大写
boolean nexteCharIsUpperCase = true;
for (int i = 0; i < str.length(); i++)
{
char c = str.charAt(i);
if (i > 0)
{
preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1));
}
else
{
preCharIsUpperCase = false;
}
curreCharIsUpperCase = Character.isUpperCase(c);
if (i < (str.length() - 1))
{
nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1));
}
if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase)
{
sb.append(SEPARATOR);
}
else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase)
{
sb.append(SEPARATOR);
}
sb.append(Character.toLowerCase(c));
}
return sb.toString();
}
/**
* 是否包含字符串
*
* @param str 验证字符串
* @param strs 字符串组
* @return 包含返回true
*/
public static boolean inStringIgnoreCase(String str, String... strs)
{
if (str != null && strs != null)
{
for (String s : strs)
{
if (str.equalsIgnoreCase(trim(s)))
{
return true;
}
}
}
return false;
}
/**
* 将下划线大写方式命名的字符串转换为驼峰式如果转换前的下划线大写方式命名的字符串为空则返回空字符串 例如HELLO_WORLD->HelloWorld
*
* @param name 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
*/
public static String convertToCamelCase(String name)
{
StringBuilder result = new StringBuilder();
// 快速检查
if (name == null || name.isEmpty())
{
// 没必要转换
return "";
}
else if (!name.contains("_"))
{
// 不含下划线仅将首字母大写
return name.substring(0, 1).toUpperCase() + name.substring(1);
}
// 用下划线将原始字符串分割
String[] camels = name.split("_");
for (String camel : camels)
{
// 跳过原始字符串中开头结尾的下换线或双重下划线
if (camel.isEmpty())
{
continue;
}
// 首字母大写
result.append(camel.substring(0, 1).toUpperCase());
result.append(camel.substring(1).toLowerCase());
}
return result.toString();
}
/**
* 驼峰式命名法 例如user_name->userName
*/
public static String toCamelCase(String s)
{
if (s == null)
{
return null;
}
s = s.toLowerCase();
StringBuilder sb = new StringBuilder(s.length());
boolean upperCase = false;
for (int i = 0; i < s.length(); i++)
{
char c = s.charAt(i);
if (c == SEPARATOR)
{
upperCase = true;
}
else if (upperCase)
{
sb.append(Character.toUpperCase(c));
upperCase = false;
}
else
{
sb.append(c);
}
}
return sb.toString();
}
@SuppressWarnings("unchecked")
public static <T> T cast(Object obj)
{
return (T) obj;
}
}

View File

@ -1,48 +0,0 @@
package com.qinxx.hslink.util;
/**
* 表格数据处理
*
* @author ruoyi
*/
public class TableSupport
{
/**
* 当前记录起始索引
*/
public static final String PAGE_NUM = "pageNum";
/**
* 每页显示记录数
*/
public static final String PAGE_SIZE = "pageSize";
/**
* 排序列
*/
public static final String ORDER_BY_COLUMN = "orderByColumn";
/**
* 排序的方向 "desc" 或者 "asc".
*/
public static final String IS_ASC = "isAsc";
/**
* 封装分页对象
*/
public static PageDomain getPageDomain()
{
PageDomain pageDomain = new PageDomain();
pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM));
pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
return pageDomain;
}
public static PageDomain buildPageRequest()
{
return getPageDomain();
}
}

View File

@ -1,12 +0,0 @@
##文件保存路径
filePath: ${user.dir}\src\main\static\files\
##数据源
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/hslink?serverTimezone=Hongkong&useUnicode=true&characterEncoding=utf8
username: root
password: 123456
db-name: hslink
filters: log4j,wall,mergeStat
driverClassName: com.mysql.cj.jdbc.Driver

View File

@ -9,7 +9,19 @@ mybatis:
logging: logging:
level: level:
com.qinxx.hslink.dao : debug com.qinxx.hslink.dao : debug
##数据源
spring: spring:
profiles: datasource:
active: dev # url: jdbc:mysql://127.0.0.1:3306/hslink?serverTimezone=Hongkong&useUnicode=true&characterEncoding=utf8
url: jdbc:mysql://106.53.113.158:3306/hslink?serverTimezone=Hongkong&useUnicode=true&characterEncoding=utf8
username: root
password: Beater123
db-name: hslink
filters: log4j,wall,mergeStat
driverClassName: com.mysql.cj.jdbc.Driver
##文件保存路径
# Linux环境下
filePath: /usr/local/src/phy/file
# Window环境下
#filePath: ${user.dir}\src\main\static\files

View File

@ -1,7 +0,0 @@
Spring Boot Version: v2.2.6.RELEASE
__ _______ __ _ __
/ / / / ___// / (_)___ / /__
/ /_/ /\__ \/ / / / __ \/ //_/
/ __ /___/ / /___/ / / / / ,<
/_/ /_//____/_____/_/_/ /_/_/|_|

View File

@ -1,11 +0,0 @@
# 开发环境配置
ENV = 'development'
# 开发环境
VUE_APP_BASE_API = '/dev-api'
# 路由懒加载
VUE_CLI_BABEL_TRANSPILE_MODULES = true
# 后端地址+端口
VUE_APP_BACK = 'http://127.0.0.1:8048'

View File

@ -1,8 +0,0 @@
# 生产环境配置
ENV = 'production'
# 生产环境
VUE_APP_BASE_API = '/prod-api'
# 后端地址+端口
VUE_APP_BACK = 'http://phy0412.top:8862/prod-api'

View File

@ -13,7 +13,7 @@ module.exports = {
proxyTable: {}, proxyTable: {},
// Various Dev Server settings // Various Dev Server settings
host: '127.0.0.1', // can be overwritten by process.env.HOST host: '0.0.0.0', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false, autoOpenBrowser: false,
errorOverlay: true, errorOverlay: true,

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "hslink", "name": "hslink",
"version": "1.0.0", "version": "1.0.0",
"description": "家校通", "description": "A Vue.js project",
"author": "peihaoyu <617594538@qq.com>", "author": "peihaoyu <617594538@qq.com>",
"private": true, "private": true,
"scripts": { "scripts": {
@ -14,7 +14,6 @@
"element-ui": "^2.13.0", "element-ui": "^2.13.0",
"jquery": "^3.4.1", "jquery": "^3.4.1",
"marked": "^0.8.2", "marked": "^0.8.2",
"mavon-editor": "^2.9.1",
"react": "^16.13.1", "react": "^16.13.1",
"vue": "^2.5.2", "vue": "^2.5.2",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",

View File

@ -8,8 +8,8 @@
export default { export default {
name: 'App', name: 'App',
mounted() { mounted() {
const url = `http://pnkx.top:8862/prod-api`; // const url = `http://192.168.10.29:8048`;
// const url = `http://127.0.0.1:8048`; const url = `http://127.0.0.1:8048`;
sessionStorage.setItem('url', url); sessionStorage.setItem('url', url);
} }
} }

View File

@ -1,36 +0,0 @@
import request from '@/util/request'
// 查询获奖列表
export function listWinners(query) {
return request({
url: '/admin/winners/list',
method: 'get',
params: query
})
}
// 新增获奖
export function addWinners(data) {
return request({
url: '/admin/winners',
method: 'post',
data: data
})
}
// 修改获奖
export function updateWinners(data) {
return request({
url: '/admin/winners',
method: 'put',
data: data
})
}
// 删除获奖
export function delWinners(id) {
return request({
url: '/admin/winners/' + id,
method: 'delete'
})
}

View File

@ -47,8 +47,11 @@ function apiAxios (method, url, params, success, failure) {
withCredentials: false withCredentials: false
}) })
.then(function (res) { .then(function (res) {
if (res.data) { console.log("success",res)
success(res.data) if (res.data.success === true) {
if (success) {
success(res.data.data)
}
} else { } else {
if (failure) { if (failure) {
failure(res.data) failure(res.data)

View File

@ -1,46 +0,0 @@
import request from '@/util/request'
// 注册
export function register(query) {
return request({
url: '/hs/register',
method: 'post',
data: query
})
}
// 编辑人员信息
export function editPerson(query) {
return request({
url: '/hs/updatePersonalInfo',
method: 'post',
data: query
})
}
// 删除人员
export function delPerson(id) {
return request({
url: '/admin/person/' + id,
method: 'delete'
})
}
// 获取班级列表
export function getClassList(query) {
return request({
url: '/admin/class/list',
method: 'post',
data: query
})
}
// 获取职务列表
export function getPostList(query) {
return request({
url: '/admin/post/list',
method: 'post',
data: query
})
}

View File

@ -1,12 +0,0 @@
import request from '@/util/request'
// 获取字典列表
export function getDict(query) {
return request({
url: '/hs/getDictionariesData',
method: 'post',
data: {
code: query
}
})
}

View File

@ -53,44 +53,3 @@ body{
body{ body{
padding-right:0 !important padding-right:0 !important
} }
.article-content img {
max-width: 100%;
}
.class-table-box {
width: 50%!important;
overflow: auto;
}
/*滚动条样式*/
::-webkit-scrollbar
{
width: 5px;
}
/*定义滚动条轨道 内阴影+圆角*/
::-webkit-scrollbar-track {
border-radius: 0.5rem;
background-color: rgba(0,0,0,0);
}
/*定义滑块 内阴影+圆角*/
::-webkit-scrollbar-thumb
{
border-radius: 0.5rem;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.4);
background-color: rgba(0,0,0,0.4);
}

View File

@ -9,18 +9,23 @@
</div> </div>
<div class="indexContainer"> <div class="indexContainer">
<div class="maskContainer" v-if="dilogStatus">
<div class="contentContainer">
<div class="closeBtnContainer" @click="closeMaskFn"></div>
<textarea class="showAreaContainer" v-model="msgShow" readonly></textarea>
</div>
</div>
<div class="editorContainer"> <div class="editorContainer">
<mavon-editor <markdown
:placeholder="'开始创作···'" :mdValuesP="msg.mdValue"
:toolbars="toolbars" :fullPageStatusP="false"
:toolbarsBackground="'#f9f9f9'" :editStatusP="true"
@change="change" :previewStatusP="true"
@imgAdd="imgAdd" :navStatusP="true"
@imgDel="imgDel" :icoStatusP="true"
ref="md" @childevent="childEventHandler"
style="height: 50vh" ref="markdown"
v-model="content" ></markdown>
/>
</div> </div>
</div> </div>
<el-button class="" type="primary" @click="publish"> </el-button> <el-button class="" type="primary" @click="publish"> </el-button>
@ -42,44 +47,14 @@
name: "Posting", name: "Posting",
data() { data() {
return { return {
//
toolbars: {
bold: true, //
italic: true, //
header: true, //
underline: true, // 线
strikethrough: true, // 线
mark: true, //
superscript: true, //
subscript: true, //
quote: true, //
ol: true, //
ul: true, //
link: true, //
imagelink: true, //
code: true, // code
table: true, //
fullscreen: false, //
readmodel: false, //
htmlcode: true, // html
help: true, //
/* 1.3.5 */
undo: true, //
redo: true, //
trash: true, //
save: false, // eventssave
navigation: true, //
alignleft: true, //
aligncenter: true, //
alignright: true, //
subfield: true, //
preview: false //
},
label: "", label: "",
title:"", title:"",
type:'', type:'',
content:'', msgShow:'我要显示的内容',
dilogStatus:false, dilogStatus:false,
msg: {
mdValue:''
},
flag:false, flag:false,
} }
}, },
@ -98,36 +73,33 @@
} }
}, },
methods: { methods: {
imgAdd (pos, file) {
// ..
const formData = new FormData();
formData.append('image', file);
this.$ajax.post('https://phy0412.top/prod-api/open/uploadImage', formData, res => {
this.$refs.md.$img2Url(pos, 'https://phy0412.top/prod-api' + res.imgUrl)
})
},
imgDel (pos) {
delete this.img_file[pos]
},
change (value, render) {
this.html = render
},
goBack() { goBack() {
this.$router.back(-1) this.$router.back(-1)
}, },
childEventHandler:function(res){
// resdata,mdValuehtmlValue
this.msg=res;
},
closeMaskFn:function(){
this.msgShow='';
this.dilogStatus=false;
},
handleChange(value) {
console.log(value);
},
publish() { publish() {
if (this.label.length !== 4) { if (this.label.length != 4) {
this.$notify({ this.$message({
message: "文章标签只能为4个汉字", message: "文章标签只能为4个汉字",
type: "warning" type: "warning"
}) })
} else if (this.title === '') { } else if (this.title == '') {
this.$notify({ this.$message({
message: "文章标题不能为空", message: "文章标题不能为空",
type: "warning" type: "warning"
}) })
} else if (this.content === '') { } else if (this.msg.mdValue == '') {
this.$notify({ this.$message({
message: "编辑内容不能为空", message: "编辑内容不能为空",
type: "warning" type: "warning"
}) })
@ -135,12 +107,13 @@
if (sessionStorage.getItem("releaseType") === "classNotice") { if (sessionStorage.getItem("releaseType") === "classNotice") {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.$ajax.post("/hs/addClassNotice",{classId:userInfo.class_id,className:userInfo.class_name, this.$ajax.post("/hs/addClassNotice",{classId:userInfo.class_id,className:userInfo.class_name,
label:this.label,title:this.title,content:this.html,content_md: this.content ,releaseId:userInfo.user_id, label:this.label,title:this.title,content:this.msg.mdValue,releaseId:userInfo.user_id,
release_time:getDate(),type:this.type},r=> { release_time:getDate(),type:this.type},r=> {
if (r.data === 1) { if (r === 1) {
this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{ this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{
console.log(r)
}); });
this.$notify({ this.$message({
message: "发布成功", message: "发布成功",
type: "success" type: "success"
}); });
@ -152,12 +125,13 @@
sessionStorage.setItem("releaseType","") sessionStorage.setItem("releaseType","")
} else { } else {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.$ajax.post("/hs/addArticle",{label:this.label,title:this.title,content:this.html,content_md: this.content,release_id:userInfo.user_id, this.$ajax.post("/hs/addArticle",{label:this.label,title:this.title,content:this.msg.mdValue,release_id:userInfo.user_id,
release_time:getDate(),type:this.type},r=>{ release_time:getDate(),type:this.type},r=>{
if (r.data === 1) { if (r === 1) {
this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{ this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{
console.log(r)
}); });
this.$notify({ this.$message({
message: "发表成功", message: "发表成功",
type: "success" type: "success"
}); });
@ -170,6 +144,9 @@
} }
} }
}, },
components: {
markdown
},
} }
</script> </script>
@ -193,7 +170,7 @@
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.editorContainer{ .editorContainer{
height: fit-content; height: 500px;
} }
.integral img{ .integral img{
display: inline-block; display: inline-block;

View File

@ -16,17 +16,23 @@
</div> </div>
</div> </div>
<div class="middle"> <div class="middle">
<div class="editorContainer article-content" v-html="all.content"></div> <div class="editorContainer">
<markdown
:mdValuesP="msg.mdValue"
:fullPageStatusP="false"
:editStatusP="true"
:previewStatusP="true"
:navStatusP="true"
:icoStatusP="true"
@childevent="childEventHandler"
ref="markdown"
></markdown>
</div>
</div> </div>
<div class="footer"> <div class="footer">
<el-row class="article-read"> <el-row>
<div class="reading-volume"> <el-button type="primary" icon="el-icon-thumb" size="mini" plain @click="follow"> </el-button>
阅读 {{all.read_number}} <el-button type="primary" icon="el-icon-share" size="mini" plain @click="follow"> </el-button>
</div>
<div class="collection" :class="all.isCollection === 0 ? '' : 'collection-active'" @click="collection(all.isCollection)">
<i class="el-icon-star-on"/>
{{all.isCollection === 0 ? '收藏' : '已收藏'}}
</div>
</el-row> </el-row>
</div> </div>
</div> </div>
@ -46,7 +52,7 @@
</div> </div>
</div> </div>
</el-main> </el-main>
<div class="index-right"> <el-aside>
<div class="person-info"> <div class="person-info">
<div class="info"> <div class="info">
<div class="name"> <div class="name">
@ -70,18 +76,19 @@
</div> </div>
<hr> <hr>
<div class="operation"> <div class="operation">
<el-button type="primary" plain size="mini" @click="follow(all.isFollow)">{{all.isFollow === 0 ? ' ' : '取消关注'}}</el-button> <el-button type="primary" plain size="mini" @click="follow"> </el-button>
<el-button type="primary" plain size="mini" @click="sendLetter(all.author_id,all.author_name)"> </el-button> <el-button type="primary" plain size="mini" @click="sendLetter(all.author_id,all.author_name)"> </el-button>
</div> </div>
</div> </div>
<footers/> <footers></footers>
</div> </el-aside>
</el-container> </el-container>
</template> </template>
<script> <script>
import { getDate } from '../assets/js/public.js' import { getDate } from '../assets/js/public.js'
import footers from './components/Footer' import footers from './components/Footer'
import markdown from "./components/Mdeditor";
export default { export default {
name: "Content", name: "Content",
data() { data() {
@ -89,6 +96,11 @@
all: "", all: "",
message: '', message: '',
id:'', id:'',
msgShow:'我要显示的内容',
dilogStatus:false,
msg: {
mdValue:''
},
flag:false, flag:false,
userId: JSON.parse(sessionStorage.getItem("userInfo")).user_id userId: JSON.parse(sessionStorage.getItem("userInfo")).user_id
} }
@ -96,48 +108,20 @@
created() { created() {
}, },
mounted() { mounted() {
this.getNotice() this.$ajax.post("/hs/getOneContent", {
id: sessionStorage.getItem("noticeId")
}, r => {
this.all = r.content;
this.message = r.message;
this.msg.mdValue = r.content.content;
this.all.header_photo = this.all.author_name.substring(0, 1);
for (let i = 0; i < this.message.length; i++) {
this.message[i].header_photo = this.message[i].real_name.substring(0, 1);
}
setTimeout(()=>{this.$refs.markdown.addLine()},1)
})
}, },
methods: { methods: {
/**
* 获取通知
*/
getNotice() {
this.$ajax.post("/hs/getOneContent", {
id: sessionStorage.getItem("noticeId"),
userId: this.userId
}, r => {
this.all = r.data.content;
this.message = r.data.message;
this.all.header_photo = this.all.author_name.substring(0, 1);
for (let i = 0; i < this.message.length; i++) {
this.message[i].header_photo = this.message[i].real_name.substring(0, 1);
}
this.$ajax.post("/hs/updateReadNumber",{
noticeId: sessionStorage.getItem("noticeId"),
number: Number(this.all.read_number)+1
}, res => {
this.all.read_number = Number(this.all.read_number)+1
})
})
},
/**
* 收藏
*/
collection(option) {
const URL = {
"0": "/hs/addCollection",
"1": "/hs/cancelCollection",
};
this.$ajax.post(URL[option],{
noticeId: sessionStorage.getItem("noticeId"),
userId: this.userId,
}, res=>{
if (res.data > 0) {
this.getNotice()
}
})
},
deleteMy(id) { deleteMy(id) {
this.$confirm('确定删除该条留言, 是否继续?', '删除', { this.$confirm('确定删除该条留言, 是否继续?', '删除', {
confirmButtonText: '确定', confirmButtonText: '确定',
@ -145,15 +129,15 @@
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$ajax.post("/hs/deleteOneMessage",{id:id},r=>{ this.$ajax.post("/hs/deleteOneMessage",{id:id},r=>{
if (r.data === 1) { if (r === 1) {
this.$notify({ this.$message({
type: 'success', type: 'success',
message: '删除成功!' message: '删除成功!'
}); });
this.$ajax.post("/hs/getOneContent", { this.$ajax.post("/hs/getOneContent", {
id: sessionStorage.getItem("noticeId") id: sessionStorage.getItem("noticeId")
}, r => { }, r => {
this.message = r.data.message; this.message = r.message;
for (let i = 0; i < this.message.length; i++) { for (let i = 0; i < this.message.length; i++) {
this.message[i].header_photo = this.message[i].real_name.substring(0, 1) this.message[i].header_photo = this.message[i].real_name.substring(0, 1)
} }
@ -161,7 +145,10 @@
} }
}) })
}).catch(() => { }).catch(() => {
this.$notify.info('已取消删除'); this.$message({
type: 'info',
message: '已取消删除'
});
}); });
}, },
sendLetter(id,name) { sendLetter(id,name) {
@ -173,31 +160,26 @@
inputErrorMessage: '内容不能为空' inputErrorMessage: '内容不能为空'
}).then(({ value }) => { }).then(({ value }) => {
this.$ajax.post("/hs/sendLetter",{sendId:userInfo.user_id,receiveId:id,content:value,time:getDate()},r=>{ this.$ajax.post("/hs/sendLetter",{sendId:userInfo.user_id,receiveId:id,content:value,time:getDate()},r=>{
if (r.data === 1) { if (r === 1) {
this.$notify({ this.$message({
type: 'success', type: 'success',
message: '发送成功' message: '发送成功'
}); });
} else { } else {
this.$notify.error("发送失败") this.$message.error("发送失败")
} }
}) })
}).catch(() => { }).catch(() => {
this.$notify.info('取消输入'); this.$message({
type: 'info',
message: '取消输入'
});
}); });
}, },
follow(option) { follow() {
const URL = { this.$message({
0: '/hs/addFollow', type:"success",
1: '/hs/cancelFollow' message: "喜欢就好"
};
this.$ajax.post(URL[option],{
userId: this.userId,
followId: this.all.author_id
}, res => {
if (res.data > 0) {
this.getNotice();
}
}) })
}, },
searchLabel(label) { searchLabel(label) {
@ -224,15 +206,15 @@
}).then(({ value }) => { }).then(({ value }) => {
this.$ajax.post("/hs/addMessage",{noticeId:sessionStorage.getItem("noticeId"),content:value, this.$ajax.post("/hs/addMessage",{noticeId:sessionStorage.getItem("noticeId"),content:value,
createTime:getDate(),userId:JSON.parse(sessionStorage.getItem("userInfo")).user_id},r=>{ createTime:getDate(),userId:JSON.parse(sessionStorage.getItem("userInfo")).user_id},r=>{
if (r.data === 1) { if (r === 1) {
this.$notify({ this.$message({
type: 'success', type: 'success',
message: '留言成功' message: '留言成功'
}); });
this.$ajax.post("/hs/getOneContent", { this.$ajax.post("/hs/getOneContent", {
id: sessionStorage.getItem("noticeId") id: sessionStorage.getItem("noticeId")
}, r => { }, r => {
this.message = r.data.message; this.message = r.message;
for (let i = 0; i < this.message.length; i++) { for (let i = 0; i < this.message.length; i++) {
this.message[i].header_photo = this.message[i].real_name.substring(0, 1) this.message[i].header_photo = this.message[i].real_name.substring(0, 1)
} }
@ -240,8 +222,14 @@
} }
}); });
this.$ajax.post("/hs/timingTask",{userId:JSON.parse(sessionStorage.getItem("userInfo")).user_id},r=>{ this.$ajax.post("/hs/timingTask",{userId:JSON.parse(sessionStorage.getItem("userInfo")).user_id},r=>{
console.log(r)
}); });
}) }).catch(() => {
this.$message({
type: 'info',
message: '取消输入'
});
});
}, },
childEventHandler:function(res){ childEventHandler:function(res){
// resdata,mdValuehtmlValue // resdata,mdValuehtmlValue
@ -252,39 +240,16 @@
this.dilogStatus=false; this.dilogStatus=false;
}, },
handleChange(val) { handleChange(val) {
console.log(val);
}, },
}, },
components: { components: {
footers, footers,
markdown
}, },
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.article-read {
display: flex;
align-items: center;
.reading-volume {
font-size: 0.9rem;
color: #999999;
}
.collection {
margin-left: 1rem;
padding: 0.2rem;
color: #999999;
cursor: pointer;
}
.collection-active {
color: #00afff!important;
}
.collection:hover {
color: #00afff;
}
}
.index-right {
width: 16%;
position: fixed;
right: 5%;
}
.comment-one:hover .delete-my{ .comment-one:hover .delete-my{
display: inline-block; display: inline-block;
} }

View File

@ -10,17 +10,24 @@
</div> </div>
<div class="indexContainer"> <div class="indexContainer">
<mavon-editor <div class="maskContainer" v-if="dilogStatus">
:placeholder="'开始创作···'" <div class="contentContainer">
:toolbars="toolbars" <div class="closeBtnContainer" @click="closeMaskFn"></div>
:toolbarsBackground="'#f9f9f9'" <textarea class="showAreaContainer" v-model="msgShow" readonly></textarea>
@change="change" </div>
@imgAdd="imgAdd" </div>
@imgDel="imgDel" <div class="editorContainer">
ref="md" <markdown
style="height: 70vh" :mdValuesP="msg.mdValue"
v-model="content" :fullPageStatusP="false"
/> :editStatusP="true"
:previewStatusP="true"
:navStatusP="true"
:icoStatusP="true"
@childevent="childEventHandler"
ref="markdown"
></markdown>
</div>
</div> </div>
<el-button class="" type="primary" @click="publish"> </el-button> <el-button class="" type="primary" @click="publish"> </el-button>
<div class="notes"> <div class="notes">
@ -39,100 +46,68 @@
<script> <script>
import {getDate} from "../assets/js/public"; import {getDate} from "../assets/js/public";
import markdown from "./components/Mdeditor";
import footers from "./components/Footer"; import footers from "./components/Footer";
export default { export default {
name: "EditorContent", name: "EditorContent",
data() { data() {
return{ return{
//
toolbars: {
bold: true, //
italic: true, //
header: true, //
underline: true, // 线
strikethrough: true, // 线
mark: true, //
superscript: true, //
subscript: true, //
quote: true, //
ol: true, //
ul: true, //
link: true, //
imagelink: true, //
code: true, // code
table: true, //
fullscreen: false, //
readmodel: false, //
htmlcode: true, // html
help: true, //
/* 1.3.5 */
undo: true, //
redo: true, //
trash: true, //
save: false, // eventssave
navigation: true, //
alignleft: true, //
aligncenter: true, //
alignright: true, //
subfield: true, //
preview: false //
},
label: "", label: "",
title:"", title:"",
type:'', type:'',
content:'', msgShow:'我要显示的内容',
dilogStatus:false, dilogStatus:false,
msg: {
mdValue:''
},
flag:false, flag:false,
} }
}, },
mounted() { mounted() {
this.$ajax.post("/hs/getOneContent",{id:sessionStorage.getItem("noticeId")},r=>{ this.$ajax.post("/hs/getOneContent",{id:sessionStorage.getItem("noticeId")},r=>{
this.label = r.data.content.label; this.label = r.content.label;
this.title = r.data.content. title; this.title = r.content. title;
this.content = r.data.content.content this.msg.mdValue = r. content.content
}) })
}, },
methods: { methods: {
imgAdd (pos, file) {
// ..
const formData = new FormData();
formData.append('image', file);
this.$ajax.post('/open/uploadImage', formData, res => {
this.$refs.md.$img2Url(pos, 'https://phy0412.top' + res.imgUrl)
})
},
imgDel (pos) {
delete this.img_file[pos]
},
change (value, render) {
this.html = render
},
goBack() { goBack() {
this.$router.back(-1) this.$router.back(-1)
}, },
childEventHandler:function(res){
// resdata,mdValuehtmlValue
this.msg=res;
},
closeMaskFn:function(){
this.msgShow='';
this.dilogStatus=false;
},
handleChange(value) {
console.log(value);
},
publish() { publish() {
if (this.label.length !== 4) { if (this.label.length != 4) {
this.$notify({ this.$message({
message: "文章标签只能为4个汉字", message: "文章标签只能为4个汉字",
type: "warning" type: "warning"
}) })
} else if (this.title === '') { } else if (this.title == '') {
this.$notify({ this.$message({
message: "文章标题不能为空", message: "文章标题不能为空",
type: "warning" type: "warning"
}) })
} else if (this.content === '') { } else if (this.msg.mdValue == '') {
this.$notify({ this.$message({
message: "编辑内容不能为空", message: "编辑内容不能为空",
type: "warning" type: "warning"
}) })
} else { } else {
this.$ajax.post("/hs/updateOneContent",{label:this.label,title:this.title, this.$ajax.post("/hs/updateOneContent",{label:this.label,title:this.title,
content:this.html,content_md: this.content ,id:sessionStorage.getItem("noticeId")},r=>{ content:this.msg.mdValue,id:sessionStorage.getItem("noticeId")},r=>{
if (r.data === 1) { if (r === 1) {
this.$notify({ this.$message({
type: "success", type: "success",
message: "编辑成功" message: "编辑成功"
}) })
@ -140,13 +115,14 @@
sessionStorage.setItem("noticeId",sessionStorage.getItem("noticeId"));*/ sessionStorage.setItem("noticeId",sessionStorage.getItem("noticeId"));*/
this.$router.back(-1) this.$router.back(-1)
} else { } else {
this.$notify.error("编辑失败") this.$message.error("编辑失败")
} }
}) })
} }
} }
}, },
components: { components: {
markdown,
footers footers
}, },
} }

View File

@ -53,6 +53,7 @@
}, },
methods:{ methods:{
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event);
} }
}, },
components: { components: {

View File

@ -76,12 +76,10 @@
</div> </div>
<div class="one" v-for="(item, index) in prominentTeacher" :key='index'> <div class="one" v-for="(item, index) in prominentTeacher" :key='index'>
<el-tooltip class="item" effect="light" :content="item.userName" placement="top"> <div class="name theme-font-blue">{{item.name}}老师</div>
<div class="name theme-font-blue">{{item.userName}}老师</div> <!-- <div class="subject theme-font-blue">数学</div>-->
</el-tooltip> <!-- <div class="grade theme-font-blue">2016</div>-->
<el-tooltip class="item" effect="light" :content="item.post" placement="top"> <div class="class theme-font-blue">{{item.class}}</div>
<div class="class theme-font-blue">{{item.post}}</div>
</el-tooltip>
</div> </div>
</div> </div>
<div class="merit-student"> <div class="merit-student">
@ -90,12 +88,9 @@
</div> </div>
<div class="one" v-for="(item, index) in meritStudent" :key='index'> <div class="one" v-for="(item, index) in meritStudent" :key='index'>
<el-tooltip class="item" effect="light" :content="item.userName" placement="top"> <div class="name theme-font-blue">{{item.name}}同学</div>
<div class="name theme-font-blue">{{item.userName}}同学</div> <!-- <div class="grade theme-font-blue">2016</div>-->
</el-tooltip> <div class="subject theme-font-blue">{{item.class}}</div>
<el-tooltip class="item" effect="light" :content="item.post" placement="top">
<div class="class theme-font-blue">{{item.post}}</div>
</el-tooltip>
</div> </div>
</div> </div>
</div> </div>
@ -105,9 +100,7 @@
</template> </template>
<script> <script>
import { listWinners } from "@/api/admin/winners"; export default {
export default {
name: "Hompage", name: "Hompage",
data() { data() {
return{ return{
@ -119,32 +112,67 @@
goodAdvice: '', goodAdvice: '',
magicalThinking: '', magicalThinking: '',
activeName: 'first', activeName: 'first',
prominentTeacher: [], prominentTeacher: [
meritStudent: [], {
id: '',
name: '张伟',
class: '2016届物联网一班',
},
{
id: '',
name: '吕小布',
class: '2016届物联网二班',
},
{
id: '',
name: '李星',
class: '大数据一班',
},
{
id: '',
name: '吴达',
class: '软件外包一班',
},
{
id: '',
name: '田七',
class: '机算计科学与技术一班',
},
],
meritStudent: [
{
id: '',
name: '王阔',
class: '2016届物联网一班',
},
{
id: '',
name: '于洋',
class: '2016届生物医学1班',
},
{
id: '',
name: '冯宇',
class: '2016届大数据一班',
},
{
id: '',
name: '刘强',
class: '2016届软件外包一班',
},
{
id: '',
name: '张智超',
class: '2016届护理一班',
},
],
} }
}, },
mounted() { mounted() {
this.getRotationPhotoList(); this.getRotationPhotoList();
this.getNoticeList(); this.getNoticeList();
this.getWinnerList()
}, },
methods: { methods: {
/**
* 获取获奖人员
*/
getWinnerList() {
listWinners().then(res => {
if (res.data.data.length > 0) {
res.data.data.forEach(item => {
if (item.type === '优秀教师') {
this.prominentTeacher.push(item)
} else if (item.type === '三好学生') {
this.meritStudent.push(item)
}
})
}
})
},
/** /**
* 图片地址 * 图片地址
*/ */
@ -156,15 +184,16 @@
this.tabLoading = true; this.tabLoading = true;
this.$ajax.post("/hs/getAllContent",{},r=>{ this.$ajax.post("/hs/getAllContent",{},r=>{
this.tabLoading = false; this.tabLoading = false;
this.newestNotice = r.data.schoolNoticeList.slice(0,12); this.newestNotice = r.schoolNoticeList.slice(0,12);
this.goodAdvice = r.data.parentAdvice.slice(0,12); this.goodAdvice = r.parentAdvice.slice(0,12);
this.magicalThinking = r.data.studentThinking.slice(0,12); this.magicalThinking = r.studentThinking.slice(0,12);
}) })
}, },
// //
getRotationPhotoList() { getRotationPhotoList() {
this.$ajax.post('/hs/getRotationPhotoList',{},res=>{ this.$ajax.post('/hs/getRotationPhotoList',{},res=>{
this.rotationPhotoList = res.data.rotationPhotoList; console.log("轮播图列表",res);
this.rotationPhotoList = res.rotationPhotoList;
}) })
}, },
searchLabel(label) { searchLabel(label) {
@ -187,7 +216,7 @@
} }
</script> </script>
<style scoped> <style scoped>
.rotation-photo{ .rotation-photo{
object-fit: contain; object-fit: contain;
width: 100%; width: 100%;

View File

@ -18,7 +18,7 @@
<el-divider direction="vertical" v-if="!isLogin"></el-divider> <el-divider direction="vertical" v-if="!isLogin"></el-divider>
<span class="pointer special-font-blue" v-if="isLogin" @click="forget">忘记密码</span> <span class="pointer special-font-blue" v-if="isLogin" @click="forget">忘记密码</span>
<el-divider direction="vertical" v-if="isLogin"></el-divider> <el-divider direction="vertical" v-if="isLogin"></el-divider>
<span class="pointer special-font-blue" @click="goToPage('help')">帮助中心</span> <span class="pointer special-font-blue" @click="help">帮助中心</span>
</div> </div>
</div> </div>
</el-header> </el-header>
@ -27,8 +27,12 @@
<el-menu <el-menu
default-active="1" default-active="1"
class="el-menu-vertical-demo"> class="el-menu-vertical-demo">
<el-menu-item :key="item.index" :index="item.path" @click="goToPage(item.path)" v-for="item in menuList">{{item.name}}</el-menu-item> <el-menu-item index="1" @click="goHomepage">首页</el-menu-item>
<el-menu-item index="100" @click="goMore" disabled>更多···</el-menu-item> <el-menu-item index="2" @click="goSchoolNotice">校园通知</el-menu-item>
<el-menu-item index="3" @click="goMyClass">我的班级</el-menu-item>
<el-menu-item index="4" @click="goParentsOpinion">家长意见</el-menu-item>
<el-menu-item index="5" @click="goStudentThought">学生想法</el-menu-item>
<el-menu-item index="6" @click="goMore" disabled>更多···</el-menu-item>
</el-menu> </el-menu>
</el-aside> </el-aside>
<el-main> <el-main>
@ -50,14 +54,6 @@
real_name: '', real_name: '',
user_type: '', user_type: '',
}, },
//
menuList: [
{name: '首页', path: 'homepage', index: '1'},
{name: '校园通知', path: 'schoolnotice', index: '2'},
{name: '我的班级', path: 'myclass', index: '3'},
{name: '家长意见', path: 'parentsproposal', index: '4'},
{name: '学生想法', path: 'studentthought', index: '5'},
]
} }
}, },
mounted() { mounted() {
@ -65,7 +61,7 @@
/*setInterval(()=>{ /*setInterval(()=>{
this.timingTask(userInfo.user_id) this.timingTask(userInfo.user_id)
},60000);*/ },60000);*/
if (userInfo === '' || userInfo === null) { if (userInfo == '' || userInfo === null) {
} else { } else {
this.isLogin = true; this.isLogin = true;
@ -88,6 +84,7 @@
}, },
timingTask(userId) { timingTask(userId) {
this.$ajax.post("/hs/timingTask",{userId:userId},r=>{ this.$ajax.post("/hs/timingTask",{userId:userId},r=>{
console.log(r)
}) })
}, },
goPersonalInfo(userId) { goPersonalInfo(userId) {
@ -96,22 +93,42 @@
this.$refs.child.getUserInfo(); this.$refs.child.getUserInfo();
}, },
goMore() { goMore() {
this.$notify("期待更多内容",) this.$message({
message:"期待更多内容",
})
}, },
goToPage(path) { goMyClass() {
if (path === 'myclass') { if (JSON.parse(sessionStorage.getItem("userInfo")).class_name === undefined) {
if (JSON.parse(sessionStorage.getItem("userInfo")).class_name === undefined) { this.$message.warning("您没有加入任何班级")
this.$message.warning("您没有加入任何班级")
} else {
this.$router.push({name: path})
}
} else { } else {
this.$router.push({name: path}) if (this.isLogin === true) {
this.$router.push({name: "myclass"})
} else {
this.$message.warning("请先登录")
this.$router.push({name: "login"})
}
} }
}, },
goStudentThought() {
this.$router.push({name: "studentthought"})
},
goParentsOpinion() {
this.$router.push({name: "parentsproposal"})
},
goSchoolNotice() {
this.$router.push({name: "schoolnotice"})
},
goHomepage() {
this.$router.push({name: "homepage"})
},
help() {
this.$router.push({
name: "help",
})
},
forget() { forget() {
this.$notify("请联系管理员重置密码") this.$message("请联系管理员重置密码")
}, },
register() { register() {
this.$router.push({ this.$router.push({
@ -122,10 +139,10 @@
}) })
}, },
opinion() { opinion() {
this.$notify('用户意见请发邮箱至617594538@qq.com') this.$message('用户意见请发邮箱至617594538@qq.com')
}, },
service() { service() {
this.$notify('客服中心请拨打15006732580') this.$message('客服中心请拨打15006732580')
}, },
login() { login() {
this.$router.push({ this.$router.push({
@ -144,7 +161,10 @@
}) })
// location.reload() // location.reload()
}).catch(() => { }).catch(() => {
this.$notify.info('已取消退出'); this.$message({
type: 'info',
message: '已取消退出'
});
}); });
} }
}, },

View File

@ -13,7 +13,7 @@
close-on-click-modal=false close-on-click-modal=false
label-position="left"> label-position="left">
<el-form-item label="角色" prop="role"> <el-form-item label="角色" prop="role">
<el-select v-model="form.role" placeholder="请选择角色"> <el-select v-model="form.role" placeholder="请选择">
<el-option :value="item.dd_detail" v-for="(item,index) in userTypeList" :key="index"></el-option> <el-option :value="item.dd_detail" v-for="(item,index) in userTypeList" :key="index"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
@ -35,7 +35,7 @@
<span style="float: right; color: #8492a6; font-size: 13px" @click="deleteUser(item.username,index)"><i class="el-icon-circle-close"></i></span> <span style="float: right; color: #8492a6; font-size: 13px" @click="deleteUser(item.username,index)"><i class="el-icon-circle-close"></i></span>
</el-option> </el-option>
</el-select>--> </el-select>-->
<el-input v-model="form.username" type="text" placeholder="请输入手机号"></el-input> <el-input v-model="form.username" type="text" placeholder="请输入手机号或姓名"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item label="密码" prop="password">
<el-input v-model="form.password" type="password" placeholder="请输入密码" @keyup.enter.native="login"></el-input> <el-input v-model="form.password" type="password" placeholder="请输入密码" @keyup.enter.native="login"></el-input>
@ -55,22 +55,23 @@
close-on-click-modal=false close-on-click-modal=false
label-position="left"> label-position="left">
<el-form-item label="角色" prop="role"> <el-form-item label="角色" prop="role">
<el-select v-model="form1.role" placeholder="请选择角色"> <el-select v-model="form1.role" placeholder="请选择">
<!-- <el-option value="学生"></el-option>-->
<el-option value="家长"></el-option> <el-option value="家长"></el-option>
<el-option value="教师"></el-option> <el-option value="教师"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="姓名" prop="realName"> <el-form-item label="姓名" prop="realName">
<el-input v-model="form1.realName" placeholder="请输入姓名" type="text"></el-input> <el-input v-model="form1.realName" type="text"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="手机号" prop="mobile"> <el-form-item label="手机号" prop="mobile">
<el-input v-model="form1.mobile" placeholder="请输入手机号" type="text"></el-input> <el-input v-model="form1.mobile" type="text"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="密码" prop="password"> <el-form-item label="密码" prop="password">
<el-input v-model="form1.password" placeholder="请输入密码" type="password"></el-input> <el-input v-model="form1.password" type="password"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="确认密码" prop="againPassword" @keyup.enter.native="register"> <el-form-item label="确认密码" prop="againPassword" @keyup.enter.native="register">
<el-input v-model="form1.againPassword" placeholder="请确认密码" type="password"></el-input> <el-input v-model="form1.againPassword" type="password"></el-input>
</el-form-item> </el-form-item>
<el-button type="primary" @click="register"> </el-button> <el-button type="primary" @click="register"> </el-button>
</el-form> </el-form>
@ -94,7 +95,7 @@
} }
} }
let type; let type;
if (this.$route.params.type === "login" || this.$route.params.type === "register") { if (this.$route.params.type == "login" || this.$route.params.type == "register") {
type = this.$route.params.type type = this.$route.params.type
} else { } else {
type = "login" type = "login"
@ -196,21 +197,19 @@
*/ */
getUserType() { getUserType() {
this.$ajax.post('/hs/getDictionariesData',{code: 'userType'},res => { this.$ajax.post('/hs/getDictionariesData',{code: 'userType'},res => {
this.userTypeList = res.data; console.log('用户类型字典项', res);
this.userTypeList = res;
}) })
}, },
forget() { forget() {
this.$notify("请联系管理员重置密码") this.$message("请联系管理员重置密码")
}, },
login() { login() {
this.loading = true; this.loading = true;
this.$ajax.post("/hs/login",{role:this.form.role,username: this.form.username,password:this.form.password},r=>{ this.$ajax.post("/hs/login",{role:this.form.role,username: this.form.username,password:this.form.password},r=>{
if (r.data === '' || r.data === null) { if (r == '' || r == null) {
this.$notify.error('用户名和密码不匹配'); this.$message.error('用户名和密码不匹配');
} else if (r.data.take_effect === '0') { this.loading = false;
this.$notify.error('该账户未通过审核');
} else if (r.data.frozen_state === '1') {
this.$notify.error('该账户已冻结');
} else { } else {
if (this.form.role === '管理员') { if (this.form.role === '管理员') {
this.$router.push({ this.$router.push({
@ -221,7 +220,7 @@
name: "homepage" name: "homepage"
}) })
} }
this.$notify({ this.$message({
message: "登录成功", message: "登录成功",
type: "success" type: "success"
}); });
@ -250,20 +249,21 @@
sessionStorage.setItem("rememberList",JSON.stringify(rememberList)); sessionStorage.setItem("rememberList",JSON.stringify(rememberList));
} }
}*/ }*/
sessionStorage.setItem("userInfo",JSON.stringify(r.data)); this.loading = false;
sessionStorage.setItem("userInfo",JSON.stringify(r));
// location.reload(); // location.reload();
} }
this.loading = false;
}) })
}, },
register() { register() {
this.$ajax.post("/hs/register",{type:this.form1.role,realname:this.form1.realName,mobile:this.form1.mobile,password:this.form1.password},r=>{ this.$ajax.post("/hs/register",{type:this.form1.role,realname:this.form1.realName,mobile:this.form1.mobile,password:this.form1.password},r=>{
if (r.data === 0) { console.log(r)
this.$notify.error('该手机号已被注册'); if (r == '0') {
this.$message.error('该手机号已被注册');
this.form1.password = ''; this.form1.password = '';
this.form1.againPassword = ''; this.form1.againPassword = '';
} else { } else {
this.$notify({ this.$message({
message: "注册成功", message: "注册成功",
type: "success" type: "success"
}); });

View File

@ -1,15 +1,15 @@
<template> <template>
<el-container> <el-container>
<el-main> <el-main>
<el-page-header @back="goBack" content="发布班级通知" v-if="addClassNotice"/> <el-page-header @back="goBack" content="发布班级通知" v-if="addClassNotice"></el-page-header>
<addArticle <addArticle
v-if="addClassNotice" v-if="addClassNotice"
@editorTitle="editorTitle" @editorTitle="editorTitle"
@goInfo="goInfo" @goInfo="goInfo"
@refresh="refresh" @refresh="refresh"
/> ></addArticle>
<div class="search" v-if="!addClassNotice"> <div class="search" v-if="!addClassNotice">
<el-input class="searchinp" v-model="condition" placeholder="请输入内容" @keydown.enter.native="search"/> <el-input class="searchinp" v-model="condition" placeholder="请输入内容" @keydown.enter.native="search"></el-input>
<el-button type="primary" class="searchbtn" @click="search">搜索</el-button> <el-button type="primary" class="searchbtn" @click="search">搜索</el-button>
</div> </div>
<div class="class-bulletin" v-if="!addClassNotice"> <div class="class-bulletin" v-if="!addClassNotice">
@ -22,23 +22,21 @@
<el-button class="editor" @click="editor">编辑</el-button> <el-button class="editor" @click="editor">编辑</el-button>
</div> </div>
</div> </div>
<div class="list" v-loading="loading"> <div class="list" v-if="!addClassNotice">
<div class="title">班级通知</div> <div class="title">班级通知</div>
<el-button class="releasebut" size="small" @click="release" plain>发布通知</el-button> <el-button class="releasebut" size="small" @click="release" plain>发布通知</el-button>
<nodate v-if="noDate"/> <nodate v-if="noDate"></nodate>
<div class="list-in-box" v-if="!addClassNotice && !noDate"> <div class="one" v-for="item in noticeList" v-if="!noDate">
<div class="one" v-for="item in noticeList"> <div class="type">[{{item.label}}]</div>
<div class="type">[{{item.label}}]</div> <div class="text" @click="getContent(item.id)">{{item.title}}</div>
<div class="text" @click="getContent(item.id)">{{item.title}}</div> <div class="release" @click="goPersonalInfo(item.user_id)">{{item.real_name}}</div>
<div class="release" @click="goPersonalInfo(item.user_id)">{{item.real_name}}</div> <div class="release-time">{{item.release_time}}</div>
<div class="release-time">{{item.release_time}}</div>
</div>
<p class="sum" v-if="!noDate">{{length}}条数据</p>
</div> </div>
<p class="sum" v-if="!noDate">{{length}}条数据</p>
</div> </div>
</el-main> </el-main>
<el-aside> <el-aside>
<div class="title">班级成员 <span v-if="userInfo.post==='班主任'" class="admin" @click="drawer=true">管理</span></div> <div class="title">班级成员</div>
<div class="students"> <div class="students">
<div class="student" v-for="item in students"> <div class="student" v-for="item in students">
<div class="header pointer">{{item.real_name.substring(0,1)}}</div> <div class="header pointer">{{item.real_name.substring(0,1)}}</div>
@ -67,170 +65,19 @@
<el-button type="primary" @click="bulletinSubmit"> </el-button> <el-button type="primary" @click="bulletinSubmit"> </el-button>
</span> </span>
</el-dialog> </el-dialog>
<el-drawer
:title="userInfo.class_name"
:visible.sync="drawer"
custom-class="class-table-box"
direction="ltr">
<div class="class-table" style="padding: 1rem;">
<el-table :data="students">
<el-table-column label="序号" width="80" align="center">
<template slot-scope="scope">
<span>{{scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="学号" align="center">
<template slot-scope="scope">
<span v-if="scope.row.post==='班主任'">{{scope.row.student_number}}</span>
<el-input v-if="scope.row.post!=='班主任'"
size="mini"
@change="editStudentNumber($event, scope.row)"
v-model="scope.row.student_number"
placeholder="请输入学号"/>
</template>
</el-table-column>
<el-table-column label="姓名" align="center" prop="real_name" />
<el-table-column label="职务" align="center" prop="post" >
<template slot-scope="scope">
<span v-if="scope.row.post==='班主任'">{{scope.row.post}}</span>
<el-select v-if="scope.row.post!=='班主任'"
v-model="scope.row.post"
filterable
size="mini"
allow-create
default-first-option
@change="changePost($event, scope.row)"
placeholder="请选择职务">
<el-option
v-for="item in postList"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="display:flex;justify-content: flex-end;margin: 1rem">
<el-button type="primary" @click="addStudent">添加学生</el-button>
</div>
</div>
</el-drawer>
<el-dialog
title="添加学生"
:visible.sync="addStudentFlag"
width="50%">
<div class="student-list">
<div class="button">
<el-button type="primary" @click="registerFlag=true">添加学生</el-button>
</div>
<div class="search">
<el-input v-model="searchCode" placeholder="请输入学生姓名" @change="getNoClassStudent"/>
</div>
<el-table
:data="noClassStudent"
style="width: 100%">
<el-table-column label="姓名" align="center" prop="real_name" />
<el-table-column label="性别" align="center" >
<template slot-scope="scope">
<span>{{scope.row.sex || '未填写'}}</span>
</template>
</el-table-column>
<el-table-column label="年级" align="center" prop="grade" />
<el-table-column label="手机号" align="center" prop="mobile" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleAdd(scope.row)"
>添加</el-button>
</template>
</el-table-column>
</el-table>
</div>
</el-dialog>
<el-dialog
title="学生注册"
:visible.sync="registerFlag"
width="40%">
<el-form :model="registerForm"
:rules="registerRules"
ref="form1"
label-width="80px"
class="demo-ruleForm"
close-on-click-modal=false
label-position="left">
<el-form-item label="姓名" prop="realname">
<el-input v-model="registerForm.realname" type="text"></el-input>
</el-form-item>
<el-form-item label="手机号" prop="mobile">
<el-input v-model="registerForm.mobile" type="text"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="registerStudent"> </el-button>
</span>
</el-dialog>
</el-container> </el-container>
</template> </template>
<script> <script>
import { register, getPostList } from '@/api/index/user' import { getDate } from '../assets/js/public.js'
import nodate from './components/NoData' import nodate from './components/NoData'
import addArticle from './AddArticle' import addArticle from './AddArticle'
export default { export default {
name: "MyClass", name: "MyClass",
data() { data() {
return{// return{
loading: false,
registerForm: {
type: '学生',
realname: '',
mobile: '',
username: '',
password: '123456',
takeEffect: '1'
},
registerRules: {
realname: [
{ required: true, message: '请输入真实姓名', trigger: 'blur' },
{ min: 2, max: 10, message: '请输入正确的姓名', trigger: 'blur' }
],
mobile: [
{ required: true, message: '请输入手机号', trigger: 'blur' },
{ min: 11, max: 11, message: '手机号格式不正确', trigger: 'blur' }
],
},
//
registerFlag: false,
//
searchCode: '',
//
addStudentFlag: false,
//
postList: [
{label: '班长', value: '班长'},
{label: '团支书', value: '团支书'},
{label: '副班长', value: '副班长'},
],
//
drawer: false,
userInfo: JSON.parse(sessionStorage.getItem("userInfo")),
addClassNotice: false, addClassNotice: false,
noDate: false, noDate: false,
condition: '', condition: '',
@ -244,205 +91,43 @@
}, },
noticeList: '', noticeList: '',
length: '', length: '',
students: [], students: '',
//
noClassStudent: [],
isNull: false, isNull: false,
dialogVisible: false, dialogVisible: false,
} }
}, },
mounted() { mounted() {
this.getPostList(); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
this.getPageDate() this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
}, if (r.bulletin == null) {
watch: { this.isNull = true;
addClassNotice(oldValue, newValue) {
if (newValue === true) {
this.getPageDate()
}
}
},
methods: {
/**
* 获取职务列表
*/
getPostList() {
getPostList({className: this.userInfo.class_name}).then(res => {
if (res.data.data.length > 0) {
res.data.data.forEach(item => {
if (!(item.post === '班长' || item.post === '副班长' || item.post === '团支书')) {
this.postList.push({
label: item.post, value: item.post
})
}
})
}
this.postList = this.postList.filter(post => {
return post.label !== '班主任'
});
let obj = {};
this.postList = this.postList.reduce((item, next) => {
if (!obj[next.label]) {
obj[next.label] = item.push(next)
}
return item;
}, [])
})
},
/**
* 注册学生
*/
registerStudent() {
register(this.registerForm).then(res => {
if (res.data.data > 0) {
this.getNoClassStudent();
this.registerForm = {
type: '学生',
realname: '',
mobile: '',
username: '',
password: '123456',
takeEffect: '1'
};
this.registerFlag = false
}
})
},
/**
* 修改学生学号
*/
editStudentNumber(studentNumber, row) {
if (studentNumber === '') {
this.$notify.error('学号不能为空!')
} else { } else {
this.$ajax.post('/hs/updatePersonalInfo', this.bulletin = r.bulletin;
{studentNumber: studentNumber, userId: row.user_id}, res => {
if (res.data > 0) {
this.$notify.success('修改成功');
this.getPageDate()
} else {
this.$notify.error('网络异常,请刷新页面重新尝试')
}
})
} }
}, this.noticeList = r. noticeList;
/** this.length = r. noticeList.length;
* 将学生加入该班级 this.students = r.students;
*/ if (r. noticeList.length === 0) {
handleAdd(row) { this.noDate = true
this.$ajax.post('/hs/updatePersonalInfo', }
{className: this.userInfo.class_name, userId: row.user_id}, res => { })
if (res.data > 0) { },
this.addStudentFlag = false; methods: {
this.$notify.success('添加成功');
this.getPageDate()
} else {
this.$notify.error('网络异常,请刷新页面重新尝试')
}
})
},
/**
* 打开未加入班级学生
*/
addStudent() {
this.addStudentFlag = true;
this.getNoClassStudent();
},
/**
* 获取未加入班级的学生
*/
getNoClassStudent() {
this.$ajax.post('/admin/getPersonnelManagement', {
name: this.searchCode, userType: '学生', className: ''
}, res => {
this.noClassStudent = res.data
})
},
getPageDate() {
this.loading = true;
this.$ajax.post("/hs/getClassInfo",{id:this.userInfo.user_id},r=>{
if (r.data.bulletin == null) {
this.isNull = true;
} else {
this.bulletin = r.data.bulletin;
}
this.noticeList = r.data.noticeList;
this.length = r.data.noticeList.length;
let studentList = r.data.students;
studentList.forEach(item => {
if (item.post === '班主任') {
item.index = 1
} else if (item.post === '班长') {
item.index = 2
} else if (item.post === '团支书') {
item.index = 3
} else if (item.post === '副班长') {
item.index = 4
} else if (item.post === '同学') {
item.index = 6
} else if (item.post === '' || item.post === undefined) {
item.index = 7
} else {
item.index = 5
}
});
this.students = studentList.sort((a, b) => {return a.index - b.index});
if (r.data.noticeList.length === 0) {
this.noDate = true
}
this.loading = false;
})
},
/**
* 改变学生职务
*/
changePost(post, row) {
this.$ajax.post('/hs/updatePersonalInfo',
{post: post, userId: row.user_id}, res => {
if (res.data > 0) {
this.dialogVisible = false;
this.$notify.success('修改成功');
this.getPostList()
} else {
this.$notify.error('网络异常,请刷新页面重新尝试')
}
})
},
/**
* 删除学生信息
*/
handleDelete(row) {
this.$confirm(`确认将${row.real_name}同学移除班级`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$ajax.post('/hs/updatePersonalInfo',
{className: '', userId: row.user_id}, res => {
if (res.data > 0) {
this.getPageDate();
this.$notify.success('删除成功');
} else {
this.$notify.error('网络异常,请刷新页面重新尝试')
}
})
})
},
goBack() { goBack() {
this.addClassNotice = false this.addClassNotice = false
}, },
refresh() { refresh() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{ this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
if (r.data.bulletin == null) { if (r.bulletin == null) {
this.isNull = true; this.isNull = true;
} else { } else {
this.bulletin = r.data.bulletin; this.bulletin = r.bulletin;
} }
this.noticeList = r.data. noticeList; this.noticeList = r. noticeList;
this.length = r.data. noticeList.length; this.length = r. noticeList.length;
this.students = r.data.students; this.students = r.students;
if (r.data.noticeList.length === 0) { if (r. noticeList.length === 0) {
this.noDate = true this.noDate = true
} }
}) })
@ -455,24 +140,25 @@
}, },
release() { release() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
if (userInfo.post === "班主任" || userInfo.post === "班长") { if (userInfo.user_type === "教师") {
this.addClassNotice = true; this.addClassNotice = true
sessionStorage.setItem("releaseType","classNotice") sessionStorage.setItem("releaseType","classNotice")
} else { } else {
this.$notify.error("没有权限发布通知") this.$message.error("没有权限发布通知")
} }
}, },
bulletinSubmit() { bulletinSubmit() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
if (this.isNull === false) { if (this.isNull === false) {
this.$ajax.post("/hs/updateBulletin",{classId:userInfo.class_id, this.$ajax.post("/hs/updateBulletin",{classId:userInfo.class_id,
className:userInfo.class_name,title:this.editors.title,content:this.editors.content,id:this.bulletin.id},r=>{ className:userInfo.class_name,title:this.editors.title,content:this.editors.content,
if (r.data === 1) { releaseTime:getDate(),id:this.bulletin.id},r=>{
if (r === 1) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{ this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
this.bulletin = r.data.bulletin; this.bulletin = r.bulletin;
}) })
this.$notify({ this.$message({
type:'success', type:'success',
message: '编辑公告成功' message: '编辑公告成功'
}) })
@ -482,12 +168,12 @@
this.$ajax.post("/hs/addBulletin",{classId:userInfo.class_id, this.$ajax.post("/hs/addBulletin",{classId:userInfo.class_id,
className:userInfo.class_name,title:this.editors.title,content:this.editors.content, className:userInfo.class_name,title:this.editors.title,content:this.editors.content,
releaseTime:getDate()},r=>{ releaseTime:getDate()},r=>{
if (r.data === 1) { if (r === 1) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{ this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
this.bulletin = r.data.bulletin; this.bulletin = r.bulletin;
}) })
this.$notify({ this.$message({
type:'success', type:'success',
message: '编辑公告成功' message: '编辑公告成功'
}) })
@ -498,20 +184,20 @@
}, },
editor() { editor() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
if (userInfo.user_type === "教师" || userInfo.post === '班主任' || userInfo.post === '班长') { if (userInfo.user_type === "教师") {
this.dialogVisible = true; this.dialogVisible = true;
this.editors.title = this.bulletin.title; this.editors.title = this.bulletin.title;
this.editors.content = this.bulletin.content; this.editors.content = this.bulletin.content;
} else { } else {
this.$notify.error("没有权限编辑公告") this.$message.error("没有权限编辑公告")
} }
}, },
search() { search() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")) let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
sessionStorage.setItem("condition",this.condition) sessionStorage.setItem("condition",this.condition)
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id,text:this.condition},r=>{ this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id,text:this.condition},r=>{
this.noticeList = r.data.noticeList this.noticeList = r. noticeList
this.length = r.data.noticeList.length this.length = r. noticeList.length
}) })
}, },
getContent(id) { getContent(id) {
@ -531,30 +217,7 @@
} }
</script> </script>
<style lang="scss" scoped> <style scoped>
.student-list {
.button {
display: flex;
justify-content: flex-end;
margin-bottom: 1rem;
}
.search {
margin: 0;
}
.one-student {
margin: 1rem;
border-bottom: 1px solid #00afff;
display: flex;
justify-content: space-between;
align-items: center;
color: #4d4d4d;
}
}
.title .admin {
font-size: 0.9rem;
color: #00afff;
cursor: pointer;
}
.el-page-header{ .el-page-header{
padding: 1rem; padding: 1rem;
background: #fff; background: #fff;
@ -584,9 +247,6 @@
padding: 1rem; padding: 1rem;
font-size: 1.5rem; font-size: 1.5rem;
} }
.list {
min-height: 10rem;
}
.list .title{ .list .title{
padding-bottom: 1rem; padding-bottom: 1rem;
font-size: 1.5rem; font-size: 1.5rem;
@ -693,7 +353,6 @@
line-height: 1.5rem; line-height: 1.5rem;
margin-left: 0.5rem; margin-left: 0.5rem;
flex: 1; flex: 1;
white-space: nowrap;
} }
.student .post{ .student .post{
line-height: 1.5rem; line-height: 1.5rem;

View File

@ -7,16 +7,14 @@
</div> </div>
<div class="list"> <div class="list">
<div class="title">家长建议</div> <div class="title">家长建议</div>
<div class="list-box" v-loading="loading"> <nodate v-if="noDate"></nodate>
<nodate v-if="noDate"></nodate> <div class="one" v-for="item in adviceList" v-if="!noDate">
<div class="one" v-for="item in adviceList" v-if="!noDate"> <div class="type">[{{item.label}}]</div>
<div class="type">[{{item.label}}]</div> <div class="text" @click="getContent(item.id)">{{item.title}}</div>
<div class="text" @click="getContent(item.id)">{{item.title}}</div> <div class="release" @click="goPersonalInfo(item.user_id)">{{item.real_name}}</div>
<div class="release" @click="goPersonalInfo(item.user_id)">{{item.real_name}}</div> <div class="release-time">{{item.release_time}}</div>
<div class="release-time">{{item.release_time}}</div>
</div>
<p class="sum" v-if="!noDate">{{length}}条数据</p>
</div> </div>
<p class="sum" v-if="!noDate">{{length}}条数据</p>
</div> </div>
</el-main> </el-main>
<el-aside> <el-aside>
@ -33,8 +31,6 @@
name: "ParentsOpinion", name: "ParentsOpinion",
data() { data() {
return{ return{
//
loading: false,
condition: '', condition: '',
adviceList: '', adviceList: '',
length: '', length: '',
@ -42,22 +38,20 @@
} }
}, },
mounted() { mounted() {
this.loading = true;
this.$ajax.post("/hs/getListByAttribute",{text:"",type:"家长建议"},r=>{ this.$ajax.post("/hs/getListByAttribute",{text:"",type:"家长建议"},r=>{
this.adviceList = r.data this.adviceList = r
this.length = r.data.length this.length = r.length
if (r.data.length === 0) { if (r.length === 0) {
this.noDate = true this.noDate = true
} }
this.loading = false;
}) })
}, },
methods: { methods: {
search() { search() {
this.$ajax.post("/hs/getListByAttribute",{text:this.condition,type:"家长建议"},r=>{ this.$ajax.post("/hs/getListByAttribute",{text:this.condition,type:"家长建议"},r=>{
this.adviceList = r this.adviceList = r
this.length = r.data.length this.length = r.length
if (r.data.length === 0) { if (r.length === 0) {
this.noDate = true this.noDate = true
} }
}) })

File diff suppressed because it is too large Load Diff

View File

@ -52,10 +52,10 @@
mounted() { mounted() {
this.$ajax.post("/hs/getListByAttribute",{type:"校园通知",text:''},r=>{ this.$ajax.post("/hs/getListByAttribute",{type:"校园通知",text:''},r=>{
let list = []; let list = [];
for (let i = 0; i < r.data.length; i++) { for (let i = 0; i < r.length; i++) {
let one = {}; let one = {};
one.date = r.data[i].release_time.substring(0,10); one.date = r[i].release_time.substring(0,10);
one.content = r.data[i].label; one.content = r[i].label;
list.push(one) list.push(one)
} }
this.resDate = list this.resDate = list
@ -76,10 +76,11 @@
}, },
getDay(date) { getDay(date) {
this.dialogVisible = true this.dialogVisible = true
console.log(date)
this.$ajax.post("/hs/getListByAttribute",{release_time: date.day,text: '',type:"校园通知"}, this.$ajax.post("/hs/getListByAttribute",{release_time: date.day,text: '',type:"校园通知"},
r=> { r=> {
this.list = r.data; this.list = r;
this.length = r.data.length; this.length = r.length;
}) })
}, },
dealMyDate(v) { dealMyDate(v) {

View File

@ -7,16 +7,14 @@
</div> </div>
<div class="list"> <div class="list">
<div class="title">学生想法</div> <div class="title">学生想法</div>
<div class="list-box" v-loading="loading"> <nodate v-if="noDate"></nodate>
<nodate v-if="noDate"/> <div class="one" v-for="item in thinkingList" v-if="!noDate">
<div class="one" v-for="item in thinkingList" v-if="!noDate"> <div class="type">[{{item.label}}]</div>
<div class="type">[{{item.label}}]</div> <div class="text" @click="getContent(item.id)">{{item.title}}</div>
<div class="text" @click="getContent(item.id)">{{item.title}}</div> <div class="release" @click="goPersonalInfo(item.user_id)">{{item.real_name}}</div>
<div class="release" @click="goPersonalInfo(item.user_id)">{{item.real_name}}</div> <div class="release-time">{{item.release_time}}</div>
<div class="release-time">{{item.release_time}}</div>
</div>
<p class="sum" v-if="!noDate">{{length}}条数据</p>
</div> </div>
<p class="sum" v-if="!noDate">{{length}}条数据</p>
</div> </div>
</el-main> </el-main>
<el-aside> <el-aside>
@ -33,8 +31,7 @@
name: "StudentThought", name: "StudentThought",
data() { data() {
return{ return{
// noDate: '',
loading: false,
condition: '', condition: '',
thinkingList: '', thinkingList: '',
length: '', length: '',
@ -42,19 +39,17 @@
} }
}, },
mounted() { mounted() {
this.loading = true;
this.$ajax.post("/hs/getListByAttribute",{text:"",type:"学生想法"},r=>{ this.$ajax.post("/hs/getListByAttribute",{text:"",type:"学生想法"},r=>{
this.thinkingList = r.data; this.thinkingList = r
this.length = r.data.length; this.length = r.length
this.loading = false
}) })
}, },
methods: { methods: {
search() { search() {
this.$ajax.post("/hs/getListByAttribute",{text:this.condition,type:"学生想法"},r=>{ this.$ajax.post("/hs/getListByAttribute",{text:this.condition,type:"学生想法"},r=>{
this.thinkingList = r.data this.thinkingList = r
this.length = r.data.length this.length = r.length
if (r.data.length === 0) { if (r.length === 0) {
this.noDate = true this.noDate = true
} }
}) })

View File

@ -1,100 +0,0 @@
<template>
<div :class="{'hidden':hidden}" class="pagination-container">
<el-pagination
:background="background"
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:layout="layout"
:page-sizes="pageSizes"
:total="total"
v-bind="$attrs"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import { scrollTo } from '@/util/scroll-to'
export default {
name: 'Pagination',
props: {
total: {
required: true,
type: Number
},
page: {
type: Number,
default: 1
},
limit: {
type: Number,
default: 20
},
pageSizes: {
type: Array,
default() {
return [10, 20, 30, 50]
}
},
layout: {
type: String,
default: 'total, sizes, prev, pager, next, jumper'
},
background: {
type: Boolean,
default: true
},
autoScroll: {
type: Boolean,
default: true
},
hidden: {
type: Boolean,
default: false
}
},
computed: {
currentPage: {
get() {
return this.page
},
set(val) {
this.$emit('update:page', val)
}
},
pageSize: {
get() {
return this.limit
},
set(val) {
this.$emit('update:limit', val)
}
}
},
methods: {
handleSizeChange(val) {
this.$emit('pagination', { page: this.currentPage, limit: val })
if (this.autoScroll) {
scrollTo(0, 800)
}
},
handleCurrentChange(val) {
this.$emit('pagination', { page: val, limit: this.pageSize })
if (this.autoScroll) {
scrollTo(0, 800)
}
}
}
}
</script>
<style scoped>
.pagination-container {
padding: 32px 16px;
}
.pagination-container.hidden {
display: none;
}
</style>

View File

@ -6,20 +6,15 @@ import 'element-ui/lib/theme-chalk/index.css'
import App from './App' import App from './App'
import router from './router' import router from './router'
import '@/assets/css/public.css' import '@/assets/css/public.css'
// 引用API文件
import api from './api/index.js' import api from './api/index.js'
import axios from 'axios' import axios from 'axios'
import Pagination from "@/components/components/Pagination";
import scroll from 'vue-scroll'
import mavonEditor from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
import { getDict } from '@/api/system/dict'
Vue.prototype.getDict = getDict;
Vue.prototype.$axios = axios; Vue.prototype.$axios = axios;
// 将API方法绑定到全局
import marked from 'marked'
import scroll from 'vue-scroll'
Vue.prototype.$ajax = api; Vue.prototype.$ajax = api;
Vue.component('Pagination', Pagination);
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(mavonEditor);
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(scroll); Vue.use(scroll);
/* eslint-disable no-new */ /* eslint-disable no-new */

View File

@ -1,12 +0,0 @@
import axios from 'axios'
axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
// 创建axios实例
const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: sessionStorage.getItem('url'),
// 超时
timeout: 300000
});
export default service

View File

@ -1,58 +0,0 @@
Math.easeInOutQuad = function(t, b, c, d) {
t /= d / 2
if (t < 1) {
return c / 2 * t * t + b
}
t--
return -c / 2 * (t * (t - 2) - 1) + b
}
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
var requestAnimFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
})()
/**
* Because it's so fucking difficult to detect the scrolling element, just move them all
* @param {number} amount
*/
function move(amount) {
document.documentElement.scrollTop = amount
document.body.parentNode.scrollTop = amount
document.body.scrollTop = amount
}
function position() {
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
}
/**
* @param {number} to
* @param {number} duration
* @param {Function} callback
*/
export function scrollTo(to, duration, callback) {
const start = position()
const change = to - start
const increment = 20
let currentTime = 0
duration = (typeof (duration) === 'undefined') ? 500 : duration
var animateScroll = function() {
// increment the time
currentTime += increment
// find the value with the quadratic in-out easing function
var val = Math.easeInOutQuad(currentTime, start, change, duration)
// move the document.body
move(val)
// do the animation unless its over
if (currentTime < duration) {
requestAnimFrame(animateScroll)
} else {
if (callback && typeof (callback) === 'function') {
// the animation is done so lets callback
callback()
}
}
}
animateScroll()
}

View File

@ -88,6 +88,7 @@
}, },
timingTask(userId) { timingTask(userId) {
this.$ajax.post("/hs/timingTask",{userId:userId},r=>{ this.$ajax.post("/hs/timingTask",{userId:userId},r=>{
console.log(r)
}) })
}, },
goPersonalInfo(userId) { goPersonalInfo(userId) {
@ -96,7 +97,9 @@
this.$refs.child.getUserInfo(); this.$refs.child.getUserInfo();
}, },
goMore() { goMore() {
this.$notify.info("期待更多内容") this.$message({
message:"期待更多内容",
})
}, },
help() { help() {
@ -105,7 +108,7 @@
}) })
}, },
forget() { forget() {
this.$notify.info("请联系管理员重置密码") this.$message("请联系管理员重置密码")
}, },
register() { register() {
this.$router.push({ this.$router.push({
@ -116,10 +119,10 @@
}) })
}, },
opinion() { opinion() {
this.$notify.info('用户意见请发邮箱至617594538@qq.com') this.$message('用户意见请发邮箱至617594538@qq.com')
}, },
service() { service() {
this.$notify.info('客服中心请拨打15006732580') this.$message('客服中心请拨打15006732580')
}, },
login() { login() {
this.$router.push({ this.$router.push({
@ -138,7 +141,7 @@
}) })
// location.reload() // location.reload()
}).catch(() => { }).catch(() => {
this.$notify({ this.$message({
type: 'info', type: 'info',
message: '已取消退出' message: '已取消退出'
}); });

View File

@ -1,57 +1,33 @@
<template> <template>
<div class="page"> <div class="page">
<div class="top"> <div class="top">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="6rem">
<el-form-item label="文章标题">
<el-input
v-model="queryParams.content"
placeholder="请输入文章标题"
clearable
size="small"
@keyup.enter.native="getVerifyList"
/>
</el-form-item>
<el-form-item label="作者姓名">
<el-input
v-model="queryParams.author"
placeholder="请输入作者姓名"
clearable
size="small"
@keyup.enter.native="getVerifyList"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getVerifyList">搜索</el-button>
</el-form-item>
</el-form>
</div> </div>
<div class="list-box" v-loading="loading"> <no-date v-if="noDate"></no-date>
<no-date v-if="noDate"/> <div class="table" v-if="!noDate">
<div class="table" v-if="!noDate"> <div class="table-header">
<div class="table-header"> <div class="index box">序号</div>
<div class="index box">序号</div> <div class="article-name box">文章名称</div>
<div class="article-name box">文章名称</div> <div class="article-type box">文章类型</div>
<div class="article-type box">文章类型</div> <div class="article-label box">文章标签</div>
<div class="article-label box">文章标签</div> <div class="author box">发表人</div>
<div class="author box">发表人</div> <div class="time box">发表时间</div>
<div class="time box">发表时间</div> <div class="function box">操作</div>
<div class="function box">操作</div> </div>
</div> <div class="table-content">
<div class="table-content"> <div class="one-data" v-for="(article, index) in articleList" :key="index">
<div class="one-data" v-for="(article, index) in articleList" :key="index"> <div class="index box">{{index+1}}</div>
<div class="index box">{{index+1}}</div> <div class="article-name box theme-font-blue special-text" @click="getContent(article.articleId)">{{article.title}}</div>
<div class="article-name box theme-font-blue special-text" @click="getContent(article.articleId)">{{article.title}}</div> <div class="article-type box theme-font-blue special-text" @click="searchLabel(article.type)">{{article.type}}</div>
<div class="article-type box theme-font-blue special-text" @click="searchLabel(article.type)">{{article.type}}</div> <div class="article-label box theme-font-blue special-text" @click="searchLabel(article.label)">{{article.label}}</div>
<div class="article-label box theme-font-blue special-text" @click="searchLabel(article.label)">{{article.label}}</div> <div class="author box theme-font-blue special-text" @click="goPersonalInfo(article.releaseId)">{{article.releaseName}}</div>
<div class="author box theme-font-blue special-text" @click="goPersonalInfo(article.releaseId)">{{article.releaseName}}</div> <div class="time box">{{article.releaseTime}}</div>
<div class="time box">{{article.releaseTime}}</div> <div class="function box">
<div class="function box"> <el-button type="success" size='mini' @click="verifyArticle(article, '1')">通过</el-button>
<el-button type="success" size='mini' @click="verifyArticle(article, '1')">通过</el-button> <el-button type="danger" size='mini' @click="verifyArticle(article, '2')">驳回</el-button>
<el-button type="danger" size='mini' @click="verifyArticle(article, '2')">驳回</el-button>
</div>
</div> </div>
<div class="number">{{articleList.length}}条数据</div>
</div> </div>
<div class="number">{{articleList.length}}条数据</div>
</div> </div>
</div> </div>
</div> </div>
@ -65,13 +41,6 @@
}, },
data() { data() {
return { return {
//
queryParams: {
content: '',
author: ''
},
//
loading: false,
// //
articleList: [], articleList: [],
// //
@ -100,8 +69,9 @@
articleId: item.articleId, articleId: item.articleId,
operating: operating operating: operating
}, res => { }, res => {
if (res.data > 0) { console.log("审核结果", res);
this.$notify({ if (res > 0) {
this.$message({
type: 'success', type: 'success',
message: `${OPERATING[operating]}成功` message: `${OPERATING[operating]}成功`
}); });
@ -109,7 +79,10 @@
_this.getVerifyList(); _this.getVerifyList();
}, 1000) }, 1000)
} else { } else {
this.$notify.error('服务器出小差了,请稍后再试'); this.$message({
type: 'error',
message: '服务器出小差了,请稍后再试'
});
} }
}) })
}) })
@ -118,15 +91,14 @@
* 获取待审核文章列表 * 获取待审核文章列表
*/ */
getVerifyList() { getVerifyList() {
this.loading = true; this.$ajax.post('/admin/getVerifyList', {}, res => {
this.$ajax.post('/admin/getVerifyList', this.queryParams, res => { console.log('待审核文章列表', res);
if (res.data.length > 0) { if (res.length > 0) {
this.noDate = false; this.noDate = false;
this.articleList = res.data; this.articleList = res;
} else { } else {
this.noDate = true; this.noDate = true;
} }
this.loading = false
}) })
}, },
/** /**

View File

@ -32,8 +32,9 @@
* 切换tab * 切换tab
*/ */
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event);
}, },
} }
} }
</script> </script>

View File

@ -53,12 +53,13 @@
*/ */
getHelpAnswerList() { getHelpAnswerList() {
this.$ajax.post('/admin/getHelpAnswerList', {}, res => { this.$ajax.post('/admin/getHelpAnswerList', {}, res => {
res.data.forEach(item => { res.forEach(item => {
if (item.answer_id !== undefined) { if (item.answer_id !== undefined) {
this.historyHelpList.push(item); this.historyHelpList.push(item);
} }
this.historyHelpNoData = this.historyHelpList.length === 0 ? true : false; this.historyHelpNoData = this.historyHelpList.length === 0 ? true : false;
}); });
console.log('历史帮助答复列表', this.historyHelpList);
}) })
} }
} }

View File

@ -49,13 +49,14 @@
answerId: userInfo.user_id, answerId: userInfo.user_id,
answer: value, answer: value,
id: help.id}, res => { id: help.id}, res => {
if (res.data === 1) { console.log('帮助解决', res);
this.$notify({ if (res === 1) {
this.$message({
type: 'success', type: 'success',
message: '提交成功' message: '提交成功'
}); });
} else { } else {
this.$notify.error("提交失败") this.$message.error("提交失败")
} }
}) })
}) })
@ -72,12 +73,13 @@
*/ */
getHelpAnswerList() { getHelpAnswerList() {
this.$ajax.post('/admin/getHelpAnswerList', {}, res => { this.$ajax.post('/admin/getHelpAnswerList', {}, res => {
res.data.forEach(item => { res.forEach(item => {
if (item.answer_id === undefined) { if (item.answer_id === undefined) {
this.notHelpList.push(item); this.notHelpList.push(item);
} }
this.notHelpNoData = this.notHelpList.length === 0 ? true : false; this.notHelpNoData = this.notHelpList.length === 0 ? true : false;
}); });
console.log('未帮助答复列表', this.notHelpList);
}) })
} }
} }

View File

@ -5,7 +5,6 @@
<rotation-photo-management></rotation-photo-management> <rotation-photo-management></rotation-photo-management>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="版块管理" name="2"> <el-tab-pane label="版块管理" name="2">
<plate-management></plate-management>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>
@ -13,11 +12,9 @@
<script> <script>
import rotationPhotoManagement from '@/view/admin/homepageManagement/homepageManagement/RotationPhotoManagement'; import rotationPhotoManagement from '@/view/admin/homepageManagement/homepageManagement/RotationPhotoManagement';
import plateManagement from '@/view/admin/homepageManagement/plateManagement/PlateManagement.vue';
export default { export default {
components: { components: {
rotationPhotoManagement, rotationPhotoManagement
plateManagement
}, },
name: "HomepageManagement", name: "HomepageManagement",
data() { data() {
@ -32,8 +29,9 @@
* 切换tab * 切换tab
*/ */
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event);
}, },
} }
} }
</script> </script>

View File

@ -1,12 +1,13 @@
<template> <template>
<div> <div>
<div class="img-list" v-loading="loading"> <div class="title">轮播图管理</div>
<div class="img-list">
<div class="img" v-for="(img, index) in rotationPhotoList" :key='index'> <div class="img" v-for="(img, index) in rotationPhotoList" :key='index'>
<el-image class="rotation-photo" <el-image class="rotation-photo"
:src='imgPath(img)' :src='imgPath(img)'
:preview-src-list="srcList" :preview-src-list="srcList"
fit='scale-down'/> fit='scale-down'></el-image>
<i class="el-icon-circle-close delete-icon pointer" @click="deleteImg(img)"/> <i class="el-icon-circle-close delete-icon pointer" @click="deleteImg(img)"></i>
</div> </div>
<el-upload <el-upload
class="upload-demo" class="upload-demo"
@ -16,9 +17,10 @@
:on-success='success' :on-success='success'
:on-error='error'> :on-error='error'>
<div class="add-img pointer"> <div class="add-img pointer">
<i class="el-icon-plus"/> <i class="el-icon-plus"></i>
</div> </div>
</el-upload> </el-upload>
</div> </div>
</div> </div>
</template> </template>
@ -27,8 +29,6 @@
export default { export default {
data() { data() {
return{ return{
//
loading: false,
// //
rotationPhotoList: [], rotationPhotoList: [],
//URL //URL
@ -45,24 +45,31 @@
* 上传图片成功 * 上传图片成功
*/ */
success(response, file, fileList) { success(response, file, fileList) {
console.log('上传图片', response);
this.$ajax.post('/admin/uploadRotationPhoto', {fileId: response.fileInfo.id}, res => { this.$ajax.post('/admin/uploadRotationPhoto', {fileId: response.fileInfo.id}, res => {
if (res.data === 1) { if (res === 1) {
this.$notify({ this.$message({
type: 'success', type: 'success',
message: '上传成功' message: '上传成功'
}) })
this.getRotationPhotoList(); this.getRotationPhotoList();
} else { } else {
this.$notify.error('网络异常,请稍后再试') this.$message({
type: 'error',
message: '网络异常,请稍后再试'
})
} }
}) })
}, },
/** /**
* 上传图片失败 * 上传图片失败
*/ */
error() { error() {
this.$notify.error('网络异常,请稍后再试') this.$message({
type: 'error',
message: '网络异常,请稍后再试'
})
}, },
/** /**
* 删除图片 * 删除图片
@ -72,14 +79,17 @@
id: img.id, id: img.id,
fileEncryption: img.fileEncryption fileEncryption: img.fileEncryption
}, res => { }, res => {
if (res.data === 1) { if (res === 1) {
this.$notify({ this.$message({
type: 'success', type: 'success',
message: '删除成功' message: '删除成功'
}) })
this.getRotationPhotoList(); this.getRotationPhotoList();
} else { } else {
this.$notify.error('网络异常,请稍后再试') this.$message({
type: 'error',
message: '网络异常,请稍后再试'
})
} }
}) })
}, },
@ -91,15 +101,14 @@
}, },
// //
getRotationPhotoList() { getRotationPhotoList() {
this.loading = true;
this.$ajax.post('/hs/getRotationPhotoList',{},res=>{ this.$ajax.post('/hs/getRotationPhotoList',{},res=>{
if (res.data.rotationPhotoList.length > 0) { console.log("轮播图列表",res);
this.rotationPhotoList = res.data.rotationPhotoList; if (res.rotationPhotoList.length > 0) {
res.data.rotationPhotoList.forEach(img => { this.rotationPhotoList = res.rotationPhotoList;
res.rotationPhotoList.forEach(img => {
this.srcList.push(`${sessionStorage.getItem('url')}/hs/showImg/${img.fileEncryption}`) this.srcList.push(`${sessionStorage.getItem('url')}/hs/showImg/${img.fileEncryption}`)
}); });
} }
this.loading = false
}) })
}, },
} }

View File

@ -1,241 +0,0 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="6rem">
<el-form-item label="获奖人员姓名" prop="userName">
<el-input
v-model="queryParams.userName"
placeholder="请输入获奖人员姓名"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="获奖类型" prop="type">
<el-select v-model="queryParams.type" placeholder="请选择获奖类型" clearable size="small">
<el-option v-for="item in winnerTypeList"
:label="item.dd_detail"
:key="item.id"
:value="item.dd_detail" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" :data="winnersList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="人员姓名" align="center" prop="userName" />
<el-table-column label="获奖类型" align="center" prop="type" />
<el-table-column label="获奖人职务" align="center" prop="post" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<!-- 添加或修改获奖对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="6rem">
<el-form-item label="获奖人员姓名" prop="userName">
<el-input v-model="form.userName" placeholder="请输入人员姓名" />
</el-form-item>
<el-form-item label="获奖类型" prop="type">
<el-select v-model="form.type" placeholder="请选择获奖类型">
<el-option v-for="item in winnerTypeList"
:label="item.dd_detail"
:key="item.id"
:value="item.dd_detail" />
</el-select>
</el-form-item>
<el-form-item label="获奖人职务" prop="post">
<el-input v-model="form.post" placeholder="请输入获奖人职务" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWinners, delWinners, addWinners, updateWinners } from "@/api/admin/winners";
export default {
name: "PlateManagement",
data() {
return {
//
winnerTypeList: [],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
winnersList: [],
//
title: "",
//
open: false,
//
queryParams: {
userName: null,
type: null,
},
//
form: {},
//
rules: {
}
};
},
created() {
this.getList();
this.getDict('WinnerType').then(res => {
this.winnerTypeList = res.data.data;
})
},
methods: {
/** 查询获奖列表 */
getList() {
this.loading = true;
listWinners(this.queryParams).then(response => {
this.winnersList = response.data.data;
this.total = response.data.data.length;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
userId: null,
userName: null,
type: null,
post: null,
version: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
remark: null
};
},
/** 搜索按钮操作 */
handleQuery() {
this.getList();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加获奖";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
listWinners({id: row.id}).then(response => {
this.form = response.data.data[0];
this.open = true;
this.title = "修改获奖";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateWinners(this.form).then(response => {
this.$notify.success("修改成功");
this.open = false;
this.getList();
});
} else {
addWinners(this.form).then(response => {
this.$notify.success("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(`是否确认删除${row.userName}的获奖信息`, "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delWinners(ids);
}).then(() => {
this.getList();
this.$notify.success("删除成功");
})
},
}
}
</script>
<style lang='scss' scoped>
</style>

View File

@ -27,6 +27,7 @@
}, },
methods: { methods: {
handleClick(tab, event) { handleClick(tab, event) {
console.log(tab, event);
} }
} }
} }

View File

@ -1,132 +1,38 @@
<template> <template>
<div class="page"> <div class="page">
<div class="top"> <div class="top">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="6rem">
<el-form-item label="人员姓名">
<el-input
v-model="queryParams.name"
placeholder="请输入人员姓名"
clearable
size="small"
@keyup.enter.native="getFollowPeopleList"
/>
</el-form-item>
<el-form-item label="人员类型">
<el-select v-model="queryParams.userType" placeholder="请选择人员类型" clearable size="small">
<el-option
v-for="dict in userTypeList"
:key="dict.id"
:label="dict.dd_detail"
:value="dict.dd_detail"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getFollowPeopleList">搜索</el-button>
</el-form-item>
</el-form>
</div> </div>
<div class="list-box" v-loading="loading"> <no-date v-if="noDate"></no-date>
<no-date v-if="noDate"/> <div class="table" v-if="!noDate">
<div class="table" v-if="!noDate"> <div class="table-header">
<div class="table-header"> <div class="index box">序号</div>
<div class="index box">序号</div> <div class="article-name box">人员名称</div>
<div class="article-name box">人员姓名</div> <div class="article-type box">人员类型</div>
<div class="article-type box">人员类型</div> <div class="time box">注册时间</div>
<div class="time box">注册时间</div> <div class="article-type box">是否冻结</div>
<div class="article-type box">是否冻结</div> <div class="function box">操作</div>
<div class="function box">操作</div> </div>
</div> <div class="table-content">
<div class="table-content"> <div class="one-data" v-for="(person, index) in personList" :key="index">
<div class="one-data" v-for="(person, index) in personList" :key="index"> <div class="index box">{{index+1}}</div>
<div class="index box">{{index+1}}</div> <div class="article-name box theme-font-blue special-text" @click="goPersonalInfo(person.user_id)">{{person.real_name}}</div>
<div class="article-name box theme-font-blue special-text" @click="goPersonalInfo(person.user_id)">{{person.real_name}}</div> <div class="article-type box">{{person.user_type}}</div>
<div class="article-type box">{{person.user_type}}</div> <div class="time box theme-font-blue special-text">{{person.create_time}}</div>
<div class="time box theme-font-blue special-text">{{person.create_time}}</div> <div class="article-type box" :class="person.frozen_state === '0' ? 'theme-font-green' : 'theme-font-red'">{{person.frozen_state === '0' ? '未冻结' : '已冻结'}}</div>
<div class="article-type box" :class="person.frozen_state === '0' ? 'theme-font-green' : 'theme-font-red'">{{person.frozen_state === '0' ? '未冻结' : '已冻结'}}</div> <div class="function box">
<div class="function box"> <el-button type="danger" size='mini' @click="peopleManagement(person, '1')" v-if="person.frozen_state === '0'">冻结</el-button>
<el-button type="danger" size='mini' @click="peopleManagement(person, '1')" v-if="person.frozen_state === '0'">冻结</el-button> <el-button type="success" size='mini' @click="peopleManagement(person, '0')" v-if="person.frozen_state === '1'">解冻</el-button>
<el-button type="success" size='mini' @click="peopleManagement(person, '0')" v-if="person.frozen_state === '1'">解冻</el-button>
<el-button type="primary" size='mini' @click="openEdit(person)">编辑</el-button>
</div>
</div> </div>
<div class="number">{{personList.length}}条数据</div>
</div> </div>
<div class="number">{{personList.length}}条数据</div>
</div> </div>
</div> </div>
<el-dialog
title="个人信息"
:visible.sync="dialogVisible"
width="fit-content">
<div class="person-info">
<div class="one">
<div class="label">姓名</div>
<div class="content">{{personInfo.real_name}}</div>
</div>
<div class="one">
<div class="label">性别</div>
<div class="content">{{personInfo.sex}}</div>
</div>
<div class="one">
<div class="label">出生日期</div>
<div class="content">{{personInfo.birthday}}</div>
</div>
<div class="one">
<div class="label">手机号</div>
<div class="content">{{personInfo.mobile}}</div>
</div>
<div class="one">
<div class="label">身份</div>
<div class="content">{{personInfo.user_type}}</div>
</div>
<div class="one">
<div class="label">个性签名</div>
<div class="content">{{personInfo.signature}}</div>
</div>
<div class="one">
<div class="label">职务</div>
<div class="content">
<el-select size="mini"
v-model="personInfo.post"
filterable
allow-create
default-first-option
placeholder="请输入职务">
<el-option v-for="item in postList"
:key="item.value"
:label="item.label"
:value="item.value"/>
</el-select>
</div>
</div>
<div class="one">
<div class="label">班级</div>
<div class="content">
<el-select size="mini"
v-model="personInfo.class_name"
filterable
allow-create
default-first-option
placeholder="请输入班级">
<el-option v-for="item in classList"
:key="item.class_name"
:label="item.class_name"
:value="item.class_name"/>
</el-select>
</div>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="updatePersonalInfo"> </el-button>
</span>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import noDate from '@/components/components/NoData' import noDate from '@/components/components/NoData'
import { getClassList } from '@/api/index/user'
export default { export default {
components: { components: {
@ -135,87 +41,16 @@
name: "PersonnelManagement", name: "PersonnelManagement",
data() { data() {
return{ return{
//
loading: false,
//
classList: [],
//
queryParams: {
name: '',
userType: ''
},
//
userTypeList: [],
//
postList: [
{label: '无', value: '无'},
{label: '班主任', value: '班主任'},
],
//
dialogVisible: false,
// //
noDate: true, noDate: true,
// //
personList: [], personList: []
//
personInfo: {}
} }
}, },
mounted() { mounted() {
this.getUserType();
this.getClassList();
this.getFollowPeopleList() this.getFollowPeopleList()
}, },
methods: { methods: {
/**
* 获取班级列表
*/
getClassList() {
getClassList({}).then(res => {
if (res.data.data.length > 0) {
res.data.data.forEach(item => {
if (item && item.class_name !== '') {
this.classList.push(item)
}
});
}
})
},
/**
* 获取人员类型
*/
getUserType() {
this.getDict('UserType').then(res => {
this.userTypeList = res.data.data.filter(item => {
return item.dd_detail !== '管理员'
})
})
},
/**
* 编辑个人信息
*/
updatePersonalInfo() {
if (this.personInfo.post === '班主任' && this.personInfo.user_type === '学生') {
this.$notify.error('学生不可赋予班主任职务')
} else {
this.$ajax.post('/hs/updatePersonalInfo',
{className: this.personInfo.class_name, post: this.personInfo.post, userId: this.personInfo.user_id}, res => {
if (res.data > 0) {
this.dialogVisible = false;
this.$notify.success('修改成功')
}
})
}
},
/**
* 打开个人信息
*/
openEdit(person) {
this.dialogVisible = true;
this.$ajax.post('/admin/getPersonInfo', {userId: person.user_id}, res => {
this.personInfo = res.data
})
},
/** /**
* 冻结/解冻 * 冻结/解冻
* @param {Object} item * @param {Object} item
@ -235,8 +70,9 @@
userId: item.user_id, userId: item.user_id,
operating: operating operating: operating
}, res => { }, res => {
if (res.data > 0) { console.log("人员操作结果", res);
this.$notify({ if (res > 0) {
this.$message({
type: 'success', type: 'success',
message: `${OPERATING[operating]+item.real_name}成功` message: `${OPERATING[operating]+item.real_name}成功`
}); });
@ -244,7 +80,10 @@
_this.getFollowPeopleList(); _this.getFollowPeopleList();
}, 1000) }, 1000)
} else { } else {
this.$notify.error('服务器出小差了,请稍后再试'); this.$message({
type: 'error',
message: '服务器出小差了,请稍后再试'
});
} }
}) })
}) })
@ -260,46 +99,21 @@
* 获取人员列表 * 获取人员列表
*/ */
getFollowPeopleList() { getFollowPeopleList() {
this.loading = true; this.$ajax.post('/admin/getPersonnelManagement', {}, res => {
this.$ajax.post('/admin/getPersonnelManagement', this.queryParams, res => { console.log('人员列表', res);
if (res.data.length > 0) { if (res.length > 0) {
this.personList = res.data; this.personList = res;
this.noDate = false; this.noDate = false;
} else { } else {
this.noDate = true this.noDate = true
} }
this.loading = false
}) })
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style scoped>
.page {
padding: 0;
.table {
padding: 0 1rem;
}
}
.person-info {
width: 40vw;
display: flex;
flex-flow: column;
.one {
display: flex;
margin-bottom: 1rem;
align-items: center;
.label {
width: 6em;
text-align-last: justify;
}
.content {
flex: 1;
color: #00afff;
}
}
}
.el-button+.el-button{ .el-button+.el-button{
margin-left: 0; margin-left: 0;
} }
@ -345,10 +159,6 @@
} }
.box{ .box{
text-align: center; text-align: center;
display: flex;
.el-button {
margin-right: 0.5rem;
}
} }
.table-header{ .table-header{
color: #999; color: #999;

View File

@ -1,230 +1,13 @@
<template> <template>
<div class="page">
<div class="top">
<el-form :model="queryParams" ref="queryForm" :inline="true" label-width="6rem">
<el-form-item label="人员姓名">
<el-input
v-model="queryParams.name"
placeholder="请输入人员姓名"
clearable
size="small"
@keyup.enter.native="getFollowPeopleList"
/>
</el-form-item>
<el-form-item label="人员类型">
<el-select v-model="queryParams.userType" placeholder="请选择人员类型" clearable size="small">
<el-option
v-for="dict in userTypeList"
:key="dict.id"
:label="dict.dd_detail"
:value="dict.dd_detail"
/>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="getFollowPeopleList">搜索</el-button>
</el-form-item>
</el-form>
</div>
<div class="list-box" v-loading="loading">
<no-date v-if="noDate"/>
<div class="table" v-if="!noDate">
<div class="table-header">
<div class="index box">序号</div>
<div class="article-name box">人员名称</div>
<div class="article-type box">人员类型</div>
<div class="time box">注册时间</div>
<div class="function box">操作</div>
</div>
<div class="table-content">
<div class="one-data" v-for="(person, index) in personList" :key="index">
<div class="index box">{{index+1}}</div>
<div class="article-name box theme-font-blue special-text" @click="goPersonalInfo(person.user_id)">{{person.real_name}}</div>
<div class="article-type box">{{person.user_type}}</div>
<div class="time box theme-font-blue special-text">{{person.create_time}}</div>
<div class="function box">
<el-button type="success" size='mini' @click="passRegistration(person)">通过</el-button>
<el-button type="danger" size='mini' @click="deleteRegistration(person)">删除</el-button>
</div>
</div>
<div class="number">{{personList.length}}条数据</div>
</div>
</div>
</div>
</div>
</template> </template>
<script> <script>
import noDate from '@/components/components/NoData' export default {
import { delPerson, editPerson } from '@/api/index/user' name: "RegistrationManagement"
export default {
components: {
noDate
},
name: "PersonnelManagement",
data() {
return{
//
loading: false,
//
queryParams: {
name: '',
userType: '',
takeEffect: '0'
},
//
userTypeList: [],
//
noDate: true,
//
personList: [],
}
},
mounted() {
this.getUserType();
this.getFollowPeopleList()
},
methods: {
/**
* 获取人员类型
*/
getUserType() {
this.getDict('UserType').then(res => {
this.userTypeList = res.data.data.filter(item => {
return item.dd_detail !== '管理员'
})
})
},
/**
* 删除人员
*/
deleteRegistration(person) {
this.$confirm(`是否确认删除${person.real_name}的注册信息`, "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delPerson(person.user_id);
}).then(() => {
this.getFollowPeopleList();
this.$notify.success("删除成功");
})
},
/**
* 通过审核
*/
passRegistration(person) {
this.$confirm(`是否确认通过${person.real_name}的注册信息`, "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return editPerson({userId: person.user_id, takeEffect: '1'});
}).then(() => {
this.getFollowPeopleList();
this.$notify.success("通过成功");
})
},
/**
* 获取人员列表
*/
getFollowPeopleList() {
this.loading = true;
this.$ajax.post('/admin/getPersonnelManagement', this.queryParams, res => {
if (res.data.length > 0) {
this.personList = res.data;
this.noDate = false;
} else {
this.noDate = true
}
this.loading = false
})
}
} }
}
</script> </script>
<style lang="scss" scoped> <style scoped>
.person-info {
width: 40vw;
display: flex;
flex-flow: column;
.one {
display: flex;
margin-bottom: 1rem;
align-items: center;
.label {
width: 6em;
text-align-last: justify;
}
.content {
flex: 1;
color: #00afff;
}
}
}
.el-button+.el-button{
margin-left: 0;
}
.table-content{
padding-bottom: 2rem;
}
.number{
font-size: 0.9rem;
color: #999;
float: right;
margin: 1rem;
}
.special-text{
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
.special-text:hover{
text-decoration: underline;
}
.index{
width: 3rem;
text-align: center;
}
.article-name{
width: 6rem;
text-align: center;
}
.article-type{
width: 6rem;
color: #999999;
text-align: center;
}
.time{
width: 14rem;
color: #999;
text-decoration: none!important;
cursor: default!important;
}
.function{
width: 10rem;
}
.box{
text-align: center;
display: flex;
.el-button {
margin-right: 0.5rem;
}
}
.table-header{
color: #999;
}
.one-data{
font-size: 0.9rem;
}
.table-header, .one-data{
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid #ADDFFA;
padding: 0.5rem 0;
}
</style> </style>

View File

@ -67,14 +67,16 @@
getPhoto() { getPhoto() {
this.$ajax.post('/hs/getFileList',{},r=>{ this.$ajax.post('/hs/getFileList',{},r=>{
this.fileList = []; this.fileList = [];
for (let i = 0; i < r.data.fileList.length; i++) { for (let i = 0; i < r.fileList.length; i++) {
this.fileList.push({path: require('../assets/file/'+r.data.fileList[i].fileEncryption)}) this.fileList.push({path: require('../assets/file/'+r.fileList[i].fileEncryption)})
} }
}) })
}, },
handleRemove(file, fileList) { handleRemove(file, fileList) {
console.log(file, fileList);
}, },
handlePreview(file) { handlePreview(file) {
console.log(file);
} }
} }
} }

107
README.md
View File

@ -1,98 +1,17 @@
<p align=center> # HSLink
<a href="http://pnkx.top:8862"> 毕设:家校通
<img style="width: 100px; height:100px;" src="https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/eee.ico" alt="nice blog system">
</a>
</p>
<p align=center>
HSLink 是一个前后端分离的家校通网站
</p>
## 项目选型
采用SpringBoot + Vue
## 网站功能 还在完善
- :tw-1f334: 采用了时下流行的SpringBoot + Vue技术。
- :tw-1f363: MySQL严格的数据库规范设计。
- :tw-1f375: 独具特色的评论回复功能,不依赖任何三方评论回复插件
## 环境依赖
| 环境依赖 | 说明描述 |
| ------------------------ | ----------------------------- |
| 软件基础环境 | 服务器(例:1 vCPU 2 GiB 1Mbps+域名(例kiwipeach.cn) ,注意这里的域名需要备案才能够访问喔|
| 数据库 | MySQL |
| JDK | 推荐使用jdk1.8及1.8以上的版本 |
| node | 前端需要使用node环境启动前端服务其中请求转发可以使用前端提供转发工具当然也可以使用nginx看具体部署条件。 |
## 主要功能预览
### PC客户端端
#### 登录
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E7%99%BB%E5%BD%95.jpg "在这里输入图片标题")
#### 注册
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E6%B3%A8%E5%86%8C.jpg "在这里输入图片标题")
#### 首页
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E9%A6%96%E9%A1%B5.jpg "在这里输入图片标题")
#### 文章详情
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E6%96%87%E7%AB%A0%E8%AF%A6%E6%83%85.png "在这里输入图片标题")
#### 校园通知
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E6%A0%A1%E5%9B%AD%E9%80%9A%E7%9F%A5.jpg "在这里输入图片标题")
#### 我的班级
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E6%88%91%E7%9A%84%E7%8F%AD%E7%BA%A7.png "在这里输入图片标题")
#### 家长建议
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E5%AE%B6%E9%95%BF%E5%BB%BA%E8%AE%AE.jpg "在这里输入图片标题")
#### 学生想法
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E5%AD%A6%E7%94%9F%E6%83%B3%E6%B3%95.jpg "在这里输入图片标题")
#### 个人中心
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E4%B8%AA%E4%BA%BA%E4%B8%AD%E5%BF%83.jpg "在这里输入图片标题")
#### 私信
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E7%A7%81%E4%BF%A1.jpg "在这里输入图片标题")
#### 发表文章
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E5%8F%91%E8%A1%A8%E6%96%87%E7%AB%A0.jpg "在这里输入图片标题")
### PC管理端
#### 首页管理
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E9%A6%96%E9%A1%B5%E7%AE%A1%E7%90%86.jpg "在这里输入图片标题")
#### 文章审核
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E6%96%87%E7%AB%A0%E5%AE%A1%E6%A0%B8.jpg "在这里输入图片标题")
#### 人员管理
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E4%BA%BA%E5%91%98%E7%AE%A1%E7%90%86.jpg "在这里输入图片标题")
#### 帮助答复
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/%E5%B8%AE%E5%8A%A9%E7%AD%94%E5%A4%8D.jpg "在这里输入图片标题")
### APP端
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E7%99%BB%E5%BD%95.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E6%B3%A8%E5%86%8C.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E9%A6%96%E9%A1%B5.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E5%85%B3%E6%B3%A8.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E5%8F%91%E8%A1%A8%E6%96%87%E7%AB%A0.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E6%B6%88%E6%81%AF%E5%88%97%E8%A1%A8.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E4%B8%AA%E4%BA%BA%E4%B8%AD%E5%BF%83.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E6%88%91%E7%9A%84%E6%94%B6%E8%97%8F.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E6%88%91%E7%9A%84%E6%96%87%E7%AB%A0.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E9%80%9A%E7%9F%A5.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E7%BC%96%E8%BE%91%E4%B8%AA%E4%BA%BA%E4%BF%A1%E6%81%AF.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E8%AE%BE%E7%BD%AE.jpg "在这里输入图片标题")
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/hslink/app%E5%B8%AE%E5%8A%A9.jpg "在这里输入图片标题")
## HSLink -> [点击跳转](http://pnkx.top:8862) 前端Vue
后端SpringBoot
数据库MySQL
移动端uni-app
有需要完整内容的可以加我QQ617594538备注写清意图