This commit is contained in:
裴浩宇 2020-04-14 17:59:01 +08:00
parent c8666d7ab7
commit 00f7e575c6
6 changed files with 88 additions and 29 deletions

View File

@ -168,4 +168,12 @@ public class HSController {
Map<String,Object> result = hsService.sendLetter(param); Map<String,Object> result = hsService.sendLetter(param);
return result; return result;
} }
//删除一条私信
@RequestMapping(value = "/deleteLetter", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody
public Map<String,Object> deleteLetter(@RequestBody Map<String,Object> param) {
Map<String,Object> result = hsService.deleteLetter(param);
return result;
}
} }

View File

@ -129,4 +129,9 @@ public interface HSLinkMapper {
*/ */
int sendLetter(Map<String,Object> param); int sendLetter(Map<String,Object> param);
/**
* 删除一条私信
*/
int deleteLetter(Map<String,Object> param);
} }

View File

@ -243,13 +243,13 @@
<!--获取个人信息--> <!--获取个人信息-->
<select id="getPersonalInfo" parameterType="map" resultType="map"> <select id="getPersonalInfo" parameterType="map" resultType="map">
select * , (select count(*) from hs_private_letter where receive_id = #{releaseId} and already_read = "0") letter_number select * , (select count(*) from hs_private_letter where receive_id = #{releaseId} and already_read = "0" and status = "1") letter_number
from hs_user where user_id = #{releaseId} from hs_user where user_id = #{releaseId}
</select> </select>
<!--获取个人私信--> <!--获取个人私信-->
<select id="getPersonalPrivateLetter" resultType="map" parameterType="map"> <select id="getPersonalPrivateLetter" resultType="map" parameterType="map">
select * from hs_private_letter left join hs_user on send_id = user_id where receive_id = #{userId} select * from hs_private_letter left join hs_user on send_id = user_id where receive_id = #{userId} and status = "1"
<if test="id != '' and id != null"> <if test="id != '' and id != null">
and id = #{id} and id = #{id}
</if> </if>
@ -265,4 +265,9 @@
insert into hs_private_letter (id,send_id,receive_id,content,letter_create_time,status,already_read) values insert into hs_private_letter (id,send_id,receive_id,content,letter_create_time,status,already_read) values
(uuid(),#{sendId},#{receiveId},#{content},#{time},"1","0") (uuid(),#{sendId},#{receiveId},#{content},#{time},"1","0")
</insert> </insert>
<!--删除一条私信-->
<update id="deleteLetter" parameterType="map">
update hs_private_letter set status = "0" where id = #{id}
</update>
</mapper> </mapper>

View File

@ -102,4 +102,9 @@ public interface HSService {
* 发送私信 * 发送私信
*/ */
Map<String,Object> sendLetter(Map<String,Object> param); Map<String,Object> sendLetter(Map<String,Object> param);
/**
* 删除一条私信
*/
Map<String,Object> deleteLetter(Map<String,Object> param);
} }

View File

@ -274,4 +274,19 @@ public class HSServiceImpl implements HSService {
result.put("success",true); result.put("success",true);
return result; return result;
} }
@Override
public Map<String, Object> deleteLetter(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
int res = 0;
try {
res = hsLinkMapper.deleteLetter(param);
} catch (Exception e) {
e.printStackTrace();
res = 0;
}
result.put("data",res);
result.put("success",true);
return result;
}
} }

View File

@ -66,8 +66,7 @@
<el-dialog <el-dialog
title="修改密码" title="修改密码"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
width="30%" width="30%">
:before-close="handleClose">
<el-form :model="editorPasswordForm" <el-form :model="editorPasswordForm"
:rules="editorPasswordRules" :rules="editorPasswordRules"
ref="editorPasswordForm" ref="editorPasswordForm"
@ -93,8 +92,7 @@
<el-drawer <el-drawer
:visible.sync="drawer" :visible.sync="drawer"
:direction="direction" :direction="direction"
:show-close = false :show-close = false>
:before-close="handleClosePrivateLetter">
<div class="privateLetterList"> <div class="privateLetterList">
<div class="header"> <div class="header">
<div class="content">内容</div> <div class="content">内容</div>
@ -104,19 +102,25 @@
<div class="unread"> <div class="unread">
<p>未读</p> <p>未读</p>
<p v-if="unreadIsNull">暂无未读</p> <p v-if="unreadIsNull">暂无未读</p>
<div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '0')" @click="read(item.id)"> <div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '0')" >
<div class="content">{{item.content}}</div> <div class="box" @click="read(item.id)">
<div class="name">{{item.real_name}}</div> <div class="content">{{item.content}}</div>
<div class="time">{{item.letter_create_time}}</div> <div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div>
</div>
<div class="delete" @click="deleteLetter(item.id)">删除</div>
</div> </div>
</div> </div>
<div class="already-read"> <div class="already-read">
<p>已读</p> <p>已读</p>
<p v-if="alreadyReadIsNull">暂无已读</p> <p v-if="alreadyReadIsNull">暂无已读</p>
<div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '1')" @click="read(item.id)"> <div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '1')">
<div class="content">{{item.content}}</div> <div class="box" @click="read(item.id)">
<div class="name">{{item.real_name}}</div> <div class="content">{{item.content}}</div>
<div class="time">{{item.letter_create_time}}</div> <div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div>
</div>
<div class="delete" @click="deleteLetter(item.id)">删除</div>
</div> </div>
</div> </div>
@ -197,6 +201,29 @@
}, },
methods: { methods: {
deleteLetter(id) {
this.$confirm('删除该私信?, 是否继续?', '删除', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$ajax.post("/hs/deleteLetter",{id:id},r=>{
if (r === 1) {
this.$message({
type: 'success',
message: '删除成功'
});
} else {
this.$message.error("删除失败")
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
sendLetter(id,name) { sendLetter(id,name) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.$prompt('接受者:'+name, '发送私信', { this.$prompt('接受者:'+name, '发送私信', {
@ -277,13 +304,6 @@
} }
}) })
}, },
/*handleClosePrivateLetter(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},*/
editorSubmit() { editorSubmit() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
if (this.editorPasswordForm.oldPassword === userInfo.pass_word) { if (this.editorPasswordForm.oldPassword === userInfo.pass_word) {
@ -316,13 +336,6 @@
this.editorPasswordForm = {}; this.editorPasswordForm = {};
} }
}, },
/*handleClose(done) {
this.$confirm('放弃修改密码?')
.then(_ => {
done();
})
.catch(_ => {});
},*/
editorPassword() { editorPassword() {
this.dialogVisible = true this.dialogVisible = true
}, },
@ -415,6 +428,10 @@
</script> </script>
<style scoped> <style scoped>
.privateLetterList .delete{
color: red;
flex: 0.5;
}
.privateLetterList{ .privateLetterList{
padding: 1rem; padding: 1rem;
margin-top: -1rem; margin-top: -1rem;
@ -471,7 +488,11 @@
font-size: 0.9rem; font-size: 0.9rem;
cursor: pointer; cursor: pointer;
} }
.privateLetterOne:hover{ .box{
display: flex;
flex: 8;
}
.box:hover{
color: #419EFF; color: #419EFF;
} }
.privateLetterOne div{ .privateLetterOne div{