Commit 7846e648 authored by 赵伟庚's avatar 赵伟庚

[feat](登录页): 对接登录页配置接口,登录页按照配置显示

parent 5df31795
...@@ -4,34 +4,36 @@ ...@@ -4,34 +4,36 @@
:class="{ :class="{
transparent: transparentBg, transparent: transparentBg,
'is-front': isFront, 'is-front': isFront,
}" }">
>
<!-- LOGO --> <!-- LOGO -->
<div @click="gotoPage" class="bg-logo"> <div @click="gotoPage" class="bg-logo">
<img style="width:140px;height:22px;" src="../assets/imgs/img_logo.png"/> <img
style="width: 140px; height: 22px"
:src="systemLogo ? JSON.parse(systemLogo)[0].url : getImageUrl('img_logo.png')" />
</div> </div>
<div class="person-menu" v-if="userInfo&& userInfo.system_id"> <div class="person-menu" v-if="userInfo && userInfo.system_id">
<!-- 用户中心 --> <!-- 用户中心 -->
<div class="user-center nav-item"> <div class="user-center nav-item">
<span class="user-icon"> <span class="user-icon">
<img style="width:24px;height:24px;border-radius:50%;vertical-align:middle;" v-if="userInfo&&userInfo.logo" :src="userInfo&&userInfo.logo" /> <img
<img style="width:24px;height:24px;border-radius:50%;vertical-align:middle;" v-else src="../assets/imgs/home_ic_user.png" /> style="width: 24px; height: 24px; border-radius: 50%; vertical-align: middle"
v-if="userInfo && userInfo.logo"
:src="userInfo && userInfo.logo" />
<img
style="width: 24px; height: 24px; border-radius: 50%; vertical-align: middle"
v-else
src="../assets/imgs/home_ic_user.png" />
</span> </span>
<span class="user-name" v-if="userInfo && userInfo.system_id"> <span class="user-name" v-if="userInfo && userInfo.system_id">
{{ userInfo.system_account || userInfo.system_id }} {{ userInfo.system_account || userInfo.system_id }}
<bg-icon icon="#bg-ic-arrow-down" style="font-size:8px;margin-left: 3px;"></bg-icon> <bg-icon icon="#bg-ic-arrow-down" style="font-size: 8px; margin-left: 3px"></bg-icon>
</span>
<span class="user-name" v-else>
请登录
</span> </span>
<span class="user-name" v-else> 请登录 </span>
<div class="menu-virtual"></div> <div class="menu-virtual"></div>
<div v-if="userInfo && userInfo.system_id" class="menu-list"> <div v-if="userInfo && userInfo.system_id" class="menu-list">
<div class="menu-item text_clip" @click.stop="menuAction('logout')"> <div class="menu-item text_clip" @click.stop="menuAction('logout')">退出登录</div>
退出登录
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -41,34 +43,36 @@ ...@@ -41,34 +43,36 @@
<script> <script>
import { mapState, mapMutations } from "vuex"; import { mapState, mapMutations } from "vuex";
import { clearCookie } from "../services/cookie.js"; import { clearCookie } from "../services/cookie.js";
import {resetRouter} from '../router/index' import { resetRouter } from "../router/index";
import { normalizeProps } from 'vue-demi'; import { normalizeProps } from "vue-demi";
import { getImageUrl } from "@/services/helper.js";
export default { export default {
name: "BgMenu", name: "BgMenu",
components: { }, components: {},
props:{ props: {
path:{ path: {
type:String, type: String,
default:'' default: "",
}, },
}, },
data() { data() {
return { return {
getImageUrl,
documentScrollTop: 0, documentScrollTop: 0,
cartList: [], cartList: [],
showCart: true, showCart: true,
showShopMenu: false, showShopMenu: false,
logo:'../assets/imgs/img_logo.png', logo: "../assets/imgs/img_logo.png",
name:'' name: "",
}; };
}, },
computed: { computed: {
msgUnreadNum(){ msgUnreadNum() {
return this.$store.state.msgUnreadNum return this.$store.state.msgUnreadNum;
}, },
nameFlag(){ nameFlag() {
return this.$store.state.nameFlag return this.$store.state.nameFlag;
}, },
userInfo() { userInfo() {
return this.$store.state.userInfo || {}; return this.$store.state.userInfo || {};
...@@ -78,27 +82,28 @@ export default { ...@@ -78,27 +82,28 @@ export default {
}, },
transparentBg() { transparentBg() {
return ( return (
this.documentScrollTop < 180 && this.documentScrollTop < 180 && (this.$route.name === "shopRecommend" || this.$route.name === "shopSearch")
(this.$route.name === "shopRecommend" ||
this.$route.name === "shopSearch")
); );
}, },
isFront() { isFront() {
let path = this.$route.path; let path = this.$route.path;
return false return false;
},
systemLogo() {
return this.$store.state.systemLogo;
}, },
...mapState({ ...mapState({
fontMenu (state) { fontMenu(state) {
let temp = [] let temp = [];
// state.menu.forEach(e => { // state.menu.forEach(e => {
// if(e.dict_group_id=='2cb4f767-fad7-44f2-afa3-f055e15dd2b6'){//font // if(e.dict_group_id=='2cb4f767-fad7-44f2-afa3-f055e15dd2b6'){//font
// temp.push(e) // temp.push(e)
// } // }
// }); // });
return temp return temp;
}, },
managerMenu(state){ managerMenu(state) {
let temp = [] let temp = [];
// state.menu.forEach(e => { // state.menu.forEach(e => {
// if(e.dict_group_id=='64c156e0-bfff-4bfc-a63a-56effe130a25'){//system // if(e.dict_group_id=='64c156e0-bfff-4bfc-a63a-56effe130a25'){//system
...@@ -107,28 +112,27 @@ export default { ...@@ -107,28 +112,27 @@ export default {
// temp.push(e) // temp.push(e)
// } // }
// // temp.push(e) // // temp.push(e)
// } // }
// }); // });
return temp return temp;
}, },
systemMenu(state){ systemMenu(state) {
let temp = [] let temp = [];
state.menu.forEach(e => { state.menu.forEach((e) => {
if(e.dict_group_id=='09938937-3db9-47de-b967-7777ea4ebb2d'){//manager if (e.dict_group_id == "09938937-3db9-47de-b967-7777ea4ebb2d") {
temp.push(e) //manager
temp.push(e);
} }
}); });
return temp return temp;
} },
}) }),
}, },
watch: { watch: {
nameFlag(n,o){ nameFlag(n, o) {
this.getLogo() this.getLogo();
} },
// cartState() { // cartState() {
// this.getCartList(); // this.getCartList();
// }, // },
...@@ -138,26 +142,25 @@ export default { ...@@ -138,26 +142,25 @@ export default {
}, },
methods: { methods: {
openMsg() { openMsg() {
this.$emit('openMsg',true) this.$emit("openMsg", true);
}, },
...mapMutations(["setCartNum"]), ...mapMutations(["setCartNum"]),
navAction(path) { navAction(path) {
this.$router.push(path); this.$router.push(path);
}, },
gotoPage(){ gotoPage() {
window.open('/apaas/portal/ui/#/','_blank') window.open("/apaas/portal/ui/#/", "_blank");
}, },
changezz(item){ changezz(item) {
this.$trace.setOptionValue('appID',item.value) this.$trace.setOptionValue("appID", item.value);
}, },
getLogo(){ getLogo() {
// this.$axios.get(`/apaas/system/getPicAndSystemName`).then(res=>{ // this.$axios.get(`/apaas/system/getPicAndSystemName`).then(res=>{
// if(res.data.code==200){ // if(res.data.code==200){
// let data = res.data.data // let data = res.data.data
// this.name=data.systemName // this.name=data.systemName
// this.logo = data.picture // this.logo = data.picture
// document.title = this.name // document.title = this.name
// var link = document.querySelector("link[rel*='icon']")||document.createElement('link'); // var link = document.querySelector("link[rel*='icon']")||document.createElement('link');
// link.type = 'image/x-icon'; // link.type = 'image/x-icon';
// link.rel = 'shortcut icon'; // link.rel = 'shortcut icon';
...@@ -166,19 +169,19 @@ export default { ...@@ -166,19 +169,19 @@ export default {
// } // }
// }) // })
}, },
menuAction(n,parent) { menuAction(n, parent) {
if (n == "logout") { if (n == "logout") {
this.$axios.post(`/apaas/system/v5/user/logout`).then(res=>{ this.$axios.post(`/apaas/system/v5/user/logout`).then((res) => {
if(res.data.code=='200'){ if (res.data.code == "200") {
window.location.href = `/apaas/manage/ui/#/login`; window.location.href = `/apaas/manage/ui/#/login`;
this.$store.commit('setUserInfo',null) this.$store.commit("setUserInfo", null);
clearCookie('bgToken') clearCookie("bgToken");
this.$message.success('退出成功') this.$message.success("退出成功");
resetRouter() resetRouter();
}else{ } else {
this.$message.error('退出失败') this.$message.error("退出失败");
} }
}) });
} else if (n == "login") { } else if (n == "login") {
let path = this.$route.path; let path = this.$route.path;
window.location.href = `/apaas/manage/ui/#/login?redirect=${path}`; window.location.href = `/apaas/manage/ui/#/login?redirect=${path}`;
...@@ -186,38 +189,38 @@ export default { ...@@ -186,38 +189,38 @@ export default {
//是否有子路由,有则寻找子路由的第一个进行跳转,无则直接进行跳转 //是否有子路由,有则寻找子路由的第一个进行跳转,无则直接进行跳转
//使用childMenuAction是模拟template中,子路径点击跳转使用childMenuAction, //使用childMenuAction是模拟template中,子路径点击跳转使用childMenuAction,
//防止出现层级错误的问题 //防止出现层级错误的问题
if(parent.children&&parent.children.length&&parent.menuType!==1){ if (parent.children && parent.children.length && parent.menuType !== 1) {
this.childMenuAction(parent.children[0],parent) this.childMenuAction(parent.children[0], parent);
}else{ } else {
this.pathToUrl(n,parent) this.pathToUrl(n, parent);
} }
} }
}, },
childMenuAction(v,parent) { childMenuAction(v, parent) {
//最多只有2层目录,childMenuAction已经进入第一层,只需判断是否还有第二层即可 //最多只有2层目录,childMenuAction已经进入第一层,只需判断是否还有第二层即可
//有第二层则继续找第二层的第一个跳转 //有第二层则继续找第二层的第一个跳转
//无第二层则直接跳转 //无第二层则直接跳转
if(v.children&&v.children.length){ if (v.children && v.children.length) {
for (let index = 0; index < v.children.length; index++) { for (let index = 0; index < v.children.length; index++) {
const e = v.children[index]; const e = v.children[index];
if(e.menuType!==2){ if (e.menuType !== 2) {
this.pathToUrl(e,parent) this.pathToUrl(e, parent);
break break;
} }
} }
}else{ } else {
this.pathToUrl(v,parent) this.pathToUrl(v, parent);
} }
}, },
pathToUrl(item,parent){ pathToUrl(item, parent) {
//判断是否是外链,是则新开窗口跳转 //判断是否是外链,是则新开窗口跳转
if(item.path.includes('http')){ if (item.path.includes("http")) {
window.open(item.path,'_blank') window.open(item.path, "_blank");
}else{ } else {
//判断是否是新窗口打开 //判断是否是新窗口打开
if(item.new_window){ if (item.new_window) {
window.open(item.path,'_blank') window.open(item.path, "_blank");
}else{ } else {
this.$router.push(item.path); this.$router.push(item.path);
} }
} }
...@@ -231,18 +234,16 @@ export default { ...@@ -231,18 +234,16 @@ export default {
scrollAction() { scrollAction() {
this.documentScrollTop = document.documentElement.scrollTop || 0; this.documentScrollTop = document.documentElement.scrollTop || 0;
}, },
}, },
created() { created() {
this.getLogo() this.getLogo();
if (this.userInfo) { if (this.userInfo) {
// this.getUserDetail(this.userInfo.user_id) // this.getUserDetail(this.userInfo.user_id)
}else { } else {
// this.getUserInfo() // this.getUserInfo()
} }
}, },
mounted() { mounted() {
this.$nextTick(this.scrollAction); this.$nextTick(this.scrollAction);
window.addEventListener("scroll", this.scrollAction, true); window.addEventListener("scroll", this.scrollAction, true);
window.addEventListener("click", this.shopMenEventListener); window.addEventListener("click", this.shopMenEventListener);
...@@ -280,19 +281,18 @@ export default { ...@@ -280,19 +281,18 @@ export default {
} }
} }
> .menu-virtual{ > .menu-virtual {
width: 128px; width: 128px;
height: 10px; height: 10px;
position: absolute; position: absolute;
top: 49px; top: 49px;
right: 0; right: 0;
z-index: 9; z-index: 9;
background-color: rgba(0,0,0,0); background-color: rgba(0, 0, 0, 0);
} }
> .menu-list { > .menu-list {
box-shadow: 0px 4px 12px 0px box-shadow: 0px 4px 12px 0px rgba(18, 30, 63, 0.1);
rgba(18, 30, 63, 0.1);
background-color: #ffffff; background-color: #ffffff;
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
...@@ -362,15 +362,15 @@ export default { ...@@ -362,15 +362,15 @@ export default {
font-size: 24px; font-size: 24px;
font-weight: bolder; font-weight: bolder;
margin-left: 10px; margin-left: 10px;
background: linear-gradient(to bottom, #d6e0fc,#9cb0e5); background: linear-gradient(to bottom, #d6e0fc, #9cb0e5);
-webkit-background-clip:text; -webkit-background-clip: text;
color:transparent; color: transparent;
line-height: 40px; line-height: 40px;
} }
} }
//个人菜单 //个人菜单
.person-menu{ .person-menu {
height: 100%; height: 100%;
padding-left: 32px; padding-left: 32px;
position: inherit; position: inherit;
...@@ -378,7 +378,7 @@ export default { ...@@ -378,7 +378,7 @@ export default {
align-items: center; align-items: center;
column-gap: 35px; column-gap: 35px;
.message{ .message {
height: 16px; height: 16px;
line-height: 16px; line-height: 16px;
background-color: #d14731; background-color: #d14731;
......
<template> <template>
<div class="login-container"> <div
class="login-container"
:style="{
'background-image': `url(${
configOptions.backgroundUrl ? JSON.parse(configOptions.backgroundUrl)[0].url : getImageUrl('bg.png')
})`,
}">
<div class="bg-warning">系统有效期剩余345 天,请管理员及时更换license!</div> <div class="bg-warning">系统有效期剩余345 天,请管理员及时更换license!</div>
<div class="bg-main"> <div class="bg-main">
<!-- <div class="bg-logo"> <!-- <div class="bg-logo">
...@@ -23,9 +29,17 @@ ...@@ -23,9 +29,17 @@
</div> </div>
<!-- v-if="pageType !== 'register'" --> <!-- v-if="pageType !== 'register'" -->
<div class="bg-msg"> <div class="bg-msg">
<p>Copyright © 比格大数据, All Rights Reserved.</p> <p v-if="configOptions && configOptions.patent">{{ configOptions.patent }}</p>
<p>ICP备案序号:晋ICP备12000773号 | 晋公网安备 14010602060307号</p> <p v-if="configOptions">
<p>法律声明 | 隐私政策</p> <span class="can_click_text" @click="open(configOptions.icpUrl)"> {{ configOptions.icpFiling }} | </span>
<span class="can_click_text" @click="open(configOptions.publicSecurityUrl)">
{{ configOptions.publicSecurityFiling }}
</span>
</p>
<p>
<span class="can_click_text" @click="open(configOptions.legalStatementUrl)">法律声明</span> |
<span class="can_click_text" @click="open(configOptions.privacyPolicyUrl)"> 隐私政策 </span>
</p>
</div> </div>
</div> </div>
</template> </template>
...@@ -33,18 +47,18 @@ ...@@ -33,18 +47,18 @@
<script setup> <script setup>
import LoginByAccount from "@/components/login-by-account.vue"; import LoginByAccount from "@/components/login-by-account.vue";
import LoginByCode from "@/components/login-by-code.vue"; import LoginByCode from "@/components/login-by-code.vue";
// import RegisterPersonalUser from "@/components/register-personal-user.vue"; import axios from "axios";
// import RegisterFrimUser from "@/components/register-firm-user.vue"; import { ElMessage } from "element-plus";
// import RegisterOrgUser from "@/components/register-org-user.vue"; import { ref, onBeforeMount, onMounted } from "vue";
// import RegisterSuccess from "@/components/register-success.vue";
import { ref, computed, onMounted } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import store from "../../store";
import { getImageUrl } from "@/services/helper.js";
const router = useRouter(); const router = useRouter();
const pageType = ref("login"); const pageType = ref("login");
const loginTab = ref("account"); const loginTab = ref("account");
const registerTab = ref("registerTab");
const configOptions = ref({});
const switchPageType = (type) => { const switchPageType = (type) => {
// pageType.value = type // pageType.value = type
router.push("/registe"); router.push("/registe");
...@@ -52,13 +66,34 @@ const switchPageType = (type) => { ...@@ -52,13 +66,34 @@ const switchPageType = (type) => {
const password = () => { const password = () => {
router.push("/password"); router.push("/password");
}; };
const getLoginPageConfig = () => {
axios.get(`/apaas/system/v5/login/loginDetail`).then((res) => {
if (res.data.code == 200) {
configOptions.value = res.data.data || null;
store.commit("setSystemLogo", configOptions.value.logoUrl);
} else {
ElMessage.error(res.data.data);
}
});
};
const open = (url) => {
if (url !== "") {
window.open(url);
} else {
return;
}
};
onBeforeMount(() => {
getLoginPageConfig();
});
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.login-container { .login-container {
width: 100vw; width: 100vw;
height: calc(100vh - 56px); height: calc(100vh - 56px);
background-image: url("@/assets/imgs/bg_zhuce.png"); background-image: url("@/assets/imgs/bg.png");
background-size: 100% 100%; background-size: 100% 100%;
background-position: center center; background-position: center center;
position: relative; position: relative;
......
...@@ -4,55 +4,60 @@ ...@@ -4,55 +4,60 @@
<bg-breadcrumb></bg-breadcrumb> <bg-breadcrumb></bg-breadcrumb>
<div class="main_container"> <div class="main_container">
<div class="form_content apaas_scroll_nor"> <div class="form_content apaas_scroll_nor">
<el-form ref="refForm" :model="formData" :rules="rules" label-width="82px" class="registerForm"> <el-form ref="refForm" :model="formData" :rules="rules" label-width="96px" class="registerForm">
<el-form-item label="LOGO" prop="logo"> <el-form-item label="LOGO" prop="logoUrl">
<bg-upload-image <bg-upload-image
v-model="formData.logo" v-model="formData.logoUrl"
:fileSize="1"
:showTips="true" :showTips="true"
customTips="请选择图片上传:支持jpg、png等格式,图片需小于500KBB" customTips="请选择图片上传:支持jpg、png等格式,图片需小于500KB"
:fileSize="500"
:fileSizeUnit="'KB'"
:limit="1" :limit="1"
listType="picture-card" listType="picture-card"
@change="changeLogo"
:accept="['.jpg', '.jpeg', '.png']"></bg-upload-image> :accept="['.jpg', '.jpeg', '.png']"></bg-upload-image>
</el-form-item> </el-form-item>
<el-form-item label="登录背景图" prop="banner"> <el-form-item label="登录背景图" prop="backgroundUrl">
<bg-upload-image <bg-upload-image
v-model="formData.banner" v-model="formData.backgroundUrl"
:fileSize="1" :fileSize="2"
:showTips="true" :showTips="true"
customTips="请选择图片上传:大小1920 * 1026像素支持jpg、png等格式,图片需小于1MB" customTips="请选择图片上传:大小1920 * 1026像素支持jpg、png等格式,图片需小于2MB"
:limit="1" :limit="1"
listType="picture-card" listType="picture-card"
@change="changeBanner"
:accept="['.jpg', '.jpeg', '.png']"></bg-upload-image> :accept="['.jpg', '.jpeg', '.png']"></bg-upload-image>
</el-form-item> </el-form-item>
<bg-form-gap title="底部所有权内容"></bg-form-gap> <bg-form-gap title="底部所有权内容"></bg-form-gap>
<el-form-item label="内容" prop="force"> <el-form-item label="内容" prop="patent">
<el-input placeholder="例如:Copyright © 某某大数据, All Rights Reserved." maxlength="100"></el-input> <el-input
v-model.trim="formData.patent"
placeholder="例如:Copyright © 某某大数据, All Rights Reserved."></el-input>
</el-form-item> </el-form-item>
<bg-form-gap title="底部ICP备案"></bg-form-gap> <bg-form-gap title="底部ICP备案"></bg-form-gap>
<el-form-item label="内容" prop="force"> <el-form-item label="内容" prop="icpFiling">
<el-input placeholder="请输入" maxlength="100"></el-input> <el-input placeholder="请输入" v-model.trim="formData.icpFiling"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="跳转连接" prop="force"> <el-form-item label="跳转连接" prop="icpUrl">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input> <el-input placeholder="例如:https://...或http://..." v-model.trim="formData.icpUrl"></el-input>
</el-form-item> </el-form-item>
<bg-form-gap title="底部公安网备案"></bg-form-gap> <bg-form-gap title="底部公安网备案"></bg-form-gap>
<el-form-item label="内容" prop="force"> <el-form-item label="内容" prop="publicSecurityFiling">
<el-input placeholder="请输入" maxlength="100"></el-input> <el-input placeholder="请输入" v-model.trim="formData.publicSecurityFiling"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="跳转连接" prop="force"> <el-form-item label="跳转连接" prop="publicSecurityUrl">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input> <el-input placeholder="例如:https://...或http://..." v-model.trim="formData.publicSecurityUrl"></el-input>
</el-form-item> </el-form-item>
<bg-form-gap title="法律声明"></bg-form-gap> <bg-form-gap title="法律声明"></bg-form-gap>
<el-form-item label="跳转连接" prop="force"> <el-form-item label="跳转连接" prop="legalStatementUrl">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input> <el-input placeholder="例如:https://...或http://..." v-model.trim="formData.legalStatementUrl"></el-input>
</el-form-item> </el-form-item>
<bg-form-gap title="隐私政策"></bg-form-gap> <bg-form-gap title="隐私政策"></bg-form-gap>
<el-form-item label="跳转连接" prop="force"> <el-form-item label="跳转连接" prop="privacyPolicyUrl">
<el-input placeholder="例如:https://...或http://..." maxlength="100"></el-input> <el-input placeholder="例如:https://...或http://..." v-model.trim="formData.privacyPolicyUrl"></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -70,13 +75,79 @@ import axios from "../../../../request/http.js"; ...@@ -70,13 +75,79 @@ import axios from "../../../../request/http.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue"; import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
import { validateLink } from "@/services/rules.js";
//表单数据 const refForm = ref(null);
const formData = reactive({
logo: "", const state = reactive({
formData: {
logoUrl: [],
backgroundUrl: [],
patent: "",
icpFiling: "",
icpUrl: "",
publicSecurityFiling: "",
publicSecurityUrl: "",
legalStatementUrl: "",
privacyPolicyUrl: "",
}, //表单数据
rules: {
logoUrl: [{ required: true, message: "请上传Logo", trigger: "change" }],
backgroundUrl: [{ required: true, message: "请上传背景图", trigger: "change" }],
icpUrl: [{ validator: validateLink, trigger: "blur" }],
publicSecurityUrl: [{ validator: validateLink, trigger: "blur" }],
legalStatementUrl: [{ validator: validateLink, trigger: "blur" }],
privacyPolicyUrl: [{ validator: validateLink, trigger: "blur" }],
}, //表单校验规则
}); });
//表单校验规则
const rules = reactive({}); const changeLogo = (value) => {
if (value && value.length > 0) {
refForm.value.clearValidate("logoUrl");
}
};
const changeBanner = (value) => {
if (value && value.length > 0) {
refForm.value.clearValidate("backgroundUrl");
}
};
const save = () => {
refForm.value.validate((valid) => {
if (valid) {
let params = {
...state.formData
}
params.logoUrl = JSON.stringify(params.logoUrl)
params.backgroundUrl = JSON.stringify(params.backgroundUrl)
axios.put(`/apaas/system/v5/login/updateLogin`,params).then(res => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg)
getLoginPageConfig()
}else {
ElMessage.error(res.data.data)
}
})
} else {
ElMessage.error("请先将表单填写完整");
}
});
};
const getLoginPageConfig = () => {
axios.get(`/apaas/system/v5/login/loginDetail`).then(res => {
if (res.data.code == 200) {
let data = res.data.data
data.logoUrl = data.logoUrl ? JSON.parse(data.logoUrl) : []
data.backgroundUrl = data.backgroundUrl ? JSON.parse(data.backgroundUrl) : []
Object.assign(state.formData,data)
}else {
ElMessage.error(res.data.data)
}
})
}
onBeforeMount(() => {
getLoginPageConfig()
})
const { formData, rules } = toRefs(state);
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
...@@ -7,22 +7,17 @@ ...@@ -7,22 +7,17 @@
ref="accountRef" ref="accountRef"
style="max-width: 90%"> style="max-width: 90%">
<el-form-item label="手机号" prop="phone"> <el-form-item label="手机号" prop="phone">
<el-input v-model="accountForm.phone" @input="phoneChange"/> <el-input v-model="accountForm.phone" @input="phoneChange" />
</el-form-item> </el-form-item>
<el-form-item label="账号" prop="account" > <el-form-item label="账号" prop="account">
<el-input v-model="accountForm.account" disabled /> <el-input v-model="accountForm.account" disabled />
</el-form-item> </el-form-item>
<el-form-item label="验证码" prop="code"> <el-form-item label="验证码" prop="code">
<div class="msg-code"> <div class="msg-code">
<el-input <el-input v-model="accountForm.code" placeholder="请输入" style="860px"> </el-input>
v-model="accountForm.code"
placeholder="请输入"
style="860px"
>
</el-input>
<div class="yzm_img"> <div class="yzm_img">
<el-button type="primary" @click.prevent="getMsgCode()" style="width: 100%;height: 34px;"> <el-button type="primary" :disabled="countDown > 0" @click.prevent="getMsgCode()" style="width: 100%; height: 34px">
{{countDown > 0 ? countDown + '秒后再次获取' : '发送验证码'}} {{ countDown > 0 ? countDown + "秒后再次获取" : "发送验证码" }}
</el-button> </el-button>
</div> </div>
</div> </div>
...@@ -34,32 +29,25 @@ ...@@ -34,32 +29,25 @@
import { reactive, ref, onBeforeMount, onMounted, computed } from "vue"; import { reactive, ref, onBeforeMount, onMounted, computed } from "vue";
import axios from "@/request/http.js"; import axios from "@/request/http.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { validatePhone } from "@/services/rules.js" import { validatePhone } from "@/services/rules.js";
const props = defineProps({ const props = defineProps({});
});
const accountForm = reactive({ const accountForm = reactive({
phone: "", phone: "",
account: "", account: "",
code: "" code: "",
}); });
const formRules = reactive({ const formRules = reactive({
phone: [ phone: [
{ required: true, message: "请输入手机号", trigger: "blur" }, { required: true, message: "请输入手机号", trigger: "blur" },
{ validator: validatePhone, trigger: "blur" }, { validator: validatePhone, trigger: "blur" },
], ],
account: [ account: [{ required: true, message: "请输入账号", trigger: "blur" }],
{ required: true, message: "请输入账号", trigger: "blur" }, code: [{ required: true, message: "请输入验证码", trigger: "blur" }],
],
code: [
{ required: true, message: "请输入验证码", trigger: "blur" },
],
}); });
const countDown = ref(0) const countDown = ref(0);
const countDownTimer = ref(null) const countDownTimer = ref(null);
const accountRef = ref(null); const accountRef = ref(null);
const emit = defineEmits(["action"]); const emit = defineEmits(["action"]);
...@@ -85,18 +73,17 @@ const setForm = (data) => { ...@@ -85,18 +73,17 @@ const setForm = (data) => {
const getMsgCode = () => { const getMsgCode = () => {
if (accountForm.account) { if (accountForm.account) {
axios.post('/apaas/system/v5/sms/verifyCode',{phone: accountForm.phone}).then(({ data }) => { axios.post("/apaas/system/v5/sms/verifyCode", { phone: accountForm.phone }).then(({ data }) => {
if (data.code == 200) { if (data.code == 200) {
countDownAction(); countDownAction();
}else { } else {
ElMessage.error(data.data); ElMessage.error(data.data);
} }
}); });
}else { } else {
ElMessage.error("该手机号未注册,请核对手机号!"); ElMessage.error("该手机号未注册,请核对手机号!");
} }
}; // 获取验证码
};// 获取验证码
const countDownAction = () => { const countDownAction = () => {
countDown.value = 60; countDown.value = 60;
...@@ -111,27 +98,25 @@ const countDownAction = () => { ...@@ -111,27 +98,25 @@ const countDownAction = () => {
clearInterval(countDownTimer.value); clearInterval(countDownTimer.value);
} }
}, 1000); }, 1000);
} };
const phoneChange = () => { const phoneChange = () => {
if(accountForm.phone.length > 10) { if (accountForm.phone.length > 10) {
accountRef.value.validateField('phone').then(valid => { accountRef.value.validateField("phone").then((valid) => {
if(valid) { if (valid) {
axios.get(`/apaas/system/v5/user/phoneToAccount?phone=${accountForm.phone}`).then((res) => { axios.get(`/apaas/system/v5/user/phoneToAccount?phone=${accountForm.phone}`).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
accountForm.account = res.data.data || '' accountForm.account = res.data.data || "";
} else { } else {
ElMessage.error(res.data.data); ElMessage.error(res.data.data);
} }
}); });
} }
}) });
} }
} };
onBeforeMount(() => {
}); onBeforeMount(() => {});
onMounted(() => {}); onMounted(() => {});
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<div class="bg-breadcrumb"> <div class="bg-breadcrumb">
<el-breadcrumb separator="/"> <el-breadcrumb separator="/">
<el-breadcrumb-item :to="{ path: '/login' }"> 登录 </el-breadcrumb-item> <el-breadcrumb-item :to="{ path: '/login' }"> 登录 </el-breadcrumb-item>
<el-breadcrumb-item > 忘记密码 </el-breadcrumb-item> <el-breadcrumb-item> 忘记密码 </el-breadcrumb-item>
</el-breadcrumb> </el-breadcrumb>
</div> </div>
<div class="page_content flex_cloumn"> <div class="page_content flex_cloumn">
...@@ -52,13 +52,8 @@ ...@@ -52,13 +52,8 @@
v-show="step === 1" v-show="step === 1"
ref="accountFromRef" ref="accountFromRef"
:form-type="route.query.id ? true : false" :form-type="route.query.id ? true : false"
:id="route.query.id"
@action="getAccountFromData"></accountFrom> @action="getAccountFromData"></accountFrom>
<passwordForm <passwordForm v-show="step === 2" ref="passwordFormRef" @action="getPasswordFormData"></passwordForm>
v-show="step === 2"
ref="passwordFormRef"
:id="route.query.id"
@action="getPasswordFormData"></passwordForm>
<div class="process_end" v-show="step === 3"> <div class="process_end" v-show="step === 3">
<div> <div>
<div> <div>
...@@ -66,11 +61,7 @@ ...@@ -66,11 +61,7 @@
<img v-else src="@/assets/imgs/img_data-fail.png" alt="" /> <img v-else src="@/assets/imgs/img_data-fail.png" alt="" />
</div> </div>
<div class="font_bold"> <div class="font_bold">
{{ {{ successFlag ? "密码修改成功" : "密码修改失败" }}
successFlag
? "密码修改成功"
: "密码修改失败"
}}
</div> </div>
<el-button type="primary" @click="cancel">返回登录页</el-button> <el-button type="primary" @click="cancel">返回登录页</el-button>
<el-button type="primary" @click="continueEdit">重新修改</el-button> <el-button type="primary" @click="continueEdit">重新修改</el-button>
...@@ -101,7 +92,7 @@ import { reactive, ref, onBeforeMount, toRefs, computed, onBeforeUnmount, onMoun ...@@ -101,7 +92,7 @@ import { reactive, ref, onBeforeMount, toRefs, computed, onBeforeUnmount, onMoun
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import axios from "@/request/http.js"; import axios from "@/request/http.js";
import { ElMessage } from "element-plus"; import { ElMessage } from "element-plus";
import { Encrypt } from "@/services/secret.js" import { Encrypt } from "@/services/secret.js";
const route = useRoute(); const route = useRoute();
const router = useRouter(); const router = useRouter();
const step = ref(1); const step = ref(1);
...@@ -126,7 +117,6 @@ const getAccountFromData = (data) => { ...@@ -126,7 +117,6 @@ const getAccountFromData = (data) => {
Object.assign(formData, data); Object.assign(formData, data);
step.value = 2; step.value = 2;
//校验手机号验证码 未出接口 //校验手机号验证码 未出接口
} else { } else {
} }
}; };
...@@ -136,12 +126,11 @@ const getPasswordFormData = (data) => { ...@@ -136,12 +126,11 @@ const getPasswordFormData = (data) => {
Object.assign(formData, data); Object.assign(formData, data);
let params = { let params = {
phone: formData.phone, phone: formData.phone,
password: Encrypt(formData.new_password) password: Encrypt(formData.new_password),
}; };
axios.post(`/apaas/system/v5/user/update/pwd`, params).then((res) => { axios.post(`/apaas/system/v5/user/update/pwd`, params).then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
successFlag.value = true; successFlag.value = true;
} else { } else {
ElMessage.error(res.data.data); ElMessage.error(res.data.data);
} }
...@@ -169,11 +158,8 @@ const cancel = () => { ...@@ -169,11 +158,8 @@ const cancel = () => {
router.go(-1); router.go(-1);
}; };
onBeforeUnmount(() => {}); onBeforeUnmount(() => {});
onMounted(() => { onMounted(() => {});
});
</script> </script>
<style scoped> <style scoped>
......
...@@ -21,8 +21,7 @@ const passwordForm = reactive({ ...@@ -21,8 +21,7 @@ const passwordForm = reactive({
new_password: "", new_password: "",
confirm_password: "", confirm_password: "",
}); });
const props = defineProps({ const props = defineProps({});
});
const validatePass = (rule, value, callback) => { const validatePass = (rule, value, callback) => {
if (value !== passwordForm.new_password) { if (value !== passwordForm.new_password) {
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<div class="msg-code"> <div class="msg-code">
<el-input v-model="infoForm.code" placeholder="请输入" style="860px"> </el-input> <el-input v-model="infoForm.code" placeholder="请输入" style="860px"> </el-input>
<div class="yzm_img"> <div class="yzm_img">
<el-button type="primary" style="width: 100%; height: 34px" @click="sendSms" :disabled="countDown"> <el-button type="primary" style="width: 100%; height: 34px" @click="sendSms" :disabled="countDown > 0">
{{ countDown > 0 ? countDown + "秒后再次获取" : "发送验证码" }} {{ countDown > 0 ? countDown + "秒后再次获取" : "发送验证码" }}
</el-button> </el-button>
</div> </div>
......
...@@ -255,6 +255,9 @@ var getFirstChild = function(menuObj,path){ ...@@ -255,6 +255,9 @@ var getFirstChild = function(menuObj,path){
} }
} }
} }
var getImageUrl = function(name) {
return new URL(`../assets/imgs/${name}`, import.meta.url).href;
};
var pathToUrl = (path)=>{ var pathToUrl = (path)=>{
if(path.includes('http')){ if(path.includes('http')){
...@@ -279,4 +282,5 @@ export { ...@@ -279,4 +282,5 @@ export {
timeForMatAdd, timeForMatAdd,
useConsole, useConsole,
getFirstChild, getFirstChild,
getImageUrl,
} }
...@@ -55,3 +55,15 @@ export function validateIdNumber(rule, value, callback) { ...@@ -55,3 +55,15 @@ export function validateIdNumber(rule, value, callback) {
} }
}, 100); }, 100);
} // 验证身份证号码 } // 验证身份证号码
export function validateLink(rule,value,callback) {
const reg = /^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/
setTimeout(() => {
if (reg.test(value) || value == "") {
callback()
}else {
callback(new Error("地址格式不正确,请重新输入"))
}
})
}
...@@ -12,7 +12,8 @@ const store = createStore({ ...@@ -12,7 +12,8 @@ const store = createStore({
menuObj:{}, menuObj:{},
treeFlag:false, treeFlag:false,
registerValid:false, registerValid:false,
msgUnreadNum: 0 msgUnreadNum: 0,
systemLogo: "",
}, },
getters: { getters: {
count(state) { count(state) {
...@@ -50,6 +51,9 @@ const store = createStore({ ...@@ -50,6 +51,9 @@ const store = createStore({
setUnreadNum(state, num) { setUnreadNum(state, num) {
state.msgUnreadNum = num state.msgUnreadNum = num
}, },
setSystemLogo(state,logo) {
state.systemLogo = logo
}
}, },
actions: {} actions: {}
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment