Commit 6960b7fe authored by wildfirecode13's avatar wildfirecode13

1

parent 74c9e59e
......@@ -9,6 +9,6 @@ module.exports ={
"IMAGE_Q1": 0.6,
"IMAGE_Q2": 0.8,
"RES_PATH": "/src/assets/",
"RES_PATH_PROD": "//yun.duiba.com.cn/spark/v2/temp_base/1633686726105",
"JS_PATH_PROD": "https://yun.duiba.com.cn/spark/v2/temp_base/1633686727993/js"
"RES_PATH_PROD": "//yun.duiba.com.cn/spark/v2/temp_base/1633775941488",
"JS_PATH_PROD": "https://yun.duiba.com.cn/spark/v2/temp_base/1633771238862/js"
}
\ No newline at end of file
export const ajaxImg = (url, data) => {
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest();
xhr.timeout = 20000;
xhr.open('post', url);
xhr.responseType = 'json';
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
if (!xhr.response) {
reject({ success: false, msg: "文件丢失" });
return;
}
resolve(xhr.response);
} else {
reject({ success: false, msg: "请求失败[" + xhr.status + "]" });
}
}
};
xhr.setRequestHeader("content-Type", "application/json");
xhr.send(data);
// console.log(data)
});
};
\ No newline at end of file
......@@ -2,7 +2,7 @@
const apiCfg = {
getRule:`projectRule.query`,
generateApproval:`/chw/cmbautologin/generateApproval`,
generateLoginUrl:`/customActivity/cmbautologin/generateLoginUrl`,
generateLoginUrl:`/chw/cmbautologin/generateLoginUrl`,
doJoin: {
uri: `join.do`,
method: "post"
......
......@@ -6,6 +6,7 @@ import "../monitor.js"; //前端错误监控
import "./app.less";
import Modal from './modal/modal';
import API from './api/index';
import { ajaxImg } from "./ajaxImg";
MD();
......@@ -17,29 +18,45 @@ class App extends Component {
const callBackUrl = 'http%3A%2F%2Factivity.m.duibatest.com.cn%2Fprojectx%2Fp19dcfe16%2Findex.html';
let activityId = CFG.projectId;
let { code, testact,iscallback,cmbdata } = queryParams;
let { code, testact, iscallback, cmbdata } = queryParams;
if (testact == 1) activityId = 'p0e63e885';
cmbdata = '%7B%22respMsg%22%3A%22%E6%93%8D%E4%BD%9C%E6%88%90%E5%8A%9F%EF%BC%81%22%2C%22mid%22%3A%221611e17549f83f6d83c77822d0bf7bef%22%2C%22state%22%3A%22state%22%2C%22cmbKeyAlias%22%3A%22SM2_CMBLIFE%22%2C%22iscallback%22%3A%221%22%2C%22respCode%22%3A%221000%22%2C%22scope%22%3A%22defaultScope%22%2C%22code%22%3A%225394c93d48144ab8806e203%22%2C%22date%22%3A%2220211008174532%22%2C%22aid%22%3A%226b9a76cce8b54060a3a31867c4c9281d%22%2C%22sign%22%3A%22MEUCIFL%2BScttTBRCZTOYcC5IhFHJ5B%5C%2FwF6oykB7LyliFpqdnAiEA5Z%5C%2FT3HyYLk2XnSWNkHgNDbpD2Fq6r5FJ9tTR3MwEBXw%3D%22%7D';
setTimeout(() => {
console.error('queryParams',JSON.stringify(queryParams));
console.error('cmbdata',decodeURIComponent(cmbdata));
console.error('queryParams', JSON.stringify(queryParams));
console.error('cmbdata', decodeURIComponent(cmbdata));
}, 1000);
if (iscallback) { //获取到code
const generateLoginUrlResult = await API.generateLoginUrl({
// const generateLoginUrlResult = await API.generateLoginUrl({
// redirectUrl: "https://activity.m.duibatest.com.cn/projectx/p19dcfe16/index.html",
// cmbData: {"respMsg":"操作成功!","mid":"1611e17549f83f6d83c77822d0bf7bef","state":"state","cmbKeyAlias":"SM2_CMBLIFE","iscallback":"1","respCode":"1000","scope":"defaultScope","code":"90a3949b9be8475cb6c6477","date":"20211009165946","aid":"6b9a76cce8b54060a3a31867c4c9281d","sign":"MEUCIDK9SphQlaB0rbpEl39bowbdsElr2NTMz1d\/VrvU+GuLAiEAn5STY+mz\/PuRQ991cCp63dPkNVR7OIaasbGSlJztFq0="},
// // cmbData: decodeURIComponent(cmbdata),
// activityId: activityId
// });
const data = {
redirectUrl: "https://activity.m.duibatest.com.cn/projectx/p19dcfe16/index.html",
cmbData: decodeURIComponent(cmbdata),
cmbData:{"respMsg":"操作成功!","mid":"1611e17549f83f6d83c77822d0bf7bef","state":"state","cmbKeyAlias":"SM2_CMBLIFE","iscallback":"1","respCode":"1000","scope":"defaultScope","code":"4a45597e466446c99d934f7","date":"20211009183758","aid":"6b9a76cce8b54060a3a31867c4c9281d","sign":"MEUCIGWsTbWb1socl\/1tS2WA7NK0emTbQXoFNqZCc1jxe+R3AiEA9bS5Opbx4CYDdqfyw3NgVm8jAU\/aeMk8OJIR0Go1b5c="},
// cmbData: decodeURIComponent(cmbdata),
activityId: activityId
});
location.href = generateLoginUrlResult.data;
};
ajaxImg(
'/chw/cmbautologin/generateLoginUrl',
JSON.stringify(data)
)
// location.href = generateLoginUrlResult.data;
} else { //没有获取到code
const protocol = 'cmblife://approval?aid=6b9a76cce8b54060a3a31867c4c9281d&callback=https%3A%2F%2Factivity.m.duibatest.com.cn%2Fprojectx%2Fp19dcfe16%2Findex.html%3Fiscallback%3D1&clientType=h5&date=20211008174119&keyAlias=CO_PUB_KEY_SM2&mid=1611e17549f83f6d83c77822d0bf7bef&random=dfcf20bc301e428db145957c672329ab&responseType=code&scope=defaultScope&sign=MEYCIQD6%2Fm6DdzezwlzQEIzXHzFKDHqBdxmkv4lopAVCsX%2FtuAIhAKR3F%2BuTsy4VVC%2B8ltsIMp%2FgMcrEJxkaoFLG468h9g2Y&state=state';
setTimeout(() => {
window.location.href = protocol;
}, 100);
setTimeout(() => {
window.location.href = protocol;
}, 100);
//请求授权协议
// const result = await API.generateApproval({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment