|
@@ -1,75 +1,71 @@
|
|
|
/*
|
|
|
-* 获取扩展字段
|
|
|
-* */
|
|
|
+ * 获取扩展字段
|
|
|
+ * */
|
|
|
const getExtInfo = (item) => {
|
|
|
- const { componentExtInfo } = item;
|
|
|
- return componentExtInfo || {};
|
|
|
+ const { componentExtInfo } = item;
|
|
|
+ return componentExtInfo || {};
|
|
|
};
|
|
|
|
|
|
/*
|
|
|
-* 获取消息列表
|
|
|
-* */
|
|
|
+ * 获取消息列表
|
|
|
+ * */
|
|
|
const getNotifyList = (item) => {
|
|
|
- const { serviceList = [] } = item;
|
|
|
- return serviceList;
|
|
|
+ const { serviceList = [] } = item;
|
|
|
+ return serviceList;
|
|
|
};
|
|
|
|
|
|
const msgClass = (item, showMsg) => {
|
|
|
- const { length } = getNotifyList(item);
|
|
|
- return !length || !showMsg ? ' no-msg' : '';
|
|
|
+ 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 { 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 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 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 { desc } = getExtInfo(item);
|
|
|
+ return desc || "了解本院特色";
|
|
|
};
|
|
|
|
|
|
const getTitle = (item) => {
|
|
|
- const { title } = getExtInfo(item);
|
|
|
- return title || '首页';
|
|
|
+ const { title } = getExtInfo(item);
|
|
|
+ return title || "";
|
|
|
};
|
|
|
|
|
|
export default {
|
|
|
- msgClass,
|
|
|
- getTitle,
|
|
|
- getBgStyle,
|
|
|
- getExtInfo,
|
|
|
- getStyleMode,
|
|
|
- getNotifyList,
|
|
|
- getSubTitle,
|
|
|
+ msgClass,
|
|
|
+ getTitle,
|
|
|
+ getBgStyle,
|
|
|
+ getExtInfo,
|
|
|
+ getStyleMode,
|
|
|
+ getNotifyList,
|
|
|
+ getSubTitle,
|
|
|
};
|