index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590
  1. <template>
  2. <view class="page">
  3. <view class="uni-list my_padding">
  4. <view class="uni-list-cell">
  5. <view class="uni-media-list uni-list-cell-navigate" style="flex-direction: row;">
  6. <view class="phto2">
  7. <image :src="userPhoto" :lazy-load="true" @tap="showPhoto()"/>
  8. </view>
  9. <view class="uni-media-list-detail" style="height: aotu;">
  10. <view class="uni-media-list-text-top">{{my.nickname}} <image class="sex_type" :src="'../../static/theme/default/details/' + my.sex + '.png'" :lazy-load="true" /></view>
  11. <view class="uni-media-list-info">
  12. 昵称: {{my.nickname}}
  13. </view>
  14. <view class="uni-media-list-info">
  15. 账号: {{my.username}}
  16. </view>
  17. <!--<view class="uni-media-list-info">-->
  18. <!--地区: -->
  19. <!--</view>-->
  20. <view class="uni-media-list-text-bottom uni-ellipsis"></view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="uni-card" v-if="isRemarks">
  26. <navigator hover-class="none" :url="'/pages/friend/remarks?user_id=' + user_id" animation-type="slide-in-bottom">
  27. <view class="uni-list">
  28. <view class="uni-list-cell" hover-class="none">
  29. <view class="uni-list-cell-navigate uni-navigate-right">
  30. <view style="width:100%">
  31. 设置备注和标签
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </navigator>
  37. </view>
  38. <view class="uni-card" v-if="is_in">
  39. <view class="uni-list">
  40. <view class="uni-list-cell" hover-class="none">
  41. <view class="uni-list-cell-navigate">
  42. <view style="width:100%;">
  43. 验证信息 <view class="show_text">{{my.content}}</view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="uni-card">
  50. <view class="uni-list">
  51. <view class="uni-list-cell" hover-class="none">
  52. <view class="uni-list-cell-navigate">
  53. <view style="width:100%;">
  54. 个性签名<view class="show_text">{{my.doodling}}</view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </view>
  60. <view class="uni-card" @tap="goCircle">
  61. <view class="uni-list">
  62. <view class="uni-list-cell" hover-class="none">
  63. <view class="uni-list-cell-navigate uni-navigate-right friend_cricle">
  64. <view class="cricle_title">朋友圈</view>
  65. <view class="uni-media-list-logo cricle_img"
  66. v-for="(img,img_index) in my.show_friend.circle"
  67. :key="img_index">
  68. <image :src="staticPath + img" style="border-radius: 8upx;" />
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <view class="uni-card" v-if="isFrom">
  75. <view class="uni-list">
  76. <view class="uni-list-cell" hover-class="none">
  77. <view class="uni-list-cell-navigate">
  78. <view style="width:100%">
  79. 来 源 <view class="show_text">{{my.from}}</view>
  80. </view>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="uni-card" v-if="type == 1" @tap="memberDetail">
  86. <view class="uni-list">
  87. <view class="uni-list-cell" hover-class="none">
  88. <view class="uni-list-cell-navigate">
  89. <view style="width:100%">
  90. 邀请人 <view class="show_text">{{invite_name}}</view>
  91. </view>
  92. </view>
  93. </view>
  94. </view>
  95. </view>
  96. <!--<view class="uni-card" v-if="isFrom && type == 1">-->
  97. <!--<navigator hover-class="none" :url="'/pages/chat/message/reduce?list_id=' + list_id" animation-type="slide-in-bottom">-->
  98. <!--<view class="uni-list">-->
  99. <!--<view class="uni-list-cell" hover-class="none">-->
  100. <!--<view class="uni-list-cell-navigate uni-navigate-right">-->
  101. <!--<view style="width:100%">-->
  102. <!--移除本群-->
  103. <!--</view>-->
  104. <!--</view>-->
  105. <!--</view>-->
  106. <!--</view>-->
  107. <!--</navigator>-->
  108. <!--</view>-->
  109. <view class="uni-card" v-if="my.is_friend">
  110. <view class="uni-list">
  111. <view class="uni-list-cell" hover-class="none" v-if="my.show_friend.phone">
  112. <view class="uni-list-cell-navigate">
  113. <navigator hover-class="none" >
  114. <view style="width:100%">
  115. 手机号码 <view class="show_text">{{my.show_friend.phone}}</view>
  116. </view>
  117. </navigator>
  118. </view>
  119. </view>
  120. <view class="uni-list-cell" hover-class="none" v-if="0">
  121. <view class="uni-list-cell-navigate uni-navigate-right">
  122. <navigator hover-class="none" url="/pages/details/more">
  123. <view style="width:100%">
  124. 更多信息
  125. </view>
  126. </navigator>
  127. </view>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="uni-card" @tap="goKefu">
  132. <view class="uni-list">
  133. <view class="uni-list-cell" hover-class="none" >
  134. <view class="uni-list-cell-navigate uni-navigate-right">
  135. <view hover-class="none">
  136. <view style="width:100%">
  137. 举报
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </view>
  144. <view class="uni-list" style="margin-top: 20upx;" >
  145. <view class="uni-list-cell" hover-class="none">
  146. <view class="uni-list-cell-navigate" @tap="goDelete">
  147. <view class="tool">
  148. 删除好友
  149. </view>
  150. </view>
  151. </view>
  152. </view>
  153. <view class="uni-list" style="margin-top: 20upx;" >
  154. <view class="uni-list-cell" hover-class="none">
  155. <view class="uni-list-cell-navigate" @tap="goPing">
  156. <view class="tool">
  157. 屏蔽好友
  158. </view>
  159. </view>
  160. </view>
  161. </view>
  162. <view class="uni-card">
  163. <view class="uni-list">
  164. <view v-if="my.is_friend">
  165. <view class="uni-list-cell" hover-class="none">
  166. <view class="uni-list-cell-navigate" @tap="goMsg()">
  167. <view class="tool">
  168. <view class="uni-media-list-logo">
  169. <image src="../../static/theme/default/details/msg.png"></image>
  170. </view>
  171. 发消息
  172. </view>
  173. </view>
  174. </view>
  175. <view class="uni-list-cell" hover-class="none" v-if="0">
  176. <view class="uni-list-cell-navigate">
  177. <view class="tool">
  178. <view class="uni-media-list-logo">
  179. <image src="../../static/theme/default/details/conversation.png"></image>
  180. </view>
  181. 音视频通话
  182. </view>
  183. </view>
  184. </view>
  185. </view>
  186. <view class="uni-list-cell" hover-class="none" v-else>
  187. <view class="uni-list-cell-navigate">
  188. <view class="tool" @tap="addFriend">
  189. 添加到通讯录
  190. </view>
  191. </view>
  192. </view>
  193. </view>
  194. </view>
  195. </view>
  196. </template>
  197. <script>
  198. import _get from '../../common/_get';
  199. import _hook from '../../common/_hook';
  200. import _data from '../../common/_data';
  201. export default {
  202. components: {
  203. },
  204. data() {
  205. return {
  206. user_id: '',
  207. is_type: 0,
  208. is_in: 0,
  209. type:0,
  210. list_id:'',
  211. invite_name:'',
  212. invite_id:0,
  213. my: {
  214. show_friend: [],
  215. photo: 'default_man/90.jpg',
  216. sex: 0,
  217. },
  218. }
  219. },
  220. onShow(){
  221. _hook.routeSonHook();
  222. let _this = this;
  223. if(this.type == 1 && this.list_id){
  224. _get.getInviteName({list_id:this.list_id,user_id:this.user_id},function (ret) {
  225. _this.invite_name = ret.invite_name
  226. _this.invite_id = ret.invite_id
  227. });
  228. }
  229. },
  230. computed: {
  231. isFrom(){
  232. return this.user_id != _data.data('user_info').id;
  233. },
  234. userPhoto(){
  235. return _data.staticPhoto() + this.my.photo + '?_=' + Math.random();
  236. },
  237. staticPath(){
  238. return _data.staticCircle();
  239. },
  240. isRemarks(){
  241. return this.my.is_friend && this.my.user_id != _data.data('user_info').id;
  242. },
  243. },
  244. methods: {
  245. goDelete(){
  246. let _this = this;
  247. uni.showModal({
  248. title: '重要提示',
  249. content: '删除好友及相关的会话数据并且不能恢复,确认删除吗?',
  250. success: function (res) {
  251. if (res.confirm) {
  252. _this.$httpSend({
  253. path: '/im/remove/friend',
  254. data: { user_id: _this.user_id },
  255. success(list_id) {
  256. uni.showToast({
  257. title: '操作成功',
  258. duration: 1500
  259. });
  260. /** 删除会话列表数据 **/
  261. for(let i = 0,local_chat_list = _data.localData('chat_list'),j = local_chat_list.length;i < j;i ++){
  262. if(local_chat_list[i].list_id == list_id){
  263. local_chat_list.splice(i,1);
  264. _data.localData('chat_list',local_chat_list);
  265. uni.$emit('data_chat_list',local_chat_list);
  266. break;
  267. }
  268. }
  269. /** 删除对话数据 */
  270. _data.localData(list_id,null);
  271. /** 从我的好友列表里删除 */
  272. for(let i = 0,v = _data.localData('friend_list'),j = v.length;i < j;i ++){
  273. for(let k = 0,o = v[i].data,l = o.length;k < l;k ++){
  274. if(o[k].user_id == _this.user_id){
  275. v[i].data.splice(k,1);
  276. _data.localData('friend_list',v);
  277. uni.$emit('data_friend_list',v);
  278. break;
  279. }
  280. }
  281. }
  282. setTimeout(() => {
  283. uni.switchTab({
  284. url: '../friend/index',
  285. });
  286. },1600);
  287. }
  288. });
  289. }
  290. }
  291. });
  292. },
  293. goPing(){
  294. let _this = this;
  295. uni.showModal({
  296. title: '重要提示',
  297. content: '是否要屏蔽好友?',
  298. success: function (res) {
  299. if (res.confirm) {
  300. _this.$httpSend({
  301. path: '/im/remove/friend',
  302. data: { user_id: _this.user_id },
  303. success(list_id) {
  304. uni.showToast({
  305. title: '操作成功',
  306. duration: 1500
  307. });
  308. /** 删除会话列表数据 **/
  309. for(let i = 0,local_chat_list = _data.localData('chat_list'),j = local_chat_list.length;i < j;i ++){
  310. if(local_chat_list[i].list_id == list_id){
  311. local_chat_list.splice(i,1);
  312. _data.localData('chat_list',local_chat_list);
  313. uni.$emit('data_chat_list',local_chat_list);
  314. break;
  315. }
  316. }
  317. /** 删除对话数据 */
  318. _data.localData(list_id,null);
  319. /** 从我的好友列表里删除 */
  320. for(let i = 0,v = _data.localData('friend_list'),j = v.length;i < j;i ++){
  321. for(let k = 0,o = v[i].data,l = o.length;k < l;k ++){
  322. if(o[k].user_id == _this.user_id){
  323. v[i].data.splice(k,1);
  324. _data.localData('friend_list',v);
  325. uni.$emit('data_friend_list',v);
  326. break;
  327. }
  328. }
  329. }
  330. setTimeout(() => {
  331. uni.switchTab({
  332. url: '../friend/index',
  333. });
  334. },1600);
  335. }
  336. });
  337. }
  338. }
  339. });
  340. },
  341. goKefu(){
  342. uni.navigateTo({'url':'/pages/chat/message?list_id='+_data.data('kefu_list_id')})
  343. },
  344. memberDetail(){
  345. if(!this.invite_id){
  346. return false;
  347. }
  348. uni.navigateTo({
  349. url:"../details/index?user_id="+this.invite_id+'&type=1&list_id='+this.list_id+'&is_action=2'
  350. })
  351. },
  352. showPhoto(){
  353. let photo = this.userPhoto.replace('70.jpg','300.jpg');
  354. uni.previewImage({
  355. indicator:"none",
  356. current: photo,
  357. urls: [ photo, ],
  358. });
  359. },
  360. goCircle(){
  361. uni.navigateTo({
  362. url: '../push/circle_details?user_id=' + this.my.user_id,
  363. });
  364. },
  365. goMsg(list_id){
  366. if(this.my.user_id == _data.data('user_info').id){
  367. uni.showToast({
  368. title: '不能给自己发消息',
  369. duration: 2000,
  370. icon: 'none',
  371. });
  372. return;
  373. }
  374. this.$httpSend({
  375. path: '/im/message/getListId',
  376. data: { user_id: this.my.user_id },
  377. success(data) {
  378. uni.navigateTo({
  379. url: '../chat/message?list_id=' + data.list_id,
  380. });
  381. }
  382. });
  383. },
  384. addFriend(){
  385. let _this = this;
  386. if(_this.is_in){
  387. _this.$httpSend({
  388. path: '/im/action/friendAddAction',
  389. data: { apply_id: _this.my.apply_id },
  390. success(data) {
  391. /** 更新申请列表数据 */
  392. let friend_apply_list = _data.localData('friend_apply_list');
  393. for(let i = 0,j = friend_apply_list.length;i < j;i ++){
  394. if(friend_apply_list[i].id == _this.my.apply_id){
  395. friend_apply_list[i].text = '已添加';
  396. _data.localData('friend_apply_list',friend_apply_list);
  397. break;
  398. }
  399. }
  400. uni.showToast({
  401. title: '已添加',
  402. duration: 2000,
  403. complete:function () {
  404. uni.navigateTo({url:'/pages/friend/index'})
  405. }
  406. });
  407. // setTimeout(() => {
  408. // uni.navigateBack();
  409. // },2500);
  410. }
  411. });
  412. } else {
  413. uni.navigateTo({
  414. url: ('../friend/apply?user_id=' + _this.user_id + '&is_type=' + _this.is_type),
  415. });
  416. }
  417. }
  418. },
  419. onLoad(option) {
  420. let _this = this;
  421. _this.user_id = option.user_id;
  422. if('in' in option){
  423. _this.is_in = option.in;
  424. }
  425. if('is_type' in option){
  426. _this.is_type = option.is_type;
  427. }
  428. if('type' in option){
  429. _this.type = option.type;
  430. }
  431. if('list_id' in option){
  432. _this.list_id = option.list_id;
  433. }
  434. if('is_action' in option){
  435. _this.is_action = option.is_action;
  436. }
  437. _this.$httpSend({
  438. path: '/im/get/details',
  439. data: { user_id: _this.user_id,in: _this.is_in },
  440. success(data) {
  441. data.username = data.username.substr(0,3)+'******'+ data.username.substr(9)
  442. data.show_friend.phone = data.username.substr(0,3)+'******'+ data.username.substr(9)
  443. console.log(data)
  444. _this.my = data;
  445. }
  446. });
  447. },
  448. onNavigationBarButtonTap(e) {
  449. if(this.user_id == _data.data('user_info').id){
  450. /* uni.showToast({
  451. title: '不能操作自己',
  452. duration: 1500,
  453. icon:'none',
  454. }); */
  455. return;
  456. }
  457. if(!this.my.is_friend){
  458. uni.showToast({
  459. title: '对方不是好友,没有更多操作了',
  460. duration: 1500,
  461. icon:'none',
  462. });
  463. return;
  464. }
  465. uni.navigateTo({
  466. url: ('./more_details?user_id=' + this.user_id),
  467. });
  468. },
  469. }
  470. </script>
  471. <style>
  472. .uni-media-list-detail {
  473. display: flex;
  474. flex: 1;
  475. flex-direction: column;
  476. justify-content: space-between;
  477. align-items: flex-start;
  478. overflow: hidden;
  479. margin-left: 26upx;
  480. }
  481. .uni-media-list-info{
  482. font-size: 26upx;
  483. padding-top: 5upx;
  484. color:#8f8f94;
  485. }
  486. .uni-media-list-text-top{
  487. margin-top: 0;
  488. font-size: 38upx;
  489. font-weight: 600;
  490. }
  491. .uni-media-list-logo {
  492. width: 45upx;
  493. height: 45upx;
  494. margin-right: 10upx;
  495. display: inline-block;
  496. vertical-align:middle;
  497. }
  498. .phto {
  499. position:relative;
  500. z-index: 3;
  501. margin-left: 15upx;
  502. margin-right: 20upx;
  503. bottom: 0;
  504. top: -30upx;
  505. width: 125upx;
  506. height: 125upx;
  507. }
  508. .phto2 {
  509. height:175upx;
  510. width:175upx;
  511. }
  512. .phto2 image{
  513. height: 100%;
  514. width: 100%;
  515. border-radius: 10px;
  516. }
  517. .uni-list-cell{
  518. height:auto !important;
  519. }
  520. .uni-card {
  521. box-shadow: none;
  522. }
  523. .my_padding:before {
  524. background-color:white;
  525. }
  526. .tool {
  527. width:100%;
  528. text-align: center;
  529. }
  530. .friend_cricle {
  531. padding-top: 20upx;
  532. padding-bottom: 20upx;
  533. }
  534. .cricle_title {
  535. display: inline-block;
  536. width: 120upx;
  537. }
  538. .cricle_img {
  539. width: 100upx;
  540. height: 100upx;
  541. }
  542. .sex_type {
  543. width: 35upx;
  544. height: 35upx;
  545. margin-right: 0upx;
  546. margin-left: 20upx;
  547. }
  548. .show_text {
  549. position: absolute;
  550. right: 60upx;
  551. color: #8f8f94;
  552. display: inline-block;
  553. }
  554. </style>