我们发布啦
This commit is contained in:
13
admin/src/views/sms/index.vue
Normal file
13
admin/src/views/sms/index.vue
Normal file
@@ -0,0 +1,13 @@
|
||||
<template>
|
||||
<div>
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
174
admin/src/views/sms/smsConfig/components/loginFrom.vue
Normal file
174
admin/src/views/sms/smsConfig/components/loginFrom.vue
Normal file
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<div class="login-container">
|
||||
<el-row type="flex">
|
||||
<el-col :span="24">
|
||||
<el-form ref="formInline" size="small" :model="formInline" :rules="ruleInline" class="login-form"
|
||||
autocomplete="on" label-position="left">
|
||||
<div class="title-container">
|
||||
<h3 class="title">短信账户登录</h3>
|
||||
</div>
|
||||
<el-form-item prop="account">
|
||||
<el-input
|
||||
ref="account"
|
||||
v-model="formInline.account"
|
||||
placeholder="用户名"
|
||||
prefix-icon="el-icon-user"
|
||||
name="username"
|
||||
type="text"
|
||||
tabindex="1"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="token">
|
||||
<el-input
|
||||
:key="passwordType"
|
||||
ref="token"
|
||||
v-model="formInline.token"
|
||||
:type="passwordType"
|
||||
placeholder="密码"
|
||||
name="token"
|
||||
tabindex="2"
|
||||
auto-complete="off"
|
||||
prefix-icon="el-icon-lock"
|
||||
/>
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'"/>
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-button size="mini" :loading="loading" type="primary" style="width:100%;margin-bottom:20px;"
|
||||
@click="handleSubmit('formInline')">登录
|
||||
</el-button>
|
||||
<el-button size="mini" type="text" style="width: 100%;" @click="changeReg">注册账户</el-button>
|
||||
</el-form>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { configApi } from '@/api/sms'
|
||||
export default {
|
||||
name: 'Login',
|
||||
data() {
|
||||
return {
|
||||
formInline: {
|
||||
account: '',
|
||||
token: ''
|
||||
},
|
||||
ruleInline: {
|
||||
account: [
|
||||
{ required: true, message: '请输入用户名', trigger: 'blur' }
|
||||
],
|
||||
token: [
|
||||
{ required: true, message: '请输入密码', trigger: 'blur' }
|
||||
]
|
||||
},
|
||||
passwordType: 'password',
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
var _this = this
|
||||
document.onkeydown = function(e) {
|
||||
const key = window.event.keyCode
|
||||
if (key === 13) {
|
||||
_this.handleSubmit('formInline')
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showPwd() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.token.focus()
|
||||
})
|
||||
},
|
||||
handleSubmit(name) {
|
||||
this.$refs[name].validate((valid) => {
|
||||
if (valid) {
|
||||
configApi(this.formInline).then(async res => {
|
||||
this.$message.success('登录成功!')
|
||||
this.$store.dispatch('user/isLogin')
|
||||
this.$emit('on-Login')
|
||||
}).catch(res => {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 休息密码
|
||||
changePassword() {
|
||||
this.$emit('on-change')
|
||||
},
|
||||
changeReg() {
|
||||
this.$emit('on-changes')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.title{
|
||||
text-align: center;
|
||||
}
|
||||
.captcha{
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
}
|
||||
$bg: #2d3a4b;
|
||||
$dark_gray: #889aa4;
|
||||
$light_gray: #eee;
|
||||
.imgs{
|
||||
img{
|
||||
height: 36px;
|
||||
}
|
||||
}
|
||||
.login-form {
|
||||
flex: 1;
|
||||
padding: 32px 0;
|
||||
text-align: center;
|
||||
width: 384px;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tips {
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
margin-bottom: 10px;
|
||||
|
||||
span {
|
||||
&:first-of-type {
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.svg-container {
|
||||
padding: 6px 5px 6px 15px;
|
||||
color: $dark_gray;
|
||||
vertical-align: middle;
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
}
|
||||
.show-pwd {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 7px;
|
||||
font-size: 16px;
|
||||
color: $dark_gray;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
/deep/.svg-icon {
|
||||
vertical-align: 0.3em;
|
||||
}
|
||||
}
|
||||
.thirdparty-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 6px;
|
||||
}
|
||||
</style>
|
||||
254
admin/src/views/sms/smsConfig/components/register.vue
Normal file
254
admin/src/views/sms/smsConfig/components/register.vue
Normal file
@@ -0,0 +1,254 @@
|
||||
<template>
|
||||
<div class="login-container">
|
||||
<el-form ref="formInline" size="small" :model="formInline" :rules="ruleInline" class="login-form" autocomplete="on" label-position="left">
|
||||
<div class="title-container">
|
||||
<h3 class="title">短信账户注册</h3>
|
||||
</div>
|
||||
<el-form-item prop="account">
|
||||
<el-input
|
||||
ref="account"
|
||||
v-model="formInline.account"
|
||||
placeholder="请输入短信平台账号"
|
||||
prefix-icon="el-icon-user"
|
||||
name="username"
|
||||
type="text"
|
||||
tabindex="1"
|
||||
auto-complete="off"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input
|
||||
:key="passwordType"
|
||||
ref="password"
|
||||
v-model="formInline.password"
|
||||
:type="passwordType"
|
||||
placeholder="请输入短信平台密码/token"
|
||||
name="password"
|
||||
tabindex="2"
|
||||
auto-complete="off"
|
||||
prefix-icon="el-icon-lock"
|
||||
/>
|
||||
<span class="show-pwd" @click="showPwd">
|
||||
<svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" />
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item prop="domain">
|
||||
<el-input
|
||||
ref="password"
|
||||
v-model="formInline.domain"
|
||||
placeholder="请输入网址域名"
|
||||
name="password"
|
||||
prefix-icon="el-icon-position"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="phone">
|
||||
<el-input
|
||||
ref="password"
|
||||
v-model="formInline.phone"
|
||||
placeholder="请输入您的手机号"
|
||||
prefix-icon="el-icon-phone-outline"
|
||||
name="password"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="sign">
|
||||
<el-input
|
||||
ref="password"
|
||||
v-model="formInline.sign"
|
||||
placeholder="请输入短信签名,例如:CRMEB"
|
||||
name="password"
|
||||
prefix-icon="el-icon-price-tag"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item prop="code" class="captcha">
|
||||
<div class="acea-row" style="flex-wrap: nowrap;">
|
||||
<el-input
|
||||
ref="username"
|
||||
v-model="formInline.code"
|
||||
placeholder="验证码"
|
||||
name="username"
|
||||
type="text"
|
||||
tabindex="1"
|
||||
autocomplete="off"
|
||||
prefix-icon="el-icon-message"
|
||||
style="width: 90%"
|
||||
/>
|
||||
<el-button size="mini" :disabled=!this.canClick @click="cutDown">{{cutNUm}}</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-button size="mini" :loading="loading" type="primary" style="width:100%;margin-bottom:20px;" @click="handleSubmit('formInline')">注册</el-button>
|
||||
<el-button size="mini" type="primary" style="width:100%;margin-bottom:20px;" @click="changelogo">立即登录</el-button>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { captchaApi, registerApi } from '@/api/sms'
|
||||
export default {
|
||||
name: 'Register',
|
||||
data() {
|
||||
const validatePhone = (rule, value, callback) => {
|
||||
if (!value) {
|
||||
return callback(new Error('请填写手机号'))
|
||||
} else if (!/^1[3456789]\d{9}$/.test(value)) {
|
||||
callback(new Error('手机号格式不正确!'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
}
|
||||
return {
|
||||
loading: false,
|
||||
passwordType: 'password',
|
||||
captchatImg: '',
|
||||
cutNUm: '获取验证码',
|
||||
canClick: true,
|
||||
formInline: {
|
||||
account: '',
|
||||
code: '',
|
||||
domain: '',
|
||||
phone: '',
|
||||
sign: '',
|
||||
password: ''
|
||||
},
|
||||
ruleInline: {
|
||||
account: [
|
||||
{ required: true, message: '请输入短信平台账号', trigger: 'blur' }
|
||||
],
|
||||
password: [
|
||||
{ required: true, message: '请输入短信平台密码/token', trigger: 'blur' }
|
||||
],
|
||||
domain: [
|
||||
{ required: true, message: '请输入网址域名', trigger: 'blur' }
|
||||
],
|
||||
phone: [
|
||||
{ required: true, validator: validatePhone, trigger: 'blur' }
|
||||
],
|
||||
sign: [
|
||||
{ required: true, message: '请输入短信签名', trigger: 'blur' }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: '请输入验证码', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
showPwd() {
|
||||
if (this.passwordType === 'password') {
|
||||
this.passwordType = ''
|
||||
} else {
|
||||
this.passwordType = 'password'
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
this.$refs.password.focus()
|
||||
})
|
||||
},
|
||||
// 短信验证码
|
||||
cutDown() {
|
||||
if (this.formInline.phone) {
|
||||
if (!this.canClick) return
|
||||
this.canClick = false
|
||||
this.cutNUm = 60
|
||||
captchaApi(this.formInline.phone).then(async res => {
|
||||
this.$message.success(res.data.message)
|
||||
})
|
||||
const time = setInterval(() => {
|
||||
this.cutNUm--
|
||||
if (this.cutNUm === 0) {
|
||||
this.cutNUm = '获取验证码'
|
||||
this.canClick = true
|
||||
clearInterval(time)
|
||||
}
|
||||
}, 1000)
|
||||
} else {
|
||||
this.$message.warning('请填写手机号!')
|
||||
}
|
||||
},
|
||||
// 注册
|
||||
handleSubmit(name) {
|
||||
this.$refs[name].validate((valid) => {
|
||||
if (valid) {
|
||||
registerApi(this.formInline).then(async res => {
|
||||
console.log(res)
|
||||
this.$message.success('注册成功')
|
||||
setTimeout(() => {
|
||||
this.changelogo()
|
||||
}, 1000)
|
||||
})
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 立即登录
|
||||
changelogo() {
|
||||
this.$emit('on-change')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.el-button+.el-button{
|
||||
margin-left: 0px !important;
|
||||
}
|
||||
.title{
|
||||
text-align: center;
|
||||
}
|
||||
.captcha{
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
/deep/.el-form-item__content{
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
$bg: #2d3a4b;
|
||||
$dark_gray: #889aa4;
|
||||
$light_gray: #eee;
|
||||
.imgs{
|
||||
img{
|
||||
height: 36px;
|
||||
}
|
||||
}
|
||||
.login-form {
|
||||
flex: 1;
|
||||
padding: 32px 0;
|
||||
text-align: center;
|
||||
width: 384px;
|
||||
margin: 0 auto;
|
||||
overflow: hidden;
|
||||
}
|
||||
.tips {
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
margin-bottom: 10px;
|
||||
|
||||
span {
|
||||
&:first-of-type {
|
||||
margin-right: 16px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.svg-container {
|
||||
padding: 6px 5px 6px 15px;
|
||||
color: $dark_gray;
|
||||
vertical-align: middle;
|
||||
width: 30px;
|
||||
display: inline-block;
|
||||
}
|
||||
.show-pwd {
|
||||
position: absolute;
|
||||
right: 10px;
|
||||
top: 7px;
|
||||
font-size: 16px;
|
||||
color: $dark_gray;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
/deep/.svg-icon {
|
||||
vertical-align: 0.3em;
|
||||
}
|
||||
}
|
||||
.thirdparty-button {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 6px;
|
||||
}
|
||||
</style>
|
||||
129
admin/src/views/sms/smsConfig/components/tableList.vue
Normal file
129
admin/src/views/sms/smsConfig/components/tableList.vue
Normal file
@@ -0,0 +1,129 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<div class="filter-container mb20">
|
||||
<div class="demo-input-suffix">
|
||||
<span class="seachTiele">短信状态:</span>
|
||||
<el-radio-group v-model="tableFrom.resultCode" size="small" @change="getList">
|
||||
<el-radio-button label="">全部</el-radio-button>
|
||||
<el-radio-button label="100">成功</el-radio-button>
|
||||
<el-radio-button label="130">失败</el-radio-button>
|
||||
<el-radio-button label="131">空号</el-radio-button>
|
||||
<el-radio-button label="132">停机</el-radio-button>
|
||||
<el-radio-button label="133">关机</el-radio-button>
|
||||
<el-radio-button label="134">无状态</el-radio-button>
|
||||
<el-radio-button label="400">黑名单</el-radio-button>
|
||||
</el-radio-group>
|
||||
</div>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="tableData.data"
|
||||
style="width: 100%"
|
||||
size="mini"
|
||||
highlight-current-row
|
||||
>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
label="ID"
|
||||
min-width="50"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="phone"
|
||||
label="手机号"
|
||||
min-width="120"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="content"
|
||||
label="模板内容"
|
||||
min-width="450"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="template"
|
||||
label="模板ID"
|
||||
min-width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="memo"
|
||||
label="备注"
|
||||
min-width="200"
|
||||
/>
|
||||
<el-table-column
|
||||
label="发送时间"
|
||||
min-width="150"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.creatTime}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="resultcode"
|
||||
label="状态码"
|
||||
min-width="100"
|
||||
/>
|
||||
</el-table>
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
:page-sizes="[20, 40, 60, 80]"
|
||||
:page-size="tableFrom.limit"
|
||||
:current-page="tableFrom.page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { smsLstApi } from '@/api/sms'
|
||||
import Template from "../../../appSetting/wxAccount/wxTemplate/index";
|
||||
export default {
|
||||
name: 'TableList',
|
||||
components: {Template},
|
||||
data() {
|
||||
return {
|
||||
listLoading: false,
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0
|
||||
},
|
||||
tableFrom: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
resultCode: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
// 列表
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
smsLstApi(this.tableFrom).then(res => {
|
||||
this.tableData.data = res.list
|
||||
this.tableData.total = res.total
|
||||
this.listLoading = false
|
||||
}).catch(res => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
pageChange(page) {
|
||||
this.tableFrom.page = page
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.tableFrom.limit = val
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
190
admin/src/views/sms/smsConfig/index.vue
Normal file
190
admin/src/views/sms/smsConfig/index.vue
Normal file
@@ -0,0 +1,190 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card v-if="isShowList" v-loading="fullscreenLoading" class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<div class="content acea-row row-middle">
|
||||
<div class="demo-basic--circle acea-row row-middle">
|
||||
<el-avatar :size="50" :src="circleUrl" class="mr20" />
|
||||
<div class="dashboard-workplace-header-tip">
|
||||
<div class="dashboard-workplace-header-tip-title">{{ smsAccount }},祝您每一天开心!</div>
|
||||
<div class="dashboard-workplace-header-tip-desc">
|
||||
<span class="mr10">修改密码</span>
|
||||
<span @click="signOut">退出登录</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="dashboard-workplace-header-extra">
|
||||
<el-row type="flex" justify="center" align="middle" :gutter="12">
|
||||
<el-col :span="8">
|
||||
<span class="pfont acea-row row-middle">
|
||||
<el-avatar icon="el-icon-user-solid" size="small" class="mr10" />
|
||||
<span>剩余条数</span>
|
||||
</span>
|
||||
<span class="rR" v-text="numbers" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span class="pfont acea-row row-middle">
|
||||
<el-avatar icon="el-icon-user-solid" size="small" class="mr10" />
|
||||
<span>已发送</span>
|
||||
</span>
|
||||
<span class="rR" v-text="sendTotal" />
|
||||
</el-col>
|
||||
<el-col :span="8">
|
||||
<span class="pfont acea-row row-middle">
|
||||
<el-avatar icon="el-icon-user-solid" size="small" class="mr10" />
|
||||
<span>总条数</span>
|
||||
</span>
|
||||
<span class="rR" v-text="amount" />
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
<table-list v-if="isShowList" />
|
||||
<login-from v-if="isShowLogn" @on-changes="onChangeReg" @on-Login="onLogin" />
|
||||
<register-from v-if="isShowReg" @on-change="logoup" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import tableList from './components/tableList'
|
||||
import loginFrom from './components/loginFrom'
|
||||
import registerFrom from './components/register'
|
||||
import { logoutApi, smsNumberApi, smsInfoApi } from '@/api/sms'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'SmsConfig',
|
||||
components: { tableList, loginFrom, registerFrom },
|
||||
data() {
|
||||
return {
|
||||
fullscreenLoading: false,
|
||||
smsAccount: '',
|
||||
circleUrl: 'https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png',
|
||||
spinShow: false,
|
||||
isShowLogn: false,
|
||||
isShow: false,
|
||||
isShowReg: false,
|
||||
isShowList: false,
|
||||
amount: 0,
|
||||
numbers: 0,
|
||||
sendTotal: 0
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'isLogin'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.onIsLogin()
|
||||
// if (!this.isLogin) {
|
||||
// this.onIsLogin()
|
||||
// } else {
|
||||
// this.isShowList = true
|
||||
// }
|
||||
},
|
||||
methods: {
|
||||
// 剩余条数
|
||||
getNumber() {
|
||||
smsInfoApi().then(async res => {
|
||||
const data = res
|
||||
this.numbers = data.number
|
||||
this.sendTotal = data.send_total
|
||||
this.amount = data.number + data.send_total
|
||||
this.smsAccount = data.account
|
||||
})
|
||||
},
|
||||
// 登录跳转
|
||||
onLogin() {
|
||||
const url = this.$route.query.url
|
||||
if (url) {
|
||||
this.$router.replace(url)
|
||||
} else {
|
||||
this.isShowLogn = false
|
||||
this.isShow = false
|
||||
this.isShowReg = false
|
||||
this.isShowList = true
|
||||
}
|
||||
},
|
||||
// 查看是否登录
|
||||
onIsLogin() {
|
||||
this.fullscreenLoading = true
|
||||
this.$store.dispatch('user/isLogin').then(async res => {
|
||||
const data = res
|
||||
this.isShowLogn = !data.status
|
||||
this.isShowList = data.status
|
||||
if (data.status) {
|
||||
this.smsAccount = data.info
|
||||
}
|
||||
this.getNumber()
|
||||
this.fullscreenLoading = false
|
||||
}).catch(res => {
|
||||
this.fullscreenLoading = false
|
||||
this.isShowLogn = true
|
||||
})
|
||||
},
|
||||
// 退出登录
|
||||
signOut() {
|
||||
logoutApi().then(async res => {
|
||||
this.isShowLogn = true
|
||||
this.isShowList = false
|
||||
this.$store.dispatch('user/isLogin')
|
||||
}).catch(res => {
|
||||
this.$message.error(res.message)
|
||||
})
|
||||
},
|
||||
// 立即注册
|
||||
onChangeReg() {
|
||||
this.isShowLogn = false
|
||||
this.isShow = false
|
||||
this.isShowReg = true
|
||||
},
|
||||
// 立即登录
|
||||
logoup() {
|
||||
this.isShowLogn = true
|
||||
this.isShow = false
|
||||
this.isShowReg = false
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
$cursor: #1890ff;
|
||||
.content{
|
||||
justify-content: space-between;
|
||||
}
|
||||
.rR{
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
display: block;
|
||||
}
|
||||
.dashboard-workplace-header-tip {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.dashboard-workplace-header-tip-title {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.dashboard-workplace-header-tip-desc{
|
||||
/*line-height: 0 !important;*/
|
||||
display: block;
|
||||
span{
|
||||
font-size: 12px;
|
||||
color: $cursor;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
.dashboard-workplace-header-extra{
|
||||
width: auto!important;
|
||||
min-width: 400px;
|
||||
}
|
||||
.pfont{
|
||||
font-size: 12px;
|
||||
color: #808695;
|
||||
}
|
||||
</style>
|
||||
39
admin/src/views/sms/smsMessage/index.vue
Normal file
39
admin/src/views/sms/smsMessage/index.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<zb-parser
|
||||
:form-id="111"
|
||||
:is-create="isCreate"
|
||||
:edit-data="editData"
|
||||
@submit="handlerSubmit"
|
||||
/>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import zbParser from '@/components/FormGenerator/components/parser/ZBParser'
|
||||
import { smsSaveApi } from '@/api/sms'
|
||||
export default {
|
||||
name: "SmsMessage",
|
||||
components: { zbParser },
|
||||
data() {
|
||||
return {
|
||||
isCreate: 0,
|
||||
editData: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handlerSubmit(formValue) {
|
||||
smsSaveApi(formValue).then(data => {
|
||||
this.$message.success('新增成功')
|
||||
this.editData = {}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
256
admin/src/views/sms/smsPay/index.vue
Normal file
256
admin/src/views/sms/smsPay/index.vue
Normal file
@@ -0,0 +1,256 @@
|
||||
<template>
|
||||
<div class="divBox">
|
||||
<el-card class="box-card">
|
||||
<el-row v-loading="fullscreenLoading" :gutter="16">
|
||||
<el-col :span="24" class="ivu-text-left mb20">
|
||||
<el-col :xs="12" :sm="6" :md="4" :lg="3" class="mr20">
|
||||
<span class="ivu-text-right ivu-block">短信账户名称:</span>
|
||||
</el-col>
|
||||
<el-col :xs="11" :sm="13" :md="19" :lg="20">
|
||||
<span>{{ account }}</span>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="24" class="ivu-text-left mb20">
|
||||
<el-col :xs="12" :sm="6" :md="4" :lg="3" class="mr20">
|
||||
<span class="ivu-text-right ivu-block">当前剩余条数:</span>
|
||||
</el-col>
|
||||
<el-col :xs="11" :sm="13" :md="19" :lg="20">
|
||||
<span>{{ numbers }}</span>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="24" class="ivu-text-left mb20">
|
||||
<el-col :xs="12" :sm="6" :md="4" :lg="3" class="mr20">
|
||||
<span class="ivu-text-right ivu-block">选择套餐:</span>
|
||||
</el-col>
|
||||
<el-col :xs="11" :sm="13" :md="19" :lg="20">
|
||||
<el-row :gutter="20">
|
||||
<el-col
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
:xxl="4"
|
||||
:xl="8"
|
||||
:lg="8"
|
||||
:md="12"
|
||||
:sm="24"
|
||||
:xs="24"
|
||||
>
|
||||
<div
|
||||
class="list-goods-list-item mb15"
|
||||
:class="{active:index === current}"
|
||||
@click="check(item,index)"
|
||||
>
|
||||
<div class="list-goods-list-item-title" :class="{active:index === current}">¥ <i>{{ item.price }}</i></div>
|
||||
<div class="list-goods-list-item-price" :class="{active:index === current}">
|
||||
<span>短信条数: {{ item.num }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col v-if="checkList" :span="24" class="ivu-text-left mb20">
|
||||
<el-col :xs="12" :sm="6" :md="4" :lg="3" class="mr20">
|
||||
<span class="ivu-text-right ivu-block">充值条数:</span>
|
||||
</el-col>
|
||||
<el-col :xs="11" :sm="13" :md="19" :lg="20">
|
||||
<span>{{ checkList.num }}</span>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col v-if="checkList" :span="24" class="ivu-text-left mb20">
|
||||
<el-col :xs="12" :sm="6" :md="4" :lg="3" class="mr20">
|
||||
<span class="ivu-text-right ivu-block">支付金额:</span>
|
||||
</el-col>
|
||||
<el-col :xs="11" :sm="13" :md="19" :lg="20">
|
||||
<span class="list-goods-list-item-number">¥{{ checkList.price }}</span>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="24" class="ivu-text-left mb20">
|
||||
<el-col :xs="12" :sm="6" :md="4" :lg="3" class="mr20">
|
||||
<span class="ivu-text-right ivu-block">付款方式:</span>
|
||||
</el-col>
|
||||
<el-col :xs="11" :sm="13" :md="19" :lg="20">
|
||||
<span class="list-goods-list-item-pay">微信支付<i v-if="code.invalid">{{ ' ( 支付码过期时间:' + code.invalid + ' )' }}</i></span>
|
||||
</el-col>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-col :xs="12" :sm="6" :md="4" :lg="3" class="mr20"> </el-col>
|
||||
<el-col :xs="11" :sm="13" :md="19" :lg="20">
|
||||
<div class="list-goods-list-item-code mr20"><img :src="code.code_url"></div>
|
||||
</el-col>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { smsNumberApi, smsPriceApi, payCodeApi, smsInfoApi } from '@/api/sms'
|
||||
import { isLogin } from '@/libs/public'
|
||||
import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'SmsPay',
|
||||
data() {
|
||||
return {
|
||||
numbers: '',
|
||||
account: '',
|
||||
list: [],
|
||||
current: 0,
|
||||
checkList: {},
|
||||
fullscreenLoading: false,
|
||||
code: {}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'isLogin'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
this.getNumber()
|
||||
this.getPrice()
|
||||
return
|
||||
|
||||
if (!this.isLogin) {
|
||||
this.$router.push('/operation/systemSms/config?url=' + this.$route.path)
|
||||
} else {
|
||||
this.getNumber()
|
||||
this.getPrice()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 查看是否登录
|
||||
onIsLogin() {
|
||||
this.fullscreenLoading = true
|
||||
this.$store.dispatch('user/isLogin').then(async res => {
|
||||
const data = res
|
||||
if (!data.status) {
|
||||
this.$message.warning('请先登录')
|
||||
this.$router.push('/operation/systemSms/config?url=' + this.$route.path)
|
||||
} else {
|
||||
this.getNumber()
|
||||
this.getPrice()
|
||||
}
|
||||
this.fullscreenLoading = false
|
||||
}).catch(res => {
|
||||
this.$router.push('/operation/systemSms/config?url=' + this.$route.path)
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
// 剩余条数
|
||||
getNumber() {
|
||||
smsInfoApi().then(async res => {
|
||||
const data = res
|
||||
this.numbers = data.number
|
||||
this.account = data.account
|
||||
})
|
||||
},
|
||||
// 支付套餐
|
||||
getPrice() {
|
||||
this.fullscreenLoading = true
|
||||
smsPriceApi({ page: 1, limit: 9999}).then(async res => {
|
||||
setTimeout(() => {
|
||||
this.fullscreenLoading = false
|
||||
}, 800)
|
||||
const data = res
|
||||
this.list = data.data
|
||||
this.checkList = this.list[0]
|
||||
this.getCode(this.checkList)
|
||||
}).catch(() => {
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
// 选中
|
||||
check(item, index) {
|
||||
this.fullscreenLoading = true
|
||||
this.current = index
|
||||
setTimeout(() => {
|
||||
this.getCode(item)
|
||||
this.checkList = item
|
||||
this.fullscreenLoading = false
|
||||
}, 800)
|
||||
},
|
||||
// 支付码
|
||||
getCode(item) {
|
||||
const data = {
|
||||
payType: 'weixin',
|
||||
mealId: item.id,
|
||||
price: item.price
|
||||
}
|
||||
payCodeApi(data).then(async res => {
|
||||
this.code = res
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.active{
|
||||
background: #0091FF;
|
||||
box-shadow:0px 6px 20px 0px rgba(0, 145, 255, 0.3);
|
||||
color: #fff !important;
|
||||
}
|
||||
.list-goods-list-item{
|
||||
border: 1px solid #DADFE6;
|
||||
padding: 20px 10px;
|
||||
box-sizing: border-box;
|
||||
border-radius:3px;
|
||||
}
|
||||
.list-goods-list{
|
||||
&-item{
|
||||
text-align: center;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
img{
|
||||
width: 60%;
|
||||
}
|
||||
.ivu-tag{
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
right: 10px;
|
||||
}
|
||||
&-title{
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #0091FF;
|
||||
margin-bottom: 3px;
|
||||
i{
|
||||
font-size: 30px;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
&-desc{
|
||||
font-size: 14px;
|
||||
color: #808695;
|
||||
}
|
||||
&-price{
|
||||
font-size: 14px;
|
||||
color: #000000;
|
||||
s{
|
||||
color: #c5c8ce;
|
||||
}
|
||||
}
|
||||
&-number{
|
||||
font-size: 14px;
|
||||
color: #ED4014;
|
||||
}
|
||||
&-pay{
|
||||
font-size: 14px;
|
||||
color: #00C050;
|
||||
i{
|
||||
font-size: 12px;
|
||||
font-style: normal;
|
||||
color: #6D7278;
|
||||
}
|
||||
}
|
||||
&-code{
|
||||
width: 130px;
|
||||
height: 130px;
|
||||
img{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
218
admin/src/views/sms/smsTemplate/index.vue
Normal file
218
admin/src/views/sms/smsTemplate/index.vue
Normal file
@@ -0,0 +1,218 @@
|
||||
<template>
|
||||
<!--v-if="isLogin"-->
|
||||
<div class="divBox" v-if="isLogin">
|
||||
<el-card v-loading="fullscreenLoading" class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<div class="filter-container">
|
||||
<div class="demo-input-suffix acea-row">
|
||||
<span class="seachTiele">模板状态:</span>
|
||||
<el-select v-model="tableFrom.status" placeholder="请选择" clearable class="filter-item selWidth mr20" @change="userSearchs">
|
||||
<el-option value="1">可用</el-option>
|
||||
<el-option value="0">不可用</el-option>
|
||||
</el-select>
|
||||
<span class="seachTiele">模板名称:</span>
|
||||
<el-input v-model="tableFrom.title" placeholder="请输入商品名称,关键字,产品编号" class="selWidth">
|
||||
<el-button slot="append" icon="el-icon-search" @change="userSearchs" />
|
||||
</el-input>
|
||||
</div>
|
||||
</div>
|
||||
<el-button size="mini" type="primary" @click="add">添加短信模板</el-button>
|
||||
</div>
|
||||
<el-table
|
||||
v-loading="listLoading"
|
||||
:data="tableData.data"
|
||||
style="width: 100%"
|
||||
size="mini"
|
||||
highlight-current-row
|
||||
>
|
||||
<el-table-column
|
||||
prop="id"
|
||||
label="ID"
|
||||
min-width="50"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="templateid"
|
||||
label="模板ID"
|
||||
min-width="80"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="title"
|
||||
label="模板名称"
|
||||
min-width="120"
|
||||
/>
|
||||
<el-table-column
|
||||
prop="content"
|
||||
label="模板内容"
|
||||
min-width="500"
|
||||
/>
|
||||
<el-table-column
|
||||
label="模板类型"
|
||||
min-width="100"
|
||||
>
|
||||
<template slot-scope="{row}">
|
||||
<span>{{ row.type | typesFilter }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="模板状态">
|
||||
<template slot-scope="{row}">
|
||||
<span>{{ row.status | statusFilter }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="add_time"
|
||||
label="添加时间"
|
||||
min-width="150"
|
||||
/>
|
||||
</el-table>
|
||||
<div class="block">
|
||||
<el-pagination
|
||||
:page-sizes="[20, 40, 60, 80]"
|
||||
:page-size="tableFrom.limit"
|
||||
:current-page="tableFrom.page"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
:total="tableData.total"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="pageChange"
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!--编辑-->
|
||||
<el-dialog
|
||||
title="添加模板"
|
||||
:visible.sync="dialogVisible"
|
||||
width="500px"
|
||||
:before-close="handleClose">
|
||||
<zb-parser
|
||||
v-if="dialogVisible"
|
||||
:form-id="110"
|
||||
:is-create="isCreate"
|
||||
:edit-data="editData"
|
||||
@submit="handlerSubmit"
|
||||
/>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { smsTempLstApi, tempCreateApi } from '@/api/sms'
|
||||
import { roterPre } from '@/settings'
|
||||
import { mapGetters } from 'vuex'
|
||||
import zbParser from '@/components/FormGenerator/components/parser/ZBParser'
|
||||
export default {
|
||||
name: 'SmsTemplate',
|
||||
components: { zbParser },
|
||||
filters: {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
0: '没有',
|
||||
1: '有'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typesFilter(status) {
|
||||
const statusMap = {
|
||||
1: '验证码',
|
||||
2: '通知',
|
||||
3: '推广'
|
||||
}
|
||||
return statusMap[status]
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isCreate: 0,
|
||||
editData: {},
|
||||
dialogVisible: false,
|
||||
fullscreenLoading: false,
|
||||
listLoading: false,
|
||||
tableData: {
|
||||
data: [],
|
||||
total: 0
|
||||
},
|
||||
tableFrom: {
|
||||
page: 1,
|
||||
limit: 20,
|
||||
status: '',
|
||||
title: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters([
|
||||
'isLogin'
|
||||
])
|
||||
},
|
||||
mounted() {
|
||||
if (!this.isLogin) {
|
||||
this.$router.push('/operation/systemSms/config?url=' + this.$route.path)
|
||||
} else {
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClose() {
|
||||
this.dialogVisible = false
|
||||
this.editData = {}
|
||||
},
|
||||
handlerSubmit(formValue) {
|
||||
tempCreateApi(formValue).then(data => {
|
||||
this.$message.success('新增成功')
|
||||
this.dialogVisible = false
|
||||
this.editData = {}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
add() {
|
||||
this.dialogVisible = true
|
||||
},
|
||||
// 查看是否登录
|
||||
onIsLogin() {
|
||||
this.fullscreenLoading = true
|
||||
this.$store.dispatch('user/isLogin').then(async res => {
|
||||
const data = res
|
||||
if (!data.status) {
|
||||
this.$message.warning('请先登录')
|
||||
this.$router.push( '/operation/systemSms/config?url=' + this.$route.path)
|
||||
} else {
|
||||
this.getList()
|
||||
}
|
||||
this.fullscreenLoading = false
|
||||
}).catch(res => {
|
||||
this.$router.push( '/operation/systemSms/config?url=' + this.$route.path)
|
||||
this.fullscreenLoading = false
|
||||
})
|
||||
},
|
||||
// 列表
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
smsTempLstApi(this.tableFrom).then(res => {
|
||||
this.tableData.data = res.data
|
||||
this.tableData.total = res.count
|
||||
this.listLoading = false
|
||||
}).catch(res => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
pageChange(page) {
|
||||
this.tableFrom.page = page
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.tableFrom.limit = val
|
||||
this.getList()
|
||||
},
|
||||
// 表格搜索
|
||||
userSearchs() {
|
||||
this.tableFrom.page = 1
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.selWidth{
|
||||
width: 350px !important;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user