first commit
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
<!--#
|
||||
layout("/layouts/platform.html"){
|
||||
#-->
|
||||
<div id="app" v-cloak>
|
||||
<el-card shadow="never">
|
||||
<el-form :model="formData" label-width="120px" ref="formRef" style="max-width: 720px;">
|
||||
<el-form-item label="背景图片" prop="picUrl">
|
||||
<image-Upload :file-size="5"
|
||||
:file-type="['png','jpg']"
|
||||
:height="100"
|
||||
:limit="1"
|
||||
:width="100"
|
||||
ref="picUpload"
|
||||
v-model="formData.picUrl"></image-Upload>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="生日贺卡" prop="birthdayUrl">
|
||||
<image-Upload :file-size="5"
|
||||
:file-type="['png','jpg']"
|
||||
:height="100"
|
||||
:limit="1"
|
||||
:width="100"
|
||||
ref="birthdayUpload"
|
||||
v-model="formData.birthdayUrl"></image-Upload>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="生日倒计时" prop="birthdayDays">
|
||||
<el-input-number v-model="formData.birthdayDays"
|
||||
:min="1"
|
||||
:precision="0"
|
||||
:step="1"
|
||||
controls-position="right"
|
||||
placeholder="请输入生日倒计时天数"
|
||||
style="width: 220px;"></el-input-number>
|
||||
<span style="margin-left: 8px;">天</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="自动发送祝福" prop="autoSendEnabled">
|
||||
<el-switch v-model="formData.autoSendEnabled"
|
||||
:disabled="autoSendConfirming"
|
||||
@change="handleAutoSendEnabledChange"
|
||||
active-text="开启"
|
||||
inactive-text="关闭"></el-switch>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button :loading="loading" @click="doSubmit" type="primary">保存配置</el-button>
|
||||
<el-button @click="openH5">预览手机端H5</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
new Vue({
|
||||
el: '#app',
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
autoSendConfirming: false,
|
||||
savedAutoSendEnabled: true,
|
||||
formData: {
|
||||
id: '',
|
||||
picUrl: '',
|
||||
birthdayUrl: '',
|
||||
birthdayDays: 15,
|
||||
autoSendEnabled: true
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleAutoSendEnabledChange(val) {
|
||||
if (this.autoSendConfirming) {
|
||||
return
|
||||
}
|
||||
const oldVal = !val
|
||||
this.autoSendConfirming = true
|
||||
this.$confirm('确定要' + (val ? '开启' : '关闭') + '自动发送祝福吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.autoSendConfirming = false
|
||||
}).catch(() => {
|
||||
this.formData.autoSendEnabled = oldVal
|
||||
this.$nextTick(() => {
|
||||
this.autoSendConfirming = false
|
||||
})
|
||||
})
|
||||
},
|
||||
async getConfig() {
|
||||
const resp = await $.post('/platform/staffManage/birthday/config/getConfig')
|
||||
if (resp.code === 0) {
|
||||
const data = resp.data || {}
|
||||
const autoSendEnabled = data.autoSendEnabled !== false
|
||||
this.formData = {
|
||||
id: data.config ? data.config.id : '',
|
||||
picUrl: data.config ? data.config.picUrl : '',
|
||||
birthdayUrl: data.config ? data.config.birthdayUrl : '',
|
||||
birthdayDays: Number(data.birthdayDays || 15),
|
||||
autoSendEnabled: autoSendEnabled
|
||||
}
|
||||
this.savedAutoSendEnabled = autoSendEnabled
|
||||
}
|
||||
},
|
||||
async doSubmit() {
|
||||
if (this.formData.autoSendEnabled !== this.savedAutoSendEnabled) {
|
||||
try {
|
||||
await this.$confirm('自动发送祝福将' + (this.formData.autoSendEnabled ? '开启' : '关闭') + ',是否继续保存?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
})
|
||||
} catch (e) {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.$confirm('确定要保存生日祝福系统配置吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(async () => {
|
||||
this.loading = true
|
||||
const resp = await $.post('/platform/staffManage/birthday/config/saveConfig', this.formData)
|
||||
this.loading = false
|
||||
if (resp.code === 0) {
|
||||
this.$message.success('保存成功,手机端H5将同步使用最新配置')
|
||||
this.getConfig()
|
||||
} else {
|
||||
this.$message.error(resp.msg)
|
||||
}
|
||||
})
|
||||
},
|
||||
openH5() {
|
||||
window.open('/platform/staffManage/birthday/manage/h5', '_blank')
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getConfig()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
Reference in New Issue
Block a user