Commit 3c768ce3 by 前端

commit

1 parent 21cb0401
...@@ -30,8 +30,7 @@ const findAllCustomerByPage = params => { ...@@ -30,8 +30,7 @@ const findAllCustomerByPage = params => {
url, url,
method: 'POST', method: 'POST',
data: params, data: params,
sign: true, sign: true
returnAll: true
}) })
} }
// 查询短信营销 // 查询短信营销
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</div> </div>
<input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" /> <input type="file" style="opacity: 0" ref="file" accept="*" @change="uploadFile" />
</div> </div>
<el-popover placement="bottom" width="452" trigger="hover"> <el-popover placement="bottom" width="455" trigger="hover">
<img src="@/images/table.png" class="preview" /> <img src="@/images/table.png" class="preview" />
<span slot="reference" class="download-url">模板预览</span> <span slot="reference" class="download-url">模板预览</span>
</el-popover> </el-popover>
...@@ -192,7 +192,6 @@ export default { ...@@ -192,7 +192,6 @@ export default {
this.$refs.file.value = '' this.$refs.file.value = ''
}, },
handleSave() { handleSave() {
this.loading = true
this.isUplaod = false this.isUplaod = false
this.isTime = false this.isTime = false
this.isLink = false this.isLink = false
...@@ -229,6 +228,7 @@ export default { ...@@ -229,6 +228,7 @@ export default {
sendTime: this.addForm.date1 + ' ' + this.addForm.date2, sendTime: this.addForm.date1 + ' ' + this.addForm.date2,
exportName: this.importName exportName: this.importName
} }
this.loading = true
this.$apis.marketing.createMessageInfo(params).then(res => { this.$apis.marketing.createMessageInfo(params).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.loading = false this.loading = false
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
], ],
getListApi: this.$apis.marketing.findAllCustomerByPage, getListApi: this.$apis.marketing.findAllCustomerByPage,
tableParams: { tableParams: {
listName: 'data.data', listName: 'data',
tableOption: true, tableOption: true,
tableColumns: [ tableColumns: [
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<div class="flex-top line-text" :key="index"> <div class="flex-top line-text" :key="index">
<div class="type-text">{{ item.text }}</div> <div class="type-text">{{ item.text }}</div>
<tempalte v-if="item.key == 'exportName'"> <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> </tempalte>
<div v-else class="type-value">{{ detailData[item.key] ? detailData[item.key] : '--' }}</div> <div v-else class="type-value">{{ detailData[item.key] ? detailData[item.key] : '--' }}</div>
</div> </div>
...@@ -83,6 +83,48 @@ export default { ...@@ -83,6 +83,48 @@ export default {
this.congifDetails() this.congifDetails()
}, },
methods: { 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() { congifDetails() {
let params = { let params = {
id: this.id id: this.id
...@@ -134,6 +176,7 @@ export default { ...@@ -134,6 +176,7 @@ export default {
.exportName { .exportName {
text-decoration: underline; text-decoration: underline;
color: #5850ff; color: #5850ff;
cursor: pointer;
} }
} }
.form-image { .form-image {
......
...@@ -50,7 +50,7 @@ export default { ...@@ -50,7 +50,7 @@ export default {
type: 'select', type: 'select',
optionList: [ optionList: [
{ text: '全部', id: '' }, { text: '全部', id: '' },
{ text: '待发送', id: 1 }, { text: '待处理', id: 1 },
{ text: '已完成', id: 2 } { text: '已完成', id: 2 }
], ],
optionId: 'id', optionId: 'id',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!