mirror of https://gitee.com/godoos/godoos.git
11 changed files with 203 additions and 74 deletions
@ -1,35 +1,100 @@ |
|||||
<script setup> |
<script setup> |
||||
import { ref } from "vue"; |
import { t } from '@/i18n'; |
||||
import { useChatStore } from "@/stores/chat"; |
import { ref, onMounted } from "vue"; |
||||
const store = useChatStore() |
import { useChatStore } from "@/stores/chat"; |
||||
const form = ref({ |
import { fetchGet, getSystemConfig } from "@/system/config"; |
||||
nickname: '', |
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 = () => { |
</div> |
||||
console.log('submit!') |
</template> |
||||
} |
|
||||
|
|
||||
</script> |
<style scoped lang="scss"> |
||||
<template> |
.el-avatar { |
||||
<el-form :model="form" label-width="160px" style="padding: 30px;"> |
margin: 10px; |
||||
<el-form-item label="头像"> |
} |
||||
<el-avatar shape="square" :size="80" :src="store.userInfo.avatar"/> |
.is-active { |
||||
</el-form-item> |
width: 100px; |
||||
<el-form-item label="昵称"> |
height: 100px; |
||||
<el-input v-model="store.userInfo.nickname" /> |
border: 2px solid red; |
||||
</el-form-item> |
} |
||||
<el-form-item label="手机号"> |
</style> |
||||
<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> |
|
||||
|
@ -1,18 +1,27 @@ |
|||||
import { OsFileWithoutContent } from '../system/core/FileSystem'; |
import { OsFileWithoutContent } from '../system/core/FileSystem'; |
||||
export function turnServePath(path: string): string { |
export function turnServePath(path: string): string { |
||||
const replaceUrl = path.indexOf('/F/myshare') === 0 ? '/F/myshare' : '/F/othershare' |
const replaceUrl = path.indexOf('/F/myshare') === 0 ? '/F/myshare' : '/F/othershare' |
||||
return path.replace(replaceUrl, 'data/userData') |
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) |
return path.replace('data/userData', newTemp) |
||||
} |
} |
||||
export function isShareFile(path: string) : boolean { |
export function isShareFile(path: string) : boolean { |
||||
// console.log('是否是共享文件:',path,path.indexOf('/F/myshare') === 0 || path.indexOf('/F/othershare') === 0);
|
// console.log('是否是共享文件:',path,path.indexOf('/F/myshare') === 0 || path.indexOf('/F/othershare') === 0);
|
||||
return 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 { |
export function turnFilePath(file: OsFileWithoutContent) : string { |
||||
// console.log('是否是共享文件:',path,path.indexOf('/F/myshare') === 0 || path.indexOf('/F/othershare') === 0);
|
|
||||
const arr = file.path.split('/') |
const arr = file.path.split('/') |
||||
return `/${arr[1]}/${arr[2]}/${arr[arr.length - 1]}` |
return `/${arr[1]}/${arr[2]}/${arr[arr.length - 1]}` |
||||
} |
} |
Loading…
Reference in new issue