index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <!-- <view v-if="config"><view @click="goDownload()">去下载</view></view> -->
  3. <view v-if="config" style="overflow: hidden;margin-bottom: 20rpx;min-height: 100vh;">
  4. <view v-if="isWeixn">
  5. <image class="guide-image" src="../../static/openGuide.png"></image>
  6. <view class="ceng"></view>
  7. </view>
  8. <view>
  9. <view class="logo-box">
  10. <view class="logo-image"><image :src="config.CONFIG_PROJECT_LOGO"></image></view>
  11. <view class="logo-text">{{ config.CONFIG_PROJECT_TITLE }}</view>
  12. </view>
  13. <view class="download-btn" @click="goDownload()">下载</view>
  14. </view>
  15. <view class="gary-text footer-bar">
  16. <view>
  17. <text style="margin-right: 10rpx;" @click="jump('/pages/userAgreement/index?appId=' + appId)">服务协议</text>
  18. <text style="margin-left: 10rpx;" @click="jump('/pages/privacyAgreement/index?appId=' + appId)">隐私政策</text>
  19. </view>
  20. <view>{{ config.CONFIG_RECORD_NUMBER }}</view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. const req = require('../../utils/request.js');
  26. const util = require('../../utils/util.js');
  27. export default {
  28. data() {
  29. return {
  30. isWeixn: false, //判断是否在微信环境 true不在,false在
  31. appId: '', //
  32. config: ''
  33. };
  34. },
  35. onLoad(opt) {
  36. this.appId = opt.appId;
  37. this.isWeixn = this.is_weixn();
  38. this.getConfig();
  39. },
  40. methods: {
  41. jump(url) {
  42. uni.navigateTo({
  43. url: url
  44. });
  45. },
  46. getConfig() {
  47. req.getRequest(
  48. '/api/config',
  49. this.appId,
  50. {},
  51. data => {
  52. this.config = data;
  53. },
  54. true
  55. );
  56. },
  57. // 去下载
  58. goDownload() {
  59. if (this.isWeixn) {
  60. //在微信环境
  61. this.showModal('请点击右上角“...”按钮, 选择在浏览器打开');
  62. } else {
  63. var u = navigator.userAgent;
  64. var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
  65. var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
  66. // 这里是iOS浏览器
  67. if (isIOS) {
  68. if (this.config.download_app_ios_url) {
  69. window.location.href = this.config.download_app_ios_url; // 跳AppStore下载地址
  70. } else {
  71. this.showModal('后台暂未开放IOS App版本下载');
  72. }
  73. } else {
  74. if (this.config.download_app_android_url) {
  75. window.location.href = this.config.download_app_android_url; // 跳AppStore下载地址
  76. } else {
  77. this.showModal('后台暂未开放Android App版本下载');
  78. }
  79. }
  80. }
  81. },
  82. // 是微信浏览器
  83. is_weixn() {
  84. var ua = navigator.userAgent.toLowerCase();
  85. if (ua.match(/MicroMessenger/i) == 'micromessenger') {
  86. return true;
  87. } else {
  88. return false;
  89. }
  90. },
  91. /**
  92. * 是否为Pc版本
  93. */
  94. isPC() {
  95. var userAgentInfo = navigator.userAgent;
  96. var Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
  97. var flag = true;
  98. for (var v = 0; v < Agents.length; v++) {
  99. if (userAgentInfo.indexOf(Agents[v]) > 0) {
  100. flag = false;
  101. break;
  102. }
  103. }
  104. return flag;
  105. },
  106. showModal(msg) {
  107. uni.showModal({
  108. title: '提示',
  109. content: msg,
  110. confirmText: '关闭',
  111. showCancel: false,
  112. success(res) {}
  113. });
  114. }
  115. }
  116. };
  117. </script>
  118. <style>
  119. @import './index.css';
  120. </style>