2021/01/06

This commit is contained in:
裴浩宇 2021-01-06 17:55:16 +08:00
parent 734b46ab5d
commit bde4fa133d
21 changed files with 434 additions and 37 deletions

View File

@ -171,8 +171,8 @@
this.historyHelpList.push(item); this.historyHelpList.push(item);
} }
}) })
this.notHelpNoData = res.data.length === 0 ? true : false; this.notHelpNoData = this.notHelpList.length === 0 ? true : false;
this.historyHelpNoData = res.data.length === 0 ? true : false; this.historyHelpNoData = this.historyHelpList.length === 0 ? true : false;
console.log("历史帮助列表",res); console.log("历史帮助列表",res);
},err => { },err => {
console.log("err",err); console.log("err",err);

View File

@ -1,7 +1,6 @@
package com.qinxx.hslink.controller; package com.qinxx.hslink.controller;
import com.qinxx.hslink.service.AdminHSService; import com.qinxx.hslink.service.AdminHSService;
import com.qinxx.hslink.service.HSService;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -146,4 +145,30 @@ public class AdminHSController {
return result; return result;
} }
/**
* 上传轮播图
* @param param
* @return
*/
@PostMapping("/uploadRotationPhoto")
@ResponseBody
public Map<String, Object> uploadRotationPhoto(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.uploadRotationPhoto(param);
return result;
}
/**
* 删除轮播图
* @param param
* @return
*/
@PostMapping("/deleteRotationPhoto")
@ResponseBody
public Map<String, Object> deleteRotationPhoto(@RequestBody Map<String,Object> param){
Map<String, Object> result = new HashMap<>();
result = AdminhsService.deleteRotationPhoto(param);
return result;
}
} }

View File

@ -1,22 +1,16 @@
package com.qinxx.hslink.controller; package com.qinxx.hslink.controller;
import com.qinxx.hslink.service.HSService; import com.qinxx.hslink.service.HSService;
import org.apache.ibatis.annotations.Param;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
import java.io.*; import java.io.*;
import java.net.URLEncoder;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -80,4 +80,18 @@ public interface AdminHSMapper {
* @return * @return
*/ */
List<Map<String, Object>> getRegisterManagementData(Map<String, Object> param); List<Map<String, Object>> getRegisterManagementData(Map<String, Object> param);
/**
* 上传轮播图
* @param param
* @return
*/
int uploadRotationPhoto(Map<String, Object> param);
/**
* 删除轮播图
* @param param
* @return
*/
int deleteRotationPhoto(Map<String, Object> param);
} }

View File

