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
fbd674d0
Commit
fbd674d0
authored
Jul 10, 2020
by
秦海涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
3dcd2320
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
95 additions
and
140 deletions
+95
-140
items-dialog.js
client/components/dialog/items-dialog/items-dialog.js
+6
-5
tb-image-upload.js
client/components/form/tb-image-upload/tb-image-upload.js
+3
-2
tb-rule.axml
client/components/form/tb-rule/tb-rule.axml
+1
-1
tb-rule.js
client/components/form/tb-rule/tb-rule.js
+3
-2
items-config.axml
client/components/task/items-config/items-config.axml
+1
-1
config.js
client/config.js
+1
-1
add.axml
client/pages/activity/add/add.axml
+17
-86
add.js
client/pages/activity/add/add.js
+44
-23
validate.js
client/pages/activity/add/validate.js
+19
-19
No files found.
client/components/dialog/items-dialog/items-dialog.js
View file @
fbd674d0
...
...
@@ -47,7 +47,7 @@ Component({
const
{
browseItemIds
}
=
this
.
props
;
this
.
setData
({
chooseId
:
chooseId
?
chooseId
?
[...
chooseId
]
:
browseItemIds
?
browseItemIds
.
split
(
","
).
map
((
i
)
=>
+
i
)
:
[],
...
...
@@ -111,6 +111,7 @@ Component({
},
changeCheckStatus
(
e
)
{
const
{
chooseId
}
=
this
.
data
;
if
(
chooseId
.
length
>=
20
)
{
my
.
showToast
({
type
:
"fail"
,
...
...
@@ -118,20 +119,20 @@ Component({
});
}
const
{
item
}
=
e
.
target
.
dataset
;
console
.
log
(
item
,
"item"
);
if
(
chooseId
.
includes
(
item
.
itemId
))
{
this
.
setData
({
chooseId
:
chooseId
,
chooseId
:
chooseId
.
filter
(
v
=>
v
!==
item
.
itemId
)
,
});
}
else
{
this
.
setData
({
chooseId
:
[
item
.
itemId
],
chooseId
:
[
...
chooseId
,
item
.
itemId
],
});
}
},
sureBabyDialog
()
{
const
{
chooseId
}
=
this
.
data
;
console
.
log
(
chooseId
,
"chooseId"
);
//
console.log(chooseId, "chooseId");
this
.
props
.
onUpdateBabyChoose
(
chooseId
.
join
());
this
.
closeBaby
();
},
...
...
client/components/form/tb-image-upload/tb-image-upload.js
View file @
fbd674d0
...
...
@@ -10,13 +10,14 @@ Component({
onSuccess
:
()
=>
{},
onError
:
()
=>
{},
url
:
''
,
dataName
:
''
},
didMount
()
{},
didUpdate
()
{},
didUnmount
()
{},
methods
:
{
async
uploadImage
()
{
const
{
onSuccess
,
onError
}
=
this
.
props
;
const
{
onSuccess
,
onError
,
dataName
}
=
this
.
props
;
try
{
const
res
=
await
chooseImage
();
...
...
@@ -38,7 +39,7 @@ Component({
});
onSuccess
&&
onSuccess
(
url
)
onSuccess
&&
onSuccess
(
url
,
dataName
)
}
catch
(
error
)
{
onError
({},
error
)
}
...
...
client/components/form/tb-rule/tb-rule.axml
View file @
fbd674d0
...
...
@@ -2,7 +2,7 @@
<view class="tb-rule-title">用于展示在活动页的规则说明</view>
<textarea
style="width:400px;margin: 10px 0 0 0"
value="{{
rul
e}}"
value="{{
valu
e}}"
onChange="onChange"
maxLength="2000"
hasLimitHint="{{true}}"
...
...
client/components/form/tb-rule/tb-rule.js
View file @
fbd674d0
Component
({
data
:
{},
props
:
{
onChange
:
()
=>
{}
onChange
:
()
=>
{},
value
:
''
,
},
didMount
()
{},
didUpdate
()
{},
methods
:
{
onChange
(
e
)
{
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
e
);
this
.
props
.
onChange
&&
this
.
props
.
onChange
(
e
.
detail
.
value
);
},
},
});
client/components/task/items-config/items-config.axml
View file @
fbd674d0
<view class="items-config">
<text style="font-size: 12px">{{itemIds ? `已选择${(itemIds + '').split(',')}个商品` : ''}} </text>
<text style="font-size: 12px">{{itemIds ? `已选择${(itemIds + '').split(',')
.length
}个商品` : ''}} </text>
<button type="primary" text size="small" onTap="onOpenDialog">{{itemIds ? '更换商品' : '选择商品'}}</button>
<items-dialog
onUpdateBabyChoose="onUpdateBabyChoose"
...
...
client/config.js
View file @
fbd674d0
export
default
{
// ams:ams接口,cloud: 云函数
requestType
:
"
ams
"
,
requestType
:
"
cloud
"
,
// app环境
env
:
"test"
,
// online 线上 test 测试
...
...
client/pages/activity/add/add.axml
View file @
fbd674d0
...
...
@@ -70,22 +70,6 @@
<tb-label title="任务配置"/>
<!-- <form-item
class="edit-content-form-item"
label="关注店铺"
validateState="{{formState['taskMap.attentionStore'].status}}"
help="{{formState['taskMap.attentionStore'].message}}"
asterisk="{{false}}">
<tb-config-input
textBefore="获得"
textAfter="体力值"
validateRange="{{[1, 99]}}"
value="{{taskMap.attentionStore.value}}"
dataName="taskMap.attentionStore.value"
onChange="onTaskInputChange",
placeholder="1-99"
/>
</form-item> -->
<form-item
class="edit-content-form-item"
...
...
@@ -104,51 +88,6 @@
/>
</form-item>
<form-item
class="edit-content-form-item"
label="签到"
validateState="{{formState['taskMap.sign'].status}}"
help="{{formState['taskMap.sign'].message}}"
asterisk="{{false}}">
<tb-config-input
textBefore="每日签到获得"
textAfter="体力值"
validateRange="{{[1, 99]}}"
value="{{taskMap.sign.value}}"
dataName="taskMap.sign.value"
onChange="onTaskInputChange",
placeholder="1-99"
/>
</form-item>
<form-item
class="edit-content-form-item"
label="兑换参与次数"
validateState="{{formState['taskMap.exchangeCredits'].status}}"
help="{{formState['taskMap.exchangeCredits'].message}}"
asterisk="{{false}}">
<tb-config-input
textBefore="可消耗"
textAfter="积分兑换参与次数"
validateRange="{{[1, 99]}}"
value="{{taskMap.exchangeCredits.value}}"
dataName="taskMap.exchangeCredits.value"
onChange="onTaskInputChange",
placeholder="1-99"
/>
<view style="margin: 10px 0 0 0">
<tb-config-input
textBefore="每天最多可兑换"
textAfter="次"
validateRange="{{[1, 10]}}"
value="{{taskMap.exchangeCredits.times}}"
dataName="taskMap.exchangeCredits.times"
onChange="onTaskInputChange",
placeholder="1-10"
/>
</view>
</form-item>
<form-item
class="edit-content-form-item"
label="邀请好友"
...
...
@@ -160,7 +99,7 @@
type="inviteFriends"
taskData="{{taskMap.inviteFriends}}"
dataName="taskMap.inviteFriends"
onUpdate="onTask
Dialog
Change"
onUpdate="onTaskChange"
/>
</form-item>
...
...
@@ -176,25 +115,7 @@
hasLink
taskData="{{taskMap.jumpLink}}"
dataName="taskMap.jumpLink"
onUpdate="onTaskDialogChange"
/>
</form-item>
<form-item
class="edit-content-form-item"
label="收藏商品"
validateState="{{formState['taskMap.collectGoods'].status}}"
help="{{formState['taskMap.collectGoods'].message}}"
asterisk="{{false}}">
<task-config
unit="体力值"
type="collectGoods"
hasLink
hasItems
taskData="{{taskMap.collectGoods}}"
dataName="taskMap.collectGoods"
onUpdate="onTaskDialogChange"
onUpdate="onTaskChange"
/>
</form-item>
...
...
@@ -204,16 +125,16 @@
validateState="{{formState['taskMap.browseGoods'].status}}"
help="{{formState['taskMap.browseGoods'].message}}"
asterisk="{{false}}">
<items-config itemIds="{{taskMap.browseGoods.itemIds}}" dataName="taskMap.browseGoods" onUpdate="onTaskChange"/>
<items-config itemIds="{{taskMap.browseGoods.itemIds}}" dataName="taskMap.browseGoods
.itemIds
" onUpdate="onTaskChange"/>
</form-item>
<form-item
validateState="{{formState.
i
mage.status}}"
help="{{formState.
i
mage.message}}"
validateState="{{formState.
logoI
mage.status}}"
help="{{formState.
logoI
mage.message}}"
class="edit-content-form-item"
label="logo图片"
asterisk="{{false}}">
<tb-image-upload url="{{
image}}" onSuccess="onImageChang
e"/>
<tb-image-upload url="{{
logoImage}}" dataName="logoImage" onSuccess="onChangeByDataNam
e"/>
</form-item>
...
...
@@ -256,7 +177,17 @@
class="edit-content-form-item"
label="淘口令图片"
asterisk="{{false}}">
<tb-image-upload url="{{commandImg}}" onSuccess="onImageChange"/>
<tb-image-upload url="{{commandImg}}" dataName="commandImg" onSuccess="onChangeByDataName"/>
</form-item>
<tb-label title="规则配置"/>
<form-item
validateState="{{formState.rule.status}}"
help="{{formState.rule.message}}"
class="edit-content-form-item"
label="活动规则"
asterisk="{{false}}">
<tb-rule value="{{rule}}" onChange="onRuleChange"/>
</form-item>
<view class="submit-btn">
...
...
client/pages/activity/add/add.js
View file @
fbd674d0
...
...
@@ -87,19 +87,19 @@ Component({
],
taskMap
:
{
attentionStore
:
{
value
:
''
,
},
//
attentionStore: {
//
value: '',
//
},
beMembership
:
{
value
:
''
},
sign
:
{
value
:
''
},
exchangeCredits
:
{
value
:
''
,
times
:
''
,
},
//
sign: {
//
value: ''
//
},
//
exchangeCredits: {
//
value: '',
//
times: '',
//
},
inviteFriends
:
{
title
:
''
,
// 任务标题
taskRateType
:
1
,
// 任务频率类型
...
...
@@ -107,19 +107,20 @@ Component({
value
:
''
,
// 任务奖励
},
browseGoods
:
{
title
:
""
,
title
:
"
寻宝屋商品
"
,
taskRateType
:
1
,
times
:
3
,
value
:
''
,
link
:
''
},
collectGoods
:
{
title
:
""
,
taskRateType
:
1
,
times
:
3
,
value
:
'90'
,
itemIds
:
""
,
link
:
''
,
itemIds
:
''
},
// collectGoods: {
// title: "",
// taskRateType: 1,
// times: 3,
// value: '90',
// itemIds: "",
// },
jumpLink
:
{
title
:
""
,
taskRateType
:
3
,
...
...
@@ -176,6 +177,11 @@ Component({
[
name
]:
value
})
},
onRuleChange
(
rule
)
{
this
.
setData
({
rule
})
},
setDataByKey
(
name
,
val
)
{
const
keys
=
name
.
split
(
'.'
);
if
(
keys
.
length
===
1
)
{
...
...
@@ -289,6 +295,9 @@ Component({
const
params
=
this
.
formatActivityParams
(
this
.
data
)
console
.
log
(
params
)
saveActivityInfo
(
params
)
.
then
(
res
=>
{
if
(
res
.
success
)
{
...
...
@@ -309,11 +318,14 @@ Component({
// 格式化参数
formatActivityParams
(
params
)
{
const
{
id
,
activityId
,
id
=
''
,
activityId
=
''
,
startTime
,
endTime
,
rule
,
title
,
subtitle
,
logoImg
,
prizeInfoList
,
taskList
,
taskMap
,
...
...
@@ -324,7 +336,11 @@ Component({
return
{
id
,
activityId
,
title
,
subtitle
,
logoImg
,
startTime
:
new
Date
(
startTime
).
getTime
(),
endTime
:
new
Date
(
endTime
).
getTime
(),
rule
,
...
...
@@ -348,10 +364,10 @@ Component({
return
list
;
},
// taskList转化taskMap
formatTaskListToMap
(
taskList
)
{
formatTaskListToMap
(
taskList
=
[]
)
{
let
taskMap
=
{};
taskList
.
forEach
(
task
=>
{
taskMap
[
task
[
type
]]
=
task
;
taskMap
[
task
[
'type'
]]
=
task
;
});
return
taskMap
},
...
...
@@ -360,6 +376,8 @@ Component({
let
totalPercent
=
prizeInfoList
.
reduce
((
total
,
next
)
=>
{
return
total
=
addFloat
(
total
,
+
next
.
probablity
)
},
0
)
// 排名类型不含谢谢参与
if
(
prizeInfoList
[
0
].
rank
)
return
prizeInfoList
;
let
prizeInfoListCopy
=
prizeInfoList
.
concat
().
map
((
v
,
index
)
=>
({
...
v
,
level
:
index
}));
if
(
totalPercent
<
100
)
{
...
...
@@ -382,6 +400,9 @@ Component({
let
{
name
}
=
dataset
this
.
setData
({
[
name
]:
value
})
},
onChangeByDataName
(
val
,
dataName
)
{
this
.
setDataByKey
(
dataName
,
val
)
},
// 选择奖品弹窗
handlerShowPrize
(
evt
)
{
const
{
...
...
client/pages/activity/add/validate.js
View file @
fbd674d0
...
...
@@ -22,28 +22,34 @@ export const descriptor = {
timeRange
:
{
required
:
true
},
i
mage
:
{
logoI
mage
:
{
required
:
true
,
message
:
"请上传正确的图片"
message
:
'请配置图片'
},
commandTitle
:
{
required
:
true
,
message
:
'请输入淘口令名称'
},
beenInvitedText
:
{
required
:
true
,
message
:
'请输入被邀请者文案'
},
commandImg
:
{
required
:
true
,
message
:
'请输入淘口令图片'
},
rule
:
{
required
:
true
,
message
:
'请输入活动规则'
},
taskMap
:
{
type
:
'object'
,
required
:
true
,
fields
:
{
attentionStore
:
{
validator
:
(
rule
,
val
)
=>
{
return
!!
val
.
value
},
message
:
'请输入关注店铺任务的奖励'
},
beMembership
:
{
validator
:
(
rule
,
val
)
=>
!!
val
.
value
,
message
:
'请输入成为会员任务的奖励'
},
sign
:
{
validator
:
(
rule
,
val
)
=>
!!
val
.
value
,
message
:
'请输入签到任务的奖励'
},
inviteFriends
:
{
validator
:
(
rule
,
val
)
=>
!!
(
val
.
title
&&
val
.
value
),
message
:
'请输入邀请任务'
...
...
@@ -56,15 +62,9 @@ export const descriptor = {
},
browseGoods
:
{
validator
:
(
rule
,
val
)
=>
{
return
!!
(
val
.
title
&&
val
.
value
&&
val
.
link
);
return
!!
(
val
.
itemIds
);
},
message
:
'请输入寻宝屋商品任务'
},
exchangeCredits
:
{
validator
:
(
rule
,
val
)
=>
{
return
!!
(
val
.
value
&&
val
.
times
);
},
message
:
'请输入兑换次数任务'
}
}
}
...
...
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