index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  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" v-if="!cardId">
  170. <view class="tit ddflex">
  171. <image src="../static/images/sj_ico.png"></image>
  172. <view>
  173. 我的名片数据
  174. </view>
  175. </view>
  176. <view class="card-datas ddflex">
  177. <view class="li">
  178. <text>{{ cardInfo.pageUser.total }}</text>
  179. 访问量(次)
  180. </view>
  181. <view class="li">
  182. <text>{{ cardInfo.todayBrowse }}</text>
  183. 今日访问量(次)
  184. </view>
  185. <view class="li">
  186. <text>{{ cardInfo.share }}</text>
  187. 分享名片(次)
  188. </view>
  189. </view>
  190. </view>
  191. <view class="box brief">
  192. <view class="tit ddflex">
  193. <view class="flex ddflex">
  194. <image src="../static/images/jj_ico.png"></image>
  195. <view>所获荣誉</view>
  196. </view>
  197. </view>
  198. <view class="contacts" style="height: 300rpx;margin-top: 20rpx;">
  199. <scroll-view scroll-x="true" class="contact" style="height: 300rpx;">
  200. <view class=" ry-image" v-for="item in 9">
  201. <image src="/static/images/lj_img.png"></image>
  202. </view>
  203. </scroll-view>
  204. </view>
  205. </view>
  206. <view class="box brief">
  207. <view class="tit ddflex">
  208. <view class="flex ddflex">
  209. <image src="../static/images/jj_ico.png"></image>
  210. <view>个人风采</view>
  211. </view>
  212. </view>
  213. <view class="contacts" style="height: 300rpx;margin-top: 20rpx;">
  214. <scroll-view scroll-x="true" class="contact" style="height: 300rpx;">
  215. <view class=" ry-image" v-for="item in 9">
  216. <image src="/static/images/lj_img.png"></image>
  217. </view>
  218. </scroll-view>
  219. </view>
  220. </view>
  221. <view class="box brief">
  222. <view class="tit ddflex">
  223. <view class="flex ddflex">
  224. <image src="../static/images/jj_ico.png"></image>
  225. <view>个人简介</view>
  226. </view>
  227. <!-- <image v-if="!cardId" src="../static/images/bj_ico.png" class="edit" @tap="jumpUrl('/card/editDesc/editDesc?id=' + cardInfo.id)"></image> -->
  228. </view>
  229. <view class="bri"><rich-text :nodes="cardInfo.brief ? cardInfo.brief : '一句话介绍自己'"></rich-text></view>
  230. </view>
  231. <view class="box brief">
  232. <view class="tit ddflex">
  233. <view class="flex ddflex">
  234. <image src="../static/images/jj_ico.png"></image>
  235. <view>公司简介</view>
  236. </view>
  237. <!-- <image v-if="!cardId" src="../static/images/bj_ico.png" class="edit" @tap="jumpUrl('/card/editDesc/editDesc?id=' + cardInfo.id)"></image> -->
  238. </view>
  239. <view class="bri"><rich-text :nodes="cardInfo.brief ? cardInfo.brief : '一句话介绍自己'"></rich-text></view>
  240. </view>
  241. <!-- <view class="box videos">
  242. <view class="tit ddflex">
  243. <view class="flex ddflex">
  244. <image src="../static/images/sp_ico.png"></image>
  245. <view>我的视频</view>
  246. </view>
  247. <image v-if="cardInfo.videoId && !cardId" @click="uploadVodChangeHandle()"
  248. src="../static/images/bj_ico.png" class="edit"></image>
  249. </view>
  250. <view class="video">
  251. <video v-if="cardInfo.videoId" controls="true" class="video-sp" :src="videoInfo.playUrl"></video>
  252. <view v-else class="not" @click="uploadVodChangeHandle()">
  253. <image src="../static/images/add_ico1.png"></image>
  254. <view>点击添加个人介绍视频</view>
  255. </view>
  256. </view>
  257. </view>
  258. <view class="also" v-if="cardId" @click="jumpUrl('/card/create/create')">我也要创建电子名片</view> -->
  259. <serviceContact></serviceContact>
  260. </view>
  261. </template>
  262. <script>
  263. const app = getApp();
  264. const req = require('../../utils/request.js');
  265. const api = require('../../utils/api.js');
  266. import VODUpload from '@/utils/aliyun-upload-sdk-1.0.1.min.js'
  267. import serviceContact from '@/components/service-contact/index.vue'
  268. export default {
  269. data() {
  270. return {
  271. systems: {},
  272. isTop: 0,
  273. options: {},
  274. scene: null,
  275. cardId: '',
  276. cardInfo: '',
  277. cardCount: '',
  278. zhiPicUrls: [],
  279. isFirst: true, //页面加载第一次调用
  280. uploader: '',
  281. isStart: false,
  282. videoInfo: '',
  283. fileName: '', //视频名称
  284. };
  285. },
  286. components:{ serviceContact },
  287. onLoad(options) {
  288. this.options = options
  289. this.cardId = options.cardId;
  290. if (options.scene)
  291. this.scene = options.scene
  292. },
  293. async onShow() {
  294. if (this.scene) {
  295. await this.loadCodeParams();
  296. }
  297. console.log('req.isLogins(false)', req.isLogins(false))
  298. await req.silenceLogin(this.options.userId ? this.options.userId : '', '')
  299. this.getCardInfo();
  300. },
  301. onShareAppMessage() {},
  302. onShareTimeline() {},
  303. methods: {
  304. loadCodeParams() {
  305. let _ts = this;
  306. return new Promise((resolve, reject) => {
  307. if (!_ts.scene) {
  308. resolve();
  309. return false;
  310. }
  311. req.getRequest(
  312. '/api/code/params', {
  313. scene: _ts.scene
  314. },
  315. data => {
  316. this.options.userId = data.userId
  317. this.cardId = data.scene
  318. resolve();
  319. }
  320. );
  321. });
  322. },
  323. getImgList(url) {
  324. var list = [];
  325. if (url) {
  326. list = url.split(',');
  327. }
  328. return list;
  329. },
  330. jumpUrl(url) {
  331. uni.navigateTo({
  332. url: url
  333. });
  334. },
  335. getCardInfo() {
  336. var url = '';
  337. var dataP = {};
  338. if (this.cardId) {
  339. url = '/api/v3/visiting/card/info';
  340. dataP.id = this.cardId;
  341. } else {
  342. url = '/api/v3/visiting/card/userInfo';
  343. dataP = {};
  344. }
  345. req.getRequest(url, dataP, data => {
  346. this.cardInfo = data;
  347. if (this.cardInfo.videoId) {
  348. this.getPlayInfo(this.cardInfo.videoId);
  349. }
  350. console.log('isFirst')
  351. if (this.cardId && this.cardInfo.userId == req.getStorage('userInfo').id) {
  352. // this.cardId = null
  353. // this.getCardInfo()
  354. } else {
  355. if (this.cardInfo.userId == req.getStorage('userInfo').id) {
  356. } else {
  357. // 用户浏览
  358. if (this.isFirst) {
  359. this.userBehavior(4)
  360. }
  361. }
  362. this.isFirst = false
  363. }
  364. });
  365. },
  366. // 用户行为
  367. userBehavior(type) {
  368. var dataP = {};
  369. dataP.type =
  370. 23 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  371. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  372. dataP.bindId = this.cardInfo.id;
  373. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  374. if (type == 3) {
  375. this.cardInfo.isThumbs = !this.cardInfo.isThumbs
  376. }
  377. if (type == 1) {
  378. this.cardInfo.follow = !this.cardInfo.follow
  379. }
  380. });
  381. },
  382. // 存入名片夹
  383. saveToFolder() {
  384. let form = {
  385. visitingCardId: this.cardInfo.id,
  386. userId: req.getStorage('userInfo').id
  387. }
  388. req.postRequest('/api/v3/visiting/card/folder/saveOrUpdate', form, res => {
  389. req.msg('已存入名片夹')
  390. this.cardInfo.isSave = true
  391. })
  392. },
  393. // 存入通讯录
  394. saveToPhone() {
  395. uni.addPhoneContact({
  396. nickName: this.cardInfo.realName,
  397. firstName: this.cardInfo.realName,
  398. mobilePhoneNumber: this.cardInfo.phone,
  399. success: (res) => {
  400. this.$showModal({
  401. title: '提示',
  402. content: '已存入通讯录,请前往手机通讯录查看',
  403. showCancel: false,
  404. })
  405. .then(res => {
  406. })
  407. .catch(err => {});
  408. },
  409. fail: () => {
  410. req.msg('存入失败')
  411. }
  412. })
  413. },
  414. goPhone() {
  415. uni.makePhoneCall({
  416. phoneNumber: this.cardInfo.phone
  417. }); // 传参带入号码即可
  418. },
  419. copy(valueText, type) {
  420. uni.setClipboardData({
  421. data: valueText,
  422. success: function(res) {
  423. if (type == 1) {
  424. req.msg('微信号复制成功');
  425. } else if (type == 2) {
  426. req.msg('邮箱复制成功');
  427. }
  428. }
  429. });
  430. },
  431. getPlayInfo(videoId) {
  432. req.getRequest('/api/v3/vod/playInfo', {
  433. videoId: videoId
  434. }, data => {
  435. this.videoInfo = data
  436. })
  437. },
  438. createUploader() {
  439. let self = this;
  440. return new VODUpload({
  441. timeout: 60000,
  442. partSize: 1048576,
  443. parallel: 5,
  444. retryCount: 3,
  445. retryDuration: 2,
  446. region: this.regionId,
  447. userId: this.accountId,
  448. // 开始上传
  449. onUploadstarted: function(uploadInfo) {
  450. uni.showLoading({
  451. title: '视频上传中'
  452. })
  453. console.log('uploadInfo==', uploadInfo)
  454. if (!uploadInfo.videoId) {
  455. req.getRequest('/api/v3/vod/uploadAuth?fileName=' + self.fileName, {}, res => {
  456. var data = res;
  457. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  458. .uploadAddress, data.videoId)
  459. })
  460. self.isStart = true;
  461. } else {
  462. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  463. res => {
  464. var data = res;
  465. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  466. .uploadAddress, data.videoId)
  467. })
  468. }
  469. },
  470. // 文件上传成功
  471. onUploadSucceed: function(uploadInfo) {
  472. // req.msg("视频上传成功");
  473. let dataP = {
  474. id: self.cardInfo.id,
  475. videoId: uploadInfo.videoId,
  476. videoInfo: JSON.stringify(uploadInfo)
  477. }
  478. req.postRequest('/api/v3/visiting/card/saveOrUpdate', dataP, res => {
  479. self.getPlayInfo(uploadInfo.videoId);
  480. setTimeout(() => {
  481. self.isStart = false;
  482. }, 1000);
  483. uni.hideLoading()
  484. })
  485. },
  486. // 文件上传失败
  487. onUploadFailed: function(uploadInfo, code, message) {
  488. req.msg("文件上传失败");
  489. },
  490. // 取消文件上传
  491. onUploadCanceled: function(uploadInfo, code, message) {
  492. req.msg("文件已暂停上传");
  493. },
  494. // 文件上传进度,单位:字节, 可以在这个函数中拿到上传进度并显示在页面上
  495. onUploadProgress: function(uploadInfo, totalSize, progress) {
  496. var progressPercent = Math.ceil(progress * 100);
  497. // self.$set(self.uploader, 'authProgress', progressPercent);
  498. },
  499. // 上传凭证超时
  500. onUploadTokenExpired: function(uploadInfo) {
  501. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  502. res => {
  503. var data = res;
  504. self.uploader.resumeUploadWithAuth(data.uploadAuth)
  505. })
  506. }
  507. })
  508. },
  509. uploadVodChangeHandle: function(e) {
  510. let self = this;
  511. uni.chooseVideo({
  512. count: 1, //上传视频的个数
  513. mediaType: ['video'], //限制上传的类型为video
  514. sourceType: ['album', 'camera'], //视频选择来源
  515. maxDuration: 58, //拍摄限制时间
  516. camera: 'back', //采用后置摄像头
  517. success: function(res) {
  518. //获取临时存放的视频资源
  519. // let tempFilePath=res.tempFiles[0]
  520. console.log('视频文件==', res)
  521. var file = {
  522. url: res.tempFilePath,
  523. coverUrl: res.thumbTempFilePath
  524. };
  525. self.fileName = res.tempFilePath.substring(res.tempFilePath.lastIndexOf('/') + 1)
  526. // if (self.uploader) {
  527. // self.uploader.stopUpload();
  528. // self.authProgress = 0;
  529. // }
  530. var userData = '{"Vod":{}}';
  531. self.uploader = self.createUploader();
  532. self.uploader.addFile(file, null, null, null, userData);
  533. self.uploader.startUpload();
  534. },
  535. })
  536. },
  537. uploadImg() {
  538. let that = this;
  539. uni.chooseImage({
  540. count: 1,
  541. sizeType: ['original', 'compressed'],
  542. sourceType: ['album', 'camera'],
  543. success: function({
  544. tempFilePaths
  545. }) {
  546. var promise = Promise.all(
  547. tempFilePaths.map(tempFilePath => {
  548. return new Promise(function(resolve, reject) {
  549. req.uploadFile(api.upload, tempFilePath, res => {
  550. that.imageMap = res.src;
  551. //上传完成,则更新保存
  552. that.updateCard(3, that.imageMap);
  553. });
  554. });
  555. })
  556. );
  557. promise
  558. .then(function(results) {
  559. console.log(results);
  560. })
  561. .catch(function(err) {
  562. console.log(err);
  563. });
  564. }
  565. });
  566. },
  567. uploadImgs() {
  568. let that = this;
  569. uni.chooseImage({
  570. count: 9,
  571. sizeType: ['original', 'compressed'],
  572. sourceType: ['album', 'camera'],
  573. success: function({
  574. tempFilePaths
  575. }) {
  576. var promise = Promise.all(
  577. tempFilePaths.map(tempFilePath => {
  578. return new Promise(function(resolve, reject) {
  579. req.uploadFile(api.upload, tempFilePath, res => {
  580. let picUrls = that.zhiPicUrls;
  581. that.zhiPicUrls = picUrls.concat(res.src);
  582. if (tempFilePaths.length == that.zhiPicUrls
  583. .length) {
  584. //上传完成,则更新保存
  585. that.updateCard(1, that.zhiPicUrls.join(
  586. ','));
  587. }
  588. });
  589. });
  590. })
  591. );
  592. promise
  593. .then(function(results) {
  594. console.log(results);
  595. })
  596. .catch(function(err) {
  597. console.log(err);
  598. });
  599. }
  600. });
  601. },
  602. //预览图片
  603. previewImg(picUrls, index) {
  604. //预览合同图片
  605. var src = picUrls[index];
  606. let imgs = picUrls;
  607. uni.previewImage({
  608. current: src, // 当前显示图片的http链接
  609. urls: imgs
  610. });
  611. },
  612. cleanimages(index) {
  613. // 删除图片
  614. let arr = this.zhiPicUrls;
  615. arr.splice(index, 1);
  616. this.zhiPicUrls = arr;
  617. },
  618. /**
  619. * @param {Object} type 1图片 2、视频
  620. * @param {Object} url 资源地址
  621. */
  622. updateCard(type, url) {
  623. var dataP = {};
  624. dataP.id = this.cardInfo.id;
  625. if (type == 1) {
  626. dataP.pictures = url;
  627. } else if (type == 2) {
  628. dataP.video = url;
  629. } else if (type == 3) {
  630. dataP.imageMap = url;
  631. }
  632. req.postRequest(api.api_addressList_update, dataP, json => {
  633. if (type == 1) {
  634. this.cardInfo.pictures = url;
  635. } else if (type == 2) {
  636. this.cardInfo.video = url;
  637. } else if (type == 3) {
  638. this.cardInfo.imageMap = url;
  639. }
  640. });
  641. },
  642. toWxShare() {
  643. req.getWXOriginalId(data => {
  644. if (data) {
  645. this.wxShare(data);
  646. } else {
  647. this.$showModal({
  648. title: '提示',
  649. content: '未配置微信小程序',
  650. cancelText: '取消',
  651. confirmText: '设置开通'
  652. }).then(res => {
  653. // 点击确认的操作
  654. // tha.copy(content);
  655. });
  656. }
  657. });
  658. },
  659. wxShare(originalId) {
  660. //分享H5
  661. // uni.share({
  662. // provider: 'weixin',
  663. // scene: 'WXSceneSession',
  664. // type: 0,
  665. // href: req.env[req.env.NODE_ENV].h5BaseUrl + '/share/card/index?cardId=' + this.cardInfo.id,
  666. // title: this.cardInfo.nickName + ' - 电子名片',
  667. // summary: this.cardInfo.title + ' ' + this.cardInfo.position.name + ' ' + this.cardInfo.message,
  668. // imageUrl: this.cardInfo.avatar,
  669. // success: function(res) {
  670. // console.log('success:' + JSON.stringify(res));
  671. // },
  672. // fail: function(err) {
  673. // console.log('fail:' + JSON.stringify(err));
  674. // }
  675. // });
  676. uni.share({
  677. provider: 'weixin',
  678. scene: 'WXSceneSession',
  679. type: 5,
  680. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375',
  681. title: this.cardInfo.nickName + ' - 电子名片',
  682. summary: this.cardInfo.title + ' ' + this.cardInfo.position.name + ' ' + this.cardInfo.message,
  683. miniProgram: {
  684. id: originalId,
  685. path: '/share/card/index?cardId=' + this.cardInfo.id,
  686. type: req.env[req.env.NODE_ENV].typeMiniProgram,
  687. webUrl: req.public.homeWebUrl
  688. },
  689. success: ret => {
  690. console.log(JSON.stringify(ret));
  691. }
  692. });
  693. }
  694. },
  695. mounted() {
  696. const systemInfo = uni.getSystemInfoSync();
  697. // px转换到rpx的比例
  698. let pxToRpxScale = 750 / systemInfo.windowWidth;
  699. let systems = {
  700. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  701. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  702. };
  703. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  704. this.systems = systems;
  705. },
  706. onPageScroll: function(e) {
  707. if (e.scrollTop > this.systems.barHeight) {
  708. this.isTop = 1;
  709. } else {
  710. this.isTop = 0;
  711. }
  712. }
  713. };
  714. </script>
  715. <style>
  716. @import './index.css';
  717. </style>