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
880f9e36
Commit
880f9e36
authored
Apr 23, 2021
by
王波
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'b-template-addStatistic' into 'b-template-component-bugfixed-0.1'
B端模板添加数据需求导出 See merge request
!13
parents
d914429c
8b548be0
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
142 additions
and
7 deletions
+142
-7
api.js
client/api.js
+2
-0
statistic-dialog.acss
.../components/dialog/statistic-dialog/statistic-dialog.acss
+10
-0
statistic-dialog.axml
.../components/dialog/statistic-dialog/statistic-dialog.axml
+18
-0
statistic-dialog.js
...nt/components/dialog/statistic-dialog/statistic-dialog.js
+75
-0
statistic-dialog.json
.../components/dialog/statistic-dialog/statistic-dialog.json
+6
-0
list-table.axml
client/components/list/list-table/list-table.axml
+3
-1
list-table.js
client/components/list/list-table/list-table.js
+15
-1
list-table.json
client/components/list/list-table/list-table.json
+2
-1
config.js
client/config.js
+3
-0
request.js
client/utils/request.js
+8
-4
No files found.
client/api.js
View file @
880f9e36
...
@@ -35,6 +35,8 @@ const API = {
...
@@ -35,6 +35,8 @@ const API = {
// 搜索条件查询中奖信息
// 搜索条件查询中奖信息
downloadFile
:
(
params
)
=>
request
(
"downloadFile"
,
"POST"
,
params
),
downloadFile
:
(
params
)
=>
request
(
"downloadFile"
,
"POST"
,
params
),
getAwardsList
:
(
params
)
=>
request
(
"getAwardsList"
,
"POST"
,
params
),
getAwardsList
:
(
params
)
=>
request
(
"getAwardsList"
,
"POST"
,
params
),
// 导出数据需求
getStats
:
(
params
)
=>
request
(
"getStats"
,
"POST"
,
params
,
{
cloudFnType
:
'c'
})
};
};
export
default
API
;
export
default
API
;
client/components/dialog/statistic-dialog/statistic-dialog.acss
0 → 100755
View file @
880f9e36
.statistic-dialog-wrap {
max-height: 400px;
overflow: scroll
}
.statistic-dialog-wrap .operator-btns {
margin-bottom: 10px;
}
.statistic-dialog-wrap .long-item .next-select {
width: 150px;
}
client/components/dialog/statistic-dialog/statistic-dialog.axml
0 → 100644
View file @
880f9e36
<dialog-wrap
title="导出数据需求"
visible="{{visible}}"
onClose="onCloseDialog"
width="500"
>
<view class="statistic-dialog-wrap">
<!-- 数据需求时间范围 -->
<form class="edit-content-form" data-name="form" inline="true" labelTextAlign="center" size="large">
<form-item class="edit-content-formItem" label="统计时间" labelTextAlign="center" asterisk="{{false}}">
<range-picker style="width: 400px" onChange="handleTimeRangeChange" hasClear="true" value="{{timeRange}}" class="block" data-time="{{timeRange}}"/>
</form-item>
<view class="operator-btns" style="textAlign:center">
<button style="margin-left:20px;height:32px" type="primary" onTap="handleExport" size="medium">导出</button>
</view>
</form>
</view>
</dialog-wrap>
\ No newline at end of file
client/components/dialog/statistic-dialog/statistic-dialog.js
0 → 100644
View file @
880f9e36
import
{
getStats
}
from
'/api'
;
Component
({
mixins
:
[],
data
:
{
// 数据统计开始结束时间
timeRange
:
[]
},
props
:
{
onClose
:
()
=>
{
},
onShowExportDialog
:
()
=>
{
},
selectedItem
:
{}
},
didMount
()
{
},
methods
:
{
// 关闭弹窗
onCloseDialog
()
{
this
.
setData
({
startDay
:
''
,
endDay
:
''
});
this
.
props
.
onClose
&&
this
.
props
.
onClose
();
},
// 监听时间变化
handleTimeRangeChange
(
e
)
{
console
.
log
(
e
.
detail
.
value
)
const
[
startTime
,
endTime
]
=
e
.
detail
.
value
;
this
.
setData
({
timeRange
:
[
startTime
,
endTime
]
});
},
// 导出
async
handleExport
(
evt
)
{
console
.
log
(
this
.
props
);
// 未选择任何条件搜索
if
(
!
this
.
data
.
timeRange
.
length
&&
!
this
.
data
.
timeRange
[
0
]
&&
!
this
.
data
.
timeRange
[
1
])
{
my
.
showToast
({
type
:
'fail'
,
content
:
'请选择统计时间范围'
});
return
;
}
const
{
activityId
}
=
this
.
props
.
selectedItem
;
let
params
=
{
activityId
,
startDay
:
this
.
data
.
timeRange
[
0
],
endDay
:
this
.
data
.
timeRange
[
1
]
};
my
.
showLoading
({
content
:
'生成文件中...'
});
try
{
let
{
success
,
data
,
message
}
=
(
await
getStats
(
params
))
||
{};
console
.
log
(
success
,
data
,
message
,
'复制链接'
);
if
(
success
)
{
this
.
props
.
onShowExportDialog
({
exportLinkUrl
:
data
.
url
.
replace
(
/amp;/g
,
''
)
});
console
.
log
(
data
,
'下载链接'
);
}
else
{
my
.
showToast
({
type
:
'fail'
,
content
:
message
});
}
my
.
hideLoading
();
}
catch
(
error
)
{
my
.
hideLoading
();
console
.
log
(
error
,
'exportStatistics-error'
);
}
}
}
});
client/components/dialog/statistic-dialog/statistic-dialog.json
0 → 100644
View file @
880f9e36
{
"component"
:
true
,
"usingComponents"
:
{
"dialog-wrap"
:
"../../basic/dialiog-wrap/dialiog-wrap"
}
}
client/components/list/list-table/list-table.axml
View file @
880f9e36
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
<button a:if="{{buttons.includes('delete')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="handleTapDelete">删除</button>
<button a:if="{{buttons.includes('delete')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="handleTapDelete">删除</button>
<button a:if="{{buttons.includes('copyLink')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onCopyLink">复制活动链接</button>
<button a:if="{{buttons.includes('copyLink')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onCopyLink">复制活动链接</button>
<button a:if="{{buttons.includes('copyNewActivity')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onCreateNewActivity">复制新活动</button>
<button a:if="{{buttons.includes('copyNewActivity')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onCreateNewActivity">复制新活动</button>
<button a:if="{{buttons.includes('exportStatistics')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onExportStatistics">导出数据需求</button>
</view>
</view>
</table-column>
</table-column>
</table>
</table>
...
@@ -40,3 +41,4 @@
...
@@ -40,3 +41,4 @@
<rank-dialog a:if="{{winnerListDialogVisible}}" visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" onShowExportDialog="showExportDialog" selectedItem="{{selectedItem}}"/>
<rank-dialog a:if="{{winnerListDialogVisible}}" visible="{{winnerListDialogVisible}}" onClose="onCloseWinnerListDialog" onShowExportDialog="showExportDialog" selectedItem="{{selectedItem}}"/>
<statistic-dialog a:if="{{statisticDialogVisible}}" visible="{{statisticDialogVisible}}" onClose="onCloseStatisticDialog" onShowExportDialog="showExportDialog" selectedItem="{{selectedItem}}"/>
\ No newline at end of file
client/components/list/list-table/list-table.js
View file @
880f9e36
...
@@ -5,7 +5,7 @@ import {
...
@@ -5,7 +5,7 @@ import {
delActivity
,
delActivity
,
findWinnerInfoList
,
findWinnerInfoList
,
uploadDataCreateFile
,
uploadDataCreateFile
,
createCopyActivity
,
createCopyActivity
}
from
"/api"
;
}
from
"/api"
;
import
{
appId
}
from
"/config"
;
import
{
appId
}
from
"/config"
;
import
{
setClipboard
}
from
"/utils"
;
import
{
setClipboard
}
from
"/utils"
;
...
@@ -27,6 +27,7 @@ Component({
...
@@ -27,6 +27,7 @@ Component({
},
},
deleteId
:
""
,
deleteId
:
""
,
winnerListDialogVisible
:
false
,
winnerListDialogVisible
:
false
,
statisticDialogVisible
:
false
,
selectedItem
:
{}
selectedItem
:
{}
},
},
props
:
{
props
:
{
...
@@ -202,5 +203,18 @@ Component({
...
@@ -202,5 +203,18 @@ Component({
const
{
value
}
=
evt
.
detail
;
const
{
value
}
=
evt
.
detail
;
this
.
getList
(
value
);
this
.
getList
(
value
);
},
},
// 关闭数据需求弹窗
onCloseStatisticDialog
()
{
this
.
setData
({
statisticDialogVisible
:
false
});
},
// 导出数据需求
async
onExportStatistics
(
evt
)
{
this
.
setData
({
statisticDialogVisible
:
true
,
selectedItem
:
evt
.
target
.
dataset
.
x
.
record
});
},
},
},
});
});
client/components/list/list-table/list-table.json
View file @
880f9e36
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
"copy-link-dialog"
:
"/components/dialog/copy-link-dialog/copy-link-dialog"
,
"copy-link-dialog"
:
"/components/dialog/copy-link-dialog/copy-link-dialog"
,
"confirm-dialog"
:
"/components/dialog/confirm-dialog/confirm-dialog"
,
"confirm-dialog"
:
"/components/dialog/confirm-dialog/confirm-dialog"
,
"rank-dialog"
:
"/components/dialog/rank-dialog/rank-dialog"
,
"rank-dialog"
:
"/components/dialog/rank-dialog/rank-dialog"
,
"winner-list-dialog"
:
"/components/dialog/winner-list-dialog/winner-list-dialog"
"winner-list-dialog"
:
"/components/dialog/winner-list-dialog/winner-list-dialog"
,
"statistic-dialog"
:
"/components/dialog/statistic-dialog/statistic-dialog"
}
}
}
}
\ No newline at end of file
client/config.js
View file @
880f9e36
...
@@ -8,6 +8,9 @@ export default {
...
@@ -8,6 +8,9 @@ export default {
// 默认云函数名称
// 默认云函数名称
cloudFnName
:
'duibats'
,
cloudFnName
:
'duibats'
,
// C端云函数名称(数据需求调用)
cCloudFnName
:
'CommonToC'
,
// 小程序appId
// 小程序appId
appId
:
"<%=appId%>"
,
appId
:
"<%=appId%>"
,
...
...
client/utils/request.js
View file @
880f9e36
...
@@ -2,11 +2,12 @@ const {
...
@@ -2,11 +2,12 @@ const {
cloud
cloud
}
=
getApp
();
}
=
getApp
();
import
{
requestType
,
cloudFnName
}
from
'../config'
;
import
{
requestType
,
cloudFnName
,
cCloudFnName
}
from
'../config'
;
const
request
=
(
url
,
method
,
params
,
ext
=
{})
=>
{
const
request
=
(
url
,
method
,
params
,
ext
=
{})
=>
{
const
{
const
{
isShowLoading
isShowLoading
,
cloudFnType
}
=
ext
;
}
=
ext
;
const
hideMyLoading
=
()
=>
{
const
hideMyLoading
=
()
=>
{
if
(
isShowLoading
)
{
if
(
isShowLoading
)
{
...
@@ -17,9 +18,12 @@ const request = (url, method, params, ext = {}) => {
...
@@ -17,9 +18,12 @@ const request = (url, method, params, ext = {}) => {
my
.
showLoading
();
my
.
showLoading
();
}
}
// 云函数名
const
cloudFn
=
cloudFnType
===
'c'
?
cCloudFnName
:
cloudFnName
const
requestAms
=
()
=>
{
const
requestAms
=
()
=>
{
return
my
.
request
({
return
my
.
request
({
url
:
`https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=
${
cloudFn
Name
}
.
${
url
}
`
,
url
:
`https://ams.dui88.com/server/index.php?g=Web&c=Mock&o=simple&projectID=218&uri=
${
cloudFn
}
.
${
url
}
`
,
method
,
method
,
data
:
params
,
data
:
params
,
dataType
:
'json'
dataType
:
'json'
...
@@ -32,7 +36,7 @@ const request = (url, method, params, ext = {}) => {
...
@@ -32,7 +36,7 @@ const request = (url, method, params, ext = {}) => {
}
}
const
requestCloud
=
()
=>
{
const
requestCloud
=
()
=>
{
return
cloud
.
function
.
invoke
(
cloudFn
Name
,
params
,
url
).
then
(
res
=>
{
return
cloud
.
function
.
invoke
(
cloudFn
,
params
,
url
).
then
(
res
=>
{
hideMyLoading
();
hideMyLoading
();
return
res
;
return
res
;
}).
catch
(()
=>
{
}).
catch
(()
=>
{
...
...
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