index.vue 18 KB

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