Commit 1105df04 by 姜鹏凯

企微配置图片上传问题

1 parent 2268d6df
...@@ -4,15 +4,15 @@ ...@@ -4,15 +4,15 @@
<div class="g-card"> <div class="g-card">
<div class="my-title">企业配置</div> <div class="my-title">企业配置</div>
<el-form-item label="企业ID:" prop="corpId"> <el-form-item label="企业ID:" prop="corpId">
<el-input style="width: 40%" v-model="form.corpId" placeholder=""></el-input> <el-input style="width: 40%;" v-model="form.corpId" placeholder=""></el-input>
<div class="tips">企业ID即CorpID,在企微后台->我的企业中获取</div> <div class="tips">企业ID即CorpID,在企微后台->我的企业中获取</div>
</el-form-item> </el-form-item>
<el-form-item label="企业名称:" prop="companyName" required> <el-form-item label="企业名称:" prop="companyName" required>
<el-input style="width: 40%" v-model="form.companyName" placeholder="企业名称"></el-input> <el-input style="width: 40%;" v-model="form.companyName" placeholder="企业名称"></el-input>
<div class="tips">根据企业 ID 配置后回显</div> <div class="tips">根据企业 ID 配置后回显</div>
</el-form-item> </el-form-item>
<el-form-item label="企业logo" required prop="logoUrl"> <el-form-item label="企业logo" required prop="logoUrl">
<upload class="image-uploader" :fileUrl.sync="form.logoUrl" type="0"></upload> <upload-to-cos class="image-uploader" :fileUrl.sync="form.logoUrl" type="0"></upload-to-cos>
<div class="tips">建议大小 2M 以内,仅支持 png/jpg 等图片类型</div> <div class="tips">建议大小 2M 以内,仅支持 png/jpg 等图片类型</div>
</el-form-item> </el-form-item>
</div> </div>
...@@ -22,20 +22,22 @@ ...@@ -22,20 +22,22 @@
<div> <div>
<el-input <el-input
:disabled="!corpSecretEditState" :disabled="!corpSecretEditState"
style="width: 40%" style="width: 40%;"
:type="corpSecretEditState ? 'text' : 'password'" :type="corpSecretEditState ? 'text' : 'password'"
v-model="form.corpSecret" v-model="form.corpSecret"
placeholder="请输入通讯录Secret"></el-input> placeholder="请输入通讯录Secret"
<el-button style="margin-left: 20px" plain v-if="corpSecretEditState" @click="cancelEditCorpSecret"> ></el-input>
<el-button style="margin-left: 20px;" plain v-if="corpSecretEditState" @click="cancelEditCorpSecret">
取消 取消
</el-button> </el-button>
<el-button type="primary" plain v-if="corpSecretEditState" @click="submitEditCorpSecret">保存</el-button> <el-button type="primary" plain v-if="corpSecretEditState" @click="submitEditCorpSecret">保存</el-button>
<el-button <el-button
type="primary" type="primary"
style="margin-left: 20px" style="margin-left: 20px;"
plain plain
v-if="!corpSecretEditState" v-if="!corpSecretEditState"
@click="editCorpSecret"> @click="editCorpSecret"
>
修改 修改
</el-button> </el-button>
</div> </div>
...@@ -48,11 +50,12 @@ ...@@ -48,11 +50,12 @@
<div> <div>
<el-input <el-input
:disabled="!contactSecretEditState" :disabled="!contactSecretEditState"
style="width: 40%" style="width: 40%;"
:type="contactSecretEditState ? 'text' : 'password'" :type="contactSecretEditState ? 'text' : 'password'"
v-model="form.contactSecret" v-model="form.contactSecret"
placeholder="请输入客户联系Secret"></el-input> placeholder="请输入客户联系Secret"
<el-button style="margin-left: 20px" plain v-if="contactSecretEditState" @click="cancelEditContactSecret"> ></el-input>
<el-button style="margin-left: 20px;" plain v-if="contactSecretEditState" @click="cancelEditContactSecret">
取消 取消
</el-button> </el-button>
<el-button type="primary" plain v-if="contactSecretEditState" @click="submitEditContactSecret"> <el-button type="primary" plain v-if="contactSecretEditState" @click="submitEditContactSecret">
...@@ -60,10 +63,11 @@ ...@@ -60,10 +63,11 @@
</el-button> </el-button>
<el-button <el-button
type="primary" type="primary"
style="margin-left: 20px" style="margin-left: 20px;"
plain plain
v-if="!contactSecretEditState" v-if="!contactSecretEditState"
@click="editContactSecret"> @click="editContactSecret"
>
修改 修改
</el-button> </el-button>
</div> </div>
...@@ -73,10 +77,10 @@ ...@@ -73,10 +77,10 @@
<div class="g-card"> <div class="g-card">
<div class="my-title">回调配置</div> <div class="my-title">回调配置</div>
<el-form-item label="Token:" prop="token"> <el-form-item label="Token:" prop="token">
<el-input style="width: 40%" v-model="form.token" placeholder="请输入Token"></el-input> <el-input style="width: 40%;" v-model="form.token" placeholder="请输入Token"></el-input>
</el-form-item> </el-form-item>
<el-form-item label="EncodingAESKey:" prop="encodingAesKey"> <el-form-item label="EncodingAESKey:" prop="encodingAesKey">
<el-input style="width: 40%" v-model="form.encodingAesKey" placeholder="请输入EncodingAESKey"></el-input> <el-input style="width: 40%;" v-model="form.encodingAesKey" placeholder="请输入EncodingAESKey"></el-input>
</el-form-item> </el-form-item>
</div> </div>
<el-form-item label="" class="ar"> <el-form-item label="" class="ar">
...@@ -86,89 +90,91 @@ ...@@ -86,89 +90,91 @@
</div> </div>
</template> </template>
<script> <script>
export default { import UploadToCos from '../../components/UploadToCos.vue'
name: 'enterprise-wechat-part1', export default {
data() { components: { UploadToCos },
return { name: 'enterprise-wechat-part1',
corpSecretCopy: '', data() {
corpSecretEditState: false, return {
contactSecretCopey: '', corpSecretCopy: '',
contactSecretEditState: false, corpSecretEditState: false,
form: {}, contactSecretCopey: '',
rules: { contactSecretEditState: false,
corpId: [{ required: true, message: '必填项', trigger: 'blur' }], form: {},
corpSecret: [{ required: true, message: '必填项', trigger: 'blur' }], rules: {
companyName: [{ required: true, message: '必填项', trigger: 'blur' }], corpId: [{ required: true, message: '必填项', trigger: 'blur' }],
contactSecret: [{ required: true, message: '必填项', trigger: 'blur' }], corpSecret: [{ required: true, message: '必填项', trigger: 'blur' }],
logoUrl: [{ required: true, message: '必填项', trigger: 'blur' }], companyName: [{ required: true, message: '必填项', trigger: 'blur' }],
token: [{ required: true, message: '必填项', trigger: 'blur' }], contactSecret: [{ required: true, message: '必填项', trigger: 'blur' }],
encodingAesKey: [{ required: true, message: '必填项', trigger: 'blur' }], logoUrl: [{ required: true, message: '必填项', trigger: 'blur' }],
}, token: [{ required: true, message: '必填项', trigger: 'blur' }],
} encodingAesKey: [{ required: true, message: '必填项', trigger: 'blur' }]
}, }
watch: { }
data: 'setData',
},
props: {
data: {
type: Object,
default: {},
},
},
methods: {
editContactSecret() {
this.contactSecretEditState = true
this.contactSecretCopy = JSON.parse(JSON.stringify(this.form.contactSecret))
this.form.contactSecret = ''
}, },
cancelEditContactSecret() { watch: {
this.contactSecretEditState = false data: 'setData'
this.form.contactSecret = JSON.parse(JSON.stringify(this.contactSecretCopy))
}, },
submitEditContactSecret() { props: {
if (this.form.contactSecret) { data: {
this.$emit('submit', this.form) type: Object,
this.contactSecretEditState = false default: {}
} }
}, },
methods: {
editContactSecret() {
this.contactSecretEditState = true
this.contactSecretCopy = JSON.parse(JSON.stringify(this.form.contactSecret))
this.form.contactSecret = ''
},
cancelEditContactSecret() {
this.contactSecretEditState = false
this.form.contactSecret = JSON.parse(JSON.stringify(this.contactSecretCopy))
},
submitEditContactSecret() {
if (this.form.contactSecret) {
this.$emit('submit', this.form)
this.contactSecretEditState = false
}
},
editCorpSecret() { editCorpSecret() {
this.corpSecretEditState = true this.corpSecretEditState = true
this.corpSecretCopy = JSON.parse(JSON.stringify(this.form.corpSecret)) this.corpSecretCopy = JSON.parse(JSON.stringify(this.form.corpSecret))
this.form.corpSecret = '' this.form.corpSecret = ''
}, },
cancelEditCorpSecret() { cancelEditCorpSecret() {
this.corpSecretEditState = false
this.form.corpSecret = JSON.parse(JSON.stringify(this.corpSecretCopy))
},
submitEditCorpSecret() {
if (this.form.corpSecret) {
this.$emit('submit', this.form)
this.corpSecretEditState = false this.corpSecretEditState = false
} this.form.corpSecret = JSON.parse(JSON.stringify(this.corpSecretCopy))
}, },
submit() { submitEditCorpSecret() {
this.$refs['form'].validate((validate) => { if (this.form.corpSecret) {
if (validate) {
this.$emit('submit', this.form) this.$emit('submit', this.form)
this.corpSecretEditState = false
}
},
submit() {
this.$refs['form'].validate((validate) => {
if (validate) {
this.$emit('submit', this.form)
}
})
},
setData() {
if (Object.keys(this.data).length) {
this.form = this.data
} }
})
},
setData() {
if (Object.keys(this.data).length) {
this.form = this.data
} }
}, },
}, mounted() {},
mounted() {}, created() {}
created() {}, }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.my-title { .my-title {
} }
.tips { .tips {
color: #aaa; color: #aaa;
font-size: 12px; font-size: 12px;
} }
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!