轮播图接口增加
This commit is contained in:
parent
546f1f4ea1
commit
7e30890122
|
|
@ -1,10 +1,19 @@
|
|||
import request from "@/utils/request";
|
||||
|
||||
// 新增上传首页轮播图
|
||||
export const addHomeSwiperApi = () => {
|
||||
export const addHomeSwiperApi = (data) => {
|
||||
return request({
|
||||
url: "/auth/getConfig",
|
||||
url: "/material-mall/bm_slide_show",
|
||||
method: "post",
|
||||
data,
|
||||
});
|
||||
};
|
||||
// 轮播图列表
|
||||
export const getSwiperListApi = (data) => {
|
||||
return request({
|
||||
url: "/material-mall//bm_slide_show/list",
|
||||
method: "get",
|
||||
params: data,
|
||||
});
|
||||
};
|
||||
// 修改轮播图状态
|
||||
|
|
|
|||
|
|
@ -2,17 +2,28 @@
|
|||
<div class="container">
|
||||
<div class="login">
|
||||
<div class="login-form">
|
||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
||||
<h3 class="title">博诺思后台管理系统</h3>
|
||||
<el-form
|
||||
ref="loginForm"
|
||||
:model="loginForm"
|
||||
:rules="loginRules"
|
||||
class="login-form"
|
||||
>
|
||||
<h3 class="title">安徽机械化装备共享平台</h3>
|
||||
<template v-if="loginMethod === 'password'">
|
||||
<el-form-item prop="username">
|
||||
<el-input
|
||||
v-model="loginForm.username"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
:placeholder="`用户名${config.loginConfig.phonePassword ? '/手机号' : ''}${config.loginConfig.emailPassword ? '/邮箱' : ''}`"
|
||||
:placeholder="`用户名${
|
||||
config.loginConfig.phonePassword ? '/手机号' : ''
|
||||
}${config.loginConfig.emailPassword ? '/邮箱' : ''}`"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="user"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
|
|
@ -23,7 +34,11 @@
|
|||
placeholder="密码"
|
||||
@keyup.enter.native="handleLogin"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon"/>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="password"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaEnabled">
|
||||
|
|
@ -34,25 +49,38 @@
|
|||
style="width: 63%"
|
||||
@keyup.enter.native="handleLogin"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon"/>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="validCode"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item v-show="isAdmin" prop="verificationCode">
|
||||
<el-input v-model="loginForm.verificationCode" placeholder="请输入验证码">
|
||||
<el-input
|
||||
v-model="loginForm.verificationCode"
|
||||
placeholder="请输入验证码"
|
||||
>
|
||||
<template slot="append">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="sendAdminCode"
|
||||
:disabled="isSendingCode || captchaEnabled?!loginForm.code:false"
|
||||
:disabled="
|
||||
isSendingCode || captchaEnabled ? !loginForm.code : false
|
||||
"
|
||||
class="send-code-button"
|
||||
>
|
||||
{{ countdown === 0 ? '获取验证码' : `${countdown}s` }}
|
||||
{{ countdown === 0 ? "获取验证码" : `${countdown}s` }}
|
||||
</el-button>
|
||||
</template>
|
||||
<svg-icon slot="prefix" icon-class="message" class="el-input__icon input-icon"/>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="message"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
|
|
@ -62,9 +90,15 @@
|
|||
v-model="loginForm.mobile"
|
||||
type="text"
|
||||
auto-complete="off"
|
||||
:placeholder="`${config.loginConfig.phoneCode ? '手机号' : '/'}${config.loginConfig.emailCode ? '邮箱' : ''}`"
|
||||
:placeholder="`${
|
||||
config.loginConfig.phoneCode ? '手机号' : '/'
|
||||
}${config.loginConfig.emailCode ? '邮箱' : ''}`"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon"/>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="user"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" v-if="captchaEnabled">
|
||||
|
|
@ -75,54 +109,80 @@
|
|||
style="width: 63%"
|
||||
@keyup.enter.native="handleLogin"
|
||||
>
|
||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon"/>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="validCode"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
<div class="login-code">
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
||||
<img :src="codeUrl" @click="getCode" class="login-code-img" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item prop="verificationCode">
|
||||
<el-input v-model="loginForm.verificationCode" placeholder="请输入验证码">
|
||||
<el-input
|
||||
v-model="loginForm.verificationCode"
|
||||
placeholder="请输入验证码"
|
||||
>
|
||||
<template slot="append">
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="sendCode"
|
||||
:disabled="isSendingCode || captchaEnabled?!loginForm.code:false"
|
||||
:disabled="
|
||||
isSendingCode || captchaEnabled ? !loginForm.code : false
|
||||
"
|
||||
class="send-code-button"
|
||||
>
|
||||
{{ countdown === 0 ? '获取验证码' : `${countdown}s` }}
|
||||
{{ countdown === 0 ? "获取验证码" : `${countdown}s` }}
|
||||
</el-button>
|
||||
</template>
|
||||
<svg-icon slot="prefix" icon-class="message" class="el-input__icon input-icon"/>
|
||||
<svg-icon
|
||||
slot="prefix"
|
||||
icon-class="message"
|
||||
class="el-input__icon input-icon"
|
||||
/>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<div class="login-form-center">
|
||||
<el-link v-if="config.loginConfig.emailCode ||config.loginConfig.phoneCode " @click="toggleLoginMethod">
|
||||
{{ loginMethod === 'password' ? '短信登录' : '密码登录' }}
|
||||
<el-link
|
||||
v-if="
|
||||
config.loginConfig.emailCode || config.loginConfig.phoneCode
|
||||
"
|
||||
@click="toggleLoginMethod"
|
||||
>
|
||||
{{ loginMethod === "password" ? "短信登录" : "密码登录" }}
|
||||
</el-link>
|
||||
<router-link v-if="config.registersConfig.emailRegisters || config.registersConfig.phoneRegisters" to="/register">
|
||||
<router-link
|
||||
v-if="
|
||||
config.registersConfig.emailRegisters ||
|
||||
config.registersConfig.phoneRegisters
|
||||
"
|
||||
to="/register"
|
||||
>
|
||||
<el-link>注册账号</el-link>
|
||||
</router-link>
|
||||
<el-checkbox v-model="loginForm.rememberMe">记住密码</el-checkbox>
|
||||
</div>
|
||||
<el-form-item style="width: 100%;">
|
||||
<el-button v-if="!isAdmin"
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width: 100%;"
|
||||
@click="loginMethod === 'password' ?IsAdmin():handleLogin()"
|
||||
<el-form-item style="width: 100%">
|
||||
<el-button
|
||||
v-if="!isAdmin"
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width: 100%"
|
||||
@click="loginMethod === 'password' ? IsAdmin() : handleLogin()"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
</el-button>
|
||||
<el-button v-if="isAdmin"
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width: 100%;"
|
||||
@click="handleLogin()"
|
||||
<el-button
|
||||
v-if="isAdmin"
|
||||
:loading="loading"
|
||||
size="medium"
|
||||
type="primary"
|
||||
style="width: 100%"
|
||||
@click="handleLogin()"
|
||||
>
|
||||
<span v-if="!loading">登 录</span>
|
||||
<span v-else>登 录 中...</span>
|
||||
|
|
@ -132,13 +192,13 @@
|
|||
<div class="login-divider">第三方登录</div>
|
||||
<div class="login-icons">
|
||||
<div class="login-icon">
|
||||
<img :src="dingding" alt="Weibo">
|
||||
<img :src="dingding" alt="Weibo" />
|
||||
</div>
|
||||
<div class="login-icon">
|
||||
<img :src="wx" alt="WeChat">
|
||||
<img :src="wx" alt="WeChat" />
|
||||
</div>
|
||||
<div class="login-icon">
|
||||
<img :src="qq" alt="QQ">
|
||||
<img :src="qq" alt="QQ" />
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
|
@ -149,248 +209,287 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { getCodeImg } from '@/api/login'
|
||||
import Cookies from 'js-cookie'
|
||||
import { decrypt, encrypt } from '@/utils/jsencrypt'
|
||||
import dingding from '@/assets/images/dingding.svg'
|
||||
import wx from '@/assets/images/wx.svg'
|
||||
import qq from '@/assets/images/QQ.svg'
|
||||
import { getCodeImg } from "@/api/login";
|
||||
import Cookies from "js-cookie";
|
||||
import { decrypt, encrypt } from "@/utils/jsencrypt";
|
||||
import dingding from "@/assets/images/dingding.svg";
|
||||
import wx from "@/assets/images/wx.svg";
|
||||
import qq from "@/assets/images/QQ.svg";
|
||||
|
||||
export default {
|
||||
name: 'Login',
|
||||
name: "Login",
|
||||
data() {
|
||||
return {
|
||||
dingding: dingding,
|
||||
wx: wx,
|
||||
qq: qq,
|
||||
codeUrl: '',
|
||||
codeUrl: "",
|
||||
isAdmin: false,
|
||||
loginForm: {
|
||||
username: '',
|
||||
password: '',
|
||||
username: "",
|
||||
password: "",
|
||||
rememberMe: false,
|
||||
code: '',
|
||||
mobile: '',
|
||||
verificationCode: '',
|
||||
uuid: '',
|
||||
loginType: '',
|
||||
phoneUuid: '',
|
||||
mobileCodeType: 'LOGIN'
|
||||
code: "",
|
||||
mobile: "",
|
||||
verificationCode: "",
|
||||
uuid: "",
|
||||
loginType: "",
|
||||
phoneUuid: "",
|
||||
mobileCodeType: "LOGIN",
|
||||
},
|
||||
passwordLoginRules: {
|
||||
username: [{ required: true, trigger: 'blur', message: '请输入您的账号' }],
|
||||
password: [{ required: true, trigger: 'blur', message: '请输入您的密码' }],
|
||||
code: [{ required: true, trigger: 'change', message: '请输入验证码' }]
|
||||
username: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的账号" },
|
||||
],
|
||||
password: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的密码" },
|
||||
],
|
||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }],
|
||||
},
|
||||
mobileLoginRules: {
|
||||
mobile: [{ required: true, trigger: 'blur', message: '请输入您的手机号' }],
|
||||
verificationCode: [{ required: true, trigger: 'blur', message: '请输入验证码' }]
|
||||
mobile: [
|
||||
{ required: true, trigger: "blur", message: "请输入您的手机号" },
|
||||
],
|
||||
verificationCode: [
|
||||
{ required: true, trigger: "blur", message: "请输入验证码" },
|
||||
],
|
||||
},
|
||||
loading: false,
|
||||
captchaEnabled: true,
|
||||
redirect: undefined,
|
||||
isSendingCode: false,
|
||||
countdown: 0,
|
||||
loginMethod: 'password', // 'password' or 'mobile'
|
||||
loginMethod: "password", // 'password' or 'mobile'
|
||||
supportsPhoneLogin: false,
|
||||
supportsEmailLogin: false
|
||||
}
|
||||
supportsEmailLogin: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
config() {
|
||||
return JSON.parse(localStorage.getItem('systemConfig')) || {loginConfig:{
|
||||
phonePassword: true,
|
||||
emailPassword: true,
|
||||
phoneCode: false,
|
||||
emailCode: false
|
||||
},registersConfig: {
|
||||
phoneRegisters: true,
|
||||
emailRegisters: true
|
||||
}}; // 获取 JSON 对象
|
||||
return (
|
||||
JSON.parse(localStorage.getItem("systemConfig")) || {
|
||||
loginConfig: {
|
||||
phonePassword: true,
|
||||
emailPassword: true,
|
||||
phoneCode: false,
|
||||
emailCode: false,
|
||||
},
|
||||
registersConfig: {
|
||||
phoneRegisters: true,
|
||||
emailRegisters: true,
|
||||
},
|
||||
}
|
||||
); // 获取 JSON 对象
|
||||
},
|
||||
loginRules() {
|
||||
return this.loginMethod === 'password' ? this.passwordLoginRules : this.mobileLoginRules
|
||||
}
|
||||
return this.loginMethod === "password"
|
||||
? this.passwordLoginRules
|
||||
: this.mobileLoginRules;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler(route) {
|
||||
this.redirect = route.query && route.query.redirect
|
||||
this.redirect = route.query && route.query.redirect;
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.getCode()
|
||||
this.getCookie()
|
||||
this.getCode();
|
||||
this.getCookie();
|
||||
},
|
||||
methods: {
|
||||
getCode() {
|
||||
getCodeImg().then(res => {
|
||||
this.captchaEnabled = res.captchaEnabled !== undefined ? res.captchaEnabled : true
|
||||
getCodeImg().then((res) => {
|
||||
this.captchaEnabled =
|
||||
res.captchaEnabled !== undefined ? res.captchaEnabled : true;
|
||||
if (this.captchaEnabled) {
|
||||
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||
this.loginForm.uuid = res.uuid
|
||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
||||
this.loginForm.uuid = res.uuid;
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
getCookie() {
|
||||
const username = Cookies.get('username')
|
||||
const password = Cookies.get('password')
|
||||
const rememberMe = Cookies.get('rememberMe')
|
||||
this.loginForm.username = username || ''
|
||||
this.loginForm.password = password ? decrypt(password) : ''
|
||||
this.loginForm.rememberMe = rememberMe === 'true'
|
||||
const username = Cookies.get("username");
|
||||
const password = Cookies.get("password");
|
||||
const rememberMe = Cookies.get("rememberMe");
|
||||
this.loginForm.username = username || "";
|
||||
this.loginForm.password = password ? decrypt(password) : "";
|
||||
this.loginForm.rememberMe = rememberMe === "true";
|
||||
},
|
||||
handleLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
this.$refs.loginForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
this.loading = true;
|
||||
if (this.loginForm.rememberMe) {
|
||||
Cookies.set('username', this.loginForm.username, { expires: 30 })
|
||||
Cookies.set('password', encrypt(this.loginForm.password), { expires: 30 })
|
||||
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 })
|
||||
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
||||
Cookies.set("password", encrypt(this.loginForm.password), {
|
||||
expires: 30,
|
||||
});
|
||||
Cookies.set("rememberMe", this.loginForm.rememberMe, {
|
||||
expires: 30,
|
||||
});
|
||||
} else {
|
||||
Cookies.remove('username')
|
||||
Cookies.remove('password')
|
||||
Cookies.remove('rememberMe')
|
||||
Cookies.remove("username");
|
||||
Cookies.remove("password");
|
||||
Cookies.remove("rememberMe");
|
||||
}
|
||||
this.loginForm.loginMethod = this.loginMethod
|
||||
this.$store.dispatch('Login', this.loginForm)
|
||||
.then(res => {
|
||||
console.log(res)
|
||||
if (res.code===200){
|
||||
if (res.isLogin){
|
||||
this.$modal.confirm('账号已在其他地方登录是否继续登录!!!!').then(function() {
|
||||
return this.$router.push({ path: this.redirect || '/' });
|
||||
}).then(() => {
|
||||
this.loading = false
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
}else {
|
||||
this.$router.push({ path: this.redirect || '/' });
|
||||
this.loginForm.loginMethod = this.loginMethod;
|
||||
this.$store
|
||||
.dispatch("Login", this.loginForm)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
if (res.code === 200) {
|
||||
if (res.isLogin) {
|
||||
this.$modal
|
||||
.confirm("账号已在其他地方登录是否继续登录!!!!")
|
||||
.then(function () {
|
||||
return this.$router.push({ path: this.redirect || "/" });
|
||||
})
|
||||
.then(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
this.$router.push({ path: this.redirect || "/" });
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
if (this.captchaEnabled) this.getCode()
|
||||
})
|
||||
this.loading = false;
|
||||
if (this.captchaEnabled) this.getCode();
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
IsAdmin() {
|
||||
this.loginForm.loginMethod = this.loginMethod
|
||||
this.$store.dispatch('IsAdmin', this.loginForm).then(res => {
|
||||
this.loginForm.loginMethod = this.loginMethod;
|
||||
this.$store.dispatch("IsAdmin", this.loginForm).then((res) => {
|
||||
if (res.data) {
|
||||
this.isAdmin = res.data
|
||||
this.$message.success('检测到您是超级管理账号,需进行手机检验')
|
||||
this.isAdmin = res.data;
|
||||
this.$message.success("检测到您是超级管理账号,需进行手机检验");
|
||||
} else {
|
||||
this.handleLogin()
|
||||
this.handleLogin();
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
isLogin() {
|
||||
this.$refs.loginForm.validate(valid => {
|
||||
this.$refs.loginForm.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true
|
||||
let that = this
|
||||
this.loginForm.loginMethod = this.loginMethod
|
||||
this.$store.dispatch('IsLogin', this.loginForm)
|
||||
.then(res => {
|
||||
this.loading = true;
|
||||
let that = this;
|
||||
this.loginForm.loginMethod = this.loginMethod;
|
||||
this.$store
|
||||
.dispatch("IsLogin", this.loginForm)
|
||||
.then((res) => {
|
||||
if (res.data) {
|
||||
this.$modal.confirm('账号已在其他地方登录是否继续登录!!!!').then(function() {
|
||||
return that.handleLogin()
|
||||
}).then(() => {
|
||||
this.loading = false
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
})
|
||||
this.$modal
|
||||
.confirm("账号已在其他地方登录是否继续登录!!!!")
|
||||
.then(function () {
|
||||
return that.handleLogin();
|
||||
})
|
||||
.then(() => {
|
||||
this.loading = false;
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
} else {
|
||||
that.handleLogin()
|
||||
that.handleLogin();
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
if (this.captchaEnabled) this.getCode()
|
||||
})
|
||||
this.loading = false;
|
||||
if (this.captchaEnabled) this.getCode();
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
sendAdminCode() {
|
||||
this.loginForm.mobile = this.loginForm.username
|
||||
this.$store.dispatch('GetPhoneCode', this.loginForm)
|
||||
.then(res => {
|
||||
this.loginForm.mobile = this.loginForm.username;
|
||||
this.$store
|
||||
.dispatch("GetPhoneCode", this.loginForm)
|
||||
.then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.loginForm.phoneUuid = res.data
|
||||
this.$message.success('验证码发送成功')
|
||||
this.isSendingCode = true
|
||||
this.countdown = 60
|
||||
this.loginForm.phoneUuid = res.data;
|
||||
this.$message.success("验证码发送成功");
|
||||
this.isSendingCode = true;
|
||||
this.countdown = 60;
|
||||
const timer = setInterval(() => {
|
||||
this.countdown -= 1
|
||||
this.countdown -= 1;
|
||||
if (this.countdown <= 0) {
|
||||
clearInterval(timer)
|
||||
this.isSendingCode = false
|
||||
clearInterval(timer);
|
||||
this.isSendingCode = false;
|
||||
}
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
}
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
this.loading = false;
|
||||
// 如果启用了验证码,则重新获取验证码
|
||||
if (this.captchaEnabled) {
|
||||
this.getCode()
|
||||
this.getCode();
|
||||
}
|
||||
// 其他失败处理逻辑
|
||||
this.isSendingCode = false
|
||||
this.countdown = 0
|
||||
})
|
||||
this.isSendingCode = false;
|
||||
this.countdown = 0;
|
||||
});
|
||||
},
|
||||
sendCode() {
|
||||
if (this.captchaEnabled ? !this.loginForm.code : false) {
|
||||
this.$message.error('请先填写验证码')
|
||||
return
|
||||
this.$message.error("请先填写验证码");
|
||||
return;
|
||||
}
|
||||
if (!this.loginForm.mobile) {
|
||||
this.$message.error('请先填写'+this.config.loginConfig.phoneCode ? '手机号' : '/' + this.config.loginConfig.emailCode ? '邮箱' : '')
|
||||
return
|
||||
this.$message.error(
|
||||
"请先填写" + this.config.loginConfig.phoneCode
|
||||
? "手机号"
|
||||
: "/" + this.config.loginConfig.emailCode
|
||||
? "邮箱"
|
||||
: ""
|
||||
);
|
||||
return;
|
||||
}
|
||||
this.$store.dispatch('GetPhoneCode', this.loginForm)
|
||||
this.$store
|
||||
.dispatch("GetPhoneCode", this.loginForm)
|
||||
.then(() => {
|
||||
this.isSendingCode = true
|
||||
this.countdown = 60
|
||||
this.isSendingCode = true;
|
||||
this.countdown = 60;
|
||||
const timer = setInterval(() => {
|
||||
this.countdown -= 1
|
||||
this.countdown -= 1;
|
||||
if (this.countdown <= 0) {
|
||||
clearInterval(timer)
|
||||
this.isSendingCode = false
|
||||
clearInterval(timer);
|
||||
this.isSendingCode = false;
|
||||
}
|
||||
}, 1000)
|
||||
}, 1000);
|
||||
})
|
||||
.catch(() => {
|
||||
this.loading = false
|
||||
this.loading = false;
|
||||
// 如果启用了验证码,则重新获取验证码
|
||||
if (this.captchaEnabled) {
|
||||
this.getCode()
|
||||
this.getCode();
|
||||
}
|
||||
// 其他失败处理逻辑
|
||||
this.isSendingCode = false
|
||||
this.countdown = 0
|
||||
})
|
||||
this.isSendingCode = false;
|
||||
this.countdown = 0;
|
||||
});
|
||||
},
|
||||
toggleLoginMethod() {
|
||||
this.loginMethod = this.loginMethod === 'password' ? 'mobile' : 'password'
|
||||
this.loginForm.username = ''
|
||||
this.loginForm.password = ''
|
||||
this.loginForm.code = ''
|
||||
this.loginForm.verificationCode = ''
|
||||
this.loginForm.loginMethod = ''
|
||||
this.isAdmin = false
|
||||
this.getCode()
|
||||
}
|
||||
}
|
||||
}
|
||||
this.loginMethod =
|
||||
this.loginMethod === "password" ? "mobile" : "password";
|
||||
this.loginForm.username = "";
|
||||
this.loginForm.password = "";
|
||||
this.loginForm.code = "";
|
||||
this.loginForm.verificationCode = "";
|
||||
this.loginForm.loginMethod = "";
|
||||
this.isAdmin = false;
|
||||
this.getCode();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
|
@ -493,17 +592,17 @@ export default {
|
|||
|
||||
.login-divider::before,
|
||||
.login-divider::after {
|
||||
content: '';
|
||||
content: "";
|
||||
flex: 1;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.login-divider:not(:empty)::before {
|
||||
margin-right: .25em;
|
||||
margin-right: 0.25em;
|
||||
}
|
||||
|
||||
.login-divider:not(:empty)::after {
|
||||
margin-left: .25em;
|
||||
margin-left: 0.25em;
|
||||
}
|
||||
|
||||
.login-icons {
|
||||
|
|
|
|||
|
|
@ -14,22 +14,33 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table :data="noticeList" border>
|
||||
<el-table :data="swiperList" border>
|
||||
<el-table-column label="序号" align="center" width="100" type="index" />
|
||||
<el-table-column prop="imgSrc" label="图片链接" align="center" />
|
||||
<el-table-column
|
||||
prop="slidePicture"
|
||||
label="图片链接"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column prop="isShow" label="是否禁用" align="center">
|
||||
<template slot-scope="{ row }">
|
||||
<el-switch
|
||||
active-text="激活"
|
||||
inactive-text="禁用"
|
||||
v-model="row.isShow"
|
||||
v-model="row.delFlag"
|
||||
@change="onSwitchChange($event, row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="outLink" label="外部链接" align="center" />
|
||||
<el-table-column
|
||||
prop="slideLink"
|
||||
label="外部链接"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template>
|
||||
<el-button size="mini" type="danger" @click="onClickDelete">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button size="mini" type="danger" @click="onClickDelete(row)">
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
|
|
@ -50,21 +61,24 @@
|
|||
>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="外部链接:">
|
||||
<el-input placeholder="请输入外部链接" />
|
||||
<el-form-item label="外部链接:" prop="slideLink">
|
||||
<el-input
|
||||
placeholder="请输入外部链接"
|
||||
v-model="addSwiperForm.slideLink"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="是否激活:">
|
||||
<el-form-item label="是否激活:" prop="delFlag">
|
||||
<el-switch
|
||||
active-text="激活"
|
||||
inactive-text="禁用"
|
||||
v-model="value1"
|
||||
v-model="addSwiperForm.delFlag"
|
||||
></el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="轮播图上传:">
|
||||
<el-form-item label="轮播图上传:" prop="fileList">
|
||||
<el-upload
|
||||
:limit="1"
|
||||
:headers="headers"
|
||||
|
|
@ -112,6 +126,7 @@
|
|||
import { getToken } from "@/utils/auth";
|
||||
import {
|
||||
addHomeSwiperApi,
|
||||
getSwiperListApi,
|
||||
deleteHomeSwiperApi,
|
||||
editHomeSwiperTypeApi,
|
||||
} from "@/api/swiper-manage/index.js";
|
||||
|
|
@ -128,11 +143,14 @@ export default {
|
|||
addSwiperFormRules: {},
|
||||
addSwiperForm: {
|
||||
fileList: [],
|
||||
slidePicture: "",
|
||||
slideLink: "",
|
||||
delFlag: true,
|
||||
},
|
||||
headers: {
|
||||
Authorization: "Bearer " + getToken(),
|
||||
},
|
||||
noticeList: [
|
||||
swiperList: [
|
||||
{
|
||||
imgSrc: "xxxx",
|
||||
isShow: true,
|
||||
|
|
@ -151,12 +169,40 @@ export default {
|
|||
],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getSwiperListData();
|
||||
},
|
||||
methods: {
|
||||
handleAdd() {
|
||||
this.addSwiperVisible = true;
|
||||
},
|
||||
submitForm() {
|
||||
this.addSwiperVisible = false;
|
||||
// 获取列表
|
||||
async getSwiperListData() {
|
||||
const res = await getSwiperListApi();
|
||||
this.swiperList = res.rows;
|
||||
|
||||
this.swiperList.forEach((e) => {
|
||||
e.delFlag == 0 ? (e.delFlag = true) : (e.delFlag = false);
|
||||
});
|
||||
// console.log(res, "列表数据--");
|
||||
},
|
||||
async submitForm() {
|
||||
// 组装参数
|
||||
const { slidePicture, slideLink, delFlag } = this.addSwiperForm;
|
||||
const params = {
|
||||
slidePicture,
|
||||
slideLink,
|
||||
delFlag: delFlag ? 0 : 2,
|
||||
};
|
||||
const res = await addHomeSwiperApi(params);
|
||||
if (res.code === 200) {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.$refs.addSwiperFormRef.resetFields();
|
||||
this.addSwiperVisible = false;
|
||||
this.getSwiperListData();
|
||||
}
|
||||
// console.log(res, "上传结果--");
|
||||
// this.addSwiperVisible = false;
|
||||
},
|
||||
cancel() {
|
||||
this.addSwiperVisible = false;
|
||||
|
|
@ -179,11 +225,10 @@ export default {
|
|||
},
|
||||
// 移除
|
||||
handleRemove(file) {
|
||||
this.addSwiperFormRules.fileList =
|
||||
this.addSwiperFormRules.fileList.filter(
|
||||
(item) => item.uid !== file.uid
|
||||
);
|
||||
this.addSwiperFormRules.logo = "";
|
||||
this.addSwiperForm.fileList = this.addSwiperForm.fileList.filter(
|
||||
(item) => item.uid !== file.uid
|
||||
);
|
||||
this.addSwiperForm.slidePicture = "";
|
||||
},
|
||||
// 预览 图片
|
||||
handlePreview(file) {
|
||||
|
|
@ -198,23 +243,39 @@ export default {
|
|||
// 上传成功
|
||||
handleSuccess(res) {
|
||||
if (res.code === 200) {
|
||||
this.addSwiperFormRules.logo = res.data.url;
|
||||
this.addSwiperForm.slidePicture = res.data.url;
|
||||
} else {
|
||||
this.addSwiperFormRules.fileList = [];
|
||||
this.addSwiperFormRules.logo = "";
|
||||
this.addSwiperForm.fileList = [];
|
||||
this.addSwiperForm.slidePicture = "";
|
||||
}
|
||||
this.$modal.closeLoading();
|
||||
},
|
||||
|
||||
onClickDelete() {
|
||||
onClickDelete(row) {
|
||||
this.$confirm("确定删除该轮播图吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {})
|
||||
.then(() => {
|
||||
console.log(row, "row-");
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
onSwitchChange(val, row) {
|
||||
if (!val) {
|
||||
this.$confirm("确定禁用该轮播图吗?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {})
|
||||
.catch(() => {
|
||||
row.isShow = true;
|
||||
});
|
||||
}
|
||||
console.log(row, "row---");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -39,7 +39,8 @@ module.exports = {
|
|||
// target: `http://192.168.2.246:18080`,//马
|
||||
// target: `http://192.168.0.110:18080`,//洪
|
||||
// target: `http://192.168.0.234:18080`,//阮
|
||||
target: `http://36.33.26.201:17788/proxyApi`, //测试
|
||||
// target: `http://36.33.26.201:17788/proxyApi`, //测试
|
||||
target: `http://192.168.0.244:17766/proxyApi`, //测试
|
||||
// target: `http://192.168.137.1:18080`,//
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
|
|
|
|||
Loading…
Reference in New Issue