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);
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 deleteLetter(Map<String,Object> param);
}

View File

@ -243,13 +243,13 @@
<!--获取个人信息-->
<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}
</select>
<!--获取个人私信-->
<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">
and id = #{id}
</if>
@ -265,4 +265,9 @@
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")
</insert>
<!--删除一条私信-->
<update id="deleteLetter" parameterType="map">
update hs_private_letter set status = "0" where id = #{id}
</update>
</mapper>

View File

@ -102,4 +102,9 @@ public interface HSService {
* 发送私信
*/
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);
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
title="修改密码"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose">
width="30%">
<el-form :model="editorPasswordForm"
:rules="editorPasswordRules"
ref="editorPasswordForm"
@ -93,8 +92,7 @@
<el-drawer
:visible.sync="drawer"
:direction="direction"
:show-close = false
:before-close="handleClosePrivateLetter">
:show-close = false>
<div class="privateLetterList">
<div class="header">
<div class="content">内容</div>
@ -104,19 +102,25 @@
<div class="unread">
<p>未读</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="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div>
<div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '0')" >
<div class="box" @click="read(item.id)">
<div class="content">{{item.content}}</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 class="already-read">
<p>已读</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="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div>
<div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '1')">
<div class="box" @click="read(item.id)">
<div class="content">{{item.content}}</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>
@ -197,6 +201,29 @@
},
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) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.$prompt('接受者:'+name, '发送私信', {
@ -277,13 +304,6 @@
}
})
},
/*handleClosePrivateLetter(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},*/
editorSubmit() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
if (this.editorPasswordForm.oldPassword === userInfo.pass_word) {
@ -316,13 +336,6 @@
this.editorPasswordForm = {};
}
},
/*handleClose(done) {
this.$confirm('放弃修改密码?')
.then(_ => {
done();
})
.catch(_ => {});
},*/
editorPassword() {
this.dialogVisible = true
},
@ -415,6 +428,10 @@
</script>
<style scoped>
.privateLetterList .delete{
color: red;
flex: 0.5;
}
.privateLetterList{
padding: 1rem;
margin-top: -1rem;
@ -471,7 +488,11 @@
font-size: 0.9rem;
cursor: pointer;
}
.privateLetterOne:hover{
.box{
display: flex;
flex: 8;
}
.box:hover{
color: #419EFF;
}
.privateLetterOne div{