'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); Map<String,Object> getPersonalInfo(Map<String,Object> param);
/** /**
* 获取个人私信 * 获取个人私信内容
*/ */
List<Map<String,Object>> getPersonalPrivateLetter(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 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"> <if test="id != '' and id != null">
and id = #{id} and id = #{id}
</if> </if>
@ -297,4 +306,5 @@
ORDER BY letter_create_time desc ORDER BY letter_create_time desc
</select> </select>
</mapper> </mapper>

View File

@ -257,8 +257,16 @@ public class HSServiceImpl implements HSService {
public Map<String, Object> readPrivateLetter(Map<String, Object> param) { public Map<String, Object> readPrivateLetter(Map<String, Object> param) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String, Object> res = new HashMap<>(); Map<String, Object> res = new HashMap<>();
List<Map<String, Object>> res1 = hsLinkMapper.getPersonalPrivateLetter(param); Integer type = (Integer) param.get("type");
int res2 = hsLinkMapper.updateUnread(param); 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("onePrivateLetter",res1);
res.put("readStatus",res2); res.put("readStatus",res2);
result.put("data",res); 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, 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=>{ release_time:getDate(),type:this.type},r=>{
if (r === 1) { if (r === 1) {
this.$ajax.post("/hs/timingTask",{userId:userInfo.user_id},r=>{
console.log(r)
});
this.$message({ this.$message({
message: "发表成功", message: "发表成功",
type: "success" type: "success"

View File

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

View File

@ -103,7 +103,7 @@
<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')" > <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="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div> <div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div> <div class="time">{{item.letter_create_time}}</div>
@ -115,7 +115,7 @@
<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')"> <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="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div> <div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div> <div class="time">{{item.letter_create_time}}</div>
@ -127,7 +127,7 @@
<p>已发送</p> <p>已发送</p>
<p v-if="sentIsNull">暂无发送</p> <p v-if="sentIsNull">暂无发送</p>
<div class="privateLetterOne" v-for="item in sentList"> <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="content">{{item.content}}</div>
<div class="name">{{item.real_name}}</div> <div class="name">{{item.real_name}}</div>
<div class="time">{{item.letter_create_time}}</div> <div class="time">{{item.letter_create_time}}</div>
@ -227,6 +227,7 @@
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
debugger
this.$ajax.post("/hs/deleteLetter",{id:id,type:type},r=>{ this.$ajax.post("/hs/deleteLetter",{id:id,type:type},r=>{
if (r === 1) { if (r === 1) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
@ -251,7 +252,7 @@
if (res.privateLetter[i].already_read === "1") { if (res.privateLetter[i].already_read === "1") {
this.alreadyReadIsNull = false this.alreadyReadIsNull = false
} else { } else {
this.unreadIsNull = true this.alreadyReadIsNull = true
} }
} }
}) })
@ -304,9 +305,10 @@
}); });
}); });
}, },
read(id) { read(id,type) {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
this.$ajax.post("/hs/readPrivateLetter",{userId:userInfo.user_id,id:id},r=>{ 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> 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].content}</p>
<p style="font-size: 0.9rem">发送时间${r.onePrivateLetter[0].letter_create_time}</p> <p style="font-size: 0.9rem">发送时间${r.onePrivateLetter[0].letter_create_time}</p>
@ -347,6 +349,18 @@
} }
}) })
}) })
} 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() { privateLetter() {
let userInfo = JSON.parse(sessionStorage.getItem("userInfo")); let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
@ -418,7 +432,9 @@
this.all = { this.all = {
real_name: r[0].real_name, real_name: r[0].real_name,
header_photo: r[0].real_name.substring(0, 1), 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,
} }
}) })
}, },