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
e67b52b2
Commit
e67b52b2
authored
Apr 22, 2021
by
杨梦雅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加数据需求导出
parent
d914429c
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
3 deletions
+41
-3
api.js
client/api.js
+2
-0
list-table.axml
client/components/list/list-table/list-table.axml
+1
-0
list-table.js
client/components/list/list-table/list-table.js
+28
-0
config.js
client/config.js
+3
-0
request.js
client/utils/request.js
+7
-3
No files found.
client/api.js
View file @
e67b52b2
...
...
@@ -35,6 +35,8 @@ const API = {
// 搜索条件查询中奖信息
downloadFile
:
(
params
)
=>
request
(
"downloadFile"
,
"POST"
,
params
),
getAwardsList
:
(
params
)
=>
request
(
"getAwardsList"
,
"POST"
,
params
),
// 导出数据需求
getStats
:
()
=>
request
(
"getStats"
,
"POST"
,
params
,
{
cloudFnType
:
'c'
})
};
export
default
API
;
client/components/list/list-table/list-table.axml
View file @
e67b52b2
...
...
@@ -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('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('exportStatistics')}}" class="tb-list-edit" type="primary" text="true" data-x="{{x}}" onTap="onExportStatistics">导出数据需求</button>
</view>
</table-column>
</table>
...
...
client/components/list/list-table/list-table.js
View file @
e67b52b2
...
...
@@ -6,6 +6,7 @@ import {
findWinnerInfoList
,
uploadDataCreateFile
,
createCopyActivity
,
getStats
}
from
"/api"
;
import
{
appId
}
from
"/config"
;
import
{
setClipboard
}
from
"/utils"
;
...
...
@@ -202,5 +203,32 @@ Component({
const
{
value
}
=
evt
.
detail
;
this
.
getList
(
value
);
},
// 导出数据需求
async
onExportStatistics
(
evt
)
{
const
{
activityId
,
startTime
,
endTime
}
=
evt
.
target
.
dataset
.
x
.
record
;
my
.
showLoading
({
content
:
'生成文件中...'
});
try
{
let
{
success
,
data
,
message
}
=
(
await
getStats
({
activityId
,
startDay
:
startTime
,
endDay
:
endTime
}))
||
{};
console
.
log
(
success
,
data
,
message
,
'复制链接'
);
if
(
success
)
{
this
.
showExportDialog
({
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/config.js
View file @
e67b52b2
...
...
@@ -8,6 +8,9 @@ export default {
// 默认云函数名称
cloudFnName
:
'duibats'
,
// C端云函数名称(数据需求调用)
cCloudFnName
:
'CommonToC'
,
// 小程序appId
appId
:
"<%=appId%>"
,
...
...
client/utils/request.js
View file @
e67b52b2
...
...
@@ -6,7 +6,8 @@ import { requestType, cloudFnName } from '../config';
const
request
=
(
url
,
method
,
params
,
ext
=
{})
=>
{
const
{
isShowLoading
isShowLoading
,
cloudFnType
}
=
ext
;
const
hideMyLoading
=
()
=>
{
if
(
isShowLoading
)
{
...
...
@@ -17,9 +18,12 @@ const request = (url, method, params, ext = {}) => {
my
.
showLoading
();
}
// 云函数名
const
cloudFn
=
cloudFnType
===
'c'
?
cCloudFnName
:
cloudFnName
const
requestAms
=
()
=>
{
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
,
data
:
params
,
dataType
:
'json'
...
...
@@ -32,7 +36,7 @@ const request = (url, method, params, ext = {}) => {
}
const
requestCloud
=
()
=>
{
return
cloud
.
function
.
invoke
(
cloudFn
Name
,
params
,
url
).
then
(
res
=>
{
return
cloud
.
function
.
invoke
(
cloudFn
,
params
,
url
).
then
(
res
=>
{
hideMyLoading
();
return
res
;
}).
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