|
@@ -19,6 +19,7 @@
|
|
</template>
|
|
</template>
|
|
</CtForm>
|
|
</CtForm>
|
|
<v-btn class="buttons mt-5" color="primary" @click.stop="handleSubmit">{{ $t('common.save') }}</v-btn>
|
|
<v-btn class="buttons mt-5" color="primary" @click.stop="handleSubmit">{{ $t('common.save') }}</v-btn>
|
|
|
|
+ <!-- <v-btn class="mt-3" color="primary" variant="text" @click.stop="ud">修改登录密码</v-btn> -->
|
|
</v-card>
|
|
</v-card>
|
|
|
|
|
|
<Loading :visible="overlay"></Loading>
|
|
<Loading :visible="overlay"></Loading>
|
|
@@ -28,13 +29,14 @@
|
|
<script setup>
|
|
<script setup>
|
|
defineOptions({ name: 'information-setting'})
|
|
defineOptions({ name: 'information-setting'})
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
-import { saveUserInfo } from '@/api/enterprise'
|
|
|
|
|
|
+import { saveUserInfo, entUpdateEmail } from '@/api/enterprise'
|
|
import { uploadFile } from '@/api/common'
|
|
import { uploadFile } from '@/api/common'
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
import { useUserStore } from '@/store/user'
|
|
import { useUserStore } from '@/store/user'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
|
|
+import { checkEmail } from '@/utils/validate'
|
|
|
|
|
|
const { t } = useI18n()
|
|
const { t } = useI18n()
|
|
const userStore = useUserStore()
|
|
const userStore = useUserStore()
|
|
@@ -81,12 +83,24 @@ const formItems = ref({
|
|
type: 'text',
|
|
type: 'text',
|
|
key: 'email',
|
|
key: 'email',
|
|
value: '',
|
|
value: '',
|
|
- label: '电子邮箱'
|
|
|
|
|
|
+ label: '电子邮箱',
|
|
|
|
+ disabled: true,
|
|
|
|
+ rules: [
|
|
|
|
+ value => {
|
|
|
|
+ if (value) return true
|
|
|
|
+ return '请输入联系邮箱'
|
|
|
|
+ },
|
|
|
|
+ value => {
|
|
|
|
+ if (checkEmail(value)) return true
|
|
|
|
+ return '请输入正确的电子邮箱'
|
|
|
|
+ }
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
]
|
|
]
|
|
})
|
|
})
|
|
|
|
|
|
// 用户基本信息
|
|
// 用户基本信息
|
|
|
|
+let emailChange = false
|
|
const baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
|
|
const baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
|
|
const query = ref({})
|
|
const query = ref({})
|
|
// 获取字典数据以及字段回显
|
|
// 获取字典数据以及字段回显
|
|
@@ -101,6 +115,10 @@ formItems.value.options.forEach(item => {
|
|
item.value = baseInfo.value[item.key]
|
|
item.value = baseInfo.value[item.key]
|
|
query.value.id = baseInfo.value.id
|
|
query.value.id = baseInfo.value.id
|
|
}
|
|
}
|
|
|
|
+ if (item.key === 'email') {
|
|
|
|
+ item.disabled = checkEmail(item.value)
|
|
|
|
+ emailChange = !item.disabled
|
|
|
|
+ }
|
|
})
|
|
})
|
|
// 监听store变化
|
|
// 监听store变化
|
|
userStore.$subscribe((mutation, state) => {
|
|
userStore.$subscribe((mutation, state) => {
|
|
@@ -153,6 +171,7 @@ const handleSubmit = async () => {
|
|
query.value[item.key] = item.value
|
|
query.value[item.key] = item.value
|
|
})
|
|
})
|
|
await saveUserInfo(query.value)
|
|
await saveUserInfo(query.value)
|
|
|
|
+ if (query.value?.email && emailChange) await entUpdateEmail({ email: query.value.email })
|
|
setTimeout(async () => {
|
|
setTimeout(async () => {
|
|
await userStore.getEnterpriseInfo()
|
|
await userStore.getEnterpriseInfo()
|
|
Snackbar.success(t('common.submittedSuccessfully'))
|
|
Snackbar.success(t('common.submittedSuccessfully'))
|