SpringBoot vue电影购票系统 电影院系统

SpringBoot 电影购票系统 电影院系统 功能介绍

首页 登录 注册 图片轮播 正在热播列表 热门榜单Top10 电影分类 按类型 地区展示 搜索 活动 留言 评价客服 购买电影票 选座购买 评分 个人中心 基本设置 购物车 我的订单

后台管理 验证码 登录 电影列表管理 院线排片管理 新增电影 轮播海报管理 用户管理 订单管理 异常订单管理 员工列表 每日工作 新增员工 Api接口管理

角色:前端购票用户 后台管理员 后台工作人员

使用技术
  • SpringBoot框架

  • Mysql数据库

  • Mybaits

  • SpringSecurity(权限)

  • vue前端

  • vue后台管理

功能展示

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

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

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

SpringSecurity配置类SecurityConfiguration.java
package cn.edu.config;

import cn.edu.auth.AuthorizationFilter;
import cn.edu.model.support.ResponseResult;
import cn.edu.utils.ResponseUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

/**
 * SpringSecurity配置
 */
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {

    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }

    /**
     * HTTP验证规则
     *
     * @param http h
     * @throws Exception e
     */
    @Override
    protected void configure(HttpSecurity http) throws Exception {

        //开启跨域
        http.csrf().disable().cors();

        http.authorizeRequests().antMatchers( "/api/captcha/**").permitAll();

        //允许跨域使用iframe
        http.headers().frameOptions().disable();

        //禁用session
        http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);

        //身份验证失败
        http.exceptionHandling().authenticationEntryPoint((request, response, authException) -> {
            ResponseUtil.writeJson(response, new ResponseResult<>(403, "身份认证失败, 请重新登录"));
        });

        http.addFilter(new AuthorizationFilter(authenticationManagerBean()));

    }

    /**
     * SpringSecurity有默认的跨域配置 会无法放行RequestHeader带有"Authorization"请求
     * 防止前端请求api报出cors error
     *
     * @return *
     */
    @Bean
    CorsConfigurationSource corsConfigurationSource() {
        final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
        final CorsConfiguration corsConfiguration = new CorsConfiguration();
        corsConfiguration.addAllowedHeader("*");
        corsConfiguration.addAllowedHeader("DELETE");
        corsConfiguration.addAllowedMethod("*");
        corsConfiguration.addAllowedOrigin("*");
        source.registerCorsConfiguration("/**", corsConfiguration);
        return source;
    }

}
运行

创建数据库, 然后修改数据库连接相关信息。

启动 Springboot 类的main方法

运行vue前端和后台管理
npm run serve

前端访问地址:http://localhost:8081/

注册用户或使用 账号: aaaaaa 密码: aaaaaa

后台管理访问地址:http://localhost:8082/

账号:liang123 密码:liang123

工作人员账号: abc123 密码: abc123

Logo

前往低代码交流专区

更多推荐