mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-11 02:12:53 +00:00
Compare commits
2 Commits
789062e85e
...
0b0c2f7cc6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b0c2f7cc6 | ||
|
|
e096707c44 |
@ -388,9 +388,6 @@ class UsersController extends AbstractController
|
||||
$data['nickname_original'] = $user->getRawOriginal('nickname');
|
||||
$data['department_name'] = $user->getDepartmentName();
|
||||
$data['department_owner'] = UserDepartment::where('parent_id',0)->where('owner_userid', $user->userid)->exists(); // 适用默认部门下第1级负责人才能添加部门OKR
|
||||
$tagMeta = UserTag::listWithMeta($user->userid, $user);
|
||||
$data['personal_tags'] = $tagMeta['top'];
|
||||
$data['personal_tags_total'] = $tagMeta['total'];
|
||||
return Base::retSuccess('success', $data);
|
||||
}
|
||||
|
||||
@ -832,16 +829,76 @@ class UsersController extends AbstractController
|
||||
$basic = UserDelete::userid2basic($id);
|
||||
}
|
||||
if ($basic) {
|
||||
$tagMeta = UserTag::listWithMeta($basic->userid, $viewer);
|
||||
$basic->personal_tags = $tagMeta['top'];
|
||||
$basic->personal_tags_total = $tagMeta['total'];
|
||||
//
|
||||
$retArray[] = $basic;
|
||||
}
|
||||
}
|
||||
return Base::retSuccess('success', $retArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/users/extra 获取会员拓展信息
|
||||
*
|
||||
* @apiDescription 需要token身份
|
||||
* @apiVersion 1.0.0
|
||||
* @apiGroup users
|
||||
* @apiName extra
|
||||
*
|
||||
* @apiParam {Number|Number[]} [userid] 会员ID(多个格式:jsonArray,一次最多50个,不传默认为当前登录会员)
|
||||
*
|
||||
* @apiSuccess {Number} ret 返回状态码(1正确、0错误)
|
||||
* @apiSuccess {String} msg 返回信息(错误描述)
|
||||
* @apiSuccess {Object[]} data 返回数据
|
||||
*/
|
||||
public function extra()
|
||||
{
|
||||
$sharekey = Request::header('sharekey');
|
||||
$shareInfo = $sharekey ? Meeting::getShareInfo($sharekey) : null;
|
||||
$viewer = null;
|
||||
if (empty($shareInfo)) {
|
||||
$viewer = User::auth();
|
||||
} elseif (Doo::userId() > 0) {
|
||||
$viewer = User::whereUserid(Doo::userId())->first();
|
||||
}
|
||||
//
|
||||
$userid = Request::input('userid');
|
||||
$array = Base::json2array($userid);
|
||||
if (empty($array) && $userid) {
|
||||
$array[] = $userid;
|
||||
}
|
||||
if (empty($array) && $viewer) {
|
||||
$array[] = $viewer->userid;
|
||||
}
|
||||
if (empty($array)) {
|
||||
return Base::retError('参数错误');
|
||||
}
|
||||
if (count($array) > 50) {
|
||||
return Base::retError('一次最多只能获取50条数据');
|
||||
}
|
||||
//
|
||||
$userids = array_values(array_unique(array_filter(array_map(function ($id) {
|
||||
$id = intval($id);
|
||||
return $id > 0 ? $id : null;
|
||||
}, $array))));
|
||||
if (empty($userids)) {
|
||||
return Base::retError('参数错误');
|
||||
}
|
||||
//
|
||||
$fields = ['userid', 'birthday', 'address', 'introduction'];
|
||||
$retArray = [];
|
||||
foreach ($userids as $id) {
|
||||
$user = User::whereUserid($id)->select($fields)->first();
|
||||
if (empty($user)) {
|
||||
continue;
|
||||
}
|
||||
$extended = Arr::only($user->toArray(), $fields);
|
||||
$tagMeta = UserTag::listWithMeta($id, $viewer);
|
||||
$extended['personal_tags'] = $tagMeta['top'];
|
||||
$extended['personal_tags_total'] = $tagMeta['total'];
|
||||
$retArray[] = $extended;
|
||||
}
|
||||
return Base::retSuccess('success', $retArray);
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {get} api/users/lists 会员列表(限管理员)
|
||||
*
|
||||
|
||||
@ -92,7 +92,7 @@ class User extends AbstractModel
|
||||
public static $defaultAvatarMode = 'auto';
|
||||
|
||||
// 基本信息的字段
|
||||
public static $basicField = ['userid', 'email', 'nickname', 'profession', 'birthday', 'address', 'introduction', 'department', 'userimg', 'bot', 'az', 'pinyin', 'line_at', 'disable_at'];
|
||||
public static $basicField = ['userid', 'email', 'nickname', 'profession', 'department', 'userimg', 'bot', 'az', 'pinyin', 'line_at', 'disable_at'];
|
||||
|
||||
/**
|
||||
* 昵称
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
:fullscreen="isFullscreen"
|
||||
:mask-closable="false"
|
||||
:footer-hide="true"
|
||||
width="420"
|
||||
width="480"
|
||||
>
|
||||
<div class="user-detail-body">
|
||||
<div class="profile-header">
|
||||
@ -13,7 +13,7 @@
|
||||
<div class="profile-avatar">
|
||||
<UserAvatar
|
||||
:userid="userData.userid"
|
||||
:size="80"
|
||||
:size="96"
|
||||
:show-state-dot="false"
|
||||
@on-click="onOpenAvatar"
|
||||
/>
|
||||
@ -21,46 +21,22 @@
|
||||
</div>
|
||||
<div class="profile-content">
|
||||
<div class="user-info-top">
|
||||
<span class="username"
|
||||
>@{{ userData.profession || "管理员" }}</span
|
||||
>
|
||||
<h1 class="fullname">
|
||||
{{ userData.nickname}}
|
||||
<h1 class="username">
|
||||
{{ userData.nickname }}
|
||||
</h1>
|
||||
<div class="meta">
|
||||
<!-- <span>{{userData.address || 'Bandung'}}</span> -->
|
||||
<span @click="commonDialogShow = true"
|
||||
class="common-dialog"
|
||||
>{{ $L("共同群组") }}:
|
||||
{{ $L("(*)个", commonDialog.total) }}</span
|
||||
>
|
||||
<span @click="commonDialogShow = true" class="common-dialog">{{ $L(userId == userData.userid ? "我的群组" : "共同群组") }}:<em>{{ $L("(*)个", commonDialog.total) }}</em></span>
|
||||
<span class="separator">|</span>
|
||||
<span
|
||||
>{{ $L("最后在线") }}:
|
||||
{{
|
||||
$A.newDateString(
|
||||
userData.line_at,
|
||||
"YYYY-MM-DD HH:mm"
|
||||
) || "-"
|
||||
}}</span
|
||||
>
|
||||
<span>{{ $L("最后在线") }}: {{$A.newDateString( userData.line_at, "YYYY-MM-DD HH:mm") || "-"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="profile-actions">
|
||||
<Button
|
||||
icon="md-chatbubbles"
|
||||
@click="onOpenDialog"
|
||||
>{{ $L("开始聊天") }}</Button
|
||||
>
|
||||
<Button
|
||||
icon="md-people"
|
||||
@click="onCreateGroup"
|
||||
>{{ $L("创建群组") }}</Button
|
||||
>
|
||||
<Button @click="onOpenDialog"><i class="taskfont"></i>{{ $L("开始聊天") }}</Button>
|
||||
<Button @click="onCreateGroup"><i class="taskfont"></i>{{ $L("创建群组") }}</Button>
|
||||
</div>
|
||||
|
||||
<div class="profile-bio">
|
||||
<div v-if="userData.introduction" class="profile-bio">
|
||||
<p>{{ userData.introduction }}</p>
|
||||
</div>
|
||||
|
||||
@ -68,57 +44,57 @@
|
||||
<h2>{{ $L("个人信息") }}</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<Icon type="ios-person-outline" />
|
||||
<Icon type="ios-briefcase-outline" />
|
||||
<span class="label">{{ $L("职位/职称") }}</span>
|
||||
<span class="value">{{userData.profession || "-"}}</span>
|
||||
</li>
|
||||
<li>
|
||||
<Icon type="ios-people-outline" />
|
||||
<span class="label">{{ $L("部门") }}</span>
|
||||
<span class="value">{{
|
||||
userData.department_name || "-"
|
||||
}}</span>
|
||||
<span class="value">{{userData.department_name || "-"}}</span>
|
||||
</li>
|
||||
<li>
|
||||
<Icon type="ios-mail-outline" />
|
||||
<span class="label">{{ $L("邮箱") }}</span>
|
||||
<span class="value">{{
|
||||
userData.email || "-"
|
||||
}}</span>
|
||||
<span @click="onOpenEmail" class="value" :class="{ 'clickable': userData.email }">{{userData.email || "-"}}</span>
|
||||
</li>
|
||||
<li>
|
||||
<Icon type="ios-call-outline" />
|
||||
<span class="label">{{ $L("电话") }}</span>
|
||||
<span class="value">{{ userData.tel || "-" }}</span>
|
||||
<span @click="onOpenTel" class="value" :class="{ 'clickable': userData.tel }">{{ userData.tel || "-" }}</span>
|
||||
</li>
|
||||
<li>
|
||||
<li v-if="userData.birthday">
|
||||
<Icon type="ios-calendar-outline" />
|
||||
<span class="label">{{ $L("生日") }}</span>
|
||||
<span class="value">{{
|
||||
userData.birthday || "-"
|
||||
}}</span>
|
||||
<span class="value">{{userData.birthday || "-"}}</span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="profile-tags" @click.capture="onOpenTagsModal">
|
||||
<div class="profile-tags">
|
||||
<div v-if="displayTags.length" class="tags-list">
|
||||
<Button
|
||||
type="dashed"
|
||||
class="manage-tags-btn icon"
|
||||
@click.stop="onOpenTagsModal"
|
||||
>
|
||||
<Icon type="ios-settings-outline" /> 管理
|
||||
</Button>
|
||||
<Button
|
||||
v-for="tag in displayTags"
|
||||
:key="tag.id"
|
||||
:type="tag.recognized ? 'primary' : 'default'"
|
||||
@click="onOpenTagsModal"
|
||||
>
|
||||
{{ tag.name }}
|
||||
<span v-if="tag.recognition_total > 0" class="recognition-total">{{tag.recognition_total}}</span>
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
class="manage-tags-btn icon"
|
||||
@click="onOpenTagsModal"
|
||||
>
|
||||
<Icon type="ios-settings-outline" /> 管理
|
||||
</Button>
|
||||
</div>
|
||||
<div v-else class="tags-empty">
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
icon="md-add"
|
||||
class="add-tag-btn"
|
||||
@click.stop="onOpenTagsModal"
|
||||
@click="onOpenTagsModal"
|
||||
>{{ $L("添加标签") }}</Button
|
||||
>
|
||||
</div>
|
||||
@ -160,6 +136,7 @@ export default {
|
||||
userid: 0,
|
||||
},
|
||||
showModal: false,
|
||||
extraLoading: 0,
|
||||
tagModalVisible: false,
|
||||
commonDialog: {
|
||||
userid: null,
|
||||
@ -227,6 +204,7 @@ export default {
|
||||
.then((user) => {
|
||||
this.userData = user;
|
||||
this.ensureTagDefaults();
|
||||
this.loadUserExtra(userid);
|
||||
this.showModal = true;
|
||||
this.loadCommonDialogCount();
|
||||
})
|
||||
@ -407,11 +385,69 @@ export default {
|
||||
$A.modalError(msg);
|
||||
});
|
||||
},
|
||||
|
||||
onOpenEmail() {
|
||||
if (!this.userData.email) {
|
||||
return;
|
||||
}
|
||||
$A.modalConfirm({
|
||||
content: `是否发送邮件给 ${this.userData.nickname}?`,
|
||||
onOk: () => {
|
||||
window.open(`mailto:${this.userData.email}`);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
onOpenTel() {
|
||||
if (!this.userData.tel) {
|
||||
return;
|
||||
}
|
||||
$A.modalConfirm({
|
||||
content: `是否拨打电话给 ${this.userData.nickname}?`,
|
||||
onOk: () => {
|
||||
if ($A.isEEUIApp()) {
|
||||
$A.eeuiAppSendMessage({
|
||||
action: 'callTel',
|
||||
tel: this.userData.tel
|
||||
});
|
||||
} else {
|
||||
window.open(`tel:${this.userData.tel}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
loadUserExtra(userid) {
|
||||
const targetId = Number(userid);
|
||||
if (!targetId) {
|
||||
return;
|
||||
}
|
||||
this.extraLoading += 1;
|
||||
this.$store
|
||||
.dispatch("getUserExtra", {
|
||||
userid: targetId,
|
||||
checkAuth: false,
|
||||
})
|
||||
.then((extra) => {
|
||||
if (extra) {
|
||||
this.applyExtraData(extra, targetId);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn(error);
|
||||
})
|
||||
.finally(() => {
|
||||
this.extraLoading = Math.max(0, this.extraLoading - 1);
|
||||
});
|
||||
},
|
||||
|
||||
applyExtraData(extra, targetId) {
|
||||
if (!extra || this.userData.userid !== targetId) {
|
||||
return;
|
||||
}
|
||||
this.userData = Object.assign({}, this.userData, extra);
|
||||
this.ensureTagDefaults();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// The styles will be moved to the SCSS file as requested.
|
||||
// This scoped style block can be removed if not needed for specific overrides.
|
||||
</style>
|
||||
|
||||
@ -2,17 +2,12 @@
|
||||
<ModalAlive
|
||||
v-model="visible"
|
||||
class-name="user-tags-manage-modal"
|
||||
:title="$L('个性标签管理')"
|
||||
:mask-closable="false"
|
||||
:footer-hide="true"
|
||||
width="520"
|
||||
:closable="true">
|
||||
<div class="tag-modal-container">
|
||||
<div class="tag-modal-header">
|
||||
<h3>{{$L('个性标签管理')}}</h3>
|
||||
<p class="tag-modal-meta">
|
||||
<span>{{$L('当前共(*)个标签', total)}}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="tag-modal-form">
|
||||
<Input
|
||||
v-model="newTagName"
|
||||
@ -43,7 +38,7 @@
|
||||
:class="{'is-editing': editId === tag.id}">
|
||||
<div class="tag-item-main">
|
||||
<div class="tag-name" v-if="editId !== tag.id">
|
||||
<Tag :color="tag.recognized ? '#84C56A' : 'default'" class="tag-pill">{{tag.name}}</Tag>
|
||||
<div class="tag-pill" :class="{'is-recognized': tag.recognized}">{{tag.name}}</div>
|
||||
</div>
|
||||
<div class="tag-name edit" v-else>
|
||||
<Input
|
||||
@ -62,7 +57,7 @@
|
||||
:loading="isPending(tag.id, 'recognize')"
|
||||
@click="toggleRecognize(tag)">
|
||||
<Icon type="md-thumbs-up" />
|
||||
<span>{{tag.recognition_total}}</span>
|
||||
<span v-if="tag.recognition_total > 0">{{tag.recognition_total}}</span>
|
||||
<span class="recognize-text">{{$L('认可')}}</span>
|
||||
</Button>
|
||||
<template v-if="editId === tag.id">
|
||||
@ -92,11 +87,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tag-meta-info" v-if="tag.created_by_name">
|
||||
<span>{{$L('由(*)创建', tag.created_by_name)}}</span>
|
||||
<span>{{$L('由 (*) 创建', tag.created_by_name)}}</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="total > 0" class="tag-modal-footer">
|
||||
<span>{{$L('当前共(*)个标签', total)}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</ModalAlive>
|
||||
</template>
|
||||
@ -364,23 +362,7 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.user-tags-manage-modal {
|
||||
.tag-modal-container {
|
||||
padding: 16px 20px 12px;
|
||||
}
|
||||
.tag-modal-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 12px;
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.tag-modal-meta {
|
||||
margin: 0;
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.tag-modal-form {
|
||||
margin-bottom: 16px;
|
||||
@ -388,6 +370,7 @@ export default {
|
||||
.tag-modal-body {
|
||||
max-height: 360px;
|
||||
overflow-y: auto;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.tag-loading {
|
||||
display: flex;
|
||||
@ -396,7 +379,7 @@ export default {
|
||||
}
|
||||
.tag-empty {
|
||||
text-align: center;
|
||||
padding: 32px 0;
|
||||
padding: 36px 0 32px;
|
||||
color: #909399;
|
||||
p {
|
||||
margin-top: 8px;
|
||||
@ -432,7 +415,16 @@ export default {
|
||||
}
|
||||
}
|
||||
.tag-pill {
|
||||
cursor: default;
|
||||
padding: 6px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
user-select: none;
|
||||
background-color: #f5f5f5;
|
||||
color: #606266;
|
||||
&.is-recognized {
|
||||
color: #67c23a;
|
||||
}
|
||||
}
|
||||
.tag-actions {
|
||||
display: flex;
|
||||
@ -442,9 +434,12 @@ export default {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
.ivu-icon {
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.recognize-text {
|
||||
padding-left: 4px;
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -455,5 +450,9 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
.tag-modal-footer {
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -45,13 +45,17 @@
|
||||
:placeholder="$L('请输入个人简介')"></Input>
|
||||
</FormItem>
|
||||
<FormItem :label="$L('个性标签')">
|
||||
<div class="user-tags-preview" @click="openTagModal">
|
||||
<div class="user-tags-preview">
|
||||
<template v-if="displayTags.length">
|
||||
<Tag
|
||||
<div
|
||||
v-for="tag in displayTags"
|
||||
:key="tag.id"
|
||||
:color="tag.recognized ? '#84C56A' : 'default'"
|
||||
class="tag-pill">{{tag.name}}</Tag>
|
||||
class="tag-pill"
|
||||
:class="{'is-recognized': tag.recognized}"
|
||||
@click="openTagModal">
|
||||
{{tag.name}}
|
||||
<span v-if="tag.recognition_total > 0">{{tag.recognition_total}}</span>
|
||||
</div>
|
||||
</template>
|
||||
<span v-else class="tags-empty">{{$L('暂无个性标签')}}</span>
|
||||
<span v-if="personalTagTotal > displayTags.length" class="tags-total">{{$L('共(*)个', personalTagTotal)}}</span>
|
||||
@ -112,10 +116,13 @@ export default {
|
||||
tagModalVisible: false,
|
||||
personalTags: [],
|
||||
personalTagTotal: 0,
|
||||
extraLoading: 0,
|
||||
extraLoaded: false,
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initData();
|
||||
this.fetchExtraInfo();
|
||||
},
|
||||
computed: {
|
||||
...mapState(['userInfo', 'formOptions']),
|
||||
@ -127,6 +134,8 @@ export default {
|
||||
watch: {
|
||||
userInfo() {
|
||||
this.initData();
|
||||
this.extraLoaded = false;
|
||||
this.fetchExtraInfo();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -143,11 +152,12 @@ export default {
|
||||
this.syncPersonalTags();
|
||||
},
|
||||
|
||||
syncPersonalTags() {
|
||||
const tags = Array.isArray(this.userInfo.personal_tags) ? this.userInfo.personal_tags : [];
|
||||
syncPersonalTags(source = null) {
|
||||
const target = source || this.userInfo;
|
||||
const tags = Array.isArray(target.personal_tags) ? target.personal_tags : [];
|
||||
this.personalTags = tags.slice(0, 10);
|
||||
this.personalTagTotal = typeof this.userInfo.personal_tags_total === 'number'
|
||||
? this.userInfo.personal_tags_total
|
||||
this.personalTagTotal = typeof target.personal_tags_total === 'number'
|
||||
? target.personal_tags_total
|
||||
: this.personalTags.length;
|
||||
},
|
||||
|
||||
@ -186,6 +196,39 @@ export default {
|
||||
onTagsUpdated({top, total}) {
|
||||
this.personalTags = Array.isArray(top) ? top : [];
|
||||
this.personalTagTotal = typeof total === 'number' ? total : this.personalTags.length;
|
||||
},
|
||||
|
||||
fetchExtraInfo() {
|
||||
const userid = $A.runNum(this.userInfo.userid);
|
||||
if (userid <= 0) {
|
||||
return;
|
||||
}
|
||||
if (this.extraLoaded || this.extraLoading > 0) {
|
||||
return;
|
||||
}
|
||||
this.extraLoading++;
|
||||
this.$store
|
||||
.dispatch("getUserExtra", {userid})
|
||||
.then((extra) => {
|
||||
if (extra) {
|
||||
this.applyExtraInfo(extra);
|
||||
this.extraLoaded = true;
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn(error);
|
||||
})
|
||||
.finally(() => {
|
||||
this.extraLoading = Math.max(0, this.extraLoading - 1);
|
||||
});
|
||||
},
|
||||
|
||||
applyExtraInfo(extra) {
|
||||
this.$set(this.formData, 'birthday', extra?.birthday || '');
|
||||
this.$set(this.formData, 'address', extra?.address || '');
|
||||
this.$set(this.formData, 'introduction', extra?.introduction || '');
|
||||
this.syncPersonalTags(extra);
|
||||
this.formData_bak = $A.cloneJSON(this.formData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -198,10 +241,34 @@ export default {
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
min-height: 32px;
|
||||
cursor: pointer;
|
||||
|
||||
.tag-pill {
|
||||
cursor: pointer;
|
||||
padding: 5px 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
user-select: none;
|
||||
background-color: #f5f5f5;
|
||||
color: #606266;
|
||||
&.is-recognized {
|
||||
color: #67c23a;
|
||||
}
|
||||
span {
|
||||
padding-left: 8px;
|
||||
position: relative;
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 2px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 2px;
|
||||
height: 2px;
|
||||
border-radius: 50%;
|
||||
background-color: currentColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.tags-empty {
|
||||
|
||||
66
resources/assets/js/store/actions.js
vendored
66
resources/assets/js/store/actions.js
vendored
@ -863,6 +863,71 @@ export default {
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取会员拓展信息(生日、地址、简介、标签等)
|
||||
* @param state
|
||||
* @param dispatch
|
||||
* @param commit
|
||||
* @param payload {userid|{userid, force, checkAuth}}
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
getUserExtra({state, dispatch, commit}, payload) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const options = (payload && typeof payload === 'object' && !Array.isArray(payload))
|
||||
? payload
|
||||
: {userid: payload};
|
||||
let {userid, force = false, checkAuth = false} = options;
|
||||
const original = userid;
|
||||
const ids = (Array.isArray(userid) ? userid : [userid])
|
||||
.map(id => Number(id))
|
||||
.filter(id => Number.isFinite(id) && id > 0);
|
||||
if (ids.length === 0) {
|
||||
resolve(Array.isArray(original) ? [] : null);
|
||||
return;
|
||||
}
|
||||
const cachedBefore = ids
|
||||
.map(id => state.userExtraCache[String(id)])
|
||||
.filter(item => typeof item === 'object' && item !== null);
|
||||
const missing = ids.filter(id => force || !state.userExtraCache[String(id)]);
|
||||
if (missing.length > 0) {
|
||||
try {
|
||||
const {data} = await dispatch("call", {
|
||||
url: 'users/extra',
|
||||
data: {userid: missing},
|
||||
checkAuth
|
||||
});
|
||||
const extraList = Array.isArray(data) ? data : [];
|
||||
extraList.forEach(item => {
|
||||
const id = Number(item?.userid);
|
||||
if (!Number.isFinite(id) || id <= 0) {
|
||||
return;
|
||||
}
|
||||
const normalized = Object.assign({}, item, {userid: id});
|
||||
commit('user/extra/save', {userid: id, data: normalized});
|
||||
const existing = state.cacheUserBasic.find(entry => entry.userid == id);
|
||||
if (existing) {
|
||||
dispatch("saveUserBasic", Object.assign({}, existing, normalized));
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn(error);
|
||||
if (cachedBefore.length === 0) {
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const results = ids
|
||||
.map(id => state.userExtraCache[String(id)])
|
||||
.filter(item => typeof item === 'object' && item !== null);
|
||||
if (Array.isArray(original)) {
|
||||
resolve(results);
|
||||
} else {
|
||||
resolve(results[0] || null);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 保存用户基础信息
|
||||
* @param commit
|
||||
@ -1099,6 +1164,7 @@ export default {
|
||||
|
||||
// Reset auth exception flag after successful login flow
|
||||
state.ajaxAuthException = null
|
||||
state.userExtraCache = {}
|
||||
|
||||
resolve()
|
||||
});
|
||||
|
||||
21
resources/assets/js/store/mutations.js
vendored
21
resources/assets/js/store/mutations.js
vendored
@ -30,6 +30,27 @@ export default {
|
||||
$A.IDBSave("cacheUserBasic", state.cacheUserBasic, 600)
|
||||
},
|
||||
|
||||
'user/extra/save': function(state, {userid, data}) {
|
||||
const id = Number(userid);
|
||||
if (!Number.isFinite(id) || id <= 0 || typeof data !== 'object' || data === null) {
|
||||
return;
|
||||
}
|
||||
const key = String(id);
|
||||
const cache = Object.assign({}, state.userExtraCache);
|
||||
cache[key] = Object.assign({}, data, {userid: id});
|
||||
state.userExtraCache = cache;
|
||||
},
|
||||
|
||||
'user/extra/clear': function(state, userid) {
|
||||
if (typeof userid === 'number' || typeof userid === 'string') {
|
||||
const cache = Object.assign({}, state.userExtraCache);
|
||||
delete cache[String(userid)];
|
||||
state.userExtraCache = cache;
|
||||
} else {
|
||||
state.userExtraCache = {};
|
||||
}
|
||||
},
|
||||
|
||||
// 共同群聊
|
||||
'common/dialog/count/save': function(state, {userid, total, updatedAt = Date.now()}) {
|
||||
if (!userid) {
|
||||
|
||||
1
resources/assets/js/store/state.js
vendored
1
resources/assets/js/store/state.js
vendored
@ -90,6 +90,7 @@ export default {
|
||||
// User
|
||||
cacheUserWait: [],
|
||||
cacheUserBasic: [],
|
||||
userExtraCache: {},
|
||||
|
||||
// 日历
|
||||
cacheCalendarView: null,
|
||||
|
||||
@ -1,18 +1,30 @@
|
||||
.common-user-detail-modal {
|
||||
.ivu-modal-fullscreen {
|
||||
.ivu-modal-body {
|
||||
border-radius: 16px 16px 0 0;
|
||||
}
|
||||
}
|
||||
.ivu-modal-content {
|
||||
border-radius: 16px !important;
|
||||
background-color: transparent;
|
||||
margin-top: calc(var(--status-bar-height) + 46px) !important;
|
||||
}
|
||||
.ivu-modal-close {
|
||||
.ivu-icon-ios-close {
|
||||
color: #ffffff;
|
||||
}
|
||||
}
|
||||
.ivu-modal-body {
|
||||
padding: 0 !important;
|
||||
background-color: #ffffff;
|
||||
border-radius: 16px;
|
||||
}
|
||||
.user-detail-body {
|
||||
.profile-header {
|
||||
position: relative;
|
||||
height: 160px;
|
||||
height: 180px;
|
||||
.cover-photo {
|
||||
background: $primary-color;
|
||||
height: 120px;
|
||||
height: 130px;
|
||||
border-top-left-radius: 16px;
|
||||
border-top-right-radius: 16px;
|
||||
}
|
||||
@ -34,45 +46,59 @@
|
||||
|
||||
.user-info-top {
|
||||
.username {
|
||||
color: $primary-desc-color;
|
||||
font-size: 14px;
|
||||
}
|
||||
.fullname {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin: 4px 0;
|
||||
}
|
||||
.meta {
|
||||
margin-top: 8px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: #808695;
|
||||
font-size: 12px;
|
||||
font-size: 13px;
|
||||
.common-dialog {
|
||||
cursor: pointer;
|
||||
em {
|
||||
padding-left: 4px;
|
||||
font-style: normal;
|
||||
color: $primary-color;
|
||||
}
|
||||
}
|
||||
.separator {
|
||||
margin: 0 8px;
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.profile-actions {
|
||||
margin: 16px 0;
|
||||
margin-top: 16px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
gap: 12px;
|
||||
.ivu-btn {
|
||||
border-radius: 6px;
|
||||
border-color: #ececec;
|
||||
&:hover {
|
||||
border-color: #a2d98d;
|
||||
}
|
||||
.taskfont {
|
||||
margin-right: 6px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.profile-bio {
|
||||
color: $primary-title-color;
|
||||
line-height: 1.5;
|
||||
margin: 16px 0;
|
||||
line-height: 1.6;
|
||||
margin-top: 16px;
|
||||
padding: 0 50px;
|
||||
font-size: 12px;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.profile-information {
|
||||
margin-top: 24px;
|
||||
text-align: left;
|
||||
background-color: #f8f8f9;
|
||||
padding: 16px;
|
||||
@ -90,7 +116,7 @@
|
||||
|
||||
li {
|
||||
display: flex;
|
||||
align-items: flex-start; // 避免多行内容导致垂直居中不齐
|
||||
align-items: flex-start;
|
||||
padding: 8px 0;
|
||||
font-size: 14px;
|
||||
|
||||
@ -118,6 +144,9 @@
|
||||
white-space: normal;
|
||||
word-break: break-word;
|
||||
overflow-wrap: break-word;
|
||||
&.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -126,14 +155,32 @@
|
||||
.profile-tags {
|
||||
margin-top: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid #80869550;
|
||||
cursor: pointer;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
display: flex;
|
||||
.tags-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
.recognition-total {
|
||||
padding-left: 8px;
|
||||
position: relative;
|
||||
&:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 2px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 2px;
|
||||
height: 2px;
|
||||
border-radius: 50%;
|
||||
background-color: currentColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ivu-btn {
|
||||
border-radius: 6px;
|
||||
}
|
||||
.ivu-tag {
|
||||
margin: 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user