|
@@ -15,7 +15,7 @@
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div style="font-size: 14px; color: var(--color-999);">只支持JPG、JPEG、PNG类型的图片,大小不超过10M</div>
|
|
|
|
|
|
+ <div style="font-size: 14px; color: var(--color-999);">只支持JPG、JPEG、PNG类型的图片,大小不超过20M</div>
|
|
</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>
|
|
@@ -30,7 +30,7 @@
|
|
defineOptions({ name: 'information-setting'})
|
|
defineOptions({ name: 'information-setting'})
|
|
import { ref } from 'vue'
|
|
import { ref } from 'vue'
|
|
import { saveUserInfo } from '@/api/enterprise'
|
|
import { saveUserInfo } from '@/api/enterprise'
|
|
-import { uploadImage } 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'
|
|
@@ -111,20 +111,10 @@ const baseInfo = ref(JSON.parse(localStorage.getItem('entBaseInfo')) || {})
|
|
const query = ref({})
|
|
const query = ref({})
|
|
// 获取字典数据以及字段回显
|
|
// 获取字典数据以及字段回显
|
|
formItems.value.options.forEach(item => {
|
|
formItems.value.options.forEach(item => {
|
|
- // if (item.dictTypeName) {
|
|
|
|
- // getDict(item.dictTypeName).then(({ data }) => {
|
|
|
|
- // data = data?.length && data || []
|
|
|
|
- // item.items = data
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
if (Object.keys(baseInfo).length) {
|
|
if (Object.keys(baseInfo).length) {
|
|
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) => {
|
|
@@ -142,9 +132,14 @@ const openFileInput = () => {
|
|
}
|
|
}
|
|
|
|
|
|
// 上传头像
|
|
// 上传头像
|
|
|
|
+const accept = ['jpg', 'png', 'jpeg']
|
|
const handleUploadFile = async (e) => {
|
|
const handleUploadFile = async (e) => {
|
|
const file = e.target.files[0]
|
|
const file = e.target.files[0]
|
|
if (!file) return
|
|
if (!file) return
|
|
|
|
+
|
|
|
|
+ const fileType = file.name.split('.')[1]
|
|
|
|
+ if (!accept.includes(fileType)) return Snackbar.warning('请上传图片格式文件')
|
|
|
|
+
|
|
const reader = new FileReader()
|
|
const reader = new FileReader()
|
|
reader.readAsDataURL(file)
|
|
reader.readAsDataURL(file)
|
|
reader.onload = () => {
|
|
reader.onload = () => {
|
|
@@ -161,7 +156,8 @@ const handleHideCopper = (data) => {
|
|
|
|
|
|
const formData = new FormData()
|
|
const formData = new FormData()
|
|
formData.append('file', file)
|
|
formData.append('file', file)
|
|
- uploadImage(formData).then(async ({ data }) => {
|
|
|
|
|
|
+ formData.append('path', 'img')
|
|
|
|
+ uploadFile(formData).then(async ({ data }) => {
|
|
if (!data) return
|
|
if (!data) return
|
|
formItems.value.options.find(e => e.key === 'avatar').value = data
|
|
formItems.value.options.find(e => e.key === 'avatar').value = data
|
|
})
|
|
})
|