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 = {
designWidth
:
750
,
sourceRoot
:
'src'
,
outputRoot
:
'dist'
,
copy
:
{
patterns
:
[
{
from
:
'ext.json'
,
to
:
'dist/ext.json'
}
// 指定需要 copy 的文件
]
},
// 通用插件配置
plugins
:
{
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"
,
"projectname"
:
"taro-
msparis
"
,
"projectname"
:
"taro-
ordering-production
"
,
"description"
:
""
,
"appid"
:
"wx
d2a161b3c8752b6
f"
,
"appid"
:
"wx
2a21c16c91b7e1b
f"
,
"setting"
:
{
"urlCheck"
:
true
,
"es6"
:
false
,
...
...
src/app.js
View file @
fde05524
...
...
@@ -7,15 +7,13 @@ import { Provider } from '@tarojs/redux'
import
'./styles/base.scss'
const
dvaApp
=
dva
.
createApp
({
initialState
:
{},
models
:
models
,
})
;
const
store
=
dvaApp
.
getStore
()
;
models
,
})
const
store
=
dvaApp
.
getStore
()
class
App
extends
Component
{
config
=
{
pages
:
[
'pages/home/index'
,
...
...
@@ -52,10 +50,6 @@ class App extends Component {
}
}
componentDidMount
()
{
}
render
()
{
return
(
<
Provider
store
=
{
store
}
>
<
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'
import
home
from
'../pages/home/model'
import
user
from
'../pages/user/model'
import
products
from
'../pages/productTabs/model'
import
global
from
'./global'
export
default
[
cart
,
home
,
user
,
products
,
global
,
]
src/pages/home/model.js
View file @
fde05524
...
...
@@ -4,14 +4,22 @@ export default {
namespace
:
'home'
,
state
:
{
settings
:
{},
currentStoreFrontId
:
null
,
},
effects
:
{
*
load
(
_
,
{
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
,
{
siteId
:
'11536422'
,
siteId
,
})
yield
put
({
type
:
'saveSettings'
,
...
...
@@ -19,6 +27,15 @@ export default {
settings
:
data
,
}
})
yield
put
({
type
:
'products/categories'
,
})
yield
put
({
type
:
'saveSettings'
,
payload
:
{
currentStoreFrontId
:
data
.
storefronts
&&
data
.
storefronts
[
0
].
id
}
})
},
},
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
({
url
:
`/r/v1/sites/
${
data
.
siteId
}
/restaurant/settings`
,
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 {
*
categories
(
_
,
{
call
,
put
,
select
,
})
{
const
{
siteId
}
=
yield
select
(
state
=>
state
.
global
)
const
{
data
}
=
yield
call
(
api
.
categories
,
{
siteId
:
'11536422'
,
siteId
,
})
yield
put
({
type
:
'save'
,
...
...
@@ -37,8 +39,9 @@ export default {
select
,
})
{
const
{
categoryId
}
=
yield
select
(
state
=>
state
.
products
)
const
{
currentStoreFrontId
}
=
yield
select
(
state
=>
state
.
home
)
const
{
data
}
=
yield
call
(
api
.
products
,
{
storefrontsId
:
'14171'
,
storefrontsId
:
currentStoreFrontId
,
categoryId
,
from
:
0
,
per
:
999
,
...
...
src/pages/productTabs/productTabs.js
View file @
fde05524
...
...
@@ -10,6 +10,7 @@ import Loading from '../../components/Loading/Loading'
...
loading
,
}))
export
default
class
ProductTabs
extends
Component
{
handleClick
(
value
)
{
const
{
categories
}
=
this
.
props
this
.
props
.
dispatch
({
...
...
@@ -25,12 +26,6 @@ export default class ProductTabs extends Component {
current
:
value
,
})
}
componentDidMount
()
{
const
{
dispatch
}
=
this
.
props
dispatch
({
type
:
'products/categories'
})
}
getTitle
()
{
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