Compare commits

...

No commits in common. 'main' and 'xieweiVue' have entirely different histories.

@ -1,2 +0,0 @@
# restaurant

@ -0,0 +1,140 @@
import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router'
Vue.use(VueRouter);
//1.创建组件
import Index from '@/views/index'
import Home from '@/views/home'
import Login from '@/views/login'
import NotFound from '@/views/404'
import UpdatePassword from '@/views/update-password'
import pay from '@/views/pay'
import register from '@/views/register'
import center from '@/views/center'
import news from '@/views/modules/news/list'
import caipinpingjia from '@/views/modules/caipinpingjia/list'
import yonghu from '@/views/modules/yonghu/list'
import shangjia from '@/views/modules/shangjia/list'
import storeup from '@/views/modules/storeup/list'
import discusscaipinxinxi from '@/views/modules/discusscaipinxinxi/list'
import caipinxinxi from '@/views/modules/caipinxinxi/list'
import config from '@/views/modules/config/list'
import canzhuo from '@/views/modules/canzhuo/list'
import caipindingdan from '@/views/modules/caipindingdan/list'
import caipinfenlei from '@/views/modules/caipinfenlei/list'
//2.配置路由 注意:名字
const routes = [{
path: '/index',
name: '首页',
component: Index,
children: [{
// 这里不设置值是把main作为默认页面
path: '/',
name: '首页',
component: Home,
meta: {icon:'', title:'center'}
}, {
path: '/updatePassword',
name: '修改密码',
component: UpdatePassword,
meta: {icon:'', title:'updatePassword'}
}, {
path: '/pay',
name: '支付',
component: pay,
meta: {icon:'', title:'pay'}
}, {
path: '/center',
name: '个人信息',
component: center,
meta: {icon:'', title:'center'}
}
,{
path: '/news',
name: '菜品资讯',
component: news
}
,{
path: '/caipinpingjia',
name: '菜品评价',
component: caipinpingjia
}
,{
path: '/yonghu',
name: '用户',
component: yonghu
},
{
path: '/shangjia',
name: '商家',
component: shangjia
}
,{
path: '/storeup',
name: '我的收藏管理',
component: storeup
}
,{
path: '/discusscaipinxinxi',
name: '菜品信息评论',
component: discusscaipinxinxi
}
,{
path: '/caipinxinxi',
name: '菜品信息',
component: caipinxinxi
}
,{
path: '/config',
name: '轮播图管理',
component: config
}
,{
path: '/canzhuo',
name: '餐桌',
component: canzhuo
}
,{
path: '/caipindingdan',
name: '菜品订单',
component: caipindingdan
}
,{
path: '/caipinfenlei',
name: '菜品分类',
component: caipinfenlei
}
]
},
{
path: '/login',
name: 'login',
component: Login,
meta: {icon:'', title:'login'}
},
{
path: '/register',
name: 'register',
component: register,
meta: {icon:'', title:'register'}
},
{
path: '/',
name: '首页',
redirect: '/index'
}, /*默认跳转路由*/
{
path: '*',
component: NotFound
}
]
//3.实例化VueRouter 注意:名字
const router = new VueRouter({
mode: 'hash',
/*hash模式改为history*/
routes // (缩写)相当于 routes: routes
})
export default router;

