123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template>
- <div @click="tologin">登录</div>
- <h2> {{ store.name }}</h2>
- <h1 @click="changeName">修改名称</h1>
- <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" />
- <div @click="networkRequest()">点击发起网络请求</div>
- <div class="abc fonsSize30">测试sass样式</div>
- <div class="text-pink-200">1111</div>
- <div :style="{ width: '1230px', height: '350px' }">
- <Echarts :option="option" />
- </div>
- </template>
- <script lang="ts" setup>
- import { reactive } from 'vue';
- import Echarts from '@/components/ReEcharts/index.vue';
- import { useRoute, useRouter } from 'vue-router'
- import { useStore } from "../store/index";
- import { post } from '@/utils/request'
- const router = useRouter()
- const store = useStore()
- function tologin() {
- router.push({
- name: 'index'
- })
- }
- function changeName(): void {
- store.name = '索索'
- }
- async function networkRequest(): Promise<void> {
- console.log('发起请求')
- const requestUrl = '/user/loginAdmin'
- const data = {
- username: '18130408100',
- password: '220926'
- }
- // proxy.$post(requestUrl, data)
- // .then((response: any) => {
- // console.log(response, '<=== 请求返回的数据')
- // })
- const res = await post(requestUrl, data)
- console.log(res, '<=== 请求返回的数据')
- }
- interface Tree {
- label: string
- children?: Tree[]
- }
- const handleNodeClick = (data: Tree) => {
- console.log(data)
- }
- const data: Tree[] = [
- {
- label: 'Level one 1',
- children: [
- {
- label: 'Level two 1-1',
- children: [
- {
- label: 'Level three 1-1-1',
- },
- ],
- },
- ],
- },
- {
- label: 'Level one 2',
- children: [
- {
- label: 'Level two 2-1',
- children: [
- {
- label: 'Level three 2-1-1',
- },
- ],
- },
- {
- label: 'Level two 2-2',
- children: [
- {
- label: 'Level three 2-2-1',
- },
- ],
- },
- ],
- },
- {
- label: 'Level one 3',
- children: [
- {
- label: 'Level two 3-1',
- children: [
- {
- label: 'Level three 3-1-1',
- },
- ],
- },
- {
- label: 'Level two 3-2',
- children: [
- {
- label: 'Level three 3-2-1',
- },
- ],
- },
- ],
- },
- ]
- const defaultProps = {
- children: 'children',
- label: 'label',
- }
- const option = reactive({
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'shadow',
- label: {
- show: true
- }
- }
- },
- grid: {
- left: '4%',
- top: '15%',
- right: '4%',
- bottom: '10%'
- },
- legend: {
- data: ['昨日总人数', '今日实时人数'],
- top: '4%',
- color: '#1FC3CE',
- fontSize: 14,
- selected: { 昨日使用率: false } // 不需要显示的设置为false
- },
- xAxis: {
- data: [
- '会议室1',
- '会议室2',
- '会议室3',
- '会议室4',
- '会议室5',
- '会议室6',
- '会议室7',
- '会议室8',
- '会议室9'
- ],
- axisLine: {
- show: true, //隐藏X轴轴线
- lineStyle: {
- color: '#eee',
- width: 1
- }
- },
- axisTick: {
- show: true, //隐藏X轴刻度
- alignWithLabel: true
- },
- axisLabel: {
- show: true,
- color: '#333', //X轴文字颜色
- fontSize: 14
- }
- },
- yAxis: [
- {
- type: 'value',
- name: '人数',
- nameTextStyle: {
- color: '#333',
- fontSize: 14
- },
- splitLine: {
- show: true,
- lineStyle: {
- width: 1,
- color: '#eee'
- }
- },
- axisTick: {
- show: false
- },
- axisLine: {
- show: false
- },
- axisLabel: {
- show: true,
- color: '#333',
- fontSize: 14
- }
- }
- ],
- series: [
- {
- name: '昨日总人数',
- type: 'bar',
- barWidth: 18,
- itemStyle: {
- color: {
- type: 'linear',
- x: 0, // 右
- y: 1, // 下
- x2: 0, // 左
- y2: 0, // 上
- colorStops: [
- {
- offset: 0,
- color: '#F89898' // 0% 处的颜色
- },
- {
- offset: 1,
- color: '#F56C6C' // 100% 处的颜色
- }
- ]
- }
- },
- data: [24, 45, 43, 35, 76, 154, 86, 42, 68]
- },
- {
- name: '今日实时人数',
- type: 'bar',
- barWidth: 18,
- itemStyle: {
- color: {
- type: 'linear',
- x: 0, // 右
- y: 1, // 下
- x2: 0, // 左
- y2: 0, // 上
- colorStops: [
- {
- offset: 0,
- color: '#52A7FF' // 0% 处的颜色
- },
- {
- offset: 1,
- color: '#409EFF' // 100% 处的颜色
- }
- ]
- }
- },
- data: [133, 23, 114, 67, 89, 35, 67, 96, 90]
- }
- ]
- });
- </script>
- <style lang="scss" scoped></style>
|