index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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: [] ,readusers:[]},
  147. userid: uni.getStorageSync('userMsg').userid,
  148. shareShow: false
  149. }
  150. },
  151. computed: {
  152. },
  153. onUnload () {
  154. delete this.$Http.refreshUserInfoData
  155. },
  156. methods: {
  157. preview(url) {
  158. viewImage(url)
  159. },
  160. goEditPage() {
  161. this.$Http.editUser = function (id) {
  162. this.getuserInfo(id)
  163. delete this.$Http.editUser
  164. }.bind(this)
  165. },
  166. async getuserInfo(id) {
  167. let res = await this.$Http.basic({
  168. "id": 20240514161502,
  169. "content": {
  170. userid: id
  171. },
  172. })
  173. if (this.cutoff(res.msg)) return
  174. this.userInfo = res.data
  175. this.userInfo.headpic = this.userInfo.attinfos.find(v => v.usetype == "headportrait") && this.userInfo.attinfos.find(v => v.usetype == "headportrait").url || '';
  176. this.userInfo.images = this.userInfo.attinfos.filter(v => v.usetype != "headportrait")
  177. console.log(this.userInfo, '用户信息');
  178. },
  179. shareClick() {
  180. this.shareShow = true
  181. },
  182. onBack() {
  183. let curPages = getCurrentPages()
  184. if (curPages.length == 1) {
  185. uni.redirectTo({
  186. url:'/pages/index/index',
  187. })
  188. } else {
  189. uni.navigateBack()
  190. }
  191. },
  192. async goodClick() {
  193. let res = await this.$Http.basic({
  194. "id": 20240416133702,
  195. "content": {
  196. "ownertable": "sys_users",
  197. "ownerid": this.userid,
  198. "type": 2//1:收藏,2:点赞
  199. },
  200. })
  201. if (this.cutoff(res.msg)) return;
  202. this.getuserInfo(this.userid)
  203. },
  204. copy() {
  205. uni.setClipboardData({
  206. data: this.userInfo.phonenumber,
  207. success: (result) => {
  208. uni.showToast({
  209. title: "已复制",
  210. icon: "none",
  211. duration: 1500,
  212. })
  213. }
  214. });
  215. }
  216. },
  217. onShareAppMessage(res) {
  218. return {
  219. title: this.userInfo.name, // 标题
  220. path: "/cloud/businessCard/index?id=" + this.userid, // 分享路径
  221. imageUrl: ""// 分享图
  222. };
  223. },
  224. onLoad(options) {
  225. this.isInitializeLogin(render.bind(this))
  226. function render() {
  227. if (options.q) {
  228. let params = this.getUrlParams(options.q);
  229. user.wechatBindUserid = params.wechatBindUserid;
  230. this.userid = params.wechatBindUserid
  231. }
  232. this.getuserInfo(this.userid)
  233. }
  234. },
  235. }
  236. </script>
  237. <style lang="scss">
  238. .self-card {
  239. .head {
  240. position: relative;
  241. width: 100vw;
  242. .bg-bottom {
  243. position: absolute;
  244. bottom: -1px;
  245. left: 0;
  246. width: 100vw;
  247. }
  248. .custom {
  249. position: absolute;
  250. width: 100vw;
  251. display: flex;
  252. justify-content: center;
  253. align-items: center;
  254. font-family: PingFang SC, PingFang SC;
  255. font-weight: 500;
  256. font-size: 17px;
  257. color: #FFFFFF;
  258. .back {
  259. position: absolute;
  260. padding: 0 10px;
  261. left: 0;
  262. color: #fff;
  263. font-size: 12px;
  264. transform: rotateY(180deg);
  265. }
  266. }
  267. .card {
  268. width: 355px;
  269. height: 220px;
  270. box-sizing: border-box;
  271. background: #FFFFFF;
  272. box-shadow: 0px 2px 10px 1px rgba(0, 0, 0, 0.16);
  273. border-radius: 8px 8px 8px 8px;
  274. position: absolute;
  275. top: var(--height);
  276. left: 10px;
  277. padding: 20px;
  278. font-family: Source Han Sans SC, Source Han Sans SC;
  279. .header {
  280. display: flex;
  281. justify-content: space-between;
  282. align-content: center;
  283. align-items: center;
  284. .left {
  285. display: flex;
  286. flex-direction: column;
  287. justify-content: space-between;
  288. .title {
  289. display: flex;
  290. align-items: center;
  291. text {
  292. &:first-child {
  293. font-weight: 500;
  294. font-size: 18px;
  295. color: #333333;
  296. }
  297. &:last-child {
  298. font-weight: 400;
  299. font-size: 12px;
  300. color: #999999;
  301. margin-left: 10px;
  302. }
  303. }
  304. margin-bottom: 5px;
  305. }
  306. .phone {
  307. font-weight: 500;
  308. font-size: 16px;
  309. color: #333333;
  310. }
  311. .redline {
  312. width: 24px;
  313. height: 2px;
  314. background: #C30D23;
  315. margin-top: 15px;
  316. }
  317. }
  318. .right {
  319. width: 56px;
  320. height: 56px;
  321. background: #DCEBF8;
  322. box-shadow: 0px 3px 6px 1px #E0D6D7;
  323. border: 2px solid #FFFFFF;
  324. border-radius: 50%;
  325. image {
  326. width: 100%;
  327. height: 100%;
  328. border-radius: 50%;
  329. }
  330. }
  331. }
  332. .bottom {
  333. display: flex;
  334. justify-content: space-between;
  335. font-family: Source Han Sans SC, Source Han Sans SC;
  336. font-weight: 400;
  337. font-size: 12px;
  338. color: #666666;
  339. margin-top: 22px;
  340. .left {
  341. display: flex;
  342. flex-direction: column;
  343. >view {
  344. margin-bottom: 13px;
  345. display: flex;
  346. align-content: center;
  347. align-items: center;
  348. i {
  349. font-size: 16px;
  350. }
  351. .text {
  352. margin-left: 10px;
  353. max-width: 211px;
  354. }
  355. }
  356. }
  357. .right {
  358. display: flex;
  359. flex-direction: column;
  360. align-items: center;
  361. align-content: center;
  362. text {
  363. font-weight: 400;
  364. font-size: 12px;
  365. color: #666666;
  366. }
  367. .code {
  368. width: 32px;
  369. height: 32px;
  370. margin-bottom: 4px;
  371. }
  372. }
  373. }
  374. }
  375. }
  376. .card-handle {
  377. padding: 50px 10px 20px 10px;
  378. background: #ffffff;
  379. margin-top: 15px;
  380. .top {
  381. display: flex;
  382. justify-content: space-between;
  383. align-items: center;
  384. align-content: center;
  385. font-family: Source Han Sans SC, Source Han Sans SC;
  386. font-size: 12px;
  387. color: #999999;
  388. .left {
  389. display: flex;
  390. flex-direction: column;
  391. .avatar {
  392. display: flex;
  393. align-items: flex-start;
  394. align-content: center;
  395. image {
  396. margin-right: 5px;
  397. width: 24px;
  398. height: 24px;
  399. }
  400. text {
  401. transform: scale(1.5);
  402. }
  403. }
  404. .readcount {
  405. margin-top: 5px;
  406. display: block;
  407. }
  408. }
  409. .right {
  410. display: flex;
  411. flex-direction: column;
  412. align-content: center;
  413. align-items: center;
  414. i {
  415. display: block;
  416. color: #666666;
  417. }
  418. text {
  419. margin-top: 5px;
  420. display: block;
  421. }
  422. }
  423. }
  424. .bottom {
  425. display: flex;
  426. justify-content: space-between;
  427. align-items: center;
  428. align-content: center;
  429. margin-top: 25px;
  430. .but {
  431. display: flex;
  432. align-items: center;
  433. justify-content: center;
  434. box-sizing: border-box;
  435. border-radius: 8px 8px 8px 8px;
  436. font-family: Source Han Sans SC, Source Han Sans SC;
  437. font-weight: 400;
  438. font-size: 16px;
  439. width: 173px;
  440. height: 50px;
  441. line-height: 50px;
  442. text-align: center;
  443. &:nth-child(1) {
  444. background: #FFFFFF;
  445. border: 1px solid #CCCCCC;
  446. color: #666666;
  447. }
  448. &:nth-child(2) {
  449. background: #C30D23;
  450. color: #FFFFFF;
  451. }
  452. view {
  453. margin-right: 10px;
  454. }
  455. }
  456. }
  457. }
  458. .user-info {
  459. padding: 12px 10px 70px 10px;
  460. font-family: PingFang SC, PingFang SC;
  461. background: #ffffff;
  462. margin-top: 10px;
  463. .title-min {
  464. margin-bottom: 10px;
  465. font-weight: 500;
  466. font-size: 14px;
  467. color: #666666;
  468. display: block;
  469. }
  470. .title-max {
  471. margin-bottom: 21px;
  472. font-weight: 500;
  473. font-size: 16px;
  474. color: #333333;
  475. display: block;
  476. }
  477. .tag-box {
  478. display: flex;
  479. flex-direction: column;
  480. margin-bottom: 20px;
  481. .title-min {}
  482. .tag-list {
  483. display: flex;
  484. align-content: center;
  485. align-items: center;
  486. flex-wrap: wrap;
  487. .tag {
  488. margin-right: 10px;
  489. padding: 6px 10px;
  490. background: #F2F2F2;
  491. border-radius: 5px 5px 5px 5px;
  492. margin-right: 10px;
  493. font-weight: 400;
  494. font-size: 14px;
  495. color: #333333;
  496. &:last-child {
  497. margin-right: 0;
  498. }
  499. }
  500. }
  501. }
  502. .descript-box {
  503. margin-bottom: 20px;
  504. display: flex;
  505. flex-direction: column;
  506. .descript {
  507. font-weight: 400;
  508. font-size: 14px;
  509. color: #666666;
  510. }
  511. }
  512. .image-box {
  513. display: flex;
  514. flex-direction: column;
  515. .image {
  516. width: 100%;
  517. height: 240px;
  518. margin-bottom: 10px;
  519. }
  520. }
  521. }
  522. .footer {
  523. display: flex;
  524. align-items: center;
  525. position: fixed;
  526. bottom: 0;
  527. left: 0;
  528. width: 375px;
  529. height: 64px;
  530. background: #FFFFFF;
  531. box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
  532. box-sizing: border-box;
  533. z-index: 9;
  534. padding: 5px 10px;
  535. .custom {
  536. position: absolute;
  537. width: 100vw;
  538. display: flex;
  539. justify-content: center;
  540. align-items: center;
  541. font-family: PingFang SC, PingFang SC;
  542. font-weight: 500;
  543. font-size: 17px;
  544. color: #FFFFFF;
  545. .back {
  546. position: absolute;
  547. padding: 0 10px;
  548. left: 0;
  549. color: #fff;
  550. font-size: 12px;
  551. transform: rotateY(180deg);
  552. }
  553. }
  554. .but {
  555. width: 355px;
  556. height: 45px;
  557. font-family: PingFang SC, PingFang SC;
  558. font-weight: 500;
  559. font-size: 14px;
  560. color: #FFFFFF;
  561. background: #C30D23;
  562. border-radius: 5px 5px 5px 5px;
  563. border: 1px solid #FFFFFF;
  564. display: flex;
  565. align-items: center;
  566. align-content: center;
  567. justify-content: space-evenly;
  568. }
  569. }
  570. }
  571. .share-box {
  572. padding: 30px 0;
  573. display: flex;
  574. align-items: center;
  575. align-content: center;
  576. justify-content: space-evenly;
  577. .item {
  578. display: flex;
  579. flex-direction: column;
  580. align-items: center;
  581. align-content: center;
  582. image {
  583. width: 50px;
  584. height: 50px;
  585. }
  586. text {
  587. margin-top: 5px;
  588. font-family: Source Han Sans SC, Source Han Sans SC;
  589. font-weight: 400;
  590. font-size: 12px;
  591. color: #333333;
  592. }
  593. }
  594. }
  595. </style>