Commit 0109f2bc by guomingpang

fix:解决冲突merge

parents 6d59af4c 178cdcc4
...@@ -89,7 +89,9 @@ ...@@ -89,7 +89,9 @@
"build:dev1": "cross-env DEPLOY_ENV=dev node scripts/build.js", "build:dev1": "cross-env DEPLOY_ENV=dev node scripts/build.js",
"build:rc": "cross-env DEPLOY_ENV=rc node scripts/build.js", "build:rc": "cross-env DEPLOY_ENV=rc node scripts/build.js",
"build:gray": "cross-env DEPLOY_ENV=gray node scripts/build.js", "build:gray": "cross-env DEPLOY_ENV=gray node scripts/build.js",
"build:prod": "cross-env DEPLOY_ENV=prod node scripts/build.js" "build:prod": "cross-env DEPLOY_ENV=prod node scripts/build.js",
"build:gray-syoo": "cross-env DEPLOY_ENV=prod node scripts/build.js",
"build:prod-syoo": "cross-env DEPLOY_ENV=prod node scripts/build.js"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
......
<!-- <!--
* @Author: 吴文洁 * @Author: 吴文洁
* @Date: 2020-08-24 12:20:57 * @Date: 2020-08-24 12:20:57
...@@ -17,7 +16,7 @@ ...@@ -17,7 +16,7 @@
<meta name="theme-color" content="#000000" /> <meta name="theme-color" content="#000000" />
<!-- <link rel="apple-touch-icon" href="../src/common/images/logo.png" /> --> <!-- <link rel="apple-touch-icon" href="../src/common/images/logo.png" /> -->
<link rel="shortcut icon" href="https://image.xiaomaiketang.com/xm/KGSYFEpcHT.png"> <link rel="shortcut icon" href="https://image.xiaomaiketang.com/xm/KGSYFEpcHT.png">
<title>小麦企培</title> <title>扫码登陆</title>
<script type="text/javascript" charset="utf-8" src="./jquery.min.js"></script> <script type="text/javascript" charset="utf-8" src="./jquery.min.js"></script>
<script src="./lottie.js"></script> <script src="./lottie.js"></script>
<script type="text/javascript" src='./animation.json'></script> <script type="text/javascript" src='./animation.json'></script>
...@@ -41,20 +40,24 @@ ...@@ -41,20 +40,24 @@
line-height: 24px; line-height: 24px;
margin-top: 12px; margin-top: 12px;
} }
.desc{
font-size:14px; .desc {
color:#999; font-size: 14px;
color: #999;
} }
.hide { .hide {
display: none; display: none;
text-align: center; text-align: center;
} }
#lottie{
#lottie {
width: 150px; width: 150px;
height: 150px; height: 150px;
margin: 0 auto; margin: 0 auto;
} }
#tenant-config-error-message{
#tenant-config-error-message {
max-width: 70%; max-width: 70%;
margin: 25px auto; margin: 25px auto;
font-size: 14px; font-size: 14px;
...@@ -109,10 +112,10 @@ ...@@ -109,10 +112,10 @@
const code = getParameterByName('code'); const code = getParameterByName('code');
const ticket = getParameterByName('ticket'); const ticket = getParameterByName('ticket');
const storeId = getParameterByName('storeId'); const storeId = getParameterByName('storeId');
const corpType = getParameterByName('corpType');
if (!code) { if (!code) {
postJSON('hades/anon/hades/getCorpTrainSuiteId', {}, (res) => { GetJSON('hades/anon/hades/getCorpTrainSuiteId', {}, (res) => {
const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.result}&redirect_uri=${encodeURIComponent(location.href)}&response_type=code&scope=snsapi_privateinfo&state=STATE#wechat_redirect` const url = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${res.result}&redirect_uri=${encodeURIComponent(location.href)}&response_type=code&scope=snsapi_privateinfo&state=STATE#wechat_redirect`
location.href = url location.href = url
}) })
...@@ -123,11 +126,12 @@ ...@@ -123,11 +126,12 @@
appTermEnum: 'XIAOMAI_CLOUD_CLASS_PC_WEB_CUSTOMER', appTermEnum: 'XIAOMAI_CLOUD_CLASS_PC_WEB_CUSTOMER',
code: code, code: code,
ticket: ticket, ticket: ticket,
storeId:storeId corpType,
storeId: storeId
}, (res) => { }, (res) => {
if (res.code == 200) { if (res.code == 200) {
$('#success').show() $('#success').show()
}else if(res.code === 'DEPLOY_CROP_ADD_USER_NO'){ } else if (res.code === 'DEPLOY_CROP_ADD_USER_NO') {
//租户配置到限,跳转空白提示缺省页 //租户配置到限,跳转空白提示缺省页
$('#tenant-config-error').show(); $('#tenant-config-error').show();
$('#tenant-config-error-message').html(res.message) $('#tenant-config-error-message').html(res.message)
...@@ -135,15 +139,31 @@ ...@@ -135,15 +139,31 @@
} else { } else {
$('#error').show(); $('#error').show();
var message = res.message.split(',').join('<br />') var message = res.message.split(',').join('<br />')
if(message === "非当前企业学院"){ if (message === "非当前企业学院") {
$('#message').html("<div><div>非当前企业学院</div><div class='desc'>尝试扫描「企业外部客户」二维码登录</div></div>"); $('#message').html("<div><div>非当前企业学院</div><div class='desc'>尝试扫描「企业外部客户」二维码登录</div></div>");
}else{ } else {
$('#message').html(message); $('#message').html(message);
} }
} }
}) })
} }
function GetJSON(url, data, callback) {
const ajaxOptions = {
type: 'GET',
url: BASIC_HOST_MAP[env] + url + `?corpType=${corpType}`,
contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
timeout: 20000,
success(res, status, xhr) {
callback(res)
},
};
$.ajax(ajaxOptions)
}
function postJSON(url, data, callback) { function postJSON(url, data, callback) {
const ajaxOptions = { const ajaxOptions = {
data: JSON.stringify(data), data: JSON.stringify(data),
...@@ -160,7 +180,7 @@ ...@@ -160,7 +180,7 @@
$.ajax(ajaxOptions) $.ajax(ajaxOptions)
} }
function emptyAnimation(){ function emptyAnimation() {
let params = { let params = {
container: document.getElementById('lottie'), container: document.getElementById('lottie'),
renderer: 'svg', renderer: 'svg',
......
...@@ -32,10 +32,25 @@ ...@@ -32,10 +32,25 @@
work correctly both with client-side routing and a non-root public URL. work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`. Learn how to configure a non-root public URL by running `npm run build`.
--> -->
<title>登录</title> <title>扫码登录</title>
<script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script> <script type="text/javascript" src="https://image.xiaomaiketang.com/xm/PhotoClip.js"></script>
</head> </head>
<body> <body>
<script>
(function (doc, win) {
var docEl = doc.documentElement,
resizeEvt =
"orientationchange" in window ? "orientationchange" : "resize",
recalc = function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) return;
docEl.style.fontSize = (clientWidth / 375) * 50 + "px";
};
if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener("DOMContentLoaded", recalc, false);
})(document, window);
</script>
<noscript>You need to enable JavaScript to run this app.</noscript> <noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div> <div id="root"></div>
<!-- <!--
......
...@@ -41,7 +41,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) { ...@@ -41,7 +41,7 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
} }
// Tools like Cloud9 rely on this. // Tools like Cloud9 rely on this.
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3003; const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3002;
const HOST = process.env.HOST || '0.0.0.0'; const HOST = process.env.HOST || '0.0.0.0';
if (process.env.HOST) { if (process.env.HOST) {
......
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
* @Description: 描述一下 * @Description: 描述一下
* @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有 * @@Copyrigh: © 2020 杭州杰竞科技有限公司 版权所有
*/ */
declare var process:any;
const APP_ID_MAP = { const APP_ID_MAP:any = {
dev: 'wx3ea60e78ddfa277e', dev: 'wx3ea60e78ddfa277e',
rc:'wx5c5a1fb71ecab7bc', rc:'wx5c5a1fb71ecab7bc',
gray:'wx3dda02036493ada6', gray:'wx3dda02036493ada6',
...@@ -15,6 +16,8 @@ const APP_ID_MAP = { ...@@ -15,6 +16,8 @@ const APP_ID_MAP = {
} }
// 调试环境,默认dev // 调试环境,默认dev
const ENV = 'dev'; const ENV: string = process.env.DEPLOY_ENV || 'dev'
console.log( process.env.DEPLOY_ENV,' process.env.DEPLOY_ENV process.env.DEPLOY_ENV')
export const AppId = APP_ID_MAP[ENV]; export const AppId = APP_ID_MAP[ENV];
...@@ -15,9 +15,6 @@ class Authorize extends React.Component { ...@@ -15,9 +15,6 @@ class Authorize extends React.Component {
} }
} }
componentDidMount() { componentDidMount() {
// console.log("ticket",window.getParameterByName('ticket'))
// const searchParams = this.props.location.search;
// const {code,ticket} = queryString.parse(searchParams);
const code = window.getParameterByName('code'); const code = window.getParameterByName('code');
const ticket = window.getParameterByName('ticket'); const ticket = window.getParameterByName('ticket');
this.setState({ this.setState({
...@@ -61,11 +58,27 @@ class Authorize extends React.Component { ...@@ -61,11 +58,27 @@ class Authorize extends React.Component {
} }
Service.hades('/anon/hades/bindWeChat',params).then((res)=>{ Service.hades('/anon/hades/bindWeChat',params).then((res)=>{
if(res.success){ if(res.success){
localStorage.setItem('wechat-common_user_avatar_url',res.result.headImgUrl || 'https://image.xiaomaiketang.com/xm/HsCjyKTbWw.png')
localStorage.setItem('wechat-common_user_open_id',res.result.openId)
localStorage.setItem('wechat-common_user_nick_name',res.result.nickName)
// if(!res.result.whetherOld){
//1.审核开关打开,并且新用户第一次登陆,未提交过审核(审核状态为空)跳转提交审核页面
if(res.result.auditSwitch === 'OPEN'&& !res.result.applyStatus ){
window.RCHistory.replace(`/wechat-audit?storeId=${storeId}`);
return
}
//2.审核开关打开,已提交过审核,审核状态为WAIT(等待审核)或者REJECTED(已被拒绝)时;跳转审核等待页;
if(res.result.auditSwitch === 'OPEN' && (res.result.applyStatus === 'WAIT' || res.result.applyStatus==='REJECTED' )){
window.RCHistory.replace(`/wechat-audit-result?storeId=${storeId}`);
return
}
// }
this.setState({ this.setState({
hasBindWechat:true, hasBindWechat:true,
headImgUrl:res.result.headImgUrl, headImgUrl:res.result.headImgUrl,
ticketState:"AUTH_SUCCESS" ticketState:"AUTH_SUCCESS"
},()=>{this.changeCodeState()}) },()=>{this.changeCodeState()})
} }
}) })
} }
...@@ -79,7 +92,7 @@ class Authorize extends React.Component { ...@@ -79,7 +92,7 @@ class Authorize extends React.Component {
{ !hasBindWechat && { !hasBindWechat &&
<div> <div>
<div> <div>
<img src="https://image.xiaomaiketang.com/xm/HsCjyKTbWw.png" className="avatar-img"></img> <img src="https://image.xiaomaiketang.com/xm/HsCjyKTbWw.png" className="avatar-img" alt=''></img>
</div> </div>
<button className="login-btn" onClick={this.wechatAuthorize}>微信登录</button> <button className="login-btn" onClick={this.wechatAuthorize}>微信登录</button>
</div> </div>
...@@ -89,7 +102,7 @@ class Authorize extends React.Component { ...@@ -89,7 +102,7 @@ class Authorize extends React.Component {
<div> <div>
<div> <div>
<img src={headImgUrl} className="avatar-img"></img> <img src={headImgUrl} className="avatar-img" alt=''></img>
</div> </div>
<div className="login-success-text">微信登录成功</div> <div className="login-success-text">微信登录成功</div>
<div className="login-success-instro">已完成微信登录操作,去网页端继续学习吧</div> <div className="login-success-instro">已完成微信登录操作,去网页端继续学习吧</div>
......
import React from "react";
import { createHashHistory } from 'history';
import { Route, Router, Switch ,Redirect} from 'react-router-dom';
import EmptyPage from './EmptyPage'
import WechatAudit from './WechatAudit'
import WechatAuditResult from "./WechatAuditResult";
const XMHistory = createHashHistory();
window.XMHistory = XMHistory;
const App =function(){
return <Router history={XMHistory}>
<Switch>
<Redirect from='/' to='/empty' exact />
<Route exact path='/empty' render={() => <EmptyPage />} />
<Route path='/wechat-audit' render={() => <WechatAudit />} />
<Route path='/wechat-audit-result' render={() => <WechatAuditResult />} />
</Switch>
</Router>
}
export default App;
\ No newline at end of file
import React, { useState } from "react";
import { Form, Button, Input } from "antd";
import Service from "@/common/js/service";
import "./WechatAudit.less";
const WechatAudit = function () {
const storeId = window.getParameterByName("storeId");
const [realName, setRealName] = useState("");
const avatarUrl= localStorage.getItem('wechat-common_user_avatar_url')
const openId= localStorage.getItem('wechat-common_user_open_id')
const nickName = localStorage.getItem('wechat-common_user_nick_name')
function saveUserInfo() {
const params = {
openId,
nickName,
avatarUrl,
storeId,
realName
};
Service.hades("anon/customerHades/applyJoin", params).then((res) => {
if(res.success === true ){
window.location.href = `${window.location.origin}${window.location.pathname}#/wechat-audit-result?storeId=${storeId}`
}
});
}
return (
<div className="wechat-audit">
<div className="box">
<div className="title">登录申请</div>
<div className="tip">
请输入您的真实姓名并提交申请,通过申请后即可登录学院
</div>
<Form>
<div className="name-item">
<Input
placeholder="请输入姓名,最多6个字符"
style={{ width: 300, height: 32 }}
value={realName}
maxLength={6}
onChange={(e) => {
setRealName(e.target.value);
}}
/>
</div>
<div className={realName ? "save-btn" : "save-btn disable"}>
<Button
type="primary"
onClick={() => {
saveUserInfo();
}}
>
申请加入
</Button>
</div>
</Form>
</div>
</div>
);
};
export default WechatAudit;
.wechat-audit{
background: #F4F6FA;
min-height: 100vh;
width: 100%;
max-width: 1200px;
display: flex;
justify-content: center;
text-align: center;
margin: 0 auto;
.box{
margin-top: 2.02rem;
.title{
font-size: .34rem;
color: #333;
margin-bottom: .2rem;
}
.tip{
font-size: .26rem;
color: #999;
margin-bottom: .32rem;
}
.name-item input{
width: 100% !important;
height: 44px !important;
font-size: .3rem !important;
}
.save-btn{
button{
background: #2966FF;
border-color:#2966FF;
width: 100% !important;
height: 44px !important;
margin-top: .6rem;
font-size: .3rem !important;
}
&.disable{
opacity: 0.5;
}
}
}
}
\ No newline at end of file
import React, { useEffect, useState } from "react";
import { debounce } from "underscore";
import Service from "@/common/js/service";
import "./WechatAuditResult.less";
const WechatAuditResult = function () {
const [status, setStatus] = useState("WAIT");
const storeId =window.getParameterByName("storeId");
const [headImgUrl,setHeadImgUrl] = useState(localStorage.getItem('wechat-common_user_avatar_url'))
const openId = localStorage.getItem('wechat-common_user_open_id')
useEffect(() => {
getStatus();
}, []);
function getStatus() {
const params={
openId,
storeId
}
Service.hades("anon/customerHades/getCustomerAudit", params).then((res) => {
const {result:{applyStatus,auditSwitch}}= res
if(auditSwitch === 'CLOSE'){
setStatus('PASSED')
}else{
setStatus(applyStatus)
}
});
}
return (
<div className="wechat-audit-result">
<Choose>
<When condition={status === "WAIT"}>
<div className="box">
<img
className="img"
src="https://image.xiaomaiketang.com/xm/6isseQhcTh.png"
alt=""
/>
<div className="desc">申请审核中</div>
<div className="tip">
您已成功提交申请,待系统审核通过后,才能登录学院
</div>
<div
className="btn reload"
onClick={debounce(() => getStatus("fail"), 3000, true)}
>
刷新
</div>
</div>
</When>
<When condition={status === "PASSED"}>
<div className='box'>
<img src={headImgUrl} className="avatar-img" alt=''></img>
<div className="login-success-text">微信登录成功</div>
<div className="login-success-instro">已完成微信登录操作,去网页端继续学习吧</div>
</div>
</When>
<Otherwise>
<div className="box">
<img
className="img"
src="https://image.xiaomaiketang.com/xm/cQzJDFZDsp.png"
alt=""
/>
<div className="desc">审核失败</div>
<div className="tip">
请输入您的真实姓名并提交申请,通过申请后就可以登录学院
</div>
<div
className="btn reload"
onClick={() => {
window.location.href =
window.location.origin +
window.location.pathname +
`#/wechat-audit?storeId=${storeId}`;
}}
>
重新申请
</div>
</div>
</Otherwise>
</Choose>
</div>
);
};
export default WechatAuditResult;
.wechat-audit-result{
background: #F4F6FA;
min-height: 100vh;
width: 100%;
max-width: 1200px;
display: flex;
flex-direction: column;
text-align: center;
margin: 0 auto;
.box{
margin-top: 3.42rem;
.img{
width: 1.2rem;
height: 1.2rem;
}
.desc{
font-size: #333;
font-size: .3rem;
font-weight: 500;
margin:.32rem 0 .2rem;
}
.tip{
font-size: .26rem;
color: #999;
width: 85%;
margin: 0 auto;
line-height: 1.8;
}
.btn{
color: #2966ff;
font-size: .3rem;
cursor: pointer;
margin-top: 1.6rem;
&:active{
opacity: 0.7;
}
}
}
.avatar-img{
width:16vw;
height:16vw;
border-radius:50%;
}
.login-btn{
width: 91.2vw;
height: 11.7vw;
background: #1CAC1B;
border-radius: 1.3vw;
display:inline-block;
color:#FFF;
border:none;
margin-top:10.6vw;
font-size:4vw;
}
.login-success-text{
margin-top:10.6vw;
font-size:4vw;
color:#333333;
}
.login-success-instro{
font-size:13px;
color:#999;
margin-top:5px;
}
}
\ No newline at end of file
...@@ -11,6 +11,8 @@ import { MenuConfig } from '@/routes/interface'; ...@@ -11,6 +11,8 @@ import { MenuConfig } from '@/routes/interface';
import Authorize from '@/modules/authorize'; import Authorize from '@/modules/authorize';
import WorkWxAuthorize from '@/modules/workWxAuthorize'; import WorkWxAuthorize from '@/modules/workWxAuthorize';
import EmptyPage from '@/modules/empty-page/EmptyPage' import EmptyPage from '@/modules/empty-page/EmptyPage'
import WechatAudit from '@/modules/wechat-audit/WechatAudit';
import WechatAuditResult from '@/modules/wechat-audit/WechatAuditResult';
const CloudClassConfig: MenuConfig = { const CloudClassConfig: MenuConfig = {
key: 'cloudClass', key: 'cloudClass',
name: '云课堂', name: '云课堂',
...@@ -33,6 +35,18 @@ const CloudClassConfig: MenuConfig = { ...@@ -33,6 +35,18 @@ const CloudClassConfig: MenuConfig = {
path: '/empty-page', path: '/empty-page',
component:EmptyPage, component:EmptyPage,
}, },
{
key: 'wechat-audit',
name: '',
path: '/wechat-audit',
component: WechatAudit,
},
{
key: 'wechat-audit-result',
name: '提示',
path: '/wechat-audit-result',
component:WechatAuditResult,
},
] ]
}; };
export default CloudClassConfig; export default CloudClassConfig;
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