提交 2db1ce5d authored 作者: 钟是志's avatar 钟是志

Merge remote-tracking branch 'origin/master'

...@@ -5,7 +5,8 @@ import React, {Component} from 'react'; ...@@ -5,7 +5,8 @@ import React, {Component} from 'react';
import {checkIsImage} from '@/webPublic/one_stop_public/libs/UploadCom'; import {checkIsImage} from '@/webPublic/one_stop_public/libs/UploadCom';
import { getModal, getPopconfirm, isFromIframe } from '@/webPublic/one_stop_public/utils/utils'; import { getModal, getPopconfirm, isFromIframe } from '@/webPublic/one_stop_public/utils/utils';
const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer'); // const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer');
const FileViewer = null;
const Modal = getModal(); const Modal = getModal();
const Popconfirm = getPopconfirm(); const Popconfirm = getPopconfirm();
...@@ -130,12 +131,12 @@ export default class index extends Component { ...@@ -130,12 +131,12 @@ export default class index extends Component {
<a onClick={this.download}> <a onClick={this.download}>
下载文件 下载文件
</a> </a>
{FileViewer && ( {/* {FileViewer && (
<FileViewer <FileViewer
fileType={type} fileType={type}
filePath={path} filePath={path}
/> />
)} )}*/}
</div> </div>
)} )}
</Modal> </Modal>
......
...@@ -6,6 +6,7 @@ import styles from "./style.less"; ...@@ -6,6 +6,7 @@ import styles from "./style.less";
import { checkIsImage } from "./UploadCom"; import { checkIsImage } from "./UploadCom";
import Viewer from "react-viewer"; import Viewer from "react-viewer";
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
// 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样 // 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样
...@@ -101,6 +102,7 @@ export default class UploadComDiyForQnZy extends React.Component { ...@@ -101,6 +102,7 @@ export default class UploadComDiyForQnZy extends React.Component {
name: "file", name: "file",
multiple: isMultiple, multiple: isMultiple,
accept: accept, accept: accept,
...getHeaders(),
action: config.uploadUrl, action: config.uploadUrl,
showUploadList: false, showUploadList: false,
onChange: this.changeUrl, onChange: this.changeUrl,
......
...@@ -8,6 +8,7 @@ import { delCookie, setCookie } from '@/webPublic/one_stop_public/utils/cookie'; ...@@ -8,6 +8,7 @@ import { delCookie, setCookie } from '@/webPublic/one_stop_public/utils/cookie';
export function setToken(value, time) { export function setToken(value, time) {
if (getToken() !== value) { if (getToken() !== value) {
setCookie('token', value); setCookie('token', value);
sessionStorage.removeItem('cacheMobile');
localStorage.setItem('antd-pro-token-onestop', value); localStorage.setItem('antd-pro-token-onestop', value);
localStorage.setItem('antd-pro-token', value); localStorage.setItem('antd-pro-token', value);
localStorage.setItem('wisdom-school-token', value); localStorage.setItem('wisdom-school-token', value);
......
/**
*
* 一站式请勿使用此组件
* 2020年5月9日 拖拽组件
* 钟是志
* 黔南的 录取通知书打印 位置设置
* */
import React, { Fragment, Component } from 'react';
import styles from './index.less';
import { message } from 'antd';
import ButtonDiy from '@/baseComponent/ButtonDiy';
import Shell from '@/baseComponent/Shell';
import { ModalConfirm } from '@/baseComponent/Modal';
let startX = 0;
let startY = 0;
export default class FormatSetting extends Component {
constructor() {
super();
document.onmousedown = function(evt) {
startX = evt.offsetX;
startY = evt.offsetY;
};
}
dragEventList = () => {
const { updateFormatSettingObject } = this.props;
let draggedRef = null;
document.addEventListener(
'dragstart',
function(event) {
// 保存拖动元素的引用(ref.)
draggedRef = event.target;
// 使其半透明
event.target.style.opacity = 0.5;
},
false,
);
document.addEventListener(
'dragend',
function(event) {
// 重置透明度
event.target.style.opacity = '';
},
false,
);
/* 放下目标节点时触发事件 */
document.addEventListener(
'dragover',
function(event) {
// 阻止默认动作
event.preventDefault();
},
false,
);
document.addEventListener(
'drop',
function(event) {
// 阻止默认动作(如打开一些元素的链接)
event.preventDefault();
// 将拖动的元素到所选择的放置目标节点中
let infoClientRect = document.getElementById('dropZone').getBoundingClientRect();
let leftNew = Math.ceil(event.clientX - infoClientRect.left) - startX;
let topNew = Math.ceil(event.clientY - infoClientRect.top) - startY;
if (
leftNew < 0 ||
leftNew > infoClientRect.width ||
topNew < 0 ||
topNew > infoClientRect.height
) {
message.warn('拖拽到了图片区域外部!');
return false;
} else {
console.log(leftNew, topNew);
}
if (event.target.id === 'dropZone') {
// const left = event.offsetX;
// const top = event.offsetY;
updateFormatSettingObject(draggedRef.id, leftNew, topNew);
draggedRef.style.left = leftNew; // `${left}px`;
draggedRef.style.top = topNew; // `${top}px`;
}
},
false,
);
};
componentDidMount() {
this.dragEventList();
}
initConfig = () => {
ModalConfirm('您确定初始化打印录取通知书格式吗?', {
onOk: () => {
this.props.initConfig();
},
});
};
render() {
const { bgImage, formatSettingObject, saveConfig } = this.props;
return (
<Fragment>
<Shell
styleShell={{
marginTop: '0',
marginBottom: '20px',
}}>
<div
style={{
height: '54px',
padding: '12px 0 12px 12px',
}}>
<ButtonDiy name="保存" className="primary" handleClick={saveConfig} />
<ButtonDiy name={'初始化格式'} handleClick={this.initConfig} />
</div>
</Shell>
<div className={styles.outSideDiv}>
<div>
<img
src={bgImage}
id={'dropZone'}
draggable={false}
className={styles.bgimage}
alt={'背景图'}
/>
{formatSettingObject.map((x, index) => {
return (
<div
draggable={true}
className={styles.inSideItem}
key={index}
id={x.name}
style={x.style}>
{x.name}
</div>
);
})}
</div>
</div>
</Fragment>
);
}
}
/***
* formatSettingObject: {
* content_set: {
* font: "宋体"
isNeedConfig: true
key: "JjqCiRYamxs"
name: "content_set"
size: "12"
style: {top: 300, left: 50}
title: "--详细内容--"
* }
* }
*
* */
...@@ -148,8 +148,8 @@ export default function request( ...@@ -148,8 +148,8 @@ export default function request(
} }
const defaultOptions = { const defaultOptions = {
// credentials: 'omit', // credentials: 'omit', // 确保浏览器不在请求中包含凭据
credentials: 'include', credentials: 'include', // 为了让浏览器发送包含凭据的请求(即使是跨域源)
mode: 'cors', mode: 'cors',
}; };
let newOptions = { ...defaultOptions, ...options }; let newOptions = { ...defaultOptions, ...options };
......
...@@ -5,88 +5,91 @@ import { getInfo } from '@/highOrderComponent/Service'; ...@@ -5,88 +5,91 @@ import { getInfo } from '@/highOrderComponent/Service';
import { Divider } from 'antd'; import { Divider } from 'antd';
import config from '@/config/config'; import config from '@/config/config';
import { import {
setSysConfig, setSysConfig,
getSysConfig as getSysConfigLocalStorage, getSysConfig as getSysConfigLocalStorage,
} from '@/webPublic/zyd_private/utils/basiclayout'; } from '@/webPublic/zyd_private/utils/basiclayout';
import { getOneStopConfig } from '@/webPublic/zyd_public/utils/utils'; import { getOneStopConfig } from '@/webPublic/zyd_public/utils/utils';
function formatUploadFile(fileList) { function formatUploadFile(fileList) {
if (!fileList || !Array.isArray(fileList)) return []; if (!fileList || !Array.isArray(fileList)) return [];
return JSON.stringify( return JSON.stringify(
fileList.map((i) => ({ fileList.map((i) => ({
uid: i.uid, uid: i.uid,
name: i.name, name: i.name,
status: i.status, status: i.status,
url: i.filePath || i.response.filePath, url: i.filePath || i.response.filePath,
})), })),
); );
} }
export const valueTypes = { export const valueTypes = {
0: { 0: {
name: '文本', name: '文本',
inputComponent: 'input', inputComponent: 'input',
}, },
1: { 1: {
name: '文件', name: '文件',
inputComponent: 'upload', inputComponent: 'upload',
formatToServer: formatUploadFile, // 新增或保存时候转换格式 formatToServer: formatUploadFile, // 新增或保存时候转换格式
formatToEdit: (str) => { formatToEdit: (str) => {
const fileArr = JSON.parse(str); const fileArr = JSON.parse(str);
if (!Array.isArray(fileArr)) return []; if (!Array.isArray(fileArr)) return [];
return fileArr; return fileArr;
}, // 编辑时,转换成可以在表单回显的格式 }, // 编辑时,转换成可以在表单回显的格式
render: (val) => { render: (val) => {
// 在列表上的显示方式 // 在列表上的显示方式
return JSON.parse(val).map((item, i) => ( return JSON.parse(val)
<> .map((item, i) => (
{i > 0 && <Divider type="vertical" />} <>
<a {i > 0 && <Divider type="vertical"/>}
target="_blank" <a
rel="noopener noreferrer" target="_blank"
key={item.uid} rel="noopener noreferrer"
href={item.url && (item.url.startsWith('http') ? item.url : config.dfs + item.url)}> key={item.uid}
{item.name} href={item.url && (item.url.startsWith('http') ? item.url : config.dfs + item.url)}>
</a> {item.name}
</> </a>
)); </>
}, ));
}, },
2: { },
name: '富文本', 2: {
inputComponent: 'input', name: '富文本',
}, inputComponent: 'input',
},
}; };
export function getSysConfig() { export function getSysConfig() {
return getInfo({ pageSize: 10000 }, '/WebConfigApi/getPage?oauthPub=true').then((res) => { return getInfo({ pageSize: 10000 }, '/WebConfigApi/getPage?oauthPub=true')
if (res && res.rows && res.rows.length) { .then((res) => {
const formattered = res.rows.reduce((acc, cur) => { if (res && res.rows && res.rows.length) {
console.log(valueTypes, cur.valueType); const formattered = res.rows.reduce((acc, cur) => {
let index = cur.valueType || '0'; console.log(valueTypes, cur.valueType);
const { formatToEdit } = valueTypes[index]; let index = cur.valueType || '0';
let { value } = cur; const { formatToEdit } = valueTypes[index];
if (formatToEdit && typeof formatToEdit === 'function') { let { value } = cur;
value = formatToEdit(value); if (formatToEdit && typeof formatToEdit === 'function') {
} value = formatToEdit(value);
return { }
...acc, return {
[cur.dictCode]: value, ...acc,
}; [cur.dictCode]: value,
}, {}); };
setSysConfig(formattered); }, {});
return formattered; setSysConfig(formattered);
} return formattered;
}); }
});
} }
export default async function setTokenAndInitSystem() {
let token = getUrlInfo().token;
if (token && token.length > 10 && getToken() !== token) {
return new Promise((resolve, reject) => {
resolve(Promise.all([setToken(token), getSysConfig(), getOneStopConfig()]));
});
}
return new Promise((resolve, reject) => {
resolve(true);
});
export default function setTokenAndInitSystem() {
let token = getUrlInfo().token;
if (token && token.length > 10 && getToken() !== token) {
setToken(token);
}
if (!getSysConfigLocalStorage()) {
getSysConfig();
}
getOneStopConfig();
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论