index.vue 21 KB

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