index.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  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;" v-if="cardInfo.wechat||cardInfo.wechat">
  50. <view class="ddflex fflex" style="background: #F8F8F8;border-radius: 10rpx;padding: 20rpx;font-size: 26rpx;margin-right: 30rpx;" v-if="cardInfo.phone">
  51. <image style="width: 32rpx;height: 32rpx;margin-right: 10rpx;" src="/card/static/images/phone.png"></image>
  52. {{cardInfo.phone}}
  53. </view>
  54. <view class="ddflex fflex" style="background: #F8F8F8;border-radius: 10rpx;padding: 20rpx;font-size: 26rpx;" v-if="cardInfo.wechat">
  55. <image style="width: 32rpx;height: 32rpx;margin-right: 10rpx;" src="/card/static/images/wx.png"></image>
  56. {{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" style="background: linear-gradient(80deg, #7EBFF1 0%, #458EEE 100%);"
  64. @click="copy(cardInfo.wechat, 1)">
  65. <image src="../../static/pages/images/wx.png"></image>微信联系</view>
  66. <view class="share-ta ddflex fflex" 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">
  200. <view class="tit ddflex">
  201. <view class="flex ddflex">
  202. <image src="/card/static/images/grjj.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.brief ? cardInfo.brief : ''"></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/gsjj.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="config.CONFIG_ABOUT_COMPANY ? config.CONFIG_ABOUT_COMPANY : ''"></rich-text></view>
  218. </view>
  219. </block>
  220. <block v-if="tabType==2">
  221. <view class="list" v-if="pageList && pageList.length > 0">
  222. <view class="li" v-for="(item, index) in pageList" :key="index">
  223. <view class="user ddflex">
  224. <image :src="item.userDTO.avatar" mode="aspectFill" class="userimg" @click="toUserHomePage(item.userDTO.id)"></image>
  225. <view class="fflex">
  226. <view class="namea ddflex">
  227. <view class="name fflex ddflex" @click="toUserHomePage(item.userDTO.id)">
  228. {{ item.userDTO.nickName }}
  229. <image v-if="item.userDTO.levelGrade > 0" src="../../static/images/vip_tag.png" class="vip-tag"></image>
  230. </view>
  231. <view class="time">{{ item.time }}</view>
  232. </view>
  233. <view class="area" @click="toUserHomePage(item.userDTO.id)" v-if="item.userDTO.cityName">{{ item.userDTO.provinceName }} {{ item.userDTO.cityName }}</view>
  234. </view>
  235. </view>
  236. <!-- 分享的动态 -->
  237. <block v-if="item.source">
  238. <view class="link ddflex" @click="jumpUrlDetail(item)">
  239. <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>
  240. <view class="fflex tover"><rich-text :nodes="item.content"></rich-text></view>
  241. </view>
  242. </block>
  243. <!-- 非分享的动态 -->
  244. <block v-else>
  245. <view v-if="item.type == 2" class="des tovers" @click="jumpUrlDetail(item)">
  246. <view class="wen">提问</view>
  247. {{ removeHtml(item.content) }}
  248. </view>
  249. <view class="des" v-else @click="jumpUrlDetail(item)"><rich-text :nodes="item.content"></rich-text></view>
  250. <!-- //如果有投票,就不显示图片 -->
  251. <block v-if="!item.qyPoll">
  252. <view class="video" v-if="item.isHaveVideo && config.open_community_video == 1">
  253. <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>
  254. <view class="video-play ddflex" @click="videoPlay(index)" v-if="item.isShowPlayBtn"><image src="../../static/images/play.png"></image></view>
  255. </view>
  256. <view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.isHaveVideo"><!-- @click="previewImgss(item.url, idx)" -->
  257. <block v-if="item.url&&item.url.length>0">
  258. <image mode="aspectFill" v-for="(it, idx) in item.url" :src="it" :key="idx"></image>
  259. </block>
  260. </view>
  261. </block>
  262. <!-- 话题 -->
  263. <view class="ddflex" v-if="item.qyDialogu">
  264. <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  265. <image src="../../static/images/topic.png"></image>
  266. {{ item.qyDialogu.title }}
  267. </view>
  268. </view>
  269. <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>
  270. <!-- 投票 -->
  271. <view :class="'vote-box' + (item.qyPoll.isEnd ? ' ends' : '')" v-if="item.qyPoll">
  272. <view class="vote-tit">{{ item.qyPoll.title }}</view>
  273. <block v-if="item.qyPoll.isVote == 1">
  274. <view class="vote-list end" @click="jumpUrlDetail(item)">
  275. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
  276. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'"></view>
  277. <view class="fflex">{{ itpy.name }}</view>
  278. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  279. </view>
  280. </view>
  281. </block>
  282. <block v-else>
  283. <view class="vote-list">
  284. <view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex" @click="submitPoll(item, index, idex)">
  285. {{ itpy.name }}
  286. </view>
  287. </view>
  288. </block>
  289. <view class="vote-can" v-if="item.qyPoll.isEnd"><text>{{item.qyPoll.voteCount}}人参与</text>投票已结束</view>
  290. </view>
  291. <block v-if="item.type==10||item.type==11">
  292. <view v-if="item.type==10" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/exercise/record/record?userId=' + item.userId)">
  293. <view>
  294. <view class="step-date">{{item.wxRun.step}}</view>
  295. <view class="step-label">步数</view>
  296. </view>
  297. <view>
  298. <view class="step-date">{{item.wxRun.index}}</view>
  299. <view class="step-label" style="text-align: right;">名次</view>
  300. </view>
  301. </view>
  302. <view v-if="item.type==11" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/match/activityDetail/activityDetail?id=' + item.matchContent.id)">
  303. <image class="step-pic" :src="item.matchContent.pic" mode="aspectFill"></image>
  304. <view class="fflex">
  305. <view class="step-title tovers">{{item.matchContent.title}}</view>
  306. <view class="ddflex" style="justify-content: space-between;margin-top: 10rpx;">
  307. <view class="step-price">{{item.matchContent.endTime}}</view>
  308. <view class="step-btn">查看</view>
  309. </view>
  310. </view>
  311. </view>
  312. </block>
  313. <view v-if="item.userGroupId" class="ddflex step-box" style="padding: 25rpx 21rpx;" @click="jumpUrl('/office/team/index?id=' + item.userGroupId)">
  314. <image style="width: 24rpx;height: 24rpx;margin-right: 13rpx;" src="../../static/images/link.png"></image>
  315. <view style="font-weight: 500;color: #999999;">Team:</view>
  316. <view>{{item.userGroupTitle}}</view>
  317. </view>
  318. <block v-else>
  319. <view class="product" v-if="item.products && item.products.length > 0">
  320. <view scroll-x="true" :class="'pro-view' + (item.products.length == 1 ? ' pro-view1' : '')">
  321. <view class="li" v-for="(it, idx) in item.products" :key="idx" @click="toProductDetail(it)">
  322. <view class="ddflex">
  323. <image :src="it.pic + '?x-oss-process=style/w375'" mode="aspectFill" class="pro-pic"></image>
  324. <view class="fflex">
  325. <view class="title tovers">{{ it.title }}</view>
  326. <view class="opts ddflex">
  327. <view class="money">¥{{ it.salePrice }}</view>
  328. <view class="pro-btn">购买</view>
  329. </view>
  330. </view>
  331. </view>
  332. </view>
  333. </view>
  334. </view>
  335. </block>
  336. </block>
  337. <view class="opt ddflex" v-if="!item.source && type != 3">
  338. <view class="fflex" @click="jumpUrlDetail(item)">{{ item.count.browseCount }}次浏览</view>
  339. <view class="ddflex" @click="submitFabulous(2, item.id, index)">
  340. <image :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  341. {{ item.count.fabulousCount < 99 ? item.count.fabulousCount : '99+' }}
  342. </view>
  343. <view class="ddflex" @click="jumpUrlDetail(item)">
  344. <image src="../../static/images/comment.png"></image>
  345. {{ item.count.commentCount < 99 ? item.count.commentCount : '99+' }}
  346. </view>
  347. <button open-type="share" class="opt-share ddflex">
  348. <image src="../../static/images/share.png"></image>
  349. 分享
  350. </button>
  351. </view>
  352. </view>
  353. </view>
  354. <view class="nodata" v-else>
  355. <image src="/static/images/empty_jl.png"></image>
  356. <text>{{ type == 1 ? '暂无动态' : type == 2 ? '暂无提问' : type == 3 ? '暂无日记' : '' }}</text>
  357. </view>
  358. </block>
  359. </view>
  360. </template>
  361. <script>
  362. const app = getApp();
  363. const req = require('../../utils/request.js');
  364. import util from '../../utils/util.js';
  365. export default {
  366. data() {
  367. return {
  368. systems: {},
  369. isTop: 0,
  370. options: {},
  371. scene: null,
  372. cardId: '',
  373. cardInfo: '',
  374. cardCount: '',
  375. zhiPicUrls: [],
  376. isFirst: true, //页面加载第一次调用
  377. uploader: '',
  378. isStart: false,
  379. videoInfo: '',
  380. fileName: '', //视频名称
  381. evaluateInfo:null,//评分
  382. tabType:1,
  383. loading:true,
  384. config: {},
  385. isLoad: true,
  386. form: {
  387. page: 1,
  388. limit: 10
  389. },
  390. pageList: [],
  391. userId: '',
  392. videoCurrent: null,
  393. videoContext: '',
  394. userInfo:''
  395. };
  396. },
  397. components:{ },
  398. onLoad(options) {
  399. this.options = options
  400. this.cardId = options.cardId;
  401. if (options.scene)
  402. this.scene = options.scene
  403. uni.showLoading({
  404. title:'加载中'
  405. })
  406. },
  407. async onShow() {
  408. this.getConfig()
  409. if (this.scene) {
  410. await this.loadCodeParams();
  411. }
  412. // await req.silenceLogin(this.options.userId ? this.options.userId : '', '')
  413. this.userInfo = req.getStorage('userInfo')
  414. this.getCardInfo();
  415. },
  416. onReachBottom() {
  417. this.form.page++;
  418. this.getOfficeList();
  419. },
  420. onShareAppMessage(res) {
  421. if (res.from == 'button') {
  422. let userInfo = req.getStorage('userInfo');
  423. this.userBehavior(6)
  424. return {
  425. title: this.cardInfo.realName,
  426. path: '/card/index/index?cardId=' + this.cardInfo.id + '&userId=' + userInfo.id,
  427. imageUrl: this.cardInfo.avatar + '?x-oss-process=style/w375', // 分享图
  428. };
  429. }
  430. },
  431. onShareTimeline(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. methods: {
  443. getConfig() {
  444. console.log('getConfig')
  445. var _this = this;
  446. return new Promise((res, rej) => {
  447. req.getRequest(
  448. '/api/other/config',{},
  449. data => {
  450. req.setStorage('configRes', JSON.stringify(data));
  451. this.config = data;
  452. console.log(this.config.CONFIG_ABOUT_COMPANY)
  453. res(data);
  454. }
  455. );
  456. });
  457. },
  458. loadCodeParams() {
  459. let _ts = this;
  460. return new Promise((resolve, reject) => {
  461. if (!_ts.scene) {
  462. resolve();
  463. return false;
  464. }
  465. req.getRequest(
  466. '/api/code/params', {
  467. scene: _ts.scene
  468. },
  469. data => {
  470. this.options.userId = data.userId
  471. this.cardId = data.scene
  472. resolve();
  473. }
  474. );
  475. });
  476. },
  477. getImgList(url) {
  478. var list = [];
  479. if (url) {
  480. list = url.split(',');
  481. }
  482. return list;
  483. },
  484. jumpUrl(url) {
  485. uni.navigateTo({
  486. url: url
  487. });
  488. },
  489. getCardInfo() {
  490. var url = '';
  491. var dataP = {
  492. id:this.cardId
  493. };
  494. if (this.cardId) {
  495. url = '/api/visiting/card/info';
  496. dataP.id = this.cardId;
  497. } else {
  498. url = '/api/visiting/card/userInfo';
  499. dataP = {};
  500. }
  501. req.getRequest(url, dataP, data => {
  502. this.cardInfo = data;
  503. this.userId = this.cardInfo.userId
  504. if(this.pageList.length==0){
  505. this.getOfficeList();
  506. }
  507. console.log('isFirst')
  508. if (this.cardId && this.cardInfo.userId == req.getStorage('userInfo').id) {
  509. this.cardId = null
  510. this.getCardInfo()
  511. } else {
  512. if (this.cardInfo.userId == req.getStorage('userInfo').id) {
  513. } else {
  514. // 用户浏览
  515. if (this.isFirst) {
  516. this.userBehavior(4)
  517. }
  518. }
  519. this.isFirst = false
  520. uni.hideLoading()
  521. this.loading = false
  522. }
  523. this.getEvaluate()
  524. });
  525. },
  526. // 用户行为
  527. userBehavior(type) {
  528. var dataP = {};
  529. dataP.type =
  530. 23 //、产品 2、活动 3、未知 4、内容 5、课程 6、老师 7、素材 8、题目 9、资料领取 10、招聘职位 12、用户须知 13、素材 15、医院科室 16、海报 20、医生 21 新闻 23名片
  531. dataP.behavior = type; //1、关注 2、收藏 3、点赞 4、浏览 5、确认 6、分享
  532. dataP.bindId = this.cardInfo.id;
  533. req.postRequestLoding('/api/v3/behavior/save', dataP, data => {
  534. if (type == 3) {
  535. this.cardInfo.isThumbs = !this.cardInfo.isThumbs
  536. }
  537. if (type == 1) {
  538. this.cardInfo.follow = !this.cardInfo.follow
  539. }
  540. });
  541. },
  542. // 存入名片夹
  543. saveToFolder() {
  544. let form = {
  545. visitingCardId: this.cardInfo.id,
  546. userId: req.getStorage('userInfo').id
  547. }
  548. req.postRequest('/api/v3/visiting/card/folder/saveOrUpdate', form, res => {
  549. req.msg('已存入名片夹')
  550. this.cardInfo.isSave = true
  551. })
  552. },
  553. // 存入通讯录
  554. saveToPhone() {
  555. console.log('saveToPhone')
  556. uni.addPhoneContact({
  557. nickName: this.cardInfo.realName,
  558. firstName: this.cardInfo.realName,
  559. mobilePhoneNumber: this.cardInfo.phone,
  560. success: (res) => {
  561. console.log(res)
  562. uni.showModal({
  563. title: '提示',
  564. content: '已存入通讯录,请前往手机通讯录查看',
  565. showCancel: false,
  566. })
  567. },
  568. fail: (err) => {
  569. console.log(err)
  570. req.msg('存入失败')
  571. }
  572. })
  573. },
  574. goPhone() {
  575. uni.makePhoneCall({
  576. phoneNumber: this.cardInfo.phone
  577. }); // 传参带入号码即可
  578. },
  579. copy(valueText, type) {
  580. uni.setClipboardData({
  581. data: valueText,
  582. success: function(res) {
  583. if (type == 1) {
  584. req.msg('微信号复制成功');
  585. } else if (type == 2) {
  586. req.msg('邮箱复制成功');
  587. }
  588. }
  589. });
  590. },
  591. //预览图片
  592. previewImg(picUrls, index) {
  593. //预览合同图片
  594. var src = picUrls[index];
  595. let imgs = picUrls;
  596. uni.previewImage({
  597. current: src, // 当前显示图片的http链接
  598. urls: imgs
  599. });
  600. },
  601. cleanimages(index) {
  602. // 删除图片
  603. let arr = this.zhiPicUrls;
  604. arr.splice(index, 1);
  605. this.zhiPicUrls = arr;
  606. },
  607. /**
  608. * @param {Object} type 1图片 2、视频
  609. * @param {Object} url 资源地址
  610. */
  611. updateCard(type, url) {
  612. var dataP = {};
  613. dataP.id = this.cardInfo.id;
  614. if (type == 1) {
  615. dataP.pictures = url;
  616. } else if (type == 2) {
  617. dataP.video = url;
  618. } else if (type == 3) {
  619. dataP.imageMap = url;
  620. }
  621. req.postRequest(api.api_addressList_update, dataP, json => {
  622. if (type == 1) {
  623. this.cardInfo.pictures = url;
  624. } else if (type == 2) {
  625. this.cardInfo.video = url;
  626. } else if (type == 3) {
  627. this.cardInfo.imageMap = url;
  628. }
  629. });
  630. },
  631. getAge(date){
  632. return util.getAge(date)
  633. },
  634. // 获取评论
  635. getEvaluate(){
  636. req.getRequest('/api/evaluate/cardInfo',{bindId:this.cardInfo.id,type:2},res=>{
  637. this.evaluateInfo = res
  638. })
  639. },
  640. tabChange(type){
  641. if(type==this.tabType) return false
  642. this.tabType = type
  643. },
  644. getOfficeList() {
  645. let that = this;
  646. var pramData = this.form;
  647. // pramData.type = this.type;
  648. pramData.orderType = 2;
  649. pramData.userId = this.userId;
  650. if (!this.isLoad) return false;
  651. this.isLoad = false;
  652. req.getRequest('/api/v3/moments/page', pramData, data => {
  653. if(data.list&&data.list.length > 0){
  654. this.total = data.total
  655. data.list.map(it=>{
  656. if(it.qyPoll && it.qyPoll.isEnd){
  657. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  658. }
  659. if(it.url){
  660. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  661. if(h.indexOf('mp4')<0&&h.indexOf('MP4')<0){
  662. it.url = it.url.split(',');
  663. }else{
  664. it.isHaveVideo = true
  665. it.isControls = false
  666. it.isShowPlayBtn = true
  667. }
  668. }
  669. 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>'
  670. return it;
  671. })
  672. }
  673. if (data.list && data.list.length >= this.form.limit) {
  674. this.isLoad = true;
  675. }
  676. if (this.form.page > 1) {
  677. data.list = this.pageList.concat(data.list);
  678. }
  679. this.pageList = data.list;
  680. this.isShowView = true;
  681. });
  682. },
  683. sum(arr) {
  684. var s = 0;
  685. for (var i=arr.length-1; i>=0; i--) {
  686. if(arr[i].count){
  687. s += Number(arr[i].count);
  688. }
  689. }
  690. return s;
  691. },
  692. //提交点赞、取消点赞;收藏、取消收藏
  693. submitFabulous(type, id, index) {
  694. if (!req.isLogins(true)) {
  695. return;
  696. }
  697. var dataP = {};
  698. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  699. dataP.momentsId = id;
  700. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  701. if (type == 2) {
  702. //动态点赞
  703. if (this.pageList[index].isPraise == 1) {
  704. //已赞
  705. this.pageList[index].isPraise = 0;
  706. this.pageList[index].count.fabulousCount--;
  707. } else {
  708. this.pageList[index].isPraise = 1;
  709. this.pageList[index].count.fabulousCount++;
  710. }
  711. }
  712. });
  713. },
  714. //提交投票
  715. submitPoll(item, pIndex, pollIndex) {
  716. if(item.qyPoll.isEnd) return false;
  717. var dataP = {};
  718. // dataP.id = item.id;
  719. dataP.pollId = item.qyPoll.id;
  720. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  721. dataP.pollOptionCode = pollObjList[pollIndex].code;
  722. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  723. req.msg('投票成功');
  724. //图片完之后要将该投票的对象返回,便于做渲染%
  725. this.pageList[pIndex].qyPoll = data;
  726. });
  727. },
  728. videoPlay(index){
  729. var that = this;
  730. var curIdx = index;
  731. this.pageList[index].isControls = true
  732. this.pageList[index].isShowPlayBtn = false
  733. // 有播放时先将prev暂停,再播放当前点击的current
  734. if (that.videoCurrent != null) {
  735. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  736. if (that.videoCurrent != curIdx) {
  737. this.pageList[that.videoCurrent].isControls = false
  738. this.pageList[that.videoCurrent].isShowPlayBtn = true
  739. videoContextPrev.stop()
  740. }
  741. that.videoCurrent = curIdx
  742. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  743. videoContextCurrent.play()
  744. } else {
  745. // 没有播放时播放视频
  746. that.videoCurrent = curIdx
  747. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  748. videoContext.play()
  749. }
  750. },
  751. videoPause(index){
  752. this.pageList[index].isControls = false
  753. this.pageList[index].isShowPlayBtn = true
  754. },
  755. videoEnded(index){
  756. this.pageList[index].isControls = false
  757. this.pageList[index].isShowPlayBtn = true
  758. },
  759. jumpUrlDetail(item) {
  760. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  761. },
  762. toUserHomePage(userId) {
  763. this.jumpUrl('/topics/home/home?userId=' + userId);
  764. },
  765. },
  766. mounted() {
  767. const systemInfo = uni.getSystemInfoSync();
  768. // px转换到rpx的比例
  769. let pxToRpxScale = 750 / systemInfo.windowWidth;
  770. let systems = {
  771. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  772. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  773. };
  774. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  775. this.systems = systems;
  776. },
  777. onPageScroll: function(e) {
  778. if (e.scrollTop > this.systems.barHeight) {
  779. this.isTop = 1;
  780. } else {
  781. this.isTop = 0;
  782. }
  783. }
  784. };
  785. </script>
  786. <style>
  787. @import './index.css';
  788. </style>