首页 > 其他分享 >2024.02.29

2024.02.29

时间:2024-02-29 20:25:02浏览次数:21  
标签:el return 2024.02 res request 29 important menu

今天主要将昨天没开发完的前端vue模板补全,然后学习了vue结合springboot完成前后端数据交互(封装axios http请求工具JS)Json数据

vue模板

<template>
  <div>
    <el-container>
      <!--      侧边栏-->
      <el-aside :width="asideWith" style="min-height: 100vh; background-color: #001529">
        <div style="height: 60px;  color: white; display: flex; align-items: center; justify-content: center">
          <img src="@/assets/logo.png" alt="" style="width: 40px; height: 40px">
          <br>
          <span class="logo-title" v-show="!isCollapse">2024Vue管理项目</span>
        </div>

        <el-menu :collapse="isCollapse" router background-color="#001529" text-color="rgba(255,255,255,0.65)"
                 active-text-color="#fff" style="border: none" :default-active="$route.path">
          <el-menu-item index="/">
            <i class="el-icon-house"></i>
            <span slot="title">系统首页</span>
          </el-menu-item>
          <el-menu-item index="/1">
            <template slot="title">
              <i class="el-icon-house"></i>
              <span>测试1</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/2">
            <template slot="title">
              <i class="el-icon-house"></i>
              <span>测试2</span>
            </template>
          </el-menu-item>
          <el-menu-item index="/element">Element页面</el-menu-item>

          <el-submenu index="/4">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>信息管理</span>
            </template>
            <el-menu-item>用户信息</el-menu-item>
            <el-menu-item>管理员信息</el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>


      <el-container>
        <!--        头部区域-->
        <el-header>
          <i :class="collapseIcon" style="font-size: 26px" @click="handleCollapse"></i>
          <el-breadcrumb separator-class="el-icon-arrow-right" style="margin-left: 20px">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item :to="{path: '/user'}">用户管理</el-breadcrumb-item>
          </el-breadcrumb>

          <div style="flex: 1;width: 0;display: flex; align-items: center; justify-content: right">
            <i class="el-icon-quanping" style="font-size: 26px;" @click="handleFull"></i>
            <el-dropdown placement="bottom">
              <div style="display: flex; align-items: center; cursor: default">
                <img src="@/assets/logo.png" alt="" style="width: 40px; height: 40px; margin:0 5px">
                <span>管理员</span>
              </div>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item @click="">个人信息</el-dropdown-item>
                <el-dropdown-item @click="">修改密码</el-dropdown-item>
                <el-dropdown-item @click="">退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>

        </el-header>
        <!--        主体区域-->
        <el-main>
          <div style="box-shadow: 0 0 10px rgba(0,0,0,.1); padding: 10px 20px; border-radius: 5px; margin-bottom: 10px">
            欲买桂花同载酒,终不似,少年游。
          </div>
          <el-card style="width: 500px">
            <div slot="header" class="clearfix">
              <span>好好学习,天天向上</span>
            </div>
            <div>
              2024加油昂,新学期新气象嘞;
              <div style="margin-top: 20px">
                <div style="margin: 10px 0"><strong>主题色</strong></div>
                <el-button type="primary">按钮</el-button>
                <el-button type="success">按钮</el-button>
                <el-button type="warning">按钮</el-button>
                <el-button type="danger">按钮</el-button>
                <el-button type="info">按钮</el-button>
              </div>
            </div>
          </el-card>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
// @ is an alias to /src


export default {
  name: 'HomeView',
  data() {
    return {
      isCollapse: false,
      asideWith: '200px',
      collapseIcon: 'el-icon-s-fold'
    }
  },
  methods: {
    handleCollapse() {
      this.isCollapse = !this.isCollapse;
      this.asideWith = this.isCollapse ? '64px' : '200px'
      this.collapseIcon = this.isCollapse ? 'el-icon-s-unfold' : 'el-icon-s-fold'
    },
    handleFull() {
      document.documentElement.requestFullscreen()
    }
  }
}

</script>

<style>
.el-menu--inline {
  background-color: #000c17 !important;

}

.el-menu--inline .el-menu-item {
  background-color: #000c17 !important;
  padding-left: 49px !important;
}

.el-menu-item:hover, .el-submenu__title:hover {
  color: #fff !important;
}

.el-menu-item.is-active {
  background-color: #40a9ff !important;
  border-radius: 5px !important;
  width: calc(100% - 8px);
  margin-left: 4px;
}

.el-menu-item.is-active i, .el-menu-item.is-active .el-tooltip {
  margin-left: -4px;
}

.el-menu-item {

  height: 40px !important;
  line-height: 40px !important;
}

.el-submenu__title {

  height: 40px !important;
  line-height: 40px !important;
}

.el-submenu__icon-arrow {
  position: relative;
  right: 0;
  top: 2px;
}

.el-aside {
  transition: width .3s;
  box-shadow: 2px 0 6px rgba(0, 21, 41, 35);
}

//头部区域logo区域的样式
.logo-title {
  margin-left: 5px;
  font-size: 15px;
  transition: all .3s;
}

