Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wechat-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
wechat-common
Commits
178cdcc4
Commit
178cdcc4
authored
Aug 13, 2021
by
guomingpang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:微信审核功能冒烟
parent
5a3a3112
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
140 additions
and
41 deletions
+140
-41
config/webpack.config.js
+9
-9
public/index.html
+15
-0
src/domains/basic-domain/constants.ts
+1
-1
src/modules/authorize/index.jsx
+22
-14
src/modules/wechat-audit/WechatAudit.jsx
+27
-8
src/modules/wechat-audit/WechatAudit.less
+5
-0
src/modules/wechat-audit/WechatAuditResult.jsx
+30
-8
src/modules/wechat-audit/WechatAuditResult.less
+31
-1
No files found.
config/webpack.config.js
View file @
178cdcc4
...
...
@@ -24,7 +24,7 @@ const getClientEnvironment = require('./env');
const
ModuleNotFoundPlugin
=
require
(
'react-dev-utils/ModuleNotFoundPlugin'
);
const
ForkTsCheckerWebpackPlugin
=
require
(
'react-dev-utils/ForkTsCheckerWebpackPlugin'
);
const
typescriptFormatter
=
require
(
'react-dev-utils/typescriptFormatter'
);
var
PREFIX
=
'wechat-common-'
const
postcssNormalize
=
require
(
'postcss-normalize'
);
const
appPackageJson
=
require
(
paths
.
appPackageJson
);
...
...
@@ -175,14 +175,14 @@ module.exports = function(webpackEnv) {
// There will be one main bundle, and one file per asynchronous chunk.
// In development, it does not produce real files.
filename
:
isEnvProduction
?
'static/js/[name].[contenthash:8].js'
:
isEnvDevelopment
&&
'static/js/bundle.js'
,
?
PREFIX
+
'static/js/[name].[contenthash:8].js'
:
isEnvDevelopment
&&
PREFIX
+
'static/js/bundle.js'
,
// TODO: remove this when upgrading to webpack 5
futureEmitAssets
:
true
,
// There are also additional JS chunk files if you use code splitting.
chunkFilename
:
isEnvProduction
?
'static/js/[name].[contenthash:8].chunk.js'
:
isEnvDevelopment
&&
'static/js/[name].chunk.js'
,
?
PREFIX
+
'static/js/[name].[contenthash:8].chunk.js'
:
isEnvDevelopment
&&
PREFIX
+
'static/js/[name].chunk.js'
,
// 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.
// We inferred the "public path" (such as / or /my-project) from homepage.
...
...
@@ -370,7 +370,7 @@ module.exports = function(webpackEnv) {
loader
:
require
.
resolve
(
'url-loader'
),
options
:
{
limit
:
imageInlineSizeLimit
,
name
:
'static/media/[name].[hash:8].[ext]'
,
name
:
PREFIX
+
'static/media/[name].[hash:8].[ext]'
,
},
},
// Process application JS with Babel.
...
...
@@ -505,7 +505,7 @@ module.exports = function(webpackEnv) {
// by webpacks internal loaders.
exclude
:
[
/
\.(
js|mjs|jsx|ts|tsx
)
$/
,
/
\.
html$/
,
/
\.
json$/
],
options
:
{
name
:
'static/media/[name].[hash:8].[ext]'
,
name
:
PREFIX
+
'static/media/[name].[hash:8].[ext]'
,
},
},
// ** STOP ** Are you adding a new loader?
...
...
@@ -578,8 +578,8 @@ module.exports = function(webpackEnv) {
new
MiniCssExtractPlugin
({
// Options similar to the same options in webpackOptions.output
// both options are optional
filename
:
'static/css/[name].[contenthash:8].css'
,
chunkFilename
:
'static/css/[name].[contenthash:8].chunk.css'
,
filename
:
PREFIX
+
'static/css/[name].[contenthash:8].css'
,
chunkFilename
:
PREFIX
+
'static/css/[name].[contenthash:8].chunk.css'
,
}),
// Generate an asset manifest file with the following content:
// - "files" key: Mapping of all asset filenames to their corresponding
...
...
public/index.html
View file @
178cdcc4
...
...
@@ -36,6 +36,21 @@
<script
type=
"text/javascript"
src=
"https://image.xiaomaiketang.com/xm/PhotoClip.js"
></script>
</head>
<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>
<div
id=
"root"
></div>
<!--
...
...
src/domains/basic-domain/constants.ts
View file @
178cdcc4
...
...
@@ -9,7 +9,7 @@
import
{
MapInterface
}
from
'@/domains/basic-domain/interface'
// 默认是 dev 环境
const
ENV
:
string
=
process
.
env
.
DEPLOY_ENV
||
'
prod
'
;
const
ENV
:
string
=
process
.
env
.
DEPLOY_ENV
||
'
dev
'
;
const
BASIC_HOST_MAP
:
MapInterface
=
{
dev
:
'https://dev-heimdall.xiaomai5.com/'
,
...
...
src/modules/authorize/index.jsx
View file @
178cdcc4
...
...
@@ -15,9 +15,6 @@ class Authorize extends React.Component {
}
}
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
ticket
=
window
.
getParameterByName
(
'ticket'
);
this
.
setState
({
...
...
@@ -61,15 +58,26 @@ class Authorize extends React.Component {
}
Service
.
hades
(
'/anon/hades/bindWeChat'
,
params
).
then
((
res
)
=>
{
if
(
res
.
success
){
if
(
res
.
auditSwitch
===
'OPEN'
){
window
.
RCHistory
.
replace
(
'/wechat-audit'
);
}
else
{
this
.
setState
({
hasBindWechat
:
true
,
headImgUrl
:
res
.
result
.
headImgUrl
,
ticketState
:
"AUTH_SUCCESS"
},()
=>
{
this
.
changeCodeState
()})
}
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
({
hasBindWechat
:
true
,
headImgUrl
:
res
.
result
.
headImgUrl
,
ticketState
:
"AUTH_SUCCESS"
},()
=>
{
this
.
changeCodeState
()})
}
})
...
...
@@ -84,7 +92,7 @@ class Authorize extends React.Component {
{
!
hasBindWechat
&&
<
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
>
<
button
className=
"login-btn"
onClick=
{
this
.
wechatAuthorize
}
>
微信登录
</
button
>
</
div
>
...
...
@@ -94,7 +102,7 @@ class Authorize extends React.Component {
<
div
>
<
div
>
<
img
src=
{
headImgUrl
}
className=
"avatar-img"
></
img
>
<
img
src=
{
headImgUrl
}
className=
"avatar-img"
alt=
''
></
img
>
</
div
>
<
div
className=
"login-success-text"
>
微信登录成功
</
div
>
<
div
className=
"login-success-instro"
>
已完成微信登录操作,去网页端继续学习吧
</
div
>
...
...
src/modules/wechat-audit/WechatAudit.jsx
View file @
178cdcc4
import
React
,
{
useState
}
from
"react"
;
import
{
Form
,
Button
,
Input
}
from
"antd"
;
import
'./WechatAudit.less'
import
Service
from
"@/common/js/service"
;
import
"./WechatAudit.less"
;
const
WechatAudit
=
function
()
{
const
[
nickName
,
setNickName
]
=
useState
(
""
);
function
saveUserInfo
(){
window
.
location
.
href
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
'#/wechat-audit-result'
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=
"wechat-audit"
>
<
div
className=
"box"
>
<
div
className=
"title"
>
登录申请
</
div
>
<
div
className=
"tip"
>
...
...
@@ -18,15 +37,15 @@ const WechatAudit = function () {
<
Input
placeholder=
"请输入姓名,最多6个字符"
style=
{
{
width
:
300
,
height
:
32
}
}
value=
{
nick
Name
}
value=
{
real
Name
}
maxLength=
{
6
}
onChange=
{
(
e
)
=>
{
set
Nick
Name
(
e
.
target
.
value
);
set
Real
Name
(
e
.
target
.
value
);
}
}
/>
</
div
>
<
div
className=
"save-btn"
>
<
div
className=
{
realName
?
"save-btn"
:
"save-btn disable"
}
>
<
Button
type=
"primary"
onClick=
{
()
=>
{
...
...
src/modules/wechat-audit/WechatAudit.less
View file @
178cdcc4
...
...
@@ -26,11 +26,16 @@
}
.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;
}
}
}
...
...
src/modules/wechat-audit/WechatAuditResult.jsx
View file @
178cdcc4
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
(
"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
(()
=>
{
getStatus
(
"waiting"
);
getStatus
();
},
[]);
function
getStatus
(
arr
)
{
setStatus
(
arr
);
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
===
"
waiting
"
}
>
<
When
condition=
{
status
===
"
WAIT
"
}
>
<
div
className=
"box"
>
<
img
className=
"img"
...
...
@@ -33,6 +49,13 @@ const WechatAuditResult = function () {
</
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
...
...
@@ -50,10 +73,9 @@ const WechatAuditResult = function () {
window
.
location
.
href
=
window
.
location
.
origin
+
window
.
location
.
pathname
+
"#/wechat-audit"
;
`#/wechat-audit?storeId=${storeId}`
;
}
}
>
{
" "
}
重新申请
</
div
>
</
div
>
...
...
src/modules/wechat-audit/WechatAuditResult.less
View file @
178cdcc4
.wechat-audit-result{
background: #F4F6FA;
min-height: 100vh;
width: 100%;
max-width: 1200px;
display: flex;
justify-content: center
;
flex-direction: column
;
text-align: center;
margin: 0 auto;
.box{
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment