generated from root/miduo_server
Merge remote-tracking branch 'origin/master'
commit
7aa390d7e1
|
|
@ -46,8 +46,12 @@ ENV = 'production'
|
|||
#繁体测试
|
||||
#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://139.9.214.198:8083'
|
||||
#VUE_APP_BASE_API = 'http://localhost:8083'
|
||||
#VUE_APP_BASE_API = 'http://35.236.136.235:8083'
|
||||
#开发服
|
||||
#VUE_APP_BASE_API = 'http://120.92.51.235:8083'
|
||||
VUE_APP_BASE_API = 'http://42.96.58.70:8083'
|
||||
# ----代理地址----
|
||||
VUE_APP_PROXY_API = 'http://127.0.0.1:80'
|
||||
|
||||
|
|
|
|||
|
|
@ -55,6 +55,14 @@ export function sendMailAll(data) {
|
|||
})
|
||||
}
|
||||
|
||||
// export function sendMailExcel(data) {
|
||||
// return request({
|
||||
// url: '/system/gm/sendmailexecl',
|
||||
// method: 'post',
|
||||
// data
|
||||
// })
|
||||
// }
|
||||
|
||||
export function getRechargeInfoList(data) {
|
||||
return request({
|
||||
url: '/system/gm/getrechargeinfolist',
|
||||
|
|
|
|||
|
|
@ -216,6 +216,13 @@ export const constantRoutes = [
|
|||
component: () => import('@/views/sysmanage/gm/sendmail'),
|
||||
meta: { title: '发送邮件', icon: 'link' }
|
||||
},
|
||||
|
||||
{
|
||||
path: 'system/gm/sendmailxlsx',
|
||||
name: 'sendmailxlsx',
|
||||
component: () => import('@/views/sysmanage/gm/sendmailxlsx'),
|
||||
meta: { title: '通过execl发送邮件', icon: 'link' }
|
||||
},
|
||||
{
|
||||
path: 'system/gm/sendmailall',
|
||||
name: 'sendmailall',
|
||||
|
|
|
|||
|
|
@ -12,13 +12,11 @@
|
|||
/>
|
||||
</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>
|
||||
<input type="file" ref="fileInput" style="margin-bottom: 20px">
|
||||
<!-- <button @click="openFileInput">选择文件</button>-->
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="" @click="() => handleButtonClick()">发送邮件</el-button>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
@ -103,10 +101,9 @@
|
|||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination/index'
|
||||
import { saveMailLog, sendMail, getSendMailAllList, updateMail, saveMailLogAll } from '@/api/systemapi/gm'
|
||||
import { saveMailLog, sendMail, getSendMailAllList, updateMail } from '@/api/systemapi/gm'
|
||||
import { getServer } from '@/api/systemapi/game'
|
||||
import { pageParams } from '@/settings'
|
||||
import XLSX from 'xlsx'
|
||||
var timeOutMap = new Map()
|
||||
|
||||
export default {
|
||||
|
|
@ -122,14 +119,13 @@ export default {
|
|||
serverMaps: null,
|
||||
searchForm: {
|
||||
dataId: '',
|
||||
cmdStr: 'sendmail',
|
||||
cmdStr: 'sendmailall',
|
||||
serverid: '',
|
||||
param: '',
|
||||
title: '',
|
||||
content: '',
|
||||
rows: '10',
|
||||
page: '1',
|
||||
jsonData: null
|
||||
page: '1'
|
||||
},
|
||||
// 分页
|
||||
pagination: pageParams
|
||||
|
|
@ -152,71 +148,6 @@ 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
|
||||
|
|
@ -304,10 +235,10 @@ export default {
|
|||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
width: 100%;
|
||||
}
|
||||
.div-table{
|
||||
width:100%;
|
||||
}
|
||||
.app-container {
|
||||
width: 100%;
|
||||
}
|
||||
.div-table{
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,313 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<div class="send-form" style="margin-bottom:15px;">
|
||||
<div style="margin-bottom: 10px;">
|
||||
<span>服务器:</span>
|
||||
<el-select v-model="searchForm.serverid" size="small" clearable filterable placeholder="请选择服务器" style="width:90%">
|
||||
<el-option
|
||||
v-for="item in serverMaps"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<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>
|
||||
<div class="div-table">
|
||||
<el-table
|
||||
:data="list"
|
||||
element-loading-text="Loading"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
:header-cell-style="{'text-align':'center'}"
|
||||
:cell-style="{'text-align':'center'}"
|
||||
:default-sort="{prop: 'updatetime', order: 'descending'}"
|
||||
>
|
||||
<el-table-column v-if="false" label="id" width="50">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column type="index" label="序号" width="50">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.$index + 1 }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="服务器名称" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.servername }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="参数" width="280">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.param }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标题" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.title }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="内容" width="300">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.content }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="cmd" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.cmd }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作人" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.updateuser }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作时间" width="189" prop="updatetime">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.updatetime }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.state == '0'" :style="{'color':'#778899'}">未发送</span>
|
||||
<span v-if="scope.row.state == '1'" :style="{'color':'#32CD32'}">已发送</span>
|
||||
<span v-if="scope.row.state == '2'" :style="{'color':'#FFA500'}">发送中</span>
|
||||
<span v-if="scope.row.state == '3'" :style="{'color':'#FF0000'}">发送失败</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button v-if="scope.row.state == 2" size="small" type="warning" @click="() => cancelSend(scope.row)">取消发送</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<pagination :pagination="pagination" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination/index'
|
||||
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 {
|
||||
components: {
|
||||
'pagination': Pagination
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editNotavailable: false,
|
||||
treeData: null,
|
||||
list: null,
|
||||
listLoading: true,
|
||||
serverMaps: null,
|
||||
searchForm: {
|
||||
dataId: '',
|
||||
cmdStr: 'sendmail',
|
||||
serverid: '',
|
||||
param: '',
|
||||
title: '',
|
||||
content: '',
|
||||
rows: '10',
|
||||
page: '1',
|
||||
jsonData: null
|
||||
},
|
||||
// 分页
|
||||
pagination: pageParams
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 分页
|
||||
'pagination.currentPage': function() {
|
||||
this.searchForm.page = this.pagination.currentPage
|
||||
this.fetchData()
|
||||
},
|
||||
'pagination.pageSize': function() {
|
||||
this.searchForm.rows = this.pagination.pageSize
|
||||
this.searchForm.page = 1
|
||||
this.fetchData()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getServerList()
|
||||
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
|
||||
getSendMailAllList({ ...this.searchForm }).then(response => {
|
||||
this.list = response.data.rows
|
||||
this.pagination.total = response.data.total
|
||||
this.pagination.currentPage = response.data.current
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 获取类型
|
||||
getServerList() {
|
||||
getServer().then(response => {
|
||||
this.serverMaps = response.data
|
||||
})
|
||||
},
|
||||
// 发送邮件
|
||||
sendMailBtn() {
|
||||
this.listLoading = true
|
||||
// 保存日志
|
||||
saveMailLog({ ...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
|
||||
})
|
||||
},
|
||||
// 取消发送
|
||||
cancelSend(data) {
|
||||
// 删除定时器任务
|
||||
clearTimeout(timeOutMap.get(data.id))
|
||||
data.state = 0
|
||||
// 修改日志状态
|
||||
updateMail({ data }).then(response => {
|
||||
if (response.code === 0) {
|
||||
this.fetchData()
|
||||
this.$message({
|
||||
message: response.msg,
|
||||
type: 'success'
|
||||
})
|
||||
} else {
|
||||
this.fetchData()
|
||||
this.$message({
|
||||
message: response.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
timeOutMap.delete(data.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.app-container {
|
||||
width: 100%;
|
||||
}
|
||||
.div-table{
|
||||
width:100%;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in New Issue