index.vue 11 KB

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