index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682
  1. <template>
  2. <view class="self-card" :style="{ '--height': tovw(+CustomBar + 10) }">
  3. <view class="footer" :style="{ height: (tovw(CustomBar).replace('vw', '')) * 375 / 100 + 'px' }"
  4. style="background: linear-gradient( 225deg, #F43A50 0%, #C30D23 100%);top: 0;">
  5. <view class="custom"
  6. :style="{ height: (tovw(Custom.height).replace('vw', '')) * 375 / 100 + 'px', top: (tovw(Custom.top).replace('vw', '')) * 375 / 100 + 'px' }">
  7. <view v-if="userInfo.name">{{ userInfo.name }}的名片</view>
  8. <view v-else>暂无信息</view>
  9. <view class="back" :style="{ lineHeight: (tovw(Custom.height).replace('vw', '')) * 375 / 100 + 'px' }"
  10. @click="onBack">
  11. <text class=" iconfont icon-a-wodetiaozhuan" />
  12. </view>
  13. </view>
  14. </view>
  15. <view class="head" :style="[{ height: tovw(+CustomBar + 184) }]"
  16. style="background: linear-gradient( 225deg, #F43A50 0%, #C30D23 100%)">
  17. <image class="bg-bottom" mode="aspectFill" src="/static/workbench/减去.svg">
  18. </image>
  19. <view class="card">
  20. <view class="header">
  21. <view class="left">
  22. <view class="title">
  23. <text>{{ userInfo.name || '暂无' }}</text>
  24. <text>{{ userInfo.rolenames || '暂无' }}</text>
  25. </view>
  26. <text class="phone">{{ userInfo.phonebumber || '暂无' }}</text>
  27. <view class="redline"></view>
  28. </view>
  29. <navigator class="right">
  30. <image
  31. :src="userInfo.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202406011717209838416B6150695f.webp'"
  32. mode="aspectFill">
  33. </image>
  34. </navigator>
  35. </view>
  36. <view class="bottom">
  37. <view class="left">
  38. <view>
  39. <i class="iconfont icon-qiye-hui"></i>
  40. <view class="text">{{ userInfo.enterprisename || '暂无' }}</view>
  41. </view>
  42. <view>
  43. <i class="iconfont icon-youxiang"></i>
  44. <view class="text">{{ userInfo.email || '暂无' }}</view>
  45. </view>
  46. <view style="margin-bottom: 0 !important;">
  47. <i class="iconfont icon-dizhi_xian"></i>
  48. <view class="text u-line-2">{{ userInfo.address || '暂无' }}</view>
  49. </view>
  50. </view>
  51. <navigator class="right" :url="'/cloud/businessCard/share?id=' + userid">
  52. <image class="code" src="/static/workbench/二维码.svg" />
  53. <text>名片码</text>
  54. </navigator>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="card-handle">
  59. <view class="top">
  60. <view class="left">
  61. <view class="avatar">
  62. <block v-for="item in userInfo.readusers" :key="item.rowindex">
  63. <image
  64. :src="item.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202406011717209838416B6150695f.webp'"
  65. v-if="item.rowindex < 4" :key="item.rowindex" />
  66. </block>
  67. <text style="color:#BBBBBB">...</text>
  68. </view>
  69. <view class="readcount">浏览了{{ userInfo.count_read }}</view>
  70. </view>
  71. <navigator url="#" class="right" @click="goodClick">
  72. <i :class="['iconfont', userInfo.islike == 1 ? ' icon-yidianzan' : ' icon-weidianzan']"
  73. :style="{ color: userInfo.islike ? '#C30D23' : '#666666' }"></i>
  74. <text>点赞{{ userInfo.count_like }}</text>
  75. </navigator>
  76. </view>
  77. <view class="bottom">
  78. <view class="but" hover-class="navigator-hover" @click="copy">
  79. <i class="iconfont icon-fuzhi" style="color: #C30D23;"></i>
  80. 复制电话
  81. </view>
  82. <view class="but" hover-class="navigator-hover" @click="shareClick">
  83. <i class="iconfont icon-zhuanfa"></i>
  84. 转发名片
  85. </view>
  86. </view>
  87. </view>
  88. <view class="user-info">
  89. <text class="title-max">简介</text>
  90. <view class="tag-box">
  91. <text class="title-min">印象标签</text>
  92. <view class="tag-list" v-if="userInfo.tag.length">
  93. <view class="tag" v-for="(item, index) in userInfo.tag" :key="index">{{ item }}</view>
  94. </view>
  95. <text v-else style="font-weight: 500;font-size: 14px;color: #666666;">暂无</text>
  96. </view>
  97. <view class="descript-box">
  98. <text class="title-min">自我介绍</text>
  99. <text class="descript">{{ userInfo.remarks || '暂无' }}</text>
  100. </view>
  101. <view class="image-box">
  102. <text class="title-min">照片墙</text>
  103. <block v-if="userInfo.images.length">
  104. <view class="image" v-for="item in userInfo.images" :key="item.attachmentid" @click="preview(item.url)">
  105. <u--image width="100%" :lazy-load="true" :src="item.url" radius="5"></u--image>
  106. </view>
  107. </block>
  108. <text v-else style="font-weight: 500;font-size: 14px;color: #666666;">暂无</text>
  109. </view>
  110. </view>
  111. <view class="footer2">
  112. <navigator class="but" :url="'/cloud/businessCard/edit?id=' + userid" @click="goEditPage">
  113. <text>修改名片</text>
  114. </navigator>
  115. </view>
  116. <u-popup :show="shareShow" mode="bottom" @close="shareShow = false">
  117. <view class="share-box">
  118. <contact openType="share">
  119. <view class="item" hover-class="navigator-hover" @click="shareWx">
  120. <image mode="widthFix" src="/static/workbench/微信好友.svg" />
  121. <text>微信好友</text>
  122. </view>
  123. </contact>
  124. <navigator class="item" :url="'/cloud/businessCard/share?id=' + userid">
  125. <image mode="widthFix" src="/static/workbench/名片海报.svg" />
  126. <text>名片海报</text>
  127. </navigator>
  128. </view>
  129. </u-popup>
  130. </view>
  131. </template>
  132. <script>
  133. import contact from "../../components/contact"
  134. import { viewImage } from "../../utils/settleFiles.js"
  135. export default {
  136. components: { contact },
  137. data() {
  138. return {
  139. userInfo: { tag: [], images: [] ,readusers:[]},
  140. userid: uni.getStorageSync('userMsg').userid,
  141. shareShow: false
  142. }
  143. },
  144. computed: {
  145. },
  146. onUnload () {
  147. delete this.$Http.refreshUserInfoData
  148. },
  149. methods: {
  150. preview(url) {
  151. viewImage(url)
  152. },
  153. goEditPage() {
  154. this.$Http.editUser = function (id) {
  155. this.getuserInfo(id)
  156. delete this.$Http.editUser
  157. }.bind(this)
  158. },
  159. async getuserInfo(id) {
  160. let res = await this.$Http.basic({
  161. "id": 20240514161502,
  162. "content": {
  163. userid: id
  164. },
  165. })
  166. if (this.cutoff(res.msg)) return
  167. this.userInfo = res.data
  168. this.userInfo.headpic = this.userInfo.attinfos.find(v => v.usetype == "headportrait") && this.userInfo.attinfos.find(v => v.usetype == "headportrait").url || '';
  169. this.userInfo.images = this.userInfo.attinfos.filter(v => v.usetype != "headportrait")
  170. console.log(this.userInfo, '用户信息');
  171. },
  172. shareClick() {
  173. this.shareShow = true
  174. },
  175. onBack() {
  176. let curPages = getCurrentPages()
  177. if (curPages.length == 1) {
  178. uni.redirectTo({
  179. url:'/pages/index/index',
  180. })
  181. } else {
  182. uni.navigateBack()
  183. }
  184. },
  185. async goodClick() {
  186. let res = await this.$Http.basic({
  187. "id": 20240416133702,
  188. "content": {
  189. "ownertable": "sys_users",
  190. "ownerid": this.userid,
  191. "type": 2//1:收藏,2:点赞
  192. },
  193. })
  194. if (this.cutoff(res.msg)) return;
  195. this.getuserInfo(this.userid)
  196. },
  197. copy() {
  198. uni.setClipboardData({
  199. data: this.userInfo.phonenumber,
  200. success: (result) => {
  201. uni.showToast({
  202. title: "已复制",
  203. icon: "none",
  204. duration: 1500,
  205. })
  206. }
  207. });
  208. }
  209. },
  210. onShareAppMessage(res) {
  211. return {
  212. title: this.userInfo.name, // 标题
  213. path: "/cloud/businessCard/index?id=" + this.userid, // 分享路径
  214. imageUrl: ""// 分享图
  215. };
  216. },
  217. onLoad(options) {
  218. this.isInitializeLogin(render.bind(this))
  219. function render() {
  220. if (options.q) {
  221. let params = this.getUrlParams(options.q);
  222. user.wechatBindUserid = params.userid;
  223. this.userid = params.userid
  224. }
  225. this.getuserInfo(this.userid)
  226. }
  227. },
  228. }
  229. </script>
  230. <style lang="scss">
  231. .self-card {
  232. .head {
  233. position: relative;
  234. width: 100vw;
  235. .bg-bottom {
  236. position: absolute;
  237. bottom: -1px;
  238. left: 0;
  239. width: 100vw;
  240. }
  241. .custom {
  242. position: absolute;
  243. width: 100vw;
  244. display: flex;
  245. justify-content: center;
  246. align-items: center;
  247. font-family: PingFang SC, PingFang SC;
  248. font-weight: 500;
  249. font-size: 17px;
  250. color: #FFFFFF;
  251. .back {
  252. position: absolute;
  253. padding: 0 10px;
  254. left: 0;
  255. color: #fff;
  256. font-size: 12px;
  257. transform: rotateY(180deg);
  258. }
  259. }
  260. .card {
  261. width: 355px;
  262. height: 220px;
  263. box-sizing: border-box;
  264. background: #FFFFFF;
  265. box-shadow: 0px 2px 10px 1px rgba(0, 0, 0, 0.16);
  266. border-radius: 8px 8px 8px 8px;
  267. position: absolute;
  268. top: var(--height);
  269. left: 10px;
  270. padding: 20px;
  271. font-family: Source Han Sans SC, Source Han Sans SC;
  272. .header {
  273. display: flex;
  274. justify-content: space-between;
  275. .left {
  276. display: flex;
  277. flex-direction: column;
  278. justify-content: space-between;
  279. .title {
  280. display: flex;
  281. align-items: center;
  282. text {
  283. &:first-child {
  284. font-weight: 500;
  285. font-size: 18px;
  286. color: #333333;
  287. }
  288. &:last-child {
  289. font-weight: 400;
  290. font-size: 12px;
  291. color: #999999;
  292. margin-left: 10px;
  293. }
  294. }
  295. margin-bottom: 5px;
  296. }
  297. .phone {
  298. font-weight: 500;
  299. font-size: 16px;
  300. color: #333333;
  301. }
  302. .redline {
  303. width: 24px;
  304. height: 2px;
  305. background: #C30D23;
  306. margin-top: 15px;
  307. }
  308. }
  309. .right {
  310. width: 56px;
  311. height: 56px;
  312. background: #DCEBF8;
  313. box-shadow: 0px 3px 6px 1px #E0D6D7;
  314. border: 2px solid #FFFFFF;
  315. border-radius: 50%;
  316. image {
  317. width: 100%;
  318. height: 100%;
  319. border-radius: 50%;
  320. }
  321. }
  322. }
  323. .bottom {
  324. display: flex;
  325. justify-content: space-between;
  326. align-items: flex-start;
  327. font-family: Source Han Sans SC, Source Han Sans SC;
  328. font-weight: 400;
  329. font-size: 12px;
  330. color: #666666;
  331. margin-top: 22px;
  332. .left {
  333. display: flex;
  334. flex-direction: column;
  335. >view {
  336. margin-bottom: 13px;
  337. display: flex;
  338. align-content: center;
  339. align-items: center;
  340. i {
  341. font-size: 16px;
  342. }
  343. .text {
  344. margin-left: 10px;
  345. max-width: 211px;
  346. }
  347. }
  348. }
  349. .right {
  350. display: flex;
  351. flex-direction: column;
  352. align-items: center;
  353. align-content: center;
  354. padding: 3px;
  355. border-radius: 5px;
  356. text {
  357. font-weight: 400;
  358. font-size: 12px;
  359. color: #666666;
  360. }
  361. .code {
  362. width: 32px;
  363. height: 32px;
  364. margin-bottom: 4px;
  365. }
  366. }
  367. }
  368. }
  369. }
  370. .card-handle {
  371. padding: 50px 10px 20px 10px;
  372. background: #ffffff;
  373. margin-top: 15px;
  374. .top {
  375. display: flex;
  376. justify-content: space-between;
  377. align-items: center;
  378. align-content: center;
  379. font-family: Source Han Sans SC, Source Han Sans SC;
  380. font-size: 12px;
  381. color: #999999;
  382. .left {
  383. display: flex;
  384. flex-direction: column;
  385. .avatar {
  386. display: flex;
  387. align-items: flex-start;
  388. align-content: center;
  389. image {
  390. margin-right: 5px;
  391. width: 24px;
  392. height: 24px;
  393. border-radius: 50%;
  394. }
  395. text {
  396. transform: scale(1.5);
  397. }
  398. }
  399. .readcount {
  400. margin-top: 5px;
  401. display: block;
  402. }
  403. }
  404. .right {
  405. display: flex;
  406. flex-direction: column;
  407. align-content: center;
  408. align-items: center;
  409. width: 35px;
  410. height: 40px;
  411. border-radius: 3px;
  412. i {
  413. display: block;
  414. color: #666666;
  415. }
  416. text {
  417. margin-top: 5px;
  418. display: block;
  419. }
  420. }
  421. }
  422. .bottom {
  423. display: flex;
  424. justify-content: space-between;
  425. align-items: center;
  426. align-content: center;
  427. margin-top: 25px;
  428. .but {
  429. display: flex;
  430. align-items: center;
  431. justify-content: center;
  432. box-sizing: border-box;
  433. border-radius: 8px 8px 8px 8px;
  434. font-family: Source Han Sans SC, Source Han Sans SC;
  435. font-weight: 400;
  436. font-size: 16px;
  437. width: 173px;
  438. height: 50px;
  439. line-height: 50px;
  440. text-align: center;
  441. &:nth-child(1) {
  442. background: #FFFFFF;
  443. border: 1px solid #CCCCCC;
  444. color: #666666;
  445. }
  446. &:nth-child(2) {
  447. background: #C30D23;
  448. color: #FFFFFF;
  449. }
  450. view {
  451. margin-right: 10px;
  452. }
  453. }
  454. }
  455. }
  456. .user-info {
  457. padding: 12px 10px 70px 10px;
  458. font-family: PingFang SC, PingFang SC;
  459. background: #ffffff;
  460. margin-top: 10px;
  461. .title-min {
  462. margin-bottom: 10px;
  463. font-weight: 500;
  464. font-size: 14px;
  465. color: #666666;
  466. display: block;
  467. }
  468. .title-max {
  469. margin-bottom: 21px;
  470. font-weight: 500;
  471. font-size: 16px;
  472. color: #333333;
  473. display: block;
  474. }
  475. .tag-box {
  476. display: flex;
  477. flex-direction: column;
  478. margin-bottom: 20px;
  479. .title-min {}
  480. .tag-list {
  481. display: flex;
  482. align-content: center;
  483. align-items: center;
  484. flex-wrap: wrap;
  485. .tag {
  486. margin-right: 10px;
  487. padding: 6px 10px;
  488. background: #F2F2F2;
  489. border-radius: 5px 5px 5px 5px;
  490. margin-right: 10px;
  491. font-weight: 400;
  492. font-size: 14px;
  493. color: #333333;
  494. &:last-child {
  495. margin-right: 0;
  496. }
  497. }
  498. }
  499. }
  500. .descript-box {
  501. margin-bottom: 20px;
  502. display: flex;
  503. flex-direction: column;
  504. .descript {
  505. font-weight: 400;
  506. font-size: 14px;
  507. color: #666666;
  508. }
  509. }
  510. .image-box {
  511. display: flex;
  512. flex-direction: column;
  513. .image {
  514. width: 100%;
  515. height: 240px;
  516. margin-bottom: 10px;
  517. }
  518. }
  519. }
  520. .footer {
  521. display: flex;
  522. position: fixed;
  523. bottom: 0;
  524. left: 0;
  525. width: 375px;
  526. height: 64px;
  527. background: #FFFFFF;
  528. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  529. box-sizing: border-box;
  530. z-index: 9;
  531. padding: 5px 10px;
  532. .custom {
  533. position: absolute;
  534. width: 100vw;
  535. display: flex;
  536. justify-content: center;
  537. align-items: center;
  538. font-family: PingFang SC, PingFang SC;
  539. font-weight: 500;
  540. font-size: 17px;
  541. color: #FFFFFF;
  542. .back {
  543. position: absolute;
  544. padding: 0 10px;
  545. left: 0;
  546. color: #fff;
  547. font-size: 12px;
  548. transform: rotateY(180deg);
  549. }
  550. }
  551. .but {
  552. width: 355px;
  553. height: 45px;
  554. font-family: PingFang SC, PingFang SC;
  555. font-weight: 500;
  556. font-size: 14px;
  557. color: #FFFFFF;
  558. background: #C30D23;
  559. border-radius: 5px 5px 5px 5px;
  560. border: 1px solid #FFFFFF;
  561. display: flex;
  562. align-items: center;
  563. align-content: center;
  564. justify-content: space-evenly;
  565. }
  566. }
  567. }
  568. .footer2 {
  569. position: fixed;
  570. bottom: 0;
  571. width: 100vw;
  572. height: 65px;
  573. background: #FFFFFF;
  574. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  575. box-sizing: border-box;
  576. padding: 5px 10px;
  577. display: flex;
  578. .but {
  579. display: flex;
  580. align-items: center;
  581. justify-content: center;
  582. width: 100%;
  583. height: 45px;
  584. background: #C30D23;
  585. border-radius: 5px;
  586. font-family: PingFang SC, PingFang SC;
  587. font-size: 14px;
  588. color: #FFFFFF;
  589. }
  590. .forbidden {
  591. opacity: .6;
  592. }
  593. }
  594. .share-box {
  595. padding: 30px 0;
  596. display: flex;
  597. align-items: center;
  598. align-content: center;
  599. justify-content: space-evenly;
  600. .item {
  601. display: flex;
  602. flex-direction: column;
  603. align-items: center;
  604. align-content: center;
  605. border-radius: 5px;
  606. image {
  607. width: 50px;
  608. height: 50px;
  609. }
  610. text {
  611. margin-top: 5px;
  612. font-family: Source Han Sans SC, Source Han Sans SC;
  613. font-weight: 400;
  614. font-size: 12px;
  615. color: #333333;
  616. }
  617. }
  618. }
  619. </style>