index.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709
  1. <template>
  2. <view style="padding-bottom: 30rpx;" v-if="!loading">
  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?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. loading:true
  268. };
  269. },
  270. components:{ serviceContact },
  271. onLoad(options) {
  272. this.options = options
  273. this.cardId = options.cardId;
  274. if (options.scene)
  275. this.scene = options.scene
  276. uni.showLoading({
  277. title:'加载中'
  278. })
  279. },
  280. async onShow() {
  281. if (this.scene) {
  282. await this.loadCodeParams();
  283. }
  284. await req.silenceLogin(this.options.userId ? this.options.userId : '', '')
  285. this.getCardInfo();
  286. },
  287. onShareAppMessage(res) {
  288. if (res.from == 'button') {
  289. let userInfo = req.getStorage('userInfo');
  290. this.userBehavior(6)
  291. return {
  292. title: this.cardInfo.realName,
  293. path: '/card/index/index?cardId=' + this.cardInfo.id + '&userId=' + userInfo.id,
  294. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375', // 分享图
  295. };
  296. }
  297. },
  298. onShareTimeline(res) {
  299. if (res.from == 'button') {
  300. let userInfo = req.getStorage('userInfo');
  301. this.userBehavior(6)
  302. return {
  303. title: this.cardInfo.realName,
  304. path: '/card/index/index?cardId=' + this.cardInfo.id + '&userId=' + userInfo.id,
  305. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375', // 分享图
  306. };
  307. }
  308. },
  309. methods: {
  310. loadCodeParams() {
  311. let _ts = this;
  312. return new Promise((resolve, reject) => {
  313. if (!_ts.scene) {
  314. resolve();
  315. return false;
  316. }
  317. req.getRequest(
  318. '/api/code/params', {
  319. scene: _ts.scene
  320. },
  321. data => {
  322. this.options.userId = data.userId
  323. this.cardId = data.scene
  324. resolve();
  325. }
  326. );
  327. });
  328. },
  329. getImgList(url) {
  330. var list = [];
  331. if (url) {
  332. list = url.split(',');
  333. }
  334. return list;
  335. },
  336. jumpUrl(url) {
  337. uni.navigateTo({
  338. url: url
  339. });
  340. },
  341. getCardInfo() {
  342. var url = '';
  343. var dataP = {
  344. id:this.cardId
  345. };
  346. if (this.cardId) {
  347. url = '/api/visiting/card/info';
  348. dataP.id = this.cardId;
  349. } else {
  350. url = '/api/visiting/card/userInfo';
  351. dataP = {};
  352. }
  353. req.getRequest(url, dataP, data => {
  354. this.cardInfo = data;
  355. console.log('isFirst')
  356. if (this.cardId && this.cardInfo.userId == req.getStorage('userInfo').id) {
  357. this.cardId = null
  358. this.getCardInfo()
  359. } else {
  360. if (this.cardInfo.userId == req.getStorage('userInfo').id) {
  361. } else {
  362. // 用户浏览
  363. if (this.isFirst) {
  364. this.userBehavior(4)
  365. }
  366. }
  367. this.isFirst = false
  368. uni.hideLoading()
  369. this.loading = false
  370. }
  371. this.getEvaluate()
  372. });
  373. },
  374. // 用户行为
  375. userBehavior(type) {
  376. var dataP = {};
  377. dataP.type =
  378. 23 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  379. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  380. dataP.bindId = this.cardInfo.id;
  381. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  382. if (type == 3) {
  383. this.cardInfo.isThumbs = !this.cardInfo.isThumbs
  384. }
  385. if (type == 1) {
  386. this.cardInfo.follow = !this.cardInfo.follow
  387. }
  388. });
  389. },
  390. // 存入名片夹
  391. saveToFolder() {
  392. let form = {
  393. visitingCardId: this.cardInfo.id,
  394. userId: req.getStorage('userInfo').id
  395. }
  396. req.postRequest('/api/v3/visiting/card/folder/saveOrUpdate', form, res => {
  397. req.msg('已存入名片夹')
  398. this.cardInfo.isSave = true
  399. })
  400. },
  401. // 存入通讯录
  402. saveToPhone() {
  403. uni.addPhoneContact({
  404. nickName: this.cardInfo.realName,
  405. firstName: this.cardInfo.realName,
  406. mobilePhoneNumber: this.cardInfo.phone,
  407. success: (res) => {
  408. this.$showModal({
  409. title: '提示',
  410. content: '已存入通讯录,请前往手机通讯录查看',
  411. showCancel: false,
  412. })
  413. .then(res => {
  414. })
  415. .catch(err => {});
  416. },
  417. fail: () => {
  418. req.msg('存入失败')
  419. }
  420. })
  421. },
  422. goPhone() {
  423. uni.makePhoneCall({
  424. phoneNumber: this.cardInfo.phone
  425. }); // 传参带入号码即可
  426. },
  427. copy(valueText, type) {
  428. uni.setClipboardData({
  429. data: valueText,
  430. success: function(res) {
  431. if (type == 1) {
  432. req.msg('微信号复制成功');
  433. } else if (type == 2) {
  434. req.msg('邮箱复制成功');
  435. }
  436. }
  437. });
  438. },
  439. getPlayInfo(videoId) {
  440. req.getRequest('/api/v3/vod/playInfo', {
  441. videoId: videoId
  442. }, data => {
  443. this.videoInfo = data
  444. })
  445. },
  446. createUploader() {
  447. let self = this;
  448. return new VODUpload({
  449. timeout: 60000,
  450. partSize: 1048576,
  451. parallel: 5,
  452. retryCount: 3,
  453. retryDuration: 2,
  454. region: this.regionId,
  455. userId: this.accountId,
  456. // 开始上传
  457. onUploadstarted: function(uploadInfo) {
  458. uni.showLoading({
  459. title: '视频上传中'
  460. })
  461. console.log('uploadInfo==', uploadInfo)
  462. if (!uploadInfo.videoId) {
  463. req.getRequest('/api/v3/vod/uploadAuth?fileName=' + self.fileName, {}, res => {
  464. var data = res;
  465. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  466. .uploadAddress, data.videoId)
  467. })
  468. self.isStart = true;
  469. } else {
  470. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  471. res => {
  472. var data = res;
  473. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  474. .uploadAddress, data.videoId)
  475. })
  476. }
  477. },
  478. // 文件上传成功
  479. onUploadSucceed: function(uploadInfo) {
  480. // req.msg("视频上传成功");
  481. let dataP = {
  482. id: self.cardInfo.id,
  483. videoId: uploadInfo.videoId,
  484. videoInfo: JSON.stringify(uploadInfo)
  485. }
  486. req.postRequest('/api/v3/visiting/card/saveOrUpdate', dataP, res => {
  487. self.getPlayInfo(uploadInfo.videoId);
  488. setTimeout(() => {
  489. self.isStart = false;
  490. }, 1000);
  491. uni.hideLoading()
  492. })
  493. },
  494. // 文件上传失败
  495. onUploadFailed: function(uploadInfo, code, message) {
  496. req.msg("文件上传失败");
  497. },
  498. // 取消文件上传
  499. onUploadCanceled: function(uploadInfo, code, message) {
  500. req.msg("文件已暂停上传");
  501. },
  502. // 文件上传进度,单位:字节, 可以在这个函数中拿到上传进度并显示在页面上
  503. onUploadProgress: function(uploadInfo, totalSize, progress) {
  504. var progressPercent = Math.ceil(progress * 100);
  505. // self.$set(self.uploader, 'authProgress', progressPercent);
  506. },
  507. // 上传凭证超时
  508. onUploadTokenExpired: function(uploadInfo) {
  509. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  510. res => {
  511. var data = res;
  512. self.uploader.resumeUploadWithAuth(data.uploadAuth)
  513. })
  514. }
  515. })
  516. },
  517. uploadVodChangeHandle: function(e) {
  518. let self = this;
  519. uni.chooseVideo({
  520. count: 1, //上传视频的个数
  521. mediaType: ['video'], //限制上传的类型为video
  522. sourceType: ['album', 'camera'], //视频选择来源
  523. maxDuration: 58, //拍摄限制时间
  524. camera: 'back', //采用后置摄像头
  525. success: function(res) {
  526. //获取临时存放的视频资源
  527. // let tempFilePath=res.tempFiles[0]
  528. console.log('视频文件==', res)
  529. var file = {
  530. url: res.tempFilePath,
  531. coverUrl: res.thumbTempFilePath
  532. };
  533. self.fileName = res.tempFilePath.substring(res.tempFilePath.lastIndexOf('/') + 1)
  534. // if (self.uploader) {
  535. // self.uploader.stopUpload();
  536. // self.authProgress = 0;
  537. // }
  538. var userData = '{"Vod":{}}';
  539. self.uploader = self.createUploader();
  540. self.uploader.addFile(file, null, null, null, userData);
  541. self.uploader.startUpload();
  542. },
  543. })
  544. },
  545. uploadImg() {
  546. let that = this;
  547. uni.chooseImage({
  548. count: 1,
  549. sizeType: ['original', 'compressed'],
  550. sourceType: ['album', 'camera'],
  551. success: function({
  552. tempFilePaths
  553. }) {
  554. var promise = Promise.all(
  555. tempFilePaths.map(tempFilePath => {
  556. return new Promise(function(resolve, reject) {
  557. req.uploadFile(api.upload, tempFilePath, res => {
  558. that.imageMap = res.src;
  559. //上传完成,则更新保存
  560. that.updateCard(3, that.imageMap);
  561. });
  562. });
  563. })
  564. );
  565. promise
  566. .then(function(results) {
  567. console.log(results);
  568. })
  569. .catch(function(err) {
  570. console.log(err);
  571. });
  572. }
  573. });
  574. },
  575. uploadImgs() {
  576. let that = this;
  577. uni.chooseImage({
  578. count: 9,
  579. sizeType: ['original', 'compressed'],
  580. sourceType: ['album', 'camera'],
  581. success: function({
  582. tempFilePaths
  583. }) {
  584. var promise = Promise.all(
  585. tempFilePaths.map(tempFilePath => {
  586. return new Promise(function(resolve, reject) {
  587. req.uploadFile(api.upload, tempFilePath, res => {
  588. let picUrls = that.zhiPicUrls;
  589. that.zhiPicUrls = picUrls.concat(res.src);
  590. if (tempFilePaths.length == that.zhiPicUrls
  591. .length) {
  592. //上传完成,则更新保存
  593. that.updateCard(1, that.zhiPicUrls.join(
  594. ','));
  595. }
  596. });
  597. });
  598. })
  599. );
  600. promise
  601. .then(function(results) {
  602. console.log(results);
  603. })
  604. .catch(function(err) {
  605. console.log(err);
  606. });
  607. }
  608. });
  609. },
  610. //预览图片
  611. previewImg(picUrls, index) {
  612. //预览合同图片
  613. var src = picUrls[index];
  614. let imgs = picUrls;
  615. uni.previewImage({
  616. current: src, // 当前显示图片的http链接
  617. urls: imgs
  618. });
  619. },
  620. cleanimages(index) {
  621. // 删除图片
  622. let arr = this.zhiPicUrls;
  623. arr.splice(index, 1);
  624. this.zhiPicUrls = arr;
  625. },
  626. /**
  627. * @param {Object} type 1图片 2、视频
  628. * @param {Object} url 资源地址
  629. */
  630. updateCard(type, url) {
  631. var dataP = {};
  632. dataP.id = this.cardInfo.id;
  633. if (type == 1) {
  634. dataP.pictures = url;
  635. } else if (type == 2) {
  636. dataP.video = url;
  637. } else if (type == 3) {
  638. dataP.imageMap = url;
  639. }
  640. req.postRequest(api.api_addressList_update, dataP, json => {
  641. if (type == 1) {
  642. this.cardInfo.pictures = url;
  643. } else if (type == 2) {
  644. this.cardInfo.video = url;
  645. } else if (type == 3) {
  646. this.cardInfo.imageMap = url;
  647. }
  648. });
  649. },
  650. getAge(date){
  651. return util.getAge(date)
  652. },
  653. // 获取评论
  654. getEvaluate(){
  655. req.getRequest('/api/evaluate/cardInfo',{bindId:this.cardInfo.id,type:2},res=>{
  656. this.evaluateInfo = res
  657. })
  658. }
  659. },
  660. mounted() {
  661. const systemInfo = uni.getSystemInfoSync();
  662. // px转换到rpx的比例
  663. let pxToRpxScale = 750 / systemInfo.windowWidth;
  664. let systems = {
  665. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  666. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  667. };
  668. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  669. this.systems = systems;
  670. },
  671. onPageScroll: function(e) {
  672. if (e.scrollTop > this.systems.barHeight) {
  673. this.isTop = 1;
  674. } else {
  675. this.isTop = 0;
  676. }
  677. }
  678. };
  679. </script>
  680. <style>
  681. @import './index.css';
  682. </style>