ソースを参照

接入首页接口 调试

la 2 年 前
コミット
a6d9e46c65
共有5 個のファイルを変更した137 個の追加87 個の削除を含む
  1. 55 0
      public/config1.js
  2. 14 6
      src/pages/home/blocks.vue
  3. 14 36
      src/pages/home/radars.vue
  4. 14 6
      src/pages/home/scrollblock.vue
  5. 40 39
      src/pages/index.vue

+ 55 - 0
public/config1.js

@@ -0,0 +1,55 @@
+// 判断浏览器是否为IE
+const ua = window.navigator.userAgent
+const isIE = ua.indexOf('MSIE') !== -1 || ua.indexOf('Trident/') !== -1
+
+// 如果浏览器为IE,则提示用户更新浏览器
+if (isIE) {
+    // alert('您的浏览器版本过低,请更新浏览器!')
+    window.unsupportedBrowser = true
+    document.getElementById('app').innerHTML = '<h1 style="width:960px;margin:200px auto;font-size:32px;font-weight:700;">您的浏览器版本过低,请升级浏览器以获取更好的体验!<br>推荐使用 <a href="https://www.microsoft.com/zh-cn/edge" style="color:blue">Microsoft Edge</a> 或者 <a href="https://www.google.com/chrome" style="color:blue">Google Chrome</a> 浏览器。<br>如果您使用的是双核浏览器,请切换到极速模式访问</h1>'
+}
+
+// 本地开发环境
+const local = {
+    // web_pc: 'https://tyyx.bozedu.top/',
+    // web_mobile: 'https://tyyxm.bozedu.top/',
+
+    api: 'https://openapi.dev.bozedu.net/',
+    oss: 'https://openapi.dev.bozedu.net/',
+    uc: 'https://uc.dev.bozedu.net/',
+    myxjyszptx: 'https://myxjyszptxapi.bozedu.top/',
+    origin: window.location.origin,
+}
+
+// 测试服环境
+const development = {
+    web_pc: 'https://myxjyszptxweb.bozedu.top/',
+
+    origin: window.location.origin,
+    api: 'https://openapi.dev.bozedu.net/',
+    oss: 'https://openapi.dev.bozedu.net/',
+    uc: 'https://uc.dev.bozedu.net/',
+    myxjyszptx: 'https://myxjyszptxapi.bozedu.top/',
+}
+
+// // 正式服环境
+const production = {
+    web_pc: 'https://myxjyszptxweb.bozedu.net/',
+
+    origin: window.location.origin,
+    api: 'https://openapi.bozedu.net/',
+    oss: 'https://openapi.bozedu.net/',
+    uc: 'https://uc.bozedu.net/',
+    myxjyszptx: 'https://myxjyszptxapi.bozedu.net/',
+}
+
+function isWhich() {
+    if (window.location.href.indexOf(development.web_pc) === 0) {
+        return development
+    } else if (window.location.href.indexOf(production.web_pc) === 0) {
+        return production
+    } else {
+        return local
+    }
+}
+window.GLOBAL_CONFIG = isWhich()

+ 14 - 6
src/pages/home/blocks.vue

@@ -1,4 +1,12 @@
-<script setup lang="ts"></script>
+<script setup lang="ts">
+interface PropsType{
+  objectPackbage:Object
+}
+withDefaults(defineProps<PropsType>(), {
+  objectPackbage:"",
+})
+
+</script>
 
 <template>
   <div class="w-full h-full flex justify-end bg_img">
@@ -6,27 +14,27 @@
       <div class="flex justify-end items-end">
         <i:ant-design:bar-chart-outlined class="text-lg mr-1" />
         <span class="tracking-wide">实时在线</span>
-        <span class="text-2xl ml-4">1290</span>
+        <span class="text-2xl ml-4">{{ objectPackbage.onlineNum }}</span>
       </div>
       <div>
         <div class="flex">
           <div>
             <span class="tracking-wide">课程资源</span>