@ -9,6 +9,13 @@
( uuid(), (SELECT release_id FROM hs_notice WHERE id = #{articleId}), #{articleId}, #{operating}, now( ) ) ( uuid(), (SELECT release_id FROM hs_notice WHERE id = #{articleId}), #{articleId}, #{operating}, now( ) )
</insert> </insert>
<!--上传轮播图-->
<insert id="uploadRotationPhoto" parameterType="map">
INSERT INTO hs_file_type ( id, file_id, type_code, type_name, create_time )
VALUES
( uuid( ), #{fileId}, 'rotationChart', '轮播图', now( ) )
</insert>
<!--审核文章(通过/驳回)--> <!--审核文章(通过/驳回)-->
<update id="verifyArticle" parameterType="map"> <update id="verifyArticle" parameterType="map">
UPDATE hs_notice set is_pass = #{operating} where id = #{articleId} UPDATE hs_notice set is_pass = #{operating} where id = #{articleId}
@ -34,6 +41,11 @@
update hs_user set take_effect = #{takeEffect} where user_id = #{userId} update hs_user set take_effect = #{takeEffect} where user_id = #{userId}
</update> </update>
<!--删除轮播图-->
<delete id="deleteRotationPhoto" parameterType="map">
DELETE from hs_file_type where id = #{id}
</delete>
<!--获取待审核文章数据--> <!--获取待审核文章数据-->
<select id="getVerifyList" parameterType="map" resultType="map"> <select id="getVerifyList" parameterType="map" resultType="map">
SELECT SELECT

View File

@ -69,4 +69,18 @@ public interface AdminHSService {
* @return * @return
*/ */
Map<String, Object> getRegisterManagementData(Map<String, Object> param); Map<String, Object> getRegisterManagementData(Map<String, Object> param);
/**
* 上传轮播图
* @param param
* @return
*/
Map<String, Object> uploadRotationPhoto(Map<String, Object> param);
/**
* 删除轮播图
* @param param
* @return
*/
Map<String, Object> deleteRotationPhoto(Map<String, Object> param);
} }

View File

@ -1,13 +1,14 @@
package com.qinxx.hslink.service.impl; package com.qinxx.hslink.service.impl;
import com.qinxx.hslink.dao.AdminHSMapper; import com.qinxx.hslink.dao.AdminHSMapper;
import com.qinxx.hslink.dao.HSLinkMapper;
import com.qinxx.hslink.service.AdminHSService; import com.qinxx.hslink.service.AdminHSService;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -25,6 +26,9 @@ public class AdminHSServiceImpl implements AdminHSService {
@Resource @Resource
AdminHSMapper adminHSMapper; AdminHSMapper adminHSMapper;
/**文件路径*/
@Value("${filePath}")
private String filesPath;
/** /**
* 获取待审核文章数据 * 获取待审核文章数据
* @param param * @param param
@ -175,4 +179,44 @@ public class AdminHSServiceImpl implements AdminHSService {
result.put("success",true); result.put("success",true);
return result; return result;
} }
/**
* 上传轮播图
* @param param
* @return
*/
@Override
public Map<String, Object> uploadRotationPhoto(Map<String, Object> param) {
int res = 0;
Map<String, Object> result = new HashMap<>();
try {
res = adminHSMapper.uploadRotationPhoto(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
@Override
public Map<String, Object> deleteRotationPhoto(Map<String, Object> param) {
int res = 0;
File file = new File(filesPath + "\\" + param.get("fileEncryption"));
// 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) {
file.delete();
}
Map<String, Object> result = new HashMap<>();
try {
res = adminHSMapper.deleteRotationPhoto(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
} }

View File

@ -359,7 +359,7 @@ public class HSServiceImpl implements HSService {
if(httpServletRequest instanceof MultipartHttpServletRequest){ if(httpServletRequest instanceof MultipartHttpServletRequest){
multipartHttpServletRequest = (MultipartHttpServletRequest) httpServletRequest; multipartHttpServletRequest = (MultipartHttpServletRequest) httpServletRequest;
}else{ }else{
return dealResultMap(false, "上传失败"); return dealResultMap(false, "上传失败", new HashMap<>());
} }
//获取MultipartFile文件信息(注意参数为前端对应的参数名称) //获取MultipartFile文件信息(注意参数为前端对应的参数名称)
MultipartFile mf = multipartHttpServletRequest.getFile("file"); MultipartFile mf = multipartHttpServletRequest.getFile("file");
@ -380,7 +380,7 @@ public class HSServiceImpl implements HSService {
mf.transferTo(file); mf.transferTo(file);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
return dealResultMap(false, "上传失败"); return dealResultMap(false, "上传失败", new HashMap<>());
} }
//保存文件路径 //保存文件路径
Map<String,Object> param = new HashMap<>(); Map<String,Object> param = new HashMap<>();
@ -389,7 +389,7 @@ public class HSServiceImpl implements HSService {
param.put("fileEncryption",id+fileName); param.put("fileEncryption",id+fileName);
param.put("filePath",String.valueOf(file)); param.put("filePath",String.valueOf(file));
hsLinkMapper.insertFilePath(param); hsLinkMapper.insertFilePath(param);
return dealResultMap(true, "上传成功"); return dealResultMap(true, "上传成功", param);
} }
@Override @Override
@ -764,10 +764,13 @@ public class HSServiceImpl implements HSService {
* @param message * @param message
* @return * @return
*/ */
private Map<String, Object> dealResultMap(boolean flag, String message) { private Map<String, Object> dealResultMap(boolean flag,
String message,
Map<String, Object> fileInfo) {
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
map.put("flag",flag); map.put("flag",flag);
map.put("message",message); map.put("message",message);
map.put("fileInfo", fileInfo);
return map; return map;
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1 +0,0 @@
测试文件

View File

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

View File

@ -8,6 +8,8 @@
<span class="pointer special-font-blue " v-if="isLogin" @click="goPersonalInfo(userInfo.user_id)">欢迎{{userInfo.real_name}}{{userInfo.user_type}}</span> <span class="pointer special-font-blue " v-if="isLogin" @click="goPersonalInfo(userInfo.user_id)">欢迎{{userInfo.real_name}}{{userInfo.user_type}}</span>
<span class="pointer special-font-blue " v-if="isLogin" @click="cancellation">注销</span> <span class="pointer special-font-blue " v-if="isLogin" @click="cancellation">注销</span>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<span class="pointer special-font-blue " v-if="userInfo.user_type === '管理员'" @click="admin">后台管理</span>
<el-divider direction="vertical"></el-divider>
<span class="pointer special-font-blue" @click="service">客服中心</span> <span class="pointer special-font-blue" @click="service">客服中心</span>
<el-divider direction="vertical"></el-divider> <el-divider direction="vertical"></el-divider>
<span class="pointer special-font-blue" @click="opinion">用户意见</span> <span class="pointer special-font-blue" @click="opinion">用户意见</span>
@ -74,6 +76,12 @@
+day2.getMinutes():day2.getMinutes())+"分"+(day2.getSeconds()<10?"0"+day2.getSeconds():day2.getSeconds())+"";},1000) +day2.getMinutes():day2.getMinutes())+"分"+(day2.getSeconds()<10?"0"+day2.getSeconds():day2.getSeconds())+"";},1000)
}, },
methods:{ methods:{
/**
* 跳转到后台管理模式
*/
admin() {
this.$router.push({name: 'homepagemanagement'});
},
timingTask(userId) { timingTask(userId) {
this.$ajax.post("/hs/timingTask",{userId:userId},r=>{ this.$ajax.post("/hs/timingTask",{userId:userId},r=>{
console.log(r) console.log(r)

View File

@ -213,7 +213,7 @@
} else { } else {
if (this.form.role === '管理员') { if (this.form.role === '管理员') {
this.$router.push({ this.$router.push({
name: "admin" name: "homepagemanagement"
}) })
} else { } else {
this.$router.push({ this.$router.push({

View File

@ -173,6 +173,8 @@
margin-top: 1rem; margin-top: 1rem;
text-align: center; text-align: center;
height: 21rem; height: 21rem;
position: sticky;
top: 8.8rem;
} }
.el-radio-group{ .el-radio-group{
margin-bottom: 0!important; margin-bottom: 0!important;
@ -180,6 +182,7 @@
.second{ .second{
background: #EEFCFE; background: #EEFCFE;
padding: 0 20%; padding: 0 20%;
margin-top: 7.3rem;
} }
.user-cancellation{ .user-cancellation{
float: right; float: right;
@ -217,5 +220,11 @@
background-size: 100%; background-size: 100%;
background-position: 0 2rem; background-position: 0 2rem;
background-repeat: no-repeat; background-repeat: no-repeat;
position: fixed;
width: 100%;
background-color: #fff;
z-index: 2000;
top: 0;
padding-top: 0.2rem;
} }
</style> </style>

View File

@ -1,22 +1,41 @@
<template> <template>
<div class="page"> <div class="page">
<h1>完善中···</h1> <el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="等待帮助" name="1">
<notHelp></notHelp>
</el-tab-pane>
<el-tab-pane label="历史帮助" name="2">
<historyHelp></historyHelp>
</el-tab-pane>
</el-tabs>
</div> </div>
</template> </template>
<script> <script>
import notHelp from '@/view/admin/helpReply/notHelp/notHelp';
import historyHelp from '@/view/admin/helpReply/historyHelp/historyHelp';
export default { export default {
data() { components: {
return{ notHelp,
historyHelp
} },
}, name: "",
methods: { data() {
/** return{
* 获取帮助答复列表 activeName: '1'
*/
} }
},
mounted() {
},
methods: {
/**
* 切换tab
*/
handleClick(tab, event) {
console.log(tab, event);
},
}
} }
</script> </script>

View File

@ -0,0 +1,91 @@
<template>
<div class="page">
<div class="no-help">
<div class="help" v-for="(help, index) in historyHelpList" :key='index'>
<div class="question">
<div class="label">提问内容</div>
<div class="content">{{help.question}}</div>
</div>
<div class="question-person">
<div class="label">提问人</div>
<div class="content pointer theme-font-blue" @click="goToPersonal(help)">{{help.questionName}}</div>
</div>
<div class="question-time">
<div class="label">提问时间</div>
<div class="content grey">{{help.create_time}}</div>
</div>
<div class="answer-content">
<div class="label">解决方案</div>
<div class="content">{{help.answer}}</div>
</div>
<div class="answer-time">
<div class="label">回答时间</div>
<div class="content grey">{{help.answer_time}}</div>
</div>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return{
//
historyHelpList: [],
//
historyHelpNoData: false
}
},
mounted() {
this.getHelpAnswerList()
},
methods: {
/**
* 跳转个人首页
*/
goToPersonal(help) {
this.$router.push({name: 'personalinfo'});
sessionStorage.setItem("userId",help.create_id);
},
/**
* 获取帮助答复列表
*/
getHelpAnswerList() {
this.$ajax.post('/admin/getHelpAnswerList', {}, res => {
res.forEach(item => {
if (item.answer_id !== undefined) {
this.historyHelpList.push(item);
}
this.historyHelpNoData = this.historyHelpList.length === 0 ? true : false;
});
console.log('历史帮助答复列表', this.historyHelpList);
})
}
}
}
</script>
<style scoped>
.help{
border: 1px solid rgb(221, 221, 221);
margin-bottom: 1rem;
border-radius: 5px;
}
.question, .question-person, .question-time, .answer-content, .answer-personal, .answer-time{
padding: 0.5rem;
display: flex;
}
.answer{
margin: 0.5rem;
}
.label{
width: 6rem;
text-align-last: justify;
margin-right: 1rem;
}
.page{
margin: 0;
padding: 0;
}
</style>

View File

@ -0,0 +1,111 @@
<template>
<div class="page">
<div class="no-help">
<div class="help" v-for="(help, index) in notHelpList" :key='index'>
<div class="question">
<div class="label">提问内容</div>
<div class="content">{{help.question}}</div>
</div>
<div class="question-person">
<div class="label">提问人</div>
<div class="content pointer theme-font-blue" @click="goToPersonal(help)">{{help.questionName}}</div>
</div>
<div class="question-time">
<div class="label">提问时间</div>
<div class="content grey">{{help.create_time}}</div>
</div>
<el-button class="answer" type="success" size="small" @click="answer(help)">帮助解决</el-button>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return{
//
notHelpList: [],
//
notHelpNoData: false,
}
},
mounted() {
this.getHelpAnswerList()
},
methods: {
/**
* 帮助解决
*/
answer(help) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.$prompt(`${help.question}`, '请输入解决方案', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /\S/,
inputErrorMessage: '内容不能为空'
}).then(({ value }) => {
this.$ajax.post("/admin/answerHelp",{
answerId: userInfo.user_id,
answer: value,
id: help.id}, res => {
console.log('帮助解决', res);
if (res === 1) {
this.$message({
type: 'success',
message: '提交成功'
});
} else {
this.$message.error("提交失败")
}
})
})
},
/**
* 跳转个人首页
*/
goToPersonal(help) {
this.$router.push({name: 'personalinfo'});
sessionStorage.setItem("userId",help.create_id);
},
/**
* 获取帮助答复列表
*/
getHelpAnswerList() {
this.$ajax.post('/admin/getHelpAnswerList', {}, res => {
res.forEach(item => {
if (item.answer_id === undefined) {
this.notHelpList.push(item);
}
this.notHelpNoData = this.notHelpList.length === 0 ? true : false;
});
console.log('未帮助答复列表', this.notHelpList);
})
}
}
}
</script>
<style scoped>
.help{
border: 1px solid rgb(221, 221, 221);
margin-bottom: 1rem;
border-radius: 5px;
}
.question, .question-person, .question-time{
padding: 0.5rem;
display: flex;
}
.answer{
margin: 0.5rem;
}
.label{
width: 6rem;
text-align-last: justify;
margin-right: 1rem;
}
.page{
margin: 0;
padding: 0;
}
</style>

View File

@ -5,7 +5,6 @@
<rotation-photo-management></rotation-photo-management> <rotation-photo-management></rotation-photo-management>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="版块管理" name="2"> <el-tab-pane label="版块管理" name="2">
<registration></registration>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div> </div>

View File

@ -9,9 +9,18 @@
fit='scale-down'></el-image> fit='scale-down'></el-image>
<i class="el-icon-circle-close delete-icon pointer" @click="deleteImg(img)"></i> <i class="el-icon-circle-close delete-icon pointer" @click="deleteImg(img)"></i>
</div> </div>
<div class="add-img pointer"> <el-upload
<i class="el-icon-plus"></i> class="upload-demo"
</div> :action="url"
list-type="picture"
:show-file-list='false'
:on-success='success'
:on-error='error'>
<div class="add-img pointer">
<i class="el-icon-plus"></i>
</div>
</el-upload>
</div> </div>
</div> </div>
</template> </template>
@ -23,18 +32,66 @@
// //
rotationPhotoList: [], rotationPhotoList: [],
//URL //URL
srcList: [] srcList: [],
//
url: `${sessionStorage.getItem('url')}/hs/upload`,
} }
}, },
mounted() { mounted() {
this.getRotationPhotoList(); this.getRotationPhotoList();
}, },
methods: { methods: {
/**
* 上传图片成功
*/
success(response, file, fileList) {
console.log('上传图片', response);
this.$ajax.post('/admin/uploadRotationPhoto', {fileId: response.fileInfo.id}, res => {
if (res === 1) {
this.$message({
type: 'success',
message: '上传成功'
})
this.getRotationPhotoList();
} else {
this.$message({
type: 'error',
message: '网络异常,请稍后再试'
})
}
})
},
/**
* 上传图片失败
*/
error() {
this.$message({
type: 'error',
message: '网络异常,请稍后再试'
})
},
/** /**
* 删除图片 * 删除图片
*/ */
deleteImg(img) { deleteImg(img) {
this.$ajax.post('/admin/deleteRotationPhoto', {
id: img.id,
fileEncryption: img.fileEncryption
}, res => {
if (res === 1) {
this.$message({
type: 'success',
message: '删除成功'
})
this.getRotationPhotoList();
} else {
this.$message({
type: 'error',
message: '网络异常,请稍后再试'
})
}
})
}, },
/** /**
* 图片地址 * 图片地址
@ -87,9 +144,6 @@
padding: 0.5rem; padding: 0.5rem;
border-radius: 0.5rem border-radius: 0.5rem
} }
.title{
font-size: 1.2rem;
}
.rotation-photo{ .rotation-photo{
width: 10rem; width: 10rem;
height: 10rem; height: 10rem;