添加管理员权限
This commit is contained in:
@@ -1,40 +1,16 @@
|
||||
<template>
|
||||
<div class="accountEdit_page">
|
||||
<div class="accountEdit_page_head">
|
||||
<div>{{ $t('account.UpdateAvatar') }}</div>
|
||||
<div class="upload_item">
|
||||
<div class="upload_file_item">
|
||||
<a-upload
|
||||
:capture="null"
|
||||
list-type="picture-card"
|
||||
:before-upload="beforeUpload"
|
||||
v-model:file-list="fileList"
|
||||
:customRequest="function(){}"
|
||||
:maxCount="1"
|
||||
accept=".jpg,.png,.jpeg,.bmp"
|
||||
@change="fileUploadChange"
|
||||
>
|
||||
<div
|
||||
class="upload_tip_block"
|
||||
>
|
||||
<!-- <i class="fi fi-br-upload"></i> -->
|
||||
<img :src="uploadUrl?uploadUrl:userDetail.avatar" alt="">
|
||||
</div>
|
||||
</a-upload>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="accountEdit_page_body">
|
||||
<div class="accountEdit_page_body_item">
|
||||
<div class="accountEdit_page_body_item_name">{{$t('account.userName')}}:</div>
|
||||
<div class="accountEdit_page_body_item_name">{{$t('account.Country')}}:</div>
|
||||
<div class="accountEdit_page_body_item_inut">
|
||||
<input type="text" disabled :value="userDetail.userName">
|
||||
<input type="text" disabled :value="userDetail.Country">
|
||||
</div>
|
||||
</div>
|
||||
<div class="accountEdit_page_body_item">
|
||||
<div class="accountEdit_page_body_item_name">{{$t('account.email')}}:</div>
|
||||
<div class="accountEdit_page_body_item_name">{{$t('account.CompanyName')}}:</div>
|
||||
<div class="accountEdit_page_body_item_inut">
|
||||
<input type="text" disabled :value="userDetail.email">
|
||||
<input type="text" disabled :value="userDetail.CompanyName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="accountEdit_page_body_item">
|
||||
@@ -43,7 +19,6 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Cropper ref="Cropper" @handleCropperSuccess="handleCropperSuccess" @closeCropper="deletUploadFile()" :cropperFileData="cropperFileData" :isRound="true"></Cropper>
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts">
|
||||
@@ -51,11 +26,9 @@ import { defineComponent,computed,ref,reactive,nextTick,toRefs,createVNode, onMo
|
||||
import { Https } from "@/tool/https";
|
||||
import { Modal,message } from 'ant-design-vue';
|
||||
import { useStore } from "vuex";
|
||||
import Cropper from '@/component/HomePage/Cropper.vue'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
export default defineComponent({
|
||||
components:{
|
||||
Cropper,
|
||||
},
|
||||
setup() {
|
||||
const store = useStore();
|
||||
@@ -63,93 +36,15 @@ export default defineComponent({
|
||||
return store.state.UserHabit.userDetail
|
||||
})
|
||||
let accountHomeData:any = reactive({
|
||||
cropperFileData:{name:'',uid:''}, //裁剪的原始文件数据
|
||||
uploadUrl:'',
|
||||
uploadFile:undefined,
|
||||
token:'',
|
||||
fileList:[]
|
||||
Country:'',
|
||||
CompanyName:'',
|
||||
})
|
||||
let Cropper = ref()
|
||||
// provide('exhibitionList',exhibitionList)
|
||||
let handleCropperSuccess = (event:any)=>{
|
||||
let {file, fileData,base64} =event
|
||||
accountHomeData.fileList[0].status = 'done'
|
||||
accountHomeData.uploadUrl = base64
|
||||
accountHomeData.uploadFile = file
|
||||
Cropper.value.closeCropper()
|
||||
}
|
||||
let beforeUpload=(file:any,fileList:any)=>{
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg' || file.type === 'image/bmp';
|
||||
if (!isJpgOrPng) {
|
||||
message.info(useI18n().t('PrintboardUpload.jsContent1'));
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 5;
|
||||
if (!isLt2M) {
|
||||
message.info(useI18n().t('PrintboardUpload.jsContent2'));
|
||||
}
|
||||
if(isJpgOrPng && isLt2M){
|
||||
// }else{
|
||||
// return (isJpgOrPng && isLt2M) || Upload.LIST_IGNORE;
|
||||
}
|
||||
|
||||
}
|
||||
let fileUploadChange = (data:any)=>{
|
||||
let file = data.file
|
||||
// file.id = res.data.id?res.data.id:""
|
||||
var reader = new FileReader();
|
||||
reader.onload = (e:any) => {
|
||||
let data_new;
|
||||
if (typeof e.target.result === 'object') {
|
||||
// 把Array Buffer转化为blob 如果是base64不需要
|
||||
data_new = window.URL.createObjectURL(new Blob([e.target.result]));
|
||||
} else {
|
||||
data_new = e.target.result;
|
||||
}
|
||||
Cropper.value.getOptionImg(data_new)
|
||||
|
||||
|
||||
};
|
||||
// 转化为base64
|
||||
// reader.readAsDataURL(file)
|
||||
// 转化为blob
|
||||
reader.readAsArrayBuffer(file.originFileObj);
|
||||
Cropper.value.changeShowModal(true)
|
||||
}
|
||||
let deletUploadFile = () => {
|
||||
accountHomeData.fileList = []
|
||||
// let index = -1
|
||||
// this.fileList.forEach((ele:any,index1:any) => {
|
||||
// if(this.cropperFileData.uid === ele.uid){
|
||||
// index = index1
|
||||
// }
|
||||
// });
|
||||
// if(index > -1){
|
||||
// this.fileList.splice(index, 1)
|
||||
// }
|
||||
}
|
||||
let setSubmit = ()=>{
|
||||
if(!accountHomeData.uploadFile)return
|
||||
let param = new FormData();
|
||||
param.append('file',accountHomeData.uploadFile);
|
||||
let config:any = {headers:{'Content-Type':'multipart/form-data','Accept':'*/*' }}
|
||||
Https.axiosPost(Https.httpUrls.uploadAvatar,param,config)
|
||||
.then((rv)=>{
|
||||
let data = {
|
||||
avatar : rv
|
||||
}
|
||||
store.commit("upUserDetail", data)
|
||||
message.success('提交成功')
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
return{
|
||||
...toRefs(accountHomeData),
|
||||
userDetail,
|
||||
Cropper,
|
||||
handleCropperSuccess,
|
||||
beforeUpload,
|
||||
fileUploadChange,
|
||||
deletUploadFile,
|
||||
setSubmit,
|
||||
}
|
||||
},
|
||||
@@ -162,28 +57,6 @@ export default defineComponent({
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.accountEdit_page{
|
||||
.accountEdit_page_head{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
img{
|
||||
width: 10rem;
|
||||
object-fit: contain;
|
||||
height: 10rem;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
}
|
||||
.accountEdit_page_head_upload{
|
||||
width: auto;
|
||||
}
|
||||
.upload_item{
|
||||
:deep(.ant-upload-list-picture-card-container){
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
margin-bottom: 5rem;
|
||||
}
|
||||
.accountEdit_page_body{
|
||||
width: 85rem;
|
||||
.accountEdit_page_body_item{
|
||||
|
||||
Reference in New Issue
Block a user