index.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  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 class="change-option ddflex">
  26. <view v-if="cardId" class="change ddflex" style="right: 140rpx;background-color:#27D699;"
  27. @click="userBehavior(3)">
  28. <image v-if="!cardInfo.isThumbs" style="width: 35rpx;height: 32rpx;"
  29. src="/card/static/images/dz1.png"></image>
  30. <image v-else style="width: 35rpx;height:32rpx;" src="/card/static/images/dz1_h.png">
  31. </image>
  32. <!-- 点赞 -->
  33. </view>
  34. <view v-if="cardId&&(userInfo.manageSaleNo!=cardInfo.jobNumber)" class="change ddflex" @click="jumpUrl('/card/cardFound/cardFound')">
  35. <image src="/card/static/images/change.png"></image>
  36. <!-- 更换销售员-->
  37. </view>
  38. </view>
  39. </block>
  40. </view>
  41. <view class="info dflex">
  42. <view class="flex">
  43. <view class="name">
  44. {{ cardInfo.realName }}
  45. <text class="job" v-if="cardInfo.job">{{ cardInfo.jobName }}</text>
  46. <text class="job">入司{{cardInfo.inDate?getAge(cardInfo.inDate):1}}年</text>
  47. </view>
  48. <view class="company ddflex" style="margin-top: 20rpx;">
  49. <image src="/card/static/images/gs.png"></image>
  50. {{ cardInfo.companyName }}
  51. </view>
  52. <view class="company ddflex">
  53. <image src="/card/static/images/area.png"></image>
  54. 服务区域 {{ cardInfo.areaCodeName?cardInfo.areaCodeName:'湖南' }}
  55. </view>
  56. <view class="company">
  57. 执业证书:{{ cardInfo.professionalCertificateNo?cardInfo.professionalCertificateNo:'暂无'}}
  58. </view>
  59. <view class="ddflex" style="margin-top: 30rpx;" v-if="cardInfo.wechat||cardInfo.wechat">
  60. <view class="ddflex fflex" style="background: #F8F8F8;border-radius: 10rpx;padding: 20rpx;font-size: 26rpx;margin-right: 30rpx;" v-if="cardInfo.phone">
  61. <image style="width: 32rpx;height: 32rpx;margin-right: 10rpx;" src="/card/static/images/phone.png"></image>
  62. {{cardInfo.phone}}
  63. </view>
  64. <view class="ddflex fflex" style="background: #F8F8F8;border-radius: 10rpx;padding: 20rpx;font-size: 26rpx;" v-if="cardInfo.wechat">
  65. <image style="width: 32rpx;height: 32rpx;margin-right: 10rpx;" src="/card/static/images/wx.png"></image>
  66. {{cardInfo.wechat}}
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="btns ddflex" v-if="cardId">
  73. <view class="share-ta ddflex fflex" style="background: linear-gradient(80deg, #7EBFF1 0%, #458EEE 100%);"
  74. @click="copy(cardInfo.wechat, 1)">
  75. <image src="../../static/pages/images/wx.png"></image>微信联系</view>
  76. <view class="share-ta ddflex fflex" style="background: linear-gradient(84deg, #6FE5BC 0%, #27D699 100%);"
  77. @click="goPhone()">
  78. <image src="/card/static/images/phone1.png"></image>电话联系</view>
  79. <view class="share-ta ddflex fflex" style="background: linear-gradient(80deg, #FF985A 0%, #FF5700 100%);"
  80. @click="jumpUrl('/card/poster/poster?id'+cardInfo.id)">
  81. <image src="/card/static/images/fx.png"></image>分享名片</view>
  82. </view>
  83. <view class="save-text ddflex" v-if="cardId" @click="saveToPhone()">
  84. <image src="/card/static/images/save.png"></image>保存到通讯录
  85. </view>
  86. <view class="btns ddflex" v-if="!cardId" style="justify-content: center;">
  87. <view class="share-ta ddflex" style="background: linear-gradient(84deg, #6FE5BC 0%, #27D699 100%);width: 260rpx;margin-right: 30rpx;"
  88. @click="jumpUrl('/card/poster/poster?id'+cardInfo.id)">
  89. <image src="/card/static/images/wdmp.png"></image>我的名片码</view>
  90. <button open-type="share" class="share-ta ddflex" style="background: linear-gradient(80deg, #FF985A 0%, #FF5700 100%);width: 260rpx !important;"
  91. >
  92. <image src="/card/static/images/fx.png"></image>发送名片</button>
  93. </view>
  94. <view class="extend-info ddflex">
  95. <view class="extend-info-item fflex">
  96. <view class="extend-info-data">{{cardInfo.cntCust?cardInfo.cntCust:0}}</view>
  97. <view class="extend-info-label ddflex">
  98. <image src="../../static/pages/images/fw_hui.png"></image>
  99. <view>服务客户</view>
  100. </view>
  101. </view>
  102. <view class="extend-info-item fflex">
  103. <view class="extend-info-data">{{cardInfo.cntCntr?cardInfo.cntCntr:0}}</view>
  104. <view class="extend-info-label ddflex">
  105. <image src="/static/pages/images/cy_hui.png"></image>
  106. <view>保单件数</view>
  107. </view>
  108. </view>
  109. <view class="extend-info-item fflex">
  110. <view class="extend-info-data">{{cardInfo.thumbs?cardInfo.thumbs:0}}</view>
  111. <view class="extend-info-label ddflex">
  112. <image src="/static/pages/images/dz_hui.png"></image>
  113. <view>点赞量</view>
  114. </view>
  115. </view>
  116. </view>
  117. <view class="q-hud ddflex">
  118. <view class="q-hud-c ddflex">
  119. <view class="q-users ddflex">
  120. <image :src="item.avatar?item.avatar:'../../static/images/userimg.png'" mode="aspectFill" v-for="(item, index) in cardInfo.pageUser.list"
  121. v-if="index<3" :key="index"></image>
  122. </view>
  123. <view class="fflex">
  124. {{cardInfo.pageUser.total}}人看过
  125. </view>
  126. <!-- <image src="../static/images/q_rico.png" class="q-rico"></image> -->
  127. </view>
  128. <view class="q-hud-r ddflex">
  129. <view class="ddflex">
  130. <image style="width: 23rpx;height: 31rpx;margin-right: 10rpx;"
  131. src="/card/static/images/hot.png"></image>
  132. <text>{{cardInfo.share}}</text>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. <!-- 评分 -->
  138. <view class="pf-box">
  139. <view class="ddflex" style="justify-content: space-between;">
  140. <view class="pf-nav">客户评价</view>
  141. <view class="ddflex pf-more" @click="jumpUrl('/card/evaluateList/evaluateList?groupId='+cardInfo.id)">
  142. 全部评价
  143. <image style="width: 9rpx;height: 19rpx;margin-left: 10rpx;" src="/static/pages/images/more.png"></image>
  144. </view>
  145. </view>
  146. <view class="ddflex" style="justify-content: center;margin-top: 40rpx;">
  147. <view class="pf-number">
  148. {{evaluateInfo.info?evaluateInfo.info.avage:0}}<text style="font-size: 24rpx;color: #333333;font-weight: 400;margin-left: 10rpx;">分</text>
  149. </view>
  150. <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" />
  151. </view>
  152. <view class="pf-note">综合评分 {{evaluateInfo.info?evaluateInfo.info.total:0}}人评分</view>
  153. <view class="pf-data" v-if="evaluateInfo.evaluateDTO">
  154. <view class="pf-user ddflex">
  155. <view class="ddflex">
  156. <image class="pf-user-header" :src="evaluateInfo.evaluateDTO.avatar?evaluateInfo.evaluateDTO.avatar:'../../static/images/userimg.png'"></image>
  157. <view class="pf-user-name tover">{{evaluateInfo.evaluateDTO.name}}</view>
  158. <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" />
  159. <text style="font-size: 20rpx;color: #FF4600;">{{evaluateInfo.evaluateDTO.serveScore}}分</text>
  160. </view>
  161. <view class="pf-user-time">{{evaluateInfo.evaluateDTO.createDate}}</view>
  162. </view>
  163. <view class="pf-user-content">
  164. {{evaluateInfo.evaluateDTO.content}}
  165. </view>
  166. <view class="" style="margin-top: 20rpx;">
  167. <image :style="'width: 200rpx;height: 200rpx;margin-bottom: 10rpx;display: inline-block;'+((index+1)%3==0?'':'margin-right:10rpx')"
  168. v-for="item,index in evaluateInfo.evaluateDTO.evaluateImgUrls" :src="item" mode="aspectFit"
  169. @click="previewImg(evaluateInfo.evaluateDTO.evaluateImgUrls,index)"></image>
  170. </view>
  171. </view>
  172. <view class="pf-btn" v-if="cardId" @click="jumpUrl('/card/evaluate/evaluate?id='+cardInfo.id)">点击输入您的评价</view>
  173. </view>
  174. <view class="ddflex index-tab">
  175. <view :class="tabType==1?'index-tab-active':''" @click="tabChange(1)">个人主页</view>
  176. <view :class="tabType==2?'index-tab-active':''" @click="tabChange(2)">最新动态</view>
  177. </view>
  178. <block v-if="tabType==1">
  179. <view class="box brief" v-if="cardInfo.honorImg">
  180. <view class="tit ddflex">
  181. <view class="flex ddflex">
  182. <image src="/card/static/images/shry.png"></image>
  183. <view>所获荣誉</view>
  184. </view>
  185. </view>
  186. <view class="contacts" style="height: 300rpx;margin-top: 20rpx;">
  187. <scroll-view scroll-x="true" class="contact" style="height: 300rpx;">
  188. <view class=" ry-image" v-for="item,index in cardInfo.honorImg.split(',')" @click="previewImg(cardInfo.honorImg.split(','),index)">
  189. <image :src="item" mode="aspectFill"></image>
  190. </view>
  191. </scroll-view>
  192. </view>
  193. </view>
  194. <view class="box brief" v-if="cardInfo.styleImg">
  195. <view class="tit ddflex">
  196. <view class="flex ddflex">
  197. <image src="/card/static/images/grfc.png"></image>
  198. <view>个人风采</view>
  199. </view>
  200. </view>
  201. <view class="contacts" style="height: 300rpx;margin-top: 20rpx;">
  202. <scroll-view scroll-x="true" class="contact" style="height: 300rpx;">
  203. <view class=" ry-image" v-for="item,index in cardInfo.styleImg.split(',')" @click="previewImg(cardInfo.styleImg.split(','),index)">
  204. <image :src="item" mode="aspectFill"></image>
  205. </view>
  206. </scroll-view>
  207. </view>
  208. </view>
  209. <view class="box brief">
  210. <view class="tit ddflex">
  211. <view class="flex ddflex">
  212. <image src="/card/static/images/grjj.png"></image>
  213. <view>个人简介</view>
  214. </view>
  215. <!-- <image v-if="!cardId" src="../static/images/bj_ico.png" class="edit" @tap="jumpUrl('/card/editDesc/editDesc?id=' + cardInfo.id)"></image> -->
  216. </view>
  217. <view class="bri"><rich-text :nodes="cardInfo.brief ? cardInfo.brief : ''"></rich-text></view>
  218. </view>
  219. <view class="box brief">
  220. <view class="tit ddflex">
  221. <view class="flex ddflex">
  222. <image src="/card/static/images/gsjj.png"></image>
  223. <view>公司简介</view>
  224. </view>
  225. <!-- <image v-if="!cardId" src="../static/images/bj_ico.png" class="edit" @tap="jumpUrl('/card/editDesc/editDesc?id=' + cardInfo.id)"></image> -->
  226. </view>
  227. <view class="bri"><rich-text :nodes="cardInfo.companyIntroduction ? cardInfo.companyIntroduction : ''"></rich-text></view>
  228. </view>
  229. </block>
  230. <block v-if="tabType==2">
  231. <view class="list" v-if="pageList && pageList.length > 0">
  232. <view class="li" v-for="(item, index) in pageList" :key="index">
  233. <view class="user ddflex">
  234. <image :src="item.userDTO.avatar" mode="aspectFill" class="userimg" @click="toUserHomePage(item.userDTO.id)"></image>
  235. <view class="fflex">
  236. <view class="namea ddflex">
  237. <view class="name fflex ddflex" @click="toUserHomePage(item.userDTO.id)">
  238. {{ item.userDTO.nickName }}
  239. <image v-if="item.userDTO.levelGrade > 0" src="../../static/images/vip_tag.png" class="vip-tag"></image>
  240. </view>
  241. <view class="time">{{ item.time }}</view>
  242. </view>
  243. <view class="area" @click="toUserHomePage(item.userDTO.id)" v-if="item.userDTO.cityName">{{ item.userDTO.provinceName }} {{ item.userDTO.cityName }}</view>
  244. </view>
  245. </view>
  246. <!-- 分享的动态 -->
  247. <block v-if="item.source">
  248. <view class="link ddflex" @click="jumpUrlDetail(item)">
  249. <block v-if="item.url&&item.url.length>0"><image mode="aspectFill" v-if="idx == 0" v-for="(it, idx) in item.url" :src="it" :key="idx"></image></block>
  250. <view class="fflex tover"><rich-text :nodes="item.content"></rich-text></view>
  251. </view>
  252. </block>
  253. <!-- 非分享的动态 -->
  254. <block v-else>
  255. <view v-if="item.type == 2" class="des tovers" @click="jumpUrlDetail(item)">
  256. <view class="wen">提问</view>
  257. {{ removeHtml(item.content) }}
  258. </view>
  259. <view class="des" v-else @click="jumpUrlDetail(item)"><rich-text :nodes="item.content"></rich-text></view>
  260. <!-- //如果有投票,就不显示图片 -->
  261. <block v-if="!item.qyPoll">
  262. <view class="video" v-if="item.isHaveVideo && config.open_community_video == 1">
  263. <video :src="item.url" :show-center-play-btn="false" :controls="item.isControls" :autoplay="item.isControls" :id="'myVideo'+index" @pause="videoPause(index)" @ended="videoEnded(index)"></video>
  264. <view class="video-play ddflex" @click="videoPlay(index)" v-if="item.isShowPlayBtn"><image src="../../static/images/play.png"></image></view>
  265. </view>
  266. <view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.isHaveVideo"><!-- @click="previewImgss(item.url, idx)" -->
  267. <block v-if="item.url&&item.url.length>0">
  268. <image mode="aspectFill" v-for="(it, idx) in item.url" :src="it" :key="idx"></image>
  269. </block>
  270. </view>
  271. </block>
  272. <!-- 话题 -->
  273. <view class="ddflex" v-if="item.qyDialogu">
  274. <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  275. <image src="../../static/images/topic.png"></image>
  276. {{ item.qyDialogu.title }}
  277. </view>
  278. </view>
  279. <view class="loca ddflex" @click="jumpUrlPoi(item,'/office/poi/index')" v-if="item.poiName"><image :src="picUrlss+'office_images/loca.png'"></image><text v-if="item.poiDistance > 0">{{item.poiDistance ? item.poiDistance < 1000 ? item.poiDistance+'m' : (item.poiDistance/1000).toFixed(1)+'km' : ''}}</text>{{item.poiName}}</view>
  280. <!-- 投票 -->
  281. <view :class="'vote-box' + (item.qyPoll.isEnd ? ' ends' : '')" v-if="item.qyPoll">
  282. <view class="vote-tit">{{ item.qyPoll.title }}</view>
  283. <block v-if="item.qyPoll.isVote == 1">
  284. <view class="vote-list end" @click="jumpUrlDetail(item)">
  285. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
  286. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'"></view>
  287. <view class="fflex">{{ itpy.name }}</view>
  288. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  289. </view>
  290. </view>
  291. </block>
  292. <block v-else>
  293. <view class="vote-list">
  294. <view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex" @click="submitPoll(item, index, idex)">
  295. {{ itpy.name }}
  296. </view>
  297. </view>
  298. </block>
  299. <view class="vote-can" v-if="item.qyPoll.isEnd"><text>{{item.qyPoll.voteCount}}人参与</text>投票已结束</view>
  300. </view>
  301. <block v-if="item.type==10||item.type==11">
  302. <view v-if="item.type==10" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/exercise/record/record?userId=' + item.userId)">
  303. <view>
  304. <view class="step-date">{{item.wxRun.step}}</view>
  305. <view class="step-label">步数</view>
  306. </view>
  307. <view>
  308. <view class="step-date">{{item.wxRun.index}}</view>
  309. <view class="step-label" style="text-align: right;">名次</view>
  310. </view>
  311. </view>
  312. <view v-if="item.type==11" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/match/activityDetail/activityDetail?id=' + item.matchContent.id)">
  313. <image class="step-pic" :src="item.matchContent.pic" mode="aspectFill"></image>
  314. <view class="fflex">
  315. <view class="step-title tovers">{{item.matchContent.title}}</view>
  316. <view class="ddflex" style="justify-content: space-between;margin-top: 10rpx;">
  317. <view class="step-price">{{item.matchContent.endTime}}</view>
  318. <view class="step-btn">查看</view>
  319. </view>
  320. </view>
  321. </view>
  322. </block>
  323. <view v-if="item.userGroupId" class="ddflex step-box" style="padding: 25rpx 21rpx;" @click="jumpUrl('/office/team/index?id=' + item.userGroupId)">
  324. <image style="width: 24rpx;height: 24rpx;margin-right: 13rpx;" src="../../static/images/link.png"></image>
  325. <view style="font-weight: 500;color: #999999;">Team:</view>
  326. <view>{{item.userGroupTitle}}</view>
  327. </view>
  328. <block v-else>
  329. <view class="product" v-if="item.products && item.products.length > 0">
  330. <view scroll-x="true" :class="'pro-view' + (item.products.length == 1 ? ' pro-view1' : '')">
  331. <view class="li" v-for="(it, idx) in item.products" :key="idx" @click="toProductDetail(it)">
  332. <view class="ddflex">
  333. <image :src="it.pic + '?x-oss-process=style/w375'" mode="aspectFill" class="pro-pic"></image>
  334. <view class="fflex">
  335. <view class="title tovers">{{ it.title }}</view>
  336. <view class="opts ddflex">
  337. <view class="money">¥{{ it.salePrice }}</view>
  338. <view class="pro-btn">购买</view>
  339. </view>
  340. </view>
  341. </view>
  342. </view>
  343. </view>
  344. </view>
  345. </block>
  346. </block>
  347. <view class="opt ddflex" v-if="!item.source && type != 3">
  348. <view class="fflex" @click="jumpUrlDetail(item)">{{ item.count.browseCount }}次浏览</view>
  349. <view class="ddflex" @click="submitFabulous(2, item.id, index)">
  350. <image :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  351. {{ item.count.fabulousCount < 99 ? item.count.fabulousCount : '99+' }}
  352. </view>
  353. <view class="ddflex" @click="jumpUrlDetail(item)">
  354. <image src="../../static/images/comment.png"></image>
  355. {{ item.count.commentCount < 99 ? item.count.commentCount : '99+' }}
  356. </view>
  357. <button open-type="share" class="opt-share ddflex">
  358. <image src="../../static/images/share.png"></image>
  359. 分享
  360. </button>
  361. </view>
  362. </view>
  363. </view>
  364. <view class="nodata" v-else>
  365. <image :src="picUrlss + 'empty_jl.png'"></image>
  366. <text>{{ type == 1 ? '暂无动态' : type == 2 ? '暂无提问' : type == 3 ? '暂无日记' : '' }}</text>
  367. </view>
  368. </block>
  369. <serviceContact></serviceContact>
  370. </view>
  371. </template>
  372. <script>
  373. const app = getApp();
  374. const req = require('../../utils/request.js');
  375. const api = require('../../utils/api.js');
  376. import VODUpload from '@/utils/aliyun-upload-sdk-1.0.1.min.js'
  377. import serviceContact from '@/components/service-contact/index.vue'
  378. import util from '../../utils/util.js';
  379. export default {
  380. data() {
  381. return {
  382. picUrlss: req.public.picUrls,
  383. systems: {},
  384. isTop: 0,
  385. options: {},
  386. scene: null,
  387. cardId: '',
  388. cardInfo: '',
  389. cardCount: '',
  390. zhiPicUrls: [],
  391. isFirst: true, //页面加载第一次调用
  392. uploader: '',
  393. isStart: false,
  394. videoInfo: '',
  395. fileName: '', //视频名称
  396. evaluateInfo:null,//评分
  397. tabType:1,
  398. loading:true,
  399. config: {},
  400. isLoad: true,
  401. form: {
  402. page: 1,
  403. limit: 10
  404. },
  405. pageList: [],
  406. userId: '',
  407. videoCurrent: null,
  408. videoContext: '',
  409. userInfo:''
  410. };
  411. },
  412. components:{ serviceContact },
  413. onLoad(options) {
  414. this.options = options
  415. this.cardId = options.cardId;
  416. if (options.scene)
  417. this.scene = options.scene
  418. uni.showLoading({
  419. title:'加载中'
  420. })
  421. },
  422. async onShow() {
  423. this.getConfig()
  424. if (this.scene) {
  425. await this.loadCodeParams();
  426. }
  427. await req.silenceLogin(this.options.userId ? this.options.userId : '', '')
  428. this.userInfo = req.getStorage('userInfo')
  429. this.getCardInfo();
  430. },
  431. onReachBottom() {
  432. this.form.page++;
  433. this.getOfficeList();
  434. },
  435. onShareAppMessage(res) {
  436. if (res.from == 'button') {
  437. let userInfo = req.getStorage('userInfo');
  438. this.userBehavior(6)
  439. return {
  440. title: this.cardInfo.realName,
  441. path: '/card/index/index?cardId=' + this.cardInfo.id + '&userId=' + userInfo.id,
  442. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375', // 分享图
  443. };
  444. }
  445. },
  446. onShareTimeline(res) {
  447. if (res.from == 'button') {
  448. let userInfo = req.getStorage('userInfo');
  449. this.userBehavior(6)
  450. return {
  451. title: this.cardInfo.realName,
  452. path: '/card/index/index?cardId=' + this.cardInfo.id + '&userId=' + userInfo.id,
  453. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375', // 分享图
  454. };
  455. }
  456. },
  457. methods: {
  458. getConfig() {
  459. var _this = this;
  460. return new Promise((res, rej) => {
  461. req.g(
  462. '/api/other/config',
  463. data => {
  464. req.setStorage('configRes', JSON.stringify(data));
  465. this.config = data;
  466. res(data);
  467. },
  468. true
  469. );
  470. });
  471. },
  472. loadCodeParams() {
  473. let _ts = this;
  474. return new Promise((resolve, reject) => {
  475. if (!_ts.scene) {
  476. resolve();
  477. return false;
  478. }
  479. req.getRequest(
  480. '/api/code/params', {
  481. scene: _ts.scene
  482. },
  483. data => {
  484. this.options.userId = data.userId
  485. this.cardId = data.scene
  486. resolve();
  487. }
  488. );
  489. });
  490. },
  491. getImgList(url) {
  492. var list = [];
  493. if (url) {
  494. list = url.split(',');
  495. }
  496. return list;
  497. },
  498. jumpUrl(url) {
  499. uni.navigateTo({
  500. url: url
  501. });
  502. },
  503. getCardInfo() {
  504. var url = '';
  505. var dataP = {
  506. id:this.cardId
  507. };
  508. if (this.cardId) {
  509. url = '/api/visiting/card/info';
  510. dataP.id = this.cardId;
  511. } else {
  512. url = '/api/visiting/card/userInfo';
  513. dataP = {};
  514. }
  515. req.getRequest(url, dataP, data => {
  516. this.cardInfo = data;
  517. this.userId = this.cardInfo.userId
  518. if(this.pageList.length==0){
  519. this.getOfficeList();
  520. }
  521. console.log('isFirst')
  522. if (this.cardId && this.cardInfo.userId == req.getStorage('userInfo').id) {
  523. this.cardId = null
  524. this.getCardInfo()
  525. } else {
  526. if (this.cardInfo.userId == req.getStorage('userInfo').id) {
  527. } else {
  528. // 用户浏览
  529. if (this.isFirst) {
  530. this.userBehavior(4)
  531. }
  532. }
  533. this.isFirst = false
  534. uni.hideLoading()
  535. this.loading = false
  536. }
  537. this.getEvaluate()
  538. });
  539. },
  540. // 用户行为
  541. userBehavior(type) {
  542. var dataP = {};
  543. dataP.type =
  544. 23 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  545. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  546. dataP.bindId = this.cardInfo.id;
  547. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  548. if (type == 3) {
  549. this.cardInfo.isThumbs = !this.cardInfo.isThumbs
  550. }
  551. if (type == 1) {
  552. this.cardInfo.follow = !this.cardInfo.follow
  553. }
  554. });
  555. },
  556. // 存入名片夹
  557. saveToFolder() {
  558. let form = {
  559. visitingCardId: this.cardInfo.id,
  560. userId: req.getStorage('userInfo').id
  561. }
  562. req.postRequest('/api/v3/visiting/card/folder/saveOrUpdate', form, res => {
  563. req.msg('已存入名片夹')
  564. this.cardInfo.isSave = true
  565. })
  566. },
  567. // 存入通讯录
  568. saveToPhone() {
  569. console.log('saveToPhone')
  570. uni.addPhoneContact({
  571. nickName: this.cardInfo.realName,
  572. firstName: this.cardInfo.realName,
  573. mobilePhoneNumber: this.cardInfo.phone,
  574. success: (res) => {
  575. console.log(res)
  576. uni.showModal({
  577. title: '提示',
  578. content: '已存入通讯录,请前往手机通讯录查看',
  579. showCancel: false,
  580. })
  581. },
  582. fail: (err) => {
  583. console.log(err)
  584. req.msg('存入失败')
  585. }
  586. })
  587. },
  588. goPhone() {
  589. uni.makePhoneCall({
  590. phoneNumber: this.cardInfo.phone
  591. }); // 传参带入号码即可
  592. },
  593. copy(valueText, type) {
  594. uni.setClipboardData({
  595. data: valueText,
  596. success: function(res) {
  597. if (type == 1) {
  598. req.msg('微信号复制成功');
  599. } else if (type == 2) {
  600. req.msg('邮箱复制成功');
  601. }
  602. }
  603. });
  604. },
  605. getPlayInfo(videoId) {
  606. req.getRequest('/api/v3/vod/playInfo', {
  607. videoId: videoId
  608. }, data => {
  609. this.videoInfo = data
  610. })
  611. },
  612. createUploader() {
  613. let self = this;
  614. return new VODUpload({
  615. timeout: 60000,
  616. partSize: 1048576,
  617. parallel: 5,
  618. retryCount: 3,
  619. retryDuration: 2,
  620. region: this.regionId,
  621. userId: this.accountId,
  622. // 开始上传
  623. onUploadstarted: function(uploadInfo) {
  624. uni.showLoading({
  625. title: '视频上传中'
  626. })
  627. console.log('uploadInfo==', uploadInfo)
  628. if (!uploadInfo.videoId) {
  629. req.getRequest('/api/v3/vod/uploadAuth?fileName=' + self.fileName, {}, res => {
  630. var data = res;
  631. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  632. .uploadAddress, data.videoId)
  633. })
  634. self.isStart = true;
  635. } else {
  636. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  637. res => {
  638. var data = res;
  639. self.uploader.setUploadAuthAndAddress(uploadInfo, data.uploadAuth, data
  640. .uploadAddress, data.videoId)
  641. })
  642. }
  643. },
  644. // 文件上传成功
  645. onUploadSucceed: function(uploadInfo) {
  646. // req.msg("视频上传成功");
  647. let dataP = {
  648. id: self.cardInfo.id,
  649. videoId: uploadInfo.videoId,
  650. videoInfo: JSON.stringify(uploadInfo)
  651. }
  652. req.postRequest('/api/v3/visiting/card/saveOrUpdate', dataP, res => {
  653. self.getPlayInfo(uploadInfo.videoId);
  654. setTimeout(() => {
  655. self.isStart = false;
  656. }, 1000);
  657. uni.hideLoading()
  658. })
  659. },
  660. // 文件上传失败
  661. onUploadFailed: function(uploadInfo, code, message) {
  662. req.msg("文件上传失败");
  663. },
  664. // 取消文件上传
  665. onUploadCanceled: function(uploadInfo, code, message) {
  666. req.msg("文件已暂停上传");
  667. },
  668. // 文件上传进度,单位:字节, 可以在这个函数中拿到上传进度并显示在页面上
  669. onUploadProgress: function(uploadInfo, totalSize, progress) {
  670. var progressPercent = Math.ceil(progress * 100);
  671. // self.$set(self.uploader, 'authProgress', progressPercent);
  672. },
  673. // 上传凭证超时
  674. onUploadTokenExpired: function(uploadInfo) {
  675. req.getRequest('/api/v3/vod/refreshUploadAuth?videoId=' + uploadInfo.videoId, {},
  676. res => {
  677. var data = res;
  678. self.uploader.resumeUploadWithAuth(data.uploadAuth)
  679. })
  680. }
  681. })
  682. },
  683. uploadVodChangeHandle: function(e) {
  684. let self = this;
  685. uni.chooseVideo({
  686. count: 1, //上传视频的个数
  687. mediaType: ['video'], //限制上传的类型为video
  688. sourceType: ['album', 'camera'], //视频选择来源
  689. maxDuration: 58, //拍摄限制时间
  690. camera: 'back', //采用后置摄像头
  691. success: function(res) {
  692. //获取临时存放的视频资源
  693. // let tempFilePath=res.tempFiles[0]
  694. console.log('视频文件==', res)
  695. var file = {
  696. url: res.tempFilePath,
  697. coverUrl: res.thumbTempFilePath
  698. };
  699. self.fileName = res.tempFilePath.substring(res.tempFilePath.lastIndexOf('/') + 1)
  700. // if (self.uploader) {
  701. // self.uploader.stopUpload();
  702. // self.authProgress = 0;
  703. // }
  704. var userData = '{"Vod":{}}';
  705. self.uploader = self.createUploader();
  706. self.uploader.addFile(file, null, null, null, userData);
  707. self.uploader.startUpload();
  708. },
  709. })
  710. },
  711. uploadImg() {
  712. let that = this;
  713. uni.chooseImage({
  714. count: 1,
  715. sizeType: ['original', 'compressed'],
  716. sourceType: ['album', 'camera'],
  717. success: function({
  718. tempFilePaths
  719. }) {
  720. var promise = Promise.all(
  721. tempFilePaths.map(tempFilePath => {
  722. return new Promise(function(resolve, reject) {
  723. req.uploadFile(api.upload, tempFilePath, res => {
  724. that.imageMap = res.src;
  725. //上传完成,则更新保存
  726. that.updateCard(3, that.imageMap);
  727. });
  728. });
  729. })
  730. );
  731. promise
  732. .then(function(results) {
  733. console.log(results);
  734. })
  735. .catch(function(err) {
  736. console.log(err);
  737. });
  738. }
  739. });
  740. },
  741. uploadImgs() {
  742. let that = this;
  743. uni.chooseImage({
  744. count: 9,
  745. sizeType: ['original', 'compressed'],
  746. sourceType: ['album', 'camera'],
  747. success: function({
  748. tempFilePaths
  749. }) {
  750. var promise = Promise.all(
  751. tempFilePaths.map(tempFilePath => {
  752. return new Promise(function(resolve, reject) {
  753. req.uploadFile(api.upload, tempFilePath, res => {
  754. let picUrls = that.zhiPicUrls;
  755. that.zhiPicUrls = picUrls.concat(res.src);
  756. if (tempFilePaths.length == that.zhiPicUrls
  757. .length) {
  758. //上传完成,则更新保存
  759. that.updateCard(1, that.zhiPicUrls.join(
  760. ','));
  761. }
  762. });
  763. });
  764. })
  765. );
  766. promise
  767. .then(function(results) {
  768. console.log(results);
  769. })
  770. .catch(function(err) {
  771. console.log(err);
  772. });
  773. }
  774. });
  775. },
  776. //预览图片
  777. previewImg(picUrls, index) {
  778. //预览合同图片
  779. var src = picUrls[index];
  780. let imgs = picUrls;
  781. uni.previewImage({
  782. current: src, // 当前显示图片的http链接
  783. urls: imgs
  784. });
  785. },
  786. cleanimages(index) {
  787. // 删除图片
  788. let arr = this.zhiPicUrls;
  789. arr.splice(index, 1);
  790. this.zhiPicUrls = arr;
  791. },
  792. /**
  793. * @param {Object} type 1图片 2、视频
  794. * @param {Object} url 资源地址
  795. */
  796. updateCard(type, url) {
  797. var dataP = {};
  798. dataP.id = this.cardInfo.id;
  799. if (type == 1) {
  800. dataP.pictures = url;
  801. } else if (type == 2) {
  802. dataP.video = url;
  803. } else if (type == 3) {
  804. dataP.imageMap = url;
  805. }
  806. req.postRequest(api.api_addressList_update, dataP, json => {
  807. if (type == 1) {
  808. this.cardInfo.pictures = url;
  809. } else if (type == 2) {
  810. this.cardInfo.video = url;
  811. } else if (type == 3) {
  812. this.cardInfo.imageMap = url;
  813. }
  814. });
  815. },
  816. getAge(date){
  817. return util.getAge(date)
  818. },
  819. // 获取评论
  820. getEvaluate(){
  821. req.getRequest('/api/evaluate/cardInfo',{bindId:this.cardInfo.id,type:2},res=>{
  822. this.evaluateInfo = res
  823. })
  824. },
  825. tabChange(type){
  826. if(type==this.tabType) return false
  827. this.tabType = type
  828. },
  829. getOfficeList() {
  830. let that = this;
  831. var pramData = this.form;
  832. // pramData.type = this.type;
  833. pramData.orderType = 2;
  834. pramData.userId = this.userId;
  835. if (!this.isLoad) return false;
  836. this.isLoad = false;
  837. req.getRequest('/api/v3/moments/page', pramData, data => {
  838. if(data.list&&data.list.length > 0){
  839. this.total = data.total
  840. data.list.map(it=>{
  841. if(it.qyPoll && it.qyPoll.isEnd){
  842. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  843. }
  844. if(it.url){
  845. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  846. if(h.indexOf('mp4')<0&&h.indexOf('MP4')<0){
  847. it.url = it.url.split(',');
  848. }else{
  849. it.isHaveVideo = true
  850. it.isControls = false
  851. it.isShowPlayBtn = true
  852. }
  853. }
  854. it.content = '<div style="overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 5;-webkit-box-orient: vertical;word-break: break-all;">' + it.content + '</div>'
  855. return it;
  856. })
  857. }
  858. if (data.list && data.list.length >= this.form.limit) {
  859. this.isLoad = true;
  860. }
  861. if (this.form.page > 1) {
  862. data.list = this.pageList.concat(data.list);
  863. }
  864. this.pageList = data.list;
  865. this.isShowView = true;
  866. });
  867. },
  868. sum(arr) {
  869. var s = 0;
  870. for (var i=arr.length-1; i>=0; i--) {
  871. if(arr[i].count){
  872. s += Number(arr[i].count);
  873. }
  874. }
  875. return s;
  876. },
  877. //提交点赞、取消点赞;收藏、取消收藏
  878. submitFabulous(type, id, index) {
  879. if (!req.isLogins(true)) {
  880. return;
  881. }
  882. var dataP = {};
  883. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  884. dataP.momentsId = id;
  885. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  886. if (type == 2) {
  887. //动态点赞
  888. if (this.pageList[index].isPraise == 1) {
  889. //已赞
  890. this.pageList[index].isPraise = 0;
  891. this.pageList[index].count.fabulousCount--;
  892. } else {
  893. this.pageList[index].isPraise = 1;
  894. this.pageList[index].count.fabulousCount++;
  895. }
  896. }
  897. });
  898. },
  899. //提交投票
  900. submitPoll(item, pIndex, pollIndex) {
  901. if(item.qyPoll.isEnd) return false;
  902. var dataP = {};
  903. // dataP.id = item.id;
  904. dataP.pollId = item.qyPoll.id;
  905. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  906. dataP.pollOptionCode = pollObjList[pollIndex].code;
  907. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  908. req.msg('投票成功');
  909. //图片完之后要将该投票的对象返回,便于做渲染%
  910. this.pageList[pIndex].qyPoll = data;
  911. });
  912. },
  913. videoPlay(index){
  914. var that = this;
  915. var curIdx = index;
  916. this.pageList[index].isControls = true
  917. this.pageList[index].isShowPlayBtn = false
  918. // 有播放时先将prev暂停,再播放当前点击的current
  919. if (that.videoCurrent != null) {
  920. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  921. if (that.videoCurrent != curIdx) {
  922. this.pageList[that.videoCurrent].isControls = false
  923. this.pageList[that.videoCurrent].isShowPlayBtn = true
  924. videoContextPrev.stop()
  925. }
  926. that.videoCurrent = curIdx
  927. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  928. videoContextCurrent.play()
  929. } else {
  930. // 没有播放时播放视频
  931. that.videoCurrent = curIdx
  932. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  933. videoContext.play()
  934. }
  935. },
  936. videoPause(index){
  937. this.pageList[index].isControls = false
  938. this.pageList[index].isShowPlayBtn = true
  939. },
  940. videoEnded(index){
  941. this.pageList[index].isControls = false
  942. this.pageList[index].isShowPlayBtn = true
  943. },
  944. jumpUrlDetail(item) {
  945. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  946. },
  947. toUserHomePage(userId) {
  948. this.jumpUrl('/topics/home/home?userId=' + userId);
  949. },
  950. },
  951. mounted() {
  952. const systemInfo = uni.getSystemInfoSync();
  953. // px转换到rpx的比例
  954. let pxToRpxScale = 750 / systemInfo.windowWidth;
  955. let systems = {
  956. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  957. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  958. };
  959. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  960. this.systems = systems;
  961. },
  962. onPageScroll: function(e) {
  963. if (e.scrollTop > this.systems.barHeight) {
  964. this.isTop = 1;
  965. } else {
  966. this.isTop = 0;
  967. }
  968. }
  969. };
  970. </script>
  971. <style>
  972. @import './index.css';
  973. </style>