Newer
Older
KaiFengH5 / src / views / home / codeQR.vue
@鲁yixuan 鲁yixuan on 9 Jul 1 KB update
<template>
  <!-- 检查更新 -->
  <div class="codeqrPage">
    <div class="main">
      <img src="https://www.pgyer.com/app/qrcode/ktbN9A" alt="APP扫码" class="codeImg" />
      <h2>{{ versionInfo.buildName }}</h2>
      <p>当前版本号:{{ versionInfo.buildVersion }}</p>
      <p>更新时间:{{ versionInfo.buildUpdated }}</p>
      <p>更新说明:{{ versionInfo.buildUpdateDescription || '--' }}</p>
      <van-button type="primary" round block @click="goDownload" v-if="ifNew == 'true'">立即更新</van-button>
    </div>
  </div>
</template>
<script setup name="codeqrPage">
import { useStore } from '@/pinia/store.js';
// import { getVersionByVersion, appVersionCheck } from '@/api/publicApi.js';

const pinias = useStore();
const versionInfo = ref({});
const ifNew = ref('false');

// 获取版本信息
// function getVersionInfo() {
//   pinias.showLoading();
//   getVersionByVersion().then((res) => {
//     versionInfo.value = res.data.data;
//     checkNewVersion(); //检测App是否有更新
//     pinias.hideLoading();
//   });
// }
// 检测App是否有更新
// function checkNewVersion() {
//   appVersionCheck().then((res) => {
//     ifNew.value = res.data.data.buildHaveNewVersion;
//   });
// }

function goDownload() {
  window.android.downloadurl('https://www.pgyer.com/ktbN9A');
}

onMounted(() => {
  getVersionInfo(); //获取详情
});
</script>
<style lang="less" scoped>
.codeqrPage {
  width: 100%;
  display: flex;
  justify-content: center;

  .main {
    width: 90%;
    margin: 50px 5%;
    text-align: center;
    line-height: 40px;
    .codeImg {
      width: 210px;
      height: 210px;
    }
    .van-button {
      margin-top: 50px;
    }
  }
}
</style>