Skip to content

Commit

Permalink
feat.邀请码可隐藏 (#191)
Browse files Browse the repository at this point in the history
* 邀请码可隐藏

* Update Profile.vue

* up

---------

Co-authored-by: 无语 <[email protected]>
  • Loading branch information
cyb233 and wuyu8512 authored Jan 23, 2024
1 parent 2cbdb77 commit 0e06c60
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/views/User/Profile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,16 @@
</q-item-section>
<q-item-section class="label-item">{{ option.label }}</q-item-section>
<q-item-section side v-if="!['Avatar'].includes(option.key)">
{{ option.value ? option.value(user) : user?.[option.key] }}
{{
option.value ? option.value(user) : option.hide ? getHideChar(user?.[option.key]) : user?.[option.key]
}}
</q-item-section>
<q-item-section side v-if="option.editable">
<q-icon size="18px" :name="icon.mdiChevronRight" />
</q-item-section>
<q-item-section side v-if="option.hide != undefined" @click.stop="option.hide = !option.hide">
<q-icon size="18px" :name="option.hide ? icon.mdiEye : icon.mdiEyeOff" />
</q-item-section>
</q-item>
</template>
</q-list>
Expand Down Expand Up @@ -77,7 +82,7 @@
</template>

<script setup lang="ts">
import { computed, defineComponent, ref, watch } from 'vue'
import { computed, defineComponent, ref, watch, reactive } from 'vue'
import { icon } from 'assets/icon'
import { useAppStore } from 'stores/app'
import { storeToRefs } from 'pinia'
Expand Down Expand Up @@ -105,7 +110,7 @@ const qqAvatarReg = /https:\/\/q.qlogo.cn\/headimg_dl\?spec=100&dst_uin=/
const qqGroupAvatarReg = /https:\/\/p.qlogo.cn\/gh\/([0-9]*)\/([0-9]*)\/100/
const qqAvatarUrl = 'https://q.qlogo.cn/headimg_dl?spec=100&dst_uin='
const qqGroupAvatarUrl = 'https://p.qlogo.cn/gh/{group_num}/{group_num}/100'
const profileListOptions: Array<Record<string, any>> = [
const profileListOptions: Array<Record<string, any>> = reactive([
{
label: '头像',
key: 'Avatar',
Expand Down Expand Up @@ -136,7 +141,8 @@ const profileListOptions: Array<Record<string, any>> = [
label: '邀请码',
key: 'InviteCode',
icon: icon.mdiLockPlus,
copiable: true
copiable: true,
hide: true
},
{
label: '用户组',
Expand All @@ -156,7 +162,11 @@ const profileListOptions: Array<Record<string, any>> = [
value: (u) => (u?.RegisterTime ? parseTime(u.RegisterTime).format('YYYY-MM-DD') : null),
icon: icon.mdiCalendarRangeOutline
}
]
])
function getHideChar(str: string) {
return str?.replace(/(.)/g, '*')
}
async function handleSubmit() {
let avatarVal = ''
Expand Down

0 comments on commit 0e06c60

Please sign in to comment.