Files
tougao_web/src/components/page/time_talk.vue
@fawn-nine b230e61de9 18:02
2023-06-29 18:02:21 +08:00

104 lines
2.7 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--对话模块-->
<template>
<div class="kuang_communtion">
<h2>
Communication
</h2>
<div v-for="(item, index) in talkMsgs" class="kuang_communtion_conmt">
<div v-if="item.user_id == msgform.user_id" class="talk_aued">
<p>
Author :
</p>
<el-card>Dear Editor,
<p style="white-space: pre-wrap;">{{item.ad_content}}</p>
</el-card>
<b>{{formatDate(item.ad_ctime)}}</b>
</div>
<div v-if="item.user_id != msgform.user_id" class="talk_aued talk_edit">
<p>
Editor :
</p>
<el-card>
<p style="white-space: pre-wrap;">{{item.ad_content}}</p>
</el-card>
<b>{{formatDate(item.ad_ctime)}}</b>
</div>
</div>
<div class="kuang_communtion_input">
<p v-if="talkMsgs"></p>
<el-input type="textarea" rows="3" v-model="msgform.ad_content" placeholder="Editor messages" resize="none">
</el-input>
<div class="kuang_communtion_input_text">
Dear Editor, through this window, you can have informal communication with the author. Please be aware
of the
prompt reply, standard use of English, and no offensive, insulting, discriminatory language.
<el-button type="primary" @click="saveMsg">Send</el-button>
</div>
</div>
</div>
</template>
<script>
import Vue from 'vue'
export default {
props: {
talkMsgs: {
type: Array,
required: true
},
msgform: {
type: Object,
required: true
},
// loading: {
// type: Boolean,
// required: true
// }
},
components: {},
data() {
return {
username: localStorage.getItem('U_name'),
}
},
computed: {},
methods: {
formatDate(timestamp) {
var date = new Date(timestamp * 1000); //时间戳为10位需*1000时间戳为13位的话不需乘1000
var Y = date.getFullYear() + '-';
var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var D = date.getDate() < 10 ? '0' + date.getDate() : date.getDate();
var h = date.getHours() < 10 ? '0' + date.getHours() : date.getHours();
var m = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes();
var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
return Y + M + D + ' ' + h + ':' + m + ':' + s;
},
// 留言弹出框
saveMsg() {
if (this.msgform.ad_content == '') {
this.$message.error('Please input messages!');
return false;
}
this.loading = true;
this.$api
.post('api/Article/pushArticleDialog', this.msgform)
.then((res) => {
this.loading = false;
// this.$message.success('Sent successfully');
this.$emit('talksave',true) // 传递成功信号
// setTimeout(()=>{
// this.$router.go(0);
// },1000)
});
},
}
}
</script>
<style scoped>
</style>