|
@@ -8,48 +8,100 @@
|
|
|
<view class="msg-text" contenteditable="true" placeholder="在此输入留言内容,限200字。"></view>
|
|
<view class="msg-text" contenteditable="true" placeholder="在此输入留言内容,限200字。"></view>
|
|
|
<view class="msg-btn" @click="sendMsg">提交</view>
|
|
<view class="msg-btn" @click="sendMsg">提交</view>
|
|
|
<view class="msg-list">
|
|
<view class="msg-list">
|
|
|
- <view class="msg-item" v-for="(msg_iteam,index) in 5">
|
|
|
|
|
|
|
+ <view class="msg-item" v-for="(msgItem,index) in list">
|
|
|
<view class="msg-list-con">
|
|
<view class="msg-list-con">
|
|
|
<view class="msg-list-tit">
|
|
<view class="msg-list-tit">
|
|
|
<view class="msg-list-name">
|
|
<view class="msg-list-name">
|
|
|
- 阿萨德撒多解散
|
|
|
|
|
|
|
+ {{msgItem.username}}
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="msg-list-time">2022-10-18 15:02</view>
|
|
|
|
|
|
|
+ <view class="msg-list-time">{{msgItem.created_at}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="msg-list-intro">阿山东黄金看加哈是否叠加记得收款飞</view>
|
|
|
|
|
|
|
+ <view class="msg-list-intro">{{msgItem.content}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="msg-list-con" >
|
|
|
|
|
|
|
+ <view class="msg-list-con" v-if="msgItem.reply!==''">
|
|
|
<view class="msg-list-tit">
|
|
<view class="msg-list-tit">
|
|
|
<view class="msg-list-name">
|
|
<view class="msg-list-name">
|
|
|
回复
|
|
回复
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="msg-list-time">2022-10-18 15:02</view>
|
|
|
|
|
|
|
+ <view class="msg-list-time">{{msgItem.updated_at}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <view class="msg-list-intro">是大家好较好的</view>
|
|
|
|
|
|
|
+ <view class="msg-list-intro">{{msgItem.reply}}</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
+ <en-blank v-if="list.length<=0"></en-blank>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import $ from 'jquery/src/jquery'
|
|
import $ from 'jquery/src/jquery'
|
|
|
|
|
+import {addMsg, getMsgList} from "@/api/news";
|
|
|
|
|
+import tools from "@/common/js/tools";
|
|
|
|
|
+import EnBlank from "@/components/en-utils/en-blank/en-blank";
|
|
|
export default {
|
|
export default {
|
|
|
name: "index",
|
|
name: "index",
|
|
|
- components: {},
|
|
|
|
|
|
|
+ components: {EnBlank},
|
|
|
props: {},
|
|
props: {},
|
|
|
data() {
|
|
data() {
|
|
|
- return {}
|
|
|
|
|
|
|
+ return {
|
|
|
|
|
+ isAjax:false,
|
|
|
|
|
+ page:1,
|
|
|
|
|
+ list:[],
|
|
|
|
|
+ total:null
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
watch: {},
|
|
watch: {},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- this.msg = $('.msg-text').text();
|
|
|
|
|
|
|
+ this.startList()
|
|
|
|
|
+ },
|
|
|
|
|
+ onReachBottom() {
|
|
|
|
|
+ this.getMsgList()
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ startList(){
|
|
|
|
|
+ this.page=1;
|
|
|
|
|
+ this.list=[];
|
|
|
|
|
+ this.total=null;
|
|
|
|
|
+ this.getMsgList()
|
|
|
|
|
+ },
|
|
|
|
|
+ getMsgList(){
|
|
|
|
|
+ if(this.isAjax){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.total!==null && this.total>=this.list.length){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ getMsgList({'page':this.page}).then((res)=>{
|
|
|
|
|
+ if(res.code===1){
|
|
|
|
|
+ this.total=res.data.total
|
|
|
|
|
+ this.list.push(...res.data.items)
|
|
|
|
|
+ ++this.page
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
sendMsg(){
|
|
sendMsg(){
|
|
|
- this.msg = $('.msg-text').text();
|
|
|
|
|
- console.log(this.msg)
|
|
|
|
|
|
|
+ let msg = $('.msg-text').text();
|
|
|
|
|
+ if(msg===''){
|
|
|
|
|
+ tools.error('请输入留言内容')
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(this.isAjax){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.isAjax=true
|
|
|
|
|
+ addMsg({'content':msg}).then((res)=>{
|
|
|
|
|
+ this.isAjax=false
|
|
|
|
|
+ if(res.code===1){
|
|
|
|
|
+ this.list.unshift(res.data)
|
|
|
|
|
+ $('.msg-text').text('');
|
|
|
|
|
+ tools.success(res.msg)
|
|
|
|
|
+ }else {
|
|
|
|
|
+ tools.error(res.msg)
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch((e)=>{
|
|
|
|
|
+ this.isAjax=false
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -129,7 +181,7 @@ export default {
|
|
|
color: #D9E4F6;
|
|
color: #D9E4F6;
|
|
|
}
|
|
}
|
|
|
.msg-list-time {
|
|
.msg-list-time {
|
|
|
- max-width: 110px;
|
|
|
|
|
|
|
+ max-width: 130px;
|
|
|
height: 30px;
|
|
height: 30px;
|
|
|
font-size: 12px;
|
|
font-size: 12px;
|
|
|
color: #495B73;
|
|
color: #495B73;
|