-            <span class="text-2xl ml-4">612</span>
+            <span class="text-2xl ml-4">{{ objectPackbage.classResource }}</span>
           </div>
           <div class="ml-24">
             <span class="tracking-wide">线上教学</span>
-            <span class="text-2xl ml-4">119</span>
+            <span class="text-2xl ml-4">{{ objectPackbage.onlineTeacher }}</span>
           </div>
         </div>
         <div class="flex mt-2">
           <div>
             <span class="tracking-wide">线上教研</span>
-            <span class="text-2xl ml-4">112</span>
+            <span class="text-2xl ml-4">{{ objectPackbage.onlineCheck }}</span>
           </div>
           <div class="ml-24">
             <span class="tracking-wide">学生作品</span>
-            <span class="text-2xl ml-4">219</span>
+            <span class="text-2xl ml-4">{{ objectPackbage.stuProduct }}</span>
           </div>
         </div>
       </div>

+ 14 - 36
src/pages/home/radars.vue

@@ -1,11 +1,21 @@
 <script setup lang="ts">
 import * as echarts from 'echarts'
 
+interface PropsType {
+  ecahrtsData: Object
+}
+const props = withDefaults(defineProps<PropsType>(), {
+  ecahrtsData: '' 
+});
+
+
+
 const chartRef = ref()
 onMounted(() => {
+  console.log(props.ecahrtsData,"9999")
   echarts.init(chartRef.value).setOption({
     title: {
-      text: '学生素养',
+      text: props.ecahrtsData.title_text,
       textStyle: {
         color: '#fff',
       },
@@ -15,7 +25,7 @@ onMounted(() => {
       confine: true,
     },
     legend: {
-      date: ['全市平均', '前一年农村平均', '目前农村平均'],
+      date: props.ecahrtsData.legend_date,
       top: '7%',
       right: '5%',
       textStyle: {
@@ -29,43 +39,11 @@ onMounted(() => {
     color: ['#11a597', '#ff8366', '#eff410'],
     radar: {
       // shape: 'circle',
-      indicator: [
-        { name: '图像识读', max: 100 },
-        { name: '文化理解', max: 100 },
-        { name: '美术表现', max: 100 },
-        { name: '综合素养', max: 100 },
-        { name: '创意实践', max: 100 },
-        { name: '审美判断', max: 100 },
-      ],
+      indicator: props.ecahrtsData.radar_indicator,
       center: ['50%', '57%'],
       radius: '70%',
     },
-    series: [{
-      type: 'radar',
-      data: [
-        {
-          value: [82, 76, 89, 73, 95, 94],
-          name: '全市平均',
-          areaStyle: {
-            color: '#11a59760',
-          },
-        },
-        {
-          value: [38, 40, 56, 36, 50, 46],
-          name: '前一年农村平均',
-          areaStyle: {
-            color: '#ff8366',
-          },
-        },
-        {
-          value: [69, 52, 62, 67, 76, 52],
-          name: '目前农村平均',
-          areaStyle: {
-            color: '#eff41060',
-          },
-        },
-      ],
-    }],
+    series: props.ecahrtsData.series,
   })
 })
 </script>

+ 14 - 6
src/pages/home/scrollblock.vue

@@ -1,5 +1,14 @@
 <script setup lang="ts">
-import dialog from '~/assets/img/home/dialog2.png'
+
+interface PropsType{
+  objectPackbageOne:Array
+}
+withDefaults(defineProps<PropsType>(), {
+  objectPackbageOne:"",
+})
+
+import dialog from '~/assets/img/home/dialog2.png';
+
 const ZaiXian_XunKe_table = $ref([
   ['家乡的古塔', '吴宇荻', '魏筱甜', '/#/zbkt/ssys/content/57'],
   ['戏曲人物', '谢秋丽', '徐文欣', '/#/zbkt/ssys/content/58'],
@@ -14,10 +23,13 @@ const ZaiXian_XunKe_table = $ref([
   ['窗外的风景', '谢秋丽', '沈小花', '/#/zbkt/ssys/content/68'],
   ['为自己的书设计封面', '孙霏霏', '胡娟', '/#/zbkt/ssys/content/70'],
 ])
+
+
 let scrollTop = $ref(0)
 let timer: number | undefined
 onMounted(() => {
-  handleMouseLeaveScroll()
+  handleMouseLeaveScroll();
+  
 })
 function handleMouseEnterScroll() {
   if (timer)
@@ -50,18 +62,14 @@ let dialogPage = $ref(0)
 const dialogRef = $ref()
 const buttonRef = $ref()
 const dialogData = $ref([
-  // [
   'https://myvod.bozedu.net/sv/1e3b5670-18404cdea41/1e3b5670-18404cdea41.mp4',
   'https://myvod.bozedu.net/sv/11060231-18404f3730d/11060231-18404f3730d.mp4',
   'https://myvod.bozedu.net/sv/207af45c-18408bd6126/207af45c-18408bd6126.mp4',
   'https://myvod.bozedu.net/sv/1e90113d-18408cd28be/1e90113d-18408cd28be.mp4',
-  // ],
-  // [
   'https://myvod.bozedu.net/sv/1bfe4cb1-18404fc27fd/1bfe4cb1-18404fc27fd.mp4',
   'https://myvod.bozedu.net/sv/36ea00ee-18408c431d3/36ea00ee-18408c431d3.mp4',
   'https://myvod.bozedu.net/sv/3e9a246-18408c8e6b1/3e9a246-18408c8e6b1.mp4',
   'https://myvod.bozedu.net/sv/399c3fff-18408cf0f7f/399c3fff-18408cf0f7f.mp4',
-  // ],
 ])
 function handleClickNextpage() {
   dialogPage = (dialogPage + 1) % 2

+ 40 - 39
src/pages/index.vue

@@ -13,36 +13,37 @@ import line3 from './home/line3.vue';
 
 import blocks from './home/blocks.vue'
 
+const AllResponse = ref('');
 
-const baseInfo = ref({
-  allSchoolNum: 40,
-  allCitySchoolNum: 1326,
-  linkSchool: 12,
-  outlinkSchool: 3,
-  linkTeacher: 75,
-  outLinkTeacher: 20,
-  lackschool: 7,
-  lackschoolPercent:"17.5%",
-  lackClassNum: 327,
-  lackClassNumPercent:"24.6%",
-  linkClass: 60,
-  outLinkClass: 14,
-  linkStudentNum: 2480,
-  outLinkStudentNum:144,
-})
+const left_top_ecahrtsData = ref({});
+
+const middle_top_data = ref({})
+const left_baseShow = ref({});
+const onineClass=ref({})
 
 const initData = () => {
-  let data = {
-    
+  let transData = {
+    year:'2023'
   };
 
   _request({
-    baseURL:"https://jsonplaceholder.typicode.com",
-    url: '/posts',
-    data:{},
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    baseURL:window.GLOBAL_CONFIG.api,
+    url: "/openapi/chart/home_data.php",
+    data:transData,
   })
     .then(res => {
-    console.log(res,"987978")
+      if (res.code == "1") {
+        AllResponse.value = res.data;
+        left_top_ecahrtsData.value=res.data.left_top_ecahrtsData
+
+
+        middle_top_data.value = res.data.middle_top_data;
+        left_baseShow.value = res.data.middle_bottom_data.left_baseShow;
+        onineClass.value = res.data.middle_bottom_data.onineClass;
+      }
     })
   .catch(error=>{console.log(error)})
 }
@@ -55,7 +56,7 @@ initData();
   <div class="flex justify-between">
     <div class="h-full flex flex-col justify-between" style="width: 25%;">
       <div class="border border-hex-0A337E bg-block p-4  h-1/2">
-        <radars />
+        <radars :ecahrtsData="left_top_ecahrtsData" />
       </div>
       <div class="border border-hex-0A337E bg-block mt-4 h-1/2">
         <bar1 />
@@ -66,23 +67,23 @@ initData();
         <div class="flex flex-col">
           <div class="flex items-end mb-2">
             <div class="w-140px text-right">全市学校数:</div>
-            <div class="text-28px mr-1">40</div>
+            <div class="text-28px mr-1">{{ middle_top_data.allSchoolNum }}</div>
             <div>个</div>
           </div>
           <div class="flex items-end mb-2">
             <div class="w-140px text-right">全市学校班级数:</div>
-            <div class="text-28px mr-1">1326</div>
+            <div class="text-28px mr-1">{{middle_top_data.allCitySchoolNum }}</div>
             <div>个</div>
           </div>
           <div class="flex items-end mb-2">
             <div class="w-140px text-right">结对学校数:</div>
-            <div class="text-28px mr-1">12</div>
-            <div>个(市外:3个)</div>
+            <div class="text-28px mr-1">{{middle_top_data.linkSchool }}</div>
+            <div>个(市外:{{middle_top_data.outlinkSchool}}个)</div>
           </div>
           <div class="flex items-end mb-2">
             <div class="w-140px text-right">结对教师数:</div>
-            <div class="text-28px mr-1">75</div>
-            <div>个(市外:20个)</div>
+            <div class="text-28px mr-1">{{middle_top_data.linkTeacher }}</div>
+            <div>个(市外:{{middle_top_data.outLinkTeacher}}个)</div>
           </div>
         </div>
 
@@ -92,11 +93,11 @@ initData();
               缺少专职美术教师学校数:
             </div>
             <div class="text-28px mr-1">
-              7
+              {{ middle_top_data.lackschool }}
             </div>
             <div>个</div>
             <div class="text-xs text-hex-16F5FF flex-auto text-right mr-2">
-              百分比17.5%
+              百分比{{ middle_top_data.lackschoolPercent }}
             </div>
           </div>
           <div class="flex items-end mb-2">
@@ -104,11 +105,11 @@ initData();
               缺少专职美术教师学校班级数:
             </div>
             <div class="text-28px mr-1">
-              327
+              {{ middle_top_data.lackClassNum }}
             </div>
             <div>个</div>
             <div class="text-xs text-hex-16F5FF flex-auto text-right mr-2">
-              百分比24.6%
+              百分比{{ middle_top_data.lackClassNumPercent }}
             </div>
           </div>
           <div class="flex items-end mb-2">
@@ -116,26 +117,26 @@ initData();
               结对班级数:
             </div>
             <div class="text-28px mr-1">
-              60
+              {{ middle_top_data.linkClass }}
             </div>
-            <div>个 ( 市外:14个 )</div>
+            <div>个 ( 市外:{{middle_top_data.outLinkClass}}个 )</div>
           </div>
           <div class="flex items-end mb-2">
             <div class="w-240px text-right">
               结对学生数:
             </div>
             <div class="text-28px mr-1">
-              2480
+              {{ middle_top_data.linkStudentNum }}
             </div>
-            <div>个 ( 市外:144个 )</div>
+            <div>个 ( 市外:{{middle_top_data.outLinkStudentNum}}个 )</div>
           </div>
         </div>
       </div>
       <geoblock />
 
       <div class="flex justify-between h-240px">
-        <blocks class="w-557px border border-hex-0A337E bg-block py-6 px-8 mr-4" />
-        <scrollblock />
+        <blocks :objectPackbage="left_baseShow" class="w-557px border border-hex-0A337E bg-block py-6 px-8 mr-4" />
+        <scrollblock :objectPackbageOne="onineClass.ZaiXian_XunKe_table" />
       </div>
     </div>
     <div class="h-full flex flex-col justify-between" style="width: 25%;">