头像修改

duizhaopin_ui
13507605001 2 years ago
parent 5f67876ede
commit 7116c7c7ab

@ -62,7 +62,7 @@ export default {
}, },
methods: { methods: {
local_ops_func: function() { local_ops_func: function() {
this.local_ops = this.$store.getters.opts.filter(item => item.name !='user') this.local_ops = this.$store.getters.opts.filter(item => item.name !='user' && item.name != 'instrument')
}, },
toggleSideBar() { toggleSideBar() {
this.$store.dispatch('app/toggleSideBar') this.$store.dispatch('app/toggleSideBar')

@ -10,7 +10,7 @@
<div class="home-pic-item" @click="picClick('reagent')"><img src="@/assets/2-主界面/试剂管理.png" alt=""></div> <div class="home-pic-item" @click="picClick('reagent')"><img src="@/assets/2-主界面/试剂管理.png" alt=""></div>
<div key="2" class="home-pic-item" @click="picClick('standard')"><img src="@/assets/2-主界面/standard.png" alt=""></div> <div key="2" class="home-pic-item" @click="picClick('standard')"><img src="@/assets/2-主界面/standard.png" alt=""></div>
<div key="3" class="home-pic-item" @click="picClick('consumables')"><img src="@/assets/2-主界面/耗材管理.png" alt=""></div> <div key="3" class="home-pic-item" @click="picClick('consumables')"><img src="@/assets/2-主界面/耗材管理.png" alt=""></div>
<div key="4" class="home-pic-item" @click="picClick('instrument')"><img src="@/assets/2-主界面/instrument.png" alt=""></div> <!-- <div key="4" class="home-pic-item" @click="picClick('instrument')"><img src="@/assets/2-主界面/instrument.png" alt=""></div> -->
<div v-if="this.$store.getters.userAuth.includes('UserIndex')" key="5" class="home-pic-item" @click="picClick('user')"><img src="@/assets/2-主界面/用户管理.png" alt=""></div> <div v-if="this.$store.getters.userAuth.includes('UserIndex')" key="5" class="home-pic-item" @click="picClick('user')"><img src="@/assets/2-主界面/用户管理.png" alt=""></div>
</div> </div>
<!-- <div class="home-menu">--> <!-- <div class="home-menu">-->

@ -194,7 +194,10 @@ export default {
this.$message.success(res.msg) this.$message.success(res.msg)
const { user_info, token } = res.data const { user_info, token } = res.data
this.$store.commit('user/SET_ROLE_NAME', user_info.role_name) this.$store.commit('user/SET_ROLE_NAME', user_info.role_name)
this.$store.commit('user/SET_AVATAR', user_info.avatar_url || user_info.avatar_base64) if (user_info.avatar_url){
this.$store.commit('user/SET_AVATAR', process.env.VUE_APP_FACE_API + '/' +user_info.avatar_url)
}
this.$store.commit('user/SET_NAME', user_info.real_name) this.$store.commit('user/SET_NAME', user_info.real_name)
this.$store.commit('user/SET_TOKEN', token) this.$store.commit('user/SET_TOKEN', token)
this.$store.dispatch('permission/generateRoutes') this.$store.dispatch('permission/generateRoutes')
@ -249,7 +252,10 @@ export default {
} }
const { user_info, token } = res.data const { user_info, token } = res.data
this.$store.commit('user/SET_ROLE_NAME', user_info.role_name) this.$store.commit('user/SET_ROLE_NAME', user_info.role_name)
this.$store.commit('user/SET_AVATAR', user_info.avatar_url || user_info.avatar_base64) if (user_info.avatar_url){
this.$store.commit('user/SET_AVATAR', process.env.VUE_APP_FACE_API + '/' +user_info.avatar_url)
}
// this.$store.commit('user/SET_AVATAR', user_info.avatar_url)
this.$store.commit('user/SET_NAME', user_info.real_name) this.$store.commit('user/SET_NAME', user_info.real_name)
this.$store.commit('user/SET_TOKEN', token) this.$store.commit('user/SET_TOKEN', token)
this.$store.dispatch('permission/generateRoutes') this.$store.dispatch('permission/generateRoutes')

@ -16,7 +16,7 @@
<el-button type="primary" icon="el-icon-search" @click="searchReagent"></el-button> <el-button type="primary" icon="el-icon-search" @click="searchReagent"></el-button>
</div> </div>
<div class="header-right"> <div class="header-right">
<el-button type="primary" plain icon="el-icon-download">导出报告</el-button> <el-button type="primary" plain icon="el-icon-download" @click="handleExport"></el-button>
<el-button icon="el-icon-refresh" circle @click="getStoreInfo" /> <el-button icon="el-icon-refresh" circle @click="getStoreInfo" />
</div> </div>
</div> </div>

@ -30,7 +30,7 @@
<el-button type="primary" icon="el-icon-search" @click="searchReagent"></el-button> <el-button type="primary" icon="el-icon-search" @click="searchReagent"></el-button>
</div> </div>
<div class="header-right"> <div class="header-right">
<el-button type="primary" plain icon="el-icon-download">导出报告</el-button> <el-button type="primary" plain icon="el-icon-download" @click="handleExport"></el-button>
<el-button icon="el-icon-refresh" circle @click="getStoreInfo" /> <el-button icon="el-icon-refresh" circle @click="getStoreInfo" />
</div> </div>
</div> </div>

@ -202,7 +202,7 @@
</el-checkbox-group> </el-checkbox-group>
</el-tab-pane> </el-tab-pane>
<!-- 仪器管理 --> <!-- 仪器管理 -->
<el-tab-pane label="仪器管理" name="fourth"> <!-- <el-tab-pane label="仪器管理" name="fourth">
<el-checkbox <el-checkbox
v-model="checkAll_instrument_module_id" v-model="checkAll_instrument_module_id"
:indeterminate="isIndeterminate_instrument_module_id" :indeterminate="isIndeterminate_instrument_module_id"
@ -218,7 +218,7 @@
{{ item.module_name }} {{ item.module_name }}
</el-checkbox> </el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-tab-pane> </el-tab-pane> -->
<el-tab-pane label="终端管理" name="fifth"> <el-tab-pane label="终端管理" name="fifth">
<el-checkbox <el-checkbox
v-model="checkAll_client_module_id" v-model="checkAll_client_module_id"
@ -390,7 +390,7 @@ export default {
this.drug_module_idOptions = res.data.drug_manage this.drug_module_idOptions = res.data.drug_manage
this.standard_module_idOptions = res.data.standard_manage this.standard_module_idOptions = res.data.standard_manage
this.consumables_module_idOptions = res.data.consumables_manage this.consumables_module_idOptions = res.data.consumables_manage
this.instrument_module_idOptions = res.data.instrument_manage // this.instrument_module_idOptions = res.data.instrument_manage
this.client_module_idOptions = res.data.client_manage this.client_module_idOptions = res.data.client_manage
}) })
}, },

