店铺设置>>通知中心>>下载图片

This commit is contained in:
魏啾
2024-09-27 11:18:06 +08:00
parent fe6e6c2553
commit bac738d80c
4 changed files with 141 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
<template>
<div class="app-container">
<div class="head-container">
<!-- <div class="head-container">
<el-row :gutter="20">
<el-col :span="3">
店铺推送 <el-switch v-model="alldata.allState" :active-value="1" :inactive-value="0"
@@ -19,7 +19,21 @@
@change="changeEvent(alldata.stockState, 0)"></el-switch>
</el-col>
</el-row>
</div>
</div> -->
<!-- 查看图片 -->
<el-button v-if="url" type="primary" @click="dialogVisible = true" style="margin-bottom: 28px;">查看图片</el-button>
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
<div style="width: 100%;text-align: center;">
<el-image style="width: 200px; height: 200px;" :src="url"></el-image>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="downloadUrl">下载</el-button>
</span>
</el-dialog>
<div class="head-container" id="table_drag">
<el-table ref="table" :data="tableData.data" v-loading="tableData.loading" row-key="id">
<el-table-column label="头像">
@@ -70,7 +84,7 @@
</template>
<script>
import { msgall, msginfo, shopState, state, delmsg } from '@/api/notifications'
import { msgall, msginfo, shopState, state, delmsg, subQrCode } from '@/api/notifications'
export default {
data() {
return {
@@ -87,14 +101,37 @@ export default {
conState: 0,
opeState: 0,
stockState: 0,
}
},
url: '',
dialogVisible: false
}
},
mounted() {
this.getTableData()
this.getlist()
this.getsubQrCode()
},
methods: {
downloadUrl() {
let link = document.createElement("a");
//创建一个a标签
link.style.display = "none";
//将a标签隐藏
link.href = this.url;
document.body.appendChild(link);
//将上面创建的a标签加入到body的尾部
link.click();
//执行a标签
this.dialogVisible = false
},
// 二维码
async getsubQrCode() {
let res = await subQrCode({
shopId: localStorage.getItem('shopId')
})
this.url = res
},
async getlist() {
let res = await state({
shopId: localStorage.getItem('shopId'),