MenuCard.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471
  1. <template>
  2. <!-- 外边框 -->
  3. <div
  4. ref="menuCard"
  5. v-loading="dataInitLoading"
  6. element-loading-spinner="el-icon-loading"
  7. element-loading-background="rgba(0, 0, 0, 0.8)"
  8. :class="
  9. $ifLeftMenu(menuData.title != undefined ? menuData.title : '')
  10. ? 'menuMainBoxA'
  11. : 'menuMainBox'
  12. "
  13. :style="{
  14. width: menuData.boxWidth ? menuData.boxWidth + 'px' : '410px',
  15. height: menuData.boxHeight ? menuData.boxHeight + 'px' : 'auto',
  16. border:
  17. menuData.type !== 'chart' && menuData.type !== 'legend'
  18. ? ''
  19. : '1px solid #2FB8FF',
  20. background: menuData.boxBackground ? menuData.boxBackground : '',
  21. }"
  22. @click="changeMenu()"
  23. >
  24. <!-- 头部 -->
  25. <div
  26. class="menuMainBox_top"
  27. v-if="menuData.type !== 'chart' && menuData.type !== 'legend'"
  28. >
  29. <!-- 头部左侧 -->
  30. <div
  31. class="menuMainBox_top_left"
  32. :style="{
  33. width: menuData.titleWidth ? menuData.titleWidth + '%' : '50%',
  34. }"
  35. >
  36. <!-- 左侧箭头图标 -->
  37. <div
  38. class="menuMainBox_top_left_iconS"
  39. v-if="menuData.type !== 'imageMenu'"
  40. ></div>
  41. <div
  42. class="menuMainBox_top_left_iconR"
  43. v-if="menuData.type === 'imageMenu'"
  44. >
  45. <div
  46. class="menuMainBox_top_left_iconR_active"
  47. v-if="
  48. $ifLeftMenu(menuData.index != undefined ? menuData.title : '')
  49. "
  50. ></div>
  51. </div>
  52. <!-- 标题 -->
  53. <div class="menuMainBox_top_left_title">
  54. {{
  55. (menuData.beforeTitle ? $store.state[menuData.beforeTitle] : "") +
  56. menuData.title
  57. }}
  58. </div>
  59. <!-- 右侧倾斜图标1 -->
  60. <div
  61. class="menuMainBox_top_left_iconE menuMainBox_top_left_iconE1"
  62. ></div>
  63. <!-- 右侧倾斜图标2 -->
  64. <div
  65. class="menuMainBox_top_left_iconE menuMainBox_top_left_iconE2"
  66. ></div>
  67. </div>
  68. <!-- 右侧两个倾斜方框 -->
  69. <div
  70. class="menuMainBox_top_right"
  71. :style="{
  72. width: menuData.titleWidth ? 110 - menuData.titleWidth + '%' : '60%',
  73. }"
  74. >
  75. <!-- 方块1 -->
  76. <div class="menuMainBox_top_right_d1"></div>
  77. <!-- 方块2 -->
  78. <div class="menuMainBox_top_right_d2"></div>
  79. </div>
  80. <!-- 右上角三个点(蓝橙蓝) -->
  81. <div class="menuMainBox_top_topRight">
  82. <div></div>
  83. <div></div>
  84. <div></div>
  85. </div>
  86. </div>
  87. <!-- 头部下的折线 -->
  88. <div
  89. class="menuMainBox_topBottom"
  90. v-if="menuData.type !== 'chart' && menuData.type !== 'legend'"
  91. :style="{
  92. left: menuData.titleWidth
  93. ? (menuData.titleWidth <= 40
  94. ? menuData.titleWidth - 39
  95. : menuData.titleWidth - 40) + '%'
  96. : '10%',
  97. }"
  98. >
  99. <!-- 折线右上角圆球 -->
  100. <div></div>
  101. </div>
  102. <div
  103. class="menuMainBox_topChart"
  104. v-if="menuData.type === 'chart' || menuData.type === 'legend'"
  105. >
  106. <div class="menuMainBox_topChart_title">
  107. {{ menuData.title }}
  108. </div>
  109. </div>
  110. <!-- -------------------------------------------------主题------------------------------------------ -->
  111. <div class="menuMainBox_main" v-if="menuData.type === 'card'">
  112. <!-- 上部 -->
  113. <div class="menuMainBox_main_top" v-if="!menuData.topSolt">
  114. <!-- <slot name="top"> </slot> -->
  115. <TopCard
  116. v-if="menuData.commonName == 'TOP'"
  117. :dataList="menuData.topData"
  118. :columnName="menuData.field"
  119. :isScroll="menuData.isScroll ? true : false"
  120. />
  121. </div>
  122. <div class="menuMainBox_main_top" v-if="menuData.topSolt">
  123. <TagTableCard
  124. v-if="menuData.topSolt.commonName == 'TagTableCard'"
  125. :echartData="menuData.topSolt.commonData"
  126. @changeMousemoveIndex="changeMousemoveIndex"
  127. />
  128. <div
  129. class="menuCardFlex"
  130. v-if="
  131. menuData.topSolt.commonName == 'TagCard' ||
  132. menuData.topSolt.commonName == 'ALLLIST'
  133. "
  134. :style="{
  135. justifyContent:
  136. menuData.topSolt.commonData.length > 1
  137. ? 'space-between'
  138. : 'center',
  139. }"
  140. >
  141. <TagCard
  142. v-for="(item, index) in menuData.topSolt.commonData"
  143. :data="item"
  144. :index="index"
  145. :chartCardDataIndex="chartCardDataIndex"
  146. :key="item.title"
  147. @changeMousemoveIndex="changeMousemoveIndex"
  148. />
  149. </div>
  150. </div>
  151. <!-- 下部 -->
  152. <div class="menuMainBox_main_bottom" v-if="!menuData.bottomSolt">
  153. <slot name="bottom"></slot>
  154. </div>
  155. <div class="menuMainBox_main_bottom" v-if="menuData.bottomSolt">
  156. <ChartCard
  157. v-if="menuData.bottomSolt.commonName == 'ChartCard'"
  158. :title="menuData.topSolt.commonData[chartCardDataIndex].title"
  159. :categoryData="
  160. menuData.topSolt.commonData[chartCardDataIndex].categoryData
  161. "
  162. :valueData="menuData.topSolt.commonData[chartCardDataIndex].valueData"
  163. :unit="menuData.topSolt.commonData[chartCardDataIndex].unit"
  164. />
  165. </div>
  166. </div>
  167. <div
  168. class="menuMainBox_main"
  169. v-if="menuData.type === 'chart' || menuData.type === 'legend'"
  170. >
  171. <div
  172. class="menuMainBox_main_all"
  173. v-if="!menuData.topSolt && !menuData.bottomSolt"
  174. >
  175. <slot></slot>
  176. </div>
  177. </div>
  178. <div class="menuMainBox_main_image" v-if="menuData.type === 'imageMenu'">
  179. <div
  180. class="menuMainBox_main_image_box"
  181. :style="returnImageUrl(menuData.imageUrl, menuData.boxHeight)"
  182. ></div>
  183. </div>
  184. <!-- 图例属性显示区域 -->
  185. <div v-if="menuData.type === 'legend'" class="legend"></div>
  186. </div>
  187. </template>
  188. <script>
  189. /**
  190. * 模块通用组件(首页和其他页面都有用到,由于综合功能和适配场景较多,配置组合可以联系开发人员:LiuMengxiang)
  191. * @author: LiuMengxiang
  192. * @Date: 2022年11月14-18日
  193. */
  194. import TagTableCard from "@/components/common/TagTableCard.vue";
  195. import ChartCard from "@/components/common/ChartCard.vue";
  196. import TagCard from "@/components/common/TagCard.vue";
  197. import TopCard from "@/components/common/TopCard.vue";
  198. export default {
  199. name: "menuCard",
  200. components: { TagTableCard, ChartCard, TagCard, TopCard },
  201. data() {
  202. return {
  203. dataInitLoading: false,
  204. resData: [],
  205. chartCardDataIndex: 0,
  206. };
  207. },
  208. mounted() {
  209. this.$nextTick(() => {
  210. try {
  211. // 读取静态文件逻辑(commonDataGetUrl为静态文件路径,需要注意的是commonDataGetUrl属性在topSolt属性下面)
  212. if (
  213. this.menuData &&
  214. this.menuData.topSolt &&
  215. this.menuData.topSolt.commonDataGetUrl
  216. ) {
  217. this.dataInitLoading = true;
  218. this.$Get(
  219. "/static/json/home/" + this.menuData.topSolt.commonDataGetUrl
  220. ).then(
  221. (res) => {
  222. let listMap = {};
  223. let tableData = res;
  224. tableData.forEach((item) => {
  225. if (!listMap[item.name]) {
  226. // type,data
  227. let listMap2 = {};
  228. if (item.data) {
  229. item.data.forEach((item2) => {
  230. if (listMap2[item2.type]) {
  231. listMap2[item2.type]["categoryData"].push(item2.year);
  232. listMap2[item2.type]["valueData"].push(item2.area);
  233. } else {
  234. let listMapItem = {};
  235. listMapItem["categoryData"] = [item2.year];
  236. listMapItem["valueData"] = [item2.area];
  237. listMap2[item2.type] = listMapItem;
  238. }
  239. });
  240. }
  241. listMap[item.name] = listMap2;
  242. } else {
  243. console.error("json文件内容重复,重复街镇:", item.name);
  244. }
  245. });
  246. if (listMap) {
  247. let categoryData = [];
  248. for (let listMapKeys in listMap) {
  249. categoryData = listMap[listMapKeys];
  250. if (categoryData) {
  251. if (!listMap["全部"]) {
  252. listMap["全部"] = {};
  253. for (let categoryDataKeys in categoryData) {
  254. if (categoryData[categoryDataKeys]) {
  255. let categoryDataItemData =
  256. categoryData[categoryDataKeys];
  257. if (listMap["全部"][categoryDataKeys]) {
  258. categoryDataItemData.valueData.forEach(
  259. (valueIndexItem, index) => {
  260. if (
  261. listMap["全部"][categoryDataKeys].valueData[
  262. index
  263. ]
  264. ) {
  265. listMap["全部"][categoryDataKeys].valueData[
  266. index
  267. ] += Math.floor(valueIndexItem);
  268. } else {
  269. listMap["全部"][categoryDataKeys].valueData[
  270. index
  271. ] = Math.floor(valueIndexItem);
  272. }
  273. }
  274. );
  275. } else {
  276. listMap["全部"][categoryDataKeys] =
  277. categoryDataItemData;
  278. }
  279. }
  280. }
  281. }
  282. }
  283. }
  284. }
  285. this.resData = listMap;
  286. if (this.resData["全部"]) {
  287. let _index = 0;
  288. let sum = 0;
  289. for (let keys in this.resData["全部"]) {
  290. this.menuData.topSolt.commonData[_index].title = keys;
  291. this.menuData.topSolt.commonData[_index].categoryData =
  292. this.resData["全部"][keys].categoryData;
  293. this.menuData.topSolt.commonData[_index].valueData =
  294. this.resData["全部"][keys].valueData;
  295. this.menuData.topSolt.commonData[_index].value =
  296. this.resData["全部"][keys].valueData[
  297. this.resData["全部"][keys].valueData.length - 1
  298. ];
  299. sum += this.menuData.topSolt.commonData[_index].value;
  300. _index++;
  301. }
  302. }
  303. this.dataInitLoading = false;
  304. },
  305. (error) => {
  306. console.log("error:", error, this.menuData);
  307. this.dataInitLoading = false;
  308. }
  309. );
  310. } else if (
  311. this.menuData.commonName &&
  312. this.menuData.commonName === "TOP"
  313. ) {
  314. // top列表
  315. this.topData(this.$store.state.homeSpecialTown);
  316. } else if (
  317. this.menuData.commonName &&
  318. this.menuData.commonName === "ALLLIST"
  319. ) {
  320. // conut(*) group by
  321. this.allListData(this.$store.state.homeSpecialTown);
  322. } else if (
  323. this.menuData.commonName &&
  324. this.menuData.commonName === "SUM"
  325. ) {
  326. // for => conut(*) where
  327. this.sumData(this.$store.state.homeSpecialTown);
  328. } else if (this.menuData && this.menuData.columnId) {
  329. // 默认查询DMS数据逻辑
  330. this.dataInitLoading = true;
  331. let params = new FormData();
  332. params.append("columnId", this.menuData.columnId);
  333. if (this.menuData.field) {
  334. params.append("field", this.menuData.field);
  335. }
  336. if (this.menuData.states) {
  337. params.append("states", this.menuData.states);
  338. } else {
  339. params.append("states", "1,2,3,4");
  340. }
  341. params.append(
  342. "pageSize",
  343. this.menuData.pageSize ? this.menuData.pageSize : 999
  344. );
  345. params.append("page", 0);
  346. if (this.menuData.paramJson) {
  347. params.append("paramJson", JSON.stringify(this.menuData.paramJson));
  348. }
  349. if (this.menuData.sortField) {
  350. let sortparam = [
  351. {
  352. field: this.menuData.sortField.field,
  353. orderByType: this.menuData.sortField.orderByType,
  354. },
  355. ];
  356. params.append("orderBy", JSON.stringify(sortparam));
  357. }
  358. this.$Post(
  359. this.menuData.getUrl
  360. ? this.menuData.getUrl
  361. : this.urlsCollection.selectContentList,
  362. params
  363. ).then(
  364. (res) => {
  365. if (
  366. this.menuData.commonName &&
  367. this.menuData.commonName === "TOP" &&
  368. res.code === 200 &&
  369. res.content.length > 0
  370. ) {
  371. res.content.forEach((item, index) => {
  372. if (this.menuData.pageSize > index) {
  373. this.resData[index] = item;
  374. }
  375. });
  376. this.changeHomeSpecialTown();
  377. } else if (
  378. res.code === 200 &&
  379. res.content.data &&
  380. res.content.data.length > 0
  381. ) {
  382. let listMap = {};
  383. let tableData = res.content.data;
  384. tableData.forEach((item) => {
  385. if (listMap[item.street]) {
  386. listMap[item.street]["categoryData"].push(item.c_years);
  387. listMap[item.street]["valueData"].push(
  388. (item.c_float_num / 10000).toFixed(2)
  389. );
  390. } else {
  391. let listMapItem = {};
  392. listMapItem["categoryData"] = [item.c_years];
  393. listMapItem["valueData"] = [
  394. (item.c_float_num / 10000).toFixed(2),
  395. ];
  396. listMap[item.street] = listMapItem;
  397. }
  398. });
  399. if (listMap) {
  400. let categoryData = [];
  401. for (let listMapKeys in listMap) {
  402. categoryData = listMap[listMapKeys].categoryData;
  403. if (listMap[listMapKeys].valueData) {
  404. if (!listMap["全部"]) {
  405. listMap["全部"] = { valueData: [], categoryData: [] };
  406. }
  407. listMap[listMapKeys].valueData.forEach(
  408. (valueIndexItem, index) => {
  409. if (listMap["全部"].valueData[index]) {
  410. listMap["全部"].valueData[index] +=
  411. Number(valueIndexItem);
  412. } else {
  413. listMap["全部"].valueData[index] =
  414. Number(valueIndexItem);
  415. }
  416. }
  417. );
  418. }
  419. }
  420. if (
  421. listMap["全部"].categoryData.length == 0 &&
  422. categoryData.length > 0
  423. ) {
  424. listMap["全部"].categoryData = categoryData;
  425. }
  426. }
  427. if (listMap["全部"] && listMap["全部"].valueData) {
  428. listMap["全部"].valueData.forEach((item, index) => {
  429. listMap["全部"].valueData[index] = item.toFixed(2);
  430. });
  431. }
  432. this.resData = listMap;
  433. this.changeHomeSpecialTown();
  434. } else {
  435. this.resData = [];
  436. this.changeHomeSpecialTown();
  437. }
  438. this.dataInitLoading = false;
  439. },
  440. (error) => {
  441. this.resData = [];
  442. this.changeHomeSpecialTown();
  443. console.log("error:", error, this.menuData);
  444. this.dataInitLoading = false;
  445. }
  446. );
  447. }
  448. // 只有第一次创建该页面,或刷新页面时。
  449. if (this.menuData.menuIndex) {
  450. if (
  451. this.$ifMenu(this.menuData.menuIndex, this.menuData.subMenuIndex)
  452. ) {
  453. // 立即修改display为block
  454. this.$refs.menuCard.style.display = "block";
  455. setTimeout(() => {
  456. this.$refs.menuCard.style.transform = "translate(0,0)";
  457. this.$refs.menuCard.style.opacity = "0.9";
  458. });
  459. } else {
  460. // 如果不符合,页面创建时就直接隐藏
  461. this.$refs.menuCard.style.display = "none";
  462. }
  463. }
  464. // 当容器创建完成时,监听窗口改变大小时间
  465. this.$bus.$off("windowOnresize");
  466. this.$bus.$on("windowOnresize", this.windowOnresize);
  467. } catch (e) {
  468. console.log("MenuCard组件mounted出现异常", e);
  469. }
  470. });
  471. },
  472. destroy() {
  473. // 当容器销毁时,需要停止监听该事件
  474. this.$bus.$off("windowOnresize");
  475. },
  476. /**
  477. * 公共card组件,接收参数如下:
  478. * menuData =>
  479. * type: 类型【card:卡片;chart:echart组件;imageMenu:图片菜单;legend:图例】(必填)
  480. * title: 标题(必填)
  481. *
  482. * getUrl: DMS数据请求路径
  483. * columnId:DMS数据请求columnId
  484. * pageSize:DMS数据请求个数
  485. * field:DMS数据请求field
  486. * sortField=>:DMS数据请求排序配置
  487. * field:排序字段
  488. * orderByType:排序类型【1:正序,2:倒序】
  489. *
  490. * index: 子菜单index(只有当type为imageMenu时有效)(只有type为imageMenu时为必填)
  491. * imageUrl: 菜单图片地址(只有当type为imageMenu时有效)(只有type为imageMenu时为必填)
  492. *
  493. * menuIndex: 显示头部菜单对应index(显示隐藏优化,组合属性)
  494. * subMenuIndex: 显示头部菜单对应subIndex(显示隐藏优化,组合属性)
  495. * minDomWidth: 最小屏幕宽度自动隐藏【单位:Number】(显示隐藏优化,组合属性)
  496. * position: 动画位置【left\right\top\bottom】(显示隐藏优化,组合属性)
  497. *
  498. * boxWidth: 宽,默认为410px【单位:Number】(非必填)
  499. * boxHeight: 高,默认为auto【单位:Number】(非必填)
  500. * boxBackground: 背景色,默认为渐变蓝色【支持#\rgba】(非必填)
  501. * titleWidth: 标题宽度,默认为50【单位:%】(非必填)
  502. * gotoPageInfo: 动态跳转页面信息(非必填)=>{index:要跳转的菜单index,subIndex:要跳转的子菜单index,name:菜单名称}
  503. *
  504. * topSolt: 头部替换插槽组件信息(非必填)=>{commonName:组件名称,commonData:组件支撑数据,commonDataGetUrl:本地静态数据文件名,columnId:DMS远程数据columnId}
  505. * bottomSolt: 底部替换插槽组件信息(非必填)=>{commonName:组件名称,commonData:组件支撑数据}
  506. *
  507. */
  508. props: ["menuData"],
  509. methods: {
  510. sumData(homeSpecialTown) {
  511. if (this.menuData.paramJson && this.menuData.categoryData) {
  512. this.resData = [];
  513. this.dataInitLoading = true;
  514. this.menuData.topSolt.commonData[0].categoryData = [];
  515. this.menuData.topSolt.commonData[0].valueData = [];
  516. let _categoryData = this.menuData.categoryData;
  517. let _valueData = [];
  518. this.menuData.categoryData.forEach((item) => {
  519. _valueData.push(0);
  520. });
  521. this.menuData.categoryData.forEach((item, _index) => {
  522. let params = new FormData();
  523. params.append("columnId", this.menuData.columnId);
  524. if (this.menuData.field) {
  525. params.append("field", this.menuData.field);
  526. }
  527. params.append("states", "2,3");
  528. params.append(
  529. "pageSize",
  530. this.menuData.pageSize ? this.menuData.pageSize : 999
  531. );
  532. params.append("page", 0);
  533. let pramJson = {};
  534. pramJson.c_new_date = item;
  535. pramJson.sj_select = this.menuData.paramJson.sj_select;
  536. if (homeSpecialTown !== "全部") {
  537. let associatedItems =
  538. this.$store.state.selectSelectDataMap.associatedItems;
  539. if (associatedItems.length > 0) {
  540. associatedItems.forEach((item) => {
  541. if (item.name === homeSpecialTown) {
  542. pramJson.bsjz = item.index + "";
  543. }
  544. });
  545. }
  546. }
  547. params.append("paramJson", JSON.stringify(pramJson));
  548. if (this.menuData.sortField) {
  549. let sortparam = [
  550. {
  551. field: this.menuData.sortField.field,
  552. orderByType: this.menuData.sortField.orderByType,
  553. },
  554. ];
  555. params.append("orderBy", JSON.stringify(sortparam));
  556. }
  557. this.$Post(
  558. this.menuData.getUrl
  559. ? this.menuData.getUrl
  560. : this.urlsCollection.selectContentList,
  561. params
  562. ).then(
  563. (res) => {
  564. let sumField = 0;
  565. if (
  566. res.code === 200 &&
  567. res.content !== "数据为空" &&
  568. res.content.length > 0
  569. ) {
  570. res.content.forEach((contentItem) => {
  571. sumField += Number(contentItem.number);
  572. });
  573. }
  574. _valueData[Number(_index)] = sumField;
  575. this.menuData.topSolt.commonData[0].categoryData = _categoryData;
  576. this.menuData.topSolt.commonData[0].valueData = _valueData;
  577. this.menuData.topSolt.commonData[0].value =
  578. _valueData[_valueData.length - 1];
  579. this.dataInitLoading = false;
  580. },
  581. (error) => {
  582. console.log("error:", error, this.menuData);
  583. }
  584. );
  585. });
  586. }
  587. },
  588. topData(homeSpecialTown) {
  589. this.dataInitLoading = true;
  590. if (this.menuData.columnId) {
  591. let params = new FormData();
  592. params.append("columnId", this.menuData.columnId);
  593. if (this.menuData.field) {
  594. params.append("field", this.menuData.field);
  595. }
  596. params.append("states", "0,1,2,3,4");
  597. params.append(
  598. "pageSize",
  599. this.menuData.pageSize ? this.menuData.pageSize : 999
  600. );
  601. params.append("page", 0);
  602. let pramJson = {};
  603. if (this.menuData.paramJson) {
  604. if (this.menuData.paramJson.sj_select) {
  605. pramJson.sj_select = this.menuData.paramJson.sj_select;
  606. }
  607. }
  608. if (homeSpecialTown !== "全部") {
  609. let associatedItems =
  610. this.$store.state.selectSelectDataMap.associatedItems;
  611. if (associatedItems.length > 0) {
  612. associatedItems.forEach((item) => {
  613. if (item.name === homeSpecialTown) {
  614. if (this.menuData.bsjzColumnName) {
  615. pramJson.c_bsjzwt = item.index + "";
  616. } else {
  617. pramJson.bsjz = item.index + "";
  618. }
  619. }
  620. });
  621. }
  622. }
  623. params.append("paramJson", JSON.stringify(pramJson));
  624. if (this.menuData.sortField) {
  625. let sortparam = [
  626. {
  627. field: this.menuData.sortField.field,
  628. orderByType: this.menuData.sortField.orderByType,
  629. },
  630. ];
  631. params.append("orderBy", JSON.stringify(sortparam));
  632. }
  633. this.$Post(
  634. this.menuData.getUrl
  635. ? this.menuData.getUrl
  636. : this.urlsCollection.selectContentList,
  637. params
  638. ).then(
  639. (res) => {
  640. this.resData = [];
  641. if (res.code === 200 && res.content.length > 0) {
  642. res.content.forEach((item, index) => {
  643. if (this.menuData.pageSize > index) {
  644. this.resData.push(item);
  645. }
  646. });
  647. this.menuData.topData = this.resData;
  648. } else {
  649. this.resData = [];
  650. this.menuData.topData = this.resData;
  651. }
  652. this.dataInitLoading = false;
  653. },
  654. (error) => {
  655. this.resData = [];
  656. this.menuData.topData = this.resData;
  657. console.log("error:", error, this.menuData);
  658. this.dataInitLoading = false;
  659. }
  660. );
  661. } else {
  662. this.dataInitLoading = false;
  663. }
  664. },
  665. allListData(homeSpecialTown) {
  666. this.dataInitLoading = true;
  667. if (this.menuData.paramJson) {
  668. this.menuData.paramJson.sj_select.forEach(
  669. (paramSjItem, paramSjIndex) => {
  670. let params = new FormData();
  671. params.append("columnId", this.menuData.columnId);
  672. if (this.menuData.field) {
  673. params.append("field", this.menuData.field);
  674. }
  675. params.append("states", "0,1,2,3,4");
  676. params.append(
  677. "pageSize",
  678. this.menuData.pageSize ? this.menuData.pageSize : 999
  679. );
  680. params.append("page", 0);
  681. let pramJson = {};
  682. pramJson.sj_select = paramSjItem;
  683. if (homeSpecialTown !== "全部") {
  684. let associatedItems =
  685. this.$store.state.selectSelectDataMap.associatedItems;
  686. if (associatedItems.length > 0) {
  687. associatedItems.forEach((item) => {
  688. if (item.name === homeSpecialTown) {
  689. pramJson.bsjz = item.index + "";
  690. }
  691. });
  692. }
  693. }
  694. params.append("paramJson", JSON.stringify(pramJson));
  695. if (this.menuData.sortField) {
  696. let sortparam = [
  697. {
  698. field: this.menuData.sortField.field,
  699. orderByType: this.menuData.sortField.orderByType,
  700. },
  701. ];
  702. params.append("orderBy", JSON.stringify(sortparam));
  703. }
  704. this.$Post(
  705. this.menuData.getUrl
  706. ? this.menuData.getUrl
  707. : this.urlsCollection.selectContentList,
  708. params
  709. ).then(
  710. (res) => {
  711. this.resData = [];
  712. let allSum = 0;
  713. if (res.code === 200 && res.content.length > 0) {
  714. res.content.forEach((item) => {
  715. allSum += item.number;
  716. });
  717. }
  718. this.menuData.topSolt.commonData[paramSjIndex].value = allSum;
  719. this.dataInitLoading = false;
  720. },
  721. (error) => {
  722. this.menuData.topSolt.commonData[paramSjIndex].value = "--";
  723. console.log("error:", error, this.menuData);
  724. this.dataInitLoading = false;
  725. }
  726. );
  727. }
  728. );
  729. }
  730. },
  731. // 切换街镇时
  732. changeHomeSpecialTown() {
  733. try {
  734. this.dataInitLoading = true;
  735. // 如果静态文件中的数据存在,直接返回
  736. if (
  737. this.resData[this.$store.state.homeSpecialTown] &&
  738. this.menuData.topSolt &&
  739. this.menuData.topSolt.commonData
  740. ) {
  741. // 普通街道
  742. if (this.resData[this.$store.state.homeSpecialTown].categoryData) {
  743. this.menuData.topSolt.commonData[0].categoryData =
  744. this.resData[this.$store.state.homeSpecialTown].categoryData;
  745. this.menuData.topSolt.commonData[0].valueData =
  746. this.resData[this.$store.state.homeSpecialTown].valueData;
  747. this.menuData.topSolt.commonData[0].value =
  748. this.resData[this.$store.state.homeSpecialTown].valueData[
  749. this.resData[this.$store.state.homeSpecialTown].valueData
  750. .length - 1
  751. ];
  752. } else {
  753. // 全部
  754. let _index = 0;
  755. for (let keys in this.resData["全部"]) {
  756. let _commonData = {
  757. title: keys,
  758. unit: this.menuData.topSolt.commonData[_index].unit,
  759. categoryData:
  760. this.resData[this.$store.state.homeSpecialTown][keys]
  761. .categoryData,
  762. valueData:
  763. this.resData[this.$store.state.homeSpecialTown][keys]
  764. .valueData,
  765. value:
  766. this.resData[this.$store.state.homeSpecialTown][keys]
  767. .valueData[
  768. this.resData[this.$store.state.homeSpecialTown][keys]
  769. .valueData.length - 1
  770. ],
  771. };
  772. if (this.menuData.topSolt.commonData[_index].type) {
  773. _commonData.type =
  774. this.menuData.topSolt.commonData[_index].type;
  775. }
  776. this.menuData.topSolt.commonData[_index] = _commonData;
  777. _index++;
  778. }
  779. }
  780. } else if (
  781. this.menuData &&
  782. this.menuData.commonName &&
  783. this.menuData.commonName === "TOP"
  784. ) {
  785. this.topData(this.$store.state.homeSpecialTown);
  786. } else if (
  787. this.menuData &&
  788. this.menuData.commonName &&
  789. this.menuData.commonName === "SUM"
  790. ) {
  791. this.sumData(this.$store.state.homeSpecialTown);
  792. } else if (
  793. this.menuData &&
  794. this.menuData.commonName &&
  795. this.menuData.commonName === "ALLLIST"
  796. ) {
  797. this.allListData(this.$store.state.homeSpecialTown);
  798. } else if (
  799. this.menuData &&
  800. this.menuData.topSolt &&
  801. this.menuData.topSolt.commonData
  802. ) {
  803. this.menuData.topSolt.commonData.forEach((item, index) => {
  804. this.menuData.topSolt.commonData[index].categoryData = [];
  805. this.menuData.topSolt.commonData[index].valueData = [];
  806. if (this.menuData.topSolt.commonData[index].valueData) {
  807. this.menuData.topSolt.commonData[index].valueData = 0;
  808. }
  809. if (this.menuData.topSolt.commonData[index].value) {
  810. this.menuData.topSolt.commonData[index].value = 0;
  811. }
  812. });
  813. }
  814. this.dataInitLoading = false;
  815. } catch (e) {
  816. console.log("MenuCard组件changeHomeSpecialTown出现异常", e);
  817. this.dataInitLoading = false;
  818. }
  819. },
  820. // 当用户使用光标切换交互组件时触发
  821. changeMousemoveIndex(index) {
  822. if (this.chartCardDataIndex != index) {
  823. this.chartCardDataIndex = index;
  824. }
  825. },
  826. // 用户点击菜单标题时,调用全局函数,根据全局暂存对象
  827. changeMenu() {
  828. if (
  829. this.menuData != undefined &&
  830. this.menuData.index != undefined &&
  831. this.menuData.title != undefined
  832. ) {
  833. this.$store.commit("changeLeftMenuTitle", this.menuData.title);
  834. if (
  835. this.menuData.menuIndex != undefined &&
  836. this.menuData.subMenuIndex != undefined
  837. ) {
  838. this.$store.commit("changeBackMenu", {
  839. index: this.menuData.menuIndex,
  840. subIndex: this.menuData.subMenuIndex,
  841. name: this.menuData.menuName ? this.menuData.menuName : "",
  842. });
  843. }
  844. }
  845. if (
  846. this.menuData != undefined &&
  847. this.menuData.gotoPageInfo != undefined
  848. ) {
  849. this.$store.commit("changeNavSelect", this.menuData.gotoPageInfo);
  850. }
  851. },
  852. // 根据菜单imageURL和boxHeight对象自动生成元素的样式(背景以及高度)
  853. returnImageUrl(imageUrl, boxHeight) {
  854. let returnStyle = "";
  855. if (boxHeight) {
  856. returnStyle += "heihgt:" + (boxHeight - 36) + "px;";
  857. }
  858. returnStyle += "background-image: url('" + imageUrl + "');";
  859. return returnStyle;
  860. },
  861. // 组件显示隐藏时,动画样式返回。
  862. showChange() {
  863. if (this.menuData != undefined && this.menuData.menuIndex != undefined) {
  864. if (this.$ifMenu(this.menuData.menuIndex, this.menuData.subMenuIndex)) {
  865. // 立即修改display为block
  866. this.$refs.menuCard.style.display = "block";
  867. this.$refs.menuCard.style.opacity = "0";
  868. setTimeout(() => {
  869. this.$refs.menuCard.style.transform = "translate(0,0)";
  870. this.$refs.menuCard.style.opacity = "0.9";
  871. }, 300);
  872. } else {
  873. // 延迟0.3s后修改display为none
  874. this.$refs.menuCard.style.transform = this.positionTotransform();
  875. this.$refs.menuCard.style.opacity = "0";
  876. setTimeout(() => {
  877. this.$refs.menuCard.style.display = "none";
  878. }, 300);
  879. }
  880. }
  881. },
  882. // 根据组件定位,返回不同的显示隐藏动画位置
  883. positionTotransform() {
  884. switch (this.menuData.position) {
  885. case "left":
  886. return "translate(-50%,0)";
  887. case "right":
  888. return "translate(50%,0)";
  889. case "top":
  890. return "translate(0,-50%)";
  891. case "bottom":
  892. return "translate(0,50%)";
  893. default:
  894. return "translate(0,0)";
  895. }
  896. },
  897. windowOnresize(windowClient) {
  898. try {
  899. if (
  900. windowClient.windowsWidth != undefined &&
  901. this.$ifMenu(this.menuData.menuIndex, this.menuData.subMenuIndex) &&
  902. this.menuData.minDomWidth != null
  903. ) {
  904. if (
  905. this.menuData.minDomWidth < windowClient.windowsWidth &&
  906. this.$refs.menuCard != undefined &&
  907. this.$refs.menuCard.style.display == "none"
  908. ) {
  909. // 立即修改display为block
  910. this.$refs.menuCard.style.display = "block";
  911. setTimeout(() => {
  912. this.$refs.menuCard.style.transform = "translate(0,0)";
  913. this.$refs.menuCard.style.opacity = "0.9";
  914. }, 300);
  915. } else if (
  916. this.menuData.minDomWidth > windowClient.windowsWidth &&
  917. this.$refs.menuCard != undefined &&
  918. this.$refs.menuCard.style.display == "block"
  919. ) {
  920. // 延迟0.3s后修改display为none
  921. this.$refs.menuCard.style.transform = this.positionTotransform();
  922. this.$refs.menuCard.style.opacity = "0";
  923. setTimeout(() => {
  924. this.$refs.menuCard.style.display = "none";
  925. }, 300);
  926. }
  927. }
  928. } catch (error) {
  929. console.error("MenuCard组件出现异常:", error);
  930. }
  931. },
  932. },
  933. watch: {
  934. "$store.state.navSelect": {
  935. handler() {
  936. this.$nextTick(() => {
  937. this.showChange();
  938. });
  939. },
  940. deep: true,
  941. },
  942. "$store.state.homeSpecialTown": {
  943. handler() {
  944. this.$nextTick(() => {
  945. this.changeHomeSpecialTown();
  946. });
  947. },
  948. deep: true,
  949. },
  950. },
  951. };
  952. </script>
  953. <style lang="less" scoped>
  954. @borderColor: #00aaff;
  955. @borderColor32: #00aaff32;
  956. @borderColor64: #00aaff64;
  957. @topTitleBgLeft: #002645;
  958. @topTitleMinLeft: #002f56;
  959. @lightColor: #74ffff;
  960. .menuMainBox,
  961. .menuMainBoxA {
  962. transition: all 0.3s;
  963. }
  964. .menuMainBox {
  965. position: relative;
  966. z-index: 999;
  967. margin: 10px 5px;
  968. min-height: 60px;
  969. border: 2px solid transparent;
  970. border-image: --webkit-linear-gradient(to top, @borderColor, transparent) 1;
  971. border-image: --moz-linear-gradient(to top, @borderColor, transparent) 1;
  972. border-image: linear-gradient(to top, @borderColor, transparent) 1;
  973. &:hover {
  974. border-image: --webkit-linear-gradient(to top, @lightColor, transparent) 1;
  975. border-image: --moz-linear-gradient(to top, @lightColor, transparent) 1;
  976. border-image: linear-gradient(to top, @lightColor, transparent) 1;
  977. .menuMainBox_top {
  978. background-color: @lightColor;
  979. &_left {
  980. background-image: --webkit-linear-gradient(
  981. to left,
  982. @lightColor,
  983. #007dff
  984. );
  985. background-image: --moz-linear-gradient(to left, @lightColor, #007dff);
  986. background-image: linear-gradient(to left, @lightColor, #007dff);
  987. }
  988. }
  989. }
  990. cursor: pointer;
  991. -moz-user-select: none;
  992. -webkit-user-select: none;
  993. -ms-user-select: none;
  994. -khtml-user-select: none;
  995. user-select: none;
  996. // type !== chart
  997. &_top {
  998. position: relative;
  999. width: 100%;
  1000. height: 36px;
  1001. display: flex;
  1002. align-items: center;
  1003. flex-wrap: nowrap;
  1004. align-content: center;
  1005. overflow: hidden;
  1006. background-color: @topTitleMinLeft;
  1007. &_left {
  1008. position: relative;
  1009. display: flex;
  1010. align-items: center;
  1011. flex-wrap: nowrap;
  1012. align-content: center;
  1013. height: 100%;
  1014. background-image: --webkit-linear-gradient(
  1015. to left,
  1016. @topTitleMinLeft,
  1017. @borderColor,
  1018. @topTitleMinLeft
  1019. );
  1020. background-image: --moz-linear-gradient(
  1021. to left,
  1022. @topTitleMinLeft,
  1023. @borderColor,
  1024. @topTitleMinLeft
  1025. );
  1026. background-image: linear-gradient(
  1027. to left,
  1028. @topTitleMinLeft,
  1029. @borderColor,
  1030. @topTitleMinLeft
  1031. );
  1032. border-bottom: 2px solid @borderColor;
  1033. &_iconS {
  1034. margin: 10px;
  1035. width: 20px;
  1036. height: 20px;
  1037. background-image: linear-gradient(to top, #0071b2, #1deef5);
  1038. clip-path: polygon(0 0, 100% 50%, 0 100%, 30% 50%, 0 0);
  1039. }
  1040. &_iconR {
  1041. position: relative;
  1042. margin: 15px;
  1043. width: 10px;
  1044. height: 10px;
  1045. background-image: transparent;
  1046. border: 1px solid #1deef5;
  1047. border-radius: 20px;
  1048. &_active {
  1049. position: absolute;
  1050. transform: translate(-50%, -50%);
  1051. top: 50%;
  1052. left: 50%;
  1053. width: 5px;
  1054. height: 5px;
  1055. background-color: #1deef5;
  1056. border-radius: 20px;
  1057. }
  1058. }
  1059. &_title {
  1060. font-size: 28px;
  1061. font-family: YouSheBiaoTiHei;
  1062. font-weight: 400;
  1063. color: #ffffff;
  1064. }
  1065. &_iconE {
  1066. position: absolute;
  1067. margin-left: 10px;
  1068. width: 15px;
  1069. height: 30px;
  1070. background-image: linear-gradient(
  1071. to bottom,
  1072. transparent,
  1073. transparent,
  1074. #00a6c0
  1075. );
  1076. transform: skew(-45deg);
  1077. }
  1078. &_iconE1 {
  1079. right: 27px;
  1080. }
  1081. &_iconE2 {
  1082. right: 7px;
  1083. }
  1084. }
  1085. &_right {
  1086. position: absolute;
  1087. right: -10%;
  1088. height: 100%;
  1089. border-top: 2px solid @borderColor;
  1090. border-left: 2px solid @borderColor;
  1091. transform: skew(-45deg);
  1092. background-color: @topTitleBgLeft;
  1093. border-image: --webkit-linear-gradient(
  1094. to right,
  1095. @borderColor,
  1096. @topTitleBgLeft
  1097. )
  1098. 1;
  1099. border-image: --moz-linear-gradient(
  1100. to right,
  1101. @borderColor,
  1102. @topTitleBgLeft
  1103. )
  1104. 1;
  1105. border-image: linear-gradient(to right, @borderColor, @topTitleBgLeft) 1;
  1106. &_d1 {
  1107. position: absolute;
  1108. left: 10px;
  1109. width: 50px;
  1110. height: 20px;
  1111. background-color: @borderColor64;
  1112. }
  1113. &_d2 {
  1114. position: absolute;
  1115. left: 70px;
  1116. width: 80px;
  1117. height: 10px;
  1118. background-color: @borderColor32;
  1119. }
  1120. }
  1121. &_topRight {
  1122. position: absolute;
  1123. top: 0;
  1124. right: 0;
  1125. display: flex;
  1126. div:nth-child(1) {
  1127. width: 5px;
  1128. height: 2px;
  1129. background-color: @borderColor;
  1130. }
  1131. div:nth-child(2) {
  1132. margin: 0 1px;
  1133. width: 5px;
  1134. height: 2px;
  1135. background-color: #f19b56;
  1136. }
  1137. div:nth-child(3) {
  1138. width: 5px;
  1139. height: 2px;
  1140. background-color: @borderColor;
  1141. }
  1142. }
  1143. }
  1144. &:hover {
  1145. .menuMainBox_main_image_box {
  1146. background-size: 110% 220px;
  1147. }
  1148. }
  1149. }
  1150. // 选中后的样式
  1151. .menuMainBoxA {
  1152. position: relative;
  1153. z-index: 999;
  1154. margin: 10px 5px;
  1155. min-height: 60px;
  1156. border: 2px solid transparent;
  1157. border-image: --webkit-linear-gradient(to top, @lightColor, transparent) 1;
  1158. border-image: --moz-linear-gradient(to top, @lightColor, transparent) 1;
  1159. border-image: linear-gradient(to top, @lightColor, transparent) 1;
  1160. cursor: pointer;
  1161. -moz-user-select: none;
  1162. -webkit-user-select: none;
  1163. -ms-user-select: none;
  1164. -khtml-user-select: none;
  1165. user-select: none;
  1166. // type !== chart
  1167. .menuMainBox_top {
  1168. position: relative;
  1169. width: 100%;
  1170. height: 36px;
  1171. display: flex;
  1172. align-items: center;
  1173. flex-wrap: nowrap;
  1174. align-content: center;
  1175. overflow: hidden;
  1176. background-color: @lightColor;
  1177. &_left {
  1178. position: relative;
  1179. display: flex;
  1180. align-items: center;
  1181. flex-wrap: nowrap;
  1182. align-content: center;
  1183. height: 100%;
  1184. border-bottom: 2px solid @borderColor;
  1185. background-image: --webkit-linear-gradient(to left, @lightColor, #007dff);
  1186. background-image: --moz-linear-gradient(to left, @lightColor, #007dff);
  1187. background-image: linear-gradient(to left, @lightColor, #007dff);
  1188. &_iconS {
  1189. margin: 10px;
  1190. width: 20px;
  1191. height: 20px;
  1192. background-image: linear-gradient(to top, #0071b2, #1deef5);
  1193. clip-path: polygon(0 0, 100% 50%, 0 100%, 30% 50%, 0 0);
  1194. }
  1195. &_iconR {
  1196. position: relative;
  1197. margin: 15px;
  1198. width: 10px;
  1199. height: 10px;
  1200. background-image: transparent;
  1201. border: 1px solid #1deef5;
  1202. border-radius: 20px;
  1203. &_active {
  1204. position: absolute;
  1205. transform: translate(-50%, -50%);
  1206. top: 50%;
  1207. left: 50%;
  1208. width: 5px;
  1209. height: 5px;
  1210. background-color: #1deef5;
  1211. border-radius: 20px;
  1212. }
  1213. }
  1214. &_title {
  1215. font-size: 28px;
  1216. font-family: YouSheBiaoTiHei;
  1217. font-weight: 400;
  1218. color: #ffffff;
  1219. }
  1220. &_iconE {
  1221. position: absolute;
  1222. margin-left: 10px;
  1223. width: 15px;
  1224. height: 30px;
  1225. background-image: linear-gradient(
  1226. to bottom,
  1227. transparent,
  1228. transparent,
  1229. #00a6c0
  1230. );
  1231. transform: skew(-45deg);
  1232. }
  1233. &_iconE1 {
  1234. right: 27px;
  1235. }
  1236. &_iconE2 {
  1237. right: 7px;
  1238. }
  1239. }
  1240. &_right {
  1241. position: absolute;
  1242. right: -10%;
  1243. height: 100%;
  1244. border-top: 2px solid @borderColor;
  1245. border-left: 2px solid @borderColor;
  1246. transform: skew(-45deg);
  1247. background-color: @topTitleBgLeft;
  1248. border-image: --webkit-linear-gradient(
  1249. to right,
  1250. @borderColor,
  1251. @topTitleBgLeft
  1252. )
  1253. 1;
  1254. border-image: --moz-linear-gradient(
  1255. to right,
  1256. @borderColor,
  1257. @topTitleBgLeft
  1258. )
  1259. 1;
  1260. border-image: linear-gradient(to right, @borderColor, @topTitleBgLeft) 1;
  1261. &_d1 {
  1262. position: absolute;
  1263. left: 10px;
  1264. width: 50px;
  1265. height: 20px;
  1266. background-color: @borderColor64;
  1267. }
  1268. &_d2 {
  1269. position: absolute;
  1270. left: 70px;
  1271. width: 80px;
  1272. height: 10px;
  1273. background-color: @borderColor32;
  1274. }
  1275. }
  1276. &_topRight {
  1277. position: absolute;
  1278. top: 0;
  1279. right: 0;
  1280. display: flex;
  1281. div:nth-child(1) {
  1282. width: 5px;
  1283. height: 2px;
  1284. background-color: @borderColor;
  1285. }
  1286. div:nth-child(2) {
  1287. margin: 0 1px;
  1288. width: 5px;
  1289. height: 2px;
  1290. background-color: #f19b56;
  1291. }
  1292. div:nth-child(3) {
  1293. width: 5px;
  1294. height: 2px;
  1295. background-color: @borderColor;
  1296. }
  1297. }
  1298. }
  1299. &:hover {
  1300. .menuMainBox_main_image_box {
  1301. background-size: 110% 220px;
  1302. }
  1303. }
  1304. }
  1305. // 公共样式
  1306. .menuMainBox_topBottom {
  1307. position: absolute;
  1308. top: 20px;
  1309. width: 38%;
  1310. height: 20px;
  1311. border-bottom: 2px solid @borderColor;
  1312. border-right: 2px solid @borderColor;
  1313. transform: skew(-45deg);
  1314. border-image: --webkit-linear-gradient(to left, @borderColor, transparent) 1;
  1315. border-image: --moz-linear-gradient(to left, @borderColor, transparent) 1;
  1316. border-image: linear-gradient(to left, @borderColor, transparent) 1;
  1317. z-index: 9999;
  1318. div {
  1319. position: absolute;
  1320. top: -2px;
  1321. right: -2px;
  1322. width: 4px;
  1323. height: 4px;
  1324. border-radius: 4px;
  1325. background-color: @borderColor;
  1326. transform: skew(45deg);
  1327. }
  1328. }
  1329. // type === chart
  1330. .menuMainBox_topChart {
  1331. width: 100%;
  1332. height: 36px;
  1333. position: relative;
  1334. display: flex;
  1335. align-items: center;
  1336. flex-wrap: nowrap;
  1337. justify-content: center;
  1338. align-content: center;
  1339. background-image: --webkit-linear-gradient(
  1340. to left,
  1341. @topTitleMinLeft,
  1342. @borderColor,
  1343. @topTitleMinLeft
  1344. );
  1345. background-image: --moz-linear-gradient(
  1346. to left,
  1347. @topTitleMinLeft,
  1348. @borderColor,
  1349. @topTitleMinLeft
  1350. );
  1351. background-image: linear-gradient(
  1352. to left,
  1353. @topTitleMinLeft,
  1354. @borderColor,
  1355. @topTitleMinLeft
  1356. );
  1357. &_title {
  1358. font-size: 18px;
  1359. font-family: PingFang SC;
  1360. font-weight: 300;
  1361. color: #e6e6e6;
  1362. line-height: 60px;
  1363. }
  1364. }
  1365. // 卡片主题
  1366. .menuMainBox_main {
  1367. position: relative;
  1368. padding-top: 10px;
  1369. width: 100%;
  1370. height: calc(100% - 36px);
  1371. background-image: --webkit-linear-gradient(
  1372. to top,
  1373. @topTitleMinLeft,
  1374. @topTitleBgLeft
  1375. );
  1376. background-image: --moz-linear-gradient(
  1377. to top,
  1378. @topTitleMinLeft,
  1379. @topTitleBgLeft
  1380. );
  1381. background-image: linear-gradient(to top, @topTitleMinLeft, @topTitleBgLeft);
  1382. box-sizing: border-box;
  1383. overflow-x: hidden;
  1384. overflow-y: auto;
  1385. scrollbar-width: none; /* Firefox */
  1386. -ms-overflow-style: none; /* IE 10+ */
  1387. &::-webkit-scrollbar {
  1388. display: none; /* Chrome Safari */
  1389. }
  1390. &_top {
  1391. margin: 0 10px;
  1392. width: calc(100% - 20px);
  1393. }
  1394. &_bottom {
  1395. margin: 0 10px;
  1396. width: calc(100% - 20px);
  1397. }
  1398. &_all {
  1399. margin: 0 10px;
  1400. width: calc(100% - 20px);
  1401. height: calc(100% - 10px);
  1402. }
  1403. &_image {
  1404. margin: 0px 10px;
  1405. width: calc(100% - 20px);
  1406. height: 210px;
  1407. background-size: 100% 200px;
  1408. background-repeat: no-repeat;
  1409. }
  1410. }
  1411. // 卡片主题
  1412. .menuMainBox_main_image {
  1413. position: relative;
  1414. margin: 0;
  1415. width: 100%;
  1416. height: calc(100% - 30px);
  1417. &_box {
  1418. width: 100%;
  1419. height: 200px;
  1420. background-size: 100% 200px;
  1421. background-repeat: no-repeat;
  1422. transition: all 0.3s;
  1423. }
  1424. }
  1425. // 图例上部图片
  1426. .legend {
  1427. position: absolute;
  1428. left: -2px;
  1429. top: -13px;
  1430. width: 104px;
  1431. height: 20px;
  1432. background: url("../../assets/home/legend_line.png") no-repeat center;
  1433. }
  1434. // tagcard
  1435. .menuCardFlex {
  1436. display: flex;
  1437. align-content: center;
  1438. align-items: center;
  1439. justify-content: space-between;
  1440. flex-wrap: nowrap;
  1441. position: relative;
  1442. .borders {
  1443. position: absolute;
  1444. left: 50%;
  1445. top: 50%;
  1446. transform: translate(-50%, -50%) rotate(45deg);
  1447. width: 110px;
  1448. height: 100px;
  1449. background: linear-gradient(to left, @borderColor, @borderColor) left top
  1450. no-repeat,
  1451. linear-gradient(to bottom, @borderColor, @borderColor) left top no-repeat,
  1452. linear-gradient(to left, @borderColor, @borderColor) right top no-repeat,
  1453. linear-gradient(to bottom, @borderColor, @borderColor) right top no-repeat,
  1454. linear-gradient(to left, @borderColor, @borderColor) left bottom no-repeat,
  1455. linear-gradient(to bottom, @borderColor, @borderColor) left bottom
  1456. no-repeat,
  1457. linear-gradient(to left, @borderColor, @borderColor) right bottom
  1458. no-repeat,
  1459. linear-gradient(to left, @borderColor, @borderColor) right bottom
  1460. no-repeat;
  1461. background-size: 6px 6px, 6px 6px, 6px 6px, 6px 6px;
  1462. }
  1463. }
  1464. </style>