@ -0,0 +1,401 @@
<template>
<div>
<div class="container loginIn" style="backgroundImage: url(http://codegen.caihongy.cn/20210228/c8db205ee3a44746a3113dace7bb9506.jpg)">
<div :class="2 == 1 ? 'left' : 2 == 2 ? 'left center' : 'left right'" style="backgroundColor: rgba(206, 221, 207, 0.53)">
<el-form class="login-form" label-position="left" :label-width="2 == 3 ? '56px' : '0px'">
<div class="title-container"><h3 class="title" style="color: rgba(53, 156, 252, 0.87)">餐厅点餐系统登录</h3></div>
<el-form-item :label="2 == 3 ? '用户名' : ''" :class="'style'+2">
<span v-if="2 != 3" class="svg-container" style="color:rgba(16, 17, 17, 1);line-height:44px"><svg-icon icon-class="user" /></span>
<el-input placeholder="请输入用户名" name="username" type="text" v-model="rulesForm.username" />
</el-form-item>
<el-form-item :label="2 == 3 ? '密码' : ''" :class="'style'+2">
<span v-if="2 != 3" class="svg-container" style="color:rgba(16, 17, 17, 1);line-height:44px"><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="2 == 3 ? '验证码' : ''" :class="'style'+2">
<span v-if="2 != 3" class="svg-container" style="color:rgba(16, 17, 17, 1);line-height:44px"><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:44px;line-height:44px">
<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-form-item>
<!-- <div style="color:rgba(88, 5, 5, 1)" class="reset">商家入驻</div> -->
<div class="register" style="color:rgba(88, 5, 5, 1)" @click="register"></div>
</el-form-item>
<el-button type="primary" @click="login()" class="loginInBt" style="padding:0;font-size:16px;border-radius:22px;height:44px;line-height:44px;width:100%;backgroundColor:rgba(64, 158, 255, 1); borderColor:rgba(64, 158, 255, 1); color:rgba(255, 255, 255, 1)">{{'1' == '1' ? '登录' : 'login'}}</el-button>
<!-- <el-form-item class="setting">
<div style="color:rgba(88, 5, 5, 1)" class="reset">修改密码</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(255, 255, 255, 1)"
el.style.color = "rgba(20, 21, 21, 0.91)"
el.style.height = "44px"
el.style.lineHeight = "44px"
el.style.borderRadius = "22px"
})
document.querySelectorAll('.loginIn .style3 .el-form-item__label').forEach(el=>{
el.style.height = "44px"
el.style.lineHeight = "44px"
})
document.querySelectorAll('.loginIn .el-form-item__label').forEach(el=>{
el.style.color = "rgba(16, 17, 17, 1)"
})
setTimeout(()=>{
document.querySelectorAll('.loginIn .role .el-radio__label').forEach(el=>{
el.style.color = "#fff"
})
},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[i].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[i].roleName == this.rulesForm.role) {
this.tableName = menus[i].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("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[i].num = chars[key]
//
let code = '#'
for (let j = 0; j < 6; j++) {
let key = Math.floor(Math.random()*colors.length)
code += colors[key]
}
this.codes[i].color = code
//
let rotate = Math.floor(Math.random()*60)
let plus = Math.floor(Math.random()*2)
if(plus == 1) rotate = '-'+rotate
this.codes[i].rotate = 'rotate('+rotate+'deg)'
//
let size = Math.floor(Math.random()*sizes.length)
this.codes[i].size = sizes[size]+'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>

@ -0,0 +1,429 @@
<!-- eslint-disable no-mixed-spaces-and-tabs -->
<template>
<div id="app">
<div class="container">
<div class="login-form" style="backgroundColor:rgba(183, 174, 174, 0.5);borderRadius:22px">
<h1 class="h1" style="color:#000;fontSize:28px;">点餐系统商家入驻</h1>
<!-- <el-form ref="rgsForm" class="rgs-form" :model="rgsForm" label-width="120px">
</el-form> -->
<el-form :model="rgsForm" :rules="rules" ref="rgsForm" label-width="120px" class="rgs-form">
<el-form-item label="商家用户名" class="input" >
<el-input v-model="ruleForm.username" autocomplete="off" placeholder="用户名" type="text"></el-input>
</el-form-item>
<el-form-item label="密码" class="input" >
<el-input v-model="ruleForm.password" autocomplete="off" placeholder="密码" type="text" />
</el-form-item>
<!-- <el-form-item label="姓名" class="input" >
<el-input v-model="ruleForm.xingming" autocomplete="off" placeholder="姓名" type="text" />
</el-form-item> -->
<!-- 此处要校检用户上传成功后返回的地址 -->
<el-form-item class="upload" label="资质" prop="zizhi">
<file-upload
tip="点击上传资质"
action="file/upload"
:limit="3"
:multiple="true"
:fileUrls="ruleForm.zizhi?ruleForm.zizhi:''"
@change="zizhiUploadChange"
></file-upload>
</el-form-item>
<!-- <el-form-item label="联系电话" class="input" >
<el-input v-model="ruleForm.lianxidianhua" autocomplete="off" placeholder="联系电话" type="text" />
</el-form-item> -->
<div style="display: flex;flex-wrap: wrap;width: 100%;justify-content: center;">
<el-button class="btn" type="primary" @click="login()"></el-button>
<el-button class="btn close" type="primary" @click="close()"></el-button>
</div>
</el-form>
</div>
</div>
</div>
</template>
<script>
export default {
data() {
return {
/* 控制上传对话框显示与否,默认false不显示 */
dialogVisible:false,
/* 对话框内放置的上传图片的地址 */
dialogImageUrl:'',
/* 已经上传的文件列表,本例未使用 */
fileList:[],
ruleForm: {
zizhi: ''
},
tableName:"",
rules: {}
};
},
created() {
this.addEditStyleChange()
this.addEditUploadStyleChange()
},
mounted(){
// let table = this.$storage.get("loginTable");
this.tableName = "shangjia";
},
methods: {
handleExceed(file,fileList){
this.$message.error('最多上传一张头像...');
},
/*
*/
beforeAvatarUpload(file){
/* 匹配 MIME 格式 */
const isJPG = file.type === 'image/jpeg';
/* 这里表示不能大于500k */
const isLt2M = file.size / 1024 / 1024 < 0.5;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 500k!');
}
return isJPG && isLt2M;
},
/*
文件上传成功时的钩子
response:上传成功返回的响应
file:每次上传的文件对象
fileList:目前所有已经上传的文件数组
*/
handleAvatarSuccess(response, file, fileList){
console.log(response,file,fileList)
/* 一般在上传成功后在此处进行业务逻辑例如将返回的路径添加进表单双向绑定的data中的对象 */
/*
{
"code":null,
"flag":true,
"msg":"上传成功~",
"data":{
"fileId":null,
"fileName":"1",
"fileSize":48558,
"path":"http://etoak.vip:9528/4028823a74559fc80174559fc81e0000.jpg"
}
}
*/
if(response.flag){
/* 将返回的路径添加进封装路径的表单项属性 */
//this.ruleForm.paths.push(response.data.path)
/* 上传成功后将返回的路径赋值给表单项中封装的路径 */
this.ruleForm.zizhi = 'http://localhost:8080/springboot1mi5m/upload/' + response.data.file
}
},
/*
文件移除的钩子
file:点击的要删除的已经上传成功的文件对象
fileList:目前所有已经上传的文件数组
*/
handleRemove(file, fileList) {
/* 此处进行上传文件被删除之后的逻辑 */
//this.ruleForm.paths.splice(this.ruleForm.paths.indexOf(file.response.data.path),1)
/* 将已经保存的上传成功的路径恢复为空串 */
this.regForm.path = ''
},
/* 点击放大镜查看上传文件详细信息时执行 */
handlePictureCardPreview(file) {
/* 填充路径 */
this.dialogImageUrl = this.regForm.path
/* 对话框显示 */
this.dialogVisible = true;
},
// uuid
getUUID () {
return new Date().getTime();
},
close(){
this.$router.push({ path: "/login" });
},
zizhiUploadChange(fileUrls) {
this.ruleForm.zizhi = fileUrls;
},
//
login() {
if((!this.ruleForm.username) && `shangjia` == this.tableName){
this.$message.error(`用户名不能为空`);
return
}
if((!this.ruleForm.password) && `shangjia` == this.tableName){
this.$message.error(`密码不能为空`);
return
}
// if(`shangjia` == this.tableName && this.ruleForm.lianxidianhua&&(!this.$validate.isMobile(this.ruleForm.lianxidianhua))){
// this.$message.error(``);
// return
// }
this.$http({
url: `${this.tableName}/register`,
method: "post",
data:this.ruleForm
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: "注册成功",
type: "success",
duration: 1500,
onClose: () => {
this.$router.replace({ path: "/login" });
}
});
} else {
this.$message.error(data.msg);
}
});
}
}
};
</script>
<style lang="scss" scoped>
.el-radio__input.is-checked .el-radio__inner {
border-color: #00c292;
background: #00c292;
}
.el-radio__input.is-checked .el-radio__inner {
border-color: #00c292;
background: #00c292;
}
.el-radio__input.is-checked .el-radio__inner {
border-color: #00c292;
background: #00c292;
}
.el-radio__input.is-checked+.el-radio__label {
color: #00c292;
}
.el-radio__input.is-checked+.el-radio__label {
color: #00c292;
}
.el-radio__input.is-checked+.el-radio__label {
color: #00c292;
}
.h1 {
margin-top: 10px;
}
body {
padding: 0;
margin: 0;
}
// .container {
// min-height: 100vh;
// text-align: center;
// // background-color: #00c292;
// padding-top: 20vh;
// background-image: url(../assets/img/bg.jpg);
// background-size: 100% 100%;
// opacity: 0.9;
// }
// .login-form:before {
// vertical-align: middle;
// display: inline-block;
// }
// .login-form {
// max-width: 500px;
// padding: 20px 0;
// width: 80%;
// position: relative;
// margin: 0 auto;
// .label {
// min-width: 60px;
// }
// .input-group {
// max-width: 500px;
// padding: 20px 0;
// width: 80%;
// position: relative;
// margin: 0 auto;
// display: flex;
// align-items: center;
// .input-container {
// display: inline-block;
// width: 100%;
// text-align: left;
// margin-left: 10px;
// }
// .icon {
// width: 30px;
// height: 30px;
// }
// .input {
// position: relative;
// z-index: 2;
// float: left;
// width: 100%;
// margin-bottom: 0;
// box-shadow: none;
// border-top: 0px solid #ccc;
// border-left: 0px solid #ccc;
// border-right: 0px solid #ccc;
// border-bottom: 1px solid #ccc;
// padding: 0px;
// resize: none;
// border-radius: 0px;
// display: block;
// width: 100%;
// height: 34px;
// padding: 6px 12px;
// font-size: 14px;
// line-height: 1.42857143;
// color: #555;
// background-color: #fff;
// }
// }
// }
.nk-navigation {
margin-top: 15px;
a {
display: inline-block;
color: #fff;
background: rgba(255, 255, 255, .2);
width: 100px;
height: 50px;
border-radius: 30px;
text-align: center;
display: flex;
align-items: center;
margin: 0 auto;
justify-content: center;
padding: 0 20px;
}
.icon {
margin-left: 10px;
width: 30px;
height: 30px;
}
}
.register-container {
margin-top: 10px;
a {
display: inline-block;
color: #fff;
max-width: 500px;
height: 50px;
border-radius: 30px;
text-align: center;
display: flex;
align-items: center;
margin: 0 auto;
justify-content: center;
padding: 0 20px;
div {
margin-left: 10px;
}
}
}
.container {
background-image: url("http://codegen.caihongy.cn/20210228/c8db205ee3a44746a3113dace7bb9506.jpg");
height: 100vh;
background-position: center center;
background-size: cover;
background-repeat: no-repeat;
.login-form {
right: 50%;
top: 50%;
height: auto;
transform: translate3d(50%, -50%, 0);
border-radius: 10px;
background-color: rgba(255,255,255,.5);
width: 420px;
padding: 30px 30px 40px 30px;
font-size: 14px;
font-weight: 500;
.h1 {
margin: 0;
text-align: center;
line-height: 54px;
font-size: 24px;
color: #000;
}
.rgs-form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.input {
width: 100%;
& /deep/ .el-form-item__label {
line-height: 40px;
color: rgba(17, 16, 16, 1);
font-size: #606266;
}
& /deep/ .el-input__inner {
height: 40px;
color: rgba(23, 24, 26, 1);
font-size: 14px;
border-width: 1px;
border-style: solid;
border-color: #606266;
border-radius: 22px;
background-color: #fff;
}
}
.btn {
margin: 0 10px;
width: 88px;
height: 44px;
color: #fff;
font-size: 14px;
border-width: 1px;
border-style: solid;
border-color: #409EFF;
border-radius: 22px;
background-color: #409EFF;
}
.close {
margin: 0 10px;
width: 88px;
height: 44px;
color: #409EFF;
font-size: 14px;
border-width: 1px;
border-style: solid;
border-color: #409EFF;
border-radius: 22px;
background-color: #FFF;
}
}
}
}
</style>
Loading…
Cancel
Save