index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <template>
  2. <view>
  3. <view class="top-fixed" :style="'height:' + systems.barHeight + 'rpx;'">
  4. <navigator open-type="navigateBack" 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 + '?x-oss-process=style/w375'" 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 + '?x-oss-process=style/w375'" 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. getTeamInfo(){
  279. req.getRequest(api.user_team_info+this.opt.id,{},data=>{
  280. this.teamInfo = data;
  281. })
  282. },
  283. joinTeam(item,index){
  284. if(this.teamInfo.relationMatch){
  285. uni.navigateTo({
  286. url: '/match/activityDetail/activityDetail?id='+this.teamInfo.relationMatch.id
  287. })
  288. return false;
  289. }
  290. req.postRequest(api.user_team_follow,{userGroupId: this.teamInfo.id},data=>{
  291. req.msg('加入团队成功');
  292. this.teamInfo.isJoin=1
  293. })
  294. },
  295. //聊一聊切换排序类型
  296. swiPType(type) {
  297. this.isLoad = true;
  298. this.form.page = 1;
  299. this.pType = type;
  300. this.getOfficeList();
  301. },
  302. //预览图片
  303. previewImgss(picUrls, index) {
  304. //预览合同图片
  305. var src = picUrls[index];
  306. let imgs = picUrls;
  307. uni.previewImage({
  308. current: src, // 当前显示图片的http链接
  309. urls: imgs
  310. });
  311. },
  312. showBtn() {
  313. if (!req.isLogins(true)) {
  314. return;
  315. }
  316. this.isShowbtn = true;
  317. },
  318. hideBtn() {
  319. this.isShowbtn = false;
  320. },
  321. removeHtml(content) {
  322. return util.removeHtml(content);
  323. },
  324. createJump(url) {
  325. if (!req.isLogins(true)) {
  326. return;
  327. }
  328. this.jumpUrl(url);
  329. },
  330. jumpUrl(url){
  331. uni.navigateTo({
  332. url: url
  333. })
  334. },
  335. jumpUrlPoi(item,url){
  336. this.currentPoi = item;
  337. uni.navigateTo({
  338. url: url
  339. })
  340. },
  341. jumpToPractice(item,url){
  342. let checkCategory = {
  343. id: item.question.cateId,
  344. name: item.question.cateName
  345. }
  346. req.setStorage('checkCategory',checkCategory)
  347. this.jumpUrl(url);
  348. },
  349. jumpUrlDetail(item) {
  350. this.jumpUrl('/office/detail/detail?contentId=' + item.id);
  351. },
  352. toProductDetail(item) {
  353. this.jumpUrl('/product/detail/detail?id=' + item.id);
  354. },
  355. getHotTopic() {
  356. var dataPram = {
  357. page: 1,
  358. limit: 4,
  359. attr: 2
  360. };
  361. req.getRequest('/api/v3/dialogue/list', dataPram, data => {
  362. this.hotTopicList = data;
  363. });
  364. },
  365. getHotPoll() {
  366. var dataPram = {
  367. page: 1,
  368. limit: 4,
  369. attr: 2,
  370. attrType: 0
  371. };
  372. req.getRequest('/api/v3/poll/pollList', dataPram, data => {
  373. this.hotPollList = data;
  374. });
  375. },
  376. getCategory(){
  377. req.getRequest('/api/v3/unified/tree/list',{type: 1},data=>{
  378. this.category = data;
  379. })
  380. },
  381. swiTree(item,index){
  382. if(this.cateIndex == index) return false;
  383. this.cateIndex = index;
  384. this.pType = -1;
  385. this.treeId = item.id;
  386. this.form.page = 1;
  387. this.isLoad = true;
  388. this.getOfficeList()
  389. },
  390. sum(arr) {
  391. var s = 0;
  392. for (var i=arr.length-1; i>=0; i--) {
  393. if(arr[i].count){
  394. s += Number(arr[i].count);
  395. }
  396. }
  397. return s;
  398. },
  399. fomatNumbers(num){
  400. return util.formatNumbers(num)
  401. },
  402. getOfficeList() {
  403. let that = this;
  404. var pramData = {};
  405. pramData.page = this.form.page;
  406. pramData.limit = this.form.limit;
  407. // pramData.type = 4;
  408. if (this.pType == 5) {
  409. //热门
  410. pramData.isEssence = 2;
  411. pramData.orderType = 1;
  412. } else {
  413. pramData.orderType = this.pType;
  414. }
  415. if(this.treeId) {
  416. pramData.treeId = this.treeId
  417. pramData.orderType = 1
  418. }else delete pramData.treeId
  419. pramData.userGroupId = this.opt.id;
  420. if (!this.isLoad) return false;
  421. this.isLoad = false;
  422. req.getRequest('/api/v3/moments/page', pramData, data => {
  423. if(data.list&&data.list.length > 0){
  424. data.list.map(it=>{
  425. if(it.qyPoll && it.qyPoll.isEnd){
  426. it.qyPoll.voteCount = that.sum(JSON.parse(it.qyPoll.optionJson))
  427. }
  428. if(it.url){
  429. let h = it.url.substring(it.url.lastIndexOf('.') + 1)
  430. if(h.indexOf('mp4')<0&&h.indexOf('MP4')<0){
  431. it.url = it.url.split(',');
  432. }else{
  433. it.isHaveVideo = true
  434. it.isControls = false
  435. it.isShowPlayBtn = true
  436. }
  437. }
  438. 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>'
  439. return it;
  440. })
  441. }
  442. if (data.list && data.list.length >= 10) {
  443. this.isLoad = true;
  444. }
  445. if (this.form.page > 1) {
  446. data.list = this.officeList.concat(data.list);
  447. } else {
  448. this.officeList = [];
  449. }
  450. this.officeList = data.list;
  451. if(this.pType == 12) this.totalNum = data.total;
  452. this.isShowPage = true;
  453. });
  454. },
  455. //提交点赞、取消点赞;收藏、取消收藏
  456. submitFabulous(type, id, index) {
  457. if (!req.isLogins(true)) {
  458. return;
  459. }
  460. var dataP = {};
  461. dataP.type = type; //1,观看 ,2点赞,3评论,4分享,5收藏
  462. dataP.momentsId = id;
  463. req.postRequestLoding('/api/v3/fabulous/save', dataP, data => {
  464. if (type == 2) {
  465. //动态点赞
  466. if (this.officeList[index].isPraise == 1) {
  467. //已赞
  468. this.officeList[index].isPraise = 0;
  469. this.officeList[index].count.fabulousCount--;
  470. } else {
  471. this.officeList[index].isPraise = 1;
  472. this.officeList[index].count.fabulousCount++;
  473. }
  474. }
  475. });
  476. },
  477. //提交投票
  478. submitPoll(item, pIndex, pollIndex) {
  479. if(item.qyPoll.isEnd){
  480. this.jumpUrlDetail(item)
  481. return false;
  482. }
  483. var dataP = {};
  484. // dataP.id = item.id;
  485. dataP.pollId = item.qyPoll.id;
  486. var pollObjList = JSON.parse(item.qyPoll.optionJson);
  487. dataP.pollOptionCode = pollObjList[pollIndex].code;
  488. req.postRequest('/api/v3/poll/saveDetails', dataP, data => {
  489. req.msg('投票成功');
  490. //图片完之后要将该投票的对象返回,便于做渲染%
  491. this.officeList[pIndex].qyPoll = data;
  492. });
  493. },
  494. goTop: function(e) {
  495. // 一键回到顶部
  496. if (uni.pageScrollTo) {
  497. uni.pageScrollTo({
  498. scrollTop: 0
  499. });
  500. } else {
  501. uni.showModal({
  502. title: '提示',
  503. content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
  504. });
  505. }
  506. },
  507. videoPlay(index){
  508. var that = this;
  509. var curIdx = index;
  510. this.officeList[index].isControls = true
  511. this.officeList[index].isShowPlayBtn = false
  512. // 有播放时先将prev暂停,再播放当前点击的current
  513. if (that.videoCurrent != null) {
  514. var videoContextPrev = uni.createVideoContext('myVideo' + that.videoCurrent)
  515. if (that.videoCurrent != curIdx) {
  516. this.officeList[that.videoCurrent].isControls = false
  517. this.officeList[that.videoCurrent].isShowPlayBtn = true
  518. videoContextPrev.stop()
  519. }
  520. that.videoCurrent = curIdx
  521. var videoContextCurrent = uni.createVideoContext('myVideo' + curIdx)
  522. videoContextCurrent.play()
  523. } else {
  524. // 没有播放时播放视频
  525. that.videoCurrent = curIdx
  526. var videoContext = uni.createVideoContext('myVideo' + curIdx) // 对应的视频id
  527. videoContext.play()
  528. }
  529. },
  530. videoPause(index){
  531. this.officeList[index].isControls = false
  532. this.officeList[index].isShowPlayBtn = true
  533. },
  534. videoEnded(index){
  535. this.officeList[index].isControls = false
  536. this.officeList[index].isShowPlayBtn = true
  537. }
  538. },
  539. created() {
  540. const systemInfo = uni.getSystemInfoSync();
  541. // px转换到rpx的比例
  542. let pxToRpxScale = 750 / systemInfo.windowWidth;
  543. let systems = {
  544. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  545. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  546. };
  547. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  548. this.systems = systems;
  549. },
  550. }
  551. </script>
  552. <style>
  553. @import "./index.css";
  554. </style>