前端终极完善
This commit is contained in:
28
Yi.Vue/src/components/ccAvatar.vue
Normal file
28
Yi.Vue/src/components/ccAvatar.vue
Normal file
@@ -0,0 +1,28 @@
|
||||
<template>
|
||||
<v-avatar :size="size" >
|
||||
<!-- <img src="https://z3.ax1x.com/2021/05/09/gJadhD.jpg" /> -->
|
||||
<img
|
||||
:src="baseurl +'/image/'+$store.state.user.user.icon"
|
||||
/>
|
||||
</v-avatar>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Utilities
|
||||
// import { get } from 'vuex-pathify'
|
||||
|
||||
export default {
|
||||
name: 'ccAvatar',
|
||||
mounted() {
|
||||
this.baseurl = process.env.VUE_APP_BASE_API;
|
||||
},
|
||||
data:()=>({
|
||||
baseurl: "",
|
||||
}),
|
||||
props: {
|
||||
size: {
|
||||
type: Number,
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -65,8 +65,10 @@
|
||||
},
|
||||
title () {
|
||||
const matches = this.item.menu_name.match(/\b(\w)/g)
|
||||
|
||||
if(matches!=null)
|
||||
{
|
||||
return matches.join('')
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
@@ -48,8 +48,10 @@
|
||||
computed: {
|
||||
title () {
|
||||
const matches = this.item.menu_name.match(/\b(\w)/g)
|
||||
|
||||
if(matches!=null)
|
||||
{
|
||||
return matches.join('')
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -8,50 +8,26 @@
|
||||
transition="scale-transition"
|
||||
>
|
||||
<template v-slot:activator="{ attrs, on }">
|
||||
<v-btn
|
||||
class="ml-2"
|
||||
min-width="0"
|
||||
text
|
||||
v-bind="attrs"
|
||||
v-on="on"
|
||||
>
|
||||
<v-btn class="ml-2" min-width="0" text v-bind="attrs" v-on="on">
|
||||
<!-- <v-icon>mdi-account</v-icon> -->
|
||||
<v-avatar size="36" class="elevation-2">
|
||||
<!-- <img src="https://z3.ax1x.com/2021/05/09/gJadhD.jpg" /> -->
|
||||
<img
|
||||
:src="
|
||||
baseurl +
|
||||
'/File/ShowNoticeImg?filePath=' +
|
||||
$store.state.user.user.icon
|
||||
"
|
||||
/>
|
||||
</v-avatar>
|
||||
<ccAvatar :size="36" class="elevation-2"></ccAvatar>
|
||||
</v-btn>
|
||||
</template>
|
||||
|
||||
<v-list
|
||||
:tile="false"
|
||||
flat
|
||||
nav
|
||||
>
|
||||
<v-list :tile="false" flat nav>
|
||||
<app-bar-item to="/"
|
||||
><v-list-item-title v-text="'用户名:'+$store.state.user.user.username"
|
||||
/></app-bar-item>
|
||||
<app-bar-item to="/"
|
||||
><v-list-item-title v-text="'称号:'+$store.state.user.user.nick"
|
||||
/></app-bar-item>
|
||||
|
||||
<app-bar-item to="/"><v-list-item-title v-text="'用户名:橙子'" /></app-bar-item>
|
||||
<app-bar-item to="/"><v-list-item-title v-text="'称号:橙子'" /></app-bar-item>
|
||||
|
||||
<v-divider class="mb-2 mt-2"/>
|
||||
<v-divider class="mb-2 mt-2" />
|
||||
|
||||
<template v-for="(p, i) in profile">
|
||||
<v-divider
|
||||
v-if="p.divider"
|
||||
:key="`divider-${i}`"
|
||||
class="mb-2 mt-2"
|
||||
/>
|
||||
<v-divider v-if="p.divider" :key="`divider-${i}`" class="mb-2 mt-2" />
|
||||
|
||||
<app-bar-item
|
||||
v-else
|
||||
:key="`item-${i}`"
|
||||
to="/"
|
||||
>
|
||||
<app-bar-item v-else :key="`item-${i}`" to="/">
|
||||
<v-list-item-title v-text="p.title" />
|
||||
</app-bar-item>
|
||||
</template>
|
||||
@@ -60,16 +36,15 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DefaultAccount',
|
||||
|
||||
export default {
|
||||
name: "DefaultAccount",
|
||||
data: () => ({
|
||||
profile: [
|
||||
{ title: '用户信息' },
|
||||
{ title: '设置' },
|
||||
{ title: "用户信息" },
|
||||
{ title: "设置" },
|
||||
{ divider: true },
|
||||
{ title: '登出' },
|
||||
{ title: "登出" },
|
||||
],
|
||||
}),
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -3,11 +3,7 @@
|
||||
<v-row justify="center">
|
||||
<v-col cols="12" md="4">
|
||||
<app-card class="mt-4 text-center">
|
||||
<v-img
|
||||
class="rounded-circle elevation-6 mt-n12 d-inline-block"
|
||||
src="https://demos.creative-tim.com/vue-material-dashboard/img/marc.aba54d65.jpg"
|
||||
width="128"
|
||||
/>
|
||||
<ccAvatar :size="128" class="rounded-circle elevation-6 mt-n12 d-inline-block"></ccAvatar>
|
||||
|
||||
<v-card-text class="text-center">
|
||||
<h6 class="text-h6 mb-2 text--secondary">
|
||||
@@ -321,8 +317,12 @@ export default {
|
||||
this.userInfo = resp.data;
|
||||
this.userInfo.password = "";
|
||||
this.editInfo = Object.assign({}, this.userInfo);
|
||||
this.$store.commit('SET_USER',this.userInfo)
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
menuApi.GetTopMenusByHttpUser().then((resp) => {
|
||||
this.menuInfo = resp.data;
|
||||
});
|
||||
@@ -333,9 +333,13 @@ choiceImg() {
|
||||
uploadImage() {
|
||||
const file = this.$refs.imgFile.files[0];
|
||||
let formData = new FormData();
|
||||
formData.append("img", file);
|
||||
formData.append("file", file);
|
||||
fileApi.EditIcon(formData).then(resp=>{
|
||||
this.init();
|
||||
this.$dialog.notify.success(resp.msg, {
|
||||
position: "top-right",
|
||||
timeout: 5000,
|
||||
});
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user