Commit 58a98d51 by maolipeng

Merge branch 'master' into feature/maolipeng/youhua

parents f022a67e 6473fa7c
/*
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:31
* @LastEditors: wufan
* @LastEditTime: 2021-05-27 10:42:12
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-24 19:34:21
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
......@@ -84,7 +84,7 @@ class Axios {
})
instance.interceptors.response.use((response: AxiosResponse): AxiosResponse | AxiosPromise => {
const { message: ResMessage, success, resultMsg, resultCode } = response.data;
const { message: ResMessage, success, resultMsg, resultCode,code} = response.data;
if (success || resultCode === 0) {
return response;
} else if (!options.reject) {
......
......@@ -2,21 +2,26 @@
* @Author: 吴文洁
* @Date: 2020-08-31 09:34:25
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-12 17:27:08
* @LastEditTime: 2021-06-23 16:08:50
* @Description:
* @Copyright: 杭州杰竞科技有限公司 版权所有
*/
import Storage from './storage';
import { PREFIX, USER_PREFIX } from '@/domains/basic-domain/constants';
declare var window:any;
class User {
getStoreId() {
return Storage.get(`${PREFIX}_storeId`);
getVersion() {
return Storage.getObj(`${PREFIX}_version`)
}
getStoreId(){
return window.currentStoreUserInfo.storeId || Storage.get(`${PREFIX}_storeId`)
}
getEnterpriseId() {
return Storage.get(`${PREFIX}_enterpriseId`);
return window.currentStoreUserInfo.enterpriseId || Storage.get(`${PREFIX}_enterpriseId`);
}
getStoreName() {
......@@ -28,21 +33,23 @@ class User {
}
getStoreUserId() {
return Storage.get(`${PREFIX}_storeUserId`);
return window.currentStoreUserInfo.storeUserId || Storage.get(`${PREFIX}_storeUserId`);
}
getCustomerId() {
return Storage.get(`${PREFIX}_customerId`);
}
getUserId() {
return Storage.get(`${PREFIX}_userId`);
return window.currentStoreUserInfo.userId || Storage.get(`${PREFIX}_userId`);
}
getUserRole() {
return Storage.get(`${PREFIX}_userRole`);
}
getToken() {
return Storage.get(`${PREFIX}_token`);
return window.currentStoreUserInfo.token || Storage.get(`${PREFIX}_token`);
}
getIsAdmin() {
......
@font-face {
font-family: 'iconfont'; /* project id 2223403 */
src: url('//at.alicdn.com/t/font_2223403_boiin24pch6.eot');
src: url('//at.alicdn.com/t/font_2223403_boiin24pch6.eot?#iefix') format('embedded-opentype'),
url('//at.alicdn.com/t/font_2223403_boiin24pch6.woff2') format('woff2'),
url('//at.alicdn.com/t/font_2223403_boiin24pch6.woff') format('woff'),
url('//at.alicdn.com/t/font_2223403_boiin24pch6.ttf') format('truetype'),
url('//at.alicdn.com/t/font_2223403_boiin24pch6.svg#iconfont') format('svg');
font-family: 'iconfont'; /* Project id 2223403 */
src: url('//at.alicdn.com/t/font_2223403_oe5p510553.woff2?t=1624259078391') format('woff2'),
url('//at.alicdn.com/t/font_2223403_oe5p510553.woff?t=1624259078391') format('woff'),
url('//at.alicdn.com/t/font_2223403_oe5p510553.ttf?t=1624259078391') format('truetype');
}
.iconfont{
font-family:"iconfont" !important;
font-size:16px;
font-style:normal;
.iconfont {
font-family: 'iconfont' !important;
font-size: 16px;
font-style: normal;
}
/*
* @Author: 吴文洁
* @Date: 2020-04-27 20:35:34
* @LastEditors: wufan
* @LastEditTime: 2021-03-26 16:14:09
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-06-23 14:14:20
* @Description:
*/
......@@ -23,8 +23,8 @@ import User from '@/common/js/user';
import Service from "@/common/js/service";
declare var getParameterByName: any;
declare var window: any;
window.currentStoreUserInfo = {}
const history = createHashHistory();
window.RCHistory = _.extend({}, history, {
......@@ -65,6 +65,10 @@ if (getParameterByName('code') && isWeiXin()) {
User.setUserId(res.result.loginInfo.userId);
User.setToken(res.result.loginInfo.xmToken);
User.setEnterpriseId(res.result.enterpriseId);
window.currentStoreUserInfo = {}
window.currentStoreUserInfo.userId = res.result.loginInfo.userId;
window.currentStoreUserInfo.token = res.result.loginInfo.xmToken;
window.currentStoreUserInfo.enterpriseId = res.result.enterpriseId;
mount()
})
} else {
......
......@@ -2,7 +2,7 @@
* @Author: 吴文洁
* @Date: 2019-07-10 10:30:49
* @LastEditors: Please set LastEditors
* @LastEditTime: 2021-05-24 16:29:05
* @LastEditTime: 2021-06-22 17:47:02
* @Description:
*/
import React, { useContext, useEffect, useState } from 'react';
......@@ -64,11 +64,13 @@ const App: React.FC = (props: any) => {
}
function getStoreInfo() {
console.log("currentStoreUserInfo",window.currentStoreUserInfo);
const params = {
storeId: User.getStoreId(),
userId: User.getUserId(),
};
Service.Hades('public/customerHades/getStoreAndUserMsg', params).then((res) => {
if(res.success){
const { id, storeUserId, storeName, userRole, storeType } = res.result;
User.setStoreId(id);
User.setStoreUserId(storeUserId);
......@@ -76,11 +78,21 @@ const App: React.FC = (props: any) => {
Bus.trigger('storeNameChange',storeName);
User.setUserRole(userRole);
User.setStoreType(storeType);
setStoreUserId(storeUserId)
setCurrentStoreUserInfo(id,storeUserId)
setStoreUserId(storeUserId);
getUserPermission();
}
})
}
function setCurrentStoreUserInfo(storeId:any,storeUserId:any){
window.currentStoreUserInfo.storeId = storeId;
window.currentStoreUserInfo.storeUserId = storeUserId;
window.currentStoreUserInfo.userId = User.getUserId();
window.currentStoreUserInfo.token = User.getToken();
window.currentStoreUserInfo.enterpriseId = User.getEnterpriseId();
}
function getStoreGroupAndStoreList() {
BaseService.getUserStore({ userId }).then((res) => {
......@@ -99,6 +111,7 @@ const App: React.FC = (props: any) => {
Bus.trigger('storeNameChange', storeName);
User.setUserRole(userRole);
User.setStoreType(storeType);
setCurrentStoreUserInfo(id,storeUserId);
ctx.dispatch(setStoreGroupList(storeGroupVOS))
ctx.dispatch(setStoreList(storeVOS));
setStoreUserId(storeUserId)
......
......@@ -179,6 +179,9 @@ export default class CollegeManagePage extends React.Component {
return null;
};
User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/home')
}}
>
......@@ -196,6 +199,9 @@ export default class CollegeManagePage extends React.Component {
e.preventDefault();
e.stopPropagation();
User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/college-info')
}}
>编辑</span>
......@@ -250,6 +256,9 @@ export default class CollegeManagePage extends React.Component {
return null;
};
User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/home')
}}
>
......@@ -267,6 +276,9 @@ export default class CollegeManagePage extends React.Component {
e.preventDefault();
e.stopPropagation();
User.setStoreId(item.id);
User.setStoreUserId(item.storeUserId);
window.currentStoreUserInfo.storeId = item.id;
window.currentStoreUserInfo.storeUserId = item.storeUserId;
window.RCHistory.push('/college-info')
}}
>编辑</span>
......
......@@ -10,6 +10,7 @@ import './CreateCollege.less';
let cutFlag = false;
export default class CreateCollege extends React.Component {
constructor(props) {
super(props);
this.state = {
......@@ -18,6 +19,7 @@ export default class CreateCollege extends React.Component {
name: '',
enterpriseId: User.getEnterpriseId(),
};
this.loginInputRef = React.createRef()
}
componentDidMount() {
......@@ -200,11 +202,11 @@ export default class CreateCollege extends React.Component {
</div>
<div className="create-box">
<div className="image-box">
<img className="image" src="https://image.xiaomaiketang.com/xm/fe4NCjr7XF.png"/>
<img className="image" src={logo}/>
<div className="image-mask">
<span
className="icon iconfont"
onClick={() => this.refs.logoInput.click()}
onClick={() => this.loginInputRef.current.click()}
>&#xe6f5;</span>
<span
className="icon iconfont"
......@@ -241,7 +243,7 @@ export default class CreateCollege extends React.Component {
type="file"
accept="image/*"
value={""}
ref="logoInput"
ref={this.loginInputRef}
style={{ display: "none" }}
onChange={this.handleSelectCover}
/>
......
@import "../../core/variables.less";
@import '../../core/variables.less';
@top-height: 60px;
@icon-color: #939393;
.top-container {
......@@ -7,16 +7,23 @@
left: 0;
right: 0;
height: @top-height;
background-color: #2966FF;
background-color: #2966ff;
// z-index:2;
&::after{
content:'';
width:100%;
height:60px;
background: linear-gradient(180deg, #2966FF 0%, rgba(41, 102, 255, 0.82) 29%, rgba(41, 102, 255, 0.58) 55%, rgba(41, 102, 255, 0.27) 77%, rgba(7, 78, 255, 0) 100%);
position:absolute;
z-index:2;
top:59px;
&::after {
content: '';
width: 100%;
height: 60px;
background: linear-gradient(
180deg,
#2966ff 0%,
rgba(41, 102, 255, 0.82) 29%,
rgba(41, 102, 255, 0.58) 55%,
rgba(41, 102, 255, 0.27) 77%,
rgba(7, 78, 255, 0) 100%
);
position: absolute;
z-index: 2;
top: 59px;
}
.logo {
display: inline-block;
......@@ -26,7 +33,7 @@
.logo-name {
font-size: 14px;
font-weight: 500;
color: #2966FF;
color: #2966ff;
line-height: 20px;
vertical-align: middle;
font-weight: bold;
......@@ -204,7 +211,7 @@
cursor: pointer;
}
.college-name {
color:#FFFFFF;
color: #ffffff;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
......@@ -213,9 +220,9 @@
.icon {
font-size: 14px;
margin-left: 8px;
color: #FFF;
color: #fff;
&:hover {
color:#FFF;
color: #fff;
}
}
}
......@@ -283,7 +290,7 @@
align-items: center;
.store-name {
font-size: 14px;
color: #FFF;
color: #fff;
line-height: 49px;
margin-left: 8px;
white-space: nowrap;
......@@ -296,17 +303,17 @@
width: 1px;
height: 16px;
background-color: #f4f4f4;
margin-right:16px;
margin-right: 16px;
}
}
.right-box {
display: flex;
align-items: center;
}
.right-bg-img{
img{
width:277px;
height:60px;
.right-bg-img {
img {
width: 277px;
height: 60px;
}
}
.link-to-store {
......@@ -315,31 +322,27 @@
line-height: 49px;
.text {
font-size: 14px;
color: #FFF;
color: #fff;
line-height: 49px;
margin-left: 7px;
}
.iconfont {
color: #FFF;
color: #fff;
}
.link {
cursor: pointer;
position: relative;
.link-btn{
padding:3px 12px;
.link-btn {
padding: 3px 12px;
border: 1px solid rgba(255, 255, 255, 0.5);
border-radius: 4px;
&:hover{
&:hover {
border: 1px solid rgba(255, 255, 255, 1);
}
}
.store-popover {
display: none;
}
&:hover {
.store-popover {
position: absolute;
display: flex;
display: none;
width: 216px;
height: 260px;
top: 49px;
......@@ -362,7 +365,7 @@
line-height: 20px;
}
.url-link {
color: #2966FF;
color: #2966ff;
font-size: 14px;
line-height: 20px;
}
......@@ -386,19 +389,24 @@
line-height: 41px;
width: 130px;
}
}
}
&:hover {
.store-popover {
display: flex;
}
}
}
.share {
.share,
.help {
cursor: pointer;
margin-left: 16px;
.share-btn{
padding:3px 12px;
.share-btn,
.help-btn {
padding: 3px 12px;
border: 1px solid rgba(255, 255, 255, 0.5);
border-radius: 4px;
&:hover{
&:hover {
border: 1px solid rgba(255, 255, 255, 1);
}
}
......@@ -529,7 +537,7 @@
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color:#FFF;
color: #fff;
}
}
}
......@@ -588,7 +596,7 @@
.user-detail {
position: relative;
padding-bottom: 16px;
border-bottom: 1px solid #E8E8E8;
border-bottom: 1px solid #e8e8e8;
display: flex;
align-items: center;
justify-content: space-between;
......@@ -625,7 +633,7 @@
cursor: pointer;
color: #333;
.menu-before {
color: #BFBFBF;
color: #bfbfbf;
margin-right: 8px;
font-size: 14px;
}
......
@import url("../../core/variables.less");
@import url('../../core/variables.less');
.login-page {
position: static;
font-family: "微软雅黑";
font-family: '微软雅黑';
padding: 0;
min-width: 1200px;
background: #F4F6FA;
background: #f4f6fa;
height: 100%;
overflow-y: hidden;
.logo-img-box{
.logo-img-box {
position: absolute;
top:24px;
right:32px;
z-index:1;
.logo-img{
width:120px;
top: 24px;
right: 32px;
z-index: 1;
.logo-img {
width: 120px;
display: inline-block;
}
}
......@@ -27,7 +27,7 @@
width: 540px;
height: 100vh;
.img-box {
background: #2966FF;
background: #2966ff;
width: 540px;
height: 100vh;
img {
......@@ -36,7 +36,7 @@
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%,-50%);
transform: translate(-50%, -50%);
}
}
}
......@@ -50,10 +50,10 @@
height: 256px;
background: rgba(41, 102, 255, 0.05);
position: absolute;
top:0;
top: 0;
left: 0;
&.right-bottom-block {
top:auto;
top: auto;
left: auto;
bottom: 0;
right: 0;
......@@ -90,8 +90,8 @@
height: 420px;
position: absolute;
left: 50%;
top:50%;
transform: translate(-50%,-50%);
top: 50%;
transform: translate(-50%, -50%);
overflow: hidden;
background-color: #ffffff;
border-radius: 4px;
......@@ -107,7 +107,7 @@
.ant-tabs-tab-active {
.ant-tabs-tab-btn {
color: #333333;
font-weight:500!important;
font-weight: 500 !important;
}
}
.ant-tabs-nav::before {
......@@ -115,7 +115,7 @@
}
.ant-tabs-tab {
text-align: center;
margin:0;
margin: 0;
}
.ant-tabs > .ant-tabs-nav .ant-tabs-nav-list {
margin: 0 auto;
......@@ -128,13 +128,7 @@
width: 280px;
height: 100%;
background: @primary;
background: -webkit-gradient(
linear,
left top,
left bottom,
from(#ffaa1a),
to(#ff8634)
) !important;
background: -webkit-gradient(linear, left top, left bottom, from(#ffaa1a), to(#ff8634)) !important;
display: flex;
display: -webkit-flex;
-webkit-flex-direction: column;
......@@ -197,8 +191,8 @@
}
}
}
.login-form{
margin-top:32px;
.login-form {
margin-top: 32px;
}
.qrcode {
display: none;
......@@ -281,7 +275,7 @@
font-weight: 500;
color: #333;
&::after {
content: "";
content: '';
display: block;
width: 24px;
height: 4px;
......@@ -383,12 +377,12 @@
border-radius: 3px;
margin-top: 60px;
font-size: 14px; // font-weight: 300;
color:#2966FF;
color: #2966ff;
&:hover {
color: #2966FF;
color: #2966ff;
}
&::before {
content: "";
content: '';
display: block;
height: 20px;
width: 1px;
......@@ -416,7 +410,7 @@
}
.refresh {
font-size: 14px;
color: #2966FF;
color: #2966ff;
cursor: pointer;
}
}
......@@ -466,10 +460,10 @@
transition: all 0.3s;
cursor: pointer;
border: none;
text-align:center;
text-align: center;
&:hover {
opacity: 0.7;
background: #5C8AFF;
background: #5c8aff;
}
}
}
......
......@@ -9,7 +9,7 @@
color: #999999;
line-height: 20px;
}
.rwm{
.rwm {
position: relative;
width: 210px;
height: 210px;
......@@ -18,29 +18,28 @@
margin-top: 24px;
border: 1px solid #e8e8e8;
border-radius: 2px;
padding:15px;
.error{
padding: 15px;
.error {
position: absolute;
width: 200px;
height: 200px;
background: rgba(255, 255, 255, 0.95);
display: flex;
align-items:center;
justify-content:center;
left:5px;
top:5px;
div{
align-items: center;
justify-content: center;
left: 5px;
top: 5px;
div {
margin: 0 10px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
line-height: 20px;
}
.ope{
.ope {
cursor: pointer;
color:rgba(82, 137, 250, 1);
color: rgba(82, 137, 250, 1);
}
}
}
......
import React, { useState, useRef, useEffect } from 'react';
import qrcode from "@/libs/qrcode/qrcode.js";
import Service from "@/common/js/service";
import qrcode from '@/libs/qrcode/qrcode.js';
import Service from '@/common/js/service';
import User from '@/common/js/user';
import { PATH } from '@/domains/basic-domain/constants';
import './WechatLogin.less'
const Logo = require("@/common/images/logo.png")
import './WechatLogin.less';
const Logo = require('@/common/images/logo.png');
declare var location: any;
declare var window: any;
export default function WechatLogin(props: any) {
const freshTime = 60;
const init: any = null;
const [status, setStatus] = useState(0);
const [ticket, setTicket] = useState('');
const [leftTime, setLeftTime] = useState(freshTime)
const [leftTime, setLeftTime] = useState(freshTime);
const QRCode = useRef(init);
const timer = useRef(init);
const leftTimeRef = useRef(init);
useEffect(() => {
leftTimeRef.current = leftTime;
}, [leftTime])
}, [leftTime]);
useEffect(() => {
clearInterval(timer.current as any);
if (status === 0) {
Service.Hades("anon/hades/getTicket", {}).then((res: any) => {
setTicket(res.result)
const redirect = `${PATH}?ticket=${res.result}&appTermEnum=XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN&env=${process.env.DEPLOY_ENV || 'dev'}`
// console.log(redirect)
// const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww409ccf9c6e31f19e&redirect_uri=${encodeURIComponent(redirect)}&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
// console.log(url)
const qrcodeWrapDom:any = document.querySelector('#qrcode');
Service.Hades('anon/hades/getTicket', {}).then((res: any) => {
setTicket(res.result);
const redirect = `${PATH}?ticket=${res.result}&appTermEnum=XIAOMAI_CLOUD_CLASS_PC_WEB_ADMIN&env=${process.env.DEPLOY_ENV || 'dev'}`;
const qrcodeWrapDom: any = document.querySelector('#qrcode');
let qrnode = new qrcode({
text: redirect,
correctLevel: 2,
size: 180,
// image: 'https://image.xiaomaiketang.com/xm/Newk4NrxKC.png',
image: 'https://image.xiaomaiketang.com/xm/bFkRBz7teA.png',
imageSize: 50
imageSize: 50,
});
qrcodeWrapDom.innerHTML = '';
qrcodeWrapDom && qrcodeWrapDom.appendChild(qrnode);
......@@ -50,79 +45,95 @@ export default function WechatLogin(props: any) {
if (leftTimeRef.current == 0) {
clearInterval(timer.current);
setStatus(1);
return
return;
}
setLeftTime(leftTimeRef.current - 1);
}, 1000)
})
}, 1000);
});
}
return () => {
clearInterval(timer.current);
}
}, [status])
};
}, [status]);
useEffect(() => {
if (leftTime == 60 || !ticket) {
return
return;
}
Service.Hades('anon/hades/getTicketState', {
ticket
ticket,
}).then((res: any) => {
if (res.result === 'AUTH_SUCCESS') {
Service.Hades('anon/hades/getTicketWXWorkLogin', {
ticket
ticket,
}).then((_res: any) => {
User.setUserId(_res.result.loginInfo.userId);
User.setToken(_res.result.loginInfo.xmToken);
User.setEnterpriseId(_res.result.enterpriseId);
User.setIdentifier(_res.result.identifier)
User.setIdentifier(_res.result.identifier);
window.currentStoreUserInfo = {}
window.currentStoreUserInfo.userId = _res.result.loginInfo.userId;
window.currentStoreUserInfo.token = _res.result.loginInfo.xmToken;
window.currentStoreUserInfo.enterpriseId = _res.result.enterpriseId;
window.RCHistory.push({
pathname: `/switch-route`,
})
})
});
});
}
});
}, [leftTime]);
})
}, [leftTime])
return <div className='wechatLoginBox'>
<div className="rwm">
<div id="qrcode"></div>
return (
<div className='wechatLoginBox'>
<div className='rwm'>
<div id='qrcode'></div>
{
status === 1 && <div className="error">
<div>二维码已过期
<p className="ope" onClick={() => {
setStatus(0)
}}>刷新</p>
{status === 1 && (
<div className='error'>
<div>
二维码已过期
<p
className='ope'
onClick={() => {
setStatus(0);
}}>
刷新
</p>
</div>
</div>
}
{
status === 2 && <div className="error">
<div>所在企业还未注册学院
<p className="ope" onClick={() => {
setStatus(0)
}}>我知道了</p>
)}
{status === 2 && (
<div className='error'>
<div>
所在企业还未注册学院
<p
className='ope'
onClick={() => {
setStatus(0);
}}>
我知道了
</p>
</div>
</div>
}
{
status === 3 && <div className="error">
<div>你还不是学院员工,请联系企业管理员
<p className="ope" onClick={() => {
setStatus(0)
}}>我知道了</p>
)}
{status === 3 && (
<div className='error'>
<div>
你还不是学院员工,请联系企业管理员
<p
className='ope'
onClick={() => {
setStatus(0);
}}>
我知道了
</p>
</div>
</div>
}
)}
</div>
<p className='text'>请使用企业微信扫码登录</p>
</div>
);
}
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