index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818
  1. <template>
  2. <view style="padding-bottom: 30rpx;" v-if="!loading">
  3. <view class="bg">
  4. <image src="/static/pages/images/userBg.png"></image>
  5. </view>
  6. <view class="infos">
  7. <view class="infos-border">
  8. <view class="photo">
  9. <block v-if="cardInfo.avatar">
  10. <image :src="cardInfo.avatar" mode="aspectFill" class="poster"></image>
  11. <view class="change-option ddflex">
  12. <view class="change ddflex" style="right: 140rpx;background-color:#27D699;"
  13. >
  14. <image v-if="!cardInfo.isThumbs" style="width: 35rpx;height: 32rpx;"
  15. src="/card/static/images/dz1.png"></image>
  16. <image v-else style="width: 35rpx;height:32rpx;" src="/card/static/images/dz1_h.png">
  17. </image>
  18. <!-- 点赞 -->
  19. </view>
  20. <view class="change ddflex" >
  21. <image src="/card/static/images/change.png"></image>
  22. <!-- 更换销售员-->
  23. </view>
  24. <view style="background-color: #FF7229;" class="change ddflex">
  25. <image style="width: 36rpx;height: 36rpx;" src="/card/static/images/bind.png"></image>
  26. <!-- 绑定销售员-->
  27. </view>
  28. </view>
  29. </block>
  30. </view>
  31. <view class="info dflex">
  32. <view class="flex">
  33. <view class="name">
  34. {{ cardInfo.realName }}
  35. <text class="job" v-if="cardInfo.job">{{ cardInfo.jobName }}</text>
  36. <text class="job">入司{{cardInfo.inDate?getAge(cardInfo.inDate):1}}年</text>
  37. </view>
  38. <view class="company ddflex" style="margin-top: 20rpx;">
  39. <image src="/card/static/images/gs.png"></image>
  40. {{ cardInfo.companyName }}
  41. </view>
  42. <view class="company ddflex">
  43. <image src="/card/static/images/area.png"></image>
  44. 服务区域 {{ cardInfo.areaCodeName?cardInfo.areaCodeName:'湖南' }}
  45. </view>
  46. <view class="company">
  47. 执业证书:{{ cardInfo.professionalCertificateNo?cardInfo.professionalCertificateNo:'暂无'}}
  48. </view>
  49. <view class="ddflex" style="margin-top: 30rpx;">
  50. <view class="ddflex fflex" style="background: #F8F8F8;border-radius: 10rpx;padding: 20rpx;font-size: 26rpx;margin-right: 30rpx;">
  51. <image style="width: 32rpx;height: 32rpx;margin-right: 10rpx;" src="/card/static/images/phone.png"></image>
  52. {{cardInfo.phone?cardInfo.phone:'暂无手机号'}}
  53. </view>
  54. <view class="ddflex fflex" style="background: #F8F8F8;border-radius: 10rpx;padding: 20rpx;font-size: 26rpx;">
  55. <image style="width: 32rpx;height: 32rpx;margin-right: 10rpx;" src="/card/static/images/wx.png"></image>
  56. {{cardInfo.wechat?cardInfo.wechat:'暂无微信号'}}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <view class="btns ddflex" v-if="cardId">
  63. <view class="share-ta ddflex fflex" v-if="cardInfo.wechat||cardInfo.wechatCode" style="background: linear-gradient(80deg, #7EBFF1 0%, #458EEE 100%);"
  64. >
  65. <image src="../../static/pages/images/wx.png"></image>微信联系</view>
  66. <view class="share-ta ddflex fflex" v-if="cardInfo.phone" style="background: linear-gradient(84deg, #6FE5BC 0%, #27D699 100%);"
  67. @click="goPhone()">
  68. <image src="/card/static/images/phone1.png"></image>电话联系</view>
  69. <view class="share-ta ddflex fflex" style="background: linear-gradient(80deg, #FF985A 0%, #FF5700 100%);"
  70. >
  71. <image src="/card/static/images/fx.png"></image>分享名片</view>
  72. </view>
  73. <view class="save-text ddflex" v-if="cardId" @click="saveToPhone()">
  74. <image src="/card/static/images/save.png"></image>保存到通讯录
  75. </view>
  76. <view class="btns ddflex" v-if="!cardId" style="justify-content: center;">
  77. <view class="share-ta ddflex" style="background: linear-gradient(84deg, #6FE5BC 0%, #27D699 100%);width: 260rpx;margin-right: 30rpx;"
  78. >
  79. <image src="/card/static/images/wdmp.png"></image>我的名片码</view>
  80. <view class="share-ta ddflex" style="background: linear-gradient(80deg, #FF985A 0%, #FF5700 100%);width:260rpx;"
  81. >
  82. <image src="/card/static/images/fx.png"></image>发送名片</view>
  83. </view>
  84. <view class="extend-info ddflex">
  85. <view class="extend-info-item fflex">
  86. <view class="extend-info-data">{{cardInfo.cntCust?cardInfo.cntCust:0}}</view>
  87. <view class="extend-info-label ddflex">
  88. <image src="../../static/pages/images/fw_hui.png"></image>
  89. <view>服务客户</view>
  90. </view>
  91. </view>
  92. <view class="extend-info-item fflex">
  93. <view class="extend-info-data">{{cardInfo.cntCntr?cardInfo.cntCntr:0}}</view>
  94. <view class="extend-info-label ddflex">
  95. <image src="/static/pages/images/cy_hui.png"></image>
  96. <view>保单件数</view>
  97. </view>
  98. </view>
  99. <view class="extend-info-item fflex">
  100. <view class="extend-info-data">{{cardInfo.thumbs?cardInfo.thumbs:0}}</view>
  101. <view class="extend-info-label ddflex">
  102. <image src="/static/pages/images/dz_hui.png"></image>
  103. <view>点赞量</view>
  104. </view>
  105. </view>
  106. </view>
  107. <view class="q-hud ddflex">
  108. <view class="q-hud-c ddflex">
  109. <view class="q-users ddflex">
  110. <image :src="item.avatar?item.avatar:'../../static/images/userimg.png'" mode="aspectFill" v-for="(item, index) in cardInfo.pageUser.list"
  111. v-if="index<3" :key="index"></image>
  112. </view>
  113. <view class="fflex">
  114. {{cardInfo.pageUser.total}}人看过
  115. </view>
  116. <!-- <image src="../static/images/q_rico.png" class="q-rico"></image> -->
  117. </view>
  118. <view class="q-hud-r ddflex">
  119. <view class="ddflex">
  120. <image style="width: 23rpx;height: 31rpx;margin-right: 10rpx;"
  121. src="/card/static/images/hot.png"></image>
  122. <text>{{cardInfo.share}}</text>
  123. </view>
  124. </view>
  125. </view>
  126. </view>
  127. <!-- 评分 -->
  128. <view class="pf-box" v-if="false">
  129. <view class="ddflex" style="justify-content: space-between;">
  130. <view class="pf-nav">客户评价</view>
  131. <view class="ddflex pf-more" @click="jumpUrl('/card/evaluateList/evaluateList?groupId='+cardInfo.id)">
  132. 全部评价
  133. <image style="width: 9rpx;height: 19rpx;margin-left: 10rpx;" src="/static/pages/images/more.png"></image>
  134. </view>
  135. </view>
  136. <view class="ddflex" style="justify-content: center;margin-top: 40rpx;">
  137. <view class="pf-number">
  138. {{evaluateInfo.info?evaluateInfo.info.avage:0}}<text style="font-size: 24rpx;color: #333333;font-weight: 400;margin-left: 10rpx;">分</text>
  139. </view>
  140. <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" />
  141. </view>
  142. <view class="pf-note">综合评分 {{evaluateInfo.info?evaluateInfo.info.total:0}}人评分</view>
  143. <view class="pf-data" v-if="evaluateInfo.evaluateDTO">
  144. <view class="pf-user ddflex">
  145. <view class="ddflex">
  146. <image class="pf-user-header" :src="evaluateInfo.evaluateDTO.avatar?evaluateInfo.evaluateDTO.avatar:'../../static/images/userimg.png'"></image>
  147. <view class="pf-user-name tover">{{evaluateInfo.evaluateDTO.name}}</view>
  148. <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" />
  149. <text style="font-size: 20rpx;color: #FF4600;">{{evaluateInfo.evaluateDTO.serveScore}}分</text>
  150. </view>
  151. <view class="pf-user-time">{{evaluateInfo.evaluateDTO.createDate}}</view>
  152. </view>
  153. <view class="pf-user-content">
  154. {{evaluateInfo.evaluateDTO.content}}
  155. </view>
  156. <view class="" style="margin-top: 20rpx;">
  157. <image :style="'width: 200rpx;height: 200rpx;margin-bottom: 10rpx;display: inline-block;'+((index+1)%3==0?'':'margin-right:10rpx')"
  158. v-for="item,index in evaluateInfo.evaluateDTO.evaluateImgUrls" :src="item" mode="aspectFit"
  159. @click="previewImg(evaluateInfo.evaluateDTO.evaluateImgUrls,index)"></image>
  160. </view>
  161. </view>
  162. <view class="pf-btn" v-if="cardId" @click="jumpUrl('/card/evaluate/evaluate?id='+cardInfo.id)">点击输入您的评价</view>
  163. </view>
  164. <view class="ddflex index-tab">
  165. <view :class="tabType==1?'index-tab-active':''" @click="tabChange(1)">个人主页</view>
  166. <!-- <view :class="tabType==2?'index-tab-active':''" @click="tabChange(2)">最新动态</view> -->
  167. </view>
  168. <block v-if="tabType==1">
  169. <!-- <view class="box brief" v-if="cardInfo.honorImg">
  170. <view class="tit ddflex">
  171. <view class="flex ddflex">
  172. <image src="/card/static/images/shry.png"></image>
  173. <view>所获荣誉</view>
  174. </view>
  175. </view>
  176. <view class="contacts" style="height: 300rpx;margin-top: 20rpx;">
  177. <scroll-view scroll-x="true" class="contact" style="height: 300rpx;">
  178. <view class=" ry-image" v-for="item,index in cardInfo.honorImg.split(',')" @click="previewImg(cardInfo.honorImg.split(','),index)">
  179. <image :src="item" mode="aspectFill"></image>
  180. </view>
  181. </scroll-view>
  182. </view>
  183. </view> -->
  184. <view class="box brief" v-if="cardInfo.styleImg">
  185. <view class="tit ddflex">
  186. <view class="flex ddflex">
  187. <image src="/card/static/images/grfc.png"></image>
  188. <view>个人风采</view>
  189. </view>
  190. </view>
  191. <view class="contacts" style="height: 300rpx;margin-top: 20rpx;">
  192. <scroll-view scroll-x="true" class="contact" style="height: 300rpx;">
  193. <view class=" ry-image" v-for="item,index in cardInfo.styleImg.split(',')" @click="previewImg(cardInfo.styleImg.split(','),index)">
  194. <image :src="item" mode="aspectFill"></image>
  195. </view>
  196. </scroll-view>
  197. </view>
  198. </view>
  199. <view class="box brief" v-if="cardInfo.honorText">
  200. <view class="tit ddflex">
  201. <view class="flex ddflex">
  202. <image src="/card/static/images/shry.png"></image>
  203. <view>所获荣誉</view>
  204. </view>
  205. <!-- <image v-if="!cardId" src="../static/images/bj_ico.png" class="edit" @tap="jumpUrl('/card/editDesc/editDesc?id=' + cardInfo.id)"></image> -->
  206. </view>
  207. <view class="bri"><rich-text :nodes="cardInfo.honorText ? cardInfo.honorText : ''"></rich-text></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="config.CONFIG_ABOUT_COMPANY ? config.CONFIG_ABOUT_COMPANY : ''"></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="/static/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="/static/images/empty_jl.png"></image>
  366. <text>{{ type == 1 ? '暂无动态' : type == 2 ? '暂无提问' : type == 3 ? '暂无日记' : '' }}</text>
  367. </view>
  368. </block>
  369. </view>
  370. </template>
  371. <script>
  372. const app = getApp();
  373. const req = require('../../utils/request.js');
  374. import util from '../../utils/util.js';
  375. export default {
  376. data() {
  377. return {
  378. systems: {},
  379. isTop: 0,
  380. options: {},
  381. scene: null,
  382. cardId: '',
  383. cardInfo: '',
  384. cardCount: '',
  385. zhiPicUrls: [],
  386. isFirst: true, //页面加载第一次调用
  387. uploader: '',
  388. isStart: false,
  389. videoInfo: '',
  390. fileName: '', //视频名称
  391. evaluateInfo:null,//评分
  392. tabType:1,
  393. loading:true,
  394. config: {},
  395. isLoad: true,
  396. form: {
  397. page: 1,
  398. limit: 10
  399. },
  400. pageList: [],
  401. userId: '',
  402. videoCurrent: null,
  403. videoContext: '',
  404. userInfo:''
  405. };
  406. },
  407. components:{ },
  408. onLoad(options) {
  409. this.options = options
  410. this.cardId = options.cardId;
  411. if (options.scene)
  412. this.scene = options.scene
  413. uni.showLoading({
  414. title:'加载中'
  415. })
  416. },
  417. async onShow() {
  418. this.getConfig()
  419. if (this.scene) {
  420. await this.loadCodeParams();
  421. }
  422. // await req.silenceLogin(this.options.userId ? this.options.userId : '', '')
  423. this.userInfo = req.getStorage('userInfo')
  424. this.getCardInfo();
  425. },
  426. onReachBottom() {
  427. this.form.page++;
  428. this.getOfficeList();
  429. },
  430. onShareAppMessage(res) {
  431. if (res.from == 'button') {
  432. let userInfo = req.getStorage('userInfo');
  433. this.userBehavior(6)
  434. return {
  435. title: this.cardInfo.realName,
  436. path: '/card/index/index?cardId=' + this.cardInfo.id + '&userId=' + userInfo.id,
  437. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375', // 分享图
  438. };
  439. }
  440. },
  441. onShareTimeline(res) {
  442. if (res.from == 'button') {
  443. let userInfo = req.getStorage('userInfo');
  444. this.userBehavior(6)
  445. return {
  446. title: this.cardInfo.realName,
  447. path: '/card/index/index?cardId=' + this.cardInfo.id + '&userId=' + userInfo.id,
  448. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375', // 分享图
  449. };
  450. }
  451. },
  452. methods: {
  453. getConfig() {
  454. console.log('getConfig')
  455. var _this = this;
  456. return new Promise((res, rej) => {
  457. req.getRequest(
  458. '/api/other/config',{},
  459. data => {
  460. req.setStorage('configRes', JSON.stringify(data));
  461. this.config = data;
  462. console.log(this.config.CONFIG_ABOUT_COMPANY)
  463. res(data);
  464. }
  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. this.isFirst = false
  519. uni.hideLoading()
  520. this.loading = false
  521. this.getEvaluate()
  522. });
  523. },
  524. // 用户行为
  525. userBehavior(type) {
  526. var dataP = {};
  527. dataP.type =
  528. 23 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  529. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  530. dataP.bindId = this.cardInfo.id;
  531. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  532. if (type == 3) {
  533. this.cardInfo.isThumbs = !this.cardInfo.isThumbs
  534. }
  535. if (type == 1) {
  536. this.cardInfo.follow = !this.cardInfo.follow
  537. }
  538. });
  539. },
  540. // 存入名片夹
  541. saveToFolder() {
  542. let form = {
  543. visitingCardId: this.cardInfo.id,
  544. userId: req.getStorage('userInfo').id
  545. }
  546. req.postRequest('/api/v3/visiting/card/folder/saveOrUpdate', form, res => {
  547. req.msg('已存入名片夹')
  548. this.cardInfo.isSave = true
  549. })
  550. },
  551. // 存入通讯录
  552. saveToPhone() {
  553. console.log('saveToPhone')
  554. uni.addPhoneContact({
  555. nickName: this.cardInfo.realName,
  556. firstName: this.cardInfo.realName,
  557. mobilePhoneNumber: this.cardInfo.phone,
  558. success: (res) => {
  559. console.log(res)
  560. uni.showModal({
  561. title: '提示',
  562. content: '已存入通讯录,请前往手机通讯录查看',
  563. showCancel: false,
  564. })
  565. },
  566. fail: (err) => {
  567. console.log(err)
  568. req.msg('存入失败')
  569. }
  570. })
  571. },
  572. goPhone() {
  573. uni.makePhoneCall({
  574. phoneNumber: this.cardInfo.phone
  575. }); // 传参带入号码即可
  576. },
  577. copy(valueText, type) {
  578. uni.setClipboardData({
  579. data: valueText,
  580. success: function(res) {
  581. if (type == 1) {
  582. req.msg('微信号复制成功');
  583. } else if (type == 2) {
  584. req.msg('邮箱复制成功');
  585. }
  586. }
  587. });
  588. },
  589. //预览图片
  590. previewImg(picUrls, index) {
  591. //预览合同图片
  592. var src = picUrls[index];
  593. let imgs = picUrls;
  594. uni.previewImage({
  595. current: src, // 当前显示图片的http链接
  596. urls: imgs
  597. });
  598. },
  599. cleanimages(index) {
  600. // 删除图片
  601. let arr = this.zhiPicUrls;
  602. arr.splice(index, 1);
  603. this.zhiPicUrls = arr;
  604. },
  605. /**
  606. * @param {Object} type 1图片 2、视频
  607. * @param {Object} url 资源地址
  608. */
  609. updateCard(type, url) {
  610. var dataP = {};
  611. dataP.id = this.cardInfo.id;
  612. if (type == 1) {
  613. dataP.pictures = url;
  614. } else if (type == 2) {
  615. dataP.video = url;
  616. } else if (type == 3) {
  617. dataP.imageMap = url;
  618. }
  619. req.postRequest(api.api_addressList_update, dataP, json => {
  620. if (type == 1) {
  621. this.cardInfo.pictures = url;
  622. } else if (type == 2) {
  623. this.cardInfo.video = url;
  624. } else if (type == 3) {
  625. this.cardInfo.imageMap = url;
  626. }
  627. });
  628. },
  629. getAge(date){
  630. return util.getAge(date)
  631. },
  632. // 获取评论
  633. getEvaluate(){
  634. req.getRequest('/api/evaluate/cardInfo',{bindId:this.cardInfo.id,type:2},res=>{
  635. this.evaluateInfo = res
  636. })
  637. },
  638. tabChange(type){
  639. if(type==this.tabType) return false
  640. this.tabType = type
  641. },
  642. getOfficeList() {
  643. let that = this;
  644. var pramData = this.form;
  645. // pramData.type = this.type;
  646. pramData.orderType = 2;
  647. pramData.userId = this.userId;
  648. if (!this.isLoad) return false;
  649. this.isLoad = false;
  650. req.getRequest('/api/v3/moments/page', pramData, data => {
  651. if(data.list&&data.list.length > 0){
  652. this.total = data.total
  653. data.list.map(it=>{
  654. if(it.qyPoll && it.qyPoll.isEnd){
  655. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  656. }
  657. if(it.url){
  658. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  659. if(h.indexOf('mp4')<0&&h.indexOf('MP4')<0){
  660. it.url = it.url.split(',');
  661. }else{
  662. it.isHaveVideo = true
  663. it.isControls = false
  664. it.isShowPlayBtn = true
  665. }
  666. }
  667. 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>'
  668. return it;
  669. })
  670. }
  671. if (data.list && data.list.length >= this.form.limit) {
  672. this.isLoad = true;
  673. }
  674. if (this.form.page > 1) {
  675. data.list = this.pageList.concat(data.list);
  676. }
  677. this.pageList = data.list;
  678. this.isShowView = true;
  679. });
  680. },
  681. sum(arr) {
  682. var s = 0;
  683. for (var i=arr.length-1; i>=0; i--) {
  684. if(arr[i].count){
  685. s += Number(arr[i].count);
  686. }
  687. }
  688. return s;
  689. },
  690. //提交点赞、取消点赞;收藏、取消收藏
  691. submitFabulous(type, id, index) {
  692. if (!req.isLogins(true)) {
  693. return;
  694. }
  695. var dataP = {};
  696. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  697. dataP.momentsId = id;
  698. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  699. if (type == 2) {
  700. //动态点赞
  701. if (this.pageList[index].isPraise == 1) {
  702. //已赞
  703. this.pageList[index].isPraise = 0;
  704. this.pageList[index].count.fabulousCount--;
  705. } else {
  706. this.pageList[index].isPraise = 1;
  707. this.pageList[index].count.fabulousCount++;
  708. }
  709. }
  710. });
  711. },
  712. //提交投票
  713. submitPoll(item, pIndex, pollIndex) {
  714. if(item.qyPoll.isEnd) return false;
  715. var dataP = {};
  716. // dataP.id = item.id;
  717. dataP.pollId = item.qyPoll.id;
  718. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  719. dataP.pollOptionCode = pollObjList[pollIndex].code;
  720. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  721. req.msg('投票成功');
  722. //图片完之后要将该投票的对象返回,便于做渲染%
  723. this.pageList[pIndex].qyPoll = data;
  724. });
  725. },
  726. videoPlay(index){
  727. var that = this;
  728. var curIdx = index;
  729. this.pageList[index].isControls = true
  730. this.pageList[index].isShowPlayBtn = false
  731. // 有播放时先将prev暂停,再播放当前点击的current
  732. if (that.videoCurrent != null) {
  733. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  734. if (that.videoCurrent != curIdx) {
  735. this.pageList[that.videoCurrent].isControls = false
  736. this.pageList[that.videoCurrent].isShowPlayBtn = true
  737. videoContextPrev.stop()
  738. }
  739. that.videoCurrent = curIdx
  740. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  741. videoContextCurrent.play()
  742. } else {
  743. // 没有播放时播放视频
  744. that.videoCurrent = curIdx
  745. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  746. videoContext.play()
  747. }
  748. },
  749. videoPause(index){
  750. this.pageList[index].isControls = false
  751. this.pageList[index].isShowPlayBtn = true
  752. },
  753. videoEnded(index){
  754. this.pageList[index].isControls = false
  755. this.pageList[index].isShowPlayBtn = true
  756. },
  757. jumpUrlDetail(item) {
  758. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  759. },
  760. toUserHomePage(userId) {
  761. this.jumpUrl('/topics/home/home?userId=' + userId);
  762. },
  763. },
  764. mounted() {
  765. const systemInfo = uni.getSystemInfoSync();
  766. // px转换到rpx的比例
  767. let pxToRpxScale = 750 / systemInfo.windowWidth;
  768. let systems = {
  769. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  770. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  771. };
  772. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  773. this.systems = systems;
  774. },
  775. onPageScroll: function(e) {
  776. if (e.scrollTop > this.systems.barHeight) {
  777. this.isTop = 1;
  778. } else {
  779. this.isTop = 0;
  780. }
  781. }
  782. };
  783. </script>
  784. <style>
  785. @import './index.css';
  786. </style>