111
This commit is contained in:
parent
d6b5a04e19
commit
aa7a211d16
10
dist/config.js
vendored
10
dist/config.js
vendored
@ -1,10 +1,10 @@
|
||||
const APP_CONFIG = {
|
||||
"APP_NAME": "demo",
|
||||
"APP_NAME": "寄托天下",
|
||||
"THEMESETTING": false,
|
||||
"API_URL": "https:\/\/x.cn\/adminApi",
|
||||
"APP_VER": "VERSIONDATA",
|
||||
"TOKEN_NAME": "token",
|
||||
"API_URL": "https:\/\/app.gter.net\/adminApi",
|
||||
"APP_VER": "5.1.17",
|
||||
"TOKEN_NAME": "authorization",
|
||||
"SESSIONNAME": "ADMINTOKEN",
|
||||
"WEBSOCKET": "",
|
||||
"WEBSOCKET": "wss:\/\/app.gter.net\/socket",
|
||||
"MY_SHOW_LOGIN_OAUTH": true
|
||||
};
|
2
dist/index.html
vendored
2
dist/index.html
vendored
@ -1,4 +1,4 @@
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/><meta content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0" name="viewport"/><link rel="icon" href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/favicon.ico"><title>X-PHP</title><script>document.write("<script src='config.js'><\/script>");</script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/echarts.f9e24724.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/elicons.0621e928.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/modules.aff522da.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/app.50eff565.js"></script><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/css/modules.f5bf25ba.css" rel="stylesheet"><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/css/app.52d5b98e.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but X-PHP doesn't work properly without JavaScript enabled.</strong></noscript><div id="app" class="adminui"><div class="app-loading"><div class="app-loading__logo"><img src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/logo.png"/></div><div class="app-loading-text"><span class="app-loading-preloader">X</span> <span class="app-loading-preloader">-</span> <span class="app-loading-preloader">A</span> <span class="app-loading-preloader">d</span> <span class="app-loading-preloader">m</span> <span class="app-loading-preloader">i</span> <span class="app-loading-preloader">n</span><div class="app-loading-viewtext-container"><span class="app-loading-viewtext">X</span> <span class="app-loading-viewtext">-</span> <span class="app-loading-viewtext">A</span> <span class="app-loading-viewtext">d</span> <span class="app-loading-viewtext">m</span> <span class="app-loading-viewtext">i</span> <span class="app-loading-viewtext">n</span></div></div></div></div></body><div id="versionCheck" class="versionCheck"><h2>当前浏览器内核版本过低</h2><p>当前版本:<span id="versionCheck-type">--</span> <span id="versionCheck-version">--</span></p><p>最低版本要求:Chrome 71+、Firefox 65+、Safari 12+、Edge 97+。</p><p>请升级浏览器版本,或更换现代浏览器,如果你使用的是双核浏览器,请切换到极速/高速模式。</p></div><style>html,
|
||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/><meta content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=0" name="viewport"/><link rel="icon" href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/favicon.ico"><title>X-PHP</title><script>document.write("<script src='config.js'><\/script>");</script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/echarts.f9e24724.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/elicons.0621e928.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/modules.aff522da.js"></script><script defer="defer" src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/js/app.ba377389.js"></script><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/css/modules.f5bf25ba.css" rel="stylesheet"><link href="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/static/css/app.2debb526.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but X-PHP doesn't work properly without JavaScript enabled.</strong></noscript><div id="app" class="adminui"><div class="app-loading"><div class="app-loading__logo"><img src="https://ansnid.oss-cn-shenzhen.aliyuncs.com/x-Admin/logo.png"/></div><div class="app-loading-text"><span class="app-loading-preloader">X</span> <span class="app-loading-preloader">-</span> <span class="app-loading-preloader">A</span> <span class="app-loading-preloader">d</span> <span class="app-loading-preloader">m</span> <span class="app-loading-preloader">i</span> <span class="app-loading-preloader">n</span><div class="app-loading-viewtext-container"><span class="app-loading-viewtext">X</span> <span class="app-loading-viewtext">-</span> <span class="app-loading-viewtext">A</span> <span class="app-loading-viewtext">d</span> <span class="app-loading-viewtext">m</span> <span class="app-loading-viewtext">i</span> <span class="app-loading-viewtext">n</span></div></div></div></div></body><div id="versionCheck" class="versionCheck"><h2>当前浏览器内核版本过低</h2><p>当前版本:<span id="versionCheck-type">--</span> <span id="versionCheck-version">--</span></p><p>最低版本要求:Chrome 71+、Firefox 65+、Safari 12+、Edge 97+。</p><p>请升级浏览器版本,或更换现代浏览器,如果你使用的是双核浏览器,请切换到极速/高速模式。</p></div><style>html,
|
||||
body,
|
||||
#app {
|
||||
transition-property: filter;
|
||||
|
4
dist/report.html
vendored
4
dist/report.html
vendored
File diff suppressed because one or more lines are too long
1
dist/static/css/216.151fd0fc.css
vendored
Normal file
1
dist/static/css/216.151fd0fc.css
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
dist/static/js/216.c7f85f6f.js
vendored
Normal file
1
dist/static/js/216.c7f85f6f.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
"use strict";(self["webpackChunkx_php_admin"]=self["webpackChunkx_php_admin"]||[]).push([[216],{2216:function(t,e,s){s.r(e),s.d(e,{default:function(){return H}});var a=s(6808),l=s(9511),i=s(1441);const r={class:"message"},n=["src","alt"],o={class:"content"},c={class:"title"},d=["textContent"],g={class:"subtitle"},h={key:0,class:"unread"},u={class:"private-letter-info"},p=["src"],m={class:"private-letter-info-message"},f={class:"private-letter-info-time"},w={key:0},v=["src"],k={key:1,class:"private-letter-info-content-flex"},_=["innerHTML"],y=["src"];function b(t,e,s,b,L,x){const T=(0,a.up)("el-menu-item"),H=(0,a.up)("el-menu"),$=(0,a.up)("el-aside"),D=(0,a.up)("el-scrollbar"),M=(0,a.up)("el-main"),S=(0,a.up)("el-footer"),C=(0,a.up)("el-container"),I=(0,a.Q2)("time");return(0,a.wg)(),(0,a.j4)(C,null,{default:(0,a.w5)((()=>[(0,a.Wm)($,{width:"160px"},{default:(0,a.w5)((()=>[(0,a.Wm)(H,{"default-active":L.messageInfo.id},{default:(0,a.w5)((()=>[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(L.talkList,(t=>((0,a.wg)(),(0,a.j4)(T,{style:{padding:"0px","line-height":"14px"},key:t.id,index:t.id,onClick:e=>x.newMessageList(t)},{default:(0,a.w5)((()=>[(0,a._)("div",r,[(0,a._)("img",{src:t.avatar,alt:t.nickname},null,8,n),(0,a._)("div",o,[(0,a._)("div",c,[(0,a._)("span",{textContent:(0,l.zw)(t.nickname)},null,8,d)]),(0,a._)("div",g,[t.unread>0?((0,a.wg)(),(0,a.iD)("span",h,"[未读]")):(0,a.kq)("",!0),(0,a.Uk)(" "+(0,l.zw)(t.count)+" 条消息 ",1)])])])])),_:2},1032,["index","onClick"])))),128))])),_:1},8,["default-active"])])),_:1}),(0,a.Wm)(C,null,{default:(0,a.w5)((()=>[(0,a.Wm)(M,{style:{"background-color":"#f3f3f3"}},{default:(0,a.w5)((()=>[(0,a.Wm)(D,{height:"100%",class:"private-letter-right-content",onScroll:x.handleScroll,ref:"scrollbar"},{default:(0,a.w5)((()=>[((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(L.messageList,(t=>((0,a.wg)(),(0,a.iD)("div",{class:(0,l.C_)(["private-letter-right-content-item",{"private-letter-isauthor":t.isauthor}]),key:t.id},[(0,a._)("div",u,[(0,a._)("a",null,[t.isauthor?(0,a.kq)("",!0):((0,a.wg)(),(0,a.iD)("img",{key:0,class:"private-letter-avatar",src:t.avatar},null,8,p))]),(0,a._)("div",m,[(0,a._)("div",f,[(0,a.wy)((0,a._)("span",null,null,512),[[I,t.timestamp,void 0,{tip:!0}]])]),"image"===t.event?((0,a.wg)(),(0,a.iD)("div",w,[(0,a._)("img",{class:"private-letter-info-img",src:t.data.url},null,8,v)])):((0,a.wg)(),(0,a.iD)("div",k,[(0,a._)("div",{class:"private-letter-info-text",innerHTML:t.message},null,8,_)]))]),(0,a._)("a",null,[t.isauthor?((0,a.wg)(),(0,a.iD)("img",{key:0,class:"private-letter-avatar",src:t.avatar},null,8,y)):(0,a.kq)("",!0)])])],2)))),128))])),_:1},8,["onScroll"])])),_:1}),(0,a.Wm)(S,{style:{padding:"0"}},{default:(0,a.w5)((()=>[(0,a.wy)((0,a._)("textarea",{"onUpdate:modelValue":e[0]||(e[0]=e=>t.message=e),onKeydown:e[1]||(e[1]=(0,i.D2)(((...e)=>t.sendMessage&&t.sendMessage(...e)),["enter"])),disabled:"disabled",placeholder:"不可回复用户信息",style:{width:"100%",height:"50px",padding:"10px",border:"none",outline:"none",resize:"none"}},null,544),[[i.nr,t.message]])])),_:1})])),_:1})])),_:1})}var L={props:{user:{type:Object,default:()=>({})},tags:{type:Array,default:()=>[]},token:{type:String,default:""}},data(){return{userTag:[],talkList:[],messageList:[],messageInfo:{},lastmessageid:0,lastScrollTop:0,lastscrollHeight:0,loading:!1,scrollbar:null}},mounted(){this.userTag=this.tags,this.$nextTick((()=>{this.scrollbar=this.$refs.scrollbar,this.getData()}))},methods:{async getData(){try{const t=await this.$http.post("message/api/talkList",{token:this.token});200===t.code?(this.talkList=t.data||[],this.talkList.length>0&&(this.messageInfo=this.talkList[0],this.newMessageList(this.messageInfo))):this.$alert(t.message,"提示",{type:"error"})}catch(t){this.$alert("请求失败","提示",{type:"error"})}},async newMessageList(t){this.messageInfo=t,this.lastmessageid=0,this.lastscrollHeight=0,this.messageList=[],await this.getMessageList(!0)},async getMessageList(){this.loading=!0;try{const t=await this.$http.post("message/api/messageList",{token:this.token,id:this.messageInfo.id,lastmessageid:this.lastmessageid});200===t.code?(t.data.data&&this.messageList.unshift(...t.data.data),this.lastmessageid=t.data.lastmessageid,this.loading=!1,this.$nextTick((()=>{this.scrollbar&&setTimeout((()=>{this.lastscrollHeight>0?this.scrollbar.setScrollTop(this.scrollbar.$refs.wrapRef.scrollHeight-this.lastscrollHeight):this.scrollbar.setScrollTop(this.scrollbar.$refs.wrapRef.scrollHeight),this.lastscrollHeight=this.scrollbar.$refs.wrapRef.scrollHeight}),200)}))):this.$alert(t.message,"提示",{type:"error"})}catch(t){this.$alert("请求失败","提示",{type:"error"})}finally{this.loading=!1}},handleScroll(t){const e=t.scrollTop;e<this.lastScrollTop&&e<=10&&this.lastmessageid&&!this.loading&&this.getMessageList(),this.lastScrollTop=e}}},x=s(8700);const T=(0,x.Z)(L,[["render",b],["__scopeId","data-v-2a455084"]]);var H=T}}]);
|
1
dist/static/js/app.50eff565.js
vendored
1
dist/static/js/app.50eff565.js
vendored
File diff suppressed because one or more lines are too long
1
dist/static/js/app.ba377389.js
vendored
Normal file
1
dist/static/js/app.ba377389.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,10 +1,10 @@
|
||||
const APP_CONFIG = {
|
||||
"APP_NAME": "demo",
|
||||
"APP_NAME": "寄托天下",
|
||||
"THEMESETTING": false,
|
||||
"API_URL": "https:\/\/x.cn\/adminApi",
|
||||
"APP_VER": "VERSIONDATA",
|
||||
"TOKEN_NAME": "token",
|
||||
"API_URL": "https:\/\/app.gter.net\/adminApi",
|
||||
"APP_VER": "5.1.17",
|
||||
"TOKEN_NAME": "authorization",
|
||||
"SESSIONNAME": "ADMINTOKEN",
|
||||
"WEBSOCKET": "",
|
||||
"WEBSOCKET": "wss:\/\/app.gter.net\/socket",
|
||||
"MY_SHOW_LOGIN_OAUTH": true
|
||||
};
|
@ -187,7 +187,8 @@ export default {
|
||||
item: {
|
||||
type: Object, default: () => ({
|
||||
options: [], // options的默认值为空对象
|
||||
bind: {} // options的默认值为空对象
|
||||
bind: {}, // options的默认值为空对象
|
||||
component: 'input',
|
||||
})
|
||||
},
|
||||
modelValue: [String, Number, Boolean, Date, Object, Array],
|
||||
|
@ -20,10 +20,11 @@
|
||||
<div class="move" style="cursor: move;"><el-icon-d-caret style="width: 1em; height: 1em;" /></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- item.component 给个默认值为 input -->
|
||||
<template v-for="(item, index) in column" :key="index">
|
||||
<el-table-column v-if="!item.hide && item.name" :column-key="item.name" v-bind="item">
|
||||
<template #default="scope">
|
||||
<x-item :item="item" v-model="scope.row"></x-item>
|
||||
<x-item :item="getItem(item)" v-model="scope.row"></x-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
@ -75,6 +76,13 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getItem(item) {
|
||||
|
||||
if (!item.component) {
|
||||
item.component = 'input';
|
||||
}
|
||||
return item;
|
||||
},
|
||||
indexMethod(index) {
|
||||
return index;
|
||||
},
|
||||
|
@ -1,168 +1,155 @@
|
||||
<template>
|
||||
<el-container>
|
||||
<el-aside width="160px">
|
||||
|
||||
<el-menu :default-active="selectpage">
|
||||
<el-menu-item style="padding: 0px;line-height: 14px;">
|
||||
<el-menu :default-active="messageInfo.id">
|
||||
<el-menu-item style="padding: 0px; line-height: 14px;" v-for="item in talkList" :key="item.id" :index="item.id" @click="newMessageList(item)">
|
||||
<div class="message">
|
||||
<img src="https://via.placeholder.com/40" alt="系统消息">
|
||||
<img :src="item.avatar" :alt="item.nickname" />
|
||||
<div class="content">
|
||||
<div class="title">
|
||||
<span>系统消息</span>
|
||||
<span v-text="item.nickname"></span>
|
||||
</div>
|
||||
<div class="subtitle">
|
||||
<span class="unread">[未读]</span> 1
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-menu-item>
|
||||
<el-menu-item style="padding: 0px;line-height: 14px;">
|
||||
<div class="message">
|
||||
<img src="https://via.placeholder.com/40" alt="系统消息">
|
||||
<div class="content">
|
||||
<div class="title">
|
||||
<span>系统消息</span>
|
||||
</div>
|
||||
<div class="subtitle">
|
||||
<span class="unread">[未读]</span> 1
|
||||
<span class="unread" v-if="item.unread > 0">[未读]</span> {{ item.count }} 条消息
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
|
||||
|
||||
</el-aside>
|
||||
<el-container>
|
||||
<el-main style="background-color: #f3f3f3;">
|
||||
|
||||
<div class="private-letter-right-content" onscroll="privateLetterPop.messagescroll(event)">
|
||||
<div id="privateLetterItemg8nSRNxRQDJZbr1qgNLAdau7Se4SJuiVMIcaAOtU98tArlU9prRpxgx-zSEehbjFUWQSzYWHR42POWiwOTNmMzg~" data-id="g8nSRNxRQDJZbr1qgNLAdau7Se4SJuiVMIcaAOtU98tArlU9prRpxgx-zSEehbjFUWQSzYWHR42POWiwOTNmMzg~" class="private-letter-right-content-item">
|
||||
<div class="private-letter-right-content-item-time">2024-05-23</div>
|
||||
<div class="private-letter-info"><a target="_blank" href="https://bbs.gter.net/home.php?mod=space&uid=3886940"><img class="private-letter-avatar" src="https://oss.gter.net/avatar/97KwEWMObeQYHT7FqkimDQlbEv_WwVV5zW-tYWFjYQ~~/small?istype=1"></a>
|
||||
<div class="private-letter-info-message">
|
||||
<div class="private-letter-info-time">11:43<div class="private-letter-info-operate">
|
||||
<img class="private-letter-info-time-dotdotdot" onclick="privateLetterPop.openPrivateOperate('g8nSRNxRQDJZbr1qgNLAdau7Se4SJuiVMIcaAOtU98tArlU9prRpxgx-zSEehbjFUWQSzYWHR42POWiwOTNmMzg~')" src="//app.gter.net/image/gter/img/dotdotdot.png">
|
||||
<div class="private-letter-info-operate-box-mask" onclick="privateLetterPop.closePrivateOperate('g8nSRNxRQDJZbr1qgNLAdau7Se4SJuiVMIcaAOtU98tArlU9prRpxgx-zSEehbjFUWQSzYWHR42POWiwOTNmMzg~')"></div>
|
||||
<div class="private-letter-info-operate-box">
|
||||
<div class="private-letter-info-operate-item" onclick="privateLetterPop.delete('g8nSRNxRQDJZbr1qgNLAdau7Se4SJuiVMIcaAOtU98tArlU9prRpxgx-zSEehbjFUWQSzYWHR42POWiwOTNmMzg~')">删除</div>
|
||||
<div class="private-letter-info-operate-item private-letter-info-operate-item-report" onclick="privateLetterPop.report('g8nSRNxRQDJZbr1qgNLAdau7Se4SJuiVMIcaAOtU98tArlU9prRpxgx-zSEehbjFUWQSzYWHR42POWiwOTNmMzg~')">举报</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="private-letter-info-content-flex">
|
||||
<div class="private-letter-info-text">测试</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="privateLetterItemRXGSUJQGkVFFmKejmGrbJQ5W0AKjwEaoQAO-DkLjUd40UyZkcy8YFUlBzNl_l8Crj7udjGznHKK0SpLptmU2ZTA~" data-id="RXGSUJQGkVFFmKejmGrbJQ5W0AKjwEaoQAO-DkLjUd40UyZkcy8YFUlBzNl_l8Crj7udjGznHKK0SpLptmU2ZTA~" class="private-letter-right-content-item private-letter-isauthor">
|
||||
<div class="private-letter-right-content-item-time">2024-05-24</div>
|
||||
<el-scrollbar height="100%" class="private-letter-right-content" @scroll="handleScroll" ref="scrollbar">
|
||||
<div class="private-letter-right-content-item" v-for="item in messageList" :key="item.id" :class="{ 'private-letter-isauthor': item.isauthor }">
|
||||
<div class="private-letter-info">
|
||||
<a>
|
||||
<img class="private-letter-avatar" :src="item.avatar" v-if="!item.isauthor" />
|
||||
</a>
|
||||
<div class="private-letter-info-message">
|
||||
<div class="private-letter-info-time">
|
||||
<div class="private-letter-info-operate">
|
||||
<img class="private-letter-info-time-dotdotdot" onclick="privateLetterPop.openPrivateOperate('RXGSUJQGkVFFmKejmGrbJQ5W0AKjwEaoQAO-DkLjUd40UyZkcy8YFUlBzNl_l8Crj7udjGznHKK0SpLptmU2ZTA~')" src="//app.gter.net/image/gter/img/dotdotdot.png">
|
||||
<div class="private-letter-info-operate-box-mask" onclick="privateLetterPop.closePrivateOperate('RXGSUJQGkVFFmKejmGrbJQ5W0AKjwEaoQAO-DkLjUd40UyZkcy8YFUlBzNl_l8Crj7udjGznHKK0SpLptmU2ZTA~')"></div>
|
||||
<div class="private-letter-info-operate-box">
|
||||
<div class="private-letter-info-operate-item" onclick="privateLetterPop.delete('RXGSUJQGkVFFmKejmGrbJQ5W0AKjwEaoQAO-DkLjUd40UyZkcy8YFUlBzNl_l8Crj7udjGznHKK0SpLptmU2ZTA~')">删除</div>
|
||||
<div class="private-letter-info-operate-item private-letter-info-operate-item-report" onclick="privateLetterPop.report('RXGSUJQGkVFFmKejmGrbJQ5W0AKjwEaoQAO-DkLjUd40UyZkcy8YFUlBzNl_l8Crj7udjGznHKK0SpLptmU2ZTA~')">举报</div>
|
||||
</div>
|
||||
</div>10:42
|
||||
<span v-time.tip="item.timestamp"></span>
|
||||
</div>
|
||||
<div class="private-letter-info-content-flex">
|
||||
<div class="private-letter-info-text">已上线~</div>
|
||||
<div v-if="item.event === 'image'">
|
||||
<img class="private-letter-info-img" :src="item.data.url" />
|
||||
</div>
|
||||
</div><a target="_blank" href="https://bbs.gter.net/home.php?mod=space&uid=3320188"><img class="private-letter-avatar" src="https://oss.gter.net/avatar/97KwEWMFZ-IQETbFqkimCQxaEqWBwVV5zW-tYWFjYQ~~?istype=1&random=KvHKjujWGmDm"></a>
|
||||
<div v-else class="private-letter-info-content-flex">
|
||||
<div class="private-letter-info-text" v-html="item.message"></div>
|
||||
</div>
|
||||
</div>
|
||||
<a>
|
||||
<img class="private-letter-avatar" :src="item.avatar" v-if="item.isauthor" />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</el-scrollbar>
|
||||
</el-main>
|
||||
<el-footer>Footer</el-footer>
|
||||
<el-footer style="padding: 0;">
|
||||
<textarea v-model="message" @keydown.enter="sendMessage" disabled="disabled" placeholder="不可回复用户信息" style="width: 100%; height: 50px; padding: 10px; border: none; outline: none; resize: none;"></textarea>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
</el-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
props: {
|
||||
user: { type: Object, default: () => ({}) },
|
||||
tags: { type: Array, default: () => ([]) },
|
||||
token: { type: String, default: () => '' },
|
||||
},
|
||||
components: {
|
||||
tags: { type: Array, default: () => [] },
|
||||
token: { type: String, default: '' },
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
userTag: [],
|
||||
data: {},
|
||||
section: [],
|
||||
inputVisible: null,
|
||||
inputValue: null,
|
||||
isLoad: false, // 初始设为 true
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听 userTag 数组的变化
|
||||
userTag: {
|
||||
handler(val) {
|
||||
if (this.isLoad) {
|
||||
this.$emit("update:tags", val)
|
||||
return this.submitUserTags(val);
|
||||
}
|
||||
this.isLoad = true;
|
||||
},
|
||||
deep: true // 深度监听,以便能够检测数组或对象内部值的变化
|
||||
}
|
||||
talkList: [],
|
||||
messageList: [],
|
||||
messageInfo: {},
|
||||
lastmessageid: 0,
|
||||
lastScrollTop: 0,
|
||||
lastscrollHeight: 0,
|
||||
loading: false,
|
||||
scrollbar: null,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.userTag = this.tags;
|
||||
this.getData();
|
||||
this.$nextTick(() => {
|
||||
this.scrollbar = this.$refs.scrollbar;
|
||||
this.getData();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
this.$http.post('user/data/get', { token: this.token }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.data = res.data.data || [];
|
||||
this.section = res.data.section || [];
|
||||
return;
|
||||
async getData() {
|
||||
try {
|
||||
const res = await this.$http.post('message/api/talkList', { token: this.token });
|
||||
if (res.code === 200) {
|
||||
this.talkList = res.data || [];
|
||||
if (this.talkList.length > 0) {
|
||||
this.messageInfo = this.talkList[0];
|
||||
this.newMessageList(this.messageInfo);
|
||||
}
|
||||
} else {
|
||||
this.$alert(res.message, '提示', { type: 'error' });
|
||||
}
|
||||
this.$alert(res.message, "提示", { type: 'error' });
|
||||
});
|
||||
},
|
||||
// 提交
|
||||
submitUserTags(tags) {
|
||||
this.$http.post('user/index/tagsUpdate', { tags: tags, token: this.token }).then((res) => {
|
||||
if (res.code == 200) {
|
||||
return false;
|
||||
}
|
||||
this.$alert(res.message, "提示", { type: 'error' });
|
||||
});
|
||||
},
|
||||
handleClose(tag) {
|
||||
this.userTag.splice(this.userTag.indexOf(tag), 1)
|
||||
},
|
||||
|
||||
showInput() {
|
||||
this.inputVisible = true
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.InputRef && this.$refs.InputRef.$refs.input) {
|
||||
this.$refs.InputRef.$refs.input.focus();
|
||||
}
|
||||
})
|
||||
},
|
||||
handleInputConfirm() {
|
||||
if (this.inputValue) {
|
||||
this.userTag.push(this.inputValue)
|
||||
} catch (error) {
|
||||
this.$alert('请求失败', '提示', { type: 'error' });
|
||||
}
|
||||
this.inputVisible = false
|
||||
this.inputValue = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
async newMessageList(item) {
|
||||
this.messageInfo = item;
|
||||
this.lastmessageid = 0;
|
||||
this.lastscrollHeight = 0;
|
||||
this.messageList = [];
|
||||
await this.getMessageList(true);
|
||||
},
|
||||
async getMessageList() {
|
||||
this.loading = true;
|
||||
try {
|
||||
const res = await this.$http.post('message/api/messageList', {
|
||||
token: this.token,
|
||||
id: this.messageInfo.id,
|
||||
lastmessageid: this.lastmessageid,
|
||||
});
|
||||
if (res.code === 200) {
|
||||
if (res.data.data) {
|
||||
this.messageList.unshift(...res.data.data);
|
||||
}
|
||||
this.lastmessageid = res.data.lastmessageid;
|
||||
this.loading = false;
|
||||
this.$nextTick(() => {
|
||||
if (this.scrollbar) {
|
||||
// 延迟
|
||||
setTimeout(() => {
|
||||
if (this.lastscrollHeight > 0) {
|
||||
this.scrollbar.setScrollTop(this.scrollbar.$refs.wrapRef.scrollHeight - this.lastscrollHeight);
|
||||
} else {
|
||||
this.scrollbar.setScrollTop(this.scrollbar.$refs.wrapRef.scrollHeight);
|
||||
}
|
||||
this.lastscrollHeight = this.scrollbar.$refs.wrapRef.scrollHeight;
|
||||
}, 200);
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
this.$alert(res.message, '提示', { type: 'error' });
|
||||
}
|
||||
} catch (error) {
|
||||
this.$alert('请求失败', '提示', { type: 'error' });
|
||||
} finally {
|
||||
this.loading = false;
|
||||
}
|
||||
},
|
||||
handleScroll(e) {
|
||||
const scrollTop = e.scrollTop;
|
||||
if (scrollTop < this.lastScrollTop && scrollTop <= 10 && this.lastmessageid && !this.loading) {
|
||||
this.getMessageList();
|
||||
}
|
||||
this.lastScrollTop = scrollTop;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.message {
|
||||
display: flex;
|
||||
@ -358,7 +345,7 @@ export default {
|
||||
}
|
||||
|
||||
.private-letter-right-content .private-letter-right-content-item .private-letter-info .private-letter-info-message .private-letter-info-img {
|
||||
height: 120px;
|
||||
max-width: 120px;
|
||||
border-radius: 5px;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
|
Loading…
Reference in New Issue
Block a user