|
|
@@ -5,12 +5,13 @@
|
|
|
</div>
|
|
|
<div class="log-container">
|
|
|
<img class="log-icon" src="../assets/img/log.png">
|
|
|
- <div class="log-text">欢迎登陆私塾家知识管理后台登陆页</div>
|
|
|
- <div @click="WxLogin" class="log-qrcode">
|
|
|
- <img class="log-qrcode-image" src="../assets/img/ssj_qrcode.png">
|
|
|
+ <div class="log-text">欢迎登陆私塾家在线人员管理后台</div>
|
|
|
+ <div @click="WxLogin" class="log-qrcode">
|
|
|
+ <div id="login_container"></div>
|
|
|
+ <!-- <img class="log-qrcode-image" src="../assets/img/ssj_qrcode.png"> -->
|
|
|
<div class="log-qrcode-text">请使用微信扫码登陆</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -22,135 +23,40 @@
|
|
|
export default {
|
|
|
name: "login",
|
|
|
data() {
|
|
|
- return {
|
|
|
+ return {};
|
|
|
+ },
|
|
|
+ watch:{
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ // debugger
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ WxLogin() {
|
|
|
+ // this.$util.messageMethod("success", "前去微信登陆扫码授权");
|
|
|
+ this.$router.push({path: '/aikmt/Redirect_uri', query: {code: "081nx4K50HDkED1WgLI50InQJ50nx4Kb",prince: "6666666666666"}});
|
|
|
+ }
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ var obj = new WxLogin({
|
|
|
+ self_redirect: false,
|
|
|
id: "login_container",
|
|
|
appid: "wx90d07ffb3ef03fc3",
|
|
|
scope: "snsapi_login",
|
|
|
redirect_uri: encodeURI(
|
|
|
- // "https://t.sharingschool.com/aikmt/Redirect_uri"
|
|
|
- "https://t.sharingschool.com/upload/ceshi/index.html"
|
|
|
- // "https://t.sharingschool.com/upload/ceshi/index.html#/aikmt/redirect_uri"
|
|
|
+ "https://kmt.sharingschool.com/aijia/index.html#/aikmt/Redirect_uri"
|
|
|
+ // "https://t.sharingschool.com/upload/ceshi/index.html"
|
|
|
),
|
|
|
- // redirect_uri: encodeURI("https://localhost:8080/kmt/login/wxlogin/scanlogin"),
|
|
|
state: "",
|
|
|
style: "width: 250px",
|
|
|
href: ""
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- // this.wxlog()
|
|
|
- // this.getTKByCode()
|
|
|
- // debugger
|
|
|
- },
|
|
|
- methods: {
|
|
|
- WxLogin(){
|
|
|
- this.$util.messageMethod("success", "前去微信登陆扫码授权");
|
|
|
- this.wxlog()
|
|
|
- // this.$router.push({path: '/aikmt/Redirect_uri', query: {code: "081nx4K50HDkED1WgLI50InQJ50nx4Kb",prince: "6666666666666"}});
|
|
|
- },
|
|
|
-async getTKByCode(){
|
|
|
- if (window.location.href.indexOf('code') >= 0) {
|
|
|
- // 如果url中包含code,则保存到store中
|
|
|
- let code = window.location.href.split("?")[1];
|
|
|
- code = code.substring(5, code.indexOf('&'));
|
|
|
- let WxCode = {code: code}
|
|
|
- let res = await this.$dao.appDao.dataSource.getTokens(WxCode);
|
|
|
- console.log(11235345647646)
|
|
|
- let data = res.data;
|
|
|
- console.log(code)
|
|
|
- if (data.code === "000") {
|
|
|
- this.$util.messageMethod("warning", data.msg);
|
|
|
- localStorage.setItem("currentUser_token",data.data);
|
|
|
- this.$router.push("/home/homeWork_approval");
|
|
|
- this.$router.push("/");
|
|
|
- }
|
|
|
- if (data.code === "999") {
|
|
|
- this.$util.messageMethod("success", data.msg);
|
|
|
- this.$router.push("/home/homeWork_approval");
|
|
|
- localStorage.setItem("currentUser_token",data.data);
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- wxlog() {
|
|
|
- const appid = this.appid;
|
|
|
- console.log(appid)
|
|
|
- this.url =
|
|
|
- "https://open.weixin.qq.com/connect/qrconnect?appid=" +
|
|
|
- appid +
|
|
|
- "&redirect_uri=" +
|
|
|
- this.redirect_uri +
|
|
|
- "&response_type=code&scope=snsapi_login#wechat_redirect";
|
|
|
- window.location = this.url;
|
|
|
- /*************************************************************/
|
|
|
- // if (sessionStorage.getItem("currentUser_token")) {
|
|
|
- // this.login();
|
|
|
- // // 如果sessionStorage中有userid,执行login
|
|
|
- // } else if (this.$store.state.code) {
|
|
|
- // // 如果只是有code
|
|
|
- // let _self = this;
|
|
|
- // console.log(_self);
|
|
|
- // // 发请求,用code换token
|
|
|
- // this.$axios({
|
|
|
- // method: "post",
|
|
|
- // url: this.baseURL + "/login",
|
|
|
- // data: {
|
|
|
- // code: this.$store.state.code
|
|
|
- // }
|
|
|
- // })
|
|
|
- // .then(function(response) {
|
|
|
- // // token和登录状态先保存在sessionStorage里
|
|
|
- // sessionStorage.setItem("token", response.data.token);
|
|
|
- // sessionStorage.setItem("userid", response.data.userid);
|
|
|
- // })
|
|
|
- // .catch(function(error) {
|
|
|
- // console.log(error);
|
|
|
- // });
|
|
|
- // } else {
|
|
|
- // let self = this;
|
|
|
- // if (self && !self._isDestroyed) {
|
|
|
- // // 如果失败了还是弹二维码
|
|
|
- // window.location = self.url;
|
|
|
- // }
|
|
|
- // }
|
|
|
- }
|
|
|
- // 账号管理、退出登录
|
|
|
-// login() {
|
|
|
-// let userid = {'userid': sessionStorage.getItem("userid")};
|
|
|
-// //token放到header里,一定要加Bearer空格
|
|
|
-// this.$axios.defaults.headers.common['Authorization'] = 'Bearer ' + sessionStorage.getItem("token");
|
|
|
-// console.log('axios headers Authorization set!');
|
|
|
-// let _self = this;
|
|
|
-// //登录请求
|
|
|
-// this.$axios({
|
|
|
-// method: 'get',
|
|
|
-// url: this.baseURL + "xxx",//向后端请求的地址
|
|
|
-// data: {
|
|
|
-// userid: sessionStorage.getItem("userid")
|
|
|
-// }
|
|
|
-// })
|
|
|
-// .then(response => {
|
|
|
-// if(response.status==200){
|
|
|
-// _self.$store.state.user = response;
|
|
|
-// _self.$router.push('/');
|
|
|
-// beforeLoginUrl+_self.$store.state.adminNav);
|
|
|
-// } else{
|
|
|
-// if(sessionStorage.getItem("userid")){
|
|
|
-// window.location = _self.url;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// })
|
|
|
-// .catch(function(error){
|
|
|
-// console.log(error);
|
|
|
-// window.location = _self.url;
|
|
|
-// })
|
|
|
- },
|
|
|
- mounted() {}
|
|
|
+ });
|
|
|
+ }
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
|
body {
|
|
|
- background-image: url(../assets/img/Land_bg.png);
|
|
|
+ /* background-image: url(../assets/img/Land_bg.png); */
|
|
|
background-size: 100% auto;
|
|
|
}
|
|
|
.container {
|
|
|
@@ -201,7 +107,12 @@ body {
|
|
|
margin: 5% 10%;
|
|
|
}
|
|
|
.log-qrcode-image {
|
|
|
- width: 80%;
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+*,
|
|
|
+::after,
|
|
|
+::before {
|
|
|
+ box-sizing: content-box;
|
|
|
}
|
|
|
.log-qrcode-text {
|
|
|
margin-top: 1.5rem;
|