'goPresonal'

This commit is contained in:
裴浩宇 2020-04-24 15:21:26 +08:00
parent e906a7917a
commit f71ac62aa0
6 changed files with 87 additions and 45 deletions

View File

@ -115,10 +115,15 @@ public interface HSLinkMapper {
Map<String,Object> getPersonalInfo(Map<String,Object> param);
/**
* 获取个人私信
* 获取个人私信内容
*/
List<Map<String,Object>> getPersonalPrivateLetter(Map<String,Object> param);
/**
* 获取已读私信内容
*/
List<Map<String,Object>> getSentPrivateLetterContent(Map<String,Object> param);
/**
* 获取已发送私信
*/

View File

@ -249,7 +249,16 @@
<!--获取个人私信-->
<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} and receive_status = "1"
select * from hs_private_letter left join hs_user on receive_id = user_id where receive_id = #{userId} and receive_status = "1"
<if test="id != '' and id != null">
and id = #{id}
</if>
ORDER BY letter_create_time desc
</select>
<!--获取已读私信内容-->
<select id="getSentPrivateLetterContent" resultType="map" parameterType="map">
select * from hs_private_letter left join hs_user on send_id = user_id where send_id = #{userId} and send_status = "1"
<if test="id != '' and id != null">
and id = #{id}
</if>
@ -297,4 +306,5 @@
ORDER BY letter_create_time desc
</select>
</mapper>

View File

