|
@@ -13,11 +13,50 @@ const { report_info,report_chapter_item,research_report_type_info,research_repor
|
|
|
|
|
|
const emits = defineEmits(['like_change'])
|
|
|
|
|
|
+const userId = ref(localStorage.getItem('hzyb-userId') || '');//用户id
|
|
|
+
|
|
|
+// 获取用户信息
|
|
|
+import {apiUserInfo} from '@/api/hzyb/user'
|
|
|
+const haveNick=ref(false)//是否设置过昵称
|
|
|
+const getUserInfo=async ()=>{
|
|
|
+ const { code,data }=await apiUserInfo({Authorization: localStorage.getItem('hzyb-token')})
|
|
|
+ if(code !==200) return
|
|
|
+
|
|
|
+ haveNick.value = data.nick_name ? true : false;
|
|
|
+}
|
|
|
+getUserInfo()
|
|
|
+
|
|
|
+ //是否匿名
|
|
|
+const isHideRealName = ref(true);
|
|
|
+//判断是否可以实名
|
|
|
+const checkNickHandle = (val) => {
|
|
|
+
|
|
|
+ if(haveNick.value){
|
|
|
+ isHideRealName.value = val
|
|
|
+ } else {
|
|
|
+ isHideRealName.value = true;
|
|
|
+ Dialog.confirm({
|
|
|
+ title: '',
|
|
|
+ message: '检测到您还未设置头像和昵称,您的留言将发布为匿名,是否立即去设置?',
|
|
|
+ confirmButtonText: '去设置',
|
|
|
+ confirmButtonColor: '#E3B377',
|
|
|
+ cancelButtonText: '暂时不用',
|
|
|
+ cancelButtonColor: '#666'
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
+ wx.miniProgram.navigateTo({ url:'/pages-user/mysetting' })
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
//显示写留言框
|
|
|
const isShowMessagebox = ref(false);
|
|
|
const message_content = ref('');
|
|
|
- //是否匿名
|
|
|
-const isHideRealName = ref(true);
|
|
|
//展开留言框
|
|
|
const writeOrCancelMessage = () => {
|
|
|
isShowMessagebox.value = ! isShowMessagebox.value;
|
|
@@ -25,9 +64,9 @@ const writeOrCancelMessage = () => {
|
|
|
/* 发布留言 */
|
|
|
const publishMessageHandle = async() => {
|
|
|
const { code } = await publishMsg({
|
|
|
- report_id: report_info ? report_info.report_id : 0,
|
|
|
+ report_id: report_info ? report_info.report_id : report_chapter_item ? report_chapter_item.report_id : 0,
|
|
|
report_chapter_id: report_chapter_item ? report_chapter_item.report_chapter_id : 0,
|
|
|
- old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : 0,
|
|
|
+ old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : research_report_type_info ? research_report_type_info.research_report_id : 0,
|
|
|
old_report_chapter_id: research_report_type_info ? research_report_type_info.research_report_type_id : 0,
|
|
|
content: message_content.value,
|
|
|
is_show_name: isHideRealName.value ? 0 : 1
|
|
@@ -38,7 +77,7 @@ const publishMessageHandle = async() => {
|
|
|
isShowMessagebox.value = false
|
|
|
setTimeout(() => {
|
|
|
getMyMsgList();
|
|
|
- },500)
|
|
|
+ },300)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -51,10 +90,10 @@ const hotMessageList = ref([]);
|
|
|
const getMyMsgList = async () => {
|
|
|
|
|
|
const { code,data } = await getMyMessage({
|
|
|
- report_id: report_info ? report_info.report_id : '',
|
|
|
+ report_id: report_info ? report_info.report_id : report_chapter_item ? report_chapter_item.report_id : '',
|
|
|
report_chapter_id: report_chapter_item ? report_chapter_item.report_chapter_id : '',
|
|
|
- old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : '',
|
|
|
- old_report_chapter_id: research_report_type_info ? research_report_type_info.research_report_type_id : ''
|
|
|
+ old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : research_report_type_info ? research_report_type_info.research_report_id : '',
|
|
|
+ old_report_chapter_id: research_report_type_info ? research_report_type_info.research_report_type_id : '',
|
|
|
})
|
|
|
|
|
|
if(code !== 200) return
|
|
@@ -67,9 +106,9 @@ const getHotMsgList = async () => {
|
|
|
let page_size = 100000;//暂时不做分页
|
|
|
|
|
|
const { code,data } = await getHotMessage({
|
|
|
- report_id: report_info ? report_info.report_id : '',
|
|
|
+ report_id: report_info ? report_info.report_id : report_chapter_item ? report_chapter_item.report_id : '',
|
|
|
report_chapter_id: report_chapter_item ? report_chapter_item.report_chapter_id : '',
|
|
|
- old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : '',
|
|
|
+ old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : research_report_type_info ? research_report_type_info.research_report_id : '',
|
|
|
old_report_chapter_id: research_report_type_info ? research_report_type_info.research_report_type_id : '',
|
|
|
current_index: 1,
|
|
|
page_size
|
|
@@ -93,10 +132,10 @@ const slideMymessageHandle = () => {
|
|
|
/* 点赞 */
|
|
|
const giveLikeHandle = async() => {
|
|
|
const { code,data } = await setLike({
|
|
|
- report_id: report_info ? report_info.report_id : 0,
|
|
|
+ report_id: report_info ? report_info.report_id : report_chapter_item ? report_chapter_item.report_id : 0,
|
|
|
report_chapter_id: report_chapter_item ? report_chapter_item.report_chapter_id : 0,
|
|
|
- old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : 0,
|
|
|
- old_report_chapter_id: research_report_type_info ? research_report_type_info.research_report_type_id : 0
|
|
|
+ old_report_id: research_report_info ? props.info.research_report_type_list[0].ResearchReportId : research_report_type_info ? research_report_type_info.research_report_id : 0,
|
|
|
+ old_report_chapter_id: research_report_type_info ? research_report_type_info.research_report_type_id : 0,
|
|
|
})
|
|
|
|
|
|
if( code !== 200 ) return
|
|
@@ -151,7 +190,7 @@ const delMessageHandle = ({ comment_id }) => {
|
|
|
/>
|
|
|
<div class="write-bottom">
|
|
|
<div class="left">
|
|
|
- <Checkbox v-model="isHideRealName" icon-size="15px" shape="square" checked-color="#E3B377"/>
|
|
|
+ <Checkbox v-model="isHideRealName" icon-size="15px" shape="square" checked-color="#E3B377" @change="checkNickHandle"/>
|
|
|
<span class="label">匿名发布</span>
|
|
|
|
|
|
<icon name="question-o" color="#E3B377" @click="Toast({ message: '匿名发布的留言将实用默认头像和默认昵称,用户需设置头像和昵称后才能取消匿名', position: 'bottom' })"/>
|
|
@@ -212,7 +251,7 @@ const delMessageHandle = ({ comment_id }) => {
|
|
|
{{item.user_name}}
|
|
|
<Tag color="#DEDFE5" text-color="#fff" v-if="item.IsTop">置顶</Tag>
|
|
|
</span>
|
|
|
- <span class="del" @click="delMessageHandle(item)">删除</span>
|
|
|
+ <span class="del" @click="delMessageHandle(item)" v-if="item.user_id === Number(userId)">删除</span>
|
|
|
</div>
|
|
|
<p class="content">{{item.content}}</p>
|
|
|
</div>
|
|
@@ -231,6 +270,7 @@ const delMessageHandle = ({ comment_id }) => {
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
</template>
|
|
|
|
|
|
<style scoped lang="scss">
|