| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <template>
- <div class="public-微信公众号配置-set gray-box top-redius border-bottom-gray">
- <div class="title">
- {{ $t("sysManagement.ldtWeChatOfficialAccountConfiguration") }}
- </div>
- <el-form
- ref="dataForm"
- label-width="240px"
- size="mini"
- class="set-form"
- label-position="left"
- @keyup.enter.native="dataFormSubmit()"
- :rules="dataRule"
- :model="dataForm"
- >
- <el-form-item
- :label="`${$t('sysManagement.weChatOfficialAccount')}appId:`"
- style="width: 640px"
- prop="appId"
- >
- <el-input
- v-model="dataForm.appId"
- :placeholder="`${$t('sysManagement.weChatOfficialAccount')}appId`"
- controls-position="right"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientId:`"
- style="width: 640px"
- prop="clientId"
- >
- <el-input
- v-model="dataForm.clientId"
- :placeholder="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientId`"
- controls-position="right"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientSecret:`"
- style="width: 640px"
- prop="clientSecret"
- >
- <el-input
- v-model="dataForm.clientSecret"
- :placeholder="`${$t('sysManagement.ldtWeChatOfficialAccount')}clientSecret`"
- controls-position="right"
- ></el-input>
- </el-form-item>
- <!--<el-form-item
- :label="`${$t('sysManagement.weChatOfficialAccount')}${$t(
- 'sysManagement.messageEncoding'
- )} token:`"
- style="width: 640px"
- prop="token"
- >
- <el-input
- v-model="dataForm.token"
- type="textarea"
- :placeholder="`${$t('sysManagement.weChatOfficialAccount')}${$t(
- 'sysManagement.messageEncoding'
- )} token`"
- controls-position="right"
- ></el-input>
- </el-form-item>
- <el-form-item
- :label="`${$t('sysManagement.weChatOfficialAccount')}${$t(
- 'sysManagement.messageEncoding'
- )} aesKey:`"
- style="width: 640px"
- prop="aesKey"
- >
- <el-input
- v-model="dataForm.aesKey"
- type="textarea"
- :placeholder="`${$t('sysManagement.weChatOfficialAccount')}${$t(
- 'sysManagement.messgaeEncoding'
- )} aesKey`"
- controls-position="right"
- ></el-input>
- </el-form-item>-->
- <div class="default-btn" @click="dataFormSubmit()">{{$t('sysManagement.save')}}</div>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <!-- <el-button @click="visible = false">取消</el-button> -->
- </span>
- </div>
- </template>
- <script>
- export default {
- data () {
- return {
- dataForm: {
- // id: null,
- // paramKey: 'MP_CONFIG',
- appId: null,
- clientId: null,
- clientSecret: null,
- token: null,
- aesKey: null
- // paramValue: null
- },
- dataRule: {
- appId: [
- { required: true, message: `${this.$i18n.t('sysManagement.weChatOfficialAccount')} appId ${this.$i18n.t('sysManagement.nullTips')}`, trigger: 'blur' }
- ],
- clientId: [
- { required: true, message: `${this.$i18n.t('sysManagement.ldtWeChatOfficialAccount')} clientId ${this.$i18n.t('sysManagement.nullTips')}`, trigger: 'blur' }
- ],
- clientSecret: [
- { required: true, message: `${this.$i18n.t('sysManagement.ldtWeChatOfficialAccount')} clientSecret ${this.$i18n.t('sysManagement.nullTips')}`, trigger: 'blur' }
- ]
- }
- }
- },
- mounted () {
- this.init()
- },
- methods: {
- init () {
- // this.$refs['dataForm'].resetFields()
- this.$nextTick(() => {
- this.$http({
- url: this.$http.adornUrl('/sys/pconfig/info/' + 'LDT_MP_CONFIG'),
- method: 'get',
- params: this.$http.adornParams({
- id: this.dataForm.id,
- key: this.dataForm.paramKey
- })
- }).then(({ data }) => {
- if (data) {
- this.dataForm = data
- }
- })
- this.$refs['dataForm'].resetFields()
- })
- },
- // 表单提交
- dataFormSubmit () {
- let obj = {}
- obj.appId = this.dataForm.appId
- obj.secret = this.dataForm.secret
- obj.token = this.dataForm.token
- obj.aesKey = this.dataForm.aesKey
- this.$refs['dataForm'].validate((valid) => {
- if (valid) {
- this.$http({
- url: this.$http.adornUrl('/sys/pconfig/save'),
- method: 'post',
- data: this.$http.adornData({
- 'paramKey': 'LDT_MP_CONFIG',
- 'paramValue': JSON.stringify(this.dataForm),
- 'remark': this.$i18n.t('sysManagement.ldtWeChatOfficialAccountConfiguration')
- })
- }).then(({ data }) => {
- if (data) {
- this.init()
- }
- this.$message({
- message: this.$i18n.t('publics.operation'),
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.visible = false
- this.$emit('refreshDataList')
- }
- })
- })
- }
- })
- }
- }
- }
- </script>
|