appDownload.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="container">
  3. <view class="appname" :style="{paddingTop: paddingTop}">河山恒康</view>
  4. <image class="appdownload-txt" src="@/static/appdownload-txt.png" mode="heightFix"></image>
  5. <view class="downbtn" @click="downApp()">打开应用市场</view>
  6. <view class="downbtn" @click="downApp('down')">直接下载APP</view>
  7. </view>
  8. </template>
  9. <script>
  10. import { getAppVersion } from '@/api/common'
  11. export default {
  12. data() {
  13. return {
  14. paddingTop: 0,
  15. }
  16. },
  17. onLoad() {
  18. const top = uni.getSystemInfoSync().windowHeight
  19. this.paddingTop = top < 568 ? '700rpx' : '770rpx'
  20. },
  21. methods: {
  22. downApp(type) {
  23. if(type=='down') {
  24. const isWechat = String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger"
  25. if(isWechat) {
  26. uni.showToast({
  27. title: '点击右上角按钮,选择在浏览器中打开',
  28. icon: "error",
  29. duration: 3000
  30. })
  31. return
  32. }
  33. let platform = uni.getSystemInfoSync().platform;
  34. let isAndroid=platform=="android";
  35. let type=isAndroid?1:2;
  36. getAppVersion(type).then(srcData => {
  37. if(srcData.code==200){
  38. let data = srcData.data;
  39. if(data&&data.url) {
  40. window.location.href=data.url//升级包地址;
  41. } else {
  42. uni.showToast({
  43. title: '暂无下载地址',
  44. icon: "none"
  45. })
  46. }
  47. } else {
  48. uni.showToast({
  49. title: '获取下载地址失败',
  50. icon: "none"
  51. })
  52. }
  53. },
  54. rej => {}
  55. ).catch(()=>{
  56. //联网失败, 结束加载
  57. uni.showToast({
  58. title: '获取下载地址失败',
  59. icon: "none"
  60. })
  61. });
  62. } else {
  63. // window.location.href="https://a.app.qq.com/o/simple.jsp?pkgname=com.mytek.rtlive";
  64. const systemInfo = uni.getSystemInfoSync()
  65. console.log(systemInfo)
  66. if(systemInfo.osName=='ios') {
  67. window.location.href= "https://a.app.qq.com/o/simple.jsp?pkgname=com.mytek.rtlive"
  68. }else if(systemInfo.osName=='android') {
  69. window.location.href= "https://m.malink.cn/s/2UZjMz"
  70. }
  71. }
  72. },
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .container {
  78. height: 100vh;
  79. width: 100%;
  80. background: url("@/static/appdownload.png") no-repeat 50%;
  81. background-size: cover;
  82. background-color: linear-gradient( 180deg, #E93C21 0%, #FF5600 100%);;
  83. // overflow: hidden;
  84. display: flex;
  85. flex-direction: column;
  86. align-items: center;
  87. justify-content: center;
  88. font-family: PingFang SC, PingFang SC;
  89. font-weight: 600;
  90. font-size: 40rpx;
  91. color: #FFFFFF;
  92. .appname {
  93. padding-top: 700rpx;
  94. margin-bottom: 14rpx;
  95. }
  96. .appdownload-txt {
  97. height: 32rpx;
  98. width: 378rpx;
  99. margin-bottom: 94rpx;
  100. }
  101. .downbtn {
  102. width: 528rpx;
  103. min-height: 96rpx;
  104. background: linear-gradient( 180deg, #FFFFFD 0%, #FEE7CC 100%);
  105. border-radius: 48rpx 48rpx 48rpx 48rpx;
  106. font-family: PingFang SC, PingFang SC;
  107. font-weight: 500;
  108. font-size: 32rpx;
  109. color: #EE4219;
  110. display: flex;
  111. align-items: center;
  112. justify-content: center;
  113. margin-bottom: 24rpx;
  114. }
  115. }
  116. </style>