瀏覽代碼

Merge branch 'iteration-oss-up'

lex 1 年之前
父節點
當前提交
eb1265c280
共有 3 個文件被更改,包括 45 次插入16 次删除
  1. 22 5
      src/views/download/index.tsx
  2. 21 5
      src/views/download/transfer.tsx
  3. 2 6
      vite.config.ts

+ 22 - 5
src/views/download/index.tsx

@@ -1,16 +1,18 @@
 import { Button, showToast, Image } from 'vant';
-import { defineComponent, reactive } from 'vue';
+import { defineComponent, onMounted, reactive } from 'vue';
 import styles from './index.module.less';
 import wxBg from './images/wx_bg.png';
 import { browser } from '@/helpers/utils';
 import student from './images/student-center.png';
+import request from '@/helpers/request';
 
 // 唤起前缀
 export default defineComponent({
   name: 'download',
   setup() {
     const state = reactive({
-      wxStatus: false
+      wxStatus: false,
+      androidUrl: ''
     });
 
     const onDownload = () => {
@@ -24,11 +26,10 @@ export default defineComponent({
       if (location.origin.indexOf('kt.colexiu.com') > -1) {
         urlIos =
           'https://apps.apple.com/us/app/%E9%9F%B3%E4%B9%90%E6%95%B0%E5%AD%97%E8%AF%BE%E5%A0%82/id6452725878';
-        urlAndroid =
-          'https://oss.dayaedu.com/appstore/kt_cooleshow_student.apk';
+        urlAndroid = state.androidUrl; //'https://oss.dayaedu.com/appstore/kt_cooleshow_student.apk';
       } else {
         urlIos = 'https://www.pgyer.com/dzRRNN';
-        urlAndroid = 'https://www.pgyer.com/2meenh';
+        urlAndroid = state.androidUrl; //'https://www.pgyer.com/2meenh';
       }
 
       if (
@@ -42,6 +43,22 @@ export default defineComponent({
         showToast('请用手机或移动设备打开');
       }
     };
+    onMounted(async () => {
+      try {
+        const { data } = await request.get(
+          '/edu-app/open/appVersionInfo/queryLatestByPlatform',
+          {
+            params: {
+              platform: 'android-student',
+              status: 'history'
+            }
+          }
+        );
+        state.androidUrl = data.downloadUrl;
+      } catch {
+        //
+      }
+    });
     return () => (
       <div class={[styles.downloadContainer]}>
         <Image src={student} />

+ 21 - 5
src/views/download/transfer.tsx

@@ -7,15 +7,32 @@ import qs from 'query-string';
 import student from './images/student-center.png';
 import teacher from './images/teacher-center.png';
 import manage from './images/manage-center.png';
+import request from '@/helpers/request';
 
 export default defineComponent({
   name: 'download-transfer',
   data() {
     return {
-      wxStatus: false
+      wxStatus: false,
+      androidUrl: ''
     };
   },
-  mounted() {
+  async mounted() {
+    try {
+      const { data } = await request.get(
+        '/edu-app/open/appVersionInfo/queryLatestByPlatform',
+        {
+          params: {
+            platform: 'android-student',
+            status: 'history'
+          }
+        }
+      );
+      this.androidUrl = data.downloadUrl;
+    } catch (e) {
+      //
+      console.log(e);
+    }
     const { pn, url, action, pageTag, ...rest } = this.$route.query;
     const { origin, pathname } = location;
     let tempPathname = pathname;
@@ -60,11 +77,10 @@ export default defineComponent({
       if (location.origin.indexOf('kt.colexiu.com') > -1) {
         urlIos =
           'https://apps.apple.com/us/app/%E9%9F%B3%E4%B9%90%E6%95%B0%E5%AD%97%E8%AF%BE%E5%A0%82/id6452725878';
-        urlAndroid =
-          'https://oss.dayaedu.com/appstore/kt_cooleshow_student.apk';
+        urlAndroid = this.androidUrl; //'https://oss.dayaedu.com/appstore/kt_cooleshow_student.apk';
       } else {
         urlIos = 'https://www.pgyer.com/dzRRNN';
-        urlAndroid = 'https://www.pgyer.com/2meenh';
+        urlAndroid = this.androidUrl; //'https://www.pgyer.com/2meenh';
       }
 
       if (

+ 2 - 6
vite.config.ts

@@ -13,8 +13,8 @@ function resolve(dir: string) {
 }
 // https://vitejs.dev/config/
 // https://github.com/vitejs/vite/issues/1930 .env
-const proxyUrl = 'https://test.lexiaoya.cn/';
-// const proxyUrl = 'https://dev.kt.colexiu.com/';
+// const proxyUrl = 'https://dev.lexiaoya.cn/';
+const proxyUrl = 'https://dev.kt.colexiu.com/';
 // const proxyUrl = 'http://192.168.3.143:7989/';
 export default defineConfig({
   base: './',
@@ -69,10 +69,6 @@ export default defineConfig({
     cors: true,
     https: false,
     proxy: {
-      '/edu-oauth': {
-        target: proxyUrl,
-        changeOrigin: true
-      },
       '/edu-app': {
         target: proxyUrl,
         changeOrigin: true