Prechádzať zdrojové kódy

下载页面去接口

JXDS18FUJT 2 rokov pred
rodič
commit
e83bff23d6

+ 1 - 1
index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8" />
     <link rel="icon" type="image/svg+xml" href="src/favicon.svg" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
-    <title>公众号</title>
+    <title></title>
   </head>
   <body>
     <div id="root"></div>

+ 1 - 1
src/App.tsx

@@ -14,7 +14,7 @@ export function App() {
   return (
     <Router>
       <Switch>
-        <Route exact path="/">
+        <Route onEnter={() => { document.title = '' }} exact path="/">
           <VideoKindList />
         </Route>
         <Route path="/home">

+ 8 - 0
src/api/index.ts

@@ -33,6 +33,14 @@ const api = {
             url: "student/user/info",
             method: 'get'
         })
+    },
+    //(开放信息)根据字典类型查询字典数据信息
+    openapiSystemDictDataType(dictType:string):AxiosPromise<openapiSystemDictDataTypeRes>{
+        return request({
+            url:`open-api/system/dict/data/type/${dictType}`,
+            method: 'get'
+        })
+
     }
 
 }

+ 41 - 21
src/api/type.d.ts

@@ -2,33 +2,53 @@ interface Res {
     code: number;
     msg: string;
 }
