基于SpringBoot vue的美妆商城平台

本文介绍了使用Java、SpringBoot、Mybatis和Vue技术开发的美妆商城平台,包括后端数据库操作和前端项目的启动流程,以及支付宝沙箱支付的整合。

一,安装步骤

后端项目启动步骤:
1.先把sql导入数据库
2.把后台项目导入编辑器
3.修改数据库配置
4.启动项目
 
前端项目启动步骤:

1.打开Vue-shop目录,在这个文件夹里面加入cmd目录窗口
2.运行启动vue项目目录(需先安装nodejs软件)

先后执行下面命令
npm install
npm run dev 
执行成功之后,命令窗口会显示前端网站信息

【559】基于SpringBoot vue的美妆商城平台源码和论文含支付宝沙箱支付

      在查阅了许多网站开发的相关资料的基础上,提出了基于Java技术,采用B/S构建结构,选用Spring Boot框架,Mybatis框架,运用VUE技术,UML技术和MySQL数据库来开发一个美妆商城网站,不同于市面上的京东、淘宝等购物网站,而是针对美妆产品购物的新型美妆购物商城,包含管理员、用户模块实现了商城的基本功能,使得美妆产品美妆的交易更加方便,有效,成本更低,将成为美妆产品美妆销售的崭新模式,具有一定的实际意义和推广价值。

关键词:美妆商城    Java    Spring Boot框架    MySQL

<template>
  <div class="app-container">
    <!--  <el-table
      :data="tableData"
      style="width: 100%"> -->

    收件人:{{buy.name}}<hr />
    手机号:{{buy.tel}}<hr />
  收货地址:{{buy.address}}


    <el-table
      style="width: 100%"
      :data="tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)">
      <el-table-column  label="商品">
          <template slot-scope="scope">
          <el-image
      style="width: 100px; height: 100px"
      :src="url+scope.row.thing.img"
      fit="contain"></el-image>
          </template>
      </el-table-column>
      <el-table-column
        prop="thing.name"
        label="商品名称"
      ></el-table-column>
      <el-table-column prop="thing.thingtype.type" label="类型"></el-table-column>
      <el-table-column prop="thing.thingtype2.type" label="区域"></el-table-column>
      <el-table-column prop="thing.price" label="价格"></el-table-column>
    </el-table>

    <div class="tabListPage">
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-size="pageSize"
        layout="total, prev, pager, next, jumper"
        :total="sum"
      >
      </el-pagination>
    </div>
  </div>
</template>

