Commit 3c768ce3 by 前端

commit

1 parent 21cb0401
......@@ -30,8 +30,7 @@ const findAllCustomerByPage = params => {
url,
method: 'POST',
data: params,
sign: true,
returnAll: true
sign: true
})
}
// 查询短信营销
......
......@@ -33,7 +33,7 @@
</div>
<input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" />
</div>
<el-popover placement="bottom" width="452" trigger="hover">
<el-popover placement="bottom" width="455" trigger="hover">
<img src="@/images/table.png" class="preview" />
<span slot="reference" class="download-url">模板预览</span>
</el-popover>
......@@ -192,7 +192,6 @@ export default {
this.$refs.file.value = ''
},
handleSave() {
this.loading = true
this.isUplaod = false
this.isTime = false
this.isLink = false
......@@ -229,6 +228,7 @@ export default {
sendTime: this.addForm.date1 + ' ' + this.addForm.date2,
exportName: this.importName
}
this.loading = true
this.$apis.marketing.createMessageInfo(params).then(res => {
if (res.code == 0) {
this.loading = false
......
......@@ -59,7 +59,7 @@ export default {
],
getListApi: this.$apis.marketing.findAllCustomerByPage,
tableParams: {
listName: 'data.data',
listName: 'data',
tableOption: true,
tableColumns: [
{
......
......@@ -9,7 +9,7 @@
<div class="flex-top line-text" :key="index">
<div class="type-text">{{ item.text }}</div>
<tempalte v-if="item.key == 'exportName'">
<a class="type-value exportName" :href="detailData.exportUrl">{{ detailData[item.key] }}</a>
<a class="type-value exportName" @click="download(detailData)">{{ detailData[item.key] }}</a>
</tempalte>
<div v-else class="type-value">{{ detailData[item.key] ? detailData[item.key] : '--' }}</div>
</div>
......@@ -83,6 +83,48 @@ export default {
this.congifDetails()
},
methods: {
download(data) {
this.getBlob(data.exportUrl).then(blob => {
this.saveAs(blob, data.exportName)
})
},
getBlob(url) {
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onload = () => {
if (xhr.status === 200) {
resolve(xhr.response)
}
}
xhr.send()
})
},
saveAs(blob, filename) {
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob, filename)
} else {
const link = document.createElement('a')
const body = document.querySelector('body')
let binaryData = []
binaryData.push(blob)
link.href = window.URL.createObjectURL(new Blob(binaryData))
link.download = filename
// fix Firefox
link.style.display = 'none'
body.appendChild(link)
link.click()
body.removeChild(link)
window.URL.revokeObjectURL(link.href)
}
},
congifDetails() {
let params = {
id: this.id
......@@ -134,6 +176,7 @@ export default {
.exportName {
text-decoration: underline;
color: #5850ff;
cursor: pointer;
}
}
.form-image {
......
......@@ -50,7 +50,7 @@ export default {
type: 'select',
optionList: [
{ text: '全部', id: '' },
{ text: '待发送', id: 1 },
{ text: '待处理', id: 1 },
{ text: '已完成', id: 2 }
],
optionId: 'id',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!