-interface StudentVideoTeachingListRes extends Res{
-    total:number
-    rows:{
-        createTime:string
-        id:number
-        state:0|1
-        updateTime:string
-        videoCover:string
-        videoName:string
-        videoSubject:number
-        videoUrl:string
+interface StudentVideoTeachingListRes extends Res {
+    total: number
+    rows: {
+        createTime: string
+        id: number
+        state: 0 | 1
+        updateTime: string
+        videoCover: string
+        videoName: string
+        videoSubject: number
+        videoUrl: string
 
     }[]
 
 }
 
-interface studentUserInfoRes extends Res{
-    total:number
-    data:{
-        createTime:string
-        id:number
-        state:0|1
-        updateTime:string
-        headImage:string
-        nickName:string
-        unionId:string
+interface studentUserInfoRes extends Res {
+    total: number
+    data: {
+        createTime: string
+        id: number
+        state: 0 | 1
+        updateTime: string
+        headImage: string
+        nickName: string
+        unionId: string
 
     }
 
+}
+interface openapiSystemDictDataTypeRes extends Res {
+    data: {
+        "searchValue": null,
+        "createBy": string,
+        "createTime": string,
+        "updateTime": null,
+        "updateBy": null,
+        "remark": string,
+        "dictCode": number,
+        "dictSort": number,
+        "dictLabel": string,
+        "dictValue": string,
+        "dictType": string,
+        "cssClass": null,
+        "listClass": null,
+        "isDefault": string,
+        "status": string
+    }[]
+
 }

+ 12 - 4
src/views/downloadCaigong1/index.tsx

@@ -1,9 +1,10 @@
 import './index.less'
 import React, { useState, useEffect } from "react";
 import utils from '~/utils/utils';
+import api from '~/api'
 export const DownloadCaigong1: React.FC = (props: any) => {
     const [tip, setTip] = useState('none')
-
+    const [androidUrl,setAndroidUrl] = useState("#没获取到链接")
     const is_weixin = () => {
         var ua = navigator.userAgent.toLowerCase();
         if (ua.search('micromessenger') !== -1) {
@@ -50,12 +51,12 @@ export const DownloadCaigong1: React.FC = (props: any) => {
         }
         else {
             return (<React.Fragment>
-                <a href="https://t1-1305573081.file.myqcloud.com/ctjk/apk/ctjk1.0.0.apk">
+                <a href={androidUrl}>
                     <div className="download1">
                         点击下载1
                     </div>
                 </a>
-                <a href="https://t1-1305573081.file.myqcloud.com/ctjk/apk/ctjk1.0.0.apk">
+                <a href={androidUrl}>
                     <div className="download2">
                         点击下载(备用)
                     </div>
@@ -76,9 +77,16 @@ export const DownloadCaigong1: React.FC = (props: any) => {
         setTip('none')
     }
     useEffect(() => {
+        document.title ='APP下载'
+        api.openapiSystemDictDataType("android_update").then(res=>{
+            console.log(res.data.data[0].dictValue)
+            console.log(androidUrl)
+            setAndroidUrl( res.data.data[0].dictValue) 
+        })
+
      
 
-    })
+    },['androidUrl'])
     return (
         <div id="app">
             <div style={{ display: tip }} id="tip">

+ 25 - 21
src/views/downloadCaigong2/index.tsx

@@ -1,8 +1,12 @@
 import './index.less'
 import React, { useEffect, useState } from "react";
 import utils from '~/utils/utils';
+import api from '~/api';
+
 export const DownloadCaigong2: React.FC = (props: any) => {
+
     const [tip, setTip] = useState('none')
+    const [androidUrl, setAndroidUrl] = useState("#没获取到链接")
     const is_weixin = () => {
         var ua = navigator.userAgent.toLowerCase();
         if (ua.search('micromessenger') !== -1) {
@@ -10,16 +14,6 @@ export const DownloadCaigong2: React.FC = (props: any) => {
         } else {
             return false;
         }
-    }
-    const openWxDownloadTip = () => {
-        setTip('block')
-
-
-    }
-    const closeWxDownloadTip = () => {
-        setTip('none')
-
-
     }
     const downloadButtons = () => {
         if (utils.isWeixin() && utils.isAndroid()) {
@@ -59,12 +53,12 @@ export const DownloadCaigong2: React.FC = (props: any) => {
         }
         else {
             return (<React.Fragment>
-                <a href="https://t1-1305573081.file.myqcloud.com/ctjk/apk/ctjk1.0.0.apk">
+                <a href={androidUrl}>
                     <div className="download1">
                         点击下载1
                     </div>
                 </a>
-                <a href="https://t1-1305573081.file.myqcloud.com/ctjk/apk/ctjk1.0.0.apk">
+                <a href={androidUrl}>
                     <div className="download2">
                         点击下载(备用)
                     </div>
@@ -76,19 +70,29 @@ export const DownloadCaigong2: React.FC = (props: any) => {
 
 
     }
+    const openWxDownloadTip = () => {
+        setTip('block')
+
+
+    }
+    const closeWxDownloadTip = () => {
+        setTip('none')
+
+
+    }
+
     useEffect(() => {
-        if (is_weixin()) {
-            document.querySelectorAll<HTMLElement>('#app a')[0].style.display = 'none'
-            document.querySelectorAll<HTMLElement>('#app a')[1].style.display = 'none'
+        document.title = 'APP下载'
+        api.openapiSystemDictDataType("android_update").then(res => {
+            console.log(res.data.data[0].dictValue)
+            setAndroidUrl(res.data.data[0].dictValue)
+        })
+
+
 
-        }
-        else {
-            document.querySelectorAll<HTMLElement>('#app a')[2].style.display = 'none'
-            document.querySelectorAll<HTMLElement>('#app a')[3].style.display = 'none'
 
-        }
 
-    })
+    }, [])
     return (
         <div id="app">
             <div style={{ display: tip }} id="tip">

+ 2 - 3
src/views/videokindList/index.tsx

@@ -1,6 +1,6 @@
 import './index.less'
 import React, { useEffect, useState } from "react";
-import { Toast } from 'antd-mobile'
+
 import { Link, useHistory } from 'react-router-dom';
 import kemu1 from './../../assets/images/kemu1.png'
 import kemu2 from './../../assets/images/kemu2.png'
@@ -23,7 +23,7 @@ export const VideoKindList: React.FC = (props: any) => {
         title: "科目四"
     }])
     useEffect(() => {
-
+        document.title =''
         let query = new URLSearchParams(window.location.search)
 
         if (query.get("state") == 'LOGIN') {
@@ -36,7 +36,6 @@ export const VideoKindList: React.FC = (props: any) => {
             })
         }
         else {
-    
             api.studentUserInfo().then(res => {