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
3a9af120
Commit
3a9af120
authored
May 27, 2021
by
管新明
Browse files
Options
Browse Files
Download
Plain Diff
fix: merge
parents
93802675
0d54cd25
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
30 deletions
+67
-30
data-board-dialog.axml
...omponents/dialog/data-board-dialog/data-board-dialog.axml
+0
-4
data-board-dialog.js
.../components/dialog/data-board-dialog/data-board-dialog.js
+4
-7
prize-dialog.js
client/components/dialog/prize-dialog/prize-dialog.js
+15
-3
add.js
client/pages/activity/add/add.js
+22
-15
helper.js
client/utils/helper.js
+22
-1
validate.js
client/utils/validate.js
+4
-0
No files found.
client/components/dialog/data-board-dialog/data-board-dialog.axml
View file @
3a9af120
...
@@ -9,9 +9,5 @@
...
@@ -9,9 +9,5 @@
<table dataSource="{{list}}" loading="{{isLoading}}" isZebra>
<table dataSource="{{list}}" loading="{{isLoading}}" isZebra>
<table-column a:for="{{titleList}}" title="{{item}}" dataIndex="{{item}}" width="{{index === 0 ? 120 : 'auto'}}"/>
<table-column a:for="{{titleList}}" title="{{item}}" dataIndex="{{item}}" width="{{index === 0 ? 120 : 'auto'}}"/>
</table>
</table>
<view class="rank-pagination">
<text class="rank-pagination-text">共 {{total}} 条</text>
<pagination showJump="{{false}}" defaultCurrent="{{1}}" current="{{searchInfo.pageNo}}" data-type="all" pageSize="{{searchInfo.pageSize}}" onChange="handleChangePage" pageShowCount="{{10}}" total="{{total}}" a:if="{{total > 0}}" shape="arrow-only" />
</view>
</view>
</view>
</dialog-wrap>
</dialog-wrap>
\ No newline at end of file
client/components/dialog/data-board-dialog/data-board-dialog.js
View file @
3a9af120
...
@@ -10,7 +10,6 @@ Component({
...
@@ -10,7 +10,6 @@ Component({
},
},
titleList
:
[],
titleList
:
[],
list
:
[],
list
:
[],
total
:
0
,
isLoading
:
false
,
isLoading
:
false
,
winactivityId
:
""
winactivityId
:
""
},
},
...
@@ -33,11 +32,10 @@ Component({
...
@@ -33,11 +32,10 @@ Component({
async
searchList
()
{
async
searchList
()
{
this
.
setData
({
this
.
setData
({
isLoading
:
true
,
isLoading
:
true
,
list
:
[],
list
:
[]
total
:
0
});
});
const
startDay
=
this
.
data
.
searchInfo
.
timeRange
[
0
].
replace
(
/-/g
,
'/'
)
const
startDay
=
this
.
data
.
searchInfo
.
timeRange
[
0
].
replace
(
/-/g
,
"/"
);
const
endDay
=
this
.
data
.
searchInfo
.
timeRange
[
1
].
replace
(
/-/g
,
'/'
)
const
endDay
=
this
.
data
.
searchInfo
.
timeRange
[
1
].
replace
(
/-/g
,
"/"
);
const
params
=
{
const
params
=
{
activityId
:
this
.
props
.
selectedItem
.
activityId
,
activityId
:
this
.
props
.
selectedItem
.
activityId
,
startDay
,
startDay
,
...
@@ -63,8 +61,7 @@ Component({
...
@@ -63,8 +61,7 @@ Component({
this
.
setData
({
this
.
setData
({
isLoading
:
false
,
isLoading
:
false
,
titleList
,
titleList
,
list
:
tableData
,
list
:
tableData
total
:
tableData
.
length
});
});
}
}
},
},
...
...
client/components/dialog/prize-dialog/prize-dialog.js
View file @
3a9af120
...
@@ -4,7 +4,7 @@ const plugin = requirePlugin("myPlugin");
...
@@ -4,7 +4,7 @@ const plugin = requirePlugin("myPlugin");
import
{
bizCode
}
from
"/config"
;
import
{
bizCode
}
from
"/config"
;
import
{
queryBenefitByEname
}
from
"/api"
;
import
{
queryBenefitByEname
}
from
"/api"
;
import
{
chooseImage
,
getImageInfo
,
validateRangeNumber
,
isDot
}
from
"/utils"
;
import
{
chooseImage
,
getImageInfo
,
validateRangeNumber
,
isDot
}
from
"/utils"
;
import
{
passUrlList
,
urlCheck
}
from
"../../../utils/helper"
;
import
{
passUrlList
,
urlCheck
,
throttleHandle
}
from
"../../../utils/helper"
;
const
EQUITY_TYPE
=
1
;
const
EQUITY_TYPE
=
1
;
const
CREDITS_TYPE
=
2
;
const
CREDITS_TYPE
=
2
;
const
OBJECT_TYPE
=
3
;
const
OBJECT_TYPE
=
3
;
...
@@ -41,6 +41,7 @@ Component({
...
@@ -41,6 +41,7 @@ Component({
OBJECT_TYPE
,
OBJECT_TYPE
,
LOWER_TYPE
,
LOWER_TYPE
,
showDialogMask
:
true
,
showDialogMask
:
true
,
canSavePrize
:
true
,
dialogTop
:
""
,
dialogTop
:
""
,
rankTips
:
{
rankTips
:
{
status
:
"success"
,
status
:
"success"
,
...
@@ -291,10 +292,12 @@ Component({
...
@@ -291,10 +292,12 @@ Component({
}
}
})
})
},
},
async
uploadImage
()
{
uploadImage
:
throttleHandle
(
async
function
()
{
if
(
!
this
.
data
.
showDialogMask
)
return
;
try
{
try
{
this
.
setData
({
this
.
setData
({
showDialogMask
:
false
,
showDialogMask
:
false
,
canSavePrize
:
false
});
});
const
res
=
await
chooseImage
();
const
res
=
await
chooseImage
();
this
.
setData
({
this
.
setData
({
...
@@ -334,14 +337,16 @@ Component({
...
@@ -334,14 +337,16 @@ Component({
image
:
url
,
image
:
url
,
},
},
showDialogMask
:
true
,
showDialogMask
:
true
,
canSavePrize
:
true
});
});
}
catch
(
error
)
{
}
catch
(
error
)
{
this
.
setData
({
this
.
setData
({
showDialogMask
:
true
,
showDialogMask
:
true
,
canSavePrize
:
true
});
});
console
.
error
(
error
);
console
.
error
(
error
);
}
}
},
},
1000
),
onChangePrizeValue
(
e
)
{
onChangePrizeValue
(
e
)
{
const
key
=
e
.
target
.
dataset
.
name
;
const
key
=
e
.
target
.
dataset
.
name
;
const
value
=
e
.
detail
.
value
;
const
value
=
e
.
detail
.
value
;
...
@@ -361,6 +366,13 @@ Component({
...
@@ -361,6 +366,13 @@ Component({
});
});
},
},
updatePrize
()
{
updatePrize
()
{
if
(
!
this
.
data
.
canSavePrize
)
{
my
.
showToast
({
type
:
"fail"
,
content
:
"请等待图片上传完毕"
,
});
return
}
const
{
const
{
name
,
name
,
ename
,
ename
,
...
...
client/pages/activity/add/add.js
View file @
3a9af120
...
@@ -11,13 +11,24 @@ import {
...
@@ -11,13 +11,24 @@ import {
saveActivityInfo
,
saveActivityInfo
,
}
from
'/api'
}
from
'/api'
import
{
import
{
addFloat
,
setPrizeProbalityRange
addFloat
,
setPrizeProbalityRange
,
throttleHandle
}
from
'/utils/helper'
}
from
'/utils/helper'
const
THANKS_TYPE
=
5
const
THANKS_TYPE
=
5
var
validator
=
new
schema
(
descriptor
)
var
validator
=
new
schema
(
descriptor
)
const
tasks
=
{
<%
for
(
var
i
=
0
;
i
<
configList
.
length
;
++
i
)
{
%>
<%-
taskKeys
.
includes
(
configList
[
i
].
key
)
&&
configList
[
i
].
key
!==
'label'
?
`
${
configList
[
i
].
key
}
:{
value:"",
taskRateType:"",
times:"",
title:"",
link:""
},`
:
''
%><%
}
%>
}
Component
({
Component
({
mixins
:
[
methods
],
mixins
:
[
methods
],
data
:
{
data
:
{
...
@@ -27,16 +38,7 @@ Component({
...
@@ -27,16 +38,7 @@ Component({
endTime
:
''
,
endTime
:
''
,
<%
for
(
var
i
=
0
;
i
<
configList
.
length
;
++
i
)
{
%>
<%
for
(
var
i
=
0
;
i
<
configList
.
length
;
++
i
)
{
%>
<%-
!
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
:
JSON
.
parse
(
JSON
.
stringify
(
tasks
)),
<%
for
(
var
i
=
0
;
i
<
configList
.
length
;
++
i
)
{
%>
<%-
taskKeys
.
includes
(
configList
[
i
].
key
)
&&
configList
[
i
].
key
!==
'label'
?
`
${
configList
[
i
].
key
}
:{
value:"",
taskRateType:"",
times:"",
title:"",
link:""
},`
:
''
%><%
}
%>
},
<%
for
(
var
i
=
0
;
i
<
boxDatas
.
length
;
++
i
)
{
%>
<%
for
(
var
i
=
0
;
i
<
boxDatas
.
length
;
++
i
)
{
%>
<%-
`
${
boxkeyDatas
[
i
].
name
}
:{
<%-
`
${
boxkeyDatas
[
i
].
name
}
:{
${
boxkeyDatas
[
i
].
value
}
${
boxkeyDatas
[
i
].
value
}
...
@@ -49,6 +51,9 @@ Component({
...
@@ -49,6 +51,9 @@ Component({
isPostParams
:
true
isPostParams
:
true
},
},
didMount
()
{
didMount
()
{
this
.
setData
({
tasks
:
JSON
.
parse
(
JSON
.
stringify
(
tasks
))
})
const
{
id
}
=
this
.
$page
.
$router
.
params
const
{
id
}
=
this
.
$page
.
$router
.
params
id
&&
this
.
getActivityInfo
(
id
)
id
&&
this
.
getActivityInfo
(
id
)
},
},
...
@@ -122,7 +127,7 @@ Component({
...
@@ -122,7 +127,7 @@ Component({
return
Object
.
values
(
newValidator
).
some
(
i
=>
i
.
status
===
'error'
)
return
Object
.
values
(
newValidator
).
some
(
i
=>
i
.
status
===
'error'
)
},
},
// 提交信息
// 提交信息
async
onSubmit
()
{
onSubmit
:
throttleHandle
(
async
function
()
{
my
.
showLoading
();
my
.
showLoading
();
console
.
log
(
this
.
data
,
'this.data'
)
console
.
log
(
this
.
data
,
'this.data'
)
...
@@ -149,12 +154,14 @@ Component({
...
@@ -149,12 +154,14 @@ Component({
my
.
hideLoading
();
my
.
hideLoading
();
if
(
success
)
{
if
(
success
)
{
this
.
backList
();
this
.
backList
();
my
.
hideLoading
();
}
else
{
}
else
{
this
.
showFailToast
(
message
);
this
.
showFailToast
(
message
);
}
}
}
}
else
{
my
.
hideLoading
();
my
.
hideLoading
();
},
}
},
1000
),
showFailToast
(
text
)
{
showFailToast
(
text
)
{
my
.
showToast
({
my
.
showToast
({
type
:
'fail'
,
type
:
'fail'
,
...
@@ -214,7 +221,7 @@ Component({
...
@@ -214,7 +221,7 @@ Component({
return
prizeInfoListCopy
return
prizeInfoListCopy
},
},
backList
()
{
backList
()
{
this
.
$page
.
$router
.
push
(
"/activity/list"
);
this
.
$page
.
$router
.
go
(
-
1
)
}
}
},
},
})
})
client/utils/helper.js
View file @
3a9af120
...
@@ -154,6 +154,26 @@ const setPrizeProbalityRange = (prizes) => {
...
@@ -154,6 +154,26 @@ const setPrizeProbalityRange = (prizes) => {
}
}
})
})
}
}
/**
* 防连点
* @param {fn} fn 函数
* @param {wait} wait 时间
*/
const
throttleHandle
=
(
fn
,
wait
=
1000
)
=>
{
let
lastTime
=
0
return
function
cb
(...
args
)
{
let
nowTime
=
Date
.
now
()
if
(
nowTime
-
lastTime
>
wait
)
{
fn
.
call
(
this
,...
args
)
lastTime
=
nowTime
}
}
}
module
.
exports
=
{
module
.
exports
=
{
passUrlList
,
passUrlList
,
signFigures
,
signFigures
,
...
@@ -161,5 +181,6 @@ module.exports = {
...
@@ -161,5 +181,6 @@ module.exports = {
accMul
,
accMul
,
addFloat
,
addFloat
,
urlCheck
,
urlCheck
,
setPrizeProbalityRange
setPrizeProbalityRange
,
throttleHandle
};
};
client/utils/validate.js
View file @
3a9af120
...
@@ -75,6 +75,10 @@ export const rankTableValidator = (rule, value, callback, source, options) => {
...
@@ -75,6 +75,10 @@ export const rankTableValidator = (rule, value, callback, source, options) => {
if
(
value
.
some
(
v
=>
!
v
.
name
))
return
new
Error
(
'名次配置错误, 请检查'
);
if
(
value
.
some
(
v
=>
!
v
.
name
))
return
new
Error
(
'名次配置错误, 请检查'
);
const
rankArr
=
(
value
.
map
(
v
=>
v
.
rank
.
split
(
'-'
)));
const
rankArr
=
(
value
.
map
(
v
=>
v
.
rank
.
split
(
'-'
)));
// 判断是从第1名开始,因为之前就做了排序,所以判断有 1 就可以了
const
rankArrStr
=
rankArr
.
toString
();
if
(
rankArrStr
.
indexOf
(
'1'
)
===
-
1
)
return
new
Error
(
'必须从第一名开始配置'
);
// 判断排名连续
// 判断排名连续
let
validInfo
=
{
let
validInfo
=
{
...
...
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