|
@@ -1,272 +0,0 @@
|
|
|
-<template>
|
|
|
- <div class="backgorundbox">
|
|
|
- <div class="loginbox">
|
|
|
- <div class="logintitle">醍摩豆账号登录</div>
|
|
|
- <div class="usrpwd" v-if="loginModel">
|
|
|
- <div class='userbox' style="margin-bottom:10%">
|
|
|
- <el-input v-model="user" placeholder="醍摩豆ID/手机号码" prefix-icon="el-icon-user" />
|
|
|
- </div>
|
|
|
- <div class='userbox'>
|
|
|
- <el-input v-model="pwd" placeholder="密码" type="password" prefix-icon="el-icon-key" />
|
|
|
- <div class="loginbtn" v-show="user !='' && pwd !='' " @click="userlogin(proxy)"><img src="@/assets/img/login.png"></div>
|
|
|
- </div>
|
|
|
- <div class="not_has_more">
|
|
|
- 或下列方式登录
|
|
|
- <div class="ddlogin" @click="loginModel=false"><img src="../assets/img/ddlogin.png"></div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="usrpwd" v-else-if="loginModel ==false">
|
|
|
- <ddlogin></ddlogin>
|
|
|
- </div>
|
|
|
- <div class="cut" @click="loginModel = !loginModel">
|
|
|
- <svg width="52" height="52" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" style="border-top-right-radius:10px">
|
|
|
- <mask id="id-3757926926-a" width="52" height="52" x="0" y="0" maskUnits="userSpaceOnUse">
|
|
|
- <path fill="#fff" d="M0 0l52 52V0H0z"></path>
|
|
|
- </mask>
|
|
|
- <g mask="url(#id-3757926926-a)">
|
|
|
- <path fill="#ccF" d="M0 0h48a4 4 0 014 4v48L0 0z"></path>
|
|
|
- <path fill="url(#pattern0)" d="M0 0h52v52H0z"></path>
|
|
|
- </g>
|
|
|
- <defs>
|
|
|
- <pattern id="pattern0" width="1" height="1" patternContentUnits="objectBoundingBox">
|
|
|
- <use transform="scale(.00216)" xlink:href="#image0"></use>
|
|
|
- </pattern>
|
|
|
- <image id="image0" width="463" height="463" :xlink:href="loginImg"></image>
|
|
|
- </defs>
|
|
|
- </svg>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <!-- <div id="login_container" style="transform: scale(.8);">123456</div> -->
|
|
|
- <bind :callbackStatus=callbackStatus v-if="callbackStatus ===1"></bind>
|
|
|
- </div>
|
|
|
-</template>
|
|
|
-<script>
|
|
|
-import { ref, watch, onMounted, getCurrentInstance } from "vue";
|
|
|
-import ddlogin from "./ddlogin.vue";
|
|
|
-import bind from "./bindPhone.vue";
|
|
|
-import { ElMessage } from "element-plus";
|
|
|
-import { useRouter } from "vue-router";
|
|
|
-import { useStore } from "vuex";
|
|
|
-import jwt_decode from "jwt-decode";
|
|
|
-export default {
|
|
|
- components: {
|
|
|
- ddlogin,
|
|
|
- bind,
|
|
|
- },
|
|
|
- setup() {
|
|
|
- let user = ref("");
|
|
|
- let pwd = ref("");
|
|
|
- let loginModel = ref(true);
|
|
|
- let loginImg = ref(require("../assets/img/erweima.png"));
|
|
|
- var userCode = "";
|
|
|
- let callbackStatus = ref("");
|
|
|
- let router = useRouter();
|
|
|
- let { proxy } = getCurrentInstance();
|
|
|
- const store = useStore();
|
|
|
- console.log(store, "VUEX");
|
|
|
- onMounted(() => {
|
|
|
- console.log(window.location.href, "mounted!");
|
|
|
- if (window.location.href.indexOf("?code") != -1) {
|
|
|
- userCode = window.location.href.substring(
|
|
|
- window.location.href.indexOf("?") + 6,
|
|
|
- window.location.href.indexOf("&state")
|
|
|
- );
|
|
|
- console.log(userCode);
|
|
|
- let sss = editState(userCode);
|
|
|
- console.log(sss, "123456789");
|
|
|
- }
|
|
|
- });
|
|
|
- //处理登录icon变化
|
|
|
- watch(loginModel, () => {
|
|
|
- loginImg.value =
|
|
|
- loginModel.value == true
|
|
|
- ? (loginImg.value = require("../assets/img/erweima.png"))
|
|
|
- : (loginImg.value = require("../assets/img/mima.png"));
|
|
|
- });
|
|
|
- let { editState } = test(proxy);
|
|
|
- function test(proxy) {
|
|
|
- let editState = (res) => {
|
|
|
- let datas = { code: res };
|
|
|
- proxy.$api.Dinglogin(datas).then((res) => {
|
|
|
- console.log(res, "接口访问成功");
|
|
|
- callbackStatus.value = res.status;
|
|
|
- localStorage.setItem(
|
|
|
- "DingUser",
|
|
|
- JSON.stringify(res.dingDingBind)
|
|
|
- );
|
|
|
- res.status === 1
|
|
|
- ? ElMessage("请进行绑定醍摩豆账号操作")
|
|
|
- : res.status === 0
|
|
|
- ? ElMessage.error("登录错误,非架构内人员禁止使用")
|
|
|
- : res.status === 200
|
|
|
- ? (ElMessage.success("登录成功"),
|
|
|
- getOrganization(proxy),
|
|
|
- getTeachinfo(proxy, res.id_token),
|
|
|
- Allpermission(proxy),
|
|
|
- router.push("/home"))
|
|
|
- : ElMessage.error("登录异常");
|
|
|
- });
|
|
|
- };
|
|
|
- return {
|
|
|
- editState,
|
|
|
- };
|
|
|
- }
|
|
|
- //获取组织架构
|
|
|
- function getOrganization(proxy) {
|
|
|
- console.log(proxy, "检查proxy");
|
|
|
- proxy.$api.getorganization().then((res) => {
|
|
|
- console.log(res, "组织架构返回的内容");
|
|
|
- res.state === 200
|
|
|
- ? store.commit("ChangOrganization", res.deptlist)
|
|
|
- : "";
|
|
|
- });
|
|
|
- }
|
|
|
- //醍摩豆或手机登录
|
|
|
- function userlogin(proxy) {
|
|
|
- let nonceNum = Math.floor(Math.random() * 10000);
|
|
|
- console.log(nonceNum, "随机数");
|
|
|
- let params = {
|
|
|
- grant_type: "account",
|
|
|
- client_id: "c7317f88-7cea-4e48-ac57-a16071f7b884",
|
|
|
- nonce: "habook",
|
|
|
- account: user.value,
|
|
|
- password: pwd.value,
|
|
|
- };
|
|
|
- proxy.$api.loginUser(params).then((res) => {
|
|
|
- console.log(res, "登录接口返回成功!");
|
|
|
- res.error
|
|
|
- ? ElMessage.error("密码错误")
|
|
|
- : res.id_token
|
|
|
- ? (ElMessage.success("登录成功"),
|
|
|
- getTeachinfo(proxy, res.id_token),
|
|
|
- Allpermission(proxy),
|
|
|
- getOrganization(proxy))
|
|
|
- : // router.push("/home"))
|
|
|
- ElMessage.error("登录失败");
|
|
|
- // router.push("/home");
|
|
|
- });
|
|
|
- }
|
|
|
- //获取教师个人信息
|
|
|
- function getTeachinfo(proxy, param) {
|
|
|
- let parameter = { id_token: param };
|
|
|
- proxy.$api.teacherinfo(parameter).then((res) => {
|
|
|
- console.log(res, "教室个人信息");
|
|
|
- let jwt_authtoken = { jwt_user: jwt_decode(res.auth_token) };
|
|
|
- res = Object.assign(res, jwt_authtoken);
|
|
|
- res.status === 200 ? store.commit("getTeachdata", res) : [];
|
|
|
- });
|
|
|
- }
|
|
|
- //获取所有权限表
|
|
|
- function Allpermission(proxy) {
|
|
|
- proxy.$api.getAllpermission().then((res) => {
|
|
|
- console.log(res, "权限列表");
|
|
|
- res.authorityBIList
|
|
|
- ? store.commit("getPermission", res.authorityBIList)
|
|
|
- : [];
|
|
|
- });
|
|
|
- }
|
|
|
- return {
|
|
|
- store,
|
|
|
- proxy,
|
|
|
- user,
|
|
|
- pwd,
|
|
|
- loginModel,
|
|
|
- loginImg,
|
|
|
- userCode,
|
|
|
- editState,
|
|
|
- callbackStatus,
|
|
|
- userlogin,
|
|
|
- router,
|
|
|
- getTeachinfo,
|
|
|
- };
|
|
|
- },
|
|
|
-};
|
|
|
-</script>
|
|
|
-<style scoped>
|
|
|
-.backgorundbox {
|
|
|
- background: url("../assets/img/background1.png") no-repeat;
|
|
|
- background-size: cover;
|
|
|
- width: 100vw;
|
|
|
- height: 100vh;
|
|
|
- position: relative;
|
|
|
- /* filter: blur(2px); */
|
|
|
-}
|
|
|
-.loginbox {
|
|
|
- position: absolute;
|
|
|
- width: 550px;
|
|
|
- height: auto;
|
|
|
- top: 200px;
|
|
|
- right: 110px;
|
|
|
- border-radius: 10px;
|
|
|
- box-shadow: 1px 1px 5px #ccc;
|
|
|
-}
|
|
|
-.usrpwd {
|
|
|
- height: 330px;
|
|
|
- text-align: center;
|
|
|
-}
|
|
|
-.logintitle {
|
|
|
- text-align: center;
|
|
|
- font-size: 20px;
|
|
|
- color: #fff;
|
|
|
- margin-bottom: 8%;
|
|
|
- margin-top: 5%;
|
|
|
-}
|
|
|
-.userbox {
|
|
|
- text-align: center;
|
|
|
- width: 60%;
|
|
|
- margin: 0 auto;
|
|
|
- position: relative;
|
|
|
-}
|
|
|
-.none {
|
|
|
- display: none;
|
|
|
-}
|
|
|
-.loginbtn {
|
|
|
- position: absolute;
|
|
|
- display: block;
|
|
|
- right: 0px;
|
|
|
- top: 0px;
|
|
|
- width: 44px;
|
|
|
- height: 44px;
|
|
|
- line-height: 43px;
|
|
|
-}
|
|
|
-.not_has_more {
|
|
|
- margin: 30px 0px 20px 0px;
|
|
|
- line-height: 50px;
|
|
|
- text-align: center;
|
|
|
- position: relative;
|
|
|
- height: 95px;
|
|
|
- font-size: 14px;
|
|
|
- font-family: PingFangSC-Regular, PingFang SC;
|
|
|
- font-weight: 400;
|
|
|
- color: rgba(140, 142, 165, 1);
|
|
|
- line-height: 30px;
|
|
|
-}
|
|
|
-.not_has_more::after,
|
|
|
-.not_has_more::before {
|
|
|
- position: absolute;
|
|
|
- width: 54px;
|
|
|
- height: 0.5px;
|
|
|
- background: #dadada;
|
|
|
- content: "";
|
|
|
- top: 15px;
|
|
|
- right: 28%;
|
|
|
-}
|
|
|
-.not_has_more::after {
|
|
|
- left: 28%;
|
|
|
-}
|
|
|
-.ddlogin {
|
|
|
- margin-top: 3%;
|
|
|
-}
|
|
|
-.cut {
|
|
|
- position: absolute;
|
|
|
- top: 0px;
|
|
|
- right: 0px;
|
|
|
-}
|
|
|
-</style>
|
|
|
-<style>
|
|
|
-.userbox .el-input__inner {
|
|
|
- height: 45px;
|
|
|
- border-radius: 30px;
|
|
|
-}
|
|
|
-</style>
|
|
|
-
|