index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761
  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. ownertable: "sys_users",
  304. ownerid: this.userid,
  305. });
  306. }
  307. },
  308. };
  309. </script>
  310. <style lang="scss">
  311. .self-card {
  312. .head {
  313. position: relative;
  314. width: 100vw;
  315. .bg-bottom {
  316. position: absolute;
  317. bottom: -1px;
  318. left: 0;
  319. width: 100vw;
  320. }
  321. .custom {
  322. position: absolute;
  323. width: 100vw;
  324. display: flex;
  325. justify-content: center;
  326. align-items: center;
  327. font-family: PingFang SC, PingFang SC;
  328. font-weight: 500;
  329. font-size: 17px;
  330. color: #ffffff;
  331. .back {
  332. position: absolute;
  333. padding: 0 10px;
  334. left: 0;
  335. color: #fff;
  336. font-size: 12px;
  337. transform: rotateY(180deg);
  338. }
  339. }
  340. .card {
  341. width: 355px;
  342. height: 220px;
  343. box-sizing: border-box;
  344. background: #ffffff;
  345. box-shadow: 0px 2px 10px 1px rgba(0, 0, 0, 0.16);
  346. border-radius: 8px 8px 8px 8px;
  347. position: absolute;
  348. top: var(--height);
  349. left: 10px;
  350. padding: 20px;
  351. font-family: Source Han Sans SC, Source Han Sans SC;
  352. .header {
  353. display: flex;
  354. justify-content: space-between;
  355. .left {
  356. display: flex;
  357. flex-direction: column;
  358. justify-content: space-between;
  359. .title {
  360. display: flex;
  361. align-items: center;
  362. text {
  363. &:first-child {
  364. font-weight: 500;
  365. font-size: 18px;
  366. color: #333333;
  367. }
  368. &:last-child {
  369. font-weight: 400;
  370. font-size: 12px;
  371. color: #999999;
  372. margin-left: 10px;
  373. }
  374. }
  375. margin-bottom: 5px;
  376. }
  377. .phone {
  378. font-weight: 500;
  379. font-size: 16px;
  380. color: #333333;
  381. }
  382. .redline {
  383. width: 24px;
  384. height: 2px;
  385. background: #c30d23;
  386. margin-top: 15px;
  387. }
  388. }
  389. .right {
  390. width: 56px;
  391. height: 56px;
  392. background: #dcebf8;
  393. box-shadow: 0px 3px 6px 1px #e0d6d7;
  394. border: 2px solid #ffffff;
  395. border-radius: 50%;
  396. image {
  397. width: 100%;
  398. height: 100%;
  399. border-radius: 50%;
  400. }
  401. }
  402. }
  403. .bottom {
  404. display: flex;
  405. justify-content: space-between;
  406. align-items: flex-start;
  407. font-family: Source Han Sans SC, Source Han Sans SC;
  408. font-weight: 400;
  409. font-size: 12px;
  410. color: #666666;
  411. margin-top: 22px;
  412. .left {
  413. display: flex;
  414. flex-direction: column;
  415. > view {
  416. margin-bottom: 13px;
  417. display: flex;
  418. align-content: center;
  419. align-items: center;
  420. i {
  421. font-size: 16px;
  422. }
  423. .text {
  424. margin-left: 10px;
  425. max-width: 211px;
  426. }
  427. }
  428. }
  429. .right {
  430. display: flex;
  431. flex-direction: column;
  432. align-items: center;
  433. align-content: center;
  434. padding: 3px;
  435. border-radius: 5px;
  436. text {
  437. font-weight: 400;
  438. font-size: 12px;
  439. color: #666666;
  440. }
  441. .code {
  442. width: 32px;
  443. height: 32px;
  444. margin-bottom: 4px;
  445. }
  446. }
  447. }
  448. }
  449. }
  450. .card-handle {
  451. padding: 50px 10px 20px 10px;
  452. background: #ffffff;
  453. margin-top: 15px;
  454. .top {
  455. display: flex;
  456. justify-content: space-between;
  457. align-items: center;
  458. align-content: center;
  459. font-family: Source Han Sans SC, Source Han Sans SC;
  460. font-size: 12px;
  461. color: #999999;
  462. .left {
  463. display: flex;
  464. flex-direction: column;
  465. .avatar {
  466. display: flex;
  467. align-items: flex-start;
  468. align-content: center;
  469. image {
  470. margin-right: 5px;
  471. width: 24px;
  472. height: 24px;
  473. border-radius: 50%;
  474. }
  475. text {
  476. transform: scale(1.5);
  477. }
  478. }
  479. .readcount {
  480. margin-top: 5px;
  481. display: block;
  482. }
  483. }
  484. .right {
  485. display: flex;
  486. flex-direction: column;
  487. align-content: center;
  488. align-items: center;
  489. width: 35px;
  490. height: 40px;
  491. border-radius: 3px;
  492. i {
  493. display: block;
  494. color: #666666;
  495. }
  496. text {
  497. margin-top: 5px;
  498. display: block;
  499. }
  500. }
  501. }
  502. .bottom {
  503. display: flex;
  504. justify-content: space-between;
  505. align-items: center;
  506. align-content: center;
  507. margin-top: 25px;
  508. .but {
  509. display: flex;
  510. align-items: center;
  511. justify-content: center;
  512. box-sizing: border-box;
  513. border-radius: 8px 8px 8px 8px;
  514. font-family: Source Han Sans SC, Source Han Sans SC;
  515. font-weight: 400;
  516. font-size: 16px;
  517. width: 173px;
  518. height: 50px;
  519. line-height: 50px;
  520. text-align: center;
  521. &:nth-child(1) {
  522. background: #ffffff;
  523. border: 1px solid #cccccc;
  524. color: #666666;
  525. }
  526. &:nth-child(2) {
  527. background: #c30d23;
  528. color: #ffffff;
  529. }
  530. view {
  531. margin-right: 10px;
  532. }
  533. }
  534. }
  535. }
  536. .user-info {
  537. padding: 12px 10px 70px 10px;
  538. font-family: PingFang SC, PingFang SC;
  539. background: #ffffff;
  540. margin-top: 10px;
  541. .title-min {
  542. margin-bottom: 10px;
  543. font-weight: 500;
  544. font-size: 14px;
  545. color: #666666;
  546. display: block;
  547. }
  548. .title-max {
  549. margin-bottom: 21px;
  550. font-weight: 500;
  551. font-size: 16px;
  552. color: #333333;
  553. display: block;
  554. }
  555. .tag-box {
  556. display: flex;
  557. flex-direction: column;
  558. margin-bottom: 20px;
  559. .title-min {
  560. }
  561. .tag-list {
  562. display: flex;
  563. align-content: center;
  564. align-items: center;
  565. flex-wrap: wrap;
  566. .tag {
  567. margin-right: 10px;
  568. padding: 6px 10px;
  569. background: #f2f2f2;
  570. border-radius: 5px 5px 5px 5px;
  571. margin-right: 10px;
  572. font-weight: 400;
  573. font-size: 14px;
  574. color: #333333;
  575. &:last-child {
  576. margin-right: 0;
  577. }
  578. }
  579. }
  580. }
  581. .descript-box {
  582. margin-bottom: 20px;
  583. display: flex;
  584. flex-direction: column;
  585. .descript {
  586. font-weight: 400;
  587. font-size: 14px;
  588. color: #666666;
  589. }
  590. }
  591. .image-box {
  592. display: flex;
  593. flex-direction: column;
  594. .image {
  595. width: 100%;
  596. height: 240px;
  597. margin-bottom: 10px;
  598. }
  599. }
  600. }
  601. .footer {
  602. display: flex;
  603. position: fixed;
  604. bottom: 0;
  605. left: 0;
  606. width: 375px;
  607. height: 64px;
  608. background: #ffffff;
  609. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  610. box-sizing: border-box;
  611. z-index: 9;
  612. padding: 5px 10px;
  613. .custom {
  614. position: absolute;
  615. width: 100vw;
  616. display: flex;
  617. justify-content: center;
  618. align-items: center;
  619. font-family: PingFang SC, PingFang SC;
  620. font-weight: 500;
  621. font-size: 17px;
  622. color: #ffffff;
  623. .back {
  624. position: absolute;
  625. padding: 0 10px;
  626. left: 0;
  627. color: #fff;
  628. font-size: 12px;
  629. transform: rotateY(180deg);
  630. }
  631. }
  632. .but {
  633. width: 355px;
  634. height: 45px;
  635. font-family: PingFang SC, PingFang SC;
  636. font-weight: 500;
  637. font-size: 14px;
  638. color: #ffffff;
  639. background: #c30d23;
  640. border-radius: 5px 5px 5px 5px;
  641. border: 1px solid #ffffff;
  642. display: flex;
  643. align-items: center;
  644. align-content: center;
  645. justify-content: space-evenly;
  646. }
  647. }
  648. }
  649. .footer2 {
  650. position: fixed;
  651. bottom: 0;
  652. width: 100vw;
  653. height: 65px;
  654. background: #ffffff;
  655. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  656. box-sizing: border-box;
  657. padding: 5px 10px;
  658. display: flex;
  659. .but {
  660. display: flex;
  661. align-items: center;
  662. justify-content: center;
  663. width: 100%;
  664. height: 45px;
  665. background: #c30d23;
  666. border-radius: 5px;
  667. font-family: PingFang SC, PingFang SC;
  668. font-size: 14px;
  669. color: #ffffff;
  670. }
  671. .forbidden {
  672. opacity: 0.6;
  673. }
  674. }
  675. .share-box {
  676. padding: 30px 0;
  677. display: flex;
  678. align-items: center;
  679. align-content: center;
  680. justify-content: space-evenly;
  681. .item {
  682. display: flex;
  683. flex-direction: column;
  684. align-items: center;
  685. align-content: center;
  686. border-radius: 5px;
  687. image {
  688. width: 50px;
  689. height: 50px;
  690. }
  691. text {
  692. margin-top: 5px;
  693. font-family: Source Han Sans SC, Source Han Sans SC;
  694. font-weight: 400;
  695. font-size: 12px;
  696. color: #333333;
  697. }
  698. }
  699. }
  700. </style>