mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-01-03 12:05:28 +08:00
v3.7.2 版本代码合并
This commit is contained in:
@ -15,6 +15,15 @@ export const thirdAppFormSchema: FormSchema[] = [
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
label: 'CorpId',
|
||||
field: 'corpId',
|
||||
component: 'Input',
|
||||
ifShow: ({ values }) => {
|
||||
return values.thirdType === 'dingtalk';
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: 'Agentld',
|
||||
field: 'agentId',
|
||||
@ -32,12 +41,6 @@ export const thirdAppFormSchema: FormSchema[] = [
|
||||
field: 'clientSecret',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
label: 'agentAppSecret',
|
||||
field: 'agentAppSecret',
|
||||
component: 'Input',
|
||||
ifShow: false,
|
||||
},{
|
||||
label: '启用',
|
||||
field: 'status',
|
||||
|
||||
@ -21,6 +21,12 @@
|
||||
</div>
|
||||
</template>
|
||||
<div class="base-desc">完成步骤1后,填入Agentld、 AppKey、AppSecret后 可对接应用与同步通讯录</div>
|
||||
<div class="flex-flow">
|
||||
<div class="base-title">CorpId</div>
|
||||
<div class="base-message">
|
||||
<a-input-password v-model:value="appConfigData.corpId" readonly />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-flow">
|
||||
<div class="base-title">Agentld</div>
|
||||
<div class="base-message">
|
||||
|
||||
@ -82,7 +82,6 @@
|
||||
agentId: '',
|
||||
clientId: '',
|
||||
clientSecret: '',
|
||||
agentAppSecret: '',
|
||||
});
|
||||
//企业微信钉钉配置modal
|
||||
const [registerAppConfigModal, { openModal }] = useModal();
|
||||
|
||||
@ -10,6 +10,9 @@
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import { formSchema } from './fill.rule.data';
|
||||
import { saveFillRule, updateFillRule } from './fill.rule.api';
|
||||
import {useMessage} from "@/hooks/web/useMessage";
|
||||
|
||||
const { createMessage: $message } = useMessage();
|
||||
|
||||
//设置标题
|
||||
const title = computed(() => (!unref(isUpdate) ? '新增' : '编辑'));
|
||||
@ -43,6 +46,20 @@
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
let formValue = await validate();
|
||||
|
||||
// 检查参数是否合法
|
||||
let ruleParams = formValue.ruleParams;
|
||||
if (!!ruleParams) {
|
||||
ruleParams = JSON.parse(ruleParams);
|
||||
for (const key of Object.keys(ruleParams)) {
|
||||
// online 保留字检查
|
||||
if (key === 'onl_watch') {
|
||||
$message.error('参数名称不能是onl_watch');
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setModalProps({ confirmLoading: true });
|
||||
if (isUpdate.value) {
|
||||
let allFieldsValue = getFieldsValue();
|
||||
|
||||
@ -4,14 +4,17 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { isOAuth2AppEnv, sysOAuth2Login } from '/@/views/sys/login/useLogin';
|
||||
import { isOAuth2AppEnv, sysOAuth2Callback, sysOAuth2Login } from '/@/views/sys/login/useLogin';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { PageEnum } from '/@/enums/pageEnum';
|
||||
import { router } from '/@/router';
|
||||
import { useUserStore } from '/@/store/modules/user';
|
||||
import { useMessage } from '/@/hooks/web/useMessage';
|
||||
import { useI18n } from '/@/hooks/web/useI18n';
|
||||
import {getTenantId} from "/@/utils/auth";
|
||||
import { getAuthCache, getTenantId, getToken } from "/@/utils/auth";
|
||||
import { requestAuthCode } from 'dingtalk-jsapi';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import { OAUTH2_THIRD_LOGIN_TENANT_ID } from "/@/enums/cacheEnum";
|
||||
|
||||
const isOAuth = ref<boolean>(isOAuth2AppEnv());
|
||||
const env = ref<any>({ thirdApp: false, wxWork: false, dingtalk: false });
|
||||
@ -55,7 +58,8 @@
|
||||
} else if (env.value.wxWork) {
|
||||
sysOAuth2Login('wechat_enterprise');
|
||||
} else if (env.value.dingtalk) {
|
||||
sysOAuth2Login('dingtalk');
|
||||
//新版钉钉登录
|
||||
dingdingLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -84,4 +88,43 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 钉钉登录
|
||||
*/
|
||||
function dingdingLogin() {
|
||||
//先获取钉钉的企业id,如果没有配置 还是走原来的逻辑,走原来的逻辑 需要判断存不存在token,存在token直接去首页
|
||||
let tenantId = getAuthCache(OAUTH2_THIRD_LOGIN_TENANT_ID) || 0;
|
||||
let url = `/sys/thirdLogin/get/corpId/clientId?tenantId=${tenantId}`;
|
||||
//update-begin---author:wangshuai---date:2024-12-09---for:不要使用getAction online里面的,要用defHttp---
|
||||
defHttp.get({ url:url },{ isTransformResponse: false }).then((res) => {
|
||||
//update-end---author:wangshuai---date:2024-12-09---for:不要使用getAction online里面的,要用defHttp---
|
||||
if (res.success) {
|
||||
if(res.result && res.result.corpId && res.result.clientId){
|
||||
requestAuthCode({ corpId: res.result.corpId, clientId: res.result.clientId }).then((res) => {
|
||||
let { code } = res;
|
||||
sysOAuth2Callback(code);
|
||||
});
|
||||
}else{
|
||||
toOldAuthLogin();
|
||||
}
|
||||
} else {
|
||||
toOldAuthLogin();
|
||||
}
|
||||
}).catch((err) => {
|
||||
toOldAuthLogin();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 旧版钉钉登录
|
||||
*/
|
||||
function toOldAuthLogin() {
|
||||
let token = getToken();
|
||||
if (token) {
|
||||
router.replace({ path: PageEnum.BASE_HOME });
|
||||
} else {
|
||||
sysOAuth2Login('dingtalk');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user