Skip to content

Commit ef8c555

Browse files
committed
refactor: ui
1 parent 263872d commit ef8c555

File tree

7 files changed

+55
-45
lines changed

7 files changed

+55
-45
lines changed

ui/src/api/application/application.ts

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { Result } from '@/request/Result'
2-
import { get, post, postStream, del, put, request, download, exportFile } from '@/request/index'
3-
import type { pageRequest } from '@/api/type/common'
4-
import type { ApplicationFormType } from '@/api/type/application'
5-
import { type Ref } from 'vue'
1+
import {Result} from '@/request/Result'
2+
import {get, post, postStream, del, put, request, download, exportFile} from '@/request/index'
3+
import type {pageRequest} from '@/api/type/common'
4+
import type {ApplicationFormType} from '@/api/type/application'
5+
import {type Ref} from 'vue'
66
import useStore from '@/stores'
77

8-
const prefix: any = { _value: '/workspace/' }
8+
const prefix: any = {_value: '/workspace/'}
99
Object.defineProperty(prefix, 'value', {
1010
get: function () {
11-
const { user } = useStore()
11+
const {user} = useStore()
1212
return this._value + user.getWorkspaceId() + '/application'
1313
},
1414
})
@@ -212,6 +212,17 @@ const getPlatformConfig: (application_id: string, type: string) => Promise<Resul
212212
) => {
213213
return get(`${prefix.value}/${application_id}/platform/${type}`)
214214
}
215+
/**
216+
* 更新平台配置
217+
*/
218+
const updatePlatformConfig: (
219+
application_id: string,
220+
type: string,
221+
data: any,
222+
loading?: Ref<boolean>
223+
) => Promise<Result<any>> = (application_id, type, data, loading) => {
224+
return post(`${prefix.value}/${application_id}/platform/${type}`, data, undefined, loading)
225+
}
215226
/**
216227
* 应用发布
217228
* @param application_id
@@ -245,4 +256,5 @@ export default {
245256
updatePlatformStatus,
246257
getPlatformConfig,
247258
publish,
259+
updatePlatformConfig
248260
}

ui/src/views/login/index.vue

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</div>
8080
</div>
8181
<div v-if="showQrCodeTab">
82-
<QrCodeTab :tabs="orgOptions" />
82+
<QrCodeTab :tabs="orgOptions"/>
8383
</div>
8484
<div class="login-gradient-divider lighter mt-24" v-if="modeList.length > 1">
8585
<span>{{ $t('views.login.moreMethod') }}</span>
@@ -98,7 +98,7 @@
9898
'font-size': item === 'OAUTH2' ? '8px' : '10px',
9999
color: theme.themeInfo?.theme,
100100
}"
101-
>{{ item }}</span
101+
>{{ item }}</span
102102
>
103103
</el-button>
104104
<el-button
@@ -108,7 +108,7 @@
108108
class="login-button-circle color-secondary"
109109
@click="changeMode('QR_CODE')"
110110
>
111-
<img src="@/assets/scan/icon_qr_outlined.svg" width="25px" />
111+
<img src="@/assets/scan/icon_qr_outlined.svg" width="25px"/>
112112
</el-button>
113113
<el-button
114114
v-if="item === '' && loginMode !== ''"
@@ -125,27 +125,27 @@
125125
</login-layout>
126126
</template>
127127
<script setup lang="ts">
128-
import { onMounted, ref, onBeforeMount } from 'vue'
129-
import { useRoute, useRouter } from 'vue-router'
130-
import type { FormInstance, FormRules } from 'element-plus'
131-
import type { LoginRequest } from '@/api/type/login'
128+
import {onMounted, ref, onBeforeMount} from 'vue'
129+
import {useRoute, useRouter} from 'vue-router'
130+
import type {FormInstance, FormRules} from 'element-plus'
131+
import type {LoginRequest} from '@/api/type/login'
132132
import LoginContainer from '@/layout/login-layout/LoginContainer.vue'
133133
import LoginLayout from '@/layout/login-layout/LoginLayout.vue'
134134
import loginApi from '@/api/user/login'
135135
import authApi from '@/api/system-settings/auth-setting'
136-
import { t, getBrowserLang } from '@/locales'
136+
import {t, getBrowserLang} from '@/locales'
137137
import useStore from '@/stores'
138-
import { useI18n } from 'vue-i18n'
138+
import {useI18n} from 'vue-i18n'
139139
import QrCodeTab from '@/views/login/scanCompinents/QrCodeTab.vue'
140-
import { MsgConfirm, MsgError } from '@/utils/message.ts'
140+
import {MsgConfirm, MsgError} from '@/utils/message.ts'
141141
import * as dd from 'dingtalk-jsapi'
142-
import { loadScript } from '@/utils/utils'
143-
import { EditionConst } from '@/utils/permission/data'
144-
import { hasPermission } from '@/utils/permission/index'
142+
import {loadScript} from '@/utils/utils'
143+
import {EditionConst} from '@/utils/permission/data'
144+
import {hasPermission} from '@/utils/permission/index'
145145
146146
const router = useRouter()
147-
const { login, user, theme } = useStore()
148-
const { locale } = useI18n({ useScope: 'global' })
147+
const {login, user, theme} = useStore()
148+
const {locale} = useI18n({useScope: 'global'})
149149
const loading = ref<boolean>(false)
150150
151151
const identifyCode = ref<string>('')
@@ -186,13 +186,13 @@ const loginHandle = () => {
186186
if (loginMode.value === 'LDAP') {
187187
login.asyncLdapLogin(loginForm.value, loading).then(() => {
188188
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
189-
router.push({ name: 'home' })
189+
router.push({name: 'home'})
190190
})
191191
} else {
192192
login.asyncLogin(loginForm.value, loading).then(() => {
193193
locale.value = localStorage.getItem('MaxKB-locale') || getBrowserLang() || 'en-US'
194194
localStorage.setItem('workspace_id', 'default')
195-
router.push({ name: 'home' })
195+
router.push({name: 'home'})
196196
})
197197
}
198198
})
@@ -275,7 +275,8 @@ function redirectAuth(authType: string) {
275275
window.location.href = url
276276
}
277277
})
278-
.catch(() => {})
278+
.catch(() => {
279+
})
279280
})
280281
}
281282
@@ -300,7 +301,7 @@ onBeforeMount(() => {
300301
loading.value = true
301302
user.asyncGetProfile().then((res) => {
302303
// 企业版和专业版:第三方登录
303-
if (hasPermission([EditionConst.IS_EE, EditionConst.IS_PE], 'OR')) {
304+
if (user.isPE() || user.isEE()) {
304305
login
305306
.getAuthType()
306307
.then((res) => {
@@ -350,10 +351,10 @@ onMounted(() => {
350351
const handleDingTalk = () => {
351352
const code = params.get('corpId')
352353
if (code) {
353-
dd.runtime.permission.requestAuthCode({ corpId: code }).then((res) => {
354+
dd.runtime.permission.requestAuthCode({corpId: code}).then((res) => {
354355
console.log('DingTalk client request success:', res)
355356
login.dingOauth2Callback(res.code).then(() => {
356-
router.push({ name: 'home' })
357+
router.push({name: 'home'})
357358
})
358359
})
359360
}
@@ -366,7 +367,7 @@ onMounted(() => {
366367
appId: appId,
367368
success: (res: any) => {
368369
login.larkCallback(res.code).then(() => {
369-
router.push({ name: 'home' })
370+
router.push({name: 'home'})
370371
})
371372
},
372373
fail: (error: any) => {
@@ -386,11 +387,11 @@ onMounted(() => {
386387
scopeList: [],
387388
success: (res: any) => {
388389
login.larkCallback(res.code).then(() => {
389-
router.push({ name: 'home' })
390+
router.push({name: 'home'})
390391
})
391392
},
392393
fail: (error: any) => {
393-
const { errno } = error
394+
const {errno} = error
394395
if (errno === 103) {
395396
callRequestAuthCode()
396397
}

ui/src/views/login/scanCompinents/larkQrCode.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<template>
22
<div class="flex-center mb-16">
3-
<img src="@/assets/scan/logo_lark.svg " alt="" width="24px" class="mr-4" />
3+
<img src="@/assets/scan/logo_lark.svg " alt="" width="24px" class="mr-4"/>
44
<h2>{{ $t('views.system.authentication.scanTheQRCode.larkQrCode') }}</h2>
55
</div>
66
<div id="lark-qr" class="lark-qrName"></div>
77
</template>
88

99
<script lang="ts" setup>
10-
import { useScriptTag } from '@vueuse/core'
11-
import { onMounted } from 'vue'
10+
import {useScriptTag} from '@vueuse/core'
11+
import {onMounted} from 'vue'
1212
13-
const { load } = useScriptTag(
13+
const {load} = useScriptTag(
1414
'https://lf-package-cn.feishucdn.com/obj/feishu-static/lark/passport/qrcode/LarkSSOSDKWebQRCode-1.0.3.js'
1515
)
16-
1716
const props = defineProps<{
1817
config: {
1918
app_secret: string
@@ -27,15 +26,13 @@ const initActive = async () => {
2726
console.error('飞书二维码 SDK 加载失败')
2827
return
2928
}
30-
3129
const data = {
3230
agentId: props.config.app_key,
3331
appSecret: props.config.app_secret
3432
}
3533
36-
const redirectUrl = encodeURIComponent(`${window.location.origin}/api/feishu`)
34+
const redirectUrl = encodeURIComponent(`${window.location.origin}/api/lark`)
3735
const url = `https://passport.feishu.cn/suite/passport/oauth/authorize?client_id=${data.agentId}&redirect_uri=${redirectUrl}&response_type=code&state=fit2cloud-lark-qr`
38-
3936
const QRLoginObj = window.QRLogin({
4037
id: 'lark-qr',
4138
goto: url,

ui/src/views/system-chat-user/authentication/component/LDAP.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<el-form-item :label="$t('views.system.password')" prop="config.password">
3131
<el-input
3232
v-model="form.config.password"
33-
:placeholder="$t('views.userManage.form.password.placeholder')"
33+
:placeholder="$t('views.login.loginForm.password.placeholder')"
3434
show-password
3535
/>
3636
</el-form-item>
@@ -120,7 +120,7 @@ const rules = reactive<FormRules<any>>({
120120
'config.password': [
121121
{
122122
required: true,
123-
message: t('views.userManage.form.password.requiredMessage'),
123+
message: t('views.login.loginForm.password.placeholder'),
124124
trigger: 'blur'
125125
}
126126
],

ui/src/views/system-setting/authentication/component/EditModal.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const open = async (platform: Platform) => {
177177
currentPlatform.config.callback_url = `${defaultCallbackUrl}/api/dingtalk`
178178
break
179179
case 'lark':
180-
currentPlatform.config.callback_url = `${defaultCallbackUrl}/api/feishu`
180+
currentPlatform.config.callback_url = `${defaultCallbackUrl}/api/lark`
181181
break
182182
default:
183183
break

ui/src/views/system-setting/authentication/component/LDAP.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<el-form-item :label="$t('views.system.password')" prop="config.password">
3131
<el-input
3232
v-model="form.config.password"
33-
:placeholder="$t('views.userManage.form.password.placeholder')"
33+
:placeholder="$t('views.login.loginForm.password.placeholder')"
3434
show-password
3535
/>
3636
</el-form-item>
@@ -120,7 +120,7 @@ const rules = reactive<FormRules<any>>({
120120
'config.password': [
121121
{
122122
required: true,
123-
message: t('views.userManage.form.password.requiredMessage'),
123+
message: t('views.login.loginForm.password.placeholder'),
124124
trigger: 'blur'
125125
}
126126
],

ui/src/views/system-setting/authentication/component/SCAN.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function createPlatform(key: string, name: string): Platform {
148148
149149
return {
150150
key,
151-
logoSrc: new URL(`../../../assets/scan/logo_${logo}.svg`, import.meta.url).href,
151+
logoSrc: new URL(`../../../../assets/scan/logo_${logo}.svg`, import.meta.url).href,
152152
name,
153153
isActive: false,
154154
isValid: false,

0 commit comments

Comments
 (0)