la %!s(int64=2) %!d(string=hai) anos
pai
achega
ccfd1fb502
Modificáronse 4 ficheiros con 80 adicións e 54 borrados
  1. 6 2
      public/config.js
  2. 64 37
      src/pages/txwx.index.vue
  3. 4 9
      src/pages/txwx/bar.vue
  4. 6 6
      src/pages/txwx/lines.vue

+ 6 - 2
public/config.js

@@ -4,16 +4,19 @@ const local = {
   web_mobile: 'https://tyyxm.bozedu.top/',
   api: 'https://tyyxopenapi.bozedu.top/',
   oss: 'https://tyyxopenapi.bozedu.top/',
+  txwxapi:'https://txwxopenapi.bozedu.top/',
   origin: window.location.origin,
 }
 
+
 // 测试服环境
 const development = {
   web_pc: 'https://tyyx.bozedu.top/',
   web_mobile: 'https://tyyxm.bozedu.top/',
   origin: window.location.origin,
   api: 'https://tyyxopenapi.bozedu.top/',
-  oss: 'https://tyyxopenapi.bozedu.top/'
+  oss: 'https://tyyxopenapi.bozedu.top/',
+  txwxapi:'https://txwxopenapi.bozedu.top/',
 }
 // 演示服环境
 const demo = {
@@ -29,7 +32,8 @@ const production = {
   web_mobile: 'https://tyyxm.txhlwxx.com/',
   origin: window.location.origin,
   api: 'https://tyyxopenapi.txhlwxx.com/',
-  oss: 'https://tyyxopenapi.txhlwxx.com/'
+  oss: 'https://tyyxopenapi.txhlwxx.com/',
+  txwxapi:'https://txwxopenapi.txhlwxx.com',
 }
 
 function isWhich() {

+ 64 - 37
src/pages/txwx.index.vue

@@ -1,55 +1,82 @@
 <script setup lang="ts">
-// import geoblock from './home/geoblock.vue'
+import _request from '../utils/request';
+
 import bar from './txwx/bar.vue'
 import lines from './txwx/lines.vue'
+
 import geo from '~/assets/img/home/geo.png'
 import under from '~/assets/img/home/under.webp'
 import stu from '~/assets/img/home/stu.webp'
 
-const b1data = $ref([
-  { title: '教师数量', num: '4366', unit: '人' },
-  { title: '学生数量', num: '111', unit: '人' },
-  { title: '学校数量', num: '111', unit: '人' },
-  { title: '名师总数', num: '11', unit: '所' },
-  { title: '上传资源总数', num: '111', unit: '人' },
-  { title: '教师直播次数', num: '111', unit: '次' },
-])
-
-const b3data = $ref([
-  ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
-  ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
-  ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
-  ['桐乡市第十中学桐乡市第十中学桐乡市第十中学桐乡市第十中学', '第一名', '2345人', '1.5W'],
-  ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
-])
-
-const b4data = $ref([
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-])
-// const b5data = $ref([
+
+
+// const b1data = $ref([
+//   { title: '教师数量', num: '4366', unit: '人' },
+//   { title: '学生数量', num: '111', unit: '人' },
+//   { title: '学校数量', num: '111', unit: '人' },
+//   { title: '名师总数', num: '11', unit: '所' },
+//   { title: '上传资源总数', num: '111', unit: '人' },
+//   { title: '教师直播次数', num: '111', unit: '次' },
+// ])
+
+// const b3data = $ref([
+//   ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
+//   ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
+//   ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
+//   ['桐乡市第十中学桐乡市第十中学桐乡市第十中学桐乡市第十中学', '第一名', '2345人', '1.5W'],
+//   ['桐乡市第十中学', '第一名', '2345人', '1.5W'],
+// ])
+
+// const b4data = $ref([
 //   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
 //   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
 //   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
 // ])
-// const b6data = $ref([
+
+// const b7data = $ref([
 //   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
 //   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
 //   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
 // ])
-const b7data = $ref([
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-])
-const b8data = $ref([
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-  ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
-])
+// const b8data = $ref([
+//   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
+//   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
+//   ['张大大', '桐乡市第十中学', '第一名', '1.5W'],
+// ])
+
 
+const b1data = ref("");
+const b3data = ref("");
+const b4data = ref("");
+const b7data = ref("");
+const b8data = ref("");
+const barEchartsData = ref('');
+const lineEchartsData = ref('');
+const initData =  () => {
+   _request({
+    headers: {
+      'Content-Type': 'application/x-www-form-urlencoded',
+    },
+    baseURL:window.GLOBAL_CONFIG.txwxapi,
+    url: "/openapi/chart/index_data.php",
+    data:{},
+  })
+    .then(res => {
+      if (res.code == '1') {
+        console.log(res, "67567");
+        b1data.value = res.data.b1data;
+        b3data.value = res.data.b3data;
+        b4data.value = res.data.b4data;
+        b7data.value = res.data.b7data;
+        b8data.value = res.data.b8data;
+        barEchartsData.value = res.data.barEchartsData;
+        lineEchartsData.value = res.data.lineEchartsData;
 
+      }
+    })
+  .catch(error=>{console.log(error)})
+}
+ initData();
 
 
 const router = useRouter()
@@ -125,7 +152,7 @@ function go(name: string) {
         </div>
 
         <div class="w-full h-400px">
-          <bar />
+          <bar v-if="barEchartsData" :echarts-data="barEchartsData" />
         </div>
       </div>
       <div class="border border-hex-0A337E bg-block p-3 h-full" style="width:33%;">
@@ -134,7 +161,7 @@ function go(name: string) {
           <img class="h-7px" :src="under">
         </div>
         <div class="w-full h-400px">
-          <lines />
+          <lines v-if="lineEchartsData" :echarts-data="lineEchartsData" />
         </div>
       </div>
       <div class=" h-full flex flex-col justify-between" style="width:33%;">

+ 4 - 9
src/pages/txwx/bar.vue

@@ -1,5 +1,8 @@
 <script setup lang="ts">
 import * as echarts from 'echarts'
+const props = defineProps<{
+  echartsData: object
+}>()
 
 const chartRef = ref()
 onMounted(() => {
@@ -20,15 +23,7 @@ onMounted(() => {
     },
     color: ['#7D7CFC', '#0293FD'],
     dataset: {
-      source: [
-        ['date', '浏览量', '点赞量'],
-        ['名师资源', 1080, 2800],
-        ['名师在线', 2060, 2100],
-        ['直播课程', 2800, 1800],
-        ['家庭教育', 2600, 1800],
-        ['特色课程', 3100, 11000],
-        ['作业辅导', 3000, 1000],
-      ],
+      source: props.echartsData.dataset_source,
     },
     xAxis: {
       type: 'category',

+ 6 - 6
src/pages/txwx/lines.vue

@@ -1,6 +1,10 @@
 <script setup lang="ts">
 import * as echarts from 'echarts'
 
+const props = defineProps<{
+  echartsData: object
+}>()
+
 const chartRef = ref()
 onMounted(() => {
   echarts.init(chartRef.value).setOption({
@@ -48,7 +52,7 @@ onMounted(() => {
         },
       },
       boundaryGap: false,
-      data: ['12-11', '12-11', '12-11', '12-11', '12-11', '12-11', '12-11', '12-11'],
+      data: props.echartsData.xAxis_data,
     },
     yAxis: {
       type: 'value',
@@ -68,11 +72,7 @@ onMounted(() => {
         },
       },
     },
-    series: [
-      { type: 'line', name: '总用户', smooth: true, symbolSize: 12, itemStyle: { borderWidth: 2 }, lineStyle: { width: 6 }, data: [42, 46, 51, 53, 57, 61, 73, 71, 81], areaStyle: { opacity: 0.2 } },
-      { type: 'line', name: '教师', smooth: true, symbolSize: 12, itemStyle: { borderWidth: 2 }, lineStyle: { width: 6 }, data: [14, 26, 39, 43, 55, 57, 61, 69, 63], areaStyle: { opacity: 0.2 } },
-      { type: 'line', name: '学生', smooth: true, symbolSize: 12, itemStyle: { borderWidth: 2 }, lineStyle: { width: 6 }, data: [19, 23, 28, 32, 37, 42, 44, 51, 66], areaStyle: { opacity: 0.2 } },
-    ],
+    series: props.echartsData.series,
 
   })
 })