@ -120,7 +120,7 @@
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-if="instrument_module_idOptions.length !== 0"> <!-- <el-col v-if="instrument_module_idOptions.length !== 0">
<el-form-item label="仪器权限" prop="instrument_module_id"> <el-form-item label="仪器权限" prop="instrument_module_id">
<el-checkbox-group v-model="formData.instrument_module_id" size="medium"> <el-checkbox-group v-model="formData.instrument_module_id" size="medium">
<el-checkbox <el-checkbox
@ -130,7 +130,7 @@
>{{ item.module_name }}</el-checkbox> >{{ item.module_name }}</el-checkbox>
</el-checkbox-group> </el-checkbox-group>
</el-form-item> </el-form-item>
</el-col> </el-col> -->
<el-col v-if="client_module_idOptions.length !== 0"> <el-col v-if="client_module_idOptions.length !== 0">
<el-form-item label="终端权限" prop="client_module_id"> <el-form-item label="终端权限" prop="client_module_id">
<el-checkbox-group v-model="formData.client_module_id" size="medium"> <el-checkbox-group v-model="formData.client_module_id" size="medium">

@ -5,7 +5,37 @@
<el-tabs v-model="activeName"> <el-tabs v-model="activeName">
<el-tab-pane label="基本信息" name="first"> <el-tab-pane label="基本信息" name="first">
<div class="avatar"> <div class="avatar">
<el-avatar :size="100" :src="circleUrl" /> <div @click="clickUpload">
<el-avatar :size="100" :src="circleUrl"/>
</div>
<el-dialog
title="头像上传"
:visible.sync="ImgVisible"
:close-on-click-modal="false"
width="500"
@close="handleImageClose"
>
<el-upload
ref="upload"
class="avatar-uploader"
:action="UPLOAD_URL"
:visible.sync="ImgVisible"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
:data="{
user_id:pdata.user_id
}"
>
<el-avatar :size="100" :src="circleUrl" />
</el-upload>
<div>
<el-button type="primary" @click="ptUpload"></el-button>
<el-button type="success" @click="paiZhaoupload"></el-button>
</div>
</el-dialog>
<span class="edit"> <span class="edit">
<svg-icon icon-class="" /> <svg-icon icon-class="" />
</span> </span>
@ -47,7 +77,7 @@
import { update_password, getinfo } from '@/api/common' import { update_password, getinfo } from '@/api/common'
import stringify from '@/utils/stringify' import stringify from '@/utils/stringify'
import UserForm from '@/components/UserForm' import UserForm from '@/components/UserForm'
import { get_role_name_list, update } from '@/api/user/user' import { get_role_name_list, update, paizhao_upload_header_img } from '@/api/user/user'
export default { export default {
name: 'User', name: 'User',
components: { UserForm }, components: { UserForm },
@ -72,8 +102,11 @@ export default {
} }
} }
return { return {
ImgVisible:false,
pdata: {}, pdata: {},
circleUrl: 'https://t7.baidu.com/it/u=2006997523,200382512&fm=193&f=GIF', circleUrl: '',
UPLOAD_URL: process.env.VUE_APP_FACE_API + '/user/upload',
fileList:[],
activeName: 'first', activeName: 'first',
roledata: [], roledata: [],
loading: false, loading: false,
@ -104,10 +137,53 @@ export default {
this.getUserInfo() this.getUserInfo()
}, },
methods: { methods: {
ptUpload() {
this.$refs['upload'].$children[0].$refs.input.click();
},
paiZhaoupload() {
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
paizhao_upload_header_img().then(rsp => {
this.circleUrl = process.env.VUE_APP_FACE_API + `/${rsp.data}`
this.pdata.avatar_url = rsp.data
loading.close()
this.ImgVisible = false
})
},
clickUpload () {
this.ImgVisible=true
},
handleImageClose() {
this.ImgVisible = false
},
handleAvatarSuccess(res, file) {
// this.$store.commit('user/SET_AVATAR', process.env.VUE_APP_BASE_API + `/${res.data}`)
this.pdata.avatar_url = res.data
this.circleUrl = process.env.VUE_APP_FACE_API + `/${res.data}`
this.ImgVisible = false
},
beforeAvatarUpload(file) {
const isJPG = file.type === 'image/jpeg';
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isJPG) {
this.$message.error('上传头像图片只能是 JPG 格式!');
}
if (!isLt2M) {
this.$message.error('上传头像图片大小不能超过 2MB!');
}
return isJPG && isLt2M;
},
getUserInfo() { getUserInfo() {
this.loading = true this.loading = true
getinfo().then(res => { getinfo().then(res => {
this.pdata = res.data this.pdata = res.data
this.circleUrl = process.env.VUE_APP_FACE_API +'/' +res.data.avatar_url
}).finally(() => { this.loading = false }) }).finally(() => { this.loading = false })
}, },
submitForm(formName) { submitForm(formName) {
@ -129,7 +205,10 @@ export default {
this.dialogVisible = false this.dialogVisible = false
this.getUserInfo() this.getUserInfo()
this.$store.commit('user/SET_ROLE_NAME', this.pdata.role_name) this.$store.commit('user/SET_ROLE_NAME', this.pdata.role_name)
this.$store.commit('user/SET_AVATAR', this.pdata.avatar_url || this.pdata.avatar_base64) // this.$store.commit('user/SET_AVATAR', this.pdata.avatar_url)
if (this.pdata.avatar_url){
this.$store.commit('user/SET_AVATAR', process.env.VUE_APP_FACE_API + '/' +this.pdata.avatar_url)
}
this.$store.commit('user/SET_NAME', this.pdata.real_name) this.$store.commit('user/SET_NAME', this.pdata.real_name)
}) })
}, },

Loading…
Cancel
Save