index.vue 21 KB

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