Compare commits
1 Commits
dependabot
...
master
Author | SHA1 | Date | |
---|---|---|---|
29753c9a04 |
@ -1,5 +1,4 @@
|
||||
const baseUrl = 'http://192.168.10.29:8048'; //服务器地址
|
||||
// const baseUrl = 'http://127.0.0.1:8048'; //服务器地址
|
||||
const baseUrl = 'http://127.0.0.1:8048'; //服务器地址
|
||||
|
||||
const get = (url, data) => {
|
||||
let httpDefaultOpts = {
|
||||
|
@ -71,10 +71,18 @@
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.yml</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
@ -1,24 +1,25 @@
|
||||
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.IHsWinnersService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
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 org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author PHY
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/admin")
|
||||
public class AdminHSController {
|
||||
public class AdminHSController extends BaseController {
|
||||
|
||||
/**
|
||||
* 日志
|
||||
@ -26,7 +27,10 @@ public class AdminHSController {
|
||||
private static Logger logger = LogManager.getLogger(HSController.class);
|
||||
|
||||
@Resource
|
||||
AdminHSService AdminhsService;
|
||||
AdminHSService adminhsService;
|
||||
@Resource
|
||||
private IHsWinnersService hsWinnersService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取待审核文章列表
|
||||
@ -34,10 +38,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getVerifyList")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getVerifyList(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.getVerifyList(param);
|
||||
result = adminhsService.getVerifyList(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -47,10 +50,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/verifyArticle")
|
||||
@ResponseBody
|
||||
public Map<String, Object> verifyArticle(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.verifyArticle(param);
|
||||
result = adminhsService.verifyArticle(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -60,10 +62,30 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getPersonnelManagement")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getPersonnelManagement(@RequestBody Map<String,Object> param){
|
||||
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;
|
||||
}
|
||||
|
||||
@ -73,10 +95,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/peopleManagement")
|
||||
@ResponseBody
|
||||
public Map<String, Object> peopleManagement(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.peopleManagement(param);
|
||||
result = adminhsService.peopleManagement(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -86,10 +107,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getHelpAnswerList")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getHelpAnswerList(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.getHelpAnswerList(param);
|
||||
result = adminhsService.getHelpAnswerList(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -99,10 +119,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/answerHelp")
|
||||
@ResponseBody
|
||||
public Map<String, Object> answerHelp(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.answerHelp(param);
|
||||
result = adminhsService.answerHelp(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -112,10 +131,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getRegisterManagementData")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getRegisterManagementData(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.getRegisterManagementData(param);
|
||||
result = adminhsService.getRegisterManagementData(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -125,10 +143,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/passRegister")
|
||||
@ResponseBody
|
||||
public Map<String, Object> passRegister(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.passRegister(param);
|
||||
result = adminhsService.passRegister(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -138,10 +155,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getMyPageNumber")
|
||||
@ResponseBody
|
||||
public Map<String, Object> getMyPageNumber(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.getMyPageNumber(param);
|
||||
result = adminhsService.getMyPageNumber(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -151,10 +167,9 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/uploadRotationPhoto")
|
||||
@ResponseBody
|
||||
public Map<String, Object> uploadRotationPhoto(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.uploadRotationPhoto(param);
|
||||
result = adminhsService.uploadRotationPhoto(param);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -164,11 +179,67 @@ public class AdminHSController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/deleteRotationPhoto")
|
||||
@ResponseBody
|
||||
public Map<String, Object> deleteRotationPhoto(@RequestBody Map<String,Object> param){
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result = AdminhsService.deleteRotationPhoto(param);
|
||||
result = adminhsService.deleteRotationPhoto(param);
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,28 @@
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
@ -482,11 +482,8 @@ public class HSController {
|
||||
* @throws IOException
|
||||
*/
|
||||
@RequestMapping("/showImg/{fileName}")
|
||||
private void responPhoto(HttpServletResponse response, @PathVariable(value = "fileName") String fileName) throws IOException {
|
||||
//Linux环境下的路径
|
||||
// String filePath = filesPath + "/" + fileName;
|
||||
//Window环境下的路径
|
||||
String filePath = filesPath + "\\" + fileName;
|
||||
private void showImg(HttpServletResponse response, @PathVariable(value = "fileName") String fileName) throws IOException {
|
||||
String filePath = filesPath + fileName;
|
||||
File imageFile = new File(filePath);
|
||||
if (imageFile.exists()) {
|
||||
FileInputStream fis = null;
|
||||
|
@ -94,4 +94,32 @@ public interface AdminHSMapper {
|
||||
* @return
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
@ -0,0 +1,55 @@
|
||||
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);
|
||||
}
|
@ -64,8 +64,10 @@
|
||||
<if test="content != '' and content != null">
|
||||
and title like CONCAT('%',#{content},'%')
|
||||
</if>
|
||||
<if test="author != '' and author != null">
|
||||
and u.real_name like CONCAT('%',#{author},'%')
|
||||
</if>
|
||||
AND is_pass = '0'
|
||||
and type != "班级通知"
|
||||
ORDER BY release_time desc
|
||||
</select>
|
||||
|
||||
@ -76,10 +78,25 @@
|
||||
(SELECT count(*) from hs_follow f where f.follow_id = u.user_id) fansNumber
|
||||
FROM hs_user u where
|
||||
u.user_type != "管理员"
|
||||
<if test="content != '' and content != null">
|
||||
<if test="name != '' and name != null">
|
||||
and u.real_name like CONCAT('%',#{name},'%')
|
||||
</if>
|
||||
and u.take_effect = "1" order by u.frozen_state
|
||||
<if test="userType != '' and userType != null">
|
||||
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>
|
||||
|
||||
<!--获取帮助答复列表-->
|
||||
@ -107,4 +124,27 @@
|
||||
select * from hs_user where take_effect = '0'
|
||||
</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>
|
||||
|
@ -10,7 +10,11 @@
|
||||
|
||||
<!--注册-->
|
||||
<insert id="register" parameterType="map">
|
||||
INSERT INTO hs_user ( user_id, pass_word,real_name, mobile, user_type, create_time)
|
||||
INSERT INTO hs_user ( user_id, pass_word,real_name, mobile, user_type,
|
||||
<if test="takeEffect != '' and takeEffect != null">
|
||||
take_effect,
|
||||
</if>
|
||||
create_time)
|
||||
VALUES
|
||||
(
|
||||
uuid(),
|
||||
@ -18,6 +22,9 @@
|
||||
#{realname},
|
||||
#{mobile},
|
||||
#{type},
|
||||
<if test="takeEffect != '' and takeEffect != null">
|
||||
#{takeEffect},
|
||||
</if>
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
@ -106,6 +113,8 @@
|
||||
read_number,
|
||||
case when (select count(*) from hs_collection where user_id = #{userId} and article_id = #{id}) > 0
|
||||
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
|
||||
from hs_notice n left join hs_user u on n.release_id = u.user_id
|
||||
where id = #{id}
|
||||
@ -184,9 +193,11 @@
|
||||
|
||||
<!--新增一条班级通知-->
|
||||
<insert id="addClassNotice" parameterType="map">
|
||||
insert into hs_notice (id,class_id,class_name,label,title,content,release_id,release_time,type)
|
||||
insert into hs_notice (id,class_id,class_name,label,
|
||||
title,content,release_id,release_time,is_pass,type)
|
||||
values
|
||||
(uuid(),#{classId},#{className},#{label},#{title},#{content},#{releaseId},#{release_time},"班级通知")
|
||||
(uuid(),#{classId},#{className},#{label},#{title},
|
||||
#{content},#{releaseId},#{release_time},'1',"班级通知")
|
||||
</insert>
|
||||
|
||||
<!--获取班级公告-->
|
||||
@ -331,10 +342,31 @@
|
||||
<!--编辑个人信息-->
|
||||
<update id="updatePersonalInfo" parameterType="map">
|
||||
update hs_user set
|
||||
sex = #{sex},
|
||||
birthday = #{birthday},
|
||||
address = #{address},
|
||||
signature = #{signature}
|
||||
<if test="sex != '' and sex != null">
|
||||
sex = #{sex},
|
||||
</if>
|
||||
<if test="studentNumber != '' and studentNumber != null">
|
||||
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}
|
||||
</update>
|
||||
|
||||
@ -567,6 +599,9 @@
|
||||
left join hs_collection c on p.id = c.article_id
|
||||
WHERE
|
||||
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"
|
||||
ORDER BY
|
||||
release_time DESC
|
||||
@ -604,4 +639,4 @@
|
||||
and is_read = '0'
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
@ -0,0 +1,89 @@
|
||||
<?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>
|
@ -0,0 +1,99 @@
|
||||
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 + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
@ -0,0 +1,149 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.qinxx.hslink.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -21,6 +22,13 @@ public interface AdminHSService {
|
||||
*/
|
||||
Map<String, Object> getPersonnelManagement(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 获取人员详情
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getPersonInfo(Map<String, Object> param);
|
||||
|
||||
/**
|
||||
* 审核文章(通过/驳回)
|
||||
* @param param
|
||||
@ -83,4 +91,26 @@ public interface AdminHSService {
|
||||
* @return
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
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);
|
||||
}
|
@ -57,6 +57,20 @@ public class AdminHSServiceImpl implements AdminHSService {
|
||||
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
|
||||
@ -203,10 +217,7 @@ public class AdminHSServiceImpl implements AdminHSService {
|
||||
@Override
|
||||
public Map<String, Object> deleteRotationPhoto(Map<String, Object> param) {
|
||||
int res = 0;
|
||||
//Linux环境下的路径
|
||||
// File file = new File(filesPath + "/" + param.get("fileEncryption"));
|
||||
//Window环境下的路径
|
||||
File file = new File(filesPath + "\\" + param.get("fileEncryption"));
|
||||
File file = new File(filesPath + param.get("fileEncryption"));
|
||||
// 路径为文件且不为空则进行删除
|
||||
if (file.isFile() && file.exists()) {
|
||||
file.delete();
|
||||
@ -222,4 +233,36 @@ public class AdminHSServiceImpl implements AdminHSService {
|
||||
result.put("success",true);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
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);
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
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;
|
||||
}
|
||||
}
|
986
HSLink-back/src/main/java/com/qinxx/hslink/util/Convert.java
Normal file
986
HSLink-back/src/main/java/com/qinxx/hslink/util/Convert.java
Normal file
@ -0,0 +1,986 @@
|
||||
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支持的值为:true、false、yes、ok、no,1,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>
|
||||
* 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法
|
||||
*
|
||||
* @param obj 对象
|
||||
* @param charsetName 字符集
|
||||
* @return 字符串
|
||||
*/
|
||||
public static String str(Object obj, String charsetName)
|
||||
{
|
||||
return str(obj, Charset.forName(charsetName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 将对象转为字符串<br>
|
||||
* 1、Byte数组和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("^整$", "零元整");
|
||||
}
|
||||
}
|
117
HSLink-back/src/main/java/com/qinxx/hslink/util/DateUtils.java
Normal file
117
HSLink-back/src/main/java/com/qinxx/hslink/util/DateUtils.java
Normal file
@ -0,0 +1,117 @@
|
||||
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 + "分钟";
|
||||
}
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
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;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
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());
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
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;
|
||||
}
|
||||
}
|
145
HSLink-back/src/main/java/com/qinxx/hslink/util/SpringUtils.java
Normal file
145
HSLink-back/src/main/java/com/qinxx/hslink/util/SpringUtils.java
Normal file
@ -0,0 +1,145 @@
|
||||
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;
|
||||
}
|
||||
}
|
35
HSLink-back/src/main/java/com/qinxx/hslink/util/SqlUtil.java
Normal file
35
HSLink-back/src/main/java/com/qinxx/hslink/util/SqlUtil.java
Normal file
@ -0,0 +1,35 @@
|
||||
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);
|
||||
}
|
||||
}
|
413
HSLink-back/src/main/java/com/qinxx/hslink/util/StringUtils.java
Normal file
413
HSLink-back/src/main/java/com/qinxx/hslink/util/StringUtils.java
Normal file
@ -0,0 +1,413 @@
|
||||
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是否为空, 包含List,Set,Queue
|
||||
*
|
||||
* @param coll 要判断的Collection
|
||||
* @return true:为空 false:非空
|
||||
*/
|
||||
public static boolean isEmpty(Collection<?> coll)
|
||||
{
|
||||
return isNull(coll) || coll.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* * 判断一个Collection是否非空,包含List,Set,Queue
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
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();
|
||||
}
|
||||
}
|
12
HSLink-back/src/main/resources/application-dev.yml
Normal file
12
HSLink-back/src/main/resources/application-dev.yml
Normal file
@ -0,0 +1,12 @@
|
||||
##文件保存路径
|
||||
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
|
@ -9,19 +9,7 @@ mybatis:
|
||||
logging:
|
||||
level:
|
||||
com.qinxx.hslink.dao : debug
|
||||
##数据源
|
||||
spring:
|
||||
datasource:
|
||||
# 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
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
|
7
HSLink-back/src/main/resources/banner.txt
Normal file
7
HSLink-back/src/main/resources/banner.txt
Normal file
@ -0,0 +1,7 @@
|
||||
Spring Boot Version: v2.2.6.RELEASE
|
||||
__ _______ __ _ __
|
||||
/ / / / ___// / (_)___ / /__
|
||||
/ /_/ /\__ \/ / / / __ \/ //_/
|
||||
/ __ /___/ / /___/ / / / / ,<
|
||||
/_/ /_//____/_____/_/_/ /_/_/|_|
|
||||
|
11
HSLink-front/.env.development
Normal file
11
HSLink-front/.env.development
Normal file
@ -0,0 +1,11 @@
|
||||
# 开发环境配置
|
||||
ENV = 'development'
|
||||
|
||||
# 开发环境
|
||||
VUE_APP_BASE_API = '/dev-api'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
||||
# 后端地址+端口
|
||||
VUE_APP_BACK = 'http://127.0.0.1:8048'
|
8
HSLink-front/.env.production
Normal file
8
HSLink-front/.env.production
Normal file
@ -0,0 +1,8 @@
|
||||
# 生产环境配置
|
||||
ENV = 'production'
|
||||
|
||||
# 生产环境
|
||||
VUE_APP_BASE_API = '/prod-api'
|
||||
|
||||
# 后端地址+端口
|
||||
VUE_APP_BACK = 'http://phy0412.top:8862/prod-api'
|
@ -13,7 +13,7 @@ module.exports = {
|
||||
proxyTable: {},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: '0.0.0.0', // can be overwritten by process.env.HOST
|
||||
host: '127.0.0.1', // 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
|
||||
autoOpenBrowser: false,
|
||||
errorOverlay: true,
|
||||
|
14362
HSLink-front/package-lock.json
generated
14362
HSLink-front/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "hslink",
|
||||
"version": "1.0.0",
|
||||
"description": "A Vue.js project",
|
||||
"description": "家校通",
|
||||
"author": "peihaoyu <617594538@qq.com>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@ -14,6 +14,7 @@
|
||||
"element-ui": "^2.13.0",
|
||||
"jquery": "^3.4.1",
|
||||
"marked": "^0.8.2",
|
||||
"mavon-editor": "^2.9.1",
|
||||
"react": "^16.13.1",
|
||||
"vue": "^2.5.2",
|
||||
"vue-router": "^3.0.1",
|
||||
|
@ -8,8 +8,8 @@
|
||||
export default {
|
||||
name: 'App',
|
||||
mounted() {
|
||||
// const url = `http://192.168.10.29:8048`;
|
||||
const url = `http://127.0.0.1:8048`;
|
||||
const url = `http://pnkx.top:8862/prod-api`;
|
||||
// const url = `http://127.0.0.1:8048`;
|
||||
sessionStorage.setItem('url', url);
|
||||
}
|
||||
}
|
||||
|
36
HSLink-front/src/api/admin/winners.js
Normal file
36
HSLink-front/src/api/admin/winners.js
Normal file
@ -0,0 +1,36 @@
|
||||
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'
|
||||
})
|
||||
}
|
@ -47,11 +47,8 @@ function apiAxios (method, url, params, success, failure) {
|
||||
withCredentials: false
|
||||
})
|
||||
.then(function (res) {
|
||||
console.log("success",res)
|
||||
if (res.data.success === true) {
|
||||
if (success) {
|
||||
success(res.data.data)
|
||||
}
|
||||
if (res.data) {
|
||||
success(res.data)
|
||||
} else {
|
||||
if (failure) {
|
||||
failure(res.data)
|
||||
|
46
HSLink-front/src/api/index/user.js
Normal file
46
HSLink-front/src/api/index/user.js
Normal file
@ -0,0 +1,46 @@
|
||||
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
|
||||
})
|
||||
}
|
||||
|
||||
|
12
HSLink-front/src/api/system/dict.js
Normal file
12
HSLink-front/src/api/system/dict.js
Normal file
@ -0,0 +1,12 @@
|
||||
import request from '@/util/request'
|
||||
|
||||
// 获取字典列表
|
||||
export function getDict(query) {
|
||||
return request({
|
||||
url: '/hs/getDictionariesData',
|
||||
method: 'post',
|
||||
data: {
|
||||
code: query
|
||||
}
|
||||
})
|
||||
}
|
@ -53,3 +53,44 @@ body{
|
||||
body{
|
||||
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);
|
||||
|
||||
}
|
||||
|
@ -9,23 +9,18 @@
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<markdown
|
||||
:mdValuesP="msg.mdValue"
|
||||
:fullPageStatusP="false"
|
||||
:editStatusP="true"
|
||||
:previewStatusP="true"
|
||||
:navStatusP="true"
|
||||
:icoStatusP="true"
|
||||
@childevent="childEventHandler"
|
||||
ref="markdown"
|
||||
></markdown>
|
||||
<mavon-editor
|
||||
:placeholder="'开始创作···'"
|
||||
:toolbars="toolbars"
|
||||
:toolbarsBackground="'#f9f9f9'"
|
||||
@change="change"
|
||||
@imgAdd="imgAdd"
|
||||
@imgDel="imgDel"
|
||||
ref="md"
|
||||
style="height: 50vh"
|
||||
v-model="content"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<el-button class="" type="primary" @click="publish">发 表</el-button>
|
||||
@ -47,14 +42,44 @@
|
||||
name: "Posting",
|
||||
data() {
|
||||
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, // 保存(触发events中的save事件)
|
||||
navigation: true, // 导航目录
|
||||
alignleft: true, // 左对齐
|
||||
aligncenter: true, // 居中
|
||||
alignright: true, // 右对齐
|
||||
subfield: true, // 单双栏模式
|
||||
preview: false // 预览
|
||||
},
|
||||
label: "",
|
||||
title:"",
|
||||
type:'',
|
||||
msgShow:'我要显示的内容',
|
||||
content:'',
|
||||
dilogStatus:false,
|
||||
msg: {
|
||||
mdValue:''
|
||||
},
|
||||
flag:false,
|
||||
}
|
||||
},
|
||||
@ -73,33 +98,36 @@
|
||||
}
|
||||
},
|
||||
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() {
|
||||
this.$router.back(-1)
|
||||
},
|
||||
childEventHandler:function(res){
|
||||
// res会传回一个data,包含属性mdValue和htmlValue,具体含义请自行翻译
|
||||
this.msg=res;
|
||||
},
|
||||
closeMaskFn:function(){
|
||||
this.msgShow='';
|
||||
this.dilogStatus=false;
|
||||
},
|
||||
handleChange(value) {
|
||||
console.log(value);
|
||||
},
|
||||
publish() {
|
||||
if (this.label.length != 4) {
|
||||
this.$message({
|
||||
if (this.label.length !== 4) {
|
||||
this.$notify({
|
||||
message: "文章标签只能为4个汉字",
|
||||
type: "warning"
|
||||
})
|
||||
} else if (this.title == '') {
|
||||
this.$message({
|
||||
} else if (this.title === '') {
|
||||
this.$notify({
|
||||
message: "文章标题不能为空",
|
||||
type: "warning"
|
||||
})
|
||||
} else if (this.msg.mdValue == '') {
|
||||
this.$message({
|
||||
} else if (this.content === '') {
|
||||
this.$notify({
|
||||
message: "编辑内容不能为空",
|
||||
type: "warning"
|
||||
})
|
||||
@ -107,13 +135,12 @@
|
||||
if (sessionStorage.getItem("releaseType") === "classNotice") {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
|
||||
this.$ajax.post("/hs/addClassNotice",{classId:userInfo.class_id,className:userInfo.class_name,
|
||||
label:this.label,title:this.title,content:this.msg.mdValue,releaseId:userInfo.user_id,
|
||||
label:this.label,title:this.title,content:this.html,content_md: this.content ,releaseId:userInfo.user_id,
|
||||
release_time:getDate(),type:this.type},r=> {
|
||||
if (r === 1) {
|
||||
if (r.data === 1) {
|
||||
this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{
|
||||
console.log(r)
|
||||
});
|
||||
this.$message({
|
||||
this.$notify({
|
||||
message: "发布成功",
|
||||
type: "success"
|
||||
});
|
||||
@ -125,13 +152,12 @@
|
||||
sessionStorage.setItem("releaseType","")
|
||||
} else {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
|
||||
this.$ajax.post("/hs/addArticle",{label:this.label,title:this.title,content:this.msg.mdValue,release_id:userInfo.user_id,
|
||||
this.$ajax.post("/hs/addArticle",{label:this.label,title:this.title,content:this.html,content_md: this.content,release_id:userInfo.user_id,
|
||||
release_time:getDate(),type:this.type},r=>{
|
||||
if (r === 1) {
|
||||
if (r.data === 1) {
|
||||
this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{
|
||||
console.log(r)
|
||||
});
|
||||
this.$message({
|
||||
this.$notify({
|
||||
message: "发表成功",
|
||||
type: "success"
|
||||
});
|
||||
@ -144,9 +170,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
markdown
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -170,7 +193,7 @@
|
||||
padding-bottom: 1rem;
|
||||
}
|
||||
.editorContainer{
|
||||
height: 500px;
|
||||
height: fit-content;
|
||||
}
|
||||
.integral img{
|
||||
display: inline-block;
|
||||
|
@ -16,23 +16,17 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="middle">
|
||||
<div class="editorContainer">
|
||||
<markdown
|
||||
:mdValuesP="msg.mdValue"
|
||||
:fullPageStatusP="false"
|
||||
:editStatusP="true"
|
||||
:previewStatusP="true"
|
||||
:navStatusP="true"
|
||||
:icoStatusP="true"
|
||||
@childevent="childEventHandler"
|
||||
ref="markdown"
|
||||
></markdown>
|
||||
</div>
|
||||
<div class="editorContainer article-content" v-html="all.content"></div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<el-row>
|
||||
<el-button type="primary" icon="el-icon-thumb" size="mini" plain @click="follow">点 赞</el-button>
|
||||
<el-button type="primary" icon="el-icon-share" size="mini" plain @click="follow">分 享</el-button>
|
||||
<el-row class="article-read">
|
||||
<div class="reading-volume">
|
||||
阅读 {{all.read_number}}
|
||||
</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>
|
||||
</div>
|
||||
</div>
|
||||
@ -52,7 +46,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</el-main>
|
||||
<el-aside>
|
||||
<div class="index-right">
|
||||
<div class="person-info">
|
||||
<div class="info">
|
||||
<div class="name">
|
||||
@ -76,19 +70,18 @@
|
||||
</div>
|
||||
<hr>
|
||||
<div class="operation">
|
||||
<el-button type="primary" plain size="mini" @click="follow">关 注</el-button>
|
||||
<el-button type="primary" plain size="mini" @click="follow(all.isFollow)">{{all.isFollow === 0 ? '关 注' : '取消关注'}}</el-button>
|
||||
<el-button type="primary" plain size="mini" @click="sendLetter(all.author_id,all.author_name)">私 信</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<footers></footers>
|
||||
</el-aside>
|
||||
<footers/>
|
||||
</div>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDate } from '../assets/js/public.js'
|
||||
import footers from './components/Footer'
|
||||
import markdown from "./components/Mdeditor";
|
||||
export default {
|
||||
name: "Content",
|
||||
data() {
|
||||
@ -96,11 +89,6 @@
|
||||
all: "",
|
||||
message: '',
|
||||
id:'',
|
||||
msgShow:'我要显示的内容',
|
||||
dilogStatus:false,
|
||||
msg: {
|
||||
mdValue:''
|
||||
},
|
||||
flag:false,
|
||||
userId: JSON.parse(sessionStorage.getItem("userInfo")).user_id
|
||||
}
|
||||
@ -108,20 +96,48 @@
|
||||
created() {
|
||||
},
|
||||
mounted() {
|
||||
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)
|
||||
})
|
||||
this.getNotice()
|
||||
},
|
||||
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) {
|
||||
this.$confirm('确定删除该条留言, 是否继续?', '删除', {
|
||||
confirmButtonText: '确定',
|
||||
@ -129,15 +145,15 @@
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.$ajax.post("/hs/deleteOneMessage",{id:id},r=>{
|
||||
if (r === 1) {
|
||||
this.$message({
|
||||
if (r.data === 1) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: '删除成功!'
|
||||
});
|
||||
this.$ajax.post("/hs/getOneContent", {
|
||||
id: sessionStorage.getItem("noticeId")
|
||||
}, r => {
|
||||
this.message = r.message;
|
||||
this.message = r.data.message;
|
||||
for (let i = 0; i < this.message.length; i++) {
|
||||
this.message[i].header_photo = this.message[i].real_name.substring(0, 1)
|
||||
}
|
||||
@ -145,10 +161,7 @@
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消删除'
|
||||
});
|
||||
this.$notify.info('已取消删除');
|
||||
});
|
||||
},
|
||||
sendLetter(id,name) {
|
||||
@ -160,26 +173,31 @@
|
||||
inputErrorMessage: '内容不能为空'
|
||||
}).then(({ value }) => {
|
||||
this.$ajax.post("/hs/sendLetter",{sendId:userInfo.user_id,receiveId:id,content:value,time:getDate()},r=>{
|
||||
if (r === 1) {
|
||||
this.$message({
|
||||
if (r.data === 1) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: '发送成功'
|
||||
});
|
||||
} else {
|
||||
this.$message.error("发送失败")
|
||||
this.$notify.error("发送失败")
|
||||
}
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '取消输入'
|
||||
});
|
||||
this.$notify.info('取消输入');
|
||||
});
|
||||
},
|
||||
follow() {
|
||||
this.$message({
|
||||
type:"success",
|
||||
message: "喜欢就好"
|
||||
follow(option) {
|
||||
const URL = {
|
||||
0: '/hs/addFollow',
|
||||
1: '/hs/cancelFollow'
|
||||
};
|
||||
this.$ajax.post(URL[option],{
|
||||
userId: this.userId,
|
||||
followId: this.all.author_id
|
||||
}, res => {
|
||||
if (res.data > 0) {
|
||||
this.getNotice();
|
||||
}
|
||||
})
|
||||
},
|
||||
searchLabel(label) {
|
||||
@ -206,15 +224,15 @@
|
||||
}).then(({ value }) => {
|
||||
this.$ajax.post("/hs/addMessage",{noticeId:sessionStorage.getItem("noticeId"),content:value,
|
||||
createTime:getDate(),userId:JSON.parse(sessionStorage.getItem("userInfo")).user_id},r=>{
|
||||
if (r === 1) {
|
||||
this.$message({
|
||||
if (r.data === 1) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: '留言成功'
|
||||
});
|
||||
this.$ajax.post("/hs/getOneContent", {
|
||||
id: sessionStorage.getItem("noticeId")
|
||||
}, r => {
|
||||
this.message = r.message;
|
||||
this.message = r.data.message;
|
||||
for (let i = 0; i < this.message.length; i++) {
|
||||
this.message[i].header_photo = this.message[i].real_name.substring(0, 1)
|
||||
}
|
||||
@ -222,14 +240,8 @@
|
||||
}
|
||||
});
|
||||
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){
|
||||
// res会传回一个data,包含属性mdValue和htmlValue,具体含义请自行翻译
|
||||
@ -240,16 +252,39 @@
|
||||
this.dilogStatus=false;
|
||||
},
|
||||
handleChange(val) {
|
||||
console.log(val);
|
||||
},
|
||||
},
|
||||
components: {
|
||||
footers,
|
||||
markdown
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<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{
|
||||
display: inline-block;
|
||||
}
|
||||
|
@ -10,24 +10,17 @@
|
||||
</div>
|
||||
|
||||
<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">
|
||||
<markdown
|
||||
:mdValuesP="msg.mdValue"
|
||||
:fullPageStatusP="false"
|
||||
:editStatusP="true"
|
||||
:previewStatusP="true"
|
||||
:navStatusP="true"
|
||||
:icoStatusP="true"
|
||||
@childevent="childEventHandler"
|
||||
ref="markdown"
|
||||
></markdown>
|
||||
</div>
|
||||
<mavon-editor
|
||||
:placeholder="'开始创作···'"
|
||||
:toolbars="toolbars"
|
||||
:toolbarsBackground="'#f9f9f9'"
|
||||
@change="change"
|
||||
@imgAdd="imgAdd"
|
||||
@imgDel="imgDel"
|
||||
ref="md"
|
||||
style="height: 70vh"
|
||||
v-model="content"
|
||||
/>
|
||||
</div>
|
||||
<el-button class="" type="primary" @click="publish">保 存</el-button>
|
||||
<div class="notes">
|
||||
@ -46,68 +39,100 @@
|
||||
|
||||
<script>
|
||||
import {getDate} from "../assets/js/public";
|
||||
import markdown from "./components/Mdeditor";
|
||||
import footers from "./components/Footer";
|
||||
|
||||
export default {
|
||||
name: "EditorContent",
|
||||
data() {
|
||||
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, // 保存(触发events中的save事件)
|
||||
navigation: true, // 导航目录
|
||||
alignleft: true, // 左对齐
|
||||
aligncenter: true, // 居中
|
||||
alignright: true, // 右对齐
|
||||
subfield: true, // 单双栏模式
|
||||
preview: false // 预览
|
||||
},
|
||||
label: "",
|
||||
title:"",
|
||||
type:'',
|
||||
msgShow:'我要显示的内容',
|
||||
content:'',
|
||||
dilogStatus:false,
|
||||
msg: {
|
||||
mdValue:''
|
||||
},
|
||||
flag:false,
|
||||
}
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.$ajax.post("/hs/getOneContent",{id:sessionStorage.getItem("noticeId")},r=>{
|
||||
this.label = r.content.label;
|
||||
this.title = r.content. title;
|
||||
this.msg.mdValue = r. content.content
|
||||
this.label = r.data.content.label;
|
||||
this.title = r.data.content. title;
|
||||
this.content = r.data.content.content
|
||||
})
|
||||
},
|
||||
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() {
|
||||
this.$router.back(-1)
|
||||
},
|
||||
childEventHandler:function(res){
|
||||
// res会传回一个data,包含属性mdValue和htmlValue,具体含义请自行翻译
|
||||
this.msg=res;
|
||||
},
|
||||
closeMaskFn:function(){
|
||||
this.msgShow='';
|
||||
this.dilogStatus=false;
|
||||
},
|
||||
handleChange(value) {
|
||||
console.log(value);
|
||||
},
|
||||
publish() {
|
||||
if (this.label.length != 4) {
|
||||
this.$message({
|
||||
if (this.label.length !== 4) {
|
||||
this.$notify({
|
||||
message: "文章标签只能为4个汉字",
|
||||
type: "warning"
|
||||
})
|
||||
} else if (this.title == '') {
|
||||
this.$message({
|
||||
} else if (this.title === '') {
|
||||
this.$notify({
|
||||
message: "文章标题不能为空",
|
||||
type: "warning"
|
||||
})
|
||||
} else if (this.msg.mdValue == '') {
|
||||
this.$message({
|
||||
} else if (this.content === '') {
|
||||
this.$notify({
|
||||
message: "编辑内容不能为空",
|
||||
type: "warning"
|
||||
})
|
||||
} else {
|
||||
this.$ajax.post("/hs/updateOneContent",{label:this.label,title:this.title,
|
||||
content:this.msg.mdValue,id:sessionStorage.getItem("noticeId")},r=>{
|
||||
if (r === 1) {
|
||||
this.$message({
|
||||
content:this.html,content_md: this.content ,id:sessionStorage.getItem("noticeId")},r=>{
|
||||
if (r.data === 1) {
|
||||
this.$notify({
|
||||
type: "success",
|
||||
message: "编辑成功"
|
||||
})
|
||||
@ -115,14 +140,13 @@
|
||||
sessionStorage.setItem("noticeId",sessionStorage.getItem("noticeId"));*/
|
||||
this.$router.back(-1)
|
||||
} else {
|
||||
this.$message.error("编辑失败")
|
||||
this.$notify.error("编辑失败")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
markdown,
|
||||
footers
|
||||
},
|
||||
}
|
||||
|
@ -53,7 +53,6 @@
|
||||
},
|
||||
methods:{
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
}
|
||||
},
|
||||
components: {
|
||||
|
@ -76,10 +76,12 @@
|
||||
优 秀 教 师
|
||||
</div>
|
||||
<div class="one" v-for="(item, index) in prominentTeacher" :key='index'>
|
||||
<div class="name theme-font-blue">{{item.name}}老师</div>
|
||||
<!-- <div class="subject theme-font-blue">数学</div>-->
|
||||
<!-- <div class="grade theme-font-blue">2016届</div>-->
|
||||
<div class="class theme-font-blue">{{item.class}}</div>
|
||||
<el-tooltip class="item" effect="light" :content="item.userName" placement="top">
|
||||
<div class="name theme-font-blue">{{item.userName}}老师</div>
|
||||
</el-tooltip>
|
||||
<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 class="merit-student">
|
||||
@ -88,9 +90,12 @@
|
||||
三 好 学 生
|
||||
</div>
|
||||
<div class="one" v-for="(item, index) in meritStudent" :key='index'>
|
||||
<div class="name theme-font-blue">{{item.name}}同学</div>
|
||||
<!-- <div class="grade theme-font-blue">2016届</div>-->
|
||||
<div class="subject theme-font-blue">{{item.class}}</div>
|
||||
<el-tooltip class="item" effect="light" :content="item.userName" placement="top">
|
||||
<div class="name theme-font-blue">{{item.userName}}同学</div>
|
||||
</el-tooltip>
|
||||
<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>
|
||||
@ -100,7 +105,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
import { listWinners } from "@/api/admin/winners";
|
||||
|
||||
export default {
|
||||
name: "Hompage",
|
||||
data() {
|
||||
return{
|
||||
@ -112,67 +119,32 @@
|
||||
goodAdvice: '',
|
||||
magicalThinking: '',
|
||||
activeName: 'first',
|
||||
prominentTeacher: [
|
||||
{
|
||||
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届护理一班',
|
||||
},
|
||||
],
|
||||
prominentTeacher: [],
|
||||
meritStudent: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getRotationPhotoList();
|
||||
this.getNoticeList();
|
||||
this.getWinnerList()
|
||||
},
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
@ -184,16 +156,15 @@
|
||||
this.tabLoading = true;
|
||||
this.$ajax.post("/hs/getAllContent",{},r=>{
|
||||
this.tabLoading = false;
|
||||
this.newestNotice = r.schoolNoticeList.slice(0,12);
|
||||
this.goodAdvice = r.parentAdvice.slice(0,12);
|
||||
this.magicalThinking = r.studentThinking.slice(0,12);
|
||||
this.newestNotice = r.data.schoolNoticeList.slice(0,12);
|
||||
this.goodAdvice = r.data.parentAdvice.slice(0,12);
|
||||
this.magicalThinking = r.data.studentThinking.slice(0,12);
|
||||
})
|
||||
},
|
||||
//获取轮播图片
|
||||
getRotationPhotoList() {
|
||||
this.$ajax.post('/hs/getRotationPhotoList',{},res=>{
|
||||
console.log("轮播图列表",res);
|
||||
this.rotationPhotoList = res.rotationPhotoList;
|
||||
this.rotationPhotoList = res.data.rotationPhotoList;
|
||||
})
|
||||
},
|
||||
searchLabel(label) {
|
||||
@ -216,7 +187,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style scoped>
|
||||
.rotation-photo{
|
||||
object-fit: contain;
|
||||
width: 100%;
|
||||
|
@ -18,7 +18,7 @@
|
||||
<el-divider direction="vertical" v-if="!isLogin"></el-divider>
|
||||
<span class="pointer special-font-blue" v-if="isLogin" @click="forget">忘记密码</span>
|
||||
<el-divider direction="vertical" v-if="isLogin"></el-divider>
|
||||
<span class="pointer special-font-blue" @click="help">帮助中心</span>
|
||||
<span class="pointer special-font-blue" @click="goToPage('help')">帮助中心</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-header>
|
||||
@ -27,12 +27,8 @@
|
||||
<el-menu
|
||||
default-active="1"
|
||||
class="el-menu-vertical-demo">
|
||||
<el-menu-item index="1" @click="goHomepage">首页</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-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="100" @click="goMore" disabled>更多···</el-menu-item>
|
||||
</el-menu>
|
||||
</el-aside>
|
||||
<el-main>
|
||||
@ -54,6 +50,14 @@
|
||||
real_name: '',
|
||||
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() {
|
||||
@ -61,7 +65,7 @@
|
||||
/*setInterval(()=>{
|
||||
this.timingTask(userInfo.user_id)
|
||||
},60000);*/
|
||||
if (userInfo == '' || userInfo === null) {
|
||||
if (userInfo === '' || userInfo === null) {
|
||||
|
||||
} else {
|
||||
this.isLogin = true;
|
||||
@ -84,7 +88,6 @@
|
||||
},
|
||||
timingTask(userId) {
|
||||
this.$ajax.post("/hs/timingTask",{userId:userId},r=>{
|
||||
console.log(r)
|
||||
})
|
||||
},
|
||||
goPersonalInfo(userId) {
|
||||
@ -93,42 +96,22 @@
|
||||
this.$refs.child.getUserInfo();
|
||||
},
|
||||
goMore() {
|
||||
this.$message({
|
||||
message:"期待更多内容",
|
||||
})
|
||||
this.$notify("期待更多内容",)
|
||||
|
||||
},
|
||||
goMyClass() {
|
||||
if (JSON.parse(sessionStorage.getItem("userInfo")).class_name === undefined) {
|
||||
this.$message.warning("您没有加入任何班级")
|
||||
} else {
|
||||
if (this.isLogin === true) {
|
||||
this.$router.push({name: "myclass"})
|
||||
goToPage(path) {
|
||||
if (path === 'myclass') {
|
||||
if (JSON.parse(sessionStorage.getItem("userInfo")).class_name === undefined) {
|
||||
this.$message.warning("您没有加入任何班级")
|
||||
} else {
|
||||
this.$message.warning("请先登录")
|
||||
this.$router.push({name: "login"})
|
||||
this.$router.push({name: path})
|
||||
}
|
||||
} else {
|
||||
this.$router.push({name: path})
|
||||
}
|
||||
},
|
||||
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() {
|
||||
this.$message("请联系管理员重置密码")
|
||||
this.$notify("请联系管理员重置密码")
|
||||
},
|
||||
register() {
|
||||
this.$router.push({
|
||||
@ -139,10 +122,10 @@
|
||||
})
|
||||
},
|
||||
opinion() {
|
||||
this.$message('用户意见请发邮箱至:617594538@qq.com')
|
||||
this.$notify('用户意见请发邮箱至:617594538@qq.com')
|
||||
},
|
||||
service() {
|
||||
this.$message('客服中心请拨打:15006732580')
|
||||
this.$notify('客服中心请拨打:15006732580')
|
||||
},
|
||||
login() {
|
||||
this.$router.push({
|
||||
@ -161,10 +144,7 @@
|
||||
})
|
||||
// location.reload()
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: '已取消退出'
|
||||
});
|
||||
this.$notify.info('已取消退出');
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -13,7 +13,7 @@
|
||||
close-on-click-modal=false
|
||||
label-position="left">
|
||||
<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-select>
|
||||
</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>
|
||||
</el-option>
|
||||
</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 label="密码" prop="password">
|
||||
<el-input v-model="form.password" type="password" placeholder="请输入密码" @keyup.enter.native="login"></el-input>
|
||||
@ -55,23 +55,22 @@
|
||||
close-on-click-modal=false
|
||||
label-position="left">
|
||||
<el-form-item label="角色" prop="role">
|
||||
<el-select v-model="form1.role" placeholder="请选择">
|
||||
<!-- <el-option value="学生"></el-option>-->
|
||||
<el-select v-model="form1.role" placeholder="请选择角色">
|
||||
<el-option value="家长"></el-option>
|
||||
<el-option value="教师"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="realName">
|
||||
<el-input v-model="form1.realName" type="text"></el-input>
|
||||
<el-input v-model="form1.realName" placeholder="请输入姓名" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model="form1.mobile" type="text"></el-input>
|
||||
<el-input v-model="form1.mobile" placeholder="请输入手机号" type="text"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="密码" prop="password">
|
||||
<el-input v-model="form1.password" type="password"></el-input>
|
||||
<el-input v-model="form1.password" placeholder="请输入密码" type="password"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="确认密码" prop="againPassword" @keyup.enter.native="register">
|
||||
<el-input v-model="form1.againPassword" type="password"></el-input>
|
||||
<el-input v-model="form1.againPassword" placeholder="请确认密码" type="password"></el-input>
|
||||
</el-form-item>
|
||||
<el-button type="primary" @click="register">提 交</el-button>
|
||||
</el-form>
|
||||
@ -95,7 +94,7 @@
|
||||
}
|
||||
}
|
||||
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
|
||||
} else {
|
||||
type = "login"
|
||||
@ -197,19 +196,21 @@
|
||||
*/
|
||||
getUserType() {
|
||||
this.$ajax.post('/hs/getDictionariesData',{code: 'userType'},res => {
|
||||
console.log('用户类型字典项', res);
|
||||
this.userTypeList = res;
|
||||
this.userTypeList = res.data;
|
||||
})
|
||||
},
|
||||
forget() {
|
||||
this.$message("请联系管理员重置密码")
|
||||
this.$notify("请联系管理员重置密码")
|
||||
},
|
||||
login() {
|
||||
this.loading = true;
|
||||
this.$ajax.post("/hs/login",{role:this.form.role,username: this.form.username,password:this.form.password},r=>{
|
||||
if (r == '' || r == null) {
|
||||
this.$message.error('用户名和密码不匹配');
|
||||
this.loading = false;
|
||||
if (r.data === '' || r.data === null) {
|
||||
this.$notify.error('用户名和密码不匹配');
|
||||
} else if (r.data.take_effect === '0') {
|
||||
this.$notify.error('该账户未通过审核');
|
||||
} else if (r.data.frozen_state === '1') {
|
||||
this.$notify.error('该账户已冻结');
|
||||
} else {
|
||||
if (this.form.role === '管理员') {
|
||||
this.$router.push({
|
||||
@ -220,7 +221,7 @@
|
||||
name: "homepage"
|
||||
})
|
||||
}
|
||||
this.$message({
|
||||
this.$notify({
|
||||
message: "登录成功",
|
||||
type: "success"
|
||||
});
|
||||
@ -249,21 +250,20 @@
|
||||
sessionStorage.setItem("rememberList",JSON.stringify(rememberList));
|
||||
}
|
||||
}*/
|
||||
this.loading = false;
|
||||
sessionStorage.setItem("userInfo",JSON.stringify(r));
|
||||
sessionStorage.setItem("userInfo",JSON.stringify(r.data));
|
||||
// location.reload();
|
||||
}
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
register() {
|
||||
this.$ajax.post("/hs/register",{type:this.form1.role,realname:this.form1.realName,mobile:this.form1.mobile,password:this.form1.password},r=>{
|
||||
console.log(r)
|
||||
if (r == '0') {
|
||||
this.$message.error('该手机号已被注册');
|
||||
if (r.data === 0) {
|
||||
this.$notify.error('该手机号已被注册');
|
||||
this.form1.password = '';
|
||||
this.form1.againPassword = '';
|
||||
} else {
|
||||
this.$message({
|
||||
this.$notify({
|
||||
message: "注册成功",
|
||||
type: "success"
|
||||
});
|
||||
|
@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-main>
|
||||
<el-page-header @back="goBack" content="发布班级通知" v-if="addClassNotice"></el-page-header>
|
||||
<el-page-header @back="goBack" content="发布班级通知" v-if="addClassNotice"/>
|
||||
<addArticle
|
||||
v-if="addClassNotice"
|
||||
@editorTitle="editorTitle"
|
||||
@goInfo="goInfo"
|
||||
@refresh="refresh"
|
||||
></addArticle>
|
||||
/>
|
||||
<div class="search" v-if="!addClassNotice">
|
||||
<el-input class="searchinp" v-model="condition" placeholder="请输入内容" @keydown.enter.native="search"></el-input>
|
||||
<el-input class="searchinp" v-model="condition" placeholder="请输入内容" @keydown.enter.native="search"/>
|
||||
<el-button type="primary" class="searchbtn" @click="search">搜索</el-button>
|
||||
</div>
|
||||
<div class="class-bulletin" v-if="!addClassNotice">
|
||||
@ -22,21 +22,23 @@
|
||||
<el-button class="editor" @click="editor">编辑</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" v-if="!addClassNotice">
|
||||
<div class="list" v-loading="loading">
|
||||
<div class="title">班级通知</div>
|
||||
<el-button class="releasebut" size="small" @click="release" plain>发布通知</el-button>
|
||||
<nodate v-if="noDate"></nodate>
|
||||
<div class="one" v-for="item in noticeList" v-if="!noDate">
|
||||
<div class="type">[{{item.label}}]</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-time">{{item.release_time}}</div>
|
||||
<nodate v-if="noDate"/>
|
||||
<div class="list-in-box" v-if="!addClassNotice && !noDate">
|
||||
<div class="one" v-for="item in noticeList">
|
||||
<div class="type">[{{item.label}}]</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-time">{{item.release_time}}</div>
|
||||
</div>
|
||||
<p class="sum" v-if="!noDate">共{{length}}条数据</p>
|
||||
</div>
|
||||
<p class="sum" v-if="!noDate">共{{length}}条数据</p>
|
||||
</div>
|
||||
</el-main>
|
||||
<el-aside>
|
||||
<div class="title">班级成员</div>
|
||||
<div class="title">班级成员 <span v-if="userInfo.post==='班主任'" class="admin" @click="drawer=true">管理</span></div>
|
||||
<div class="students">
|
||||
<div class="student" v-for="item in students">
|
||||
<div class="header pointer">{{item.real_name.substring(0,1)}}</div>
|
||||
@ -65,19 +67,170 @@
|
||||
<el-button type="primary" @click="bulletinSubmit">确 定</el-button>
|
||||
</span>
|
||||
</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>
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDate } from '../assets/js/public.js'
|
||||
import { register, getPostList } from '@/api/index/user'
|
||||
import nodate from './components/NoData'
|
||||
import addArticle from './AddArticle'
|
||||
|
||||
export default {
|
||||
name: "MyClass",
|
||||
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,
|
||||
noDate: false,
|
||||
condition: '',
|
||||
@ -91,43 +244,205 @@
|
||||
},
|
||||
noticeList: '',
|
||||
length: '',
|
||||
students: '',
|
||||
students: [],
|
||||
//未加入班级学生
|
||||
noClassStudent: [],
|
||||
isNull: false,
|
||||
dialogVisible: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
|
||||
if (r.bulletin == null) {
|
||||
this.isNull = true;
|
||||
} else {
|
||||
this.bulletin = r.bulletin;
|
||||
}
|
||||
this.noticeList = r. noticeList;
|
||||
this.length = r. noticeList.length;
|
||||
this.students = r.students;
|
||||
if (r. noticeList.length === 0) {
|
||||
this.noDate = true
|
||||
}
|
||||
})
|
||||
this.getPostList();
|
||||
this.getPageDate()
|
||||
},
|
||||
watch: {
|
||||
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 {
|
||||
this.$ajax.post('/hs/updatePersonalInfo',
|
||||
{studentNumber: studentNumber, userId: row.user_id}, res => {
|
||||
if (res.data > 0) {
|
||||
this.$notify.success('修改成功');
|
||||
this.getPageDate()
|
||||
} else {
|
||||
this.$notify.error('网络异常,请刷新页面重新尝试')
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 将学生加入该班级
|
||||
*/
|
||||
handleAdd(row) {
|
||||
this.$ajax.post('/hs/updatePersonalInfo',
|
||||
{className: this.userInfo.class_name, userId: row.user_id}, res => {
|
||||
if (res.data > 0) {
|
||||
this.addStudentFlag = false;
|
||||
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() {
|
||||
this.addClassNotice = false
|
||||
},
|
||||
refresh() {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
|
||||
if (r.bulletin == null) {
|
||||
if (r.data.bulletin == null) {
|
||||
this.isNull = true;
|
||||
} else {
|
||||
this.bulletin = r.bulletin;
|
||||
this.bulletin = r.data.bulletin;
|
||||
}
|
||||
this.noticeList = r. noticeList;
|
||||
this.length = r. noticeList.length;
|
||||
this.students = r.students;
|
||||
if (r. noticeList.length === 0) {
|
||||
this.noticeList = r.data. noticeList;
|
||||
this.length = r.data. noticeList.length;
|
||||
this.students = r.data.students;
|
||||
if (r.data.noticeList.length === 0) {
|
||||
this.noDate = true
|
||||
}
|
||||
})
|
||||
@ -140,25 +455,24 @@
|
||||
},
|
||||
release() {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
if (userInfo.user_type === "教师") {
|
||||
this.addClassNotice = true
|
||||
if (userInfo.post === "班主任" || userInfo.post === "班长") {
|
||||
this.addClassNotice = true;
|
||||
sessionStorage.setItem("releaseType","classNotice")
|
||||
} else {
|
||||
this.$message.error("没有权限发布通知")
|
||||
this.$notify.error("没有权限发布通知")
|
||||
}
|
||||
},
|
||||
bulletinSubmit() {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
if (this.isNull === false) {
|
||||
this.$ajax.post("/hs/updateBulletin",{classId:userInfo.class_id,
|
||||
className:userInfo.class_name,title:this.editors.title,content:this.editors.content,
|
||||
releaseTime:getDate(),id:this.bulletin.id},r=>{
|
||||
if (r === 1) {
|
||||
className:userInfo.class_name,title:this.editors.title,content:this.editors.content,id:this.bulletin.id},r=>{
|
||||
if (r.data === 1) {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
|
||||
this.bulletin = r.bulletin;
|
||||
this.bulletin = r.data.bulletin;
|
||||
})
|
||||
this.$message({
|
||||
this.$notify({
|
||||
type:'success',
|
||||
message: '编辑公告成功'
|
||||
})
|
||||
@ -168,12 +482,12 @@
|
||||
this.$ajax.post("/hs/addBulletin",{classId:userInfo.class_id,
|
||||
className:userInfo.class_name,title:this.editors.title,content:this.editors.content,
|
||||
releaseTime:getDate()},r=>{
|
||||
if (r === 1) {
|
||||
if (r.data === 1) {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id},r=>{
|
||||
this.bulletin = r.bulletin;
|
||||
this.bulletin = r.data.bulletin;
|
||||
})
|
||||
this.$message({
|
||||
this.$notify({
|
||||
type:'success',
|
||||
message: '编辑公告成功'
|
||||
})
|
||||
@ -184,20 +498,20 @@
|
||||
},
|
||||
editor() {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
if (userInfo.user_type === "教师") {
|
||||
if (userInfo.user_type === "教师" || userInfo.post === '班主任' || userInfo.post === '班长') {
|
||||
this.dialogVisible = true;
|
||||
this.editors.title = this.bulletin.title;
|
||||
this.editors.content = this.bulletin.content;
|
||||
} else {
|
||||
this.$message.error("没有权限编辑公告")
|
||||
this.$notify.error("没有权限编辑公告")
|
||||
}
|
||||
},
|
||||
search() {
|
||||
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"))
|
||||
sessionStorage.setItem("condition",this.condition)
|
||||
this.$ajax.post("/hs/getClassInfo",{id:userInfo.user_id,text:this.condition},r=>{
|
||||
this.noticeList = r. noticeList
|
||||
this.length = r. noticeList.length
|
||||
this.noticeList = r.data.noticeList
|
||||
this.length = r.data.noticeList.length
|
||||
})
|
||||
},
|
||||
getContent(id) {
|
||||
@ -217,7 +531,30 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" 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{
|
||||
padding: 1rem;
|
||||
background: #fff;
|
||||
@ -247,6 +584,9 @@
|
||||
padding: 1rem;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
.list {
|
||||
min-height: 10rem;
|
||||
}
|
||||
.list .title{
|
||||
padding-bottom: 1rem;
|
||||
font-size: 1.5rem;
|
||||
@ -353,6 +693,7 @@
|
||||
line-height: 1.5rem;
|
||||
margin-left: 0.5rem;
|
||||
flex: 1;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.student .post{
|
||||
line-height: 1.5rem;
|
||||
|
@ -7,14 +7,16 @@
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="title">家长建议</div>
|
||||
<nodate v-if="noDate"></nodate>
|
||||
<div class="one" v-for="item in adviceList" v-if="!noDate">
|
||||
<div class="type">[{{item.label}}]</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-time">{{item.release_time}}</div>
|
||||
<div class="list-box" v-loading="loading">
|
||||
<nodate v-if="noDate"></nodate>
|
||||
<div class="one" v-for="item in adviceList" v-if="!noDate">
|
||||
<div class="type">[{{item.label}}]</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-time">{{item.release_time}}</div>
|
||||
</div>
|
||||
<p class="sum" v-if="!noDate">共{{length}}条数据</p>
|
||||
</div>
|
||||
<p class="sum" v-if="!noDate">共{{length}}条数据</p>
|
||||
</div>
|
||||
</el-main>
|
||||
<el-aside>
|
||||
@ -31,6 +33,8 @@
|
||||
name: "ParentsOpinion",
|
||||
data() {
|
||||
return{
|
||||
//加载标志
|
||||
loading: false,
|
||||
condition: '',
|
||||
adviceList: '',
|
||||
length: '',
|
||||
@ -38,20 +42,22 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loading = true;
|
||||
this.$ajax.post("/hs/getListByAttribute",{text:"",type:"家长建议"},r=>{
|
||||
this.adviceList = r
|
||||
this.length = r.length
|
||||
if (r.length === 0) {
|
||||
this.adviceList = r.data
|
||||
this.length = r.data.length
|
||||
if (r.data.length === 0) {
|
||||
this.noDate = true
|
||||
}
|
||||
this.loading = false;
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.$ajax.post("/hs/getListByAttribute",{text:this.condition,type:"家长建议"},r=>{
|
||||
this.adviceList = r
|
||||
this.length = r.length
|
||||
if (r.length === 0) {
|
||||
this.length = r.data.length
|
||||
if (r.data.length === 0) {
|
||||
this.noDate = true
|
||||
}
|
||||
})
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -52,10 +52,10 @@
|
||||
mounted() {
|
||||
this.$ajax.post("/hs/getListByAttribute",{type:"校园通知",text:''},r=>{
|
||||
let list = [];
|
||||
for (let i = 0; i < r.length; i++) {
|
||||
for (let i = 0; i < r.data.length; i++) {
|
||||
let one = {};
|
||||
one.date = r[i].release_time.substring(0,10);
|
||||
one.content = r[i].label;
|
||||
one.date = r.data[i].release_time.substring(0,10);
|
||||
one.content = r.data[i].label;
|
||||
list.push(one)
|
||||
}
|
||||
this.resDate = list
|
||||
@ -76,11 +76,10 @@
|
||||
},
|
||||
getDay(date) {
|
||||
this.dialogVisible = true
|
||||
console.log(date)
|
||||
this.$ajax.post("/hs/getListByAttribute",{release_time: date.day,text: '',type:"校园通知"},
|
||||
r=> {
|
||||
this.list = r;
|
||||
this.length = r.length;
|
||||
this.list = r.data;
|
||||
this.length = r.data.length;
|
||||
})
|
||||
},
|
||||
dealMyDate(v) {
|
||||
|
@ -7,14 +7,16 @@
|
||||
</div>
|
||||
<div class="list">
|
||||
<div class="title">学生想法</div>
|
||||
<nodate v-if="noDate"></nodate>
|
||||
<div class="one" v-for="item in thinkingList" v-if="!noDate">
|
||||
<div class="type">[{{item.label}}]</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-time">{{item.release_time}}</div>
|
||||
<div class="list-box" v-loading="loading">
|
||||
<nodate v-if="noDate"/>
|
||||
<div class="one" v-for="item in thinkingList" v-if="!noDate">
|
||||
<div class="type">[{{item.label}}]</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-time">{{item.release_time}}</div>
|
||||
</div>
|
||||
<p class="sum" v-if="!noDate">共{{length}}条数据</p>
|
||||
</div>
|
||||
<p class="sum" v-if="!noDate">共{{length}}条数据</p>
|
||||
</div>
|
||||
</el-main>
|
||||
<el-aside>
|
||||
@ -31,7 +33,8 @@
|
||||
name: "StudentThought",
|
||||
data() {
|
||||
return{
|
||||
noDate: '',
|
||||
//加載标志
|
||||
loading: false,
|
||||
condition: '',
|
||||
thinkingList: '',
|
||||
length: '',
|
||||
@ -39,17 +42,19 @@
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.loading = true;
|
||||
this.$ajax.post("/hs/getListByAttribute",{text:"",type:"学生想法"},r=>{
|
||||
this.thinkingList = r
|
||||
this.length = r.length
|
||||
this.thinkingList = r.data;
|
||||
this.length = r.data.length;
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
search() {
|
||||
this.$ajax.post("/hs/getListByAttribute",{text:this.condition,type:"学生想法"},r=>{
|
||||
this.thinkingList = r
|
||||
this.length = r.length
|
||||
if (r.length === 0) {
|
||||
this.thinkingList = r.data
|
||||
this.length = r.data.length
|
||||
if (r.data.length === 0) {
|
||||
this.noDate = true
|
||||
}
|
||||
})
|
||||
|
100
HSLink-front/src/components/components/Pagination/index.vue
Normal file
100
HSLink-front/src/components/components/Pagination/index.vue
Normal file
@ -0,0 +1,100 @@
|
||||
<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>
|
@ -6,15 +6,20 @@ import 'element-ui/lib/theme-chalk/index.css'
|
||||
import App from './App'
|
||||
import router from './router'
|
||||
import '@/assets/css/public.css'
|
||||
// 引用API文件
|
||||
import api from './api/index.js'
|
||||
import axios from 'axios'
|
||||
Vue.prototype.$axios = axios;
|
||||
// 将API方法绑定到全局
|
||||
import marked from 'marked'
|
||||
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.$ajax = api;
|
||||
Vue.component('Pagination', Pagination);
|
||||
Vue.config.productionTip = false;
|
||||
Vue.use(mavonEditor);
|
||||
Vue.use(ElementUI);
|
||||
Vue.use(scroll);
|
||||
/* eslint-disable no-new */
|
||||
|
12
HSLink-front/src/util/request.js
Normal file
12
HSLink-front/src/util/request.js
Normal file
@ -0,0 +1,12 @@
|
||||
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
|
58
HSLink-front/src/util/scroll-to.js
Normal file
58
HSLink-front/src/util/scroll-to.js
Normal file
@ -0,0 +1,58 @@
|
||||
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()
|
||||
}
|
@ -88,7 +88,6 @@
|
||||
},
|
||||
timingTask(userId) {
|
||||
this.$ajax.post("/hs/timingTask",{userId:userId},r=>{
|
||||
console.log(r)
|
||||
})
|
||||
},
|
||||
goPersonalInfo(userId) {
|
||||
@ -97,9 +96,7 @@
|
||||
this.$refs.child.getUserInfo();
|
||||
},
|
||||
goMore() {
|
||||
this.$message({
|
||||
message:"期待更多内容",
|
||||
})
|
||||
this.$notify.info("期待更多内容")
|
||||
|
||||
},
|
||||
help() {
|
||||
@ -108,7 +105,7 @@
|
||||
})
|
||||
},
|
||||
forget() {
|
||||
this.$message("请联系管理员重置密码")
|
||||
this.$notify.info("请联系管理员重置密码")
|
||||
},
|
||||
register() {
|
||||
this.$router.push({
|
||||
@ -119,10 +116,10 @@
|
||||
})
|
||||
},
|
||||
opinion() {
|
||||
this.$message('用户意见请发邮箱至:617594538@qq.com')
|
||||
this.$notify.info('用户意见请发邮箱至:617594538@qq.com')
|
||||
},
|
||||
service() {
|
||||
this.$message('客服中心请拨打:15006732580')
|
||||
this.$notify.info('客服中心请拨打:15006732580')
|
||||
},
|
||||
login() {
|
||||
this.$router.push({
|
||||
@ -141,7 +138,7 @@
|
||||
})
|
||||
// location.reload()
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
this.$notify({
|
||||
type: 'info',
|
||||
message: '已取消退出'
|
||||
});
|
||||
|
@ -1,33 +1,57 @@
|
||||
<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.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>
|
||||
<no-date v-if="noDate"></no-date>
|
||||
<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="article-label box">文章标签</div>
|
||||
<div class="author box">发表人</div>
|
||||
<div class="time box">发表时间</div>
|
||||
<div class="function box">操作</div>
|
||||
</div>
|
||||
<div class="table-content">
|
||||
<div class="one-data" v-for="(article, index) in articleList" :key="index">
|
||||
<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-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="author box theme-font-blue special-text" @click="goPersonalInfo(article.releaseId)">{{article.releaseName}}</div>
|
||||
<div class="time box">{{article.releaseTime}}</div>
|
||||
<div class="function box">
|
||||
<el-button type="success" size='mini' @click="verifyArticle(article, '1')">通过</el-button>
|
||||
<el-button type="danger" size='mini' @click="verifyArticle(article, '2')">驳回</el-button>
|
||||
</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="article-label box">文章标签</div>
|
||||
<div class="author box">发表人</div>
|
||||
<div class="time box">发表时间</div>
|
||||
<div class="function box">操作</div>
|
||||
</div>
|
||||
<div class="table-content">
|
||||
<div class="one-data" v-for="(article, index) in articleList" :key="index">
|
||||
<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-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="author box theme-font-blue special-text" @click="goPersonalInfo(article.releaseId)">{{article.releaseName}}</div>
|
||||
<div class="time box">{{article.releaseTime}}</div>
|
||||
<div class="function box">
|
||||
<el-button type="success" size='mini' @click="verifyArticle(article, '1')">通过</el-button>
|
||||
<el-button type="danger" size='mini' @click="verifyArticle(article, '2')">驳回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="number">共{{articleList.length}}条数据</div>
|
||||
</div>
|
||||
<div class="number">共{{articleList.length}}条数据</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,6 +65,13 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//参数
|
||||
queryParams: {
|
||||
content: '',
|
||||
author: ''
|
||||
},
|
||||
//加载标志
|
||||
loading: false,
|
||||
//待审核文章列表
|
||||
articleList: [],
|
||||
//无数据
|
||||
@ -69,9 +100,8 @@
|
||||
articleId: item.articleId,
|
||||
operating: operating
|
||||
}, res => {
|
||||
console.log("审核结果", res);
|
||||
if (res > 0) {
|
||||
this.$message({
|
||||
if (res.data > 0) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: `${OPERATING[operating]}成功`
|
||||
});
|
||||
@ -79,10 +109,7 @@
|
||||
_this.getVerifyList();
|
||||
}, 1000)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '服务器出小差了,请稍后再试'
|
||||
});
|
||||
this.$notify.error('服务器出小差了,请稍后再试');
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -91,14 +118,15 @@
|
||||
* 获取待审核文章列表
|
||||
*/
|
||||
getVerifyList() {
|
||||
this.$ajax.post('/admin/getVerifyList', {}, res => {
|
||||
console.log('待审核文章列表', res);
|
||||
if (res.length > 0) {
|
||||
this.loading = true;
|
||||
this.$ajax.post('/admin/getVerifyList', this.queryParams, res => {
|
||||
if (res.data.length > 0) {
|
||||
this.noDate = false;
|
||||
this.articleList = res;
|
||||
this.articleList = res.data;
|
||||
} else {
|
||||
this.noDate = true;
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
/**
|
||||
|
@ -32,9 +32,8 @@
|
||||
* 切换tab
|
||||
*/
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -53,13 +53,12 @@
|
||||
*/
|
||||
getHelpAnswerList() {
|
||||
this.$ajax.post('/admin/getHelpAnswerList', {}, res => {
|
||||
res.forEach(item => {
|
||||
res.data.forEach(item => {
|
||||
if (item.answer_id !== undefined) {
|
||||
this.historyHelpList.push(item);
|
||||
}
|
||||
this.historyHelpNoData = this.historyHelpList.length === 0 ? true : false;
|
||||
});
|
||||
console.log('历史帮助答复列表', this.historyHelpList);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -49,14 +49,13 @@
|
||||
answerId: userInfo.user_id,
|
||||
answer: value,
|
||||
id: help.id}, res => {
|
||||
console.log('帮助解决', res);
|
||||
if (res === 1) {
|
||||
this.$message({
|
||||
if (res.data === 1) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: '提交成功'
|
||||
});
|
||||
} else {
|
||||
this.$message.error("提交失败")
|
||||
this.$notify.error("提交失败")
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -73,13 +72,12 @@
|
||||
*/
|
||||
getHelpAnswerList() {
|
||||
this.$ajax.post('/admin/getHelpAnswerList', {}, res => {
|
||||
res.forEach(item => {
|
||||
res.data.forEach(item => {
|
||||
if (item.answer_id === undefined) {
|
||||
this.notHelpList.push(item);
|
||||
}
|
||||
this.notHelpNoData = this.notHelpList.length === 0 ? true : false;
|
||||
});
|
||||
console.log('未帮助答复列表', this.notHelpList);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@
|
||||
<rotation-photo-management></rotation-photo-management>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="版块管理" name="2">
|
||||
<plate-management></plate-management>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</div>
|
||||
@ -12,9 +13,11 @@
|
||||
|
||||
<script>
|
||||
import rotationPhotoManagement from '@/view/admin/homepageManagement/homepageManagement/RotationPhotoManagement';
|
||||
import plateManagement from '@/view/admin/homepageManagement/plateManagement/PlateManagement.vue';
|
||||
export default {
|
||||
components: {
|
||||
rotationPhotoManagement
|
||||
rotationPhotoManagement,
|
||||
plateManagement
|
||||
},
|
||||
name: "HomepageManagement",
|
||||
data() {
|
||||
@ -29,9 +32,8 @@
|
||||
* 切换tab
|
||||
*/
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1,13 +1,12 @@
|
||||
<template>
|
||||
<div>
|
||||
<div class="title">轮播图管理</div>
|
||||
<div class="img-list">
|
||||
<div class="img-list" v-loading="loading">
|
||||
<div class="img" v-for="(img, index) in rotationPhotoList" :key='index'>
|
||||
<el-image class="rotation-photo"
|
||||
:src='imgPath(img)'
|
||||
<el-image class="rotation-photo"
|
||||
:src='imgPath(img)'
|
||||
:preview-src-list="srcList"
|
||||
fit='scale-down'></el-image>
|
||||
<i class="el-icon-circle-close delete-icon pointer" @click="deleteImg(img)"></i>
|
||||
fit='scale-down'/>
|
||||
<i class="el-icon-circle-close delete-icon pointer" @click="deleteImg(img)"/>
|
||||
</div>
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
@ -17,10 +16,9 @@
|
||||
:on-success='success'
|
||||
:on-error='error'>
|
||||
<div class="add-img pointer">
|
||||
<i class="el-icon-plus"></i>
|
||||
<i class="el-icon-plus"/>
|
||||
</div>
|
||||
</el-upload>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -29,6 +27,8 @@
|
||||
export default {
|
||||
data() {
|
||||
return{
|
||||
//加载标志
|
||||
loading: false,
|
||||
//轮播图图片
|
||||
rotationPhotoList: [],
|
||||
//轮播图片URL列表
|
||||
@ -45,31 +45,24 @@
|
||||
* 上传图片成功
|
||||
*/
|
||||
success(response, file, fileList) {
|
||||
console.log('上传图片', response);
|
||||
this.$ajax.post('/admin/uploadRotationPhoto', {fileId: response.fileInfo.id}, res => {
|
||||
if (res === 1) {
|
||||
this.$message({
|
||||
if (res.data === 1) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: '上传成功'
|
||||
})
|
||||
this.getRotationPhotoList();
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '网络异常,请稍后再试'
|
||||
})
|
||||
this.$notify.error('网络异常,请稍后再试')
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
/**
|
||||
* 上传图片失败
|
||||
*/
|
||||
error() {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '网络异常,请稍后再试'
|
||||
})
|
||||
this.$notify.error('网络异常,请稍后再试')
|
||||
},
|
||||
/**
|
||||
* 删除图片
|
||||
@ -79,17 +72,14 @@
|
||||
id: img.id,
|
||||
fileEncryption: img.fileEncryption
|
||||
}, res => {
|
||||
if (res === 1) {
|
||||
this.$message({
|
||||
if (res.data === 1) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: '删除成功'
|
||||
})
|
||||
this.getRotationPhotoList();
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '网络异常,请稍后再试'
|
||||
})
|
||||
this.$notify.error('网络异常,请稍后再试')
|
||||
}
|
||||
})
|
||||
},
|
||||
@ -101,14 +91,15 @@
|
||||
},
|
||||
//获取轮播图片
|
||||
getRotationPhotoList() {
|
||||
this.loading = true;
|
||||
this.$ajax.post('/hs/getRotationPhotoList',{},res=>{
|
||||
console.log("轮播图列表",res);
|
||||
if (res.rotationPhotoList.length > 0) {
|
||||
this.rotationPhotoList = res.rotationPhotoList;
|
||||
res.rotationPhotoList.forEach(img => {
|
||||
if (res.data.rotationPhotoList.length > 0) {
|
||||
this.rotationPhotoList = res.data.rotationPhotoList;
|
||||
res.data.rotationPhotoList.forEach(img => {
|
||||
this.srcList.push(`${sessionStorage.getItem('url')}/hs/showImg/${img.fileEncryption}`)
|
||||
});
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
}
|
||||
|
@ -0,0 +1,241 @@
|
||||
<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>
|
@ -27,7 +27,6 @@
|
||||
},
|
||||
methods: {
|
||||
handleClick(tab, event) {
|
||||
console.log(tab, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,38 +1,132 @@
|
||||
<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>
|
||||
<no-date v-if="noDate"></no-date>
|
||||
<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="article-type box">是否冻结</div>
|
||||
<div class="function box">操作</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="article-type 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="article-type box" :class="person.frozen_state === '0' ? 'theme-font-green' : 'theme-font-red'">{{person.frozen_state === '0' ? '未冻结' : '已冻结'}}</div>
|
||||
<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="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 class="number">共{{personList.length}}条数据</div>
|
||||
</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="article-type box" :class="person.frozen_state === '0' ? 'theme-font-green' : 'theme-font-red'">{{person.frozen_state === '0' ? '未冻结' : '已冻结'}}</div>
|
||||
<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="success" size='mini' @click="peopleManagement(person, '0')" v-if="person.frozen_state === '1'">解冻</el-button>
|
||||
</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 class="number">共{{personList.length}}条数据</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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import noDate from '@/components/components/NoData'
|
||||
import { getClassList } from '@/api/index/user'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -41,16 +135,87 @@
|
||||
name: "PersonnelManagement",
|
||||
data() {
|
||||
return{
|
||||
//加载标志
|
||||
loading: false,
|
||||
//班级列表
|
||||
classList: [],
|
||||
//参数
|
||||
queryParams: {
|
||||
name: '',
|
||||
userType: ''
|
||||
},
|
||||
//角色列表
|
||||
userTypeList: [],
|
||||
//职务列表
|
||||
postList: [
|
||||
{label: '无', value: '无'},
|
||||
{label: '班主任', value: '班主任'},
|
||||
],
|
||||
//编辑信息弹框标志
|
||||
dialogVisible: false,
|
||||
//无数据
|
||||
noDate: true,
|
||||
//人员列表
|
||||
personList: []
|
||||
personList: [],
|
||||
//个人信息
|
||||
personInfo: {}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getUserType();
|
||||
this.getClassList();
|
||||
this.getFollowPeopleList()
|
||||
},
|
||||
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
|
||||
@ -70,9 +235,8 @@
|
||||
userId: item.user_id,
|
||||
operating: operating
|
||||
}, res => {
|
||||
console.log("人员操作结果", res);
|
||||
if (res > 0) {
|
||||
this.$message({
|
||||
if (res.data > 0) {
|
||||
this.$notify({
|
||||
type: 'success',
|
||||
message: `${OPERATING[operating]+item.real_name}成功`
|
||||
});
|
||||
@ -80,10 +244,7 @@
|
||||
_this.getFollowPeopleList();
|
||||
}, 1000)
|
||||
} else {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '服务器出小差了,请稍后再试'
|
||||
});
|
||||
this.$notify.error('服务器出小差了,请稍后再试');
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -99,21 +260,46 @@
|
||||
* 获取人员列表
|
||||
*/
|
||||
getFollowPeopleList() {
|
||||
this.$ajax.post('/admin/getPersonnelManagement', {}, res => {
|
||||
console.log('人员列表', res);
|
||||
if (res.length > 0) {
|
||||
this.personList = res;
|
||||
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>
|
||||
|
||||
<style scoped>
|
||||
<style lang="scss" 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{
|
||||
margin-left: 0;
|
||||
}
|
||||
@ -159,6 +345,10 @@
|
||||
}
|
||||
.box{
|
||||
text-align: center;
|
||||
display: flex;
|
||||
.el-button {
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
}
|
||||
.table-header{
|
||||
color: #999;
|
||||
|
@ -1,13 +1,230 @@
|
||||
<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>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "RegistrationManagement"
|
||||
import noDate from '@/components/components/NoData'
|
||||
import { delPerson, editPerson } from '@/api/index/user'
|
||||
|
||||
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>
|
||||
|
||||
<style scoped>
|
||||
|
||||
<style lang="scss" 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>
|
||||
|
@ -67,16 +67,14 @@
|
||||
getPhoto() {
|
||||
this.$ajax.post('/hs/getFileList',{},r=>{
|
||||
this.fileList = [];
|
||||
for (let i = 0; i < r.fileList.length; i++) {
|
||||
this.fileList.push({path: require('../assets/file/'+r.fileList[i].fileEncryption)})
|
||||
for (let i = 0; i < r.data.fileList.length; i++) {
|
||||
this.fileList.push({path: require('../assets/file/'+r.data.fileList[i].fileEncryption)})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleRemove(file, fileList) {
|
||||
console.log(file, fileList);
|
||||
},
|
||||
handlePreview(file) {
|
||||
console.log(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
107
README.md
107
README.md
@ -1,17 +1,98 @@
|
||||
# HSLink
|
||||
毕设:家校通
|
||||
<p align=center>
|
||||
<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 "在这里输入图片标题")
|
||||
|
||||
|
||||
前端:Vue
|
||||
|
||||
后端:SpringBoot
|
||||
|
||||
数据库:MySQL
|
||||
|
||||
移动端:uni-app
|
||||
|
||||
有需要完整内容的可以加我QQ:617594538;备注写清意图
|
||||
|
||||
## HSLink -> [点击跳转](http://pnkx.top:8862)
|
||||
|
Loading…
Reference in New Issue
Block a user