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
c898ab9f
Commit
c898ab9f
authored
Jan 14, 2021
by
bianlongting
💬
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'b-template-component-bugfixed' into 'b-template-component'
B端模板问题修复 See merge request
!8
parents
3a0cb26a
b4869c88
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
19 deletions
+27
-19
prize-dialog.axml
client/components/dialog/prize-dialog/prize-dialog.axml
+8
-6
prize-dialog.js
client/components/dialog/prize-dialog/prize-dialog.js
+4
-3
add.js
client/pages/activity/add/add.js
+13
-8
validate.ts
server/duibats/src/decorator/validate.ts
+2
-2
No files found.
client/components/dialog/prize-dialog/prize-dialog.axml
View file @
c898ab9f
...
...
@@ -22,12 +22,14 @@
</form-item>
<form-item style="width:100%" size="large" class="probability-prize-content-formItem" label="奖品类型" required>
<view class="probability-prize-content-formitem-choosePrize-wrap">
<select onChange="onPrizeTypeChange" defaultValue="{{isEdit ? prizeDialogData.record.type : prizeInitData.type}}">
<option a:if="{{typeChecked.includes(1)}}" value="{{1}}">优惠券</option>
<option a:if="{{typeChecked.includes(2)}}" value="{{2}}">积分</option>
<option a:if="{{typeChecked.includes(3)}}" value="{{3}}">实物</option>
<!-- <option a:if="{{typeChecked.includes(5)}}" value="{{5}}">降级奖品</option> -->
</select>
<radio-group value="{{isEdit ? prizeDialogData.record.type : prizeInitData.type}}" onChange="onPrizeTypeChange">
<radio a:if="{{typeChecked.includes(1)}}" value="{{1}}">优惠券</radio>
<radio a:if="{{typeChecked.includes(2)}}" value="{{2}}">积分</radio>
<radio a:if="{{typeChecked.includes(3)}}" value="{{3}}">实物</radio>
<!-- <radio a:if="{{typeChecked.includes(5)}}" value="{{5}}">降级奖品</radio> -->
</radio-group>
</view>
</form-item>
<form-item a:if="{{[EQUITY_TYPE].includes(prizeInitData.type)}}" validateState="{{choosePrizeTips.status}}" style="width:100%" size="large" help="{{choosePrizeTips.content}}" class="probability-prize-content-formItem probability-prize-content-formItem-choosePrize" label="选择奖品" required>
...
...
client/components/dialog/prize-dialog/prize-dialog.js
View file @
c898ab9f
...
...
@@ -253,7 +253,7 @@ Component({
});
},
resetPrizeInit
()
{
const
{
isEdit
,
prizeDialogData
}
=
this
.
props
;
const
{
isEdit
,
prizeDialogData
,
typeChecked
}
=
this
.
props
;
console
.
log
(
isEdit
,
prizeDialogData
);
if
(
isEdit
)
{
console
.
log
(
prizeDialogData
);
...
...
@@ -435,7 +435,7 @@ Component({
// this.showItemTips('goodsIdTips', 'success', '');
// }
// }
if
(
type
==
EQUITY_TYPE
||
type
==
OBJECT_TYPE
)
{
if
(
type
==
EQUITY_TYPE
||
type
==
OBJECT_TYPE
||
type
==
CREDITS_TYPE
)
{
// if (!desc) {
// this.showItemTips("prizeDescTips", "error", "请填写奖品描述");
// } else {
...
...
@@ -450,9 +450,10 @@ Component({
this
.
showItemTips
(
"imageTips"
,
"error"
,
"请配置奖品图片"
);
}
}
let
intPattern
=
new
RegExp
(
'^[0-9]+?$'
)
// 库存奖品的库存值判断
let
usePass
=
switchStock
==
1
?
+
stock
>=
(
useStock
||
0
)
:
true
;
let
stockPass
=
switchStock
==
1
?
validateRangeNumber
(
stock
,
[
0
,
99999
])
:
true
;
let
stockPass
=
switchStock
==
1
?
intPattern
.
test
(
stock
)
&&
validateRangeNumber
(
stock
,
[
0
,
99999
])
:
true
;
if
(
!
stockPass
||
!
usePass
)
{
this
.
showItemTips
(
"prizeNumberTips"
,
...
...
client/pages/activity/add/add.js
View file @
c898ab9f
...
...
@@ -84,8 +84,8 @@ Component({
const
{
formState
}
=
_this
.
data
;
_this
.
setFormTips
(
formState
,
errors
,
target
)
if
(
errors
)
{
let
newValidator
=
_this
.
setFormTips
(
formState
,
errors
,
target
);
if
(
errors
||
newValidator
)
{
resolve
(
false
);
}
else
{
resolve
(
true
);
...
...
@@ -101,12 +101,16 @@ Component({
Object
.
keys
(
formState
).
forEach
(
key
=>
{
let
error
=
errors
.
filter
(
v
=>
target
?
v
.
field
===
target
&&
v
.
field
===
key
:
v
.
field
===
key
).
length
&&
errors
.
filter
(
v
=>
v
.
field
===
key
)[
0
];
// 时间实时校验
// if (key === 'timeRange' && formState[key].status === 'error') {
// return
// }
if
(
key
===
'timeRange'
&&
formState
[
key
].
status
===
'error'
)
{
newValidator
[
key
]
=
{
status
:
formState
[
key
].
status
,
message
:
formState
[
key
].
message
};
}
else
{
newValidator
[
key
]
=
{
status
:
error
?
'error'
:
'success'
,
message
:
error
?
error
.
message
:
''
};
}
})
...
...
@@ -115,6 +119,7 @@ Component({
this
.
setData
({
formState
:
newValidator
})
return
Object
.
values
(
newValidator
).
some
(
i
=>
i
.
status
===
'error'
)
},
// 提交信息
async
onSubmit
()
{
...
...
server/duibats/src/decorator/validate.ts
View file @
c898ab9f
...
...
@@ -28,9 +28,9 @@ const validateParams = (validators: Rules, data: object) => {
console
.
log
(
'errors'
,
errors
)
console
.
log
(
'fields'
,
fields
)
if
(
errors
)
{
resolve
({})
}
else
{
resolve
({
errors
,
fields
})
}
else
{
resolve
({})
}
})
})
...
...
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