map2d.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. ec02_pie_spouseDirection() {
  2. const chart = echarts.init($("#ec02_pie_spouseDirection")[0]);
  3. this.charts.ec02_pie_spouseDirection = chart;
  4. chart.setOption(opt_pie);
  5. chart.setOption({
  6. legend: {show: false},
  7. series: [{
  8. data: '子丑寅卯辰巳午未申酉戌亥'.split('').map((item) => {
  9. return {
  10. name: item,
  11. value: 1
  12. }
  13. }),
  14. startAngle: '105',
  15. label: {
  16. fontSize: 16 * scale,
  17. textShadowColor: '#000',
  18. textShadowBlur: .5 * scale,
  19. textShadowOffsetX: scale,
  20. textShadowOffsetY: scale,
  21. }
  22. }, {
  23. startAngle: '45',
  24. data: [
  25. {
  26. name: '',
  27. value: 30,
  28. itemStyle: {
  29. color: 'rgba(255,0,0,.33)',
  30. borderWidth: 5 * scale,
  31. borderColor: 'red',
  32. }
  33. },
  34. {name: '', value: 150, itemStyle: {color: 'transparent'}},
  35. {
  36. name: '',
  37. value: 30,
  38. itemStyle: {
  39. color: 'rgba(255,0,0,.33)',
  40. borderWidth: 5 * scale,
  41. borderColor: 'red',
  42. }
  43. },
  44. {name: '', value: 150, itemStyle: {color: 'transparent'}},
  45. ]
  46. }].map(item => {
  47. return $.extend(true, {}, seri_pie, {
  48. silent: true,
  49. label: {
  50. position: 'inside',
  51. verticalAlign: 'top'
  52. },
  53. animationEasing: 'exponentialOut',
  54. center: ['30%', '55%'],
  55. radius: [0, '76%'],
  56. }, item)
  57. })
  58. });
  59. let opt = chart.getOption();
  60. $('#spouseDirection_submit').click(function () {
  61. opt.series[1].startAngle %= 360;
  62. opt.series[1].animationDurationUpdate = 0;
  63. chart.setOption(opt);
  64. let [mon, date] = [$("#spouseDirection_input_m").val(), $("#spouseDirection_input_d").val()];
  65. if (!((mon <= 12 && mon >= 1) && (date <= 30 && date >= 1))) {
  66. alert('请输入正确的生日');
  67. return
  68. }
  69. setTimeout(function () {
  70. let num = mon - 0 + (date - 0);
  71. opt.series[1].startAngle = -(num - 1) * 30 - 105 - 1800;
  72. opt.series[1].animationDurationUpdate = 5000;
  73. chart.setOption(opt);
  74. }, 0)
  75. })
  76. },
  77. c04_bestLocation() {
  78. let indexOrder = [5, 9, 6, 7, 2, 8, 3, 4, 1];
  79. let $blocks = $(".blocks");
  80. $("#bestLocation_submit").click(function () {
  81. let direct = $('[name=direct]:checked').val();
  82. let season = $('[name=season]:checked').val();
  83. if(!$("#floorNumber").val()){
  84. alert('请输入楼层数!');
  85. return;
  86. }
  87. if(!direct){
  88. alert('请输入方位!')
  89. return;
  90. }
  91. if(!season){
  92. alert('请输入出生季节!')
  93. return;
  94. }
  95. let breakFlag = false;
  96. indexOrder.forEach(function (item, index) {
  97. if (!breakFlag) {
  98. setTimeout(function () {
  99. $blocks.find('#block' + item).addClass('active').siblings().removeClass('active');
  100. }, index * 500);
  101. if (((direct - 0 + index) % 9 || 9) === season - 0) {
  102. breakFlag = true;
  103. }
  104. }
  105. })
  106. });
  107. $("#floorNumber").change(function () {
  108. if ($(this).val() > 5) {
  109. $("#direct").text('住宅或单位')
  110. } else {
  111. $("#direct").text('小区')
  112. }
  113. })
  114. }
  115. };
  116. MapGeo.init();