Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-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
姜雷
wx-school-app
Commits
610e4442
Commit
610e4442
authored
Aug 23, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
9b30b361
ac3c884d
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
119 additions
and
14 deletions
+119
-14
useSystemInfo.ts
src/hooks/useSystemInfo.ts
+21
-0
Feedback.tsx
src/pages/Feedback/Feedback.tsx
+16
-8
useFeedbackList.ts
src/pages/Feedback/useFeedbackList.ts
+6
-2
OrderItem.tsx
src/pages/Order/components/OrderItem/OrderItem.tsx
+3
-1
RechargeItem.tsx
src/pages/Order/components/RechargeItem/RechargeItem.tsx
+2
-1
index.tsx
src/pages/index/index.tsx
+2
-0
reducers.ts
src/store/reducers.ts
+2
-0
systemInfo.ts
src/store/rootReducers/systemInfo.ts
+40
-0
userinfo.ts
src/store/rootReducers/userinfo.ts
+2
-2
version.ts
src/utils/version.ts
+25
-0
No files found.
src/hooks/useSystemInfo.ts
0 → 100644
View file @
610e4442
import
{
useSelector
,
useDispatch
}
from
'@tarojs/redux'
;
import
Taro
,
{
useEffect
}
from
'@tarojs/taro'
;
import
{
updateSystemInfo
}
from
'@/store/rootReducers/systemInfo'
;
const
useSystemInfo
=
()
=>
{
const
systemInfo
=
useSelector
(
(
state
:
{
systemInfo
:
Taro
.
getSystemInfo
.
Promised
})
=>
state
.
systemInfo
,
);
const
dispatch
=
useDispatch
();
useEffect
(()
=>
{
if
(
!
systemInfo
.
SDKVersion
)
{
Taro
.
getSystemInfo
().
then
(
res
=>
{
dispatch
(
updateSystemInfo
(
res
));
});
}
},
[]);
return
systemInfo
;
};
export
default
useSystemInfo
;
src/pages/Feedback/Feedback.tsx
View file @
610e4442
...
...
@@ -16,6 +16,8 @@ import { addFeedback } from '@/api/feedback';
import
useButtonPadding
from
'@/hooks/useButtonPadding'
;
import
FeedbackItem
from
'./components/FeedbackItem/FeedbackItem'
;
import
{
formatDate
}
from
'@/utils/time'
;
import
useSystemInfo
from
'@/hooks/useSystemInfo'
;
import
{
compareVersion
}
from
'@/utils/version'
;
function
Feedback
()
{
useShareAppMessage
(
shareHandle
);
...
...
@@ -68,15 +70,21 @@ function Feedback() {
}
};
const
[
scrollTop
,
setScrollTop
]
=
useState
(
0
);
const
systemInfo
=
useSystemInfo
();
useEffect
(()
=>
{
wx
.
onKeyboardHeightChange
(
res
=>
{
console
.
log
(
res
.
height
);
if
(
res
.
height
)
{
setShowKeyboard
(
true
);
}
else
{
setShowKeyboard
(
false
);
}
});
if
(
compareVersion
(
systemInfo
.
SDKVersion
,
'2.7.0'
))
{
wx
.
onKeyboardHeightChange
(
res
=>
{
console
.
log
(
res
.
height
);
if
(
res
.
height
)
{
setShowKeyboard
(
true
);
}
else
{
setShowKeyboard
(
false
);
}
});
}
else
{
console
.
log
(
'in focus'
);
}
},
[]);
useEffect
(()
=>
{
Taro
.
createSelectorQuery
()
...
...
src/pages/Feedback/useFeedbackList.ts
View file @
610e4442
...
...
@@ -41,16 +41,20 @@ const useFeedbackList = (customerId: number) => {
.
then
(
res
=>
{
console
.
log
(
res
);
if
(
res
.
data
.
length
)
{
let
list
=
res
.
data
.
map
(
item
=>
({
...
item
,
replayList
:
item
.
replayList
.
reverse
(),
}));
if
(
lastId
)
{
dispatch
({
type
:
'getMoreList'
,
payload
:
res
.
data
,
payload
:
list
,
});
setPaination
({
...
pagination
,
pageNum
:
pagination
.
pageNum
+
1
});
}
else
{
dispatch
({
type
:
'refreshList'
,
payload
:
res
.
data
,
payload
:
list
,
});
}
}
...
...
src/pages/Order/components/OrderItem/OrderItem.tsx
View file @
610e4442
...
...
@@ -64,6 +64,8 @@ class OrderItem extends Component {
const
{
data
:
{
orderState
,
createAt
,
serviceName
,
payableMoney
},
}
=
this
.
props
;
let
moneyStr
=
payableMoney
.
toFixed
(
2
);
return
(
<
View
className=
'OrderItem'
onClick=
{
this
.
detailHandle
}
>
<
View
className=
'OrderItem-text'
>
...
...
@@ -83,7 +85,7 @@ class OrderItem extends Component {
</
View
>
<
View
className=
{
`OrderItem-price ${orderState === '1' ? 'topay' : ''}`
}
>
¥
{
payableMoney
.
toFixed
(
2
)
}
¥
{
moneyStr
}
</
View
>
</
View
>
);
...
...
src/pages/Order/components/RechargeItem/RechargeItem.tsx
View file @
610e4442
...
...
@@ -8,6 +8,7 @@ const RechargeItem = (props: { data: RechargeOrder }) => {
const
{
data
:
{
createAt
,
rechargeRemark
,
actualAmount
,
orderNum
},
}
=
props
;
let
moneyStr
=
actualAmount
.
toFixed
(
2
);
return
(
<
View
className=
'RechargeItem'
>
...
...
@@ -26,7 +27,7 @@ const RechargeItem = (props: { data: RechargeOrder }) => {
</
View
>
<
View
className=
{
`RechargeItem-price ${actualAmount >= 0 ? 'topay' : ''}`
}
>
¥
{
actualAmount
.
toFixed
(
2
)
}
¥
{
moneyStr
}
</
View
>
</
View
>
);
...
...
src/pages/index/index.tsx
View file @
610e4442
...
...
@@ -8,6 +8,7 @@ import { connect } from '@tarojs/redux';
import
{
updateUserInfo
,
UserState
}
from
'../../store/rootReducers/userinfo'
;
import
{
appLogin
}
from
'../../api/customer'
;
import
{
shareHandle
}
from
'@/common/shareMethod'
;
import
useSystemInfo
from
'@/hooks/useSystemInfo'
;
type
PageDispatchProps
=
{
updateUserInfo
:
(
e
:
UserState
|
{
token
:
string
})
=>
void
;
...
...
@@ -97,6 +98,7 @@ class Index extends Component {
render
()
{
const
{
errorText
}
=
this
.
state
;
useSystemInfo
();
return
<
View
className=
'Index'
>
{
errorText
}
</
View
>;
}
}
...
...
src/store/reducers.ts
View file @
610e4442
...
...
@@ -5,6 +5,7 @@ import ShowerReducer from '@/pages/Shower/store';
import
serviceList
from
'./rootReducers/service'
;
import
orderState
from
'./rootReducers/orderState'
;
import
showerState
from
'./rootReducers/shower'
;
import
systemInfo
from
'./rootReducers/systemInfo'
;
export
default
combineReducers
({
userinfo
,
...
...
@@ -13,4 +14,5 @@ export default combineReducers({
serviceList
,
orderState
,
showerState
,
systemInfo
,
});
src/store/rootReducers/systemInfo.ts
0 → 100644
View file @
610e4442
import
Actions
from
'@/types/Store/Actions'
;
const
INITIAL_STATE
=
{
brand
:
''
,
model
:
''
,
pixelRatio
:
''
,
screenWidth
:
0
,
screenHeight
:
0
,
windowWidth
:
0
,
windowHeight
:
0
,
statusBarHeight
:
0
,
language
:
''
,
version
:
''
,
system
:
''
,
platform
:
''
,
fontSizeSetting
:
0
,
SDKVersion
:
''
,
};
export
const
updateSystemInfo
=
(
entity
:
Taro
.
getSystemInfo
.
Promised
,
):
Actions
=>
({
type
:
'UPDATE_SYSTEMINFO'
,
payload
:
entity
,
});
export
default
function
systemInfo
(
state
:
Taro
.
getSystemInfo
.
Promised
=
INITIAL_STATE
,
actions
:
Actions
,
):
Taro
.
getSystemInfo
.
Promised
{
switch
(
actions
.
type
)
{
case
'UPDATE_SYSTEMINFO'
:
return
{
...
state
,
...
actions
.
payload
,
};
default
:
return
state
;
}
}
src/store/rootReducers/userinfo.ts
View file @
610e4442
import
Action
from
'../../types/Store/Actions'
;
import
{
Customer
}
from
'../../types/Customer/Customer'
;
import
{
Customer
,
CustomerSex
}
from
'../../types/Customer/Customer'
;
export
type
UserState
=
StoreState
<
Customer
&
{
code
:
string
}
>
;
...
...
@@ -14,7 +14,7 @@ export const INITIAL_STATE = {
customerId
:
0
,
customerName
:
''
,
customerPhone
:
''
,
customerSex
:
''
,
customerSex
:
CustomerSex
.
boy
,
customerType
:
''
,
email
:
''
,
entranceDate
:
''
,
...
...
src/utils/version.ts
0 → 100644
View file @
610e4442
export
function
compareVersion
(
v1
:
string
,
v2
:
string
):
boolean
{
let
v1Arr
=
v1
.
split
(
'.'
);
let
v2Arr
=
v2
.
split
(
'.'
);
const
len
=
Math
.
max
(
v1
.
length
,
v2
.
length
);
while
(
v1
.
length
<
len
)
{
v1Arr
.
push
(
'0'
);
}
while
(
v2
.
length
<
len
)
{
v2Arr
.
push
(
'0'
);
}
for
(
let
i
=
0
;
i
<
len
;
i
++
)
{
const
num1
=
parseInt
(
v1
[
i
]);
const
num2
=
parseInt
(
v2
[
i
]);
if
(
num1
>
num2
)
{
return
true
;
}
else
if
(
num1
<
num2
)
{
return
false
;
}
}
return
true
;
}
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