Commit 178cdcc4 by guomingpang

feat:微信审核功能冒烟

parent 5a3a3112
...@@ -24,7 +24,7 @@ const getClientEnvironment = require('./env'); ...@@ -24,7 +24,7 @@ const getClientEnvironment = require('./env');
const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin'); const ModuleNotFoundPlugin = require('react-dev-utils/ModuleNotFoundPlugin');
const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin'); const ForkTsCheckerWebpackPlugin = require('react-dev-utils/ForkTsCheckerWebpackPlugin');
const typescriptFormatter = require('react-dev-utils/typescriptFormatter'); const typescriptFormatter = require('react-dev-utils/typescriptFormatter');
var PREFIX = 'wechat-common-'
const postcssNormalize = require('postcss-normalize'); const postcssNormalize = require('postcss-normalize');
const appPackageJson = require(paths.appPackageJson); const appPackageJson = require(paths.appPackageJson);
...@@ -175,14 +175,14 @@ module.exports = function(webpackEnv) { ...@@ -175,14 +175,14 @@ module.exports = function(webpackEnv) {
// There will be one main bundle, and one file per asynchronous chunk. // There will be one main bundle, and one file per asynchronous chunk.
// In development, it does not produce real files. // In development, it does not produce real files.
filename: isEnvProduction filename: isEnvProduction
? 'static/js/[name].[contenthash:8].js' ?PREFIX+ 'static/js/[name].[contenthash:8].js'
: isEnvDevelopment && 'static/js/bundle.js', : isEnvDevelopment && PREFIX+'static/js/bundle.js',
// TODO: remove this when upgrading to webpack 5 // TODO: remove this when upgrading to webpack 5
futureEmitAssets: true, futureEmitAssets: true,
// There are also additional JS chunk files if you use code splitting. // There are also additional JS chunk files if you use code splitting.
chunkFilename: isEnvProduction chunkFilename: isEnvProduction
? 'static/js/[name].[contenthash:8].chunk.js' ? PREFIX+'static/js/[name].[contenthash:8].chunk.js'
: isEnvDevelopment && 'static/js/[name].chunk.js', : isEnvDevelopment && PREFIX+'static/js/[name].chunk.js',
// webpack uses `publicPath` to determine where the app is being served from. // webpack uses `publicPath` to determine where the app is being served from.
// It requires a trailing slash, or the file assets will get an incorrect path. // It requires a trailing slash, or the file assets will get an incorrect path.
// We inferred the "public path" (such as / or /my-project) from homepage. // We inferred the "public path" (such as / or /my-project) from homepage.
...@@ -370,7 +370,7 @@ module.exports = function(webpackEnv) { ...@@ -370,7 +370,7 @@ module.exports = function(webpackEnv) {
loader: require.resolve('url-loader'), loader: require.resolve('url-loader'),
options: { options: {
limit: imageInlineSizeLimit, limit: imageInlineSizeLimit,
name: 'static/media/[name].[hash:8].[ext]', name: PREFIX+'static/media/[name].[hash:8].[ext]',
}, },
}, },
// Process application JS with Babel. // Process application JS with Babel.
...@@ -505,7 +505,7 @@ module.exports = function(webpackEnv) { ...@@ -505,7 +505,7 @@ module.exports = function(webpackEnv) {
// by webpacks internal loaders. // by webpacks internal loaders.
exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/], exclude: [/\.(js|mjs|jsx|ts|tsx)$/, /\.html$/, /\.json$/],
options: { options: {
name: 'static/media/[name].[hash:8].[ext]', name: PREFIX+'static/media/[name].[hash:8].[ext]',
}, },
}, },
// ** STOP ** Are you adding a new loader? // ** STOP ** Are you adding a new loader?
...@@ -578,8 +578,8 @@ module.exports = function(webpackEnv) { ...@@ -578,8 +578,8 @@ module.exports = function(webpackEnv) {
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
// Options similar to the same options in webpackOptions.output // Options similar to the same options in webpackOptions.output
// both options are optional // both options are optional
filename: 'static/css/[name].[contenthash:8].css', filename: PREFIX+'static/css/[name].[contenthash:8].css',
chunkFilename: 'static/css/[name].[contenthash:8].chunk.css', chunkFilename: PREFIX+'static/css/[name].[contenthash:8].chunk.css',
}), }),
// Generate an asset manifest file with the following content: // Generate an asset manifest file with the following content:
// - "files" key: Mapping of all asset filenames to their corresponding // - "files" key: Mapping of all asset filenames to their corresponding
......
...@@ -36,6 +36,21 @@ ...@@ -36,6 +36,21 @@
<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>
<!-- <!--
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
import { MapInterface } from '@/domains/basic-domain/interface' import { MapInterface } from '@/domains/basic-domain/interface'
// 默认是 dev 环境 // 默认是 dev 环境
const ENV: string = process.env.DEPLOY_ENV || 'prod'; const ENV: string = process.env.DEPLOY_ENV || 'dev';
const BASIC_HOST_MAP: MapInterface = { const BASIC_HOST_MAP: MapInterface = {
dev: 'https://dev-heimdall.xiaomai5.com/', dev: 'https://dev-heimdall.xiaomai5.com/',
......
...@@ -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,15 +58,26 @@ class Authorize extends React.Component { ...@@ -61,15 +58,26 @@ 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){
if(res.auditSwitch === 'OPEN'){ localStorage.setItem('wechat-common_user_avatar_url',res.result.headImgUrl || 'https://image.xiaomaiketang.com/xm/HsCjyKTbWw.png')
window.RCHistory.replace('/wechat-audit'); localStorage.setItem('wechat-common_user_open_id',res.result.openId)
}else{ localStorage.setItem('wechat-common_user_nick_name',res.result.nickName)
this.setState({ // if(!res.result.whetherOld){
hasBindWechat:true, //1.审核开关打开,并且新用户第一次登陆,未提交过审核(审核状态为空)跳转提交审核页面
headImgUrl:res.result.headImgUrl, if(res.result.auditSwitch === 'OPEN'&& !res.result.applyStatus ){
ticketState:"AUTH_SUCCESS" window.RCHistory.replace(`/wechat-audit?storeId=${storeId}`);
},()=>{this.changeCodeState()}) 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({
hasBindWechat:true,
headImgUrl:res.result.headImgUrl,
ticketState:"AUTH_SUCCESS"
},()=>{this.changeCodeState()})
} }
}) })
...@@ -84,7 +92,7 @@ class Authorize extends React.Component { ...@@ -84,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>
...@@ -94,7 +102,7 @@ class Authorize extends React.Component { ...@@ -94,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, { useState } from "react"; import React, { useState } from "react";
import { Form, Button, Input } from "antd"; import { Form, Button, Input } from "antd";
import './WechatAudit.less' import Service from "@/common/js/service";
import "./WechatAudit.less";
const WechatAudit = function () { const WechatAudit = function () {
const [nickName, setNickName] = useState(""); const storeId = window.getParameterByName("storeId");
function saveUserInfo(){ const [realName, setRealName] = useState("");
window.location.href =window.location.origin + window.location.pathname + '#/wechat-audit-result' 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 ( return (
<div className='wechat-audit'> <div className="wechat-audit">
<div className="box"> <div className="box">
<div className="title">登录申请</div> <div className="title">登录申请</div>
<div className="tip"> <div className="tip">
...@@ -18,15 +37,15 @@ const WechatAudit = function () { ...@@ -18,15 +37,15 @@ const WechatAudit = function () {
<Input <Input
placeholder="请输入姓名,最多6个字符" placeholder="请输入姓名,最多6个字符"
style={{ width: 300, height: 32 }} style={{ width: 300, height: 32 }}
value={nickName} value={realName}
maxLength={6} maxLength={6}
onChange={(e) => { onChange={(e) => {
setNickName(e.target.value); setRealName(e.target.value);
}} }}
/> />
</div> </div>
<div className="save-btn"> <div className={realName ? "save-btn" : "save-btn disable"}>
<Button <Button
type="primary" type="primary"
onClick={() => { onClick={() => {
......
...@@ -26,11 +26,16 @@ ...@@ -26,11 +26,16 @@
} }
.save-btn{ .save-btn{
button{ button{
background: #2966FF;
border-color:#2966FF;
width: 100% !important; width: 100% !important;
height: 44px !important; height: 44px !important;
margin-top: .6rem; margin-top: .6rem;
font-size: .3rem !important; font-size: .3rem !important;
} }
&.disable{
opacity: 0.5;
}
} }
} }
......
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import { debounce } from "underscore"; import { debounce } from "underscore";
import Service from "@/common/js/service";
import "./WechatAuditResult.less"; import "./WechatAuditResult.less";
const WechatAuditResult = function () { const WechatAuditResult = function () {
const [status, setStatus] = useState("waiting"); 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(() => { useEffect(() => {
getStatus("waiting"); getStatus();
}, []); }, []);
function getStatus(arr) { function getStatus() {
setStatus(arr); 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 ( return (
<div className="wechat-audit-result"> <div className="wechat-audit-result">
<Choose> <Choose>
<When condition={status === "waiting"}> <When condition={status === "WAIT"}>
<div className="box"> <div className="box">
<img <img
className="img" className="img"
...@@ -33,6 +49,13 @@ const WechatAuditResult = function () { ...@@ -33,6 +49,13 @@ const WechatAuditResult = function () {
</div> </div>
</div> </div>
</When> </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> <Otherwise>
<div className="box"> <div className="box">
<img <img
...@@ -50,10 +73,9 @@ const WechatAuditResult = function () { ...@@ -50,10 +73,9 @@ const WechatAuditResult = function () {
window.location.href = window.location.href =
window.location.origin + window.location.origin +
window.location.pathname + window.location.pathname +
"#/wechat-audit"; `#/wechat-audit?storeId=${storeId}`;
}} }}
> >
{" "}
重新申请 重新申请
</div> </div>
</div> </div>
......
.wechat-audit-result{ .wechat-audit-result{
background: #F4F6FA; background: #F4F6FA;
min-height: 100vh; min-height: 100vh;
width: 100%; width: 100%;
max-width: 1200px; max-width: 1200px;
display: flex; display: flex;
justify-content: center; flex-direction: column;
text-align: center; text-align: center;
margin: 0 auto; margin: 0 auto;
.box{ .box{
...@@ -36,4 +38,31 @@ ...@@ -36,4 +38,31 @@
} }
} }
} }
.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
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