index.vue 23 KB

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