大号在练葵花宝典 发表于 2024-12-1 18:53:49

[免费]SpringBoot+Vue景区订票(购票)体系【论文+源码+SQL脚本】

大家好,我是java1234_小锋老师,看到一个不错的SpringBoot+Vue大景区订票(购票)体系,分享下哈。
项目视频演示

【免费】SpringBoot+Vue景区订票(购票)体系 Java毕业筹划_哔哩哔哩_bilibili


项目介绍

现代经济快节奏发展以及不停美满升级的信息化技术,让传统数据信息的管理升级为软件存储,归纳,集中处理数据信息的管理方式。本景区订票体系就是在如许的大环境下诞生,其可以资助使用者在短时间内处理完毕庞大的数据信息,使用这种软件工具可以资助管理职员进步事件处理效率,达到事半功倍的结果。此景区订票体系利用当下成熟美满的Spring Boot框架,使用跨平台的可开辟大型贸易网站的Java语言,以及最受接待的RDBMS应用软件之一的MySQL数据库进行程序开辟。景区订票体系有管理员,用户两个脚色。管理员功能有个人中心,景点范例管理,公告范例管理,景点信息管理,公告信息管理,论坛管理,用户信息管理,轮播图管理,景点留言管理,景点收藏管理,旅游景点预定管理。用户可以注册登录,查看景点信息,查看公告信息,查看论坛信息并且可以在论坛发言,可以在景点信息上留言和预定。景区订票体系的开辟根据操作职员需要筹划的界面轻巧美观,在功能模块结构上跟同范例网站保持同等,程序在实现基本要求功能时,也为数据信息面对的安全题目提供了一些实用的办理方案。可以说该程序在资助使用者高效率地处理工作事件的同时,也实现了数据信息的整体化,规范化与自动化。

体系展示

https://i-blog.csdnimg.cn/direct/eae1d807f5404275bbc3453eefc7da00.jpeghttps://i-blog.csdnimg.cn/direct/2a6e8f8f9ce443bd9361aeac1d906126.jpeghttps://i-blog.csdnimg.cn/direct/c237635f19b4408f9afc1206b8b95b7d.jpeghttps://i-blog.csdnimg.cn/direct/37885bb86a1046e281b8edb16c24dbf3.jpeghttps://i-blog.csdnimg.cn/direct/f4e96ce2a1f7426dada9cc21676ac98b.jpeghttps://i-blog.csdnimg.cn/direct/054612ab53474fbb8fc9ea7a526f709a.jpeghttps://i-blog.csdnimg.cn/direct/14dc7410c6cb4510a3fe4eaefe48e70d.jpeghttps://i-blog.csdnimg.cn/direct/bad3ef79a5ad420187d6e6e978078615.jpeg

部门代码


package com.controller;


import java.util.Arrays;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import com.service.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.UsersEntity;
import com.service.TokenService;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;

/**
* 登录相关
*/
@RequestMapping("users")
@RestController
public class UsersController {
       
        @Autowired
        private UsersService usersService;
       
        @Autowired
        private TokenService tokenService;

        /**
       * 登录
       */
        @IgnoreAuth
        @PostMapping(value = "/login")
        public R login(String username, String password, String captcha, HttpServletRequest request) {
                UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
                if(user==null || !user.getPassword().equals(password)) {
                        return R.error("账号或密码不正确");
                }
                String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
                R r = R.ok();
                r.put("token", token);
                r.put("role",user.getRole());
                r.put("userId",user.getId());
                return r;
        }
       
        /**
       * 注册
       */
        @IgnoreAuth
        @PostMapping(value = "/register")
        public R register(@RequestBody UsersEntity user){
//            ValidatorUtils.validateEntity(user);
            if(usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
                    return R.error("用户已存在");
            }
      usersService.insert(user);
      return R.ok();
    }

        /**
       * 退出
       */
        @GetMapping(value = "logout")
        public R logout(HttpServletRequest request) {
                request.getSession().invalidate();
                return R.ok("退出成功");
        }
       