.el-header {
  box-shadow: 2px 0 6px rgba(0, 21, 41, 35);
  display: flex;
  align-items: center;
}
</style>

request.js

import { ElMessage } from 'element-plus'
import router from '../router'
import axios from "axios";

const request = axios.create({
    baseURL: 'http://localhost:8080',
    timeout: 30000  // 后台接口超时时间设置
})

// request 拦截器
// 可以自请求发送前对请求做一些处理
request.interceptors.request.use(config => {
    config.headers['Content-Type'] = 'application/json;charset=utf-8';
    return config
}, error => {
    return Promise.reject(error)
});

// response 拦截器
// 可以在接口响应后统一处理结果
request.interceptors.response.use(
    response => {
        let res = response.data;
        // 如果是返回的文件
        if (response.config.responseType === 'blob') {
            return res
        }
        // 兼容服务端返回的字符串数据
        if (typeof res === 'string') {
            res = res ? JSON.parse(res) : res
        }
        // 当权限验证不通过的时候给出提示
        if (res.code === '401') {
            ElMessage.error(res.msg);
            router.push("/login")
        }
        return res;
    },
        error => {
        console.log('err' + error)
        return Promise.reject(error)
    }
)


export default request

标签:el,return,2024.02,res,request,29,important,menu
From: https://www.cnblogs.com/gyg1222/p/18038832

相关文章

  • 20240229解题报告
    [abc300_e]DiceProduct3很明显,概率是由其因子转移而来的,设\(dp[i]\)表示结果为i的概率,则有转移方程:\[dp_i=\sum_{j=2}^6dp_{\frac{i}{j}}\times\frac{1}{5}\times[i\bmodj=0]\]为什么是从二开始?因为乘1结果不变,不影响概率,所以只有5中情况,因为n很大,所以可以用记忆化搜索......
  • 2024/2/29
    2024/2/29更改策略,记录学习笔记的数量。希望自己能越来越好。能够科学联网真的对学习很重要。保持自己的初心。2.今天下载了Ubuntu(Multipass)3.一些个指令uname-auname--helpUsage:uname[OPTION]...Printcertainsysteminformation.WithnoOPTION,samea......
  • 2.29每日学习
    单位集美大学在Python3.x中可以使用中文作为变量名。TF1-2分数2作者郭晓曦单位集美大学Python变量使用前必须先声明,并且一旦声明就不能在当前作用域内改变其类型。TF1-3分数......
  • 1.29
    第二章主要讲述了主人公李淼经历了一场梦境之后,发现自己竟然获得了编写代码的能力,并开始在梦境中尝试编写代码的故事。梦境中的编程语言在梦境中,李淼发现自己能够使用一种他从未接触过的编程语言进行编写代码。这种编程语言不同于现实中的任何一种编程语言,它具有更高的灵活性和强......
  • 2024-02-29-Linux高级网络编程(3-UDP编程-TFTP、广播、多播)
    3.UDP编程-TFTP、广播、多播3.1TFTP简介、通信过程3.1.1TFTP概述TFTP:简单文件传送协议(TrivialFileTransferProtocol),最初用于引导无盘系统,被设计用来传输小文件特点:基于UDP实现,不进行用户有效性认证数据传输模式:octet:二进制模式netascii:文本模式mail:已经不再支持3......
  • 2.29每日总结
    今天课上学习了软件测试的知识在软件开发过程中,测试是一个非常重要的环节。通过测试可以有效地发现程序中的缺陷和bug,并提前解决这些问题,从而保证软件的质量和稳定性。软件测试根据不同的目的和方法可以分为多种类型,下面我们来看一下软件测试的分类。1.功能测试功能测试......
  • 2024-02-29-Linux高级网络编程(2-UDP编程)
    2.UDP编程2.1字节序概述字节序是指多字节数据的存储顺序分类:小端格式:将低位字节数据存储在低地址(LSB)大端格式:将高位字节数据存储在低地址2.1.1如何判断当前系统的字节序#include<stdio.h>unionun{/*data*/inta;charb;};intmain(intargc......
  • Codeforce Round 929(Div.3)
    CodeforcesRound929(Div.3)刷题记录A.TurtlePuzzle:RearrangeandNegate//Problem:A.TurtlePuzzle:RearrangeandNegate//Contest:Codeforces-CodeforcesRound929(Div.3)//URL:https://codeforces.com/contest/1933/problem/0//MemoryLimit:256MB......
  • Codeforces Round 929 (Div. 3)
    CodeforcesRound929(Div.3)A-TurtlePuzzle:RearrangeandNegate代码:#include<bits/stdc++.h>usingnamespacestd;usingll=longlong;usingpii=pair<ll,ll>;#definefifirst#definesesecondusingi128=__int128_t;usingpiii=pa......
  • 1.29
    整合redis 2.引入redis起步依赖我们可以在创建工程的时候就直接引入redis,选择NoSQL,选择第一个创建完成后,我们可以在pom文件中看到redis的依赖 ......