Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
qinhaitao
taobao-mini-template
Commits
162d8903
Commit
162d8903
authored
Mar 09, 2021
by
wangnf
Browse files
Options
Browse Files
Download
Plain Diff
wnf
parents
1961e60b
0372887c
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
94 additions
and
22 deletions
+94
-22
.editorconfig
c_client/.editorconfig
+12
-0
.eslintrc.js
c_client/.eslintrc.js
+17
-0
index.js
c_client/config/index.js
+1
-1
jsconfig.json
c_client/jsconfig.json
+14
-4
app.js
c_client/src/app.js
+1
-6
Popup.jsx
c_client/src/components/_base/Popup/Popup.jsx
+18
-4
Popup.module.less
c_client/src/components/_base/Popup/Popup.module.less
+6
-3
useAuth.js
c_client/src/hooks/useAuth.js
+2
-1
useLogin.js
c_client/src/hooks/useLogin.js
+10
-3
useRequest.js
c_client/src/hooks/useRequest.js
+13
-0
No files found.
c_client/.editorconfig
0 → 100644
View file @
162d8903
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
c_client/.eslintrc.js
0 → 100644
View file @
162d8903
/* eslint-disable*/
module
.
exports
=
{
extends
:
[
'taro/react'
,
'standard'
,
'standard-jsx'
],
rules
:
{
'react-hooks/exhaustive-deps'
:
0
,
'array-bracket-spacing'
:
[
'error'
,
'always'
],
'space-before-function-paren'
:
[
'error'
,
'never'
],
'no-unused-vars'
:
1
,
'import/first'
:
0
},
globals
:
{
my
:
true
,
getApp
:
true
,
Component
:
true
,
Page
:
true
}
}
c_client/config/index.js
View file @
162d8903
...
@@ -13,7 +13,7 @@ const config = {
...
@@ -13,7 +13,7 @@ const config = {
sourceRoot
:
'src'
,
sourceRoot
:
'src'
,
outputRoot
:
'dist'
,
outputRoot
:
'dist'
,
alias
:
{
alias
:
{
'@'
:
path
.
resolve
(
__dirname
,
'..'
,
'src'
)
'@'
:
path
.
resolve
(
__dirname
,
'..'
,
'src
/
'
)
},
},
plugins
:
[
plugins
:
[
[
[
...
...
c_client/jsconfig.json
View file @
162d8903
{
{
"compilerOptions"
:
{
"compilerOptions"
:
{
"baseUrl"
:
"."
,
"target"
:
"ES6"
,
"module"
:
"commonjs"
,
"jsx"
:
"react"
,
"allowSyntheticDefaultImports"
:
true
,
"baseUrl"
:
"./"
,
"paths"
:
{
"paths"
:
{
"@/*"
:
[
"@/*"
:
[
"
./
src/*"
"src/*"
]
,
]
}
}
}
},
"exclude"
:
[
"node_modules"
],
"include"
:
[
"src/**/*"
]
}
}
\ No newline at end of file
c_client/src/app.js
View file @
162d8903
...
@@ -15,11 +15,10 @@ class App extends Component {
...
@@ -15,11 +15,10 @@ class App extends Component {
componentDidMount
()
{}
componentDidMount
()
{}
onLaunch
(
options
)
{
onLaunch
(
options
)
{
console
.
log
(
options
,
'options'
)
console
.
log
(
'options :>> '
,
options
);
const
{
activityId
}
=
options
.
query
||
{}
const
{
activityId
}
=
options
.
query
||
{}
const
app
=
getApp
()
const
app
=
getApp
()
app
.
activityId
=
activityId
||
config
.
defaultActivityId
app
.
activityId
=
activityId
||
config
.
defaultActivityId
}
}
...
@@ -29,10 +28,6 @@ class App extends Component {
...
@@ -29,10 +28,6 @@ class App extends Component {
componentDidCatchError
()
{
}
componentDidCatchError
()
{
}
onGlobalClick
(
e
)
{
console
.
log
(
'onGlobalClick :>> '
,
e
)
}
// this.props.children 是将要会渲染的页面
// this.props.children 是将要会渲染的页面
render
()
{
render
()
{
return
this
.
props
.
children
return
this
.
props
.
children
...
...
c_client/src/components/_base/Popup/Popup.jsx
View file @
162d8903
import
{
noopFn
}
from
'@/utils/util'
import
{
noopFn
}
from
'@/utils/util'
import
{
View
}
from
'@tarojs/components'
import
{
View
,
Icon
}
from
'@tarojs/components'
import
classnames
from
'classnames'
import
classnames
from
'classnames'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
React
,
{
useEffect
,
useState
}
from
'react'
import
Overlay
from
'../Overlay/Overlay'
import
Overlay
from
'../Overlay/Overlay'
import
styles
from
'./Popup.module.less'
import
styles
from
'./Popup.module.less'
export
default
function
Popup
(
props
)
{
export
default
function
Popup
(
props
)
{
const
{
onClose
=
noopFn
,
position
=
'bottom'
,
height
=
'30%'
,
width
=
'100%'
,
closeOnClickOverlay
=
true
}
=
props
const
{
onClose
=
noopFn
,
position
=
'bottom'
,
height
=
'30%'
,
width
=
'100%'
,
backgroundColor
=
'#fff'
,
closeOnClickOverlay
=
true
,
closebale
=
false
,
closeButtonStyle
=
{
right
:
6
,
top
:
-
36
}
}
=
props
const
[
isShowAnimate
,
setShowAnimate
]
=
useState
(
false
)
const
[
isShowAnimate
,
setShowAnimate
]
=
useState
(
false
)
const
onCloseModal
=
()
=>
{
const
onCloseModal
=
()
=>
{
...
@@ -33,8 +46,9 @@ export default function Popup(props) {
...
@@ -33,8 +46,9 @@ export default function Popup(props) {
return
(
return
(
<
View
className=
{
wrapClass
}
>
<
View
className=
{
wrapClass
}
>
<
Overlay
onTap=
{
onClickOverlay
}
/>
<
Overlay
onTap=
{
onClickOverlay
}
/>
<
View
className=
{
contentClass
}
style=
{
{
width
,
height
}
}
>
<
View
className=
{
contentClass
}
style=
{
{
width
,
height
,
backgroundColor
}
}
>
{
closebale
&&
<
View
className=
{
styles
.
close_button
}
onClick=
{
onCloseModal
}
style=
{
closeButtonStyle
}
></
View
>
}
{
props
.
children
}
{
props
.
children
}
</
View
>
</
View
>
...
...
c_client/src/components/_base/Popup/Popup.module.less
View file @
162d8903
...
@@ -11,7 +11,10 @@
...
@@ -11,7 +11,10 @@
left: 0;
left: 0;
transition: transform 0.3s;
transition: transform 0.3s;
}
}
.show {
.close_button {
transform: translateY(0);
.wh(50px, 50px);
transition: transform 0.3s;
.image("//yun.duiba.com.cn/taobaomini/template/modal_close_btn.png", contain);
position: absolute;
// right: 20px;
// top: -70px;
}
}
c_client/src/hooks/useAuth.js
View file @
162d8903
import
{
useState
,
useEffect
}
from
'react'
import
{
useState
,
useEffect
}
from
'react'
import
{
getAuthUserInfo
}
from
'../utils/tb'
import
{
getAuthUserInfo
}
from
'../utils/tb'
export
function
useAuthInfo
()
{
// 授权
export
function
useAuth
()
{
const
[
authInfo
,
setAuthInfo
]
=
useState
({
const
[
authInfo
,
setAuthInfo
]
=
useState
({
nickName
:
''
,
nickName
:
''
,
avatar
:
''
avatar
:
''
...
...
c_client/src/hooks/useLogin.js
View file @
162d8903
...
@@ -4,12 +4,18 @@ import { useLoginInfoModel } from '../store/loginInfo'
...
@@ -4,12 +4,18 @@ import { useLoginInfoModel } from '../store/loginInfo'
import
API
from
'../api'
import
API
from
'../api'
import
{
checkShopFavoredStatus
}
from
'../utils/tb'
import
{
checkShopFavoredStatus
}
from
'../utils/tb'
import
config
from
'../config'
import
config
from
'../config'
import
{
useAuth
Info
}
from
'./useAuth'
import
{
useAuth
}
from
'./useAuth'
import
{
noopFn
}
from
'@/utils/util'
import
{
noopFn
}
from
'@/utils/util'
const
{
login
}
=
API
const
{
login
}
=
API
/**
* 授权登录
*
* @export
* @param {*} [callback=noopFn] 登录之后的回调
* @return {*} isLogin 是否登录
*/
export
function
useLogin
(
callback
=
noopFn
)
{
export
function
useLogin
(
callback
=
noopFn
)
{
const
{
authorized
,
authInfo
}
=
useAuthInfo
()
const
{
loginInfo
,
setLoginInfo
}
=
useLoginInfoModel
()
const
{
loginInfo
,
setLoginInfo
}
=
useLoginInfoModel
()
const
[
isLogin
,
setLoginStatus
]
=
useState
(
false
)
const
[
isLogin
,
setLoginStatus
]
=
useState
(
false
)
...
@@ -20,7 +26,6 @@ export function useLogin(callback = noopFn) {
...
@@ -20,7 +26,6 @@ export function useLogin(callback = noopFn) {
const
{
nickName
:
userNick
,
avatar
}
=
authInfo
const
{
nickName
:
userNick
,
avatar
}
=
authInfo
const
{
inviteId
}
=
params
const
{
inviteId
}
=
params
const
res
=
await
login
({
userNick
,
avatar
,
isFollow
,
inviteId
})
const
res
=
await
login
({
userNick
,
avatar
,
isFollow
,
inviteId
})
if
(
res
?.
success
)
{
if
(
res
?.
success
)
{
setLoginInfo
({
setLoginInfo
({
...
res
.
data
,
...
res
.
data
,
...
@@ -34,6 +39,8 @@ export function useLogin(callback = noopFn) {
...
@@ -34,6 +39,8 @@ export function useLogin(callback = noopFn) {
}
}
}
}
const
{
authorized
,
authInfo
}
=
useAuth
()
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
authorized
)
{
if
(
authorized
)
{
doLogin
()
doLogin
()
...
...
c_client/src/hooks/useRequest.js
View file @
162d8903
import
{
useState
,
useEffect
}
from
'react'
import
{
useState
,
useEffect
}
from
'react'
/**
* 请求
*
* @export
* @param {*} api 接口请求
* @param {*} [params={}] 请求参数
* @param {*} [config={}] {
method: 'GET',
showLoading: false,
toastError: true
}
* @return {*}
*/
export
function
useRequest
(
api
,
params
=
{},
config
=
{})
{
export
function
useRequest
(
api
,
params
=
{},
config
=
{})
{
const
[
data
,
setData
]
=
useState
(
null
)
const
[
data
,
setData
]
=
useState
(
null
)
const
[
code
,
setCode
]
=
useState
(
''
)
const
[
code
,
setCode
]
=
useState
(
''
)
...
...
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