        /**
   * 密码重置
   */
    @IgnoreAuth
        @RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
            UsersEntity user = usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", username));
            if(user==null) {
                    return R.error("账号不存在");
            }
            user.setPassword("123456");
      usersService.update(user,null);
      return R.ok("密码已重置为:123456");
    }
       
        /**
   * 列表
   */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UsersEntity user){
      EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
            PageUtils page = usersService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
      return R.ok().put("data", page);
    }

        /**
   * 列表
   */
    @RequestMapping("/list")
    public R list( UsersEntity user){
               EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
              ew.allEq(MPUtil.allEQMapPre( user, "user"));
      return R.ok().put("data", usersService.selectListView(ew));
    }

    /**
   * 信息
   */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
      UsersEntity user = usersService.selectById(id);
      return R.ok().put("data", user);
    }
   
    /**
   * 获取用户的session用户信息
   */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
            Integer id = (Integer)request.getSession().getAttribute("userId");
      UsersEntity user = usersService.selectById(id);
      return R.ok().put("data", user);
    }

    /**
   * 保存
   */
    @PostMapping("/save")
    public R save(@RequestBody UsersEntity user){
//            ValidatorUtils.validateEntity(user);
            if(usersService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
                    return R.error("用户已存在");
            }
            user.setPassword("123456");
      usersService.insert(user);
      return R.ok();
    }

    /**
   * 修改
   */
    @RequestMapping("/update")
    public R update(@RequestBody UsersEntity user){
//      ValidatorUtils.validateEntity(user);
      usersService.updateById(user);//全部更新
      return R.ok();
    }

    /**
   * 删除
   */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
      usersService.deleteBatchIds(Arrays.asList(ids));
      return R.ok();
    }
}
<template>
    <div>
      <div class="container loginIn" style="backgroundImage: url(/laonianrenjingqudingpiao/img/back-img-bg.jpg)">

            <div :class="2 == 1 ? 'left' : 2 == 2 ? 'left center' : 'left right'" style="backgroundColor: rgba(255, 255, 255, 1)">
                <el-form class="login-form" label-position="left" :label-width="3 == 3 ? '56px' : '0px'">
                  <div class="title-container"><h3 class="title" style="color: rgba(149, 184, 226, 1)">景区订票系统</h3></div>
                  <el-form-item :label="3 == 3 ? '用户名' : ''" :class="'style'+3">
                        <span v-if="3 != 3" class="svg-container" style="color:rgba(136, 154, 164, 1);line-height:50px"><svg-icon icon-class="user" /></span>
                        <el-input placeholder="请输入用户名" name="username" type="text" v-model="rulesForm.username" />
                  </el-form-item>
                  <el-form-item :label="3 == 3 ? '密码' : ''" :class="'style'+3">
                        <span v-if="3 != 3" class="svg-container" style="color:rgba(136, 154, 164, 1);line-height:50px"><svg-icon icon-class="password" /></span>
                        <el-input placeholder="请输入密码" name="password" type="password" v-model="rulesForm.password" />
                  </el-form-item>
                  <el-form-item v-if="0 == '1'" class="code" :label="3 == 3 ? '验证码' : ''" :class="'style'+3">
                        <span v-if="3 != 3" class="svg-container" style="color:rgba(136, 154, 164, 1);line-height:50px"><svg-icon icon-class="code" /></span>
                        <el-input placeholder="请输入验证码" name="code" type="text" v-model="rulesForm.code" />
                        <div class="getCodeBt" @click="getRandCode(4)" style="height:50px;line-height:50px">
                            <span v-for="(item, index) in codes" :key="index" :style="{color:item.color,transform:item.rotate,fontSize:item.size}">{{ item.num }}</span>
                        </div>
                  </el-form-item>
                  <el-form-item label="角色" prop="loginInRole" class="role">
                        <el-radio
                              v-for="item in menus"
                              v-if="item.hasBackLogin=='是'"
                              v-bind:key="item.roleName"
                              v-model="rulesForm.role"
                              :label="item.roleName"
                        >{{item.roleName}}</el-radio>
                  </el-form-item>
                  <el-button type="primary" @click="login()" class="loginInBt" style="padding:0;font-size:16px;border-radius:15px;height:44px;line-height:44px;width:100%;backgroundColor:rgba(149, 184, 226, 1); borderColor:rgba(149, 184, 226, 1); color:rgba(255, 255, 255, 1)">{{'2' == '1' ? '登录' : 'login'}}</el-button>
                  <el-form-item class="setting">
            <div style="color:rgba(149, 184, 226, 1)" class="register" @click="register('yonghu')">用户注册</div>
                  </el-form-item>
               
                </el-form>
            </div>

      </div>
    </div>
