123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /*
- * 获取扩展字段
- * */
- const getExtInfo = (item) => {
- const { componentExtInfo } = item;
- return componentExtInfo || {};
- };
- /*
- * 获取消息列表
- * */
- const getNotifyList = (item) => {
- const { serviceList = [] } = item;
- return serviceList;
- };
- const msgClass = (item, showMsg) => {
- const { length } = getNotifyList(item);
- return !length || !showMsg ? ' no-msg' : '';
- };
- /*
- * 获取样式
- * */
- const getStyleMode = (item) => {
- const {
- icon,
- styleMode = 'a',
- } = getExtInfo(item);
- /*
- * 三种模式
- * */
- const modes = {
- a: 'head-a',
- b: 'head-b',
- c: 'head-c',
- };
- return icon ? 'head-custom' : modes[styleMode];
- };
- const getImgUrl = (url, prefix) => (
- url.length === 32 ? `${prefix}${url}` : url
- );
- const getBgStyle = (item, imgSrcPrefix) => {
- const styles = [];
- const { icon } = getExtInfo(item);
- if (icon) {
- styles.push(`background-image:url(${getImgUrl(icon, imgSrcPrefix)})`);
- }
- return styles.join(';');
- };
- /*
- * 获取二级标题
- * */
- const getSubTitle = (item) => {
- const { desc } = getExtInfo(item);
- return desc || '了解本院特色';
- };
- const getTitle = (item) => {
- const { title } = getExtInfo(item);
- return title || '首页';
- };
- export default {
- msgClass,
- getTitle,
- getBgStyle,
- getExtInfo,
- getStyleMode,
- getNotifyList,
- getSubTitle,
- };
|