login.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <div @click="tologin">登录</div>
  3. <h2> {{ store.name }}</h2>
  4. <h1 @click="changeName">修改名称</h1>
  5. <el-tree :data="data" :props="defaultProps" @node-click="handleNodeClick" />
  6. <div @click="networkRequest()">点击发起网络请求</div>
  7. <div class="abc fonsSize30">测试sass样式</div>
  8. <div class="text-pink-200">1111</div>
  9. <div :style="{ width: '1230px', height: '350px' }">
  10. <Echarts :option="option" />
  11. </div>
  12. </template>
  13. <script lang="ts" setup>
  14. import { reactive } from 'vue';
  15. import Echarts from '@/components/ReEcharts/index.vue';
  16. import { useRoute, useRouter } from 'vue-router'
  17. import { useStore } from "../store/index";
  18. import { post } from '@/utils/request'
  19. const router = useRouter()
  20. const store = useStore()
  21. function tologin() {
  22. router.push({
  23. name: 'index'
  24. })
  25. }
  26. function changeName(): void {
  27. store.name = '索索'
  28. }
  29. async function networkRequest(): Promise<void> {
  30. console.log('发起请求')
  31. const requestUrl = '/user/loginAdmin'
  32. const data = {
  33. username: '18130408100',
  34. password: '220926'
  35. }
  36. // proxy.$post(requestUrl, data)
  37. // .then((response: any) => {
  38. // console.log(response, '<=== 请求返回的数据')
  39. // })
  40. const res = await post(requestUrl, data)
  41. console.log(res, '<=== 请求返回的数据')
  42. }
  43. interface Tree {
  44. label: string
  45. children?: Tree[]
  46. }
  47. const handleNodeClick = (data: Tree) => {
  48. console.log(data)
  49. }
  50. const data: Tree[] = [
  51. {
  52. label: 'Level one 1',
  53. children: [
  54. {
  55. label: 'Level two 1-1',
  56. children: [
  57. {
  58. label: 'Level three 1-1-1',
  59. },
  60. ],
  61. },
  62. ],
  63. },
  64. {
  65. label: 'Level one 2',
  66. children: [
  67. {
  68. label: 'Level two 2-1',
  69. children: [
  70. {
  71. label: 'Level three 2-1-1',
  72. },
  73. ],
  74. },
  75. {
  76. label: 'Level two 2-2',
  77. children: [
  78. {
  79. label: 'Level three 2-2-1',
  80. },
  81. ],
  82. },
  83. ],
  84. },
  85. {
  86. label: 'Level one 3',
  87. children: [
  88. {
  89. label: 'Level two 3-1',
  90. children: [
  91. {
  92. label: 'Level three 3-1-1',
  93. },
  94. ],
  95. },
  96. {
  97. label: 'Level two 3-2',
  98. children: [
  99. {
  100. label: 'Level three 3-2-1',
  101. },
  102. ],
  103. },
  104. ],
  105. },
  106. ]
  107. const defaultProps = {
  108. children: 'children',
  109. label: 'label',
  110. }
  111. const option = reactive({
  112. tooltip: {
  113. trigger: 'axis',
  114. axisPointer: {
  115. type: 'shadow',
  116. label: {
  117. show: true
  118. }
  119. }
  120. },
  121. grid: {
  122. left: '4%',
  123. top: '15%',
  124. right: '4%',
  125. bottom: '10%'
  126. },
  127. legend: {
  128. data: ['昨日总人数', '今日实时人数'],
  129. top: '4%',
  130. color: '#1FC3CE',
  131. fontSize: 14,
  132. selected: { 昨日使用率: false } // 不需要显示的设置为false
  133. },
  134. xAxis: {
  135. data: [
  136. '会议室1',
  137. '会议室2',
  138. '会议室3',
  139. '会议室4',
  140. '会议室5',
  141. '会议室6',
  142. '会议室7',
  143. '会议室8',
  144. '会议室9'
  145. ],
  146. axisLine: {
  147. show: true, //隐藏X轴轴线
  148. lineStyle: {
  149. color: '#eee',
  150. width: 1
  151. }
  152. },
  153. axisTick: {
  154. show: true, //隐藏X轴刻度
  155. alignWithLabel: true
  156. },
  157. axisLabel: {
  158. show: true,
  159. color: '#333', //X轴文字颜色
  160. fontSize: 14
  161. }
  162. },
  163. yAxis: [
  164. {
  165. type: 'value',
  166. name: '人数',
  167. nameTextStyle: {
  168. color: '#333',
  169. fontSize: 14
  170. },
  171. splitLine: {
  172. show: true,
  173. lineStyle: {
  174. width: 1,
  175. color: '#eee'
  176. }
  177. },
  178. axisTick: {
  179. show: false
  180. },
  181. axisLine: {
  182. show: false
  183. },
  184. axisLabel: {
  185. show: true,
  186. color: '#333',
  187. fontSize: 14
  188. }
  189. }
  190. ],
  191. series: [
  192. {
  193. name: '昨日总人数',
  194. type: 'bar',
  195. barWidth: 18,
  196. itemStyle: {
  197. color: {
  198. type: 'linear',
  199. x: 0, // 右
  200. y: 1, // 下
  201. x2: 0, // 左
  202. y2: 0, // 上
  203. colorStops: [
  204. {
  205. offset: 0,
  206. color: '#F89898' // 0% 处的颜色
  207. },
  208. {
  209. offset: 1,
  210. color: '#F56C6C' // 100% 处的颜色
  211. }
  212. ]
  213. }
  214. },
  215. data: [24, 45, 43, 35, 76, 154, 86, 42, 68]
  216. },
  217. {
  218. name: '今日实时人数',
  219. type: 'bar',
  220. barWidth: 18,
  221. itemStyle: {
  222. color: {
  223. type: 'linear',
  224. x: 0, // 右
  225. y: 1, // 下
  226. x2: 0, // 左
  227. y2: 0, // 上
  228. colorStops: [
  229. {
  230. offset: 0,
  231. color: '#52A7FF' // 0% 处的颜色
  232. },
  233. {
  234. offset: 1,
  235. color: '#409EFF' // 100% 处的颜色
  236. }
  237. ]
  238. }
  239. },
  240. data: [133, 23, 114, 67, 89, 35, 67, 96, 90]
  241. }
  242. ]
  243. });
  244. </script>
  245. <style lang="scss" scoped></style>