</template>
<script>
    import menu from "@/utils/menu";
    export default {
      data() {
            return {
                rulesForm: {
                  username: "",
                  password: "",
                  role: "",
                  code: '',
                },
                menus: [],
                tableName: "",
                codes: [{
                  num: 1,
                  color: '#000',
                  rotate: '10deg',
                  size: '16px'
                },{
                  num: 2,
                  color: '#000',
                  rotate: '10deg',
                  size: '16px'
                },{
                  num: 3,
                  color: '#000',
                  rotate: '10deg',
                  size: '16px'
                },{
                  num: 4,
                  color: '#000',
                  rotate: '10deg',
                  size: '16px'
                }],
            };
      },
      mounted() {
            let menus = menu.list();
            this.menus = menus;
      },
      created() {
            this.setInputColor()
            this.getRandCode()
      },
      methods: {
            setInputColor(){
                this.$nextTick(()=>{
                  document.querySelectorAll('.loginIn .el-input__inner').forEach(el=>{
                        el.style.backgroundColor = "rgba(194, 189, 189, 0.42)"
                        el.style.color = "rgba(51, 51, 51, 1)"
                        el.style.height = "50px"
                        el.style.lineHeight = "50px"
                        el.style.borderRadius = "15px"
                  })
                  document.querySelectorAll('.loginIn .style3 .el-form-item__label').forEach(el=>{
                        el.style.height = "50px"
                        el.style.lineHeight = "50px"
                  })
                  document.querySelectorAll('.loginIn .el-form-item__label').forEach(el=>{
                        el.style.color = "rgb(0 0 0)"
                  })
                  setTimeout(()=>{
                        document.querySelectorAll('.loginIn .role .el-radio__label').forEach(el=>{
                            el.style.color = "rgb(0 0 0)"
                        })
                  },350)
                })

            },
            register(tableName){
                this.$storage.set("loginTable", tableName);
                this.$router.push({path:'/register'})
            },
            // 登陆
            login() {
                let code = ''
                for(let i in this.codes) {
                  code += this.codes.num
                }
                if ('0' == '1' && !this.rulesForm.code) {
                  this.$message.error("请输入验证码");
                  return;
                }
                if ('0' == '1' && this.rulesForm.code.toLowerCase() != code.toLowerCase()) {
                  this.$message.error("验证码输入有误");
                  this.getRandCode()
                  return;
                }
                if (!this.rulesForm.username) {
                  this.$message.error("请输入用户名");
                  return;
                }
                if (!this.rulesForm.password) {
                  this.$message.error("请输入密码");
                  return;
                }
                if (!this.rulesForm.role) {
                  this.$message.error("请选择角色");
                  return;
                }
                let menus = this.menus;
                for (let i = 0; i < menus.length; i++) {
                  if (menus.roleName == this.rulesForm.role) {
                        this.tableName = menus.tableName;
                  }
                }
                this.$http({
                  url: `${this.tableName}/login?username=${this.rulesForm.username}&password=${this.rulesForm.password}`,
                  method: "post"
                }).then(({ data }) => {
                  if (data && data.code === 0) {
                        this.$storage.set("Token", data.token);
                        this.$storage.set("userId", data.userId);
                        this.$storage.set("role", this.rulesForm.role);
                        this.$storage.set("sessionTable", this.tableName);
                        this.$storage.set("adminName", this.rulesForm.username);
                        this.$router.replace({ path: "/index/" });
                  } else {
                        this.$message.error(data.msg);
                  }
                });
            },
            getRandCode(len = 4){
                this.randomString(len)
            },
            randomString(len = 4) {
                let chars = [
                  "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
                  "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
                  "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
                  "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
                  "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
                  "3", "4", "5", "6", "7", "8", "9"
                ]
                let colors = ["0", "1", "2","3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
                let sizes = ['14', '15', '16', '17', '18']

                let output = [];
                for (let i = 0; i < len; i++) {
                  // 随机验证码
                  let key = Math.floor(Math.random()*chars.length)
                  this.codes.num = chars
                  // 随机验证码颜色
                  let code = '#'
                  for (let j = 0; j < 6; j++) {
                        let key = Math.floor(Math.random()*colors.length)
                        code += colors
                  }
                  this.codes.color = code
                  // 随机验证码方向
                  let rotate = Math.floor(Math.random()*60)
                  let plus = Math.floor(Math.random()*2)
                  if(plus == 1) rotate = '-'+rotate
                  this.codes.rotate = 'rotate('+rotate+'deg)'
                  // 随机验证码字体大小
                  let size = Math.floor(Math.random()*sizes.length)
                  this.codes.size = sizes+'px'
                }
            },
      }
    };
</script>
<style lang="scss" scoped>
    .loginIn {
      min-height: 100vh;
      position: relative;
      background-repeat: no-repeat;
      background-position: center center;
      background-size: cover;

    .left {
      position: absolute;
      left: 0;
      top: 0;
      width: 360px;
      height: 100%;

    .login-form {
      background-color: transparent;
      width: 100%;
      right: inherit;
      padding: 0 12px;
      box-sizing: border-box;
      display: flex;
      justify-content: center;
      flex-direction: column;
    }

    .title-container {
      text-align: center;
      font-size: 24px;

    .title {
      margin: 20px 0;
    }
    }

    .el-form-item {
      position: relative;

    .svg-container {
      padding: 6px 5px 6px 15px;
      color: #889aa4;
      vertical-align: middle;
      display: inline-block;
      position: absolute;
      left: 0;
      top: 0;
      z-index: 1;
      padding: 0;
      line-height: 40px;
      width: 30px;
      text-align: center;
    }

    .el-input {
      display: inline-block;
      height: 40px;
      width: 100%;

    & /deep/ input {
          background: transparent;
          border: 0px;
          -webkit-appearance: none;
          padding: 0 15px 0 30px;
          color: #fff;
          height: 40px;
      }
    }

    }


    }

    .center {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 360px;
      transform: translate3d(-50%,-50%,0);
      height: 446px;
      border-radius: 8px;
    }

    .right {
      position: absolute;
      left: inherit;
      right: 0;
      top: 0;
      width: 360px;
      height: 100%;
    }

    .code {
    .el-form-item__content {
      position: relative;

    .getCodeBt {
      position: absolute;
      right: 0;
      top: 0;
      line-height: 40px;
      width: 100px;
      background-color: rgba(51,51,51,0.4);
      color: #fff;
      text-align: center;
      border-radius: 0 4px 4px 0;
      height: 40px;
      overflow: hidden;

    span {
      padding: 0 5px;
      display: inline-block;
      font-size: 16px;
      font-weight: 600;
    }
    }

    .el-input {
    & /deep/ input {
          padding: 0 130px 0 30px;
      }
    }
    }
    }

    .setting {
    & /deep/ .el-form-item__content {
          padding: 0 15px;
          box-sizing: border-box;
          line-height: 32px;
          height: 32px;
          font-size: 14px;
          color: #999;
          margin: 0 !important;

    .register {
      float: left;
      width: 50%;
    }

    .reset {
      float: right;
      width: 50%;
      text-align: right;
    }
    }
    }

    .style2 {
      padding-left: 30px;

    .svg-container {
      left: -30px !important;
    }

    .el-input {
    & /deep/ input {
          padding: 0 15px !important;
      }
    }
    }

    .code.style2, .code.style3 {
    .el-input {
    & /deep/ input {
          padding: 0 115px 0 15px;
      }
    }
    }

    .style3 {
    & /deep/ .el-form-item__label {
          padding-right: 6px;
      }

    .el-input {
    & /deep/ input {
          padding: 0 15px !important;
      }
    }
    }

    .role {
    & /deep/ .el-form-item__label {
          width: 56px !important;
      }

    & /deep/ .el-radio {
          margin-right: 12px;
      }
    }

    }
</style>
源码代码

链接:https://pan.baidu.com/s/1ZF_rrnE_IT3B-v-xGXLWrg
提取码:1234
https://i-blog.csdnimg.cn/direct/6e930f3dde3c4f2bb9cf4501c8642e1c.jpeg

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: [免费]SpringBoot+Vue景区订票(购票)体系【论文+源码+SQL脚本】