<script>
import { GetList, State } from "@/api/buylist";
export default {
  data() {
    return {
        url:process.env.VUE_APP_BASE_API,
      tableData: [],
      pageSize: 20,
      currentPage: 1,
      sum: 0,
      buy:{
        name:'',
        tel:'',
        address:''
      },
      keydata:{
        buyId:this.$route.query.buyId
      }
    };
  },
  created() {

    this.Bind();
  },
  methods: {
    async Bind() {
      await GetList(this.keydata).then((list) => {
        this.tableData = list.data.buylist;
        const{name,tel,address}=list.data.buy.client;
        this.buy.name=name
        this.buy.tel=tel
        this.buy.address=address
        this.sum = this.tableData.length;
      });
    },
    handleCurrentChange(val) {
      //翻页事件
      this.currentPage = val;
      this.Bind();
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1,
h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>

<template>
  <div class="login-container">
    <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form" auto-complete="on" label-position="left">

      <div class="title-container">
        <h3 class="title">商城管理后台</h3>
      </div>

      <el-form-item prop="login">
        <span class="svg-container">
          <svg-icon icon-class="user" />
        </span>
        <el-input
          ref="login"
          v-model="loginForm.login"
          placeholder="Username"
          name="login"
          type="text"
          tabindex="1"
          auto-complete="on"
        />
      </el-form-item>

      <el-form-item prop="pwd">
        <span class="svg-container">
          <svg-icon icon-class="password" />
        </span>
        <el-input
          :key="passwordType"
          ref="pwd"
          v-model="loginForm.pwd"
          :type="passwordType"
          placeholder="Password"
          name="pwd"
          tabindex="2"
          auto-complete="on"
          @keyup.enter.native="handleLogin"
        />
        <span class="show-pwd" @click="showPwd">
          <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
        </span>
      </el-form-item>


      <el-button :loading="loading" type="primary" style="width:100%;margin-bottom:30px;" @click.native.prevent="handleLogin">立即登录</el-button>


    </el-form>


  </div>
</template>

<script>
import { adminmenu } from '@/router/adminrouter';
const defaultMod = {
  login: '',
  pwd: '',
  tel:'',
  mail:'',
  address:'',
  sex:'男',
  age: 0,
  xueli: '',
  name:''
};

export default {
  name: 'Login',
  data() {
    return {
      setmes: Object.assign({}, defaultMod),
      loginForm: {
        login: '',
        pwd: '',
        author: 'admin'
      },
      loginRules: {
        login: [{ required: true, trigger: 'blur' }],
        pwd: [{ required: true, trigger: 'blur' }]
      },
      loading: false,
      passwordType: 'password',
      redirect: undefined
    }
  },
  watch: {
    $route: {
      handler: function(route) {
        this.redirect = route.query && route.query.redirect
      },
      immediate: true
    }
  },
  methods: {
    showPwd() {
      if (this.passwordType === 'password') {
        this.passwordType = ''
      } else {
        this.passwordType = 'password'
      }
      this.$nextTick(() => {
        this.$refs.pwd.focus()
      })
    },
    handleLogin() {
      this.$refs.loginForm.validate(valid => {
        if (valid) {
          this.loading = true
          this.$store.dispatch('admin/loginin', this.loginForm).then(res => {

        switch (this.$store.state.admin.author) {
            case 'admin':
              // this.$router.options.addRoutes(adminmenu);
              this.$router.options.routes = adminmenu// 配置管理员路由
              this.$router.addRoutes(adminmenu)// 动态加载路由
              break
            default:
              break
          }
          this.$router.push({name:'Dashboard'})
            this.loading = false
          }).catch(() => {
            this.loading = false
          })
        } else {
          console.log('error submit!!')
          return false
        }
      })
    }
  }
}
</script>

<style lang="scss">
/* 修复input 背景不协调 和光标变色 */
/* Detail see https://github.com/PanJiaChen/vue-element-admin/pull/927 */

$bg:#283443;
$light_gray:#fff;
$cursor: #fff;

@supports (-webkit-mask: none) and (not (cater-color: $cursor)) {
  .login-container .el-input input {
    color: $cursor;
  }
}

/* reset element-ui css */
.login-container {
  .el-input {
    display: inline-block;
    height: 47px;
    width: 85%;

    input {
      background: transparent;
      border: 0px;
      -webkit-appearance: none;
      border-radius: 0px;
      padding: 12px 5px 12px 15px;
      color: $light_gray;
      height: 47px;
      caret-color: $cursor;

      &:-webkit-autofill {
        box-shadow: 0 0 0px 1000px $bg inset !important;
        -webkit-text-fill-color: $cursor !important;
      }
    }
  }

  .el-form-item {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 5px;
    color: #454545;
  }
}
</style>

<style lang="scss" scoped>
$bg:#2d3a4b;
$dark_gray:#889aa4;
$light_gray:#eee;

.login-container {
  min-height: 100%;
  width: 100%;
  background-color: $bg;
  overflow: hidden;

  .login-form {
    position: relative;
    width: 520px;
    max-width: 100%;
    padding: 160px 35px 0;
    margin: 0 auto;
    overflow: hidden;
  }

  .tips {
    font-size: 14px;
    color: #fff;
    margin-bottom: 10px;

    span {
      &:first-of-type {
        margin-right: 16px;
      }
    }
  }

  .svg-container {
    padding: 6px 5px 6px 15px;
    color: $dark_gray;
    vertical-align: middle;
    width: 30px;
    display: inline-block;
  }

  .title-container {
    position: relative;

    .title {
      font-size: 26px;
      color: $light_gray;
      margin: 0px auto 40px auto;
      text-align: center;
      font-weight: bold;
    }
  }

  .show-pwd {
    position: absolute;
    right: 10px;
    top: 7px;
    font-size: 16px;
    color: $dark_gray;
    cursor: pointer;
    user-select: none;
  }
}
</style>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.java</groupId>
    <artifactId>shop</artifactId>
    <version>1.0-SNAPSHOT</version>
    <description>shop</description>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.0.RELEASE</version>
    </parent>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <com.alibaba.fastjson>1.2.70</com.alibaba.fastjson>
        <org.projectlombok.lombok>1.16.6</org.projectlombok.lombok>
        <mysql.mysql-connector-java>8.0.29</mysql.mysql-connector-java>
        <com.baomidou.mybatis-plus>3.1.1</com.baomidou.mybatis-plus>
        <org.freemarker.freemarker>2.3.28</org.freemarker.freemarker>
        <com.alibaba.druid>1.1.22</com.alibaba.druid>
        <org.apache.tomcat.embed.tomcat>9.0.12</org.apache.tomcat.embed.tomcat>
    </properties>


    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${org.projectlombok.lombok}</version>
        </dependency>

        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>${com.alibaba.fastjson}</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.alibaba/druid -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid</artifactId>
            <version>${com.alibaba.druid}</version>
        </dependency>


        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.mysql-connector-java}</version>
        </dependency>

        <!-- mybatis plus -->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>${com.baomidou.mybatis-plus}</version>
        </dependency>

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-generator</artifactId>
            <version>${com.baomidou.mybatis-plus}</version>
        </dependency>
<!--        <dependency>-->
<!--            <groupId>org.freemarker</groupId>-->
<!--            <artifactId>freemarker</artifactId>-->
<!--            <version>${freemarker.version}</version>-->
<!--        </dependency>-->


        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
<!--            <scope>provided</scope>-->
            <version>${org.apache.tomcat.embed.tomcat}</version>
        </dependency>
        <!-- 添加jstl标签库依赖模块 -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>com.alipay.sdk</groupId>
            <artifactId>alipay-sdk-java</artifactId>
            <version>3.7.4.ALL</version>
        </dependency>

    </dependencies>



    <build>
        <finalName>runok</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>com.java.shopApplication</mainClass>
                </configuration>

                <version>1.4.2.RELEASE</version>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>META-INF/resources</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>

            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <excludes>
                    <exclude>**/*.woff</exclude>
                    <exclude>**/*.woff2</exclude>
                    <exclude>**/*.ttf</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*.woff</include>
                    <include>**/*.woff2</include>
                    <include>**/*.ttf</include>
                </includes>
            </resource>
        </resources>
    </build>


    <repositories>
        <repository>
            <id>aliyun</id>
            <name>aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </repository>
    </repositories>
</project>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值