Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
taro-ordering
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
Bal Feng
taro-ordering
Commits
fde05524
Commit
fde05524
authored
Nov 06, 2018
by
Bal Feng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
add ext.json
parent
6237190d
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
135 additions
and
23 deletions
+135
-23
index.js
config/index.js
+5
-0
ext.json
ext.json
+57
-0
project.config.json
project.config.json
+2
-2
app.js
src/app.js
+3
-9
global.js
src/models/global.js
+17
-0
index.js
src/models/index.js
+2
-0
model.js
src/pages/home/model.js
+19
-2
service.js
src/pages/home/service.js
+24
-2
model.js
src/pages/productTabs/model.js
+5
-2
productTabs.js
src/pages/productTabs/productTabs.js
+1
-6
No files found.
config/index.js
View file @
fde05524
...
@@ -5,6 +5,11 @@ const config = {
...
@@ -5,6 +5,11 @@ const config = {
designWidth
:
750
,
designWidth
:
750
,
sourceRoot
:
'src'
,
sourceRoot
:
'src'
,
outputRoot
:
'dist'
,
outputRoot
:
'dist'
,
copy
:
{
patterns
:
[
{
from
:
'ext.json'
,
to
:
'dist/ext.json'
}
// 指定需要 copy 的文件
]
},
// 通用插件配置
// 通用插件配置
plugins
:
{
plugins
:
{
babel
:
{
babel
:
{
...
...
ext.json
0 → 100644
View file @
fde05524
{
"extEnable"
:
true
,
"extAppid"
:
"wx337a3a660c6da1c6"
,
"ext"
:
{
"attr"
:
{
"siteId"
:
"11536422"
,
"logoUrl"
:
"https://user-assets.sxlcdn.com/images/24978/FuN1XSaebo4UJHhfumbZHfySq3S9.png?imageMogr2/strip/thumbnail/1200x9000%3E/format/png"
,
"siteUrl"
:
"www.sxl.cn"
,
"description"
:
"自主选位,自主点菜,源味渔社针对大食堂的弊端,致力于为消费者提供本味,健康,绿色,快捷的餐饮食品。"
},
"style"
:
{
"mainBackground"
:
"#AB8F83"
}
},
"pages"
:
[
"pages/home/index"
,
"pages/cart/index"
,
"pages/user/index"
],
"window"
:
{
"backgroundTextStyle"
:
"dark"
,
"navigationBarBackgroundColor"
:
"#346b30"
,
"navigationBarTitleText"
:
"点餐小程序"
,
"navigationBarTextStyle"
:
"white"
},
"tabBar"
:
{
"list"
:
[
{
"pagePath"
:
"pages/home/index"
,
"text"
:
"首页"
,
"iconPath"
:
"./images/tab/icon-home.png"
,
"selectedIconPath"
:
"./images/tab/icon-home-selected.png"
},
{
"pagePath"
:
"pages/cart/index"
,
"text"
:
"订单"
,
"iconPath"
:
"./images/tab/icon-order.png"
,
"selectedIconPath"
:
"./images/tab/icon-order-selected.png"
},
{
"pagePath"
:
"pages/user/index"
,
"text"
:
"更多"
,
"iconPath"
:
"./images/tab/icon-mine.png"
,
"selectedIconPath"
:
"./images/tab/icon-mine-selected.png"
}
],
"color"
:
"#fff"
,
"selectedColor"
:
"#fff"
,
"backgroundColor"
:
"#346b30"
,
"borderStyle"
:
"#ccc"
},
"networkTimeout"
:
{
"request"
:
10000
,
"downloadFile"
:
10000
},
"debug"
:
true
}
project.config.json
View file @
fde05524
{
{
"miniprogramRoot"
:
"./dist"
,
"miniprogramRoot"
:
"./dist"
,
"projectname"
:
"taro-
msparis
"
,
"projectname"
:
"taro-
ordering-production
"
,
"description"
:
""
,
"description"
:
""
,
"appid"
:
"wx
d2a161b3c8752b6
f"
,
"appid"
:
"wx
2a21c16c91b7e1b
f"
,
"setting"
:
{
"setting"
:
{
"urlCheck"
:
true
,
"urlCheck"
:
true
,
"es6"
:
false
,
"es6"
:
false
,
...
...
src/app.js
View file @
fde05524
...
@@ -7,15 +7,13 @@ import { Provider } from '@tarojs/redux'
...
@@ -7,15 +7,13 @@ import { Provider } from '@tarojs/redux'
import
'./styles/base.scss'
import
'./styles/base.scss'
const
dvaApp
=
dva
.
createApp
({
const
dvaApp
=
dva
.
createApp
({
initialState
:
{},
initialState
:
{},
models
:
models
,
models
,
})
;
})
const
store
=
dvaApp
.
getStore
()
;
const
store
=
dvaApp
.
getStore
()
class
App
extends
Component
{
class
App
extends
Component
{
config
=
{
config
=
{
pages
:
[
pages
:
[
'pages/home/index'
,
'pages/home/index'
,
...
@@ -52,10 +50,6 @@ class App extends Component {
...
@@ -52,10 +50,6 @@ class App extends Component {
}
}
}
}
componentDidMount
()
{
}
render
()
{
render
()
{
return
(
<
Provider
store
=
{
store
}
>
return
(
<
Provider
store
=
{
store
}
>
<
Home
/>
<
Home
/>
...
...
src/models/global.js
0 → 100644
View file @
fde05524
import
Taro
from
'@tarojs/taro'
export
default
{
namespace
:
'global'
,
state
:
{},
effects
:
{},
reducers
:
{
save
(
state
,
{
payload
,
})
{
return
{
...
state
,
...
payload
,
}
}
},
}
src/models/index.js
View file @
fde05524
...
@@ -2,10 +2,12 @@ import cart from '../pages/cart/model'
...
@@ -2,10 +2,12 @@ import cart from '../pages/cart/model'
import
home
from
'../pages/home/model'
import
home
from
'../pages/home/model'
import
user
from
'../pages/user/model'
import
user
from
'../pages/user/model'
import
products
from
'../pages/productTabs/model'
import
products
from
'../pages/productTabs/model'
import
global
from
'./global'
export
default
[
export
default
[
cart
,
cart
,
home
,
home
,
user
,
user
,
products
,
products
,
global
,
]
]
src/pages/home/model.js
View file @
fde05524
...
@@ -4,14 +4,22 @@ export default {
...
@@ -4,14 +4,22 @@ export default {
namespace
:
'home'
,
namespace
:
'home'
,
state
:
{
state
:
{
settings
:
{},
settings
:
{},
currentStoreFrontId
:
null
,
},
},
effects
:
{
effects
:
{
*
load
(
_
,
{
*
load
(
_
,
{
call
,
call
,
put
put
,
select
,
})
{
})
{
const
{
attr
,
style
}
=
yield
call
(
homeApi
.
getExtConfig
)
yield
put
({
type
:
'global/save'
,
payload
:
attr
,
})
const
{
siteId
}
=
yield
select
(
state
=>
state
.
global
)
const
{
data
}
=
yield
call
(
homeApi
.
settings
,
{
const
{
data
}
=
yield
call
(
homeApi
.
settings
,
{
siteId
:
'11536422'
,
siteId
,
})
})
yield
put
({
yield
put
({
type
:
'saveSettings'
,
type
:
'saveSettings'
,
...
@@ -19,6 +27,15 @@ export default {
...
@@ -19,6 +27,15 @@ export default {
settings
:
data
,
settings
:
data
,
}
}
})
})
yield
put
({
type
:
'products/categories'
,
})
yield
put
({
type
:
'saveSettings'
,
payload
:
{
currentStoreFrontId
:
data
.
storefronts
&&
data
.
storefronts
[
0
].
id
}
})
},
},
},
},
reducers
:
{
reducers
:
{
...
...
src/pages/home/service.js
View file @
fde05524
import
Request
from
'../../utils/request'
;
import
Taro
from
'@tarojs/taro'
import
Request
from
'../../utils/request'
import
extJson
from
'../../../ext.json'
const
isWeApp
=
process
.
env
.
TARO_ENV
===
'weapp'
export
const
settings
=
data
=>
Request
({
export
const
settings
=
data
=>
Request
({
url
:
`/r/v1/sites/
${
data
.
siteId
}
/restaurant/settings`
,
url
:
`/r/v1/sites/
${
data
.
siteId
}
/restaurant/settings`
,
method
:
'GET'
,
method
:
'GET'
,
});
})
export
const
getExtConfig
=
()
=>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
isWeApp
)
{
Taro
.
getExtConfig
({
success
:
(
res
)
=>
{
resolve
(
res
.
extConfig
)
},
fail
:
(
error
)
=>
{
reject
(
error
)
},
})
}
else
{
resolve
(
extJson
.
ext
)
}
})
}
src/pages/productTabs/model.js
View file @
fde05524
...
@@ -11,9 +11,11 @@ export default {
...
@@ -11,9 +11,11 @@ export default {
*
categories
(
_
,
{
*
categories
(
_
,
{
call
,
call
,
put
,
put
,
select
,
})
{
})
{
const
{
siteId
}
=
yield
select
(
state
=>
state
.
global
)
const
{
data
}
=
yield
call
(
api
.
categories
,
{
const
{
data
}
=
yield
call
(
api
.
categories
,
{
siteId
:
'11536422'
,
siteId
,
})
})
yield
put
({
yield
put
({
type
:
'save'
,
type
:
'save'
,
...
@@ -37,8 +39,9 @@ export default {
...
@@ -37,8 +39,9 @@ export default {
select
,
select
,
})
{
})
{
const
{
categoryId
}
=
yield
select
(
state
=>
state
.
products
)
const
{
categoryId
}
=
yield
select
(
state
=>
state
.
products
)
const
{
currentStoreFrontId
}
=
yield
select
(
state
=>
state
.
home
)
const
{
data
}
=
yield
call
(
api
.
products
,
{
const
{
data
}
=
yield
call
(
api
.
products
,
{
storefrontsId
:
'14171'
,
storefrontsId
:
currentStoreFrontId
,
categoryId
,
categoryId
,
from
:
0
,
from
:
0
,
per
:
999
,
per
:
999
,
...
...
src/pages/productTabs/productTabs.js
View file @
fde05524
...
@@ -10,6 +10,7 @@ import Loading from '../../components/Loading/Loading'
...
@@ -10,6 +10,7 @@ import Loading from '../../components/Loading/Loading'
...
loading
,
...
loading
,
}))
}))
export
default
class
ProductTabs
extends
Component
{
export
default
class
ProductTabs
extends
Component
{
handleClick
(
value
)
{
handleClick
(
value
)
{
const
{
categories
}
=
this
.
props
const
{
categories
}
=
this
.
props
this
.
props
.
dispatch
({
this
.
props
.
dispatch
({
...
@@ -25,12 +26,6 @@ export default class ProductTabs extends Component {
...
@@ -25,12 +26,6 @@ export default class ProductTabs extends Component {
current
:
value
,
current
:
value
,
})
})
}
}
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
dispatch
({
type
:
'products/categories'
})
}
getTitle
()
{
getTitle
()
{
const
{
categories
}
=
this
.
props
const
{
categories
}
=
this
.
props
...
...
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