index.vue 35 KB

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