generated from root/miduo_server
选择单服发邮件
parent
80e7cf5c02
commit
c26d48cc65
|
|
@ -43,10 +43,11 @@ ENV = 'production'
|
|||
#BT主播服
|
||||
#VUE_APP_BASE_API = 'http://124.71.66.2:8083'
|
||||
#VUE_APP_BASE_API = 'http://146.56.239.195:8083'
|
||||
|
||||
VUE_APP_BASE_API = 'http://43.133.69.121:8083'
|
||||
|
||||
|
||||
#繁体测试
|
||||
#VUE_APP_BASE_API = 'http://104.199.226.30:8083'
|
||||
#BT 二发
|
||||
VUE_APP_BASE_API = 'http://139.9.214.198:8083'
|
||||
#VUE_APP_BASE_API = 'http://localhost:8083'
|
||||
# ----代理地址----
|
||||
VUE_APP_PROXY_API = 'http://127.0.0.1:80'
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,14 @@ export function saveMailLog(data) {
|
|||
})
|
||||
}
|
||||
|
||||
export function saveMailLogAll(data) {
|
||||
return request({
|
||||
url: '/system/gm/savemaillogall',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function sendMail(data) {
|
||||
return request({
|
||||
url: '/system/gm/sendmail',
|
||||
|
|
|
|||
|
|
@ -12,11 +12,13 @@
|
|||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
<div style="margin-bottom: 10px;"><span style="line-height:50px">参数:</span><el-input v-model="searchForm.param" size="small" clearable style="width:90%" type="textarea" rows="2" /></div>
|
||||
<div style="margin-bottom: 10px;"><span style="line-height:50px">标题:</span><el-input v-model="searchForm.title" size="small" clearable style="width:90%" type="textarea" rows="2" /></div>
|
||||
|
||||
<div>
|
||||
<span style="line-height:69px">内容:</span><el-input v-model="searchForm.content" size="small" clearable style="width:90%" type="textarea" rows="3" />
|
||||
<el-button type="primary" size="" @click="() => sendMailBtn()">发送邮件</el-button>
|
||||
<input type="file" ref="fileInput" style="margin-bottom: 20px">
|
||||
<!-- <button @click="openFileInput">选择文件</button>-->
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="" @click="() => handleButtonClick()">发送邮件</el-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -101,9 +103,10 @@
|
|||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination/index'
|
||||
import { saveMailLog, sendMail, getSendMailAllList, updateMail } from '@/api/systemapi/gm'
|
||||
import { saveMailLog, sendMail, getSendMailAllList, updateMail, saveMailLogAll } from '@/api/systemapi/gm'
|
||||
import { getServer } from '@/api/systemapi/game'
|
||||
import { pageParams } from '@/settings'
|
||||
import XLSX from 'xlsx'
|
||||
var timeOutMap = new Map()
|
||||
|
||||
export default {
|
||||
|
|
@ -119,13 +122,14 @@ export default {
|
|||
serverMaps: null,
|
||||
searchForm: {
|
||||
dataId: '',
|
||||
cmdStr: 'sendmailall',
|
||||
cmdStr: 'sendmail',
|
||||
serverid: '',
|
||||
param: '',
|
||||
title: '',
|
||||
content: '',
|
||||
rows: '10',
|
||||
page: '1'
|
||||
page: '1',
|
||||
jsonData: null
|
||||
},
|
||||
// 分页
|
||||
pagination: pageParams
|
||||
|
|
@ -148,6 +152,71 @@ export default {
|
|||
this.fetchData()
|
||||
},
|
||||
methods: {
|
||||
handleButtonClick() {
|
||||
const file = this.$refs.fileInput.files[0]
|
||||
if (file) {
|
||||
const reader = new FileReader()
|
||||
reader.onload = (e) => {
|
||||
const data = new Uint8Array(e.target.result)
|
||||
const workbook = XLSX.read(data, { type: 'array' })
|
||||
const worksheet = workbook.Sheets[workbook.SheetNames[0]]
|
||||
const jsonData = XLSX.utils.sheet_to_json(worksheet, { header: 1 })
|
||||
const jsonDataWithoutHeader = jsonData.slice(1)
|
||||
const headerRow = jsonData[0]
|
||||
const result = jsonDataWithoutHeader.map(row => {
|
||||
const obj = {}
|
||||
headerRow.forEach((header, index) => {
|
||||
obj[header] = row[index]
|
||||
})
|
||||
return obj
|
||||
})
|
||||
const jsonArray = Object.keys(result).map(key => result[key])
|
||||
const jsonString = JSON.stringify(jsonArray)
|
||||
console.log(jsonString)
|
||||
this.searchForm.jsonData = jsonString
|
||||
saveMailLogAll({ ...this.searchForm }).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.$message({
|
||||
message: response.msg,
|
||||
type: 'success'
|
||||
})
|
||||
this.fetchData()
|
||||
// 设置定时器
|
||||
timeOutMap.set(response.data, setTimeout(() => {
|
||||
this.searchForm.dataId = response.data
|
||||
// 定时发送邮件
|
||||
sendMail({ ...this.searchForm }).then(response1 => {
|
||||
if (response1.code === 0) {
|
||||
this.fetchData()
|
||||
this.$message({
|
||||
message: response1.msg,
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
this.fetchData()
|
||||
this.$message({
|
||||
message: response1.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
}).catch(() => {
|
||||
this.fetchData()
|
||||
})
|
||||
timeOutMap.delete(response.data)
|
||||
}, 10000))
|
||||
} else {
|
||||
this.fetchData()
|
||||
this.$message({
|
||||
message: response.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
}
|
||||
reader.readAsArrayBuffer(file)
|
||||
}
|
||||
},
|
||||
// 刷新数据
|
||||
fetchData() {
|
||||
this.listLoading = true
|
||||
|
|
|
|||
Loading…
Reference in New Issue