contacts.vue 35 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052
  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. .active {
  756. background: #F5F7FD;
  757. box-sizing: border-box;
  758. border-right: 4px solid #5570F1 !important;
  759. }
  760. .userItem {
  761. padding: 0 21px 0 25px;
  762. display: flex;
  763. align-items: center;
  764. justify-content: space-between;
  765. height: 90px;
  766. box-sizing: border-box;
  767. border-right: 4px solid #fff;
  768. cursor: pointer;
  769. .userAvatar {
  770. img {
  771. width: 58px;
  772. height: 58px;
  773. border-radius: 50%;
  774. }
  775. }
  776. .userInfo {
  777. flex: 1;
  778. box-sizing: border-box;
  779. padding-left: 15px;
  780. .userName {
  781. display: flex;
  782. align-items: center;
  783. justify-content: space-between;
  784. .userNameText {
  785. font-size: 18px;
  786. font-weight: bold;
  787. width: 240px;
  788. white-space: nowrap;
  789. overflow: hidden;
  790. text-overflow: ellipsis;
  791. color: #333;
  792. }
  793. .userMessageNum {
  794. font-size: 12px;
  795. color: #333;
  796. width: 24px;
  797. height: 24px;
  798. line-height: 24px;
  799. text-align: center;
  800. border-radius: 50%;
  801. background: #FFCC91;
  802. font-weight: bold;
  803. }
  804. }
  805. .userMessage {
  806. display: flex;
  807. align-items: center;
  808. justify-content: space-between;
  809. .userMessageText {
  810. display: block;
  811. width: 240px;
  812. white-space: nowrap;
  813. overflow: hidden;
  814. text-overflow: ellipsis;
  815. font-size: 14px;
  816. color: #999999;
  817. }
  818. .userMessageTime {
  819. font-size: 14px;
  820. color: #999999;
  821. }
  822. }
  823. }
  824. }
  825. }
  826. }
  827. //右侧
  828. .hallRight {
  829. flex: 1;
  830. background: #fff;
  831. border-radius: 20px;
  832. position: relative;
  833. height: 1184px;
  834. .rightNewFriendBox {
  835. height: 126px;
  836. border-bottom: 1px solid #E9EDF7;
  837. display: flex;
  838. align-items: center;
  839. justify-content: space-between;
  840. box-sizing: border-box;
  841. padding: 30px 40px;
  842. .rightNewFriendItem {
  843. display: flex;
  844. align-items: center;
  845. .rightNewFriendAvatar {
  846. margin-right: 15px;
  847. img {
  848. width: 66px;
  849. height: 66px;
  850. border-radius: 50%;
  851. }
  852. }
  853. .rightNewFriendInfo {
  854. .rightNewFriendName {
  855. font-size: 18px;
  856. margin-bottom: 7px;
  857. }
  858. .rightNewFriendPhone {
  859. font-size: 18px;
  860. color: #999;
  861. }
  862. }
  863. }
  864. .rightNewFriendStatus {
  865. .rightNewFriendStatus1 {
  866. font-size: 16px;
  867. color: #999;
  868. width: 69px;
  869. text-align: center;
  870. }
  871. }
  872. }
  873. .userInfoMainBox {
  874. padding: 40px;
  875. max-width: 900px;
  876. margin: 100px auto 0 auto;
  877. .userInfoMainItem {
  878. display: flex;
  879. align-items: center;
  880. justify-content: flex-start;
  881. border-bottom: 1px solid #E9EDF7;
  882. padding: 0 20px 30px 20px;
  883. .userInfoMainAvatar {
  884. img {
  885. width: 66px;
  886. height: 66px;
  887. border-radius: 50%;
  888. }
  889. margin-right: 15px;
  890. }
  891. .userInfoMainInfo {
  892. flex: 1;
  893. .userInfoMainName {
  894. display: flex;
  895. align-items: center;
  896. justify-content: space-between;
  897. img {
  898. width: 18px;
  899. height: 18px;
  900. cursor: pointer;
  901. }
  902. .userInfoMainNameText {
  903. font-size: 18px;
  904. width: 240px;
  905. height: 28px;
  906. line-height: 28px;
  907. white-space: nowrap;
  908. overflow: hidden;
  909. text-overflow: ellipsis;
  910. }
  911. }
  912. .userInfoMainPhone {
  913. font-size: 14px;
  914. color: #999;
  915. margin-top: 10px;
  916. }
  917. }
  918. }
  919. .userInfoMainLineBox {
  920. display: flex;
  921. align-items: center;
  922. justify-content: flex-start;
  923. padding: 20px;
  924. border-bottom: 1px solid #E9EDF7;
  925. .userInfoMainLineTitle{
  926. font-size: 16px;
  927. color: #999999;
  928. width: 90px;
  929. }
  930. .userInfoMainLineContent{
  931. font-size: 16px;
  932. color: #333;
  933. flex: 1;
  934. .userInfoMainLineContentItem{
  935. display: flex;
  936. align-items: center;
  937. justify-content: space-between;
  938. cursor: pointer;
  939. }
  940. }
  941. }
  942. .userInfoMainButton {
  943. padding:40px 0 10px 0;
  944. text-align: center;
  945. .userInfoMainButtonItem {
  946. font-size: 14px;
  947. color: #5570F1;
  948. img {
  949. width: 30px;
  950. height: 30px;
  951. margin-bottom: 5px;
  952. }
  953. }
  954. }
  955. }
  956. .ifHallRigthNoMessage {
  957. color: #CCCCCC;
  958. font-size: 32px;
  959. font-weight: bold;
  960. text-align: center;
  961. height: 1184px;
  962. line-height: 1184px;
  963. }
  964. .userName {
  965. font-size: 20px;
  966. color: #333;
  967. font-weight: bold;
  968. }
  969. .ifNotice {
  970. padding-bottom: 60px !important;
  971. }
  972. .UserNameBox {
  973. display: flex;
  974. align-items: center;
  975. justify-content: space-between;
  976. padding: 40px 30px 30px 30px;
  977. border-bottom: 1px solid #E7E7E7;
  978. position: relative;
  979. .moreIcon {
  980. cursor: pointer;
  981. }
  982. .groupNotice {
  983. position: absolute;
  984. height: 40px;
  985. line-height: 40px;
  986. font-size: 16px;
  987. background:url('../../assets/chat/notice.png') no-repeat 10px center #F6F8FE;
  988. left: 30px;
  989. box-sizing: border-box;
  990. padding-left: 40px;
  991. bottom: 10px;
  992. color: #999999;
  993. border-radius: 10px;
  994. padding-right: 10px;
  995. width: 400px;
  996. white-space: nowrap;
  997. overflow: hidden;
  998. text-overflow: ellipsis;
  999. }
  1000. }
  1001. }
  1002. }
  1003. //弹出框底部按钮
  1004. .footerButtonBox {
  1005. padding-top: 40px;
  1006. text-align: center;
  1007. }
  1008. .friendWindowText {
  1009. font-size: 16px;
  1010. color: #333;
  1011. span {
  1012. color: #5570F1;
  1013. font-weight: bold;
  1014. }
  1015. }
  1016. //表单微调 start------------------------------------------------------------>*/
  1017. ::v-deep .custom-form-item > .el-form-item__label {
  1018. line-height: 140px !important;
  1019. }
  1020. ::v-deep .custom-textarea .el-textarea__inner {
  1021. resize: none; /* 禁止用拖拽调整大小 */
  1022. }
  1023. ::v-deep .custom-align-right .el-form-item__label {
  1024. text-align: right; /* 设置标签文字右对齐 */
  1025. }
  1026. ::v-deep .el-select-group__title {
  1027. color: #909399;
  1028. }
  1029. ::v-deep .el-select {
  1030. width: 100% !important;
  1031. }
  1032. ::v-deep .el-tabs__active-bar{
  1033. height: 1px !important;
  1034. }
  1035. ::v-deep .el-tabs__nav-wrap::after {
  1036. height:1px !important;
  1037. }
  1038. ::v-deep .el-tabs__header {
  1039. margin-bottom: 0 !important;
  1040. }
  1041. </style>