import { reactive } from 'vue' import './ConfigView.scss' import { ElMessage } from 'element-plus' import login from 'src/api/login' import { indexStore } from 'lib/stores' export default { setup() { const store = indexStore() const bean = reactive({ resetPasswordDialogShow: false, resetPasswordInput: '', resetPasswordInputOld: '', resetPasswordInputTwo: '', editorConfigDialogShow: false, editorConfigInfo: { oa_appid: '', oa_secret: '', link_prev:'', show_conn:"false", show_seal:"false", // service_phone: '', // service_qrcode: { // url: '' // }, service_weixin:"", robot_key:'', // service_type: '1', front_host: '', back_host: '', privacy: '', user: '' } }) const methods = reactive({ handleEditorConfigSubmit() { login.editorConfig(bean.editorConfigInfo).then((res: any) => { if (res.code == 0) { ElMessage.success('配置修改成功') } else { ElMessage.success('配置修改失败') } methods.updateConfig() bean.editorConfigDialogShow = false }) }, handleResetPasswordSubmit() { if (bean.resetPasswordInputOld === '') { ElMessage.error('旧密码不能为空') return } if (bean.resetPasswordInput === '') { ElMessage.error('密码不能为空') return } if (bean.resetPasswordInput !== bean.resetPasswordInputTwo) { ElMessage.error('两次输入的密码不一致') return } login .resetPassWord({ old_password: bean.resetPasswordInputOld, password: bean.resetPasswordInput }) .then((res: any) => { if (res.code === 0) { ElMessage.success('密码修改成功') setTimeout(() => { store.logout() }, 1000) } else { ElMessage.error(res.message) } }) }, updateConfig() { login.getConfig().then((res) => { bean.editorConfigInfo = res.data }) } }) methods.updateConfig() return () => { return (
{/* { methods.handleResetPasswordSubmit() }} > 确定 */} {/* {bean.editorConfigInfo.service_type == '1' ? ( ) : ( { bean.editorConfigInfo.service_qrcode = response.data }} > {bean.editorConfigInfo.service_qrcode ? ( ) : ( )} )} */} {/* front_host:"", back_host:"", privacy:"", user:"" */} { methods.handleEditorConfigSubmit() }} > 确定 {/* */}
) } } }