mirror of https://gitee.com/godoos/godoos.git
11 changed files with 203 additions and 74 deletions
@ -1,35 +1,100 @@ |
|||
<script setup> |
|||
import { ref } from "vue"; |
|||
import { useChatStore } from "@/stores/chat"; |
|||
const store = useChatStore() |
|||
const form = ref({ |
|||
nickname: '', |
|||
}) |
|||
<script setup> |
|||
import { t } from '@/i18n'; |
|||
import { ref, onMounted } from "vue"; |
|||
import { useChatStore } from "@/stores/chat"; |
|||
import { fetchGet, getSystemConfig } from "@/system/config"; |
|||
const store = useChatStore() |
|||
const form = ref({ |
|||
nickname: '', |
|||
}) |
|||
const userInfo = getSystemConfig().userInfo |
|||
const dialogShow = ref(false) |
|||
let imgList = reactive([]) |
|||
const showChange = (val) =>{ |
|||
dialogShow.value = val |
|||
} |
|||
const toChangeHead = ()=>{ |
|||
console.log('换头像'); |
|||
} |
|||
// 获取头像列表 |
|||
const getHeadList = async() => { |
|||
const res = await fetchGet(`${userInfo.url}/files/avatarlist`) |
|||
if (res.ok) { |
|||
imgList = await res.json() |
|||
imgList = imgList.data.map(item => { |
|||
item.isChoose = false |
|||
return item |
|||
}) |
|||
imgList[0].isChoose = true |
|||
} |
|||
console.log('imgList:' , imgList); |
|||
} |
|||
let pos = ref(0) |
|||
// 换头像 |
|||
const chooseImg = (index) => { |
|||
imgList.forEach(item => item.isChoose = false) |
|||
imgList[index].isChoose = true |
|||
pos.value = index |
|||
} |
|||
const onSubmit = () => { |
|||
console.log('submit!') |
|||
} |
|||
onMounted(()=>{ |
|||
getHeadList() |
|||
}) |
|||
</script> |
|||
<template> |
|||
<div> |
|||
<el-form :model="form" label-width="160px" style="padding: 30px;"> |
|||
<el-form-item label="头像"> |
|||
<el-avatar :size="90" :src="store.userInfo.avatar" @click="showChange(true)"/> |
|||
</el-form-item> |
|||
<el-form-item label="昵称"> |
|||
<el-input v-model="store.userInfo.nickname" /> |
|||
</el-form-item> |
|||
<el-form-item label="手机号"> |
|||
<el-input v-model="store.userInfo.phone" /> |
|||
</el-form-item> |
|||
<el-form-item label="工号"> |
|||
<el-input v-model="store.userInfo.job_number" /> |
|||
</el-form-item> |
|||
<el-form-item label="自我介绍"> |
|||
<el-input v-model="store.userInfo.desc" /> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" @click="onSubmit">保存</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
<el-dialog v-model="dialogShow" title="修改头像" width="500px" draggable> |
|||
<div> |
|||
<el-avatar |
|||
v-for="(item, index) in imgList" |
|||
:key="item.name" |
|||
:size="90" |
|||
:src="item.url" |
|||
:class="{'is-active': item.isChoose}" |
|||
@click="chooseImg(index)"/> |
|||
</div> |
|||
<template #footer> |
|||
<div class="dialog-footer"> |
|||
<el-button @click="showChange(false)">{{ t("cancel") }}</el-button> |
|||
<el-button type="primary" @click="toChangeHead"> |
|||
{{ t("confirm") }} |
|||
</el-button> |
|||
</div> |
|||
</template> |
|||
</el-dialog> |
|||
|
|||
const onSubmit = () => { |
|||
console.log('submit!') |
|||
} |
|||
</div> |
|||
</template> |
|||
|
|||
</script> |
|||
<template> |
|||
<el-form :model="form" label-width="160px" style="padding: 30px;"> |
|||
<el-form-item label="头像"> |
|||
<el-avatar shape="square" :size="80" :src="store.userInfo.avatar"/> |
|||
</el-form-item> |
|||
<el-form-item label="昵称"> |
|||
<el-input v-model="store.userInfo.nickname" /> |
|||
</el-form-item> |
|||
<el-form-item label="手机号"> |
|||
<el-input v-model="store.userInfo.phone" /> |
|||
</el-form-item> |
|||
<el-form-item label="工号"> |
|||
<el-input v-model="store.userInfo.job_number" /> |
|||
</el-form-item> |
|||
<el-form-item label="自我介绍"> |
|||
<el-input v-model="store.userInfo.desc" /> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<el-button type="primary" @click="onSubmit">保存</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
</template> |
|||
<style scoped lang="scss"> |
|||
.el-avatar { |
|||
margin: 10px; |
|||
} |
|||
.is-active { |
|||
width: 100px; |
|||
height: 100px; |
|||
border: 2px solid red; |
|||
} |
|||
</style> |
|||
|
@ -1,18 +1,27 @@ |
|||
import { OsFileWithoutContent } from '../system/core/FileSystem'; |
|||
export function turnServePath(path: string): string { |
|||
const replaceUrl = path.indexOf('/F/myshare') === 0 ? '/F/myshare' : '/F/othershare' |
|||
return path.replace(replaceUrl, 'data/userData') |
|||
const replaceUrl = path.indexOf('/F/myshare') === 0 ? '/F/myshare' : '/F/othershare' |
|||
return path.replace(replaceUrl, 'data/userData') |
|||
} |
|||
export function turnLocalPath(path: string, newTemp: string): string { |
|||
//将浏览器地址转化为本地地址
|
|||
export function turnLocalPath(path: string, newTemp: string, type?: number): string { |
|||
if (type && type === 1) { |
|||
const arr = newTemp.split('/') |
|||
newTemp = `/${arr[1]}/${arr[2]}` |
|||
} |
|||
return path.replace('data/userData', newTemp) |
|||
} |
|||
export function isShareFile(path: string) : boolean { |
|||
// console.log('是否是共享文件:',path,path.indexOf('/F/myshare') === 0 || path.indexOf('/F/othershare') === 0);
|
|||
return path.indexOf('/F/myshare') === 0 || path.indexOf('/F/othershare') === 0 |
|||
} |
|||
//是否是分享根目录
|
|||
export function isRootShare(path: string) : boolean { |
|||
// console.log('根路径:',path === '/F/myshare' || path === '/F/othershare');
|
|||
return path === '/F/myshare' || path === '/F/othershare' |
|||
} |
|||
//返回路径
|
|||
export function turnFilePath(file: OsFileWithoutContent) : string { |
|||
// console.log('是否是共享文件:',path,path.indexOf('/F/myshare') === 0 || path.indexOf('/F/othershare') === 0);
|
|||
const arr = file.path.split('/') |
|||
return `/${arr[1]}/${arr[2]}/${arr[arr.length - 1]}` |
|||
} |
Loading…
Reference in new issue