@ -257,8 +257,16 @@ public class HSServiceImpl implements HSService {
public Map<String, Object> readPrivateLetter(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>();
Map<String, Object> res = new HashMap<>();
List<Map<String, Object>> res1 = hsLinkMapper.getPersonalPrivateLetter(param);
int res2 = hsLinkMapper.updateUnread(param);
Integer type = (Integer) param.get("type");
List<Map<String, Object>> res1;
int res2;
if (type == 0) {
res1 = hsLinkMapper.getPersonalPrivateLetter(param);
res2= hsLinkMapper.updateUnread(param);
} else {
res1 = hsLinkMapper.getSentPrivateLetterContent(param);
res2= 0;
}
res.put("onePrivateLetter",res1);
res.put("readStatus",res2);
result.put("data",res);

View File

@ -127,6 +127,9 @@
this.$ajax.post("/hs/addArticle",{label:this.label,title:this.title,content:this.msg.mdValue,release_id:userInfo.user_id,
release_time:getDate(),type:this.type},r=>{
if (r === 1) {
this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{
console.log(r)
});
this.$message({
message: "发表成功",
type: "success"

View File

@ -82,7 +82,7 @@
goPersonalInfo(userId) {
this.$router.push({name: 'personalinfo'});
sessionStorage.setItem("userId",userId);
setTimeout(()=>{location.reload()},1)
setTimeout(()=>{location.reload()},500)
},
goMore() {
this.$message({

View File

@ -103,7 +103,7 @@
<p>未读</p>
<p v-if="unreadIsNull">暂无未读</p>
<div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '0')" >
<div class="box" @click="read(item.id)">
<div class="box" @click="read(item.id,0)">
<div class="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div>
@ -115,7 +115,7 @@
<p>已读</p>
<p v-if="alreadyReadIsNull">暂无已读</p>
<div class="privateLetterOne" v-for="item in privateLetterList" v-if="(item.already_read === '1')">
<div class="box" @click="read(item.id)">
<div class="box" @click="read(item.id,0)">
<div class="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div>
@ -127,7 +127,7 @@
<p>已发送</p>
<p v-if="sentIsNull">暂无发送</p>
<div class="privateLetterOne" v-for="item in sentList">
<div class="box" @click="read(item.id)">
<div class="box" @click="read(item.id,1)">
<div class="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div>
@ -227,6 +227,7 @@
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
debugger
this.$ajax.post("/hs/deleteLetter",{id:id,type:type},r=>{
if (r === 1) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
@ -251,7 +252,7 @@
if (res.privateLetter[i].already_read === "1") {
this.alreadyReadIsNull = false
} else {
this.unreadIsNull = true
this.alreadyReadIsNull = true
}
}
})
@ -304,49 +305,62 @@
});
});
},
read(id) {
read(id,type) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.$ajax.post("/hs/readPrivateLetter",{userId:userInfo.user_id,id:id},r=>{
this.$confirm(`<p style="font-size: 0.9rem">发送者:${r.onePrivateLetter[0].real_name}</p>
if (type === 0) {
this.$ajax.post("/hs/readPrivateLetter",{userId:userInfo.user_id,id:id,type},r=>{
this.$confirm(`<p style="font-size: 0.9rem">发送者:${r.onePrivateLetter[0].real_name}</p>
<p style="font-size: 0.9rem">内容${r.onePrivateLetter[0].content}</p>
<p style="font-size: 0.9rem">发送时间${r.onePrivateLetter[0].letter_create_time}</p>
`, '私信', {
distinguishCancelAndClose: true,
cancelButtonText: '回复',
dangerouslyUseHTMLString: true
}).catch(action => {
console.log("action",action)
if (action === 'cancel') {
this.sendLetter(r.onePrivateLetter[0].user_id,r.onePrivateLetter[0].real_name)
}
});
this.$ajax.post("/hs/getPersonalPrivateLetter",{userId:userInfo.user_id},r=>{
this.privateLetterList = r.privateLetter
for (let i = 0; i < r.privateLetter.length; i++) {
if (r.privateLetter[i].already_read === "0") {
this.unreadIsNull = false
} else {
this.unreadIsNull = true
distinguishCancelAndClose: true,
cancelButtonText: '回复',
dangerouslyUseHTMLString: true
}).catch(action => {
console.log("action",action)
if (action === 'cancel') {
this.sendLetter(r.onePrivateLetter[0].user_id,r.onePrivateLetter[0].real_name)
}
if (r[i].privateLetter.already_read === "1") {
this.alreadyReadIsNull = false
} else {
this.unreadIsNull = true
});
this.$ajax.post("/hs/getPersonalPrivateLetter",{userId:userInfo.user_id},r=>{
this.privateLetterList = r.privateLetter
for (let i = 0; i < r.privateLetter.length; i++) {
if (r.privateLetter[i].already_read === "0") {
this.unreadIsNull = false
} else {
this.unreadIsNull = true
}
if (r[i].privateLetter.already_read === "1") {
this.alreadyReadIsNull = false
} else {
this.unreadIsNull = true
}
}
}
})
this.$ajax.post("/hs/getPersonalInfo",{text:"",releaseId: sessionStorage.getItem("userId")},r=>{
this.list = r.personalList;
this.length = r.personalList.length;
this.all = {
real_name: r.personalInfo.real_name,
header_photo: r.personalInfo.real_name.substring(0, 1),
integral: r.personalInfo.integral,
letter_number: r.personalInfo.letter_number,
user_id: r.personalInfo.user_id,
}
})
})
this.$ajax.post("/hs/getPersonalInfo",{text:"",releaseId: sessionStorage.getItem("userId")},r=>{
this.list = r.personalList;
this.length = r.personalList.length;
this.all = {
real_name: r.personalInfo.real_name,
header_photo: r.personalInfo.real_name.substring(0, 1),
integral: r.personalInfo.integral,
letter_number: r.personalInfo.letter_number,
user_id: r.personalInfo.user_id,
}
} else {
this.$ajax.post("/hs/readPrivateLetter", {userId: userInfo.user_id, id: id, type}, r => {
this.$confirm(`<p style="font-size: 0.9rem">发送者:${r.onePrivateLetter[0].real_name}</p>
<p style="font-size: 0.9rem">内容${r.onePrivateLetter[0].content}</p>
<p style="font-size: 0.9rem">发送时间${r.onePrivateLetter[0].letter_create_time}</p>
`, '私信', {
// distinguishCancelAndClose: true,
showCancelButton:false,
dangerouslyUseHTMLString: true
})
})
})
}
},
privateLetter() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
@ -418,7 +432,9 @@
this.all = {
real_name: r[0].real_name,
header_photo: r[0].real_name.substring(0, 1),
integral: r[0].integral
integral: r[0].integral,
letter_number: r[0].letter_number,
user_id: r[0].user_id,
}
})
},