123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <template>
- <div class="hc-app-body h-full w-full">
- <img class="bg-img h-full w-full" :src="bgImg" alt="">
- <div class="app-body h-full w-full">
- <div class="app-company-name hc-flex-center">
- <img :src="companyName" alt="">
- </div>
- <div class="app-title">
- <div class="icon-box hc-flex-center">
- <img :src="appIcon" alt="">
- </div>
- <div class="title-box">
- <div class="name">工程云家</div>
- <div class="version">当前版本:{{androidInfo.versionNumber}}</div>
- <div class="time">更新时间:{{androidInfo.updateTime}}</div>
- </div>
- </div>
- <div class="app-tip">苹果手机或微信等,请点击右上角,在浏览器中打开此页面。(尽量在浏览器中打开此页,否则可能会无法下载)</div>
- <div class="app-btn">
- <template v-if="isPcType === 'pc'">
- <el-button type="success" @click="downloadAndroid">
- <i class="i-ic-baseline-android"/>
- <span class="ml-1">下载安卓APP</span>
- </el-button>
- <el-button type="success" @click="downloadApple">
- <i class="i-ic-baseline-apple"/>
- <span class="ml-1">下载苹果APP</span>
- </el-button>
- </template>
- <el-row :gutter="20" v-if="isPcType === 'mobile'">
- <el-col :span="12">
- <el-button type="success" @click="downloadAndroid">
- <i class="i-ic-baseline-android"/>
- <span class="ml-1">下载安卓APP</span>
- </el-button>
- </el-col>
- <el-col :span="12">
- <el-button type="success" @click="downloadApple">
- <i class="i-ic-baseline-apple"/>
- <span class="ml-1">下载苹果APP</span>
- </el-button>
- </el-col>
- </el-row>
- </div>
- <div class="h-100px" v-if="isPcType === 'mobile'"/>
- </div>
- </div>
- </template>
- <script setup>
- import {onMounted, onUnmounted, ref} from "vue";
- import {getNewVersion} from "~src/request/index";
- import bgImg from '~src/assets/archives/topHead.png'
- import companyName from '~src/assets/index/companyName.png'
- import appIcon from '~src/assets/index/app-icon.png'
- import {getObjValue, isNullES, newWindow} from "js-fast-way";
- import { ElMessage } from 'element-plus'
- //渲染完成
- const isPcType = ref('mobile')
- onMounted(() => {
- const dom = document.documentElement
- isPcType.value = `${dom.offsetWidth > 700 ?'pc':'mobile'}`
- dom.setAttribute('class', `${dom.offsetWidth > 700 ?'hc-app-pc':'hc-app-mobile'}`)
- getApiData()
- })
- //获取接口数据
- const androidInfo = ref({})
- const appleInfo = ref({})
- const getApiData = async () => {
- androidInfo.value = await getAppInfo(1) //安卓
- appleInfo.value = await getAppInfo(2) //ios
- }
- //获取APP数据
- const getAppInfo = async (type) => {
- const { data } = await getNewVersion({
- softwareType: type,
- fileType: 0,
- platform: 'client',
- })
- return getObjValue(data)
- }
- //下载安卓APP
- const downloadAndroid = () => {
- const info = androidInfo.value
- if (isNullES(info.fileUrl)) {
- ElMessage.warning('系统维护中,请稍后再试')
- return
- }
- newWindow(info.fileUrl)
- }
- //下载苹果APP
- const downloadApple = () => {
- const info = appleInfo.value
- if (isNullES(info.fileUrl)) {
- ElMessage.warning('系统维护中,请稍后再试')
- return
- }
- newWindow(info.fileUrl)
- }
- //页面卸载
- onUnmounted(() => {
- document.documentElement.removeAttribute('class')
- })
- </script>
- <style lang="scss">
- html.hc-app-mobile,
- html.hc-app-mobile body,
- html.hc-app-mobile body #app {
- position: relative;
- padding: 0;
- margin: 0;
- width: 100%;
- height: 100%;
- }
- .hc-app-body {
- position: relative;
- .bg-img {
- position: fixed;
- inset: 0;
- object-fit: cover;
- }
- .app-body {
- position: relative;
- .app-company-name {
- position: relative;
- padding: 20px;
- height: 30px;
- img {
- height: 100%;
- }
- }
- .app-tip {
- position: relative;
- padding: 0 20px;
- color: white;
- font-size: 14px;
- }
- .app-title {
- position: relative;
- padding: 0 20px;
- color: white;
- display: flex;
- .icon-box {
- position: relative;
- width: 80px;
- img {
- width: 100%;
- }
- }
- .title-box {
- position: relative;
- width: calc(100% - 80px);
- padding-left: 14px;
- font-size: 13px;
- .name {
- font-size: 18px;
- margin-top: 6px;
- margin-bottom: 2px;
- }
- }
- }
- .app-btn {
- position: relative;
- padding: 24px;
- overflow: hidden;
- .el-button {
- width: 100%;
- height: 40px;
- font-size: 16px;
- i {
- font-size: 18px;
- }
- }
- }
- }
- }
- .hc-app-pc .hc-app-body .app-body {
- width: 350px;
- margin: auto;
- .app-title {
- margin-top: 40%;
- }
- .app-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- .el-button {
- width: auto;
- }
- .el-button + .el-button {
- margin-left: 24px;
- }
- }
- }
- </style>
|