day03-主页模块-修改密码

news2024/7/7 16:40:30

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档

文章目录

  • 1.获取用户资料在Vuex中共享
    • 登录成功跳转到主页之后,可以获取用户资料,获取的资料在Vuex中共享,这样用户就可以很方便的获取该信息
        • 获取流程
        • 在什么位置获取
        • 在导航守卫的位置,可以确定已经有了token,获取资料更佳,在页面发生跳转时触发,此时不论你从何时何地进来,如果发现没获取资料,都可以清楚直观的获取资料。判断条件也使得不会发生重复的加载。
        • 获取用户资料的api(src/api/user.js)
        • Vuex中声明用户信息状态,修改用户信息的mutations,和获取用户信息的action src/store/modules/user.js
        • 通过getters声明userId(快捷访问)-代码位置src/store/getters.js
        • 在权限拦截处调用action-代码位置(src/pemission.js)
  • 2、显式用户头像和用户名
        • 顶部组件的内部位置
        • Vuex中已经有用户资料数据,可以通过getters开发属性,直接在组件中引用即可
        • 位置src/store/getters.js 暴露属性
        • 在Navbar组件引入getters-代码位置(src/layout/components/NavBar.vue)
        • NavBar组件显示用户名和头像-代码位置(src/layout/components/NavBar.vue)
        • 🍕🍕🍕设置头像和用户名的样式-代码位置(src/layout/components/NavBar.vue)
  • 3、处理头像为空的场景
        • 🚜🚜🚜当用户没有头像时要显示用户名的第一个字
        • 🍳🍳🍳条件判断-代码位置(src/layout/components/NavBar.vue)
        • 🧀🧀🧀 ?可选链操作符,是当?前面的变量为空时,不会继续往下执行,防止报错,如果版本不支持?的编译,需升级版本
  • 4.处理token失效的问题
        • token是有时效性的,当token超时,我们需要做一下处理
        • 🌮请求拦截器处理-代码位置(src/utils/request.js)
        • 实现Vuex的登出action-代码位置(src/store/modules/user.js)
  • 5.调整下拉菜单,实现退出登录
        • 退出登录流程
        • Navbar中点击退出登录-代码位置(src/layout/components/NavBar.vue)
        • 退出方法-代码位置(src/layout/components/NavBar.vue)
        • 注意:native修饰符表示给组件的根元素注册事件
  • 6.修改密码功能实现
        • 整体流程
    • 6.1-修改密码-弹出层
        • 🍿🍿🍿注册修改密码点击事件-代码位置(src/layout/components/NavBar.vue)
        • 声明变量和方法控制弹层显示-代码位置
        • 放置弹层组件-代码位置(src/layout/components/NavBar.vue)
  • 6.2-修改密码-表单结构
        • 表单结构-代码位置(src/layout/components/NavBar.vue)
  • 6.3修改密码-表单校验
        • 声明数据和规则-代码位置(src/layout/components/NavBar.vue)
        • 绑定属性-代码位置(src/layout/components/NavBar.vue)
  • 6.4-修改密码-确定和取消
        • 确定和取消流程
        • 修改密码方法-代码位置(src/api/user.js)
        • 确定方法-代码位置(src/layout/components/NavBar.vue)
        • 取消方法-代码位置(src/layout/components/NavBar.vue)
        • 监听弹层关闭事件
        • 这里确定修改关闭弹窗,监听close事件,将表单进行重置,修改了信息,再打开的时候这些信息应该都被重置
  • 7. 清理组件和路由
        • 路由只保留登录-主页-404
        • 请求模块只保留user.js模块
  • 8.创建项目所需要的组件和路由
        • 创建模块
        • 路由模块样例
        • 路由的统一导入
        • 在src/router/index.js中集成到当前路由中
  • 9.扩展-解析左侧菜单原理
        • 左侧菜单的数据来源于路由模块的信息, 会根据路由信息的hidden属性来判断是否显示该路由信息到菜单,菜单属性中的图表和标题来源于路由meta中的icon和title属性
        • sidebar组件引入路由信息![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/4e4c164dcf474af5810d769cefa411e3.png)
        • 循环渲染路由信息
        • sidebarItem组件根据条件渲染-传递icon和title属性给item组件
        • item组件接收icon和title属性,使用函数型组件完成渲染
  • 10.左侧菜单显示项目logo
        • ogo有两种展示形态,当菜单展开时,显示大图,当菜单折叠时,显示小图
        • 通过settings.js的设置,将logo显示出来-代码位置(src/settings.js)
        • 调整logo的页面结构-代码位置(src/layout/components/Sidebar/Logo.vue)
        • 调整logo样式-代码位置(src/layout/components/Sidebar/Logo.vue


1.获取用户资料在Vuex中共享

提示:这里可以添加本文要记录的大概内容:

登录成功跳转到主页之后,可以获取用户资料,获取的资料在Vuex中共享,这样用户就可以很方便的获取该信息

获取流程

在这里插入图片描述

在什么位置获取

在这里插入图片描述

在导航守卫的位置,可以确定已经有了token,获取资料更佳,在页面发生跳转时触发,此时不论你从何时何地进来,如果发现没获取资料,都可以清楚直观的获取资料。判断条件也使得不会发生重复的加载。
获取用户资料的api(src/api/user.js)
export function getUserInfo(){
  return request({
    url:'/sys/profile'
  })
}
Vuex中声明用户信息状态,修改用户信息的mutations,和获取用户信息的action src/store/modules/user.js
const state = {
  token:getToken(),
  userInfo:{}//这里一个空对象,为了防止后面取数据报错
}
const mutations = {
 setUserInfo(state,userInfo){
   state.userInfo = userInfo
  }
}
const actions = {
  async getUserInfo(context){
    const result = await getUserInfo();
    context.commit("setUserInfo",result)
   }
}
通过getters声明userId(快捷访问)-代码位置src/store/getters.js
const getters = {
	userId: state => state.user.userInfo.userId,
}
export default getters
在权限拦截处调用action-代码位置(src/pemission.js)
import router from '@/router'
import nprogress from 'nprogress'
import 'nprogress/nprogress.css'
import store from '@/store'
/**
 *前置守卫
 *
*/
const whiteList = ['/login', '/404']
router.beforeEach(async(to,from,nex)=>{
 nprogress.start()
 if(store.getters.token){
  //存在token
  if(to.path === '/login'){
    //跳转到主页
    next('/');//中转到主页 不传地址 不会执行后置守卫
    nprogress.done()
   }else{
      if(!store.getters.userId){
        await store.dispatch("user/getUserInfo") 
      }
      next()//放行
    }
 }else{
   //没有token
   if(whiteList.includes(to.path)){
    next();
    }else{
      next('/login');//中转到登录页
      nprogress.done()
     }
  }
})

2、显式用户头像和用户名

顶部组件的内部位置

在这里插入图片描述

Vuex中已经有用户资料数据,可以通过getters开发属性,直接在组件中引用即可
位置src/store/getters.js 暴露属性
const getters = {
  token:state => state.user.token,
  userId:state =>state.user.userInfo.userId,//头像
  avatar:state=>state.user.userInfo.username,//用户名称
}
export default getters
在Navbar组件引入getters-代码位置(src/layout/components/NavBar.vue)
export default {
  computed: {
    // 引入头像和用户名称
    ...mapGetters([
      'sidebar',
      'avatar',
      'name'
    ])
  },
}
NavBar组件显示用户名和头像-代码位置(src/layout/components/NavBar.vue)
<div class="avatar-wrapper">
          <!-- 头像 -->
          <img :src="avatar" class="user-avatar">
          <!-- 用户名称 -->
          <span class="name">{{ name }}</span>
          <!-- 图标 -->
          <i class="el-icon-setting" />
</div>
🍕🍕🍕设置头像和用户名的样式-代码位置(src/layout/components/NavBar.vue)
.avatar-wrapper {
        margin-top: 5px;
        position: relative;
        display: flex;
        align-items: center;
        .name {
          //  用户名称距离右侧距离
          margin-right: 10px;
          font-size: 16px;
        }
        .el-icon-setting {
          font-size: 20px;
        }
        .user-avatar {
          cursor: pointer;
          width: 30px;
          height: 30px;
          border-radius: 50%;
        }
      }

3、处理头像为空的场景

🚜🚜🚜当用户没有头像时要显示用户名的第一个字
🍳🍳🍳条件判断-代码位置(src/layout/components/NavBar.vue)
<div class="avatar-wrapper">
          <!-- 头像 -->
          <img v-if="avatar" :src="avatar" class="user-avatar">
          <span v-else class="username">{{ name?.charAt(0) }}</span>
          <!-- 用户名称 -->
          <span class="name">{{ name }}</span>
          <!-- 图标 -->
          <i class="el-icon-setting" />
        </div>
 <style>
   .username {
          width: 30px;
          height: 30px;
          text-align: center;
          line-height: 30px;
          border-radius: 50%;
          background: #04c9be;
          color: #fff;
          margin-right: 4px;
        }
</style>
🧀🧀🧀 ?可选链操作符,是当?前面的变量为空时,不会继续往下执行,防止报错,如果版本不支持?的编译,需升级版本
npm i vue@2.7.0  vue-template-compiler@2.7.0   # 升级vue版本️

4.处理token失效的问题

token是有时效性的,当token超时,我们需要做一下处理

在这里插入图片描述

🌮请求拦截器处理-代码位置(src/utils/request.js)
//响应拦截器
service.interceptors.response.use(...,async(error)=>{
  if(error.response.status === 401){
    Message({type:'warning',message:'token超时了'})
   //说明token超时
   await store.dispatch('user/logout')//调用action退出登录
   router.push('/login');//跳转到登录页
   return Promise.reject(error)
   }
   //error.message
   Message.error(error.message)
   return Promise.reject(error)
})
实现Vuex的登出action-代码位置(src/store/modules/user.js)
const actions = {
  //退出登录
  logout(context){
    context.commit('removeToken');//删除token
    context.commit('setUserInfo',{});//设置用户信息为空对象 
  }
}

5.调整下拉菜单,实现退出登录

在这里插入图片描述

退出登录流程

在这里插入图片描述

Navbar中点击退出登录-代码位置(src/layout/components/NavBar.vue)
  <el-dropdown-item @click.native="logout">
          <span style="display:block;">登出</span>
  </el-dropdown-item>
退出方法-代码位置(src/layout/components/NavBar.vue)
export default{
  methods:{
    async logout(){
     //调用退出登录的action
     await this.$store.dispatch('user/logout')
     this.$router.push('/login')
     } 
  }
}
注意:native修饰符表示给组件的根元素注册事件

6.修改密码功能实现

整体流程

在这里插入图片描述
在这里插入图片描述

6.1-修改密码-弹出层

🍿🍿🍿注册修改密码点击事件-代码位置(src/layout/components/NavBar.vue)
<!-- prevent阻止默认事件 -->
 <a target="_blank" @click.prevent="updatePassword">
    <el-dropdown-item>修改密码</el-dropdown-item>
 </a>
声明变量和方法控制弹层显示-代码位置

(src/layout/components/NavBar.vue)

export default {
 data(){
  return {
    showDialog:false
   }
  },
  methods:{
    updatePassword(){
      this.showDialog = true
     }
   }
}
放置弹层组件-代码位置(src/layout/components/NavBar.vue)
<el-dialog width="500px" title="修改密码" :visible.sync="showDialog" >
</el-dialog>

6.2-修改密码-表单结构

在这里插入图片描述

表单结构-代码位置(src/layout/components/NavBar.vue)
  <el-form  label-width="120px" >
        <el-form-item label="旧密码" >
          <el-input  show-password size="small" />
        </el-form-item>
        <el-form-item label="新密码" >
          <el-input  show-password size="small" />
        </el-form-item>
        <el-form-item label="重复密码" >
          <el-input  show-password size="small" />
        </el-form-item>
        <el-form-item>
          <el-button size="mini" type="primary" >确认修改</el-button>
          <el-button size="mini" >取消</el-button>
        </el-form-item>
      </el-form>

6.3修改密码-表单校验

在这里插入图片描述

声明数据和规则-代码位置(src/layout/components/NavBar.vue)
export default {
  data () {
    return  {
     passForm: {
        oldPassword: '', // 旧密码
        newPassword: '', // 新密码
        confirmPassword: '' // 确认密码字段
      },
     rules: {
        oldPassword: [{ required: true, message: '旧密码不能为空', trigger: 'blur' }], // 旧密码
        newPassword: [{ required: true, message: '新密码不能为空', trigger: 'blur' }, {
          trigger: 'blur',
          min: 6,
          max: 16,
          message: '新密码的长度为6-16位之间'
        }], // 新密码
        confirmPassword: [{ required: true, message: '重复密码不能为空', trigger: 'blur' }, {
          trigger: 'blur',
          validator: (rule, value, callback) => {
            // value
            if (this.passForm.newPassword === value) {
              callback()
            } else {
              callback(new Error('重复密码和新密码输入不一致'))
            }
          }
        }] // 确认密码字段
      }
    }
  }
}
绑定属性-代码位置(src/layout/components/NavBar.vue)
      <el-form ref="passForm" label-width="120px" :model="passForm" :rules="rules">
        <el-form-item label="旧密码" prop="oldPassword">
          <el-input v-model="passForm.oldPassword" show-password size="small" />
        </el-form-item>
        <el-form-item label="新密码" prop="newPassword">
          <el-input v-model="passForm.newPassword" show-password size="small" />
        </el-form-item>
        <el-form-item label="重复密码" prop="confirmPassword">
          <el-input v-model="passForm.confirmPassword" show-password size="small" />
        </el-form-item>
        <el-form-item>
          <el-button size="mini" type="primary" >确认修改</el-button>
          <el-button size="mini" >取消</el-button>
        </el-form-item>
      </el-form>

6.4-修改密码-确定和取消

确定和取消流程

在这里插入图片描述

修改密码方法-代码位置(src/api/user.js)
/**
 * 更新密码
 * **/
export function updatePassword(data){
  return request({
     url:'/sys/user/updatePass',
     method:'put',
     data
   })
}
确定方法-代码位置(src/layout/components/NavBar.vue)
//确定
btnOk(){
  this.$refs.passForm.validate(async isOk =>{
    if(isOk){
      //调用接口
      await updatePassword(this.passForm)
      this.$message.success('修改密码成功')
      this.btnCancel()
     }
  })
}
取消方法-代码位置(src/layout/components/NavBar.vue)
btnCancel() {
      this.$refs.passForm.resetFields() // 重置表单
      // 关闭弹层
      this.showDialog = false
}
监听弹层关闭事件
    <el-dialog @close="btnCancel" width="500px" title="修改密码" :visible.sync="showDialog" >

这里确定修改关闭弹窗,监听close事件,将表单进行重置,修改了信息,再打开的时候这些信息应该都被重置

7. 清理组件和路由

在这里插入图片描述
在这里插入图片描述

路由只保留登录-主页-404
请求模块只保留user.js模块

8.创建项目所需要的组件和路由

在这里插入图片描述

创建模块

在这里插入图片描述

路由模块样例

在这里插入图片描述

路由的统一导入

在这里插入图片描述

在src/router/index.js中集成到当前路由中

在这里插入图片描述

9.扩展-解析左侧菜单原理

在这里插入图片描述

左侧菜单的数据来源于路由模块的信息, 会根据路由信息的hidden属性来判断是否显示该路由信息到菜单,菜单属性中的图表和标题来源于路由meta中的icon和title属性
sidebar组件引入路由信息在这里插入图片描述
循环渲染路由信息

在这里插入图片描述

sidebarItem组件根据条件渲染-传递icon和title属性给item组件

在这里插入图片描述

item组件接收icon和title属性,使用函数型组件完成渲染

在这里插入图片描述

10.左侧菜单显示项目logo

ogo有两种展示形态,当菜单展开时,显示大图,当菜单折叠时,显示小图

在这里插入图片描述

通过settings.js的设置,将logo显示出来-代码位置(src/settings.js)
sidebarLogo:true
调整logo的页面结构-代码位置(src/layout/components/Sidebar/Logo.vue)
<template>
  <div class="sidebar-logo-container" :class="{'collapse':collapse}">
    <transition name="sidebarLogoFade">
      <router-link key="collapse" class="sidebar-logo-link" to="/">
        <img src="@/assets/common/logo.png" class="sidebar-logo">
      </router-link>
    </transition>
  </div>
</template>
调整logo样式-代码位置(src/layout/components/Sidebar/Logo.vue
<style lang="scss" scoped>
.sidebarLogoFade-enter-active {
  transition: opacity 1.5s;
}

.sidebarLogoFade-enter,
.sidebarLogoFade-leave-to {
  opacity: 0;
}

.sidebar-logo-container {
  position: relative;
  width: 100%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  overflow: hidden;

  & .sidebar-logo-link {
    height: 100%;
    width: 100%;

    & .sidebar-logo {
      width: 140px;
      vertical-align: middle;
      margin-right: 12px;
    }

    & .sidebar-title {
      display: inline-block;
      margin: 0;
      color: #fff;
      font-weight: 600;
      line-height: 50px;
      font-size: 14px;
      font-family: Avenir, Helvetica Neue, Arial, Helvetica, sans-serif;
      vertical-align: middle;
    }
  }

  &.collapse {
    .sidebar-logo {
      margin-right: 0px;
      width: 32px;
      height: 32px;
    }
  }
}
</style>

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1886256.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【基础算法总结】分治—快排

分治—快排 1.分治2.颜色分类3.排序数组4.数组中的第K个最大元素5.库存管理 III 点赞&#x1f44d;&#x1f44d;收藏&#x1f31f;&#x1f31f;关注&#x1f496;&#x1f496; 你的支持是对我最大的鼓励&#xff0c;我们一起努力吧!&#x1f603;&#x1f603; 1.分治 分治…

Node.js安装及配置

文章目录 1.安装Node.js2.创建目录3.配置环境变量4.配置全局安装路径和缓存路径(可选)配置Webstorm 1.安装Node.js https://registry.npmmirror.com/binary.html?pathnode 推荐安装18.x版本 2.创建目录 下载解压后进入目录&#xff0c;创建node_global和node_cache两个空文…

在嵌入式商用里面哪款RTOS(实时操作系统)比较多人用?

在开始前刚好我有一些资料&#xff0c;是我根据网友给的问题精心整理了一份「嵌入式的资料从专业入门到高级教程」&#xff0c; 点个关注在评论区回复“888”之后私信回复“888”&#xff0c;全部无偿共享给大家&#xff01;&#xff01;&#xff01; 传统的RTOS和嵌入式Linu…

【氮化硼】 h-BN薄膜的控制辐射损伤和边缘结构

摘要: 本文展示了通过化学剥离法合成的六方氮化硼(h-BN)膜在80 kV电子束辐照下表现出比石墨烯更高的抗辐射损伤能力。研究表明,即使在长时间电子束辐照下,单层h-BN也不会形成空位缺陷或发生非晶化。实验观察到在h-BN薄膜中,锯齿形边缘结构占主导地位,且这些边缘主要由氮…

6个操作简单又好用的实用办公工具

分享6个操作简单又好用的实用办公工具&#xff0c;手机和电脑上的都有&#xff0c;好好使用可以让工作效率翻倍&#xff01; 1.方方格子 一个大型的的【Excel工具箱】&#xff0c;支持32位和64位Office&#xff0c;可直接作为插件使用&#xff0c;功能覆盖非常全面&#xff0c…

MySQL实战-4 | 深入浅出索引(上)(下)

什么是数据库索引&#xff0c;索引又是如何工作的呢&#xff1f; 一句话简单来说&#xff0c;索引的出现其实就是为了提高数据查询的效率&#xff0c;就像书的目录一样。一本 500 页的书&#xff0c;如果你想快速找到其中的某一个知识点&#xff0c;在不借助目录的情况下&…

MySQL:设计数据库与操作

设计数据库 1. 数据建模1.1 概念模型1.2 逻辑模型1.3 实体模型主键外键外键约束 2. 标准化2.1 第一范式2.2 链接表2.3 第二范式2.4 第三范式 3. 数据库模型修改3.1 模型的正向工程3.2 同步数据库模型3.3 模型的逆向工程3.4 实际应用建议 4. 数据库实体模型4.1 创建和删除数据库…

学习笔记(linux高级编程)10

IPC 进程间通信 interprocess communicate 三大类&#xff1a; 1、古老的通信方式 无名管道 有名管道 信号 2、IPC对象通信 system v BSD suse fedora kernel.org 消息队列(用的相对少&#xff0c;这里不讨论) 共享内存 信号量集 3、socket通信 网络通信 特…

【MySQL】mysql访问

mysql访问 1.引入MySQL 客户端库2.C/C 进行增删改3.查询的处理细节4.图形化界面访问数据库4.1下载MYSQL Workbench4.2MYSQL Workbench远程连接数据库 点赞&#x1f44d;&#x1f44d;收藏&#x1f31f;&#x1f31f;关注&#x1f496;&#x1f496; 你的支持是对我最大的鼓励&a…

基于CNN的股票预测方法【卷积神经网络】

基于机器学习方法的股票预测系列文章目录 一、基于强化学习DQN的股票预测【股票交易】 二、基于CNN的股票预测方法【卷积神经网络】 文章目录 基于机器学习方法的股票预测系列文章目录一、CNN建模原理二、模型搭建三、模型参数的选择&#xff08;1&#xff09;探究window_size…

8619 公约公倍

这个问题可以通过计算最大公约数 (GCD) 和最小公倍数 (LCM) 来解决。我们需要找到一个整数&#xff0c;它是 a, b, c 的 GCD 的倍数&#xff0c;同时也是 d, e, f 的 LCM 的约数。 以下是解决这个问题的步骤&#xff1a; 1. 计算 a, b, c 的最大公约数。 2. 计算 d, e, f 的最…

SAP MM模块的ATP检查

前面几篇文章都演示和说明ATP的一些设置和操作&#xff0c;通常情况下ATP的检查PP模块&#xff0c;SD模块用的相对来说是比较多的&#xff0c;但是实际上MM模块也会遵循ATP的可用性的检查规则。 当我们在做311、301等移动类型时&#xff0c;系统会根据相应的可用性检查规则&am…

大模型应用开发实战基础

大模型应用开发实战基础 1. 背景 大模型如日中天&#xff0c;各行各业都受它影响&#xff0c;但是作为程序员&#xff0c;除了让它翻译代码不知道用它干什么&#xff0c;就像是拿着锤子的木匠&#xff0c;找不到钉子在哪。一边听着别人说2024是AI元年&#xff0c;一边又不知所…

基于X86+FPGA的精密加工检测设备解决方案

应用场景 随着我国高新技术的发展和国防现代化发展&#xff0c;航空、航天等领域需 要的大型光电子器件&#xff0c;微型电子机械、 光 电信息等领域需要的微型器件&#xff0c;还有一些复杂零件的加工需求日益增加&#xff0c;这些都需要借助精密甚至超精密的加工检测设备 客…

Asp.NET identity以及Owin

》》》Identity是集成到Owin框架中中 ● Microsoft.AspNet.Identity.Core&#xff1a;Identity的核心类库&#xff0c;实现了身份验证的核心功能&#xff0c;并提供了拓展接口。● Microsoft.AspNet.Identity.EntityFramework&#xff1a;Identity数据持久化的EF实现。   ● …

强化学习的数学原理:最优贝尔曼公式

大纲 贝尔曼最优公式是贝尔曼公式的一个特殊情况&#xff0c;但其也非常重要。 本节课很重要的两个概念和一个工具&#xff1a; 工具不用多说&#xff0c;就是贝尔曼最优公式&#xff0c;概念则是 optimal state value&#xff08;最优状态价值&#xff09; 和 optimal polic…

文件中各个函数返回----EOF----NULL---非零值>>>>>区分

fopen 返回值&#xff1a;操作正常返回文件指针&#xff0c; 失败返回NULL fclose 返回值&#xff1a;操作正常返回 0 失败返回EOF 不关闭文件会丢失 fgetc 返回值&#xff1a; 成功读入字符 失败返回EOF fputc 返回值&#xff1a;成功输出的字符 失败返回EOF fgets …

香橙派OrangePi AIpro初体验:当小白拿到一块开发板第一时间会做什么?

文章目录 香橙派OrangePi AIpro初体验&#xff1a;当小白拿到一块高性能AI开发板第一时间会做什么前言一、香橙派OrangePi AIpro概述1.简介2.引脚图开箱图片 二、使用体验1.基础操作2.软件工具分析 三、香橙派OrangePi AIpro.测试Demo1.测试Demo1&#xff1a;录音和播音(USB接口…

MySQL的并发控制、事务、日志

目录 一.并发控制 1.锁机制 2.加锁与释放锁 二.事务&#xff08;transactions&#xff09; 1.事物的概念 2.ACID特性 3.事务隔离级别 三.日志 1.事务日志 2.错误日志 3.通用日志 4.慢查询日志 5.二进制日志 备份 一.并发控制 在 MySQL 中&#xff0c;并发控制是确…

pandas数据分析(5)

pandas使用Numpy的np.nan代表缺失数据&#xff0c;显示为NaN。NaN是浮点数标准中地Not-a-Number。对于时间戳&#xff0c;则使用pd.NaT&#xff0c;而文本使用的是None。 首先构造一组数据&#xff1a; 使用None或者np.nan来表示缺失的值&#xff1a; 清理DataFrame时&#xf…