1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- /*
- * 获取扩展字段
- * */
- 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,
- };
|