contacts.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054
  1. <template>
  2. <div class="mainBox">
  3. <div class="hallBox">
  4. <div class="hallLeft">
  5. <!--添加好友 start------------------------------------------>
  6. <contactsTitle :name="tableTitleName" @addUser="addUser" @closeAddUser="closeAddUser" />
  7. <!--添加好友 end------------------------------------------>
  8. <!--搜索 start------------------------------------------>
  9. <div class="searchBox">
  10. <el-input
  11. placeholder="请输入用户账号"
  12. prefix-icon="el-icon-search"
  13. v-model="searchUserName"
  14. @keyup.enter.native="searchFriend"
  15. v-if="pagestatus == 4"
  16. >
  17. </el-input>
  18. <el-input
  19. placeholder="请输入好友账号"
  20. prefix-icon="el-icon-search"
  21. v-model="searchUserListName"
  22. @keyup.enter.native="searchOrdFriend"
  23. v-if="pagestatus==1||pagestatus==2||pagestatus==3"
  24. >
  25. </el-input>
  26. </div>
  27. <!--搜索 end------------------------------------------>
  28. <div class="newFriendBox">新的朋友</div>
  29. <div class="newFriendImgBox" v-if="pagestatus==4">
  30. <div class="newFriendImg">
  31. <img src="@/assets/chat/newcontacts.png">
  32. </div>
  33. <div class="newFriendText">
  34. 搜索:{{searchUserName}}
  35. </div>
  36. <div class="searchFriendBox" v-if="searchWindowStatus==true">
  37. <div class="searchFriendItem">
  38. <div class="searchFriendAvatar">
  39. <img :src="searchFriendList.avatar" v-if="searchFriendList.avatar!=''">
  40. <img src="@/assets/chat/user/admin.png" v-else>
  41. </div>
  42. <div class="searchFriendInfo">
  43. <div class="searchFriendName">
  44. <div class="searchFriendNameText" v-if="searchFriendList.remark!=null">{{searchFriendList.remark}}</div>
  45. <div class="searchFriendNameText" v-else>{{searchFriendList.user_name}}</div>
  46. <!--性别-->
  47. <!-- <div class="gender"><img src="@/assets/chat/girl.png"></div> -->
  48. <!--更多-->
  49. <!-- <img src="@/assets/chat/fi_more.png"> -->
  50. </div>
  51. <div class="searchFriendPhone">账号:{{searchFriendList.user_name}}</div>
  52. </div>
  53. </div>
  54. <!-- <div v-if="searchFriendList.isfriend==0||searchFriendList.isfriend==null"></div>
  55. <div class="searchFriendLineBox" v-else @click="openEditWindow">
  56. <div class="searchFriendLineTitle">备注</div>
  57. <div class="searchFriendLineContent">
  58. <div class="searchFriendLineContentItem">
  59. <div>{{searchFriendList.remark}}</div>
  60. <div><i class="el-icon-edit"></i></div>
  61. </div>
  62. </div>
  63. </div> -->
  64. <!-- <div class="searchFriendLineBox">
  65. <div class="searchFriendLineTitle">共同群聊</div>
  66. <div class="searchFriendLineContent">0个</div>
  67. </div>
  68. <div class="searchFriendLineBox">
  69. <div class="searchFriendLineTitle">添加方式</div>
  70. <div class="searchFriendLineContent">通过账号添加</div>
  71. </div> -->
  72. <div class="searchFriendButton">
  73. <el-button type="primary" v-if="searchFriendList.showBtn==false" @click="openAddWindow(searchFriendList.id)">添加到通讯录</el-button>
  74. <el-button type="danger" v-if="searchFriendList.showBtn==true" @click="deleteFriend(searchFriendList)">删除好友</el-button>
  75. </div>
  76. <!-- <div class="searchFriendButton">
  77. <div class="searchFriendButtonItem">
  78. <img src="@/assets/chat/sendmessage.png">
  79. <div>发消息</div>
  80. </div>
  81. </div> -->
  82. </div>
  83. </div>
  84. <div :class="['newFriendImgBox', pagestatus === 2 ? 'newFriendIActive' : '']" @click="tabPage(2)" v-else>
  85. <div class="newFriendImg">
  86. <img src="@/assets/chat/newcontacts.png">
  87. </div>
  88. <div class="newFriendText" v-if="pagestatus==4">
  89. 搜索:{{searchUserName}}
  90. </div>
  91. <div class="newFriendText" v-else>
  92. 新的朋友
  93. <span v-if="userApplyList.length>0">{{userApplyList.length}}</span>
  94. </div>
  95. </div>
  96. <!--用户列表 start------------------------------------------>
  97. <div class="userListBox" v-if="pagestatus==1||pagestatus==2||pagestatus==3">
  98. <!-- <div class="userListTitle">A</div> -->
  99. <div class="userItem" @click="changeUserItem(item.friend_id)" v-for="(item,index) in userFriendList" :key="index" :class="['userItem', { active: item.status == 1 }]">
  100. <div class="userAvatar">
  101. <img :src="item.avatar" v-if="item.avatar!=''">
  102. <img src="@/assets/chat/user/admin.png" v-else>
  103. </div>
  104. <div class="userInfo">
  105. <div class="userName">
  106. <div class="userNameText" v-if="item.remark!=null">{{item.user_name}}<span v-if="item.remark!=''">({{item.remark}})</span></div>
  107. <div class="userNameText" v-else>{{item.user_name}}</div>
  108. </div>
  109. </div>
  110. </div>
  111. </div>
  112. <!--用户列表 end------------------------------------------>
  113. </div>
  114. <div class="hallRight" v-if="pagestatus==1||pagestatus==4">
  115. <div class="ifHallRigthNoMessage">恒星管理平台</div>
  116. </div>
  117. <div class="hallRight" v-if="pagestatus==2">
  118. <div class="UserNameBox">
  119. <div class="userName">新的朋友</div>
  120. </div>
  121. <div class="rightNewFriendBox" v-for="(item,index) in userApplyList" :key="index">
  122. <div class="rightNewFriendItem">
  123. <div class="rightNewFriendAvatar">
  124. <img :src="item.avatar" v-if="item.avatar!=''">
  125. <img src="@/assets/chat/user/admin.png" v-else>
  126. </div>
  127. <div class="rightNewFriendInfo">
  128. <div class="rightNewFriendName">{{item.remark}}</div>
  129. <div class="rightNewFriendPhone">{{item.user_name}}</div>
  130. </div>
  131. </div>
  132. <div class="rightNewFriendStatus">
  133. <div class="rightNewFriendStatus2">
  134. <el-button type="primary" @click="openWindow(item)">接受</el-button>
  135. </div>
  136. </div>
  137. </div>
  138. <!-- <div class="rightNewFriendBox">
  139. <div class="rightNewFriendItem">
  140. <div class="rightNewFriendAvatar">
  141. <img src="@/assets/chat/user/user.png">
  142. </div>
  143. <div class="rightNewFriendInfo">
  144. <div class="rightNewFriendName">我是某某某</div>
  145. <div class="rightNewFriendPhone">15210211200</div>
  146. </div>
  147. </div>
  148. <div class="rightNewFriendStatus">
  149. <div class="rightNewFriendStatus1">已接受</div>
  150. </div>
  151. </div>
  152. <div class="rightNewFriendBox">
  153. <div class="rightNewFriendItem">
  154. <div class="rightNewFriendAvatar">
  155. <img src="@/assets/chat/user/user.png">
  156. </div>
  157. <div class="rightNewFriendInfo">
  158. <div class="rightNewFriendName">我是某某某</div>
  159. <div class="rightNewFriendPhone">15210211200</div>
  160. </div>
  161. </div>
  162. <div class="rightNewFriendStatus">
  163. <div class="rightNewFriendStatus2">
  164. <el-button type="primary" @click="friendWindowStatus=true">接受</el-button>
  165. </div>
  166. </div>
  167. </div> -->
  168. </div>
  169. <div class="hallRight" v-if="pagestatus==3">
  170. <div class="userInfoMainBox">
  171. <div class="userInfoMainItem">
  172. <div class="userInfoMainAvatar">
  173. <img :src="friendInfo.avatar" v-if="friendInfo.avatar!=''">
  174. <img src="@/assets/chat/user/admin.png" v-else>
  175. </div>
  176. <div class="userInfoMainInfo">
  177. <div class="userInfoMainName">
  178. <div class="userInfoMainNameText">{{friendInfo.user_name}}</div>
  179. </div>
  180. <div class="userInfoMainPhone">账号:{{friendInfo.user_name}}</div>
  181. </div>
  182. </div>
  183. <div class="userInfoMainLineBox">
  184. <div class="userInfoMainLineTitle">备注</div>
  185. <div class="userInfoMainLineContent">
  186. <div class="userInfoMainLineContentItem" @click="openEditWindow">
  187. <div v-if="friendInfo.remark!=null">{{friendInfo.remark}}</div>
  188. <div v-else>暂无备注</div>
  189. <div><i class="el-icon-edit"></i></div>
  190. </div>
  191. </div>
  192. </div>
  193. <!-- <div class="userInfoMainLineBox">
  194. <div class="userInfoMainLineTitle">共同群聊</div>
  195. <div class="userInfoMainLineContent">0个</div>
  196. </div>
  197. <div class="userInfoMainLineBox">
  198. <div class="userInfoMainLineTitle">添加方式</div>
  199. <div class="userInfoMainLineContent">通过账号添加</div>
  200. </div> -->
  201. <div class="userInfoMainButton">
  202. <!-- <div class="userInfoMainButtonItem">
  203. <img src="@/assets/chat/sendmessage.png">
  204. <div>删除好友</div>
  205. </div> -->
  206. <el-button type="primary" icon="el-icon-s-promotion" @click="sendMessage(friendInfo)">发送消息</el-button>
  207. <el-button type="danger" icon="el-icon-delete" @click="deleteFriend(friendInfo.friend_id)">删除好友</el-button>
  208. </div>
  209. </div>
  210. </div>
  211. </div>
  212. <!--发送好友申请弹出框 start------------------------------------------------------------>
  213. <el-dialog :visible.sync="addFriendWindowStatus" title="朋友申请" :close-on-click-modal="false" width="420px">
  214. <div>
  215. <div>
  216. <el-form :model="form" ref="form" autocomplete="off" label-position="left">
  217. <div class="formDiv">
  218. <el-form-item label="验证消息:" :label-width="formLabelWidth" class="custom-align-right">
  219. <el-input v-model="addform.remark" autocomplete="off" placeholder="我是.."></el-input>
  220. </el-form-item>
  221. </div>
  222. </el-form>
  223. </div>
  224. <div class="footerButtonBox">
  225. <el-button type="info" @click="addFriendWindowStatus=false">取消</el-button>
  226. <el-button type="primary" @click="addMyFriend">确定</el-button>
  227. </div>
  228. </div>
  229. </el-dialog>
  230. <!--发送好友申请弹出框 end------------------------------------------------------------>
  231. <!--请求验证弹出框 start------------------------------------------------------------>
  232. <el-dialog :visible.sync="friendWindowStatus" title="通过朋友验证" :close-on-click-modal="false" width="420px">
  233. <div>
  234. <div class="friendWindowText">
  235. <!--此处修改备注是没用的,修改备注需要friendId,但是此时你们还不是好友,改不了备注-->
  236. <!-- <el-form :model="form" ref="form" autocomplete="off" label-position="left">
  237. <div class="formDiv">
  238. <el-form-item label="备注名" :label-width="formLabelWidth" class="custom-align-right">
  239. <el-input v-model="form.remark" autocomplete="off" placeholder="请输入备注名.."></el-input>
  240. </el-form-item>
  241. </div>
  242. </el-form> -->
  243. 确定要添加<span>{{friendInfo.user_name}}</span>为好友吗?
  244. </div>
  245. <div class="footerButtonBox">
  246. <el-button type="info" @click="friendWindowStatus=false">取消</el-button>
  247. <el-button type="primary" @click="addFriend">确定</el-button>
  248. </div>
  249. </div>
  250. </el-dialog>
  251. <!--请求验证弹出框 end------------------------------------------------------------>
  252. <!--修改备注弹出框 start------------------------------------------------------------>
  253. <el-dialog :visible.sync="editWindowStatus" title="修改备注" :close-on-click-modal="false" width="420px">
  254. <div>
  255. <div>
  256. <el-form :model="form" ref="form" autocomplete="off" label-position="left">
  257. <div class="formDiv">
  258. <el-form-item label="备注名" :label-width="formLabelWidth" class="custom-align-right">
  259. <el-input v-model="remark" autocomplete="off" placeholder="请输入备注名.."></el-input>
  260. </el-form-item>
  261. </div>
  262. </el-form>
  263. </div>
  264. <div class="footerButtonBox">
  265. <el-button type="info" @click="editWindowStatus=false">取消</el-button>
  266. <el-button type="primary" @click="editFriend">确定</el-button>
  267. </div>
  268. </div>
  269. </el-dialog>
  270. <!--修改备注弹出框 end------------------------------------------------------------>
  271. </div>
  272. </template>
  273. <script>
  274. //引入公用样式
  275. import '@/styles/global.less';
  276. //引入baseUrl
  277. import URL from '@/utils/baseUrl';
  278. //引入组件
  279. import contactsTitle from './components/contactsTitle.vue';
  280. import { status } from 'nprogress';
  281. import openWindow from '@/utils/open-window';
  282. export default {
  283. components: {
  284. contactsTitle
  285. },
  286. data() {
  287. return {
  288. //1.全局配置 start------------------------------------------------------------>
  289. tableTitleName:'通讯录',
  290. pagestatus:1,//1=没有选择任何联系人 2=申请列表 3=好友详情 4=搜索结果
  291. formLabelWidth:"100px",//表单label宽度
  292. searchUserName:"",//搜索新添加用户
  293. searchUserListName:"",//搜索好友列表
  294. friendId:"",//要添加的好友id
  295. friendWindowStatus:false,//通过朋友申请弹出框
  296. searchWindowStatus:false,//搜索窗口左侧弹出框
  297. searchUserWindowStatus:false,//搜索好友列表弹出框
  298. editWindowStatus:false,//修改备注弹出框
  299. addFriendWindowStatus:false,//发送好友申请弹出框
  300. editFriendId:"",//要编辑的好友
  301. getFriendApplyListStatus:null,//获取好友申请列表状态
  302. //1.全局配置 end------------------------------------------------------------>
  303. //2.好友列表 start------------------------------------------------------------>
  304. userFriendList:[],//好友列表
  305. userApplyList:[],//好友申请列表
  306. searchFriendList:"",//搜索好友列表
  307. //2.好友列表 end------------------------------------------------------------>
  308. //3.通过好友申请 start------------------------------------------------------------>
  309. form:{
  310. //好友id
  311. id:"",
  312. //好友申请
  313. remark:"",
  314. //状态
  315. status:2,
  316. //申请id
  317. apply_id:""
  318. },
  319. //3.通过好友申请 end------------------------------------------------------------>
  320. //4.编辑好友 start------------------------------------------------------------>
  321. friendInfo:{},//好友信息
  322. remark:"",//修改的用户备注
  323. //4.编辑好友 end------------------------------------------------------------>
  324. //5.发送好友申请 start------------------------------------------------------------>
  325. addform:{
  326. //好友id
  327. friend_id:"",
  328. //好友申请
  329. remark:"",
  330. },
  331. //5.发送好友申请 end------------------------------------------------------------>
  332. };
  333. },
  334. methods: {
  335. //0.全局操作 start------------------------------------------------------------>
  336. //0.1切换页面状态
  337. tabPage(status){
  338. this.pagestatus = status;
  339. if(status==2){
  340. //如果是2 好友列表状态还原
  341. for(let item of this.userFriendList){
  342. item.status = 0;
  343. }
  344. }
  345. this.getFriendApplyList();
  346. },
  347. //0.全局操作 end------------------------------------------------------------>
  348. //1.好友列表 start------------------------------------------------------------>
  349. addUser(){
  350. this.pagestatus = 4;
  351. },
  352. closeAddUser(){
  353. this.pagestatus = 2;
  354. this.searchWindowStatus = false;
  355. },
  356. //1.1获取联系人列表
  357. getUserFriendList(){
  358. //获取用户身份id
  359. //const userId = this.$store.state.user.userid;
  360. this.$store.dispatch('chat/getFriendsList',{}).then(res=> {
  361. let data = res.data;
  362. for(let item of data){
  363. item.status = 0; //默认未选中
  364. }
  365. this.userFriendList = data;
  366. }).catch(() => {
  367. this.$message.error('获取好友列表失败!')
  368. })
  369. },
  370. //1.2选择联系人
  371. changeUserItem(id){
  372. for(let item of this.userFriendList){
  373. if(item.friend_id == id){
  374. item.status = 1;
  375. }else{
  376. item.status = 0;
  377. }
  378. }
  379. //切换页面到用户列表
  380. this.pagestatus = 3;
  381. //把要编辑的好友的id存起来
  382. this.editFriendId = id;
  383. // console.log(id)
  384. // console.log(this.userFriendList)
  385. //获取好友身份信息详情
  386. this.$store.dispatch('chat/getFriendInfo',{friend_id:this.editFriendId}).then(res=> {
  387. console.log(res);
  388. //保存好友信息
  389. this.friendInfo = res.data;
  390. }).catch(() => {
  391. this.$message.error('获得好友身份详情失败!')
  392. })
  393. },
  394. //1.3搜索联系人
  395. searchFriend(){
  396. //搜索联系人
  397. this.$store.dispatch('chat/searchFriend',{keyword:this.searchUserName}).then(res=> {
  398. //获取到好友
  399. this.searchWindowStatus = false;
  400. console.log(res);
  401. if(res.code==200){
  402. if(res.data.length>0){
  403. this.searchWindowStatus = true;
  404. this.searchFriendList = res.data[0];
  405. //搜出来以后查询两人是否为好友
  406. this.searchIsFriend(this.searchFriendList)
  407. }else{
  408. this.$message.error('没有找到该联系人!')
  409. }
  410. }else{
  411. this.$message.error('搜索关键字不能为空!')
  412. }
  413. })
  414. },
  415. //1.3搜索好友列表中的好友
  416. searchOrdFriend(){
  417. if(this.searchUserListName==""){
  418. this.$message.error('搜索关键字不能为空!')
  419. return;
  420. }else{
  421. let isFriend = false;
  422. for(let item of this.userFriendList){
  423. if(item.user_name == this.searchUserListName){
  424. isFriend = true;
  425. this.searchFriendList = item;
  426. }
  427. }
  428. if(isFriend){
  429. this.changeUserItem(this.searchFriendList.friend_id)
  430. //console.log(this.searchFriendList);
  431. }else{
  432. this.$message.error('没有找到该联系人!')
  433. }
  434. }
  435. },
  436. //1.好友列表 end------------------------------------------------------------>
  437. //2.获得好友申请列表 start------------------------------------------------------------>
  438. //2.1 好友申请列表
  439. getFriendApplyList(){
  440. console.log("获取好友申请列表");
  441. const userId = this.$store.state.user.userid;
  442. this.$store.dispatch('chat/getFriendsApplyList',{user_id:userId}).then(res=> {
  443. this.userApplyList = res.data;
  444. }).catch(() => {
  445. this.$message.error('获取好友申请列表失败!')
  446. })
  447. },
  448. //2.2 接受好友申请
  449. addFriend(){
  450. //通过用户申请
  451. console.log(this.form);
  452. this.$store.dispatch('chat/applyFriend',this.form).then(res=> {
  453. if(res.code==200){
  454. this.$message.success('成功添加好友!')
  455. this.friendWindowStatus = false;
  456. //重新加载用户列表
  457. this.getUserFriendList();
  458. //清空右侧
  459. this.friendInfo = {};
  460. //this.pagestatus = 1;
  461. this.getFriendApplyListStatus();
  462. }
  463. })
  464. },
  465. //2.3 删除好友
  466. deleteFriend(id){
  467. console.log(id);
  468. if(id){
  469. this.editFriendId = String(id);
  470. }
  471. console.log(id)
  472. this.$confirm('此操作将永久删除该联系人, 是否继续?', '提示', {
  473. confirmButtonText: '确定',
  474. cancelButtonText: '取消',
  475. type: 'warning'
  476. }).then(() => {
  477. console.log(this.editFriendId);
  478. this.$store.dispatch('chat/delFriend',{friend_id:this.editFriendId}).then(res=> {
  479. this.$message.success('删除成功!')
  480. //关闭用户详情显示
  481. this.pagestatus = 1;
  482. //重新装在用户列表
  483. this.getUserFriendList();
  484. })
  485. }).catch(() => {
  486. this.$message({
  487. type: 'warning',
  488. message: '已取消删除'
  489. });
  490. });
  491. },
  492. //2.4 编辑好友
  493. editFriend(){
  494. let data = {
  495. friend_id:this.editFriendId,
  496. remark:this.remark
  497. }
  498. //this.editFriendId
  499. this.$store.dispatch('chat/updateFriend',data).then(res=> {
  500. this.$message.success('修改备注名成功!')
  501. this.pagestatus = 1;
  502. this.editWindowStatus = false;
  503. this.getUserFriendList();
  504. this.remark = "";
  505. }).catch(() => {
  506. this.$message.error('修改备注名失败!')
  507. })
  508. },
  509. //2.5 发送好友申请
  510. addMyFriend(){
  511. console.log(this.addform);
  512. this.$store.dispatch('chat/addFriend',this.addform).then(res=> {
  513. this.$message.success("已成功发送好友申请!")
  514. this.addFriendWindowStatus = false;
  515. this.searchWindowStatus = false;
  516. this.addform.remark = "";
  517. })
  518. },
  519. //2.6 查询是否是好友
  520. searchIsFriend(item){
  521. let data = {
  522. friend_id:item.isfriend
  523. }
  524. console.log(data);
  525. this.$store.dispatch('chat/isFriend',data).then(res=>{
  526. console.log(res);
  527. if(res.code==0&&res.message=="不是好友"){
  528. this.searchFriendList.showBtn = false;
  529. }else{
  530. this.searchFriendList.showBtn = true;
  531. }
  532. this.$forceUpdate();
  533. })
  534. },
  535. //2.7 定时查询好友申请状态
  536. setTimeFriendApplyList(){
  537. console.log("定时查询好友申请状态");
  538. let that = this;
  539. this.getFriendApplyListStatus = setInterval(()=>{
  540. that.getFriendApplyList();
  541. },5000)
  542. },
  543. //2.获得好友申请列表 end------------------------------------------------------------>
  544. //3.操作弹出框 start------------------------------------------------------------>
  545. //用户菜单操作
  546. openWindow(item){
  547. this.form.id = item.id;
  548. this.friendInfo = item;
  549. //打开弹出框
  550. this.friendWindowStatus = true;
  551. },
  552. openEditWindow(id){
  553. //打开修改备注弹出框
  554. this.editWindowStatus = true;
  555. },
  556. openAddWindow(id){
  557. console.log(id);
  558. this.addform.friend_id = String(id);
  559. this.addFriendWindowStatus = true;
  560. },
  561. //发送消息
  562. sendMessage(friendInfo){
  563. console.log(friendInfo);
  564. //带着friend_id跳转到hall页面
  565. this.$router.push({
  566. path:'/hall',
  567. query:{friend_id:friendInfo.friend_id}
  568. });
  569. },
  570. //3.操作弹出框 end------------------------------------------------------------>
  571. },
  572. mounted() {
  573. //1.获取联系人列表
  574. this.getUserFriendList();
  575. //2.获取好友申请列表
  576. this.getFriendApplyList();
  577. //3.定时查询好友申请状态
  578. this.setTimeFriendApplyList();
  579. //打印当前用户id
  580. console.log("当前的用户id为:" + this.$store.state.user.userid);
  581. },
  582. beforeDestroy() {
  583. clearInterval(this.getFriendApplyListStatus);
  584. }
  585. };
  586. </script>
  587. <style scoped lang="less">
  588. .hallBox {
  589. display: flex;
  590. margin: 30px;
  591. //左侧
  592. .hallLeft {
  593. width: 420px;
  594. background: #fff;
  595. border-radius: 20px;
  596. margin-right: 20px;
  597. .newFriendBox {
  598. padding: 10px 25px 0 25px;
  599. font-size: 18px;
  600. color: #999;
  601. }
  602. .newFriendImgBox {
  603. margin: 10px 0 10px 0;
  604. padding: 20px 0 20px 25px;
  605. display: flex;
  606. align-items: center;
  607. justify-content: flex-start;
  608. cursor: pointer;
  609. border-bottom: 1px solid #E9EDF7;
  610. position: relative;
  611. box-sizing: border-box;
  612. border-right: 4px solid #fff;
  613. .newFriendImg {
  614. width: 58px;
  615. height: 58px;
  616. border-radius: 8px;
  617. background: #5570F1;
  618. display: flex;
  619. align-items: center;
  620. justify-content: center;
  621. margin-right: 20px;
  622. }
  623. .newFriendText {
  624. color: #333;
  625. font-size: 18px;
  626. display: flex;
  627. align-items: center;
  628. justify-content: space-between;
  629. flex: 1;
  630. span {
  631. background: #5570F1;
  632. color: #fff;
  633. line-height: 24px;
  634. font-size: 12px;
  635. width: 24px;
  636. height: 24px;
  637. text-align: center;
  638. border-radius: 50%;
  639. display: block;
  640. margin-right: 20px;
  641. }
  642. }
  643. }
  644. .newFriendIActive {
  645. border-right: 4px solid #5570F1 !important;
  646. background: #F5F7FD
  647. }
  648. .searchFriendBox {
  649. position: absolute;
  650. width: 280px;
  651. border-radius: 8px;
  652. top: 0;
  653. right: -300px;
  654. background: #fff;
  655. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  656. border-radius: 8px;
  657. z-index: 100;
  658. box-sizing: border-box;
  659. padding: 30px 0;
  660. .searchFriendItem {
  661. display: flex;
  662. align-items: center;
  663. justify-content: flex-start;
  664. border-bottom: 1px solid #E9EDF7;
  665. padding: 0 20px 30px 20px;
  666. .searchFriendAvatar {
  667. img {
  668. width: 66px;
  669. height: 66px;
  670. border-radius: 50%;
  671. }
  672. margin-right: 15px;
  673. }
  674. .searchFriendInfo {
  675. flex: 1;
  676. .searchFriendName {
  677. display: flex;
  678. align-items: center;
  679. .gender {
  680. img {
  681. width: 12px;
  682. height: 12px;
  683. }
  684. }
  685. img {
  686. width: 18px;
  687. height: 18px;
  688. cursor: pointer;
  689. }
  690. .searchFriendNameText {
  691. font-size: 18px;
  692. width: 120px;
  693. height: 28px;
  694. line-height: 28px;
  695. white-space: nowrap;
  696. overflow: hidden;
  697. text-overflow: ellipsis;
  698. }
  699. }
  700. .searchFriendPhone {
  701. font-size: 14px;
  702. color: #999;
  703. margin-top: 10px;
  704. }
  705. }
  706. }
  707. .searchFriendLineBox {
  708. display: flex;
  709. align-items: center;
  710. justify-content: flex-start;
  711. padding: 20px;
  712. border-bottom: 1px solid #E9EDF7;
  713. .searchFriendLineTitle{
  714. font-size: 16px;
  715. color: #999999;
  716. width: 90px;
  717. }
  718. .searchFriendLineContent{
  719. font-size: 16px;
  720. color: #333;
  721. flex: 1;
  722. .searchFriendLineContentItem{
  723. display: flex;
  724. align-items: center;
  725. justify-content: space-between;
  726. }
  727. }
  728. }
  729. .searchFriendButton {
  730. padding:40px 0 10px 0;
  731. text-align: center;
  732. .searchFriendButtonItem {
  733. font-size: 14px;
  734. color: #5570F1;
  735. img {
  736. width: 30px;
  737. height: 30px;
  738. margin-bottom: 5px;
  739. }
  740. }
  741. }
  742. }
  743. .userListTitle {
  744. padding: 15px 25px;
  745. font-size: 18px;
  746. color: #999;
  747. }
  748. .searchBox {
  749. padding-left: 25px;
  750. padding-right: 25px;
  751. padding-bottom: 20px;
  752. }
  753. .userListBox {
  754. padding: 15px 0;
  755. overflow-y: auto;
  756. height: 380px;
  757. .active {
  758. background: #F5F7FD;
  759. box-sizing: border-box;
  760. border-right: 4px solid #5570F1 !important;
  761. }
  762. .userItem {
  763. padding: 0 21px 0 25px;
  764. display: flex;
  765. align-items: center;
  766. justify-content: space-between;
  767. height: 90px;
  768. box-sizing: border-box;
  769. border-right: 4px solid #fff;
  770. cursor: pointer;
  771. .userAvatar {
  772. img {
  773. width: 58px;
  774. height: 58px;
  775. border-radius: 50%;
  776. }
  777. }
  778. .userInfo {
  779. flex: 1;
  780. box-sizing: border-box;
  781. padding-left: 15px;
  782. .userName {
  783. display: flex;
  784. align-items: center;
  785. justify-content: space-between;
  786. .userNameText {
  787. font-size: 18px;
  788. font-weight: bold;
  789. width: 240px;
  790. white-space: nowrap;
  791. overflow: hidden;
  792. text-overflow: ellipsis;
  793. color: #333;
  794. }
  795. .userMessageNum {
  796. font-size: 12px;
  797. color: #333;
  798. width: 24px;
  799. height: 24px;
  800. line-height: 24px;
  801. text-align: center;
  802. border-radius: 50%;
  803. background: #FFCC91;
  804. font-weight: bold;
  805. }
  806. }
  807. .userMessage {
  808. display: flex;
  809. align-items: center;
  810. justify-content: space-between;
  811. .userMessageText {
  812. display: block;
  813. width: 240px;
  814. white-space: nowrap;
  815. overflow: hidden;
  816. text-overflow: ellipsis;
  817. font-size: 14px;
  818. color: #999999;
  819. }
  820. .userMessageTime {
  821. font-size: 14px;
  822. color: #999999;
  823. }
  824. }
  825. }
  826. }
  827. }
  828. }
  829. //右侧
  830. .hallRight {
  831. flex: 1;
  832. background: #fff;
  833. border-radius: 20px;
  834. position: relative;
  835. height: 740px;
  836. .rightNewFriendBox {
  837. height: 126px;
  838. border-bottom: 1px solid #E9EDF7;
  839. display: flex;
  840. align-items: center;
  841. justify-content: space-between;
  842. box-sizing: border-box;
  843. padding: 30px 40px;
  844. .rightNewFriendItem {
  845. display: flex;
  846. align-items: center;
  847. .rightNewFriendAvatar {
  848. margin-right: 15px;
  849. img {
  850. width: 66px;
  851. height: 66px;
  852. border-radius: 50%;
  853. }
  854. }
  855. .rightNewFriendInfo {
  856. .rightNewFriendName {
  857. font-size: 18px;
  858. margin-bottom: 7px;
  859. }
  860. .rightNewFriendPhone {
  861. font-size: 18px;
  862. color: #999;
  863. }
  864. }
  865. }
  866. .rightNewFriendStatus {
  867. .rightNewFriendStatus1 {
  868. font-size: 16px;
  869. color: #999;
  870. width: 69px;
  871. text-align: center;
  872. }
  873. }
  874. }
  875. .userInfoMainBox {
  876. padding: 40px;
  877. max-width: 900px;
  878. margin: 100px auto 0 auto;
  879. .userInfoMainItem {
  880. display: flex;
  881. align-items: center;
  882. justify-content: flex-start;
  883. border-bottom: 1px solid #E9EDF7;
  884. padding: 0 20px 30px 20px;
  885. .userInfoMainAvatar {
  886. img {
  887. width: 66px;
  888. height: 66px;
  889. border-radius: 50%;
  890. }
  891. margin-right: 15px;
  892. }
  893. .userInfoMainInfo {
  894. flex: 1;
  895. .userInfoMainName {
  896. display: flex;
  897. align-items: center;
  898. justify-content: space-between;
  899. img {
  900. width: 18px;
  901. height: 18px;
  902. cursor: pointer;
  903. }
  904. .userInfoMainNameText {
  905. font-size: 18px;
  906. width: 240px;
  907. height: 28px;
  908. line-height: 28px;
  909. white-space: nowrap;
  910. overflow: hidden;
  911. text-overflow: ellipsis;
  912. }
  913. }
  914. .userInfoMainPhone {
  915. font-size: 14px;
  916. color: #999;
  917. margin-top: 10px;
  918. }
  919. }
  920. }
  921. .userInfoMainLineBox {
  922. display: flex;
  923. align-items: center;
  924. justify-content: flex-start;
  925. padding: 20px;
  926. border-bottom: 1px solid #E9EDF7;
  927. .userInfoMainLineTitle{
  928. font-size: 16px;
  929. color: #999999;
  930. width: 90px;
  931. }
  932. .userInfoMainLineContent{
  933. font-size: 16px;
  934. color: #333;
  935. flex: 1;
  936. .userInfoMainLineContentItem{
  937. display: flex;
  938. align-items: center;
  939. justify-content: space-between;
  940. cursor: pointer;
  941. }
  942. }
  943. }
  944. .userInfoMainButton {
  945. padding:40px 0 10px 0;
  946. text-align: center;
  947. .userInfoMainButtonItem {
  948. font-size: 14px;
  949. color: #5570F1;
  950. img {
  951. width: 30px;
  952. height: 30px;
  953. margin-bottom: 5px;
  954. }
  955. }
  956. }
  957. }
  958. .ifHallRigthNoMessage {
  959. color: #CCCCCC;
  960. font-size: 32px;
  961. font-weight: bold;
  962. text-align: center;
  963. height: 740px;
  964. line-height: 740px;
  965. }
  966. .userName {
  967. font-size: 20px;
  968. color: #333;
  969. font-weight: bold;
  970. }
  971. .ifNotice {
  972. padding-bottom: 60px !important;
  973. }
  974. .UserNameBox {
  975. display: flex;
  976. align-items: center;
  977. justify-content: space-between;
  978. padding: 40px 30px 30px 30px;
  979. border-bottom: 1px solid #E7E7E7;
  980. position: relative;
  981. .moreIcon {
  982. cursor: pointer;
  983. }
  984. .groupNotice {
  985. position: absolute;
  986. height: 40px;
  987. line-height: 40px;
  988. font-size: 16px;
  989. background:url('../../assets/chat/notice.png') no-repeat 10px center #F6F8FE;
  990. left: 30px;
  991. box-sizing: border-box;
  992. padding-left: 40px;
  993. bottom: 10px;
  994. color: #999999;
  995. border-radius: 10px;
  996. padding-right: 10px;
  997. width: 400px;
  998. white-space: nowrap;
  999. overflow: hidden;
  1000. text-overflow: ellipsis;
  1001. }
  1002. }
  1003. }
  1004. }
  1005. //弹出框底部按钮
  1006. .footerButtonBox {
  1007. padding-top: 40px;
  1008. text-align: center;
  1009. }
  1010. .friendWindowText {
  1011. font-size: 16px;
  1012. color: #333;
  1013. span {
  1014. color: #5570F1;
  1015. font-weight: bold;
  1016. }
  1017. }
  1018. //表单微调 start------------------------------------------------------------>*/
  1019. ::v-deep .custom-form-item > .el-form-item__label {
  1020. line-height: 140px !important;
  1021. }
  1022. ::v-deep .custom-textarea .el-textarea__inner {
  1023. resize: none; /* 禁止用拖拽调整大小 */
  1024. }
  1025. ::v-deep .custom-align-right .el-form-item__label {
  1026. text-align: right; /* 设置标签文字右对齐 */
  1027. }
  1028. ::v-deep .el-select-group__title {
  1029. color: #909399;
  1030. }
  1031. ::v-deep .el-select {
  1032. width: 100% !important;
  1033. }
  1034. ::v-deep .el-tabs__active-bar{
  1035. height: 1px !important;
  1036. }
  1037. ::v-deep .el-tabs__nav-wrap::after {
  1038. height:1px !important;
  1039. }
  1040. ::v-deep .el-tabs__header {
  1041. margin-bottom: 0 !important;
  1042. }
  1043. </style>