appDownload.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. }
  65. },
  66. }
  67. }
  68. </script>
  69. <style lang="scss" scoped>
  70. .container {
  71. height: 100vh;
  72. width: 100%;
  73. background: url("@/static/appdownload.png") no-repeat 50%;
  74. background-size: cover;
  75. background-color: linear-gradient( 180deg, #E93C21 0%, #FF5600 100%);;
  76. // overflow: hidden;
  77. display: flex;
  78. flex-direction: column;
  79. align-items: center;
  80. justify-content: center;
  81. font-family: PingFang SC, PingFang SC;
  82. font-weight: 600;
  83. font-size: 40rpx;
  84. color: #FFFFFF;
  85. .appname {
  86. padding-top: 700rpx;
  87. margin-bottom: 14rpx;
  88. }
  89. .appdownload-txt {
  90. height: 32rpx;
  91. width: 378rpx;
  92. margin-bottom: 94rpx;
  93. }
  94. .downbtn {
  95. width: 528rpx;
  96. min-height: 96rpx;
  97. background: linear-gradient( 180deg, #FFFFFD 0%, #FEE7CC 100%);
  98. border-radius: 48rpx 48rpx 48rpx 48rpx;
  99. font-family: PingFang SC, PingFang SC;
  100. font-weight: 500;
  101. font-size: 32rpx;
  102. color: #EE4219;
  103. display: flex;
  104. align-items: center;
  105. justify-content: center;
  106. margin-bottom: 24rpx;
  107. }
  108. }
  109. </style>