index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  1. <template>
  2. <view style="padding-bottom: 30rpx;">
  3. <view class="top-fixed" :style="'height: '+ systems.barHeight + 'rpx;'">
  4. <view :class="'bgcolor' + (isTop == 1 ? ' opacity' : '')" :style="'height:' + systems.barHeight + 'rpx'">
  5. </view>
  6. <view class="top-fixed-c"
  7. :style="'height: '+ systems.navigationHeight + 'rpx;margin-top:' + systems.ktxStatusHeight + 'rpx;'">
  8. <navigator url="" hover-class="none" open-type="navigateBack" class="back ddflex"
  9. :style="'height: '+ systems.navigationHeight + 'rpx;'">
  10. <image src="/static/pages/images/back_black.png"></image>
  11. </navigator>
  12. <view :class="'top-title tover' + (isTop == 1 ? ' top-black':'')"
  13. :style="'line-height: '+ systems.navigationHeight + 'rpx;'">名片</view>
  14. </view>
  15. </view>
  16. <view :style="'height: '+ systems.barHeight + 'rpx;'"></view>
  17. <view class="bg">
  18. <image src="/static/pages/images/userBg.png"></image>
  19. </view>
  20. <view class="infos">
  21. <view class="infos-border">
  22. <view class="photo">
  23. <block v-if="cardInfo.avatar">
  24. <image :src="cardInfo.avatar" mode="aspectFill" class="poster"></image>
  25. <view class="change ddflex" style="right: 140rpx;background-color:#27D699;"
  26. @click="userBehavior(3)">
  27. <image v-if="!cardInfo.isThumbs" style="width: 35rpx;height: 32rpx;"
  28. src="/card/static/images/dz.png"></image>
  29. <image v-else style="width: 35rpx;height:32rpx;" src="../../static/images/like_h.png">
  30. </image>
  31. <!-- 点赞 -->
  32. </view>
  33. <view class="change ddflex" @click="uploadImg()">
  34. <image src="/card/static/images/change.png"></image>
  35. <!-- 更换形象图 -->
  36. </view>
  37. </block>
  38. <!-- @click="uploadImg()" -->
  39. <view class="upload ddflex" v-else
  40. @click="jumpUrl('/card/create/create?isEdit=true&id=' + cardInfo.id)">
  41. <image src="../../static/images/jia.png"></image>
  42. 上传专属形象
  43. </view>
  44. </view>
  45. <view class="info dflex">
  46. <view class="flex">
  47. <view class="name">
  48. {{ cardInfo.realName }}
  49. <text class="job" v-if="cardInfo.job">{{ cardInfo.job }}</text>
  50. <text class="job">入司10年</text>
  51. </view>
  52. <view class="company ddflex" style="margin-top: 20rpx;">
  53. <image src="/static/pages/images/dzico.png"></image>
  54. {{ cardInfo.companyName }}
  55. </view>
  56. <view class="company ddflex">
  57. <image src="/static/pages/images/dzico.png"></image>
  58. 服务区域 {{ cardInfo.industryName }}
  59. </view>
  60. <view class="company">
  61. 执业证书:02000043090080002013000260
  62. </view>
  63. <!-- <view class="industry">
  64. {{ cardInfo.industryName }}
  65. </view> -->
  66. </view>
  67. <!-- <view class="guanzhu" v-if="cardId" @click="userBehavior(1)">{{cardInfo.follow==1?'我已关注':'+关注'}}</view> -->
  68. <!-- <view class="logo"><image :src="cardInfo.avatar" mode="aspectFit"></image></view> -->
  69. </view>
  70. <!-- <view class="contacts" v-if="cardId">
  71. <scroll-view scroll-x="true" class="contact">
  72. <view class="li" @click="goPhone()">
  73. <view class="lit ddflex">
  74. <image src="../static/images/phone.png"></image>
  75. 拨打电话
  76. </view>
  77. <view class="num">{{ cardInfo.phone }}</view>
  78. </view>
  79. <view class="li" @click="copy(cardInfo.wechat, 1)">
  80. <view class="lit ddflex">
  81. <image src="../static/images/wechat.png"></image>
  82. 复制微信
  83. </view>
  84. <view class="num">{{ cardInfo.wechat }}</view>
  85. </view>
  86. <view class="li" @click="copy(cardInfo.email, 2)">
  87. <view class="lit ddflex">
  88. <image src="../static/images/message.png"></image>
  89. 复制邮箱
  90. </view>
  91. <view class="num">{{ cardInfo.email }}</view>
  92. </view>
  93. </scroll-view>
  94. </view> -->
  95. </view>
  96. <view class="btns ddflex" v-if="cardId">
  97. <view class="share-ta ddflex fflex" style="background: linear-gradient(80deg, #7EBFF1 0%, #458EEE 100%);;"
  98. @click="saveToPhone()">
  99. <image src="../../static/pages/images/wx.png"></image>存入通讯录</view>
  100. <view class="share-ta ddflex fflex" style="background: linear-gradient(84deg, #6FE5BC 0%, #27D699 100%);"
  101. @click="saveToPhone()">
  102. <image src="/static/pages/images/dh.png"></image>存入通讯录</view>
  103. <view class="share-ta ddflex fflex" style="background: linear-gradient(80deg, #FF985A 0%, #FF5700 100%);"
  104. @click="cardInfo.isSave?'':saveToFolder()">
  105. <image src="/static/pages/images/share1.png"></image>{{cardInfo.isSave?'已存入名片夹':'存入名片夹'}}</view>
  106. </view>
  107. <view class="save-text ddflex">
  108. <image src="../static/images/wxth.png"></image>保存到通讯录
  109. </view>
  110. <view class="btns ddflex" v-if="!cardId">
  111. <view class="share" @click="jumpUrl('/card/poster/poster?id=' + cardInfo.id)">分享名片</view>
  112. <view class="opt ddflex">
  113. <view class="li" @click="jumpUrl('/card/create/create?isEdit=true&id=' + cardInfo.id)">
  114. <image src="../static/images/edit.png"></image>
  115. <view>编辑名片</view>
  116. </view>
  117. </view>
  118. </view>
  119. <view class="extend-info ddflex">
  120. <view class="extend-info-item fflex">
  121. <view class="extend-info-data">1678</view>
  122. <view class="extend-info-label ddflex">
  123. <image src="../../static/pages/images/fw_hui.png"></image>
  124. <view>服务客户</view>
  125. </view>
  126. </view>
  127. <view class="extend-info-item fflex">
  128. <view class="extend-info-data">1678</view>
  129. <view class="extend-info-label ddflex">
  130. <image src="/static/pages/images/cy_hui.png"></image>
  131. <view>保单件数</view>
  132. </view>
  133. </view>
  134. <view class="extend-info-item fflex">
  135. <view class="extend-info-data">1678</view>
  136. <view class="extend-info-label ddflex">
  137. <image src="/static/pages/images/dz_hui.png"></image>
  138. <view>点赞量</view>
  139. </view>
  140. </view>
  141. </view>
  142. <view class="q-hud ddflex">
  143. <view class="q-hud-c ddflex">
  144. <view class="q-users ddflex">
  145. <image :src="item.avatar" mode="aspectFill" v-for="(item, index) in cardInfo.pageUser.list"
  146. v-if="index<3" :key="index"></image>
  147. </view>
  148. <view class="fflex">
  149. {{cardInfo.pageUser.total}}人看过
  150. </view>
  151. <!-- <image src="../static/images/q_rico.png" class="q-rico"></image> -->
  152. </view>
  153. <view class="q-hud-r ddflex">
  154. <view class="ddflex" @click="userBehavior(3)">
  155. <image v-if="!cardInfo.isThumbs" style="width: 27rpx;height: 29rpx;margin-right: 10rpx;"
  156. src="../static/images/dz.png"></image>
  157. <image v-else style="width: 27rpx;height: 29rpx;margin-right: 10rpx;"
  158. src="../../static/images/like_h.png"></image>
  159. <text>{{cardInfo.thumbs}}</text>
  160. </view>
  161. <view class="ddflex" v-if="cardId" @click="jumpUrl('/card/poster/poster?id'+cardInfo.id)">
  162. <image style="width: 29rpx;height: 29rpx;margin-left: 30rpx;margin-right: 10rpx;"
  163. src="../static/images/share.png"></image>
  164. <text>分享</text>
  165. </view>
  166. </view>
  167. </view>
  168. </view>
  169. <view class="box brief">
  170. <view class="tit ddflex">
  171. <view class="flex ddflex">
  172. <image src="../static/images/jj_ico.png"></image>
  173. <view>个人简介</view>
  174. </view>
  175. <!-- <image v-if="!cardId" src="../static/images/bj_ico.png" class="edit" @tap="jumpUrl('/card/editDesc/editDesc?id=' + cardInfo.id)"></image> -->
  176. </view>
  177. <view class="bri"><rich-text :nodes="cardInfo.brief ? cardInfo.brief : '一句话介绍自己'"></rich-text></view>
  178. </view>
  179. <view class="box" v-if="!cardId">
  180. <view class="tit ddflex">
  181. <image src="../static/images/sj_ico.png"></image>
  182. <view>
  183. 我的名片数据
  184. </view>
  185. </view>
  186. <view class="card-datas ddflex">
  187. <view class="li">
  188. <text>{{ cardInfo.pageUser.total }}</text>
  189. 访问量(次)
  190. </view>
  191. <view class="li">
  192. <text>{{ cardInfo.todayBrowse }}</text>
  193. 今日访问量(次)
  194. </view>
  195. <view class="li">
  196. <text>{{ cardInfo.share }}</text>
  197. 分享名片(次)
  198. </view>
  199. </view>
  200. </view>
  201. <view class="box videos">
  202. <view class="tit ddflex">
  203. <view class="flex ddflex">
  204. <image src="../static/images/sp_ico.png"></image>
  205. <view>我的视频</view>
  206. </view>
  207. <image v-if="cardInfo.videoId && !cardId" @click="uploadVodChangeHandle()"
  208. src="../static/images/bj_ico.png" class="edit"></image>
  209. </view>
  210. <view class="video">
  211. <video v-if="cardInfo.videoId" controls="true" class="video-sp" :src="videoInfo.playUrl"></video>
  212. <view v-else class="not" @click="uploadVodChangeHandle()">
  213. <image src="../static/images/add_ico1.png"></image>
  214. <view>点击添加个人介绍视频</view>
  215. </view>
  216. </view>
  217. </view>
  218. <view class="also" v-if="cardId" @click="jumpUrl('/card/create/create')">我也要创建电子名片</view>
  219. </view>
  220. </template>
  221. <script>
  222. const app = getApp();
  223. const req = require('../../utils/request.js');
  224. const api = require('../../utils/api.js');
  225. import VODUpload from '@/utils/aliyun-upload-sdk-1.0.1.min.js'
  226. export default {
  227. data() {
  228. return {
  229. systems: {},
  230. isTop: 0,
  231. options: {},
  232. scene: null,
  233. cardId: '',
  234. cardInfo: '',
  235. cardCount: '',
  236. zhiPicUrls: [],
  237. isFirst: true, //页面加载第一次调用
  238. uploader: '',
  239. isStart: false,
  240. videoInfo: '',
  241. fileName: '', //视频名称
  242. };
  243. },
  244. onLoad(options) {
  245. this.options = options
  246. this.cardId = options.cardId;
  247. if (options.scene)
  248. this.scene = options.scene
  249. },
  250. async onShow() {
  251. if (this.scene) {
  252. await this.loadCodeParams();
  253. }
  254. console.log('req.isLogins(false)', req.isLogins(false))
  255. await req.silenceLogin(this.options.userId ? this.options.userId : '', '')
  256. this.getCardInfo();
  257. },
  258. onShareAppMessage() {},
  259. onShareTimeline() {},
  260. methods: {
  261. loadCodeParams() {
  262. let _ts = this;
  263. return new Promise((resolve, reject) => {
  264. if (!_ts.scene) {
  265. resolve();
  266. return false;
  267. }
  268. req.getRequest(
  269. '/api/code/params', {
  270. scene: _ts.scene
  271. },
  272. data => {
  273. this.options.userId = data.userId
  274. this.cardId = data.scene
  275. resolve();
  276. }
  277. );
  278. });
  279. },
  280. getImgList(url) {
  281. var list = [];
  282. if (url) {
  283. list = url.split(',');
  284. }
  285. return list;
  286. },
  287. jumpUrl(url) {
  288. uni.navigateTo({
  289. url: url
  290. });
  291. },
  292. getCardInfo() {
  293. var url = '';
  294. var dataP = {};
  295. if (this.cardId) {
  296. url = '/api/v3/visiting/card/info';
  297. dataP.id = this.cardId;
  298. } else {
  299. url = '/api/v3/visiting/card/userInfo';
  300. dataP = {};
  301. }
  302. req.getRequest(url, dataP, data => {
  303. this.cardInfo = data;
  304. if (this.cardInfo.videoId) {
  305. this.getPlayInfo(this.cardInfo.videoId);
  306. }
  307. console.log('isFirst')
  308. if (this.cardId && this.cardInfo.userId == req.getStorage('userInfo').id) {
  309. // this.cardId = null
  310. // this.getCardInfo()
  311. } else {
  312. if (this.cardInfo.userId == req.getStorage('userInfo').id) {
  313. } else {
  314. // 用户浏览
  315. if (this.isFirst) {
  316. this.userBehavior(4)
  317. }
  318. }
  319. this.isFirst = false
  320. }
  321. });
  322. },
  323. // 用户行为
  324. userBehavior(type) {
  325. var dataP = {};
  326. dataP.type =
  327. 23 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  328. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  329. dataP.bindId = this.cardInfo.id;
  330. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  331. if (type == 3) {
  332. this.cardInfo.isThumbs = !this.cardInfo.isThumbs
  333. }
  334. if (type == 1) {
  335. this.cardInfo.follow = !this.cardInfo.follow
  336. }
  337. });
  338. },
  339. // 存入名片夹
  340. saveToFolder() {
  341. let form = {
  342. visitingCardId: this.cardInfo.id,
  343. userId: req.getStorage('userInfo').id
  344. }
  345. req.postRequest('/api/v3/visiting/card/folder/saveOrUpdate', form, res => {
  346. req.msg('已存入名片夹')
  347. this.cardInfo.isSave = true
  348. })
  349. },
  350. // 存入通讯录
  351. saveToPhone() {
  352. uni.addPhoneContact({
  353. nickName: this.cardInfo.realName,
  354. firstName: this.cardInfo.realName,
  355. mobilePhoneNumber: this.cardInfo.phone,
  356. success: (res) => {
  357. this.$showModal({
  358. title: '提示',
  359. content: '已存入通讯录,请前往手机通讯录查看',
  360. showCancel: false,
  361. })
  362. .then(res => {
  363. })
  364. .catch(err => {});
  365. },
  366. fail: () => {
  367. req.msg('存入失败')
  368. }
  369. })
  370. },
  371. goPhone() {
  372. uni.makePhoneCall({
  373. phoneNumber: this.cardInfo.phone
  374. }); // 传参带入号码即可
  375. },
  376. copy(valueText, type) {
  377. uni.setClipboardData({
  378. data: valueText,
  379. success: function(res) {
  380. if (type == 1) {
  381. req.msg('微信号复制成功');
  382. } else if (type == 2) {
  383. req.msg('邮箱复制成功');
  384. }
  385. }
  386. });
  387. },
  388. getPlayInfo(videoId) {
  389. req.getRequest('/api/v3/vod/playInfo', {
  390. videoId: videoId
  391. }, data => {
  392. this.videoInfo = data
  393. })
  394. },
  395. createUploader() {
  396. let self = this;
  397. return new VODUpload({
  398. timeout: 60000,
  399. partSize: 1048576,
  400. parallel: 5,
  401. retryCount: 3,
  402. retryDuration: 2,
  403. region: this.regionId,
  404. userId: this.accountId,
  405. // 开始上传
  406. onUploadstarted: function(uploadInfo) {
  407. uni.showLoading({
  408. title: '视频上传中'
  409. })
  410. console.log('uploadInfo==', uploadInfo)
  411. if (!uploadInfo.videoId) {
  412. req.getRequest('/api/v3/vod/uploadAuth?fileName=' + self.fileName, {}, res => {
  413. var data = res;
  414. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  415. .uploadAddress, data.videoId)
  416. })
  417. self.isStart = true;
  418. } else {
  419. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  420. res => {
  421. var data = res;
  422. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  423. .uploadAddress, data.videoId)
  424. })
  425. }
  426. },
  427. // 文件上传成功
  428. onUploadSucceed: function(uploadInfo) {
  429. // req.msg("视频上传成功");
  430. let dataP = {
  431. id: self.cardInfo.id,
  432. videoId: uploadInfo.videoId,
  433. videoInfo: JSON.stringify(uploadInfo)
  434. }
  435. req.postRequest('/api/v3/visiting/card/saveOrUpdate', dataP, res => {
  436. self.getPlayInfo(uploadInfo.videoId);
  437. setTimeout(() => {
  438. self.isStart = false;
  439. }, 1000);
  440. uni.hideLoading()
  441. })
  442. },
  443. // 文件上传失败
  444. onUploadFailed: function(uploadInfo, code, message) {
  445. req.msg("文件上传失败");
  446. },
  447. // 取消文件上传
  448. onUploadCanceled: function(uploadInfo, code, message) {
  449. req.msg("文件已暂停上传");
  450. },
  451. // 文件上传进度,单位:字节, 可以在这个函数中拿到上传进度并显示在页面上
  452. onUploadProgress: function(uploadInfo, totalSize, progress) {
  453. var progressPercent = Math.ceil(progress * 100);
  454. // self.$set(self.uploader, 'authProgress', progressPercent);
  455. },
  456. // 上传凭证超时
  457. onUploadTokenExpired: function(uploadInfo) {
  458. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  459. res => {
  460. var data = res;
  461. self.uploader.resumeUploadWithAuth(data.uploadAuth)
  462. })
  463. }
  464. })
  465. },
  466. uploadVodChangeHandle: function(e) {
  467. let self = this;
  468. uni.chooseVideo({
  469. count: 1, //上传视频的个数
  470. mediaType: ['video'], //限制上传的类型为video
  471. sourceType: ['album', 'camera'], //视频选择来源
  472. maxDuration: 58, //拍摄限制时间
  473. camera: 'back', //采用后置摄像头
  474. success: function(res) {
  475. //获取临时存放的视频资源
  476. // let tempFilePath=res.tempFiles[0]
  477. console.log('视频文件==', res)
  478. var file = {
  479. url: res.tempFilePath,
  480. coverUrl: res.thumbTempFilePath
  481. };
  482. self.fileName = res.tempFilePath.substring(res.tempFilePath.lastIndexOf('/') + 1)
  483. // if (self.uploader) {
  484. // self.uploader.stopUpload();
  485. // self.authProgress = 0;
  486. // }
  487. var userData = '{"Vod":{}}';
  488. self.uploader = self.createUploader();
  489. self.uploader.addFile(file, null, null, null, userData);
  490. self.uploader.startUpload();
  491. },
  492. })
  493. },
  494. uploadImg() {
  495. let that = this;
  496. uni.chooseImage({
  497. count: 1,
  498. sizeType: ['original', 'compressed'],
  499. sourceType: ['album', 'camera'],
  500. success: function({
  501. tempFilePaths
  502. }) {
  503. var promise = Promise.all(
  504. tempFilePaths.map(tempFilePath => {
  505. return new Promise(function(resolve, reject) {
  506. req.uploadFile(api.upload, tempFilePath, res => {
  507. that.imageMap = res.src;
  508. //上传完成,则更新保存
  509. that.updateCard(3, that.imageMap);
  510. });
  511. });
  512. })
  513. );
  514. promise
  515. .then(function(results) {
  516. console.log(results);
  517. })
  518. .catch(function(err) {
  519. console.log(err);
  520. });
  521. }
  522. });
  523. },
  524. uploadImgs() {
  525. let that = this;
  526. uni.chooseImage({
  527. count: 9,
  528. sizeType: ['original', 'compressed'],
  529. sourceType: ['album', 'camera'],
  530. success: function({
  531. tempFilePaths
  532. }) {
  533. var promise = Promise.all(
  534. tempFilePaths.map(tempFilePath => {
  535. return new Promise(function(resolve, reject) {
  536. req.uploadFile(api.upload, tempFilePath, res => {
  537. let picUrls = that.zhiPicUrls;
  538. that.zhiPicUrls = picUrls.concat(res.src);
  539. if (tempFilePaths.length == that.zhiPicUrls
  540. .length) {
  541. //上传完成,则更新保存
  542. that.updateCard(1, that.zhiPicUrls.join(
  543. ','));
  544. }
  545. });
  546. });
  547. })
  548. );
  549. promise
  550. .then(function(results) {
  551. console.log(results);
  552. })
  553. .catch(function(err) {
  554. console.log(err);
  555. });
  556. }
  557. });
  558. },
  559. //预览图片
  560. previewImg(picUrls, index) {
  561. //预览合同图片
  562. var src = picUrls[index];
  563. let imgs = picUrls;
  564. uni.previewImage({
  565. current: src, // 当前显示图片的http链接
  566. urls: imgs
  567. });
  568. },
  569. cleanimages(index) {
  570. // 删除图片
  571. let arr = this.zhiPicUrls;
  572. arr.splice(index, 1);
  573. this.zhiPicUrls = arr;
  574. },
  575. /**
  576. * @param {Object} type 1图片 2、视频
  577. * @param {Object} url 资源地址
  578. */
  579. updateCard(type, url) {
  580. var dataP = {};
  581. dataP.id = this.cardInfo.id;
  582. if (type == 1) {
  583. dataP.pictures = url;
  584. } else if (type == 2) {
  585. dataP.video = url;
  586. } else if (type == 3) {
  587. dataP.imageMap = url;
  588. }
  589. req.postRequest(api.api_addressList_update, dataP, json => {
  590. if (type == 1) {
  591. this.cardInfo.pictures = url;
  592. } else if (type == 2) {
  593. this.cardInfo.video = url;
  594. } else if (type == 3) {
  595. this.cardInfo.imageMap = url;
  596. }
  597. });
  598. },
  599. toWxShare() {
  600. req.getWXOriginalId(data => {
  601. if (data) {
  602. this.wxShare(data);
  603. } else {
  604. this.$showModal({
  605. title: '提示',
  606. content: '未配置微信小程序',
  607. cancelText: '取消',
  608. confirmText: '设置开通'
  609. }).then(res => {
  610. // 点击确认的操作
  611. // tha.copy(content);
  612. });
  613. }
  614. });
  615. },
  616. wxShare(originalId) {
  617. //分享H5
  618. // uni.share({
  619. // provider: 'weixin',
  620. // scene: 'WXSceneSession',
  621. // type: 0,
  622. // href: req.env[req.env.NODE_ENV].h5BaseUrl + '/share/card/index?cardId=' + this.cardInfo.id,
  623. // title: this.cardInfo.nickName + ' - 电子名片',
  624. // summary: this.cardInfo.title + ' ' + this.cardInfo.position.name + ' ' + this.cardInfo.message,
  625. // imageUrl: this.cardInfo.avatar,
  626. // success: function(res) {
  627. // console.log('success:' + JSON.stringify(res));
  628. // },
  629. // fail: function(err) {
  630. // console.log('fail:' + JSON.stringify(err));
  631. // }
  632. // });
  633. uni.share({
  634. provider: 'weixin',
  635. scene: 'WXSceneSession',
  636. type: 5,
  637. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375',
  638. title: this.cardInfo.nickName + ' - 电子名片',
  639. summary: this.cardInfo.title + ' ' + this.cardInfo.position.name + ' ' + this.cardInfo.message,
  640. miniProgram: {
  641. id: originalId,
  642. path: '/share/card/index?cardId=' + this.cardInfo.id,
  643. type: req.env[req.env.NODE_ENV].typeMiniProgram,
  644. webUrl: req.public.homeWebUrl
  645. },
  646. success: ret => {
  647. console.log(JSON.stringify(ret));
  648. }
  649. });
  650. }
  651. },
  652. mounted() {
  653. const systemInfo = uni.getSystemInfoSync();
  654. // px转换到rpx的比例
  655. let pxToRpxScale = 750 / systemInfo.windowWidth;
  656. let systems = {
  657. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  658. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  659. };
  660. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  661. this.systems = systems;
  662. },
  663. onPageScroll: function(e) {
  664. if (e.scrollTop > this.systems.barHeight) {
  665. this.isTop = 1;
  666. } else {
  667. this.isTop = 0;
  668. }
  669. }
  670. };
  671. </script>
  672. <style>
  673. @import './index.css';
  674. </style>