index-shareRoute.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. <template>
  2. <div
  3. class="creation"
  4. :style="{
  5. '--heightA': state.heightA + 'px',
  6. '--navBarHeight': navBarHeight + 'px',
  7. '--creationHeight': creationHeight ? creationHeight + 'px' : '100vh'
  8. }"
  9. >
  10. <div class="creationBg"></div>
  11. <van-sticky>
  12. <van-nav-bar
  13. v-if="browser().isApp"
  14. class="nav"
  15. :class="{ isScreenScroll: isScreenScroll }"
  16. :fixed="false"
  17. title="作品详情"
  18. left-arrow
  19. @click-left="goBack"
  20. />
  21. <div v-else class="logoDownload" :class="{ isShareScreenScroll: isScreenScroll }">
  22. <img :src="isScreenScroll ? require('./img/logo1.png') : require('./img/logo.png')" class="logoImg" />
  23. <div class="logTit" @click="handlerDownLoad">下载App</div>
  24. </div>
  25. </van-sticky>
  26. <div v-if="isEmpty" class="isEmpty">
  27. <MEmpty msg="作品已删除" />
  28. </div>
  29. <template v-else>
  30. <div class="singerBox">
  31. <div class="musicSheetName">
  32. <van-notice-bar :text="state.musicDetail.musicSheetName" background="none" />
  33. </div>
  34. <div class="singerName">演奏:{{ state.musicDetail.username }}</div>
  35. </div>
  36. <van-sticky :offset-top="44 + navBarHeight" :z-index="200">
  37. <div class="playBox" ref="playBoxDom">
  38. <div
  39. :class="[
  40. 'playSection',
  41. plyrState.mediaTimeShow && 'mediaTimeShow',
  42. isLandscapeScreen && 'isLandscapeScreen',
  43. state.playType === 'Video' && 'videoType'
  44. ]"
  45. id="playMediaSection"
  46. @click="handlerClickPlay"
  47. >
  48. <!-- 横屏 -->
  49. <div v-if="isLandscapeScreen" class="backBox">
  50. <img class="backImg" :src="require('./img/back.png')" @click="handlerBack" />
  51. <div class="musicDetail">
  52. <div class="musicSheetName">
  53. <van-notice-bar :text="state.musicDetail.musicSheetName" background="none" />
  54. </div>
  55. <div class="username">演奏:{{ state.musicDetail.username }}</div>
  56. </div>
  57. </div>
  58. <!-- audio -->
  59. <div class="audioBox" v-if="state.playType === 'Audio'">
  60. <canvas class="audioVisualizer" id="audioVisualizer"></canvas>
  61. <audio
  62. crossorigin="anonymous"
  63. id="audioMediaSrc"
  64. :src="state.musicDetail.videoUrl"
  65. controls="false"
  66. preload="metadata"
  67. playsinline
  68. webkit-playsinline
  69. />
  70. <img src="./img/ty.png" class="tyBg" />
  71. <div class="audioBoxBg">
  72. <div :class="['audioPan', plyrState.playIngShow ? 'imgRotate' : '']">
  73. <van-image class="audioImg" :src="state.musicDetail.img || require('./img/music_bg.png')" />
  74. </div>
  75. <i class="audioPoint"></i>
  76. <i :class="['audioZhen', plyrState.playIngShow && 'active']"></i>
  77. </div>
  78. </div>
  79. <!-- video -->
  80. <video
  81. v-if="state.playType === 'Video'"
  82. id="videoMediaSrc"
  83. class="videoBox"
  84. :src="state.musicDetail.videoUrl"
  85. :data-poster="state.musicDetail.videoImg || require('./img/videoBg.png')"
  86. :poster="state.musicDetail.videoImg || require('./img/videoBg.png')"
  87. preload="metadata"
  88. playsinline
  89. webkit-playsinline
  90. x5-playsinline
  91. />
  92. <!-- 工具 -->
  93. <div :class="['playLarge', !plyrState.mediaTimeShow && plyrState.playIngShow && 'playIngShow']"></div>
  94. <div class="mediaTimeCon">
  95. <div class="mediaTime">
  96. <div>
  97. {{ getSecondRPM(plyrState.currentTime) }}
  98. </div>
  99. <div class="note">/</div>
  100. <div class="duration">
  101. {{ getSecondRPM(plyrState.duration) }}
  102. </div>
  103. </div>
  104. </div>
  105. <div class="landscapeScreen" @click="handlerLandscapeScreen"></div>
  106. <!-- 谱面 -->
  107. <div v-if="staffState.staffSrc" :class="['staffBoxCon', staffState.isShow && 'staffBoxShow']">
  108. <div
  109. class="staffBox"
  110. :style="{
  111. '--staffBoxHeight': staffState.height
  112. }"
  113. >
  114. <div class="mask"></div>
  115. <iframe ref="staffDom" class="staff" frameborder="0" :src="staffState.staffSrc"></iframe>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </van-sticky>
  121. <div class="musicSection musicShareSection">
  122. <div class="avatarInfoBox">
  123. <div class="avatar">
  124. <van-image class="userLogo" :src="state.musicDetail.avatar" />
  125. <div class="infoCon">
  126. <div class="info">
  127. <span class="userName">{{ state.musicDetail.username }}</span>
  128. <img :src="require('./img/icon-member.png')" v-if="state.musicDetail.vipFlag" class="iconMember" />
  129. </div>
  130. <div class="sub">
  131. {{
  132. (state.musicDetail.subjectName || "") + " " + (state.musicDetail.currentGradeNum ? getGradeCh(state.musicDetail.currentGradeNum - 1) : "")
  133. }}
  134. </div>
  135. </div>
  136. </div>
  137. <div class="linkes" @click="onStarChange">
  138. <img src="./img/icon-zan-active.png" v-if="state.musicDetail.starFlag" class="iconZan" />
  139. <img src="./img/icon-zan.png" v-else class="iconZan" />
  140. <span>{{ state.musicDetail.likeNum }}</span>
  141. </div>
  142. </div>
  143. <textEllipsis class="textEllipsis" :text="state.musicDetail.desc || ''" />
  144. </div>
  145. <div class="likeSection likeShareSection">
  146. <div class="likeTitle">推荐作品</div>
  147. <template v-if="state.listState.dataShow">
  148. <van-list :finished="state.listState.finished" :finishedText="' '" :immediateCheck="false">
  149. <van-cell
  150. v-for="(item, index) in state.list"
  151. :key="index"
  152. :class="['likeShareItem', index === state.list.length - 1 && 'likeShareItemLast']"
  153. :border="false"
  154. @click="onDetail(item)"
  155. >
  156. <template #icon>
  157. <div class="audioImgBox">
  158. <img :src="require('./img/audio-pan.png')" class="audioPan" crossorigin="anonymous" />
  159. <img :src="item.img || require('./share-model/images/music-bg.png')" class="muploader" crossorigin="anonymous" />
  160. <img
  161. class="imgLabel"
  162. :src="
  163. item.videoUrl && item.videoUrl.lastIndexOf('mp4') !== -1
  164. ? require('./share-model/images/videoLabel.png')
  165. : require('./share-model/images/audioLabel.png')
  166. "
  167. />
  168. </div>
  169. </template>
  170. <template #title>
  171. <div class="userInfo">
  172. <div class="musicSheetName van-ellipsis">{{ item.musicSheetName }}</div>
  173. <div class="usernameCon">
  174. <div class="likeNum">
  175. <img :src="require('./img/icon-zan-active.png')" />
  176. <span>{{ item.likeNum }}</span>
  177. </div>
  178. <div class="username van-ellipsis">{{ item.username }}</div>
  179. </div>
  180. </div>
  181. </template>
  182. <template #default>
  183. <div class="time">
  184. <img :src="require('./img/play.png')" class="playImg" />
  185. </div>
  186. </template>
  187. </van-cell>
  188. </van-list>
  189. <div v-if="!state.listState.finished || state.params.page > 2" class="btnImg">
  190. <img @click="handleChangeList" @touchstart="() => {}" :src="require('./img/btn.png')" />
  191. </div>
  192. </template>
  193. <MEmpty class="mEmpty" v-else msg="暂无作品" style="margin-bottom: 0.5rem" />
  194. </div>
  195. <div class="upward shareUpward" v-show="!isScreenScroll">
  196. <img :src="require('./img/upward.png')" />
  197. </div>
  198. </template>
  199. <van-popup v-model="loginStatus" style="background: transparent; overflow: inherit">
  200. <LoginModel @close="() => (this.loginStatus = false)" @confirm="onConfirm" />
  201. </van-popup>
  202. <Loading v-if="!staffState.isShow"></Loading>
  203. <div
  204. v-if="wxStatus"
  205. class="wxpopup"
  206. @click="
  207. () => {
  208. wxStatus = false
  209. }
  210. "
  211. >
  212. <img src="./img/wx_bg.png" alt="" />
  213. </div>
  214. </div>
  215. </template>
  216. <script>
  217. import dayjs from "dayjs"
  218. import { browser, getSecondRPM, getGradeCh, validStudentUrl } from "@/common/common"
  219. import { postMessage } from "@/helpers/native-message"
  220. import { api_openUserMusicPage, api_userMusicStar, api_openUserMusicDetail } from "./api"
  221. import audioVisualDraw, { vaildMusicScoreUrl } from "./audioVisualDraw"
  222. import textEllipsis from "./textEllipsis"
  223. import Loading from "./loading"
  224. import "plyr/dist/plyr.css"
  225. import Plyr from "plyr"
  226. import MEmpty from "@/components/MEmpty"
  227. import LoginModel from "./login-model"
  228. export default {
  229. name: "creation",
  230. data() {
  231. return {
  232. id: this.$route.query.id,
  233. loginTag: false, // 是否登录标识
  234. loginStatus: false,
  235. isEmpty: false,
  236. wxStatus: false,
  237. state: {
  238. playType: "", // 播放类型
  239. musicDetail: {},
  240. isClick: false,
  241. list: [],
  242. listState: {
  243. dataShow: true, // 判断是否有数据
  244. loading: false,
  245. finished: false
  246. },
  247. params: {
  248. page: 1,
  249. rows: 4
  250. },
  251. _plrl: null,
  252. heightA: 0
  253. },
  254. plyrState: {
  255. duration: 0,
  256. currentTime: 0,
  257. mediaTimeShow: false,
  258. playIngShow: true
  259. },
  260. isLandscapeScreen: false,
  261. isScreenScroll: false,
  262. navBarHeight: 0,
  263. staffState: {
  264. staffSrc: "",
  265. isShow: false,
  266. height: "initial",
  267. speedRate: 1,
  268. musicRenderType: "staff",
  269. partIndex: 0
  270. },
  271. creationHeight: 0
  272. }
  273. },
  274. components: {
  275. textEllipsis,
  276. MEmpty,
  277. Loading,
  278. LoginModel
  279. },
  280. methods: {
  281. getGradeCh,
  282. getSecondRPM,
  283. browser,
  284. onDayjs(time) {
  285. return dayjs(time).format("YYYY-MM-DD HH:mm")
  286. },
  287. goBack() {
  288. if (browser().isApp) {
  289. this.setStatusBarTextColor(false)
  290. postMessage({ api: "setBarStatus", content: { status: 1, backButtonHidden: 0 } })
  291. postMessage({
  292. api: "back"
  293. })
  294. } else {
  295. this.$router.back()
  296. }
  297. },
  298. onDetail(item) {
  299. this.$router.push({
  300. path: "/shareCreation",
  301. query: {
  302. id: item.id
  303. }
  304. })
  305. },
  306. // 点赞
  307. async onStarChange() {
  308. try {
  309. await api_userMusicStar({
  310. userMusicId: this.id,
  311. star: !this.state.musicDetail.starFlag
  312. })
  313. this.state.musicDetail.starFlag = !this.state.musicDetail.starFlag
  314. if (this.state.musicDetail.starFlag) {
  315. this.state.musicDetail.likeNum += 1
  316. } else {
  317. this.state.musicDetail.likeNum -= 1
  318. }
  319. } catch (e) {
  320. //
  321. if (e.code === 403) {
  322. this.loginStatus = true
  323. }
  324. }
  325. },
  326. async onConfirm(val) {
  327. this.loginTag = val
  328. this.loginStatus = false
  329. const { data } = await api_openUserMusicDetail(this.id)
  330. this.state.musicDetail = data
  331. },
  332. async getStarList() {
  333. try {
  334. if (this.state.isClick) return
  335. this.state.isClick = true
  336. const res = await api_openUserMusicPage({
  337. type: "FORMAL",
  338. exclusionId: this.id,
  339. sort: 1,
  340. ...this.state.params
  341. })
  342. this.state.listState.loading = false
  343. const result = res.data || {}
  344. // 处理重复请求数据
  345. // if (this.state.list.length > 0 && result.current === 1) {
  346. // return
  347. // }
  348. this.state.list = result.rows || []
  349. this.state.listState.finished = result.current >= result.pages
  350. this.state.params.page = result.current + 1
  351. this.state.listState.dataShow = this.state.list.length > 0
  352. this.state.isClick = false
  353. } catch {
  354. this.state.listState.dataShow = false
  355. this.state.listState.finished = true
  356. this.state.isClick = false
  357. }
  358. },
  359. handleChangeList() {
  360. if (this.state.listState.finished) {
  361. this.state.listState.finished = false
  362. this.state.params.page = 1
  363. this.getStarList()
  364. } else {
  365. this.getStarList()
  366. }
  367. },
  368. async init() {
  369. /* 初始化请求 */
  370. try {
  371. const res = await api_openUserMusicDetail(this.id)
  372. this.state.musicDetail = res.data || {}
  373. try {
  374. const jsonConfig = JSON.parse(res.data.jsonConfig)
  375. jsonConfig.speedRate && (this.staffState.speedRate = jsonConfig.speedRate)
  376. jsonConfig.musicRenderType && (this.staffState.musicRenderType = jsonConfig.musicRenderType)
  377. jsonConfig["part-index"] && (this.staffState.partIndex = jsonConfig["part-index"])
  378. } catch {}
  379. // 五线谱
  380. this.initStaff()
  381. this.getStarList()
  382. // 判断是视频还是音频
  383. if (res.data.videoUrl.lastIndexOf("mp4") !== -1) {
  384. this.state.playType = "Video"
  385. } else {
  386. this.state.playType = "Audio"
  387. }
  388. this.$nextTick(() => {
  389. this.initMediaPlay()
  390. })
  391. } catch (e) {
  392. this.staffState.isShow = true
  393. if (e.code === 999) {
  394. this.isEmpty = true
  395. }
  396. }
  397. },
  398. // 初始化 媒体播放
  399. initMediaPlay() {
  400. const { playStaff, pauseStaff, updateProgressStaff } = this.staffMoveInstance()
  401. const id = this.state.playType === "Audio" ? "#audioMediaSrc" : "#videoMediaSrc"
  402. this.state._plrl = new Plyr(id, {
  403. controls: ["play", "progress", "current-time", "duration"],
  404. fullscreen: {
  405. enabled: false,
  406. fallback: false
  407. }
  408. })
  409. const player = this.state._plrl
  410. // 创建音波数据
  411. if (this.state.playType === "Audio") {
  412. const audioDom = document.querySelector("#audioMediaSrc")
  413. const canvasDom = document.querySelector("#audioVisualizer")
  414. const { pauseVisualDraw, playVisualDraw } = audioVisualDraw(audioDom, canvasDom)
  415. player.on("play", () => {
  416. playVisualDraw()
  417. })
  418. player.on("pause", () => {
  419. pauseVisualDraw()
  420. })
  421. }
  422. player.on("timeupdate", () => {
  423. this.plyrState.currentTime = player.currentTime
  424. })
  425. player.on("play", () => {
  426. this.plyrState.playIngShow = false
  427. playStaff()
  428. })
  429. player.on("pause", () => {
  430. this.plyrState.playIngShow = true
  431. pauseStaff()
  432. })
  433. player.on("ended", () => {
  434. if (this.plyrState.mediaTimeShow) return
  435. player.currentTime = 0
  436. if (!player.playing) {
  437. setTimeout(() => {
  438. updateProgressStaff(player.currentTime)
  439. }, 100)
  440. }
  441. })
  442. // 处理按压事件
  443. const handleStart = () => {
  444. if (this.isLandscapeScreen.value) {
  445. return
  446. }
  447. this.plyrState.duration = player.duration
  448. this.plyrState.mediaTimeShow = true
  449. }
  450. // 处理松开事件
  451. const handleEnd = () => {
  452. this.plyrState.mediaTimeShow = false
  453. // 暂停的时候调用
  454. if (!player.playing) {
  455. updateProgressStaff(player.currentTime)
  456. }
  457. }
  458. const progressDom = document.querySelector("#playMediaSection .plyr__controls .plyr__progress__container")
  459. progressDom.addEventListener("mousedown", handleStart)
  460. progressDom.addEventListener("touchstart", handleStart)
  461. progressDom.addEventListener("mouseup", handleEnd)
  462. progressDom.addEventListener("touchend", handleEnd)
  463. },
  464. // 初始化五线谱
  465. initStaff() {
  466. const src = `${vaildMusicScoreUrl()}/gym-music-score/#/simple-detail?id=${this.state.musicDetail.musicSheetId}&musicRenderType=${
  467. this.staffState.musicRenderType
  468. }&part-index=${this.staffState.partIndex}`
  469. //const src = `http://192.168.3.122:3000/gym-music-score.html#/simple-detail?id=${state.musicDetail.musicSheetId}&musicRenderType=${staffState.musicRenderType}&part-index=${staffState.partIndex}`;
  470. this.staffState.staffSrc = src
  471. window.addEventListener("message", event => {
  472. const { api, height } = event.data
  473. if (api === "api_musicPage") {
  474. this.staffState.isShow = true
  475. this.staffState.height = height + "px"
  476. }
  477. })
  478. },
  479. staffMoveInstance() {
  480. let isPause = true
  481. const requestAnimationFrameFun = () => {
  482. requestAnimationFrame(() => {
  483. this.$refs.staffDom?.contentWindow?.postMessage(
  484. {
  485. api: "api_playProgress",
  486. content: {
  487. currentTime: this.state._plrl.currentTime * this.staffState.speedRate
  488. }
  489. },
  490. "*"
  491. )
  492. if (!isPause) {
  493. requestAnimationFrameFun()
  494. }
  495. })
  496. }
  497. const playStaff = () => {
  498. // 没渲染不执行
  499. if (!this.staffState.isShow) return
  500. isPause = false
  501. this.$refs.staffDom?.contentWindow?.postMessage(
  502. {
  503. api: "api_play"
  504. },
  505. "*"
  506. )
  507. requestAnimationFrameFun()
  508. }
  509. const pauseStaff = () => {
  510. // 没渲染不执行
  511. if (!this.staffState.isShow) return
  512. isPause = true
  513. this.$refs.staffDom?.contentWindow?.postMessage(
  514. {
  515. api: "api_paused"
  516. },
  517. "*"
  518. )
  519. }
  520. const updateProgressStaff = currentTime => {
  521. // 没渲染不执行
  522. if (!this.staffState.isShow) return
  523. this.$refs.staffDom?.contentWindow?.postMessage(
  524. {
  525. api: "api_updateProgress",
  526. content: {
  527. currentTime: currentTime * this.staffState.speedRate
  528. }
  529. },
  530. "*"
  531. )
  532. }
  533. return {
  534. playStaff,
  535. pauseStaff,
  536. updateProgressStaff
  537. }
  538. },
  539. //点击改变播放状态
  540. handlerClickPlay(event) {
  541. // 原生 播放暂停按钮 点击的时候 不触发
  542. if (event?.target?.matches("button.plyr__control")) {
  543. return
  544. }
  545. if (this.state._plrl.playing) {
  546. this.state._plrl.pause()
  547. } else {
  548. this.state._plrl.play()
  549. }
  550. },
  551. handleScroll() {
  552. // 作品已删除不让滚动变色
  553. if (this.isEmpty) return
  554. const height = window.scrollY || document.documentElement.scrollTop
  555. // 防止多次调用
  556. if (height > 0 && this.isScreenScroll === false) {
  557. this.isScreenScroll = true
  558. this.setStatusBarTextColor(false)
  559. }
  560. if (height <= 0) {
  561. this.isScreenScroll = false
  562. this.setStatusBarTextColor(true)
  563. }
  564. },
  565. // 设置导航栏颜色
  566. setStatusBarTextColor(isWhite) {
  567. postMessage({
  568. api: "setStatusBarTextColor",
  569. content: { statusBarTextColor: isWhite }
  570. })
  571. },
  572. handleVisibilitychange() {
  573. if (document.hidden) {
  574. this.state._plrl?.pause()
  575. }
  576. },
  577. handlerBack(event) {
  578. event.stopPropagation()
  579. this.verticalScreen()
  580. },
  581. landscapeScreen() {
  582. postMessage({
  583. api: "setRequestedOrientation",
  584. content: {
  585. orientation: 0
  586. }
  587. })
  588. this.isLandscapeScreen = true
  589. },
  590. verticalScreen() {
  591. postMessage({
  592. api: "setRequestedOrientation",
  593. content: {
  594. orientation: 1
  595. }
  596. })
  597. this.isLandscapeScreen = false
  598. },
  599. handlerLandscapeScreen(event) {
  600. event.stopPropagation()
  601. const { isApp, weixin } = browser()
  602. if (isApp) {
  603. this.landscapeScreen()
  604. return
  605. }
  606. if (weixin) {
  607. this.wxStatus = true
  608. } else {
  609. const t = Date.now()
  610. const str = location.href
  611. this.shareCall(str)
  612. setTimeout(() => {
  613. if (Date.now() - t < 3500) {
  614. window.location.replace(validStudentUrl() + "/#/studentDownLoad")
  615. }
  616. }, 3000)
  617. }
  618. },
  619. shareCall(str) {
  620. const iosStr = encodeURIComponent(str)
  621. const userAgent = navigator.userAgent || navigator.vendor
  622. if (/(iPhone|iPad|iPod|iOS)/i.test(userAgent)) {
  623. window.location.href = `StudentsDaya://linkUrl=${iosStr}`
  624. } else if (/(Android)/i.test(userAgent)) {
  625. window.location.href = `studentdaya://html:8888/SplashActivity?url=${iosStr}`
  626. } else {
  627. showToast("请用手机或移动设备打开")
  628. }
  629. },
  630. handlerDownLoad() {
  631. if (browser().weixin) {
  632. this.wxStatus = true
  633. } else {
  634. window.location.replace(validStudentUrl() + "/#/studentDownLoad")
  635. }
  636. },
  637. setFullHeight() {
  638. this.creationHeight = window.innerHeight
  639. }
  640. },
  641. mounted() {
  642. this.state.heightA = this.$refs.playBoxDom.offsetHeight
  643. document.addEventListener("scroll", this.handleScroll)
  644. document.addEventListener("visibilitychange", this.handleVisibilitychange)
  645. !browser().isApp && this.setFullHeight()
  646. window.addEventListener("resize", this.setFullHeight)
  647. },
  648. destroyed() {
  649. this.state._plrl?.destroy()
  650. document.removeEventListener("scroll", this.handleScroll)
  651. document.removeEventListener("visibilitychange", this.handleVisibilitychange)
  652. window.removeEventListener("resize", this.setFullHeight)
  653. },
  654. created() {
  655. this.setStatusBarTextColor(true)
  656. postMessage({ api: "setBarStatus", content: { status: 0, backButtonHidden: 1 } })
  657. postMessage({ api: "getNavHeight" }, res => {
  658. const { content } = res
  659. const dpi = content.dpi || 2
  660. if (content.navHeight) {
  661. const navHeight = content.navHeight / dpi
  662. this.navBarHeight = navHeight
  663. }
  664. })
  665. this.init()
  666. }
  667. }
  668. </script>
  669. <style lang="less" scoped>
  670. @import url("./index.less");
  671. </style>