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
6444ac45
Commit
6444ac45
authored
Sep 08, 2020
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor:
💡
统一字段
parent
43e53752
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
248 additions
and
266 deletions
+248
-266
add.js
client/pages/activity/add/add.js
+3
-3
add.axml
client/pages/activity/addBackup/add.axml
+11
-11
add.js
client/pages/activity/addBackup/add.js
+177
-185
validate.js
client/pages/activity/addBackup/validate.js
+41
-44
constants.js
server/duiba/utils/constants.js
+16
-23
No files found.
client/pages/activity/add/add.js
View file @
6444ac45
...
@@ -28,11 +28,11 @@ Component({
...
@@ -28,11 +28,11 @@ Component({
<%-
!
taskKeys
.
includes
(
configList
[
i
].
key
)
&&
configList
[
i
].
key
!==
'label'
?
`
${
configList
[
i
].
key
}
:
${
configList
[
i
].
defaultValue
||
"''"
}
,`
:
''
%><%
}
%>
<%-
!
taskKeys
.
includes
(
configList
[
i
].
key
)
&&
configList
[
i
].
key
!==
'label'
?
`
${
configList
[
i
].
key
}
:
${
configList
[
i
].
defaultValue
||
"''"
}
,`
:
''
%><%
}
%>
tasks
:
{
tasks
:
{
// 关注店铺
// 关注店铺
attentionStore
:
{
follow
:
{
value
:
''
,
value
:
''
,
},
},
// 成为会员
// 成为会员
beMembership
:
{
member
:
{
value
:
''
,
value
:
''
,
},
},
// 签到
// 签到
...
@@ -45,7 +45,7 @@ Component({
...
@@ -45,7 +45,7 @@ Component({
times
:
''
,
times
:
''
,
},
},
// 邀请好友
// 邀请好友
invite
Friend
s
:
{
invites
:
{
title
:
''
,
// 任务标题
title
:
''
,
// 任务标题
taskRateType
:
1
,
// 任务频率类型
taskRateType
:
1
,
// 任务频率类型
times
:
3
,
// 任务为每日限次次数值
times
:
3
,
// 任务为每日限次次数值
...
...
client/pages/activity/addBackup/add.axml
View file @
6444ac45
...
@@ -81,17 +81,17 @@
...
@@ -81,17 +81,17 @@
<form-item
<form-item
class="edit-content-form-item"
class="edit-content-form-item"
label="成为会员"
label="成为会员"
validateState="{{formState['taskMap.
beMembership
'].status}}"
validateState="{{formState['taskMap.
member
'].status}}"
help="{{formState['taskMap.
beMembership
'].message}}"
help="{{formState['taskMap.
member
'].message}}"
asterisk="{{false}}">
asterisk="{{false}}">
<view class="form-flex">
<view class="form-flex">
<checkbox class="form-check" checked="{{taskMap.
beMembership.checked}}" data-name="taskMap.beMembership
.checked" onChange="onCheckChange"></checkbox>
<checkbox class="form-check" checked="{{taskMap.
member.checked}}" data-name="taskMap.member
.checked" onChange="onCheckChange"></checkbox>
<tb-config-input
<tb-config-input
textBefore="获得"
textBefore="获得"
textAfter="体力值"
textAfter="体力值"
validateRange="{{[1, 99]}}"
validateRange="{{[1, 99]}}"
value="{{taskMap.
beMembership
.value}}"
value="{{taskMap.
member
.value}}"
dataName="taskMap.
beMembership
.value"
dataName="taskMap.
member
.value"
onChange="onTaskInputChange",
onChange="onTaskInputChange",
placeholder="1-99"
placeholder="1-99"
/>
/>
...
@@ -101,16 +101,16 @@
...
@@ -101,16 +101,16 @@
<form-item
<form-item
class="edit-content-form-item"
class="edit-content-form-item"
label="邀请好友"
label="邀请好友"
validateState="{{formState['taskMap.invite
Friend
s'].status}}"
validateState="{{formState['taskMap.invites'].status}}"
help="{{formState['taskMap.invite
Friend
s'].message}}"
help="{{formState['taskMap.invites'].message}}"
asterisk="{{false}}">
asterisk="{{false}}">
<view class="form-flex">
<view class="form-flex">
<checkbox class="form-check" checked="{{taskMap.invite
Friends.checked}}" data-name="taskMap.inviteFriend
s.checked" onChange="onCheckChange"></checkbox>
<checkbox class="form-check" checked="{{taskMap.invite
s.checked}}" data-name="taskMap.invite
s.checked" onChange="onCheckChange"></checkbox>
<task-config
<task-config
unit="体力值"
unit="体力值"
type="invite
Friend
s"
type="invites"
taskData="{{taskMap.invite
Friend
s}}"
taskData="{{taskMap.invites}}"
dataName="taskMap.invite
Friend
s"
dataName="taskMap.invites"
onUpdate="onTaskChange"
onUpdate="onTaskChange"
/>
/>
</view>
</view>
...
...
client/pages/activity/addBackup/add.js
View file @
6444ac45
This diff is collapsed.
Click to expand it.
client/pages/activity/addBackup/validate.js
View file @
6444ac45
import
{
TASK_RATE_TYPE
}
from
'../const'
import
{
TASK_RATE_TYPE
}
from
"../const"
;
import
flatten
from
'lodash/flatten'
import
flatten
from
"lodash/flatten"
;
import
{
rankTableValidator
}
from
"../../../utils/validate"
;
import
{
rankTableValidator
}
from
"../../../utils/validate"
;
// 使用 async-validator 校验
// 使用 async-validator 校验
...
@@ -9,22 +9,22 @@ export const descriptor = {
...
@@ -9,22 +9,22 @@ export const descriptor = {
required
:
true
,
required
:
true
,
validator
:
(
rule
,
value
)
=>
{
validator
:
(
rule
,
value
)
=>
{
value
=
value
.
trim
();
value
=
value
.
trim
();
return
!!
value
&&
value
.
length
<=
12
return
!!
value
&&
value
.
length
<=
12
;
},
},
message
:
"请输入正确的活动名称"
message
:
"请输入正确的活动名称"
,
},
},
subtitle
:
{
subtitle
:
{
required
:
true
,
required
:
true
,
validator
:
(
rule
,
value
)
=>
{
validator
:
(
rule
,
value
)
=>
{
value
=
value
.
trim
();
value
=
value
.
trim
();
return
!!
value
&&
value
.
length
<=
16
return
!!
value
&&
value
.
length
<=
16
;
},
},
message
:
"请输入正确的活动副标题"
message
:
"请输入正确的活动副标题"
,
},
},
prizeInfoList
:
{
prizeInfoList
:
{
required
:
true
,
required
:
true
,
validator
:
rankTableValidator
validator
:
rankTableValidator
,
},
},
//活动的开始时间和结束时间校验判断
//活动的开始时间和结束时间校验判断
timeRange
:
{
timeRange
:
{
...
@@ -45,7 +45,7 @@ export const descriptor = {
...
@@ -45,7 +45,7 @@ export const descriptor = {
},
},
logoImg
:
{
logoImg
:
{
required
:
true
,
required
:
true
,
message
:
'请配置图片'
message
:
"请配置图片"
,
},
},
commandTitle
:
{
commandTitle
:
{
required
:
true
,
required
:
true
,
...
@@ -53,7 +53,7 @@ export const descriptor = {
...
@@ -53,7 +53,7 @@ export const descriptor = {
value
=
value
.
trim
();
value
=
value
.
trim
();
return
!!
value
;
return
!!
value
;
},
},
message
:
'请输入淘口令名称'
message
:
"请输入淘口令名称"
,
},
},
beenInvitedText
:
{
beenInvitedText
:
{
required
:
true
,
required
:
true
,
...
@@ -61,11 +61,11 @@ export const descriptor = {
...
@@ -61,11 +61,11 @@ export const descriptor = {
value
=
value
.
trim
();
value
=
value
.
trim
();
return
!!
value
;
return
!!
value
;
},
},
message
:
'请输入被邀请者文案'
message
:
"请输入被邀请者文案"
,
},
},
commandImg
:
{
commandImg
:
{
required
:
true
,
required
:
true
,
message
:
'请输入淘口令图片'
message
:
"请输入淘口令图片"
,
},
},
rule
:
{
rule
:
{
required
:
true
,
required
:
true
,
...
@@ -73,62 +73,59 @@ export const descriptor = {
...
@@ -73,62 +73,59 @@ export const descriptor = {
value
=
value
.
trim
();
value
=
value
.
trim
();
return
!!
value
;
return
!!
value
;
},
},
message
:
'请输入活动规则'
message
:
"请输入活动规则"
,
},
},
taskMap
:
{
taskMap
:
{
type
:
'object'
,
type
:
"object"
,
required
:
true
,
required
:
true
,
fields
:
{
fields
:
{
beMembership
:
{
member
:
{
validator
:
(
rule
,
val
,
cb
,
source
)
=>
{
validator
:
(
rule
,
val
,
cb
,
source
)
=>
{
if
(
!
source
.
beMembership
.
checked
)
return
true
;
if
(
!
source
.
member
.
checked
)
return
true
;
return
!!
val
.
value
return
!!
val
.
value
;
},
},
message
:
'请输入成为会员任务的奖励'
message
:
"请输入成为会员任务的奖励"
,
},
},
invite
Friend
s
:
{
invites
:
{
validator
:
(
rule
,
val
,
cb
,
source
)
=>
{
validator
:
(
rule
,
val
,
cb
,
source
)
=>
{
if
(
!
source
.
inviteFriend
s
.
checked
)
return
true
;
if
(
!
source
.
invite
s
.
checked
)
return
true
;
return
!!
(
val
.
title
&&
val
.
value
)
return
!!
(
val
.
title
&&
val
.
value
)
;
},
},
message
:
'请输入邀请任务'
message
:
"请输入邀请任务"
,
},
},
jumpLink
:
{
jumpLink
:
{
validator
:
(
rule
,
val
,
cb
,
source
)
=>
{
validator
:
(
rule
,
val
,
cb
,
source
)
=>
{
if
(
!
source
.
jumpLink
.
checked
)
return
true
;
if
(
!
source
.
jumpLink
.
checked
)
return
true
;
return
!!
(
val
.
title
&&
val
.
value
&&
val
.
link
);
return
!!
(
val
.
title
&&
val
.
value
&&
val
.
link
);
},
},
message
:
'请输入浏览指定页面任务'
message
:
"请输入浏览指定页面任务"
,
},
},
browseGoods
:
{
browseGoods
:
{
validator
:
(
rule
,
val
)
=>
{
validator
:
(
rule
,
val
)
=>
{
return
!!
(
val
.
itemIds
)
;
return
!!
val
.
itemIds
;
},
},
message
:
'请输入寻宝屋商品任务'
message
:
"请输入寻宝屋商品任务"
,
}
}
,
}
}
,
}
}
,
};
};
export
const
formatValidator
=
(
descriptor
,
validators
)
=>
{
export
const
formatValidator
=
(
descriptor
,
validators
)
=>
{
validators
=
validators
||
{}
validators
=
validators
||
{}
;
Object
.
keys
(
descriptor
).
forEach
(
key
=>
{
Object
.
keys
(
descriptor
).
forEach
(
(
key
)
=>
{
if
(
descriptor
[
key
].
fields
)
{
if
(
descriptor
[
key
].
fields
)
{
Object
.
keys
(
descriptor
[
key
].
fields
).
forEach
(
fieldKey
=>
{
Object
.
keys
(
descriptor
[
key
].
fields
).
forEach
(
(
fieldKey
)
=>
{
validators
[
`
${
key
}
.
${
fieldKey
}
`
]
=
{
validators
[
`
${
key
}
.
${
fieldKey
}
`
]
=
{
status
:
'success'
,
status
:
"success"
,
message
:
''
message
:
""
,
}
}
;
})
})
;
}
else
{
}
else
{
validators
[
key
]
=
{
validators
[
key
]
=
{
status
:
'success'
,
status
:
"success"
,
message
:
''
message
:
""
,
}
}
;
}
}
});
});
return
validators
return
validators
;
}
};
\ No newline at end of file
server/duiba/utils/constants.js
View file @
6444ac45
...
@@ -29,9 +29,8 @@ const DRAW_STATUS = {
...
@@ -29,9 +29,8 @@ const DRAW_STATUS = {
//库存类型
//库存类型
const
STOCK_TYPE
=
{
const
STOCK_TYPE
=
{
LIMIT_STOCK
:
1
,
LIMIT_STOCK
:
1
,
NO_LIMIT_STOCK
:
2
NO_LIMIT_STOCK
:
2
,
}
};
// 日志类型: error,info
// 日志类型: error,info
const
LOGGER_TYPE
=
{
const
LOGGER_TYPE
=
{
...
@@ -42,8 +41,8 @@ const LOGGER_TYPE = {
...
@@ -42,8 +41,8 @@ const LOGGER_TYPE = {
const
SHIP_STATUS
=
{
const
SHIP_STATUS
=
{
NO_ADDRESS
:
1
,
NO_ADDRESS
:
1
,
NO_SHIP
:
2
,
NO_SHIP
:
2
,
HAS_SHIP
:
3
HAS_SHIP
:
3
,
}
}
;
const
PRIZE_TYPE
=
{
const
PRIZE_TYPE
=
{
EQUITY
:
1
,
EQUITY
:
1
,
...
@@ -55,8 +54,8 @@ const PRIZE_TYPE = {
...
@@ -55,8 +54,8 @@ const PRIZE_TYPE = {
const
PRIZE_DATA_TYPR
=
{
const
PRIZE_DATA_TYPR
=
{
RANK_PRIZE
:
1
,
RANK_PRIZE
:
1
,
PRO_PRIZE
:
2
,
PRO_PRIZE
:
2
,
BUILD_PRIZE
:
3
BUILD_PRIZE
:
3
,
}
}
;
// code类型
// code类型
const
CODE_TYPES
=
{
const
CODE_TYPES
=
{
PARAMS_ERROR
:
{
PARAMS_ERROR
:
{
...
@@ -95,11 +94,11 @@ const TEMPLATE_INFO = {
...
@@ -95,11 +94,11 @@ const TEMPLATE_INFO = {
};
};
const
TASK_TYPE_CHINA
=
{
const
TASK_TYPE_CHINA
=
{
beMembership
:
"成为会员"
,
member
:
"成为会员"
,
attentionStore
:
"关注店铺"
,
follow
:
"关注店铺"
,
sign
:
"签到"
,
sign
:
"签到"
,
exchangeCredits
:
"兑换积分"
,
exchangeCredits
:
"兑换积分"
,
invite
Friend
s
:
"邀请好友"
,
invites
:
"邀请好友"
,
orderGoods
:
"下单商品"
,
orderGoods
:
"下单商品"
,
browseGoods
:
"浏览商品"
,
browseGoods
:
"浏览商品"
,
jumpLink
:
"跳转链接"
,
jumpLink
:
"跳转链接"
,
...
@@ -108,11 +107,11 @@ const TASK_TYPE_CHINA = {
...
@@ -108,11 +107,11 @@ const TASK_TYPE_CHINA = {
const
TASK_CHECK_TYPE
=
{
const
TASK_CHECK_TYPE
=
{
value
:
{
value
:
{
list
:
[
list
:
[
"
beMembership
"
,
"
member
"
,
"
attentionStore
"
,
"
follow
"
,
"sign"
,
"sign"
,
"exchangeCredits"
,
"exchangeCredits"
,
"invite
Friend
s"
,
"invites"
,
"orderGoods"
,
"orderGoods"
,
"jumpLink"
,
"jumpLink"
,
"collectGoods"
,
"collectGoods"
,
...
@@ -123,7 +122,7 @@ const TASK_CHECK_TYPE = {
...
@@ -123,7 +122,7 @@ const TASK_CHECK_TYPE = {
times
:
{
times
:
{
list
:
[
list
:
[
"exchangeCredits"
,
"exchangeCredits"
,
"invite
Friend
s"
,
"invites"
,
"orderGoods"
,
"orderGoods"
,
"browseGoods"
,
"browseGoods"
,
"jumpLink"
,
"jumpLink"
,
...
@@ -131,19 +130,13 @@ const TASK_CHECK_TYPE = {
...
@@ -131,19 +130,13 @@ const TASK_CHECK_TYPE = {
],
],
},
},
title
:
{
title
:
{
list
:
[
list
:
[
"invites"
,
"orderGoods"
,
"browseGoods"
,
"jumpLink"
,
"collectGoods"
],
"inviteFriends"
,
"orderGoods"
,
"browseGoods"
,
"jumpLink"
,
"collectGoods"
,
],
},
},
itemIds
:
{
itemIds
:
{
list
:
[
"orderGoods"
,
"browseGoods"
,
"collectGoods"
],
list
:
[
"orderGoods"
,
"browseGoods"
,
"collectGoods"
],
},
},
taskRateType
:
{
taskRateType
:
{
list
:
[
"invite
Friend
s"
,
"orderGoods"
,
"browseGoods"
,
"collectGoods"
],
list
:
[
"invites"
,
"orderGoods"
,
"browseGoods"
,
"collectGoods"
],
},
},
link
:
{
list
:
[
"jumpLink"
]
},
link
:
{
list
:
[
"jumpLink"
]
},
};
};
...
@@ -171,5 +164,5 @@ module.exports = {
...
@@ -171,5 +164,5 @@ module.exports = {
PRIZE_TYPE
,
PRIZE_TYPE
,
SHIP_STATUS
,
SHIP_STATUS
,
STOCK_TYPE
,
STOCK_TYPE
,
PRIZE_DATA_TYPR
PRIZE_DATA_TYPR
,
};
};
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