index.vue 29 KB

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