修复注册码权限无效bug

This commit is contained in:
eoao
2025-07-22 23:33:46 +08:00
parent bbcff4908d
commit 7267f03482
23 changed files with 115 additions and 112 deletions

View File

@@ -93,7 +93,7 @@
</el-tooltip>
<el-tooltip v-if="item.status === 7"
effect="dark"
:content="$t('NoRecipient')"
:content="$t('noRecipient')"
>
<Icon icon="ic:round-mark-email-read" style="color:#FBBD08" width="20"
height="20"/>

View File

@@ -9,6 +9,7 @@
import {ref, onMounted, onBeforeUnmount, watch, nextTick, shallowRef, defineEmits} from 'vue';
import loading from "@/components/loading/index.vue";
import {compressImage} from "@/utils/file-utils.js";
import { useI18n } from 'vue-i18n'
defineExpose({
clearEditor,
focus,
@@ -27,6 +28,7 @@ const props = defineProps({
});
const { locale } = useI18n()
const emit = defineEmits(['change']);
const editor = shallowRef(null);
const isInitialized = ref(false);
@@ -81,7 +83,7 @@ function initEditor() {
},
font_size_formats: '8px 10px 12px 14px 16px 18px 24px 36px',
emoticons_search: false,
language: 'zh_CN',
language: locale.value === 'zh' ? 'zh_CN' : 'en',
language_url: '/tinymce/langs/zh_CN.js',
menubar: false,
license_key: 'gpl',

View File

@@ -67,9 +67,8 @@ const en = {
loginDevice: 'Login device',
loginSystem: 'Login system',
browserLogin: 'Browser Login',
noPerm: 'Unauthorized',
noLimit: 'Unlimited',
blocked: 'Blocked',
unauthorized: 'Unauthorized',
unlimited: 'Unlimited',
sendCount: 'Send email : ',
accountCount: 'Add account : ',
action: 'Action',
@@ -173,7 +172,7 @@ const en = {
tgBotDesc: 'Forward received emails to a Telegram bot',
tgBotToken: 'Bot token',
toBotTokenDesc: 'Multiple user chat_ids, separated by commas',
otherEmailDec: 'emails can be forwarded to other providers, but must be verified via cloudflare',
otherEmailDec: 'emails can be forwarded to external email, but must be verified via cloudflare.',
otherEmailInputDesc: 'Separate multiple email addresses with commas.',
forwardingRulesDesc: 'Rule-based forwarding only forwards emails received by the specified address.',
ruleEmailsInputDesc: 'Separate multiple email addresses with commas.',
@@ -225,7 +224,7 @@ const en = {
allRestore: 'Includes deleted data',
restoreSuccessMsg: 'Restore successful',
banRestore: 'Confirm banning {msg}?',
signOut: 'Sign out',
logOut: 'Sign out',
clearContentConfirm: 'Are you sure to clear all content?',
attLimitMsg: 'Attachment size limit: 28MB',
emptyRecipientMsg: 'Recipient email cannot be empty',
@@ -240,9 +239,9 @@ const en = {
sendingErrorMsg: 'Sending in progress',
networkErrorMsg: 'Network error. Check your internet',
timeoutErrorMsg: 'Timeout. Try again later',
serverBusyErrorMsg: 'Server busy. Please try again later.',
reqFailErrorMsg: 'Request failed. Try again later.',
mailDetails: 'Message',
serverBusyErrorMsg: 'Server busy. Please try again later',
reqFailErrorMsg: 'Request failed. Try again later',
message: 'Message',
language: 'Language',
totalUserAccount: '{msg}',
sendBanned: 'Banned',

View File

@@ -35,7 +35,7 @@ const zh = {
totalSent: '发送数量',
totalMailboxes: '邮箱数量',
totalUsers: '用户数量',
deleted: '删除',
deleted: '删除',
active: '正常',
emailSource: '邮件来源',
userGrowth: '用户增长',
@@ -67,9 +67,8 @@ const zh = {
loginDevice: '登录设备',
loginSystem: '登录系统',
browserLogin: '登录浏览器',
noPerm: '无权限',
noLimit: '无限制',
blocked: '被禁用',
unauthorized: '无权限',
unlimited: '无限制',
sendCount: '邮件发送 :',
accountCount: '邮箱添加 :',
action: '操作',
@@ -225,7 +224,7 @@ const zh = {
allRestore: '包括已删除的数据',
restoreSuccessMsg: '恢复成功',
banRestore: '确认禁用 {msg} 吗?',
signOut: '退出',
logOut: '退出',
clearContentConfirm: '确定要清空所有内容吗?',
attLimitMsg: '附件大小限制28mb',
emptyRecipientMsg: '收件人邮箱地址不能为空',
@@ -242,10 +241,10 @@ const zh = {
timeoutErrorMsg: '请求超时,请稍后重试',
serverBusyErrorMsg: '服务器繁忙,请稍后重试',
reqFailErrorMsg: '请求失败,请稍后再试',
mailDetails: '邮件详情',
message: '邮件详情',
language: '网站语言',
totalUserAccount: '{msg} 个',
sendBan: '已禁用',
sendBanned: '已禁用',
wrote: '来信'
}
export default zh

View File

@@ -16,8 +16,6 @@ export async function init() {
const token = localStorage.getItem('token');
console.log(settingStore.lang)
if (!settingStore.lang) {
settingStore.lang = navigator.language.split('-')[0]
}

View File

@@ -31,7 +31,7 @@
<Icon icon="fluent:settings-48-regular" width="20" height="20" />
<span class="menu-name" style="margin-left: 21px">{{$t('settings')}}</span>
</el-menu-item>
<div class="manage-title" v-perm="['user:query','role:query','setting:query','analysis:query']">
<div class="manage-title" v-perm="['user:query','role:query','setting:query','analysis:query','reg-key:query']">
<div>{{$t('manage')}}</div>
</div>
<el-menu-item @click="router.push({name: 'analysis'})" index="analysis" v-perm="'analysis:query'"

View File

@@ -48,13 +48,13 @@
<div>
<el-tag v-if="settingStore.settings.manyEmail || settingStore.settings.addEmail" >{{$t('disabled')}}</el-tag>
<span v-else-if="accountCount && hasPerm('account:add')" style="margin-right: 5px">{{ $t('totalUserAccount',{msg: accountCount}) }}</span>
<el-tag v-else-if="!accountCount && hasPerm('account:add')" >{{$t('noLimit')}}</el-tag>
<el-tag v-else-if="!hasPerm('account:add')" >{{$t('blocked')}}</el-tag>
<el-tag v-else-if="!accountCount && hasPerm('account:add')" >{{$t('unlimited')}}</el-tag>
<el-tag v-else-if="!hasPerm('account:add')" >{{$t('unauthorized')}}</el-tag>
</div>
</div>
</div>
<div class="logout">
<el-button type="primary" :loading="logoutLoading" @click="clickLogout">{{$t('signOut')}}</el-button>
<el-button type="primary" :loading="logoutLoading" @click="clickLogout">{{$t('logOut')}}</el-button>
</div>
</div>
</template>
@@ -94,20 +94,21 @@ const sendType = computed(() => {
}
if (!hasPerm('email:send')) {
return t('noPerm')
return t('unauthorized')
}
if (userStore.user.role.sendType === 'ban') {
return t('sendBanned')
}
if (!userStore.user.role.sendCount) {
return t('noLimit')
}
if (userStore.user.role.sendCount < 0) {
return t('blocked')
return t('unlimited')
}
if (userStore.user.role.sendType === 'day') {
return t('daily')
}
if (userStore.user.role.sendType === 'count') {
return t('total')
}
@@ -115,15 +116,20 @@ const sendType = computed(() => {
const sendCount = computed(() => {
if (!hasPerm('email:send')) {
return null
}
if (userStore.user.role.sendType === 'ban') {
return null
}
if (!userStore.user.role.sendCount) {
return null
}
if (userStore.user.role.sendCount < 0) {
if (settingStore.settings.send === 1) {
return null
}

View File

@@ -20,7 +20,7 @@ export default {
}
}
export function hasPerm(permKey) {
export function hasPerm(permKey) {
const {permKeys} = useUserStore().user;
return permKeys.includes('*') || permKeys.includes(permKey);
}
@@ -37,6 +37,28 @@ export function permsToRouter(permKeys) {
}
const routers = {
'email:send': [
{
path: '/sent',
name: 'send',
component: () => import('@/views/send/index.vue'),
meta: {
title: 'sent',
name: 'send',
menu: true
}
},
{
path: '/drafts',
name: 'draft',
component: () => import('@/views/draft/index.vue'),
meta: {
title: 'drafts',
name: 'draft',
menu: true
}
}
],
'user:query': [{
path: '/all-users',
name: 'user',
@@ -58,7 +80,7 @@ const routers = {
}
}],
'setting:query': [{
path: '/sys-setting',
path: '/system-setting',
name: 'sys-setting',
component: () => import('@/views/sys-setting/index.vue'),
meta: {

View File

@@ -19,31 +19,11 @@ const routes = [
}
},
{
path: '/sent',
name: 'send',
component: () => import('@/views/send/index.vue'),
meta: {
title: 'sent',
name: 'send',
menu: true
}
},
{
path: '/drafts',
name: 'draft',
component: () => import('@/views/draft/index.vue'),
meta: {
title: 'drafts',
name: 'draft',
menu: true
}
},
{
path: '/content',
path: '/message',
name: 'content',
component: () => import('@/views/content/index.vue'),
meta: {
title: 'mailDetails',
title: 'message',
name: 'content',
menu: false
}

View File

@@ -7,7 +7,7 @@
<Icon class="icon" @click="changeStar" v-if="email.isStar" icon="fluent-color:star-16" width="21" height="20"/>
<Icon class="icon" @click="changeStar" v-else icon="solar:star-line-duotone" width="19" height="19"/>
</span>
<Icon class="icon" v-if="emailStore.contentData.showReply" @click="openReply" icon="carbon:reply" width="20" height="20" />
<Icon class="icon" v-if="emailStore.contentData.showReply" v-perm="'email:send'" @click="openReply" icon="carbon:reply" width="20" height="20" />
</div>
<div></div>
<el-scrollbar class="scrollbar">

View File

@@ -64,7 +64,7 @@ function jumpContent(email) {
emailStore.contentData.delType = 'logic'
emailStore.contentData.showStar = true
emailStore.contentData.showReply = true
router.push('/content')
router.push('/message')
}
const existIds = new Set();

View File

@@ -14,7 +14,7 @@
style="width: 100%;"
>
<el-table-column width="10" />
<el-table-column :label="$t('roleName')" prop="name" :min-width="roleWidth">
<el-table-column :label="$t('role')" prop="name" :min-width="roleWidth">
<template #default="props">
<div class="role-name">
<span >{{props.row.name}}</span>
@@ -79,7 +79,7 @@
<div>
<span>{{node.label}}</span>
<span class="send-num" v-if="data.permKey === 'email:send'" @click.stop>
<el-input-number v-model="form.sendCount" controls-position="right" :max="99999" size="small" :placeholder="$t('total')" >
<el-input-number v-model="form.sendCount" controls-position="right" :min="0" :max="99999" size="small" :placeholder="$t('total')" >
</el-input-number>
<el-select v-model="form.sendType" placeholder="Select" size="small" style="width: 65px;margin-left: 5px;">
<el-option :label="$t('total')" value="count" />

View File

@@ -59,7 +59,7 @@ function jumpContent(email) {
emailStore.contentData.delType = 'logic'
emailStore.contentData.showStar = true
emailStore.contentData.showReply = true
router.push('/content')
router.push('/message')
}
function addStar(email) {

View File

@@ -32,7 +32,7 @@ function jumpContent(email) {
emailStore.contentData.delType = 'logic'
emailStore.contentData.showStar = true
emailStore.contentData.showReply = true
router.push('/content')
router.push('/message')
}
function cancelStar(email) {

View File

@@ -10,7 +10,7 @@
>
</el-input>
</div>
<el-select v-model="params.status" placeholder="Select" class="status-select">
<el-select v-model="params.status" placeholder="Select" class="status-select" :style="`width: ${locale === 'en' ? 95 : 80 }px`">
<el-option :key="-1" :label="$t('all')" :value="-1"/>
<el-option :key="0" :label="$t('active')" :value="0"/>
<el-option :key="1" :label="$t('banned')" :value="1"/>
@@ -507,11 +507,11 @@ function formatSendType(user) {
function formatSendCount(user) {
if (!user.sendAction.hasPerm) {
return t('noPerm')
return t('unauthorized')
}
if (!user.sendAction.sendCount) {
return t('noLimit');
return t('unlimited');
}
let count = user.sendCount + '/' + user.sendAction.sendCount
@@ -898,8 +898,6 @@ function adjustWidth() {
}
.status-select {
width: 95px;
:deep(.el-select__wrapper) {
min-height: 28px;
}