index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. <template>
  2. <view>
  3. <view class="top-fixed" :style="'height:' + systems.barHeight + 'rpx;'">
  4. <navigator @click="toBack" hover-class="none" class="back ddflex" :style="'top:' + systems.ktxStatusHeight + 'rpx;height:' + systems.navigationHeight + 'rpx;'">
  5. <image :src="picUrlss+'lezhan/back_black.png'"></image>
  6. </navigator>
  7. </view>
  8. <view class="top" :style="'padding-top:' + systems.barHeight + 'rpx;'">
  9. <view class="info ddflex">
  10. <image :src="teamInfo.url?teamInfo.url:picUrlss+'office_images/team_default.png'" mode="aspectFill" class="team-pic"></image>
  11. <view class="fflex" style="overflow: visible;">
  12. <view class="ddflex">
  13. <view class="title fflex">{{teamInfo.title}}</view>
  14. <button v-if="userInfo&&teamInfo.isJoin == 1" open-type="share" class="ddflex" style="font-size: 24rpx;color: #999999;margin-top: -30rpx;">
  15. <image style="width: 30rpx;height: 30rpx;margin-right: 8rpx;margin-left: 8rpx;" src="../static/images/fx.png"></image>
  16. 邀请
  17. </button>
  18. </view>
  19. <view class="sta ddflex">
  20. <view class="ddflex fflex">
  21. <view><text>{{teamInfo.memberNum?teamInfo.memberNum:0}}</text>成员</view>
  22. <view class="sta-line">|</view>
  23. <view><text>{{totalNum}}</text>帖子</view>
  24. </view>
  25. <view class="sta-datas">今日互动{{teamInfo.dayMomentsNum}}</view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="bri ddflex" @click="jumpUrl('/office/teamInfo/index?id='+teamInfo.id)">
  30. <view class="fflex tovers">{{teamInfo.description}}</view>
  31. <image src="../../static/pages/images/more.png" class="rico"></image>
  32. </view>
  33. <view v-if="teamInfo.relationMatch" class="ddflex"
  34. style="padding: 18rpx 0;margin-top: 20rpx;color: #999;font-size: 24rpx;"
  35. @click="jumpUrl('/match/activityDetail/activityDetail?id='+teamInfo.relationMatch.id)">
  36. 来自
  37. <view class="fflex tover" style="color: var(--main);">{{teamInfo.relationMatch.title}}</view>
  38. </view>
  39. <view class="leader ddflex" v-if="teamInfo.teamUserDTO">
  40. <text>队长</text>
  41. <image :src="teamInfo.teamUserDTO.avatar?teamInfo.teamUserDTO.avatar:'/static/images/def_head.png'" mode="aspectFill"></image>
  42. <view>{{teamInfo.teamUserDTO.realName?teamInfo.teamUserDTO.realName:teamInfo.teamUserDTO.nickName}}</view>
  43. </view>
  44. <view class="join ddflex" v-if="userInfo&&teamInfo.isJoin != 1">
  45. <view class="fflex">
  46. <view>hi,{{userInfo.name?userInfo.name:userInfo.nickName}}~</view>
  47. <text>欢迎关注{{teamInfo.title}}</text>
  48. </view>
  49. <view class="join-btn" @click="joinTeam">加入</view>
  50. </view>
  51. </view>
  52. <view class="ddflex qunCode" v-if="teamInfo.groupCode">
  53. <view>
  54. <view>加入【{{teamInfo.title}}群】</view>
  55. <view style="margin: 10rpx 0;">一起探讨更多保险知识</view>
  56. <image style="width: 27rpx;height: 17rpx;" src="/office/static/images/jt.png"></image>
  57. </view>
  58. <image class="qunCode-pic" :src="teamInfo.groupCode" show-menu-by-longpress="true" @click="previewImgss([teamInfo.groupCode],0)"></image>
  59. </view>
  60. <view class="tab ddflex">
  61. <!-- <view :class="'li ' + (pType == 1 ? 'active' : '')" @click="swiPType(1)">综合</view> -->
  62. <view :class="'li ' + (pType == 12 ? 'active' : '')" @click="swiPType(12)">最新</view>
  63. <view :class="'li ' + (pType == 5 ? 'active' : '')" @click="swiPType(5)">热门</view>
  64. </view>
  65. <view class="cons-b">
  66. <view class="list" v-if="officeList && officeList.length > 0">
  67. <view class="li" v-for="(item, index) in officeList" :key="index">
  68. <view class="user ddflex" @click="jumpUrl('/topics/home/home?userId=' + item.userDTO.id)">
  69. <image :src="item.userDTO.avatar" mode="aspectFill" class="userimg"></image>
  70. <view class="fflex">
  71. <view class="namea ddflex">
  72. <view class="name fflex ddflex">{{ item.userDTO.nickName }}
  73. <!-- <image src="../../static/images/vip_tag.png" class="vip-tag" v-if="item.userDTO.levelGrade > 0"></image> -->
  74. <image v-if="item.userDTO.isOpenWeRunData" style="width:15rpx;height:20rpx;margin-left: 10rpx;" src="../../static/images/yd.png"></image>
  75. </view>
  76. <view class="time">{{ item.time }}</view>
  77. </view>
  78. <view class="area" v-if="item.userDTO.cityName">{{ item.userDTO.provinceName }} {{ item.userDTO.cityName }}</view>
  79. </view>
  80. </view>
  81. <view class="des" @click="jumpUrlDetail(item)"><rich-text :nodes="item.content"></rich-text></view>
  82. <!-- //如果有投票,就不显示图片 -->
  83. <block v-if="!item.qyPoll">
  84. <view class="video" v-if="item.isHaveVideo && config.open_community_video == 1">
  85. <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>
  86. <view class="video-play ddflex" @click="videoPlay(index)" v-if="item.isShowPlayBtn"><image src="../../static/images/play.png"></image></view>
  87. </view>
  88. <view class="imgbox ddflex" @click="jumpUrlDetail(item)" v-if="!item.isHaveVideo"><!-- @click="previewImgss(item.url, idx)" -->
  89. <block v-if="item.url&&item.url.length>0">
  90. <image mode="aspectFill" v-for="(it, idx) in item.url" :src="it" :key="idx"></image>
  91. </block>
  92. </view>
  93. </block>
  94. <!-- 话题 -->
  95. <view class="ddflex" v-if="item.qyDialogu">
  96. <view class="topic ddflex" @click="jumpUrl('/topics/detail/detail?topicId=' + item.qyDialogu.id)">
  97. <image src="../../static/images/topic.png"></image>
  98. {{ item.qyDialogu.title }}
  99. </view>
  100. </view>
  101. <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>
  102. <!-- 投票 -->
  103. <view :class="'vote-box' + (item.qyPoll.isEnd ? ' ends' : '')" v-if="item.qyPoll">
  104. <view class="vote-tit">{{ item.qyPoll.title }}</view>
  105. <block v-if="item.qyPoll.isVote == 1">
  106. <view class="vote-list end" @click="jumpUrlDetail(item)">
  107. <view :class="'lis ddflex ' + (itpy.isVote == 1 ? 'active' : '')" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex">
  108. <view class="percent" :style="'width:' + parseFloat(itpy.proportion) + '%;'"></view>
  109. <view class="fflex">{{ itpy.name }}</view>
  110. <view>{{ parseFloat(itpy.proportion) + '%' }}</view>
  111. </view>
  112. </view>
  113. </block>
  114. <block v-else>
  115. <view class="vote-list">
  116. <view class="lis" v-for="(itpy, idex) in JSON.parse(item.qyPoll.optionJson)" :key="idex" @click="submitPoll(item, index, idex)">
  117. {{ itpy.name }}
  118. </view>
  119. </view>
  120. </block>
  121. <view class="vote-can" v-if="item.qyPoll.isEnd"><text>{{item.qyPoll.voteCount}}人参与</text>投票已结束</view>
  122. </view>
  123. <block v-if="item.type==10||item.type==11">
  124. <view v-if="item.type==10" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/exercise/record/record?userId=' + item.userId)">
  125. <view>
  126. <view class="step-date">{{item.wxRun.step}}</view>
  127. <view class="step-label">步数</view>
  128. </view>
  129. <view>
  130. <view class="step-date">{{item.wxRun.index}}</view>
  131. <view class="step-label" style="text-align: right;">名次</view>
  132. </view>
  133. </view>
  134. <view v-if="item.type==11" class="ddflex step-box" style="justify-content: space-between;" @click="jumpUrl('/match/activityDetail/activityDetail?id=' + item.matchContent.id)">
  135. <image class="step-pic" :src="item.matchContent.pic" mode="aspectFill"></image>
  136. <view class="fflex">
  137. <view class="step-title tovers">{{item.matchContent.title}}</view>
  138. <view class="ddflex" style="justify-content: space-between;margin-top: 10rpx;">
  139. <view class="step-price">{{item.matchContent.endTime}}</view>
  140. <view class="step-btn">查看</view>
  141. </view>
  142. </view>
  143. </view>
  144. </block>
  145. <view v-if="item.userGroupId" class="ddflex step-box" style="padding: 25rpx 21rpx;" @click="jumpUrl('/office/team/index?id=' + item.userGroupId)">
  146. <image style="width: 24rpx;height: 24rpx;margin-right: 13rpx;" src="../../static/images/link.png"></image>
  147. <view style="font-weight: 500;color: #999999;">Team:</view>
  148. <view>{{item.userGroupTitle}}</view>
  149. </view>
  150. <block v-else>
  151. <view class="product" v-if="item.products && item.products.length > 0">
  152. <view scroll-x="true" class="pro-view pro-view1" v-if="item.products.length == 1">
  153. <view class="lis" v-for="(it, idx) in item.products" :key="idx" @click="toProductDetail(it)">
  154. <view class="ddflex">
  155. <image :src="it.pic" mode="aspectFill" class="pic"></image>
  156. <view class="fflex">
  157. <view class="title tover">{{ it.title }}</view>
  158. <view class="opts ddflex">
  159. <view class="money"><text>¥</text>{{ it.salePrice }}</view>
  160. <view class="pro-btn"><image src="../../static/pages/images/n_cart.png"></image></view>
  161. </view>
  162. </view>
  163. </view>
  164. </view>
  165. </view>
  166. <scroll-view scroll-x="true" class="pro-view" v-else>
  167. <view class="lis" v-for="(it, idx) in item.products" :key="idx" @click="toProductDetail(it)">
  168. <view class="ddflex">
  169. <image :src="it.pic" mode="aspectFill" class="pic"></image>
  170. <view class="fflex">
  171. <view class="title tover">{{ it.title }}</view>
  172. <view class="opts ddflex">
  173. <view class="money"><text>¥</text>{{ it.salePrice }}</view>
  174. <view class="pro-btn"><image src="../../static/pages/images/n_cart.png"></image></view>
  175. </view>
  176. </view>
  177. </view>
  178. </view>
  179. </scroll-view>
  180. </view>
  181. </block>
  182. <view class="opt ddflex" v-if="!item.source">
  183. <view class="fflex" @click="jumpUrlDetail(item)">{{fomatNumbers(item.count.browseCount)}}次浏览</view>
  184. <view class="ddflex" @click="submitFabulous(2, item.id, index)">
  185. <image :src="'../../static/images/' + (item.isPraise == 1 ? 'like_h' : 'like') + '.png'"></image>
  186. {{fomatNumbers(item.count.fabulousCount)}}
  187. </view>
  188. <view class="ddflex" @click="jumpUrlDetail(item)" v-if="config.is_show_create_btn == 1">
  189. <image src="../../static/images/comment.png"></image>
  190. {{fomatNumbers(item.count.commentCount)}}
  191. </view>
  192. <button open-type="share" hover-class="none" class="opt-share ddflex">
  193. <image src="../../static/images/share.png"></image>
  194. 分享
  195. </button>
  196. </view>
  197. </view>
  198. </view>
  199. <view class="nodata" v-else>
  200. <image :src="picUrlss + 'empty_jl.png'"></image>
  201. <text>暂无动态</text>
  202. </view>
  203. </view>
  204. <view class="create" @click="createJump('/office/news/news?newsType=1&userGroupId='+opt.id)" v-if="config.is_show_create_btn == 1&&userInfo&&teamInfo.isJoin == 1"><image style="display: block;" src="../../static/images/create.png"></image>发布</view>
  205. </view>
  206. </template>
  207. <script>
  208. const app = getApp();
  209. const api = require('../../utils/api.js');
  210. const req = require('../../utils/request.js');
  211. const util = require('../../utils/util.js');
  212. export default {
  213. components: {
  214. },
  215. data() {
  216. return {
  217. systems: {},
  218. picUrlss: req.public.picUrls,
  219. opt: {},
  220. isRefresh: false,
  221. isShowbtn: false,
  222. isShowPage: false,
  223. isLoad: true,
  224. form: {
  225. page: 1,
  226. limit: 10
  227. },
  228. pType: 12, //排序: 1综合, 2最新,3浏览最多,4评论最多,5热门
  229. officeList: [], //聊一聊
  230. config: {},
  231. videoCurrent: null,
  232. videoContext: '',
  233. teamInfo: {},
  234. userInfo: {},
  235. totalNum: 0,
  236. currentPoi: {},
  237. teamRank:[],
  238. myRank:{},
  239. isOpenWeRunData:false
  240. }
  241. },
  242. async onLoad(options) {
  243. this.opt = options;
  244. await req.silenceLogin(options.tjuid?options.tjuid:'', '');
  245. this.getTeamInfo();
  246. this.getOfficeList();
  247. this.userInfo = req.getStorage('userInfo');
  248. this.isOpenWeRunData = req.getStorage('isOpenWeRunData')
  249. this.config =req.getStorage('configRes')? JSON.parse(req.getStorage('configRes')):''
  250. },
  251. onShow() {
  252. if(this.isRefresh){
  253. this.form.page = 1;
  254. this.isLoad = true;
  255. this.getOfficeList();
  256. this.isRefresh = false;
  257. }
  258. this.userInfo = req.getStorage('userInfo');
  259. this.isOpenWeRunData = req.getStorage('isOpenWeRunData')
  260. this.config =req.getStorage('configRes')? JSON.parse(req.getStorage('configRes')):''
  261. },
  262. onHide() {
  263. this.isShowbtn = false;
  264. },
  265. onReachBottom() {
  266. this.form.page++;
  267. this.getOfficeList();
  268. },
  269. onShareAppMessage(){
  270. let title = req.getStorage('userInfo').nickName+'邀请您加入'+this.teamInfo.title
  271. return {
  272. title: title,
  273. imageUrl:this.teamInfo.url?this.teamInfo.url:this.picUrlss+'office_images/team_default.png',
  274. path: '/office/team/index?tjuid=' +req.getStorage('userInfo').id+'&id='+this.opt.id
  275. };
  276. },
  277. methods: {
  278. toBack(){
  279. let pages = getCurrentPages();
  280. let prevPage = pages[pages.length - 2];
  281. if(prevPage){
  282. uni.navigateBack()
  283. }else{
  284. uni.switchTab({
  285. url:"/pages/index/index"
  286. })
  287. }
  288. },
  289. getTeamInfo(){
  290. req.getRequest(api.user_team_info+this.opt.id,{},data=>{
  291. this.teamInfo = data;
  292. })
  293. },
  294. joinTeam(item,index){
  295. if(this.teamInfo.relationMatch){
  296. uni.navigateTo({
  297. url: '/match/activityDetail/activityDetail?id='+this.teamInfo.relationMatch.id
  298. })
  299. return false;
  300. }
  301. req.postRequest(api.user_team_follow,{userGroupId: this.teamInfo.id},data=>{
  302. req.msg('加入团队成功');
  303. this.teamInfo.isJoin=1
  304. })
  305. },
  306. //聊一聊切换排序类型
  307. swiPType(type) {
  308. this.isLoad = true;
  309. this.form.page = 1;
  310. this.pType = type;
  311. this.getOfficeList();
  312. },
  313. //预览图片
  314. previewImgss(picUrls, index) {
  315. //预览合同图片
  316. var src = picUrls[index];
  317. let imgs = picUrls;
  318. uni.previewImage({
  319. current: src, // 当前显示图片的http链接
  320. urls: imgs
  321. });
  322. },
  323. showBtn() {
  324. if (!req.isLogins(true)) {
  325. return;
  326. }
  327. this.isShowbtn = true;
  328. },
  329. hideBtn() {
  330. this.isShowbtn = false;
  331. },
  332. removeHtml(content) {
  333. return util.removeHtml(content);
  334. },
  335. createJump(url) {
  336. if (!req.isLogins(true)) {
  337. return;
  338. }
  339. this.jumpUrl(url);
  340. },
  341. jumpUrl(url){
  342. uni.navigateTo({
  343. url: url
  344. })
  345. },
  346. jumpUrlPoi(item,url){
  347. this.currentPoi = item;
  348. uni.navigateTo({
  349. url: url
  350. })
  351. },
  352. jumpToPractice(item,url){
  353. let checkCategory = {
  354. id: item.question.cateId,
  355. name: item.question.cateName
  356. }
  357. req.setStorage('checkCategory',checkCategory)
  358. this.jumpUrl(url);
  359. },
  360. jumpUrlDetail(item) {
  361. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  362. },
  363. toProductDetail(item) {
  364. this.jumpUrl('/product/detail/detail?id=' + item.id);
  365. },
  366. getHotTopic() {
  367. var dataPram = {
  368. page: 1,
  369. limit: 4,
  370. attr: 2
  371. };
  372. req.getRequest('/api/v3/dialogue/list', dataPram, data => {
  373. this.hotTopicList = data;
  374. });
  375. },
  376. getHotPoll() {
  377. var dataPram = {
  378. page: 1,
  379. limit: 4,
  380. attr: 2,
  381. attrType: 0
  382. };
  383. req.getRequest('/api/v3/poll/pollList', dataPram, data => {
  384. this.hotPollList = data;
  385. });
  386. },
  387. getCategory(){
  388. req.getRequest('/api/v3/unified/tree/list',{type: 1},data=>{
  389. this.category = data;
  390. })
  391. },
  392. swiTree(item,index){
  393. if(this.cateIndex == index) return false;
  394. this.cateIndex = index;
  395. this.pType = -1;
  396. this.treeId = item.id;
  397. this.form.page = 1;
  398. this.isLoad = true;
  399. this.getOfficeList()
  400. },
  401. sum(arr) {
  402. var s = 0;
  403. for (var i=arr.length-1; i>=0; i--) {
  404. if(arr[i].count){
  405. s += Number(arr[i].count);
  406. }
  407. }
  408. return s;
  409. },
  410. fomatNumbers(num){
  411. return util.formatNumbers(num)
  412. },
  413. getOfficeList() {
  414. let that = this;
  415. var pramData = {};
  416. pramData.page = this.form.page;
  417. pramData.limit = this.form.limit;
  418. // pramData.type = 4;
  419. if (this.pType == 5) {
  420. //热门
  421. pramData.isEssence = 2;
  422. pramData.orderType = 1;
  423. } else {
  424. pramData.orderType = this.pType;
  425. }
  426. if(this.treeId) {
  427. pramData.treeId = this.treeId
  428. pramData.orderType = 1
  429. }else delete pramData.treeId
  430. pramData.userGroupId = this.opt.id;
  431. if (!this.isLoad) return false;
  432. this.isLoad = false;
  433. req.getRequest('/api/v3/moments/page', pramData, data => {
  434. if(data.list&&data.list.length > 0){
  435. data.list.map(it=>{
  436. if(it.qyPoll && it.qyPoll.isEnd){
  437. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  438. }
  439. if(it.url){
  440. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  441. if(h.indexOf('mp4')<0&&h.indexOf('MP4')<0){
  442. it.url = it.url.split(',');
  443. }else{
  444. it.isHaveVideo = true
  445. it.isControls = false
  446. it.isShowPlayBtn = true
  447. }
  448. }
  449. 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>'
  450. return it;
  451. })
  452. }
  453. if (data.list && data.list.length >= 10) {
  454. this.isLoad = true;
  455. }
  456. if (this.form.page > 1) {
  457. data.list = this.officeList.concat(data.list);
  458. } else {
  459. this.officeList = [];
  460. }
  461. this.officeList = data.list;
  462. if(this.pType == 12) this.totalNum = data.total;
  463. this.isShowPage = true;
  464. });
  465. },
  466. //提交点赞、取消点赞;收藏、取消收藏
  467. submitFabulous(type, id, index) {
  468. if (!req.isLogins(true)) {
  469. return;
  470. }
  471. var dataP = {};
  472. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  473. dataP.momentsId = id;
  474. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  475. if (type == 2) {
  476. //动态点赞
  477. if (this.officeList[index].isPraise == 1) {
  478. //已赞
  479. this.officeList[index].isPraise = 0;
  480. this.officeList[index].count.fabulousCount--;
  481. } else {
  482. this.officeList[index].isPraise = 1;
  483. this.officeList[index].count.fabulousCount++;
  484. }
  485. }
  486. });
  487. },
  488. //提交投票
  489. submitPoll(item, pIndex, pollIndex) {
  490. if(item.qyPoll.isEnd){
  491. this.jumpUrlDetail(item)
  492. return false;
  493. }
  494. var dataP = {};
  495. // dataP.id = item.id;
  496. dataP.pollId = item.qyPoll.id;
  497. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  498. dataP.pollOptionCode = pollObjList[pollIndex].code;
  499. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  500. req.msg('投票成功');
  501. //图片完之后要将该投票的对象返回,便于做渲染%
  502. this.officeList[pIndex].qyPoll = data;
  503. });
  504. },
  505. goTop: function(e) {
  506. // 一键回到顶部
  507. if (uni.pageScrollTo) {
  508. uni.pageScrollTo({
  509. scrollTop: 0
  510. });
  511. } else {
  512. uni.showModal({
  513. title: '提示',
  514. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  515. });
  516. }
  517. },
  518. videoPlay(index){
  519. var that = this;
  520. var curIdx = index;
  521. this.officeList[index].isControls = true
  522. this.officeList[index].isShowPlayBtn = false
  523. // 有播放时先将prev暂停,再播放当前点击的current
  524. if (that.videoCurrent != null) {
  525. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  526. if (that.videoCurrent != curIdx) {
  527. this.officeList[that.videoCurrent].isControls = false
  528. this.officeList[that.videoCurrent].isShowPlayBtn = true
  529. videoContextPrev.stop()
  530. }
  531. that.videoCurrent = curIdx
  532. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  533. videoContextCurrent.play()
  534. } else {
  535. // 没有播放时播放视频
  536. that.videoCurrent = curIdx
  537. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  538. videoContext.play()
  539. }
  540. },
  541. videoPause(index){
  542. this.officeList[index].isControls = false
  543. this.officeList[index].isShowPlayBtn = true
  544. },
  545. videoEnded(index){
  546. this.officeList[index].isControls = false
  547. this.officeList[index].isShowPlayBtn = true
  548. }
  549. },
  550. created() {
  551. const systemInfo = uni.getSystemInfoSync();
  552. // px转换到rpx的比例
  553. let pxToRpxScale = 750 / systemInfo.windowWidth;
  554. let systems = {
  555. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  556. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  557. };
  558. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  559. this.systems = systems;
  560. },
  561. }
  562. </script>
  563. <style>
  564. @import "./index.css";
  565. </style>