Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cdsf-wx-app
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
cdsf-wx-app
Commits
34236e72
Commit
34236e72
authored
Oct 09, 2018
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
89d1b2e5
84b9343c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
30 deletions
+25
-30
App.js
src/containers/App.js
+11
-27
ReprtRepair.js
src/containers/Repair/ReprtRepair.js
+13
-2
index.js
src/store/index.js
+1
-1
No files found.
src/containers/App.js
View file @
34236e72
...
@@ -27,30 +27,9 @@ class App extends Component {
...
@@ -27,30 +27,9 @@ class App extends Component {
userinfo
:
defaultUserinfo
,
userinfo
:
defaultUserinfo
,
updateUserInfo
:
this
.
updateUserInfo
,
updateUserInfo
:
this
.
updateUserInfo
,
},
},
loadingText
:
'加载中...'
,
};
};
}
}
renderLogin
=
props
=>
{
// const { isWx } = this.state;
const
isWx
=
true
;
const
{
search
}
=
props
.
location
;
const
paramsString
=
search
.
substring
(
1
);
const
searchParams
=
new
URLSearchParams
(
paramsString
);
const
code
=
searchParams
.
get
(
'code'
);
const
state
=
searchParams
.
get
(
'state'
);
console
.
log
(
isWx
,
code
,
state
);
if
(
!
isWx
)
{
return
<
div
>
请在微信客户端打开链接
<
/div>
;
}
else
if
(
!
code
)
{
console
.
log
(
window
.
location
);
let
rUrl
=
encodeURIComponent
(
''
);
window
.
location
.
href
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
APP_ID
}
&redirect_uri=
${
rUrl
}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
;
return
<
div
>
授权中。。。
<
/div>
;
}
else
{
return
<
Login
{...
props
}
code
=
{
code
}
/>
;
}
};
getParams
=
str
=>
{
getParams
=
str
=>
{
let
obj
=
{};
let
obj
=
{};
const
searchParams
=
new
URLSearchParams
(
str
);
const
searchParams
=
new
URLSearchParams
(
str
);
...
@@ -66,11 +45,12 @@ class App extends Component {
...
@@ -66,11 +45,12 @@ class App extends Component {
userContext
:
{
userContext
:
{
userinfo
:
{
login
},
userinfo
:
{
login
},
},
},
loadingText
,
}
=
this
.
state
;
}
=
this
.
state
;
const
{
history
,
location
}
=
props
;
const
{
history
,
location
}
=
props
;
let
params
=
this
.
getParams
(
location
.
search
);
let
params
=
this
.
getParams
(
location
.
search
);
if
(
login
)
{
if
(
login
)
{
return
<
div
style
=
{{
margin
:
'60px 24px 0'
}}
>
加载中。。。
<
/div>
;
return
<
div
style
=
{{
margin
:
'60px 24px 0'
}}
>
{
loadingText
}
<
/div>
;
}
}
if
(
params
.
code
)
{
if
(
params
.
code
)
{
console
.
log
(
'fetch UserInfo'
);
console
.
log
(
'fetch UserInfo'
);
...
@@ -92,18 +72,22 @@ class App extends Component {
...
@@ -92,18 +72,22 @@ class App extends Component {
.
catch
(
err
=>
{
.
catch
(
err
=>
{
console
.
log
(
err
);
console
.
log
(
err
);
Toast
.
fail
(
err
.
msg
||
'获取授权失败!'
);
Toast
.
fail
(
err
.
msg
||
'获取授权失败!'
);
this
.
updateUserInfo
({
login
:
true
});
this
.
setState
({
loadingText
:
'请求授权失败!请重新进入或刷新页面!'
,
});
});
});
}
else
{
}
else
{
console
.
log
(
'go in wxAuth'
);
console
.
log
(
'go in wxAuth'
);
this
.
goWechatAuth
();
this
.
goWechatAuth
();
}
}
return
<
div
style
=
{{
margin
:
'60px 24px 0'
}}
>
加载中。。。
<
/div>
;
return
<
div
style
=
{{
margin
:
'60px 24px 0'
}}
>
{
loadingText
}
<
/div>
;
};
};
goWechatAuth
=
()
=>
{
goWechatAuth
=
()
=>
{
let
rUrl
=
encodeURIComponent
(
window
.
location
.
origin
);
let
rUrl
=
encodeURIComponent
(
window
.
location
.
origin
);
window
.
location
.
href
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
APP_ID
}
&redirect_uri=
${
rUrl
}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
;
window
.
location
.
href
=
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=
${
APP_ID
}
&redirect_uri=
${
rUrl
}
&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
;
return
<
div
>
授权中。。。
<
/div>
;
return
<
div
style
=
{{
margin
:
'60px 24px 0'
}}
>
授权中。。。
<
/div>
;
};
};
validateUserinfo
=
(
props
,
code
,
Component
)
=>
{
validateUserinfo
=
(
props
,
code
,
Component
)
=>
{
const
{
const
{
...
@@ -115,8 +99,8 @@ class App extends Component {
...
@@ -115,8 +99,8 @@ class App extends Component {
if
(
!
login
)
{
if
(
!
login
)
{
console
.
log
(
'no login'
);
console
.
log
(
'no login'
);
// product 需要修改为去微信授权
// product 需要修改为去微信授权
return
<
Component
/>
;
//
return <Component />;
//
return this.goWechatAuth();
return
this
.
goWechatAuth
();
}
}
let
item
=
author
.
find
(
i
=>
i
.
code
===
code
);
let
item
=
author
.
find
(
i
=>
i
.
code
===
code
);
if
(
item
.
type
)
{
if
(
item
.
type
)
{
...
...
src/containers/Repair/ReprtRepair.js
View file @
34236e72
...
@@ -137,11 +137,11 @@ class ReprtRepair extends Component {
...
@@ -137,11 +137,11 @@ class ReprtRepair extends Component {
Toast
.
fail
(
'请选择报修人身份!'
);
Toast
.
fail
(
'请选择报修人身份!'
);
return
;
return
;
}
}
if
(
!
applyForm
.
area
Id
)
{
if
(
!
applyForm
.
area
)
{
Toast
.
fail
(
'请选择报修区域!'
);
Toast
.
fail
(
'请选择报修区域!'
);
return
;
return
;
}
}
if
(
!
applyForm
.
term
Id
)
{
if
(
!
applyForm
.
term
)
{
Toast
.
fail
(
'请选择报修项目!'
);
Toast
.
fail
(
'请选择报修项目!'
);
return
;
return
;
}
}
...
@@ -149,6 +149,17 @@ class ReprtRepair extends Component {
...
@@ -149,6 +149,17 @@ class ReprtRepair extends Component {
Toast
.
fail
(
'请输入报修地址!'
);
Toast
.
fail
(
'请输入报修地址!'
);
return
;
return
;
}
}
let
imgList
=
applyForm
.
uploadImg
.
filter
(
i
=>
i
!==
null
);
if
(
imgList
.
length
)
{
let
size
=
imgList
.
reduce
((
totle
,
item
)
=>
{
let
fileSize
=
item
.
filesList
[
0
].
size
;
return
totle
+
fileSize
;
},
0
);
if
(
size
>
10485760
)
{
Toast
.
fail
(
'上传图片过大!'
);
return
;
}
}
return
true
;
return
true
;
};
};
startApply
=
()
=>
{
startApply
=
()
=>
{
...
...
src/store/index.js
View file @
34236e72
class
Store
{
class
Store
{
constructor
()
{
constructor
()
{
this
.
userId
=
'
34
'
;
this
.
userId
=
''
;
}
}
getUserId
=
()
=>
{
getUserId
=
()
=>
{
return
this
.
userId
;
return
this
.
userId
;
...
...
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