|
@@ -1,184 +1,374 @@
|
|
|
<template>
|
|
|
- <div
|
|
|
- v-loading.fullscreen.lock="loading"
|
|
|
- :element-loading-text="$t('loading')"
|
|
|
- class="aui-wrapper"
|
|
|
- >
|
|
|
- <template v-if="!loading">
|
|
|
- <main-sidebar v-if="!$store.state.isfull" />
|
|
|
- <div
|
|
|
- class="aui-content__wrapper"
|
|
|
- :style="{
|
|
|
- 'margin-left': $store.state.isFull ? '0' : '240px',
|
|
|
- width: $store.state.isFull ? '100%' : 'calc(100% - 240px)',
|
|
|
- 'overflow-y':'auto'
|
|
|
- }"
|
|
|
- >
|
|
|
- <div class="page">
|
|
|
- <div class="box">
|
|
|
- <div class="title">{{helloWord}}</div>
|
|
|
- <div class="tip">{{helloTip}}</div>
|
|
|
- <div class="ask">
|
|
|
- <div class="question">
|
|
|
- <el-input type="textarea" :rows="2" v-model="question" placeholder="有什么问题,您可以对我提问!" resize="none"></el-input>
|
|
|
- </div>
|
|
|
- <div class="btns">
|
|
|
- <div class="left">
|
|
|
- <div class="copy">
|
|
|
- <img src="@/assets/images/agent/link.png">
|
|
|
- </div>
|
|
|
- <div class="think" :class="{'active':deepThink}" @click="toDeepThink">
|
|
|
- <img src="@/assets/images/agent/think.png">
|
|
|
- <span>深度思考</span>
|
|
|
+ <div class="page">
|
|
|
+ <img src="@/assets/images/agent/ch_logo.png" class="logo">
|
|
|
+ <div class="login">
|
|
|
+ <div class="l_tabs adfac">
|
|
|
+ <div class="t_pre" :class="{'active':tidx===1}" @click="handleChangeTab(1)">账号密码登录</div>
|
|
|
+ <div class="t_pre" :class="{'active':tidx===2}" @click="handleChangeTab(2)">验证码登录</div>
|
|
|
+ </div>
|
|
|
+ <div class="l_form">
|
|
|
+ <template v-if="tidx===1">
|
|
|
+ <el-form ref="accountRef" :model="accountForm" :rules="accountRules" label-width="0px">
|
|
|
+ <el-form-item label="" prop="username">
|
|
|
+ <el-input v-model="accountForm.username" placeholder="请输入账号" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="" prop="password">
|
|
|
+ <el-input show-password v-model="accountForm.password" placeholder="请输入密码" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ <template v-else-if="tidx===2">
|
|
|
+ <el-form ref="codeRef" :model="codeForm" :rules="codeRules" label-width="0px">
|
|
|
+ <el-form-item label="" prop="phone">
|
|
|
+ <el-input type="number" v-model="codeForm.phone" placeholder="请输入手机号码" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="" prop="code">
|
|
|
+ <div class="c_pre">
|
|
|
+ <div class="left">
|
|
|
+ <el-input v-model="codeForm.code" placeholder="请输入验证码"></el-input>
|
|
|
+ </div>
|
|
|
+ <div class="cp_right" @click="handleCode">
|
|
|
+ <span>{{ codeBtnText }}</span>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div class="right">
|
|
|
- <img src="@/assets/images/agent/photo.png">
|
|
|
- <img src="@/assets/images/agent/upload.png">
|
|
|
- <img src="@/assets/images/agent/input_hou.png" v-if="question" @click="handleQuestion">
|
|
|
- <img src="@/assets/images/agent/input_qian.png" v-else>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ <div class="l_check">
|
|
|
+ <el-checkbox v-model="checked">记住密码</el-checkbox>
|
|
|
+ </div>
|
|
|
+ <div class="l_btn" :class="{'active':((tidx===1&&accountForm.username&&accountForm.password)||(tidx===2&&codeForm.phone&&codeForm.code))}" @click="handleLogin">立即登录</div>
|
|
|
+ <div class="l_check">
|
|
|
+ <el-checkbox v-model="agree">已阅读并同意 <span class="lcs">隐私协议</span> 和 <span class="lcs">服务条款</span></el-checkbox>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup name="">
|
|
|
- import MainSidebar from "../main-sidebar.vue";
|
|
|
- import { ref, getCurrentInstance } from 'vue'
|
|
|
- const { proxy } = getCurrentInstance();
|
|
|
-
|
|
|
- const helloWord = ref('Hi~,我是PERILL Coach')
|
|
|
- const helloTip = ref('可以为你提供PERILL模型,个人教练、团队教练相关的理论、案例、分析报告等知识的查询和解答')
|
|
|
- const question = ref('')
|
|
|
- const deepThink = ref(false)
|
|
|
-
|
|
|
- const toDeepThink = () => {
|
|
|
- deepThink.value = !deepThink.value
|
|
|
- }
|
|
|
-
|
|
|
- const handleQuestion = () => {
|
|
|
- proxy.$router.push({
|
|
|
- path: '/agentDialogResult',
|
|
|
- query: {
|
|
|
- question: question.value,
|
|
|
- deepThink: deepThink.value
|
|
|
+ var timer = null;
|
|
|
+ import Cookies from "js-cookie";
|
|
|
+ import { getUUID } from "@/utils";
|
|
|
+ import { ref, getCurrentInstance } from 'vue'
|
|
|
+ const { proxy } = getCurrentInstance();
|
|
|
+
|
|
|
+ const time = ref(60);
|
|
|
+ const codeBtn = ref(true);
|
|
|
+ const codeBtnText = ref('获取验证码');
|
|
|
+ const tidx = ref(1);
|
|
|
+ const accountRef = ref(null);
|
|
|
+ const codeRef = ref(null);
|
|
|
+ const accountForm = ref({
|
|
|
+ username: '',
|
|
|
+ password: '',
|
|
|
+ uuid: getUUID()
|
|
|
+ });
|
|
|
+ const accountRules = ref({
|
|
|
+ username: [
|
|
|
+ { required: true, message: '请输入账号', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ password: [
|
|
|
+ { required: true, message: '请输入密码', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ const codeForm = ref({
|
|
|
+ phone: '',
|
|
|
+ code: ''
|
|
|
+ });
|
|
|
+ const codeRules = ref({
|
|
|
+ phone: [
|
|
|
+ { required: true, message: '请输入手机号码', trigger: 'blur' },
|
|
|
+ { pattern: /^1[3456789]\d{9}$/, message: '请输入正确的手机号码', trigger: 'blur' }
|
|
|
+ ],
|
|
|
+ code: [
|
|
|
+ { required: true, message: '请输入验证码', trigger: 'blur' }
|
|
|
+ ]
|
|
|
+ })
|
|
|
+ const checked = ref(false);
|
|
|
+ const agree = ref(false);
|
|
|
+
|
|
|
+
|
|
|
+ const handleChangeTab = (idx) => {
|
|
|
+ tidx.value = idx;
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleCode = () => {
|
|
|
+ if(!codeBtn.value) return;
|
|
|
+ codeBtn.value = false;
|
|
|
+ codeBtnText.value = '重新发送('+time.value+'s)';
|
|
|
+ timer = setInterval(()=>{
|
|
|
+ time.value--;
|
|
|
+ if(time.value<=0){
|
|
|
+ clearInterval(timer);
|
|
|
+ codeBtnText.value = '获取验证码';
|
|
|
+ codeBtn.value = true;
|
|
|
+ time.value = 60;
|
|
|
+ }else{
|
|
|
+ codeBtnText.value = '重新发送('+time.value+'s)';
|
|
|
+ }
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+
|
|
|
+ const handleLogin = () => {
|
|
|
+ if(tidx.value===1){
|
|
|
+ proxy.$refs.accountRef.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if(!agree.value) return proxy.$message({type: 'warning', message: '请阅读并同意隐私协议和服务条款'})
|
|
|
+ toLogin();
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else if(tidx.value===2){
|
|
|
+ proxy.$refs.codeRef.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ if(!agree.value) return proxy.$message({type: 'warning', message: '请阅读并同意隐私协议和服务条款'})
|
|
|
+ console.log("验证码登录");
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ const toLogin = () => {
|
|
|
+ proxy.$http.post("/login", accountForm.value).then(({ data: res }) => {
|
|
|
+ if (res.code !== 0) proxy.$message.error(res.msg);
|
|
|
+ sessionStorage.removeItem("tags");
|
|
|
+ Cookies.set("token", res.data.token);
|
|
|
+
|
|
|
+ if (checked.value) {
|
|
|
+ setCookie(accountForm.value.username, accountForm.value.password, 7);
|
|
|
+ } else {
|
|
|
+ setCookie("", "", -1);
|
|
|
+ }
|
|
|
+
|
|
|
+ return proxy.$router.push('agentDialog')
|
|
|
+
|
|
|
+ // 获取菜单列表, 添加并全局变量保存
|
|
|
+ proxy.$http.get("/sys/menu/nav", {
|
|
|
+ params: {
|
|
|
+ menuClassify: 1
|
|
|
+ }
|
|
|
+ }).then(({ data: res }) => {
|
|
|
+ if (res.code !== 0) proxy.$message.error(res.msg);
|
|
|
+ var menuList = res.data;
|
|
|
+ for (var i = 0; i < menuList.length; i++) {
|
|
|
+ var menu = {};
|
|
|
+ if (menuList[i].url != "") {
|
|
|
+ menu = menuList[i];
|
|
|
+ } else if (menuList[i].children.length > 0) {
|
|
|
+ menu = menuList[i].children[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ // 组装路由
|
|
|
+ var route = {
|
|
|
+ path: "",
|
|
|
+ component: null,
|
|
|
+ name: "index",
|
|
|
+ meta: {
|
|
|
+ ...window.SITE_CONFIG["contentTabDefault"],
|
|
|
+ menuId: menu.id,
|
|
|
+ title: menu.name,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ let URL = (menu.url || "").replace(/{{([^}}]+)?}}/g,(s1, s2) => eval(s2));
|
|
|
+ URL = URL.replace(/^\//, "").replace(/_/g, "-");
|
|
|
+ route["path"] = route["name"] = URL.replace(/\//g, "-");
|
|
|
+ route["component"] = () => import(`@/views/modules/${URL}`);
|
|
|
+ proxy.$router.push(route);
|
|
|
+ proxy.$store.state.sidebarMenuActiveName = [];
|
|
|
+
|
|
|
+ var proute = menuList.filter(
|
|
|
+ (item) =>
|
|
|
+ item.children.filter((child) => child.id == menu.id).length > 0
|
|
|
+ );
|
|
|
+
|
|
|
+ proxy.$store.state.sidebarMenuActiveName.push(
|
|
|
+ proute.length > 0 ? proute[0].name : ""
|
|
|
+ );
|
|
|
+ proxy.$store.state.sidebarMenuActiveName.push(
|
|
|
+ route.meta.title
|
|
|
+ );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ localStorage.setItem("currentMenuIndex", 0);
|
|
|
+ proxy.$store.state.currentMenuIndex = 0;
|
|
|
+ });
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ const setCookie = (name, pwd, exdays) => {
|
|
|
+ var exdate = new Date();
|
|
|
+ exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays);
|
|
|
+ window.document.cookie =
|
|
|
+ "userName" + "=" + name + ";path=/;expires=" + exdate.toGMTString();
|
|
|
+ window.document.cookie =
|
|
|
+ "userPwd" + "=" + pwd + ";path=/;expires=" + exdate.toGMTString();
|
|
|
+ }
|
|
|
+ const getCookie = () => {
|
|
|
+ if (document.cookie.length > 0) {
|
|
|
+ var arr = document.cookie.split("; ");
|
|
|
+ for (var i = 0; i < arr.length; i++) {
|
|
|
+ var arr2 = arr[i].split("=");
|
|
|
+ if (arr2[0] === "userName") {
|
|
|
+ accountForm.value.username = arr2[1];
|
|
|
+ } else if (arr2[0] === "userPwd") {
|
|
|
+ accountForm.value.password = arr2[1];
|
|
|
}
|
|
|
- })
|
|
|
- }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ getCookie();
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
- ::v-deep .el-textarea__inner{
|
|
|
- background: #FFFFFF;
|
|
|
- border-radius: 10px !important;
|
|
|
- border: none !important;
|
|
|
- padding: 0 !important;
|
|
|
- }
|
|
|
-
|
|
|
- .page{
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- .box{
|
|
|
- .title{
|
|
|
- font-family: DingTalk, DingTalk;
|
|
|
- font-weight: normal;
|
|
|
- font-size: 24px;
|
|
|
- color: #111111;
|
|
|
- line-height: 29px;
|
|
|
- }
|
|
|
- .tip{
|
|
|
- font-family: PingFangSC, PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 14px;
|
|
|
- color: #9CA3AF;
|
|
|
- line-height: 20px;
|
|
|
- margin-top: 11px;
|
|
|
- }
|
|
|
+ .page{
|
|
|
+ width: 100%;
|
|
|
+ height: 100vh;
|
|
|
+ background: url(@/assets/images/agent/login_bg.png) no-repeat;
|
|
|
+ background-size: 100% 100%;
|
|
|
+ position: relative;
|
|
|
|
|
|
- .ask{
|
|
|
- width: 980px;
|
|
|
- height: 148px;
|
|
|
- background: #FFFFFF;
|
|
|
- border-radius: 10px;
|
|
|
- border: 1px solid #E5E7EB;
|
|
|
- padding: 20px;
|
|
|
- box-sizing: border-box;
|
|
|
- margin-top: 80px;
|
|
|
- position: relative;
|
|
|
- .btns{
|
|
|
- width: 940px;
|
|
|
- position: absolute;
|
|
|
- left: 20px;
|
|
|
- bottom: 20px;
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- .left{
|
|
|
- display: flex;
|
|
|
- .copy{
|
|
|
- width: 36px;
|
|
|
- height: 36px;
|
|
|
- background: #FFFFFF;
|
|
|
- border-radius: 6px;
|
|
|
- border: 1px solid #E5E7EB;
|
|
|
- cursor: pointer;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- img{
|
|
|
- width: 14px;
|
|
|
- height: 16px;
|
|
|
- }
|
|
|
- }
|
|
|
- .think{
|
|
|
- width: 96px;
|
|
|
- height: 36px;
|
|
|
- background: #FFFFFF;
|
|
|
- border-radius: 6px;
|
|
|
- border: 1px solid #E5E7EB;
|
|
|
- margin-left: 8px;
|
|
|
- display: flex;
|
|
|
- align-items: center;
|
|
|
- justify-content: center;
|
|
|
- cursor: pointer;
|
|
|
- img{
|
|
|
- width: 14px;
|
|
|
- height: 14px;
|
|
|
- }
|
|
|
- span{
|
|
|
- font-family: PingFangSC, PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- font-size: 14px;
|
|
|
- color: #111111;
|
|
|
- line-height: 20px;
|
|
|
- margin-left: 3px;
|
|
|
- }
|
|
|
- &.active{
|
|
|
- border: 1px solid #70b2df;
|
|
|
- span{
|
|
|
- color: #70b2df;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- .right{
|
|
|
- display: flex;
|
|
|
- img{
|
|
|
- width: 30px;
|
|
|
- height: 30px;
|
|
|
- margin-left: 33px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ .logo{
|
|
|
+ width: 285px;
|
|
|
+ height: 48px;
|
|
|
+ position: absolute;
|
|
|
+ top: 40px;
|
|
|
+ left: 48px;
|
|
|
+ z-index: 2;
|
|
|
+ }
|
|
|
+
|
|
|
+ .login{
|
|
|
+ width: 514px;
|
|
|
+ height: 614px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 16px;
|
|
|
+ padding: 64px 48px;
|
|
|
+ box-sizing: border-box;
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ margin-top: -307px;
|
|
|
+ right: 262px;
|
|
|
+
|
|
|
+ .l_tabs{
|
|
|
+ .t_pre{
|
|
|
+ font-family: PingFangSC, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 20px;
|
|
|
+ color: #646464;
|
|
|
+ line-height: 28px;
|
|
|
+ padding-bottom: 4px;
|
|
|
+ cursor: pointer;
|
|
|
+ &.active{
|
|
|
+ font-weight: bold;
|
|
|
+ color: #761E6A;
|
|
|
+ position: relative;
|
|
|
+ &::after{
|
|
|
+ content:'';
|
|
|
+ width: 100%;
|
|
|
+ height: 2px;
|
|
|
+ background: #761E6A;
|
|
|
+ position: absolute;
|
|
|
+ left: 0;
|
|
|
+ bottom: 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ &:last-child{
|
|
|
+ margin-left: 64px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .l_check{
|
|
|
+ margin-top: 48px;
|
|
|
+ .lcs{
|
|
|
+ font-family: PingFangSC, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 16px;
|
|
|
+ color: #761E6A;
|
|
|
+ line-height: 22px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .l_btn{
|
|
|
+ margin-top: 48px;
|
|
|
+ height: 60px;
|
|
|
+ background: rgba(131, 52, 120, .4);
|
|
|
+ border-radius: 6px;
|
|
|
+ font-family: PingFang-SC, PingFang-SC;
|
|
|
+ font-weight: bold;
|
|
|
+ font-size: 20px;
|
|
|
+ color: #FFFFFF;
|
|
|
+ line-height: 60px;
|
|
|
+ text-align: center;
|
|
|
+ cursor: pointer;
|
|
|
+ letter-spacing: 1px;
|
|
|
+ cursor: not-allowed;
|
|
|
+ &.active{
|
|
|
+ background: rgba(131, 52, 120, 1);
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .c_pre{
|
|
|
+ height: 54px;
|
|
|
+ background: #FFFFFF;
|
|
|
+ border-radius: 6px;
|
|
|
+ border: 1px solid #ECEEF5;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ .left{
|
|
|
+ width: 304px;
|
|
|
+ }
|
|
|
+ .cp_right{
|
|
|
+ width: calc(100% - 304px);
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: center;
|
|
|
+ position: relative;
|
|
|
+ cursor: pointer;
|
|
|
+ &::before{
|
|
|
+ content: '';
|
|
|
+ width: 1px;
|
|
|
+ height: 21px;
|
|
|
+ background: #ECEEF5;
|
|
|
+ position: absolute;
|
|
|
+ top: 50%;
|
|
|
+ margin-top: -10.5px;
|
|
|
+ left: 0;
|
|
|
+ }
|
|
|
+ &>span{
|
|
|
+ font-family: PingFangSC, PingFang SC;
|
|
|
+ font-weight: 400;
|
|
|
+ font-size: 14px;
|
|
|
+ color: #761E6A;
|
|
|
+ line-height: 20px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ::v-deep .el-form-item{
|
|
|
+ margin-bottom: 0 !important;
|
|
|
+ margin-top: 48px;
|
|
|
+ }
|
|
|
+ ::v-deep .el-input__inner{
|
|
|
+ height: 54px !important;
|
|
|
+ line-height: 54px !important;
|
|
|
+ }
|
|
|
+ ::v-deep .el-checkbox__label{
|
|
|
+ font-size: 16px !important;
|
|
|
+ color: #393939;
|
|
|
+ }
|
|
|
+ ::v-deep .c_pre .el-input__inner{
|
|
|
+ border: none !important;
|
|
|
+ height: 48px !important;
|
|
|
+ line-height: 48px !important;
|
|
|
+ width: calc(100% - 2px);
|
|
|
+ margin-left: 2px;
|
|
|
+ }
|
|
|
</style>
|