New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9 10V44H39V10H9Z" fill="none" stroke="#fff" stroke-width="4" stroke-linejoin="round"/><path d="M20 20V33" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M28 20V33" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M4 10H44" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M16 10L19.289 4H28.7771L32 10H16Z" fill="none" stroke="#fff" stroke-width="4" stroke-linejoin="round"/></svg> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> |
| | | <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="300px" height="300px" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| | | <g><path style="opacity:0.245" fill="#bfcadf" d="M 180.5,43.5 C 181.552,43.3505 182.552,43.5172 183.5,44C 186.713,48.2579 190.047,52.4246 193.5,56.5C 190.136,60.6986 186.302,64.3653 182,67.5C 177.833,64.6667 174.333,61.1667 171.5,57C 174.628,52.5742 177.628,48.0742 180.5,43.5 Z"/></g> |
| | | <g><path style="opacity:0.991" fill="#c1d1e2" d="M 57.5,51.5 C 61.5586,53.7205 64.8919,56.8872 67.5,61C 64.5,63.5 61.5,66 58.5,68.5C 55.6314,66.4659 53.2981,63.9659 51.5,61C 53.3134,57.6926 55.3134,54.526 57.5,51.5 Z"/></g> |
| | | <g><path style="opacity:0.991" fill="#c1d1e2" d="M 101.5,78.5 C 105.559,80.7205 108.892,83.8872 111.5,88C 108.5,90.5 105.5,93 102.5,95.5C 99.6314,93.4659 97.2981,90.9659 95.5,88C 97.3134,84.6926 99.3134,81.526 101.5,78.5 Z"/></g> |
| | | <g><path style="opacity:0.355" fill="#c0cddf" d="M 210.5,81.5 C 211.496,81.4142 212.329,81.7476 213,82.5C 214.515,84.6772 216.015,86.8439 217.5,89C 216.037,91.6312 214.037,93.7979 211.5,95.5C 208.963,93.7979 206.963,91.6312 205.5,89C 207.295,86.5742 208.962,84.0742 210.5,81.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#d9e2ee" d="M 195.5,94.5 C 192.443,96.3951 190.277,99.0618 189,102.5C 188.212,108.582 188.379,114.582 189.5,120.5C 189.5,141.833 189.5,163.167 189.5,184.5C 212.696,188.344 235.029,195.01 256.5,204.5C 256.649,205.552 256.483,206.552 256,207.5C 251.328,207.304 246.995,206.97 243,206.5C 242,207.167 241,207.833 240,208.5C 226.713,207.509 213.213,207.509 199.5,208.5C 198.006,208.291 196.839,207.624 196,206.5C 195.374,208.991 194.541,208.991 193.5,206.5C 188.433,207.479 183.599,207.479 179,206.5C 178,207.167 177,207.833 176,208.5C 174.333,208.5 172.667,208.5 171,208.5C 169.933,207.809 168.766,207.309 167.5,207C 168.5,206.167 169.5,205.333 170.5,204.5C 170.376,203.893 170.043,203.56 169.5,203.5C 166.558,199.277 164.391,194.61 163,189.5C 162.393,185.463 162.56,181.463 163.5,177.5C 139.994,177.831 116.661,177.498 93.5,176.5C 95.8333,176.5 98.1667,176.5 100.5,176.5C 100.333,154.497 100.5,132.497 101,110.5C 101.927,102.239 106.427,97.0718 114.5,95C 141.498,94.5 168.498,94.3334 195.5,94.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#ccd9ed" d="M 195.5,94.5 C 200.048,94.1994 203.215,96.1994 205,100.5C 207.128,106.991 207.961,113.658 207.5,120.5C 201.5,120.5 195.5,120.5 189.5,120.5C 188.379,114.582 188.212,108.582 189,102.5C 190.277,99.0618 192.443,96.3951 195.5,94.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#fbfcfd" d="M 121.5,116.5 C 126.989,116.504 128.822,119.171 127,124.5C 122.791,127.596 119.958,126.596 118.5,121.5C 119.092,119.577 120.092,117.911 121.5,116.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#fefefe" d="M 140.5,117.5 C 150.172,117.334 159.839,117.5 169.5,118C 172.167,120.333 172.167,122.667 169.5,125C 159.833,125.667 150.167,125.667 140.5,125C 137.88,122.441 137.88,119.941 140.5,117.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#fcfdfd" d="M 120.5,134.5 C 127.486,134.331 129.153,137.164 125.5,143C 121.229,144.513 118.895,143.013 118.5,138.5C 118.752,136.927 119.418,135.594 120.5,134.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#fcfdfe" d="M 140.5,134.5 C 150.172,134.334 159.839,134.5 169.5,135C 172.167,137.667 172.167,140.333 169.5,143C 159.833,143.667 150.167,143.667 140.5,143C 137.899,140.17 137.899,137.337 140.5,134.5 Z"/></g> |
| | | <g><path style="opacity:0.245" fill="#bfcadf" d="M 46.5,145.5 C 47.552,145.351 48.552,145.517 49.5,146C 52.7132,150.258 56.0465,154.425 59.5,158.5C 56.1356,162.699 52.3023,166.365 48,169.5C 43.8333,166.667 40.3333,163.167 37.5,159C 40.6283,154.574 43.6283,150.074 46.5,145.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#fcfdfe" d="M 120.5,152.5 C 127.486,152.331 129.153,155.164 125.5,161C 118.946,160.957 117.279,158.123 120.5,152.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#fefefe" d="M 140.5,152.5 C 150.172,152.334 159.839,152.5 169.5,153C 171.648,155.075 171.982,157.408 170.5,160C 160.167,160.667 149.833,160.667 139.5,160C 138.083,157.257 138.416,154.757 140.5,152.5 Z"/></g> |
| | | <g><path style="opacity:0.248" fill="#bfcadf" d="M 238.5,157.5 C 240.39,157.297 241.89,157.963 243,159.5C 246.233,163.063 249.067,166.896 251.5,171C 248.223,175.064 244.39,178.564 240,181.5C 235.833,178.667 232.333,175.167 229.5,171C 232.733,166.611 235.733,162.111 238.5,157.5 Z"/></g> |
| | | <g><path style="opacity:1" fill="#ccd9ed" d="M 93.5,176.5 C 116.661,177.498 139.994,177.831 163.5,177.5C 162.56,181.463 162.393,185.463 163,189.5C 164.391,194.61 166.558,199.277 169.5,203.5C 159.833,203.5 150.167,203.5 140.5,203.5C 136.167,203.5 131.833,203.5 127.5,203.5C 118.143,203.832 108.81,203.498 99.5,202.5C 96.2675,198.112 93.6009,193.446 91.5,188.5C 90.9106,184.029 91.5772,180.029 93.5,176.5 Z"/></g> |
| | | <g><path style="opacity:0.31" fill="#d9e2ec" d="M 91.5,188.5 C 93.6009,193.446 96.2675,198.112 99.5,202.5C 108.81,203.498 118.143,203.832 127.5,203.5C 122.102,205.74 116.435,207.407 110.5,208.5C 97.4696,207.361 84.4696,207.361 71.5,208.5C 70.0055,208.291 68.8388,207.624 68,206.5C 67.3741,208.991 66.5407,208.991 65.5,206.5C 62.5395,206.865 59.3728,207.532 56,208.5C 51.6667,207.167 47.3333,207.167 43,208.5C 41.6976,207.915 40.531,207.249 39.5,206.5C 56.1876,198.715 73.5209,192.715 91.5,188.5 Z"/></g> |
| | | <g><path style="opacity:0.282" fill="#e5ebf2" d="M 39.5,206.5 C 40.531,207.249 41.6976,207.915 43,208.5C 47.3333,207.167 51.6667,207.167 56,208.5C 59.3728,207.532 62.5395,206.865 65.5,206.5C 66.5407,208.991 67.3741,208.991 68,206.5C 68.8388,207.624 70.0055,208.291 71.5,208.5C 84.4696,207.361 97.4696,207.361 110.5,208.5C 103.939,210.424 97.2724,212.424 90.5,214.5C 88.6555,213.062 87.4888,213.396 87,215.5C 86,212.833 85,212.833 84,215.5C 83.6667,214.833 83.3333,214.167 83,213.5C 82.082,215.632 80.7487,216.299 79,215.5C 76.6667,216.167 74.3333,216.833 72,217.5C 71.2588,216.359 70.4255,216.359 69.5,217.5C 68.4593,215.009 67.6259,215.009 67,217.5C 66.3333,216.167 65.3333,215.167 64,214.5C 61.2683,217.807 58.6016,218.141 56,215.5C 55.3741,217.991 54.5407,217.991 53.5,215.5C 49.4792,216.826 45.1458,216.826 40.5,215.5C 38.6803,215.649 37.1803,216.316 36,217.5C 35.3741,215.009 34.5407,215.009 33.5,217.5C 32.4593,215.009 31.6259,215.009 31,217.5C 29.0088,216.008 26.8422,215.008 24.5,214.5C 29.3065,211.595 34.3065,208.928 39.5,206.5 Z"/></g> |
| | | <g><path style="opacity:0.272" fill="#e7edf3" d="M 140.5,203.5 C 150.167,203.5 159.833,203.5 169.5,203.5C 170.043,203.56 170.376,203.893 170.5,204.5C 169.5,205.333 168.5,206.167 167.5,207C 168.766,207.309 169.933,207.809 171,208.5C 172.667,208.5 174.333,208.5 176,208.5C 177,207.833 178,207.167 179,206.5C 183.599,207.479 188.433,207.479 193.5,206.5C 194.541,208.991 195.374,208.991 196,206.5C 196.839,207.624 198.006,208.291 199.5,208.5C 213.213,207.509 226.713,207.509 240,208.5C 241,207.833 242,207.167 243,206.5C 246.995,206.97 251.328,207.304 256,207.5C 256.483,206.552 256.649,205.552 256.5,204.5C 266.186,209.007 275.519,214.007 284.5,219.5C 282.085,219.556 279.751,219.889 277.5,220.5C 276.459,218.009 275.626,218.009 275,220.5C 274,217.833 273,217.833 272,220.5C 271.667,219.833 271.333,219.167 271,218.5C 270.333,219.833 269.333,220.833 268,221.5C 267.259,220.359 266.425,220.359 265.5,221.5C 264.402,217.639 263.569,217.639 263,221.5C 262.751,220.376 262.251,219.376 261.5,218.5C 258.833,219.833 256.167,219.833 253.5,218.5C 252.459,220.991 251.626,220.991 251,218.5C 250.333,219.833 249.333,220.833 248,221.5C 243.667,220.167 239.333,220.167 235,221.5C 232.266,220.638 232.099,219.805 234.5,219C 233.5,218.833 232.5,218.667 231.5,218.5C 229.796,219.068 228.296,219.068 227,218.5C 226,219.167 225,219.833 224,220.5C 220.57,220.306 217.07,220.306 213.5,220.5C 212.459,218.009 211.626,218.009 211,220.5C 210,217.833 209,217.833 208,220.5C 207.667,219.833 207.333,219.167 207,218.5C 206.333,219.833 205.333,220.833 204,221.5C 203.259,220.359 202.425,220.359 201.5,221.5C 200.402,217.639 199.569,217.639 199,221.5C 198.751,220.376 198.251,219.376 197.5,218.5C 194.833,219.833 192.167,219.833 189.5,218.5C 188.459,220.991 187.626,220.991 187,218.5C 186.333,219.833 185.333,220.833 184,221.5C 179.667,220.167 175.333,220.167 171,221.5C 168.266,220.638 168.099,219.805 170.5,219C 167.805,218.746 165.305,218.579 163,218.5C 162,219.167 161,219.833 160,220.5C 155.667,219.167 151.333,219.167 147,220.5C 146.833,220.167 146.667,219.833 146.5,219.5C 148.672,218.795 150.672,217.795 152.5,216.5C 150.432,214.055 148.265,211.722 146,209.5C 145.333,210.833 144.667,210.833 144,209.5C 143.667,210.167 143.333,210.833 143,211.5C 142.505,209.01 141.005,207.51 138.5,207C 139.973,206.29 140.64,205.124 140.5,203.5 Z"/></g> |
| | | <g><path style="opacity:0.253" fill="#f1f4f8" d="M 127.5,203.5 C 131.833,203.5 136.167,203.5 140.5,203.5C 140.64,205.124 139.973,206.29 138.5,207C 141.005,207.51 142.505,209.01 143,211.5C 143.333,210.833 143.667,210.167 144,209.5C 144.667,210.833 145.333,210.833 146,209.5C 148.265,211.722 150.432,214.055 152.5,216.5C 150.672,217.795 148.672,218.795 146.5,219.5C 146.667,219.833 146.833,220.167 147,220.5C 151.333,219.167 155.667,219.167 160,220.5C 161,219.833 162,219.167 163,218.5C 165.305,218.579 167.805,218.746 170.5,219C 168.099,219.805 168.266,220.638 171,221.5C 175.333,220.167 179.667,220.167 184,221.5C 185.333,220.833 186.333,219.833 187,218.5C 187.626,220.991 188.459,220.991 189.5,218.5C 192.167,219.833 194.833,219.833 197.5,218.5C 198.251,219.376 198.751,220.376 199,221.5C 199.569,217.639 200.402,217.639 201.5,221.5C 202.425,220.359 203.259,220.359 204,221.5C 205.333,220.833 206.333,219.833 207,218.5C 207.333,219.167 207.667,219.833 208,220.5C 209,217.833 210,217.833 211,220.5C 211.626,218.009 212.459,218.009 213.5,220.5C 217.07,220.306 220.57,220.306 224,220.5C 225,219.833 226,219.167 227,218.5C 228.296,219.068 229.796,219.068 231.5,218.5C 232.5,218.667 233.5,218.833 234.5,219C 232.099,219.805 232.266,220.638 235,221.5C 239.333,220.167 243.667,220.167 248,221.5C 249.333,220.833 250.333,219.833 251,218.5C 251.626,220.991 252.459,220.991 253.5,218.5C 256.167,219.833 258.833,219.833 261.5,218.5C 262.251,219.376 262.751,220.376 263,221.5C 263.569,217.639 264.402,217.639 265.5,221.5C 266.425,220.359 267.259,220.359 268,221.5C 269.333,220.833 270.333,219.833 271,218.5C 271.333,219.167 271.667,219.833 272,220.5C 273,217.833 274,217.833 275,220.5C 275.626,218.009 276.459,218.009 277.5,220.5C 279.751,219.889 282.085,219.556 284.5,219.5C 288.3,221.234 291.966,223.234 295.5,225.5C 295.585,226.995 294.919,227.995 293.5,228.5C 291.576,228.894 289.743,228.227 288,226.5C 287.259,227.641 286.425,227.641 285.5,226.5C 284.459,228.991 283.626,228.991 283,226.5C 280.975,228.725 278.642,229.059 276,227.5C 275.667,225.833 275.333,224.167 275,222.5C 274.871,225.003 273.871,227.003 272,228.5C 271.259,227.359 270.425,227.359 269.5,228.5C 268.459,226.009 267.626,226.009 267,228.5C 265.475,227.28 263.641,226.613 261.5,226.5C 258.989,226.288 256.822,226.955 255,228.5C 250.572,228.019 246.572,228.019 243,228.5C 241.676,227.12 240.343,226.786 239,227.5C 237.667,226.833 236.667,225.833 236,224.5C 235.374,226.991 234.541,226.991 233.5,224.5C 232.459,226.991 231.626,226.991 231,224.5C 229.177,228.121 226.843,228.787 224,226.5C 223.259,227.641 222.425,227.641 221.5,226.5C 220.459,228.991 219.626,228.991 219,226.5C 216.975,228.725 214.642,229.059 212,227.5C 211.667,225.833 211.333,224.167 211,222.5C 210.871,225.003 209.871,227.003 208,228.5C 207.259,227.359 206.425,227.359 205.5,228.5C 204.459,226.009 203.626,226.009 203,228.5C 201.475,227.28 199.641,226.613 197.5,226.5C 194.989,226.288 192.822,226.955 191,228.5C 186.572,228.019 182.572,228.019 179,228.5C 177.676,227.12 176.343,226.786 175,227.5C 173.667,226.833 172.667,225.833 172,224.5C 171.374,226.991 170.541,226.991 169.5,224.5C 168.459,226.991 167.626,226.991 167,224.5C 165.177,228.121 162.843,228.787 160,226.5C 159.259,227.641 158.425,227.641 157.5,226.5C 156.459,228.991 155.626,228.991 155,226.5C 152.975,228.725 150.642,229.059 148,227.5C 147.472,220.927 146.638,220.927 145.5,227.5C 144.167,227.833 142.833,228.167 141.5,228.5C 140.459,226.009 139.626,226.009 139,228.5C 138.228,227.151 137.061,226.318 135.5,226C 135.833,225.667 136.167,225.333 136.5,225C 135.167,224.667 133.833,224.333 132.5,224C 132.833,223.667 133.167,223.333 133.5,223C 132.216,222.316 131.049,222.483 130,223.5C 129,222.833 128,222.167 127,221.5C 125.902,222.967 124.402,223.801 122.5,224C 123.337,225.011 123.67,226.178 123.5,227.5C 120.495,227.22 117.661,227.554 115,228.5C 113.676,227.12 112.343,226.786 111,227.5C 109.667,226.833 108.667,225.833 108,224.5C 107.374,226.991 106.541,226.991 105.5,224.5C 104.459,226.991 103.626,226.991 103,224.5C 101.177,228.121 98.8432,228.787 96,226.5C 95.2588,227.641 94.4255,227.641 93.5,226.5C 92.4593,228.991 91.6259,228.991 91,226.5C 88.975,228.725 86.6417,229.059 84,227.5C 83.6667,225.833 83.3333,224.167 83,222.5C 82.8706,225.003 81.8706,227.003 80,228.5C 79.2588,227.359 78.4255,227.359 77.5,228.5C 76.4593,226.009 75.6259,226.009 75,228.5C 73.4747,227.28 71.6413,226.613 69.5,226.5C 66.9886,226.288 64.8219,226.955 63,228.5C 58.5718,228.019 54.5718,228.019 51,228.5C 49.6764,227.12 48.3431,226.786 47,227.5C 45.6667,226.833 44.6667,225.833 44,224.5C 43.3741,226.991 42.5407,226.991 41.5,224.5C 40.4593,226.991 39.6259,226.991 39,224.5C 37.1766,228.121 34.8432,228.787 32,226.5C 31.2588,227.641 30.4255,227.641 29.5,226.5C 28.4593,228.991 27.6259,228.991 27,226.5C 24.975,228.725 22.6417,229.059 20,227.5C 19.6667,225.833 19.3333,224.167 19,222.5C 18.8706,225.003 17.8706,227.003 16,228.5C 15.2588,227.359 14.4255,227.359 13.5,228.5C 12.4593,226.009 11.6259,226.009 11,228.5C 9.17386,226.835 7.00719,225.835 4.5,225.5C 10.8377,221.329 17.5044,217.663 24.5,214.5C 26.8422,215.008 29.0088,216.008 31,217.5C 31.6259,215.009 32.4593,215.009 33.5,217.5C 34.5407,215.009 35.3741,215.009 36,217.5C 37.1803,216.316 38.6803,215.649 40.5,215.5C 45.1458,216.826 49.4792,216.826 53.5,215.5C 54.5407,217.991 55.3741,217.991 56,215.5C 58.6016,218.141 61.2683,217.807 64,214.5C 65.3333,215.167 66.3333,216.167 67,217.5C 67.6259,215.009 68.4593,215.009 69.5,217.5C 70.4255,216.359 71.2588,216.359 72,217.5C 74.3333,216.833 76.6667,216.167 79,215.5C 80.7487,216.299 82.082,215.632 83,213.5C 83.3333,214.167 83.6667,214.833 84,215.5C 85,212.833 86,212.833 87,215.5C 87.4888,213.396 88.6555,213.062 90.5,214.5C 97.2724,212.424 103.939,210.424 110.5,208.5C 116.435,207.407 122.102,205.74 127.5,203.5 Z"/></g> |
| | | <g><path style="opacity:0.219" fill="#fafbfd" d="M 295.5,225.5 C 296.833,226.167 298.167,226.833 299.5,227.5C 299.5,228.5 299.5,229.5 299.5,230.5C 199.5,230.5 99.5,230.5 -0.5,230.5C -0.5,229.833 -0.5,229.167 -0.5,228.5C 1.00087,227.248 2.66754,226.248 4.5,225.5C 7.00719,225.835 9.17386,226.835 11,228.5C 11.6259,226.009 12.4593,226.009 13.5,228.5C 14.4255,227.359 15.2588,227.359 16,228.5C 17.8706,227.003 18.8706,225.003 19,222.5C 19.3333,224.167 19.6667,225.833 20,227.5C 22.6417,229.059 24.975,228.725 27,226.5C 27.6259,228.991 28.4593,228.991 29.5,226.5C 30.4255,227.641 31.2588,227.641 32,226.5C 34.8432,228.787 37.1766,228.121 39,224.5C 39.6259,226.991 40.4593,226.991 41.5,224.5C 42.5407,226.991 43.3741,226.991 44,224.5C 44.6667,225.833 45.6667,226.833 47,227.5C 48.3431,226.786 49.6764,227.12 51,228.5C 54.5718,228.019 58.5718,228.019 63,228.5C 64.8219,226.955 66.9886,226.288 69.5,226.5C 71.6413,226.613 73.4747,227.28 75,228.5C 75.6259,226.009 76.4593,226.009 77.5,228.5C 78.4255,227.359 79.2588,227.359 80,228.5C 81.8706,227.003 82.8706,225.003 83,222.5C 83.3333,224.167 83.6667,225.833 84,227.5C 86.6417,229.059 88.975,228.725 91,226.5C 91.6259,228.991 92.4593,228.991 93.5,226.5C 94.4255,227.641 95.2588,227.641 96,226.5C 98.8432,228.787 101.177,228.121 103,224.5C 103.626,226.991 104.459,226.991 105.5,224.5C 106.541,226.991 107.374,226.991 108,224.5C 108.667,225.833 109.667,226.833 111,227.5C 112.343,226.786 113.676,227.12 115,228.5C 117.661,227.554 120.495,227.22 123.5,227.5C 123.67,226.178 123.337,225.011 122.5,224C 124.402,223.801 125.902,222.967 127,221.5C 128,222.167 129,222.833 130,223.5C 131.049,222.483 132.216,222.316 133.5,223C 133.167,223.333 132.833,223.667 132.5,224C 133.833,224.333 135.167,224.667 136.5,225C 136.167,225.333 135.833,225.667 135.5,226C 137.061,226.318 138.228,227.151 139,228.5C 139.626,226.009 140.459,226.009 141.5,228.5C 142.833,228.167 144.167,227.833 145.5,227.5C 146.638,220.927 147.472,220.927 148,227.5C 150.642,229.059 152.975,228.725 155,226.5C 155.626,228.991 156.459,228.991 157.5,226.5C 158.425,227.641 159.259,227.641 160,226.5C 162.843,228.787 165.177,228.121 167,224.5C 167.626,226.991 168.459,226.991 169.5,224.5C 170.541,226.991 171.374,226.991 172,224.5C 172.667,225.833 173.667,226.833 175,227.5C 176.343,226.786 177.676,227.12 179,228.5C 182.572,228.019 186.572,228.019 191,228.5C 192.822,226.955 194.989,226.288 197.5,226.5C 199.641,226.613 201.475,227.28 203,228.5C 203.626,226.009 204.459,226.009 205.5,228.5C 206.425,227.359 207.259,227.359 208,228.5C 209.871,227.003 210.871,225.003 211,222.5C 211.333,224.167 211.667,225.833 212,227.5C 214.642,229.059 216.975,228.725 219,226.5C 219.626,228.991 220.459,228.991 221.5,226.5C 222.425,227.641 223.259,227.641 224,226.5C 226.843,228.787 229.177,228.121 231,224.5C 231.626,226.991 232.459,226.991 233.5,224.5C 234.541,226.991 235.374,226.991 236,224.5C 236.667,225.833 237.667,226.833 239,227.5C 240.343,226.786 241.676,227.12 243,228.5C 246.572,228.019 250.572,228.019 255,228.5C 256.822,226.955 258.989,226.288 261.5,226.5C 263.641,226.613 265.475,227.28 267,228.5C 267.626,226.009 268.459,226.009 269.5,228.5C 270.425,227.359 271.259,227.359 272,228.5C 273.871,227.003 274.871,225.003 275,222.5C 275.333,224.167 275.667,225.833 276,227.5C 278.642,229.059 280.975,228.725 283,226.5C 283.626,228.991 284.459,228.991 285.5,226.5C 286.425,227.641 287.259,227.641 288,226.5C 289.743,228.227 291.576,228.894 293.5,228.5C 294.919,227.995 295.585,226.995 295.5,225.5 Z"/></g> |
| | | </svg> |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M24 44C29.5228 44 34.5228 41.7614 38.1421 38.1421C41.7614 34.5228 44 29.5228 44 24C44 18.4772 41.7614 13.4772 38.1421 9.85786C34.5228 6.23858 29.5228 4 24 4C18.4772 4 13.4772 6.23858 9.85786 9.85786C6.23858 13.4772 4 18.4772 4 24C4 29.5228 6.23858 34.5228 9.85786 38.1421C13.4772 41.7614 18.4772 44 24 44Z" fill="none" stroke="#333" stroke-width="4" stroke-linejoin="round"/><path fill-rule="evenodd" clip-rule="evenodd" d="M24 11C25.3807 11 26.5 12.1193 26.5 13.5C26.5 14.8807 25.3807 16 24 16C22.6193 16 21.5 14.8807 21.5 13.5C21.5 12.1193 22.6193 11 24 11Z" fill="#333"/><path d="M24.5 34V20H23.5H22.5" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M21 34H28" stroke="#333" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg> |
| | | <?xml version="1.0" encoding="UTF-8"?><svg width="24" height="24" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M24 44C29.5228 44 34.5228 41.7614 38.1421 38.1421C41.7614 34.5228 44 29.5228 44 24C44 18.4772 41.7614 13.4772 38.1421 9.85786C34.5228 6.23858 29.5228 4 24 4C18.4772 4 13.4772 6.23858 9.85786 9.85786C6.23858 13.4772 4 18.4772 4 24C4 29.5228 6.23858 34.5228 9.85786 38.1421C13.4772 41.7614 18.4772 44 24 44Z" fill="none" stroke="#2D8BF7" stroke-width="4" stroke-linejoin="round"/><path fill-rule="evenodd" clip-rule="evenodd" d="M24 11C25.3807 11 26.5 12.1193 26.5 13.5C26.5 14.8807 25.3807 16 24 16C22.6193 16 21.5 14.8807 21.5 13.5C21.5 12.1193 22.6193 11 24 11Z" fill="#2D8BF7"/><path d="M24.5 34V20H23.5H22.5" stroke="#2D8BF7" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/><path d="M21 34H28" stroke="#2D8BF7" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/></svg> |
| | |
| | | isShowLoding: true |
| | | }).then(res => { |
| | | if (res.success) { |
| | | const projectList = res.content.obj.map(project => ({ |
| | | const projectList = res.content.map(project => ({ |
| | | id: project.projectId, |
| | | name: project.projectName, |
| | | groupCount: project.groupCount, |
| | |
| | | </block> |
| | | </block> |
| | | <view wx:else class="empty-container"> |
| | | <image class="empty-image" src="/images/empty.png" mode="aspectFit"></image> |
| | | <image class="empty-image" src="/images/empty.svg" mode="aspectFit"></image> |
| | | <view class="empty-text">暂无轮灌组数据</view> |
| | | <view class="empty-text">请刷新或稍后再试</view> |
| | | </view> |
| | |
| | | // pages/home/home.js |
| | | const storage = require('../../utils/storage.js'); |
| | | const { |
| | | get, |
| | | post |
| | | get, |
| | | post |
| | | } = require('../../api/request.js'); |
| | | const { |
| | | PROJECT_URLS |
| | | PROJECT_URLS |
| | | } = require('../../api/config.js'); |
| | | |
| | | // 项目配置,包含各项目的专有设置 |
| | | const PROJECT_CONFIG = { |
| | | JYG: { |
| | | tag: 'ym', |
| | | displayName: '嘉峪关项目', |
| | | needLogin: true // 需要登录 |
| | | }, |
| | | MQ: { |
| | | tag: 'mq', |
| | | displayName: '民勤项目', |
| | | operatorId: '2025033115305200006', // 统一ID用于operator和clientId |
| | | needLogin: false // 不需要登录 |
| | | }, |
| | | TEST: { |
| | | tag: 'ym', |
| | | displayName: '测试项目', |
| | | operatorId: '2025032411245000006', // 统一ID用于operator和clientId |
| | | vcId: '2024122617295800009', |
| | | needLogin: false // 不需要登录 |
| | | }, |
| | | SCHOOL: { |
| | | tag: 'XX', |
| | | displayName: '学校项目', |
| | | operatorId: '2025040215305200006', // 统一ID用于operator和clientId |
| | | needLogin: true // 不需要登录 |
| | | } |
| | | }; |
| | | const { |
| | | PROJECT_CONFIG |
| | | } = require('../../utils/projectConfig.js'); |
| | | |
| | | Page({ |
| | | |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | sessionId: "", |
| | | showConfirm: false, |
| | | myItem: {}, |
| | | waterIntakeName: "", |
| | | image: "/images/ic_head_bg.jpg", |
| | | userPhone: "", |
| | | userName: "请点击登录", |
| | | scrollViewHeight: 0, |
| | | listData: [], |
| | | isRefreshing: false, |
| | | isWXRefreshing: false, |
| | | errorData: '', //错误内容 |
| | | showErrorDialog: false, |
| | | confirmBtn: { |
| | | content: '确认' |
| | | }, |
| | | errorDialogTitle: "关阀错误", |
| | | showForceConfirm: false, //是否强制开阀 |
| | | lastIntakeName: "", |
| | | showProjectDialog: false, |
| | | selectedProject: '', |
| | | avatarTapCount: 0, |
| | | isFromLogin: false, |
| | | showTipDialog: '', |
| | | projectConfig: PROJECT_CONFIG // 添加项目配置到data中 |
| | | }, |
| | | |
| | | openValve: function (e) { |
| | | const app = getApp(); |
| | | if (app.globalData.isLoggedIn) { |
| | | wx.navigateTo({ |
| | | url: '/pages/waterIntake/waterIntake', |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | calculateScrollViewHeight: function () { |
| | | wx.createSelectorQuery().selectAll('.list-item').boundingClientRect((rects) => { |
| | | let totalHeight = rects.reduce((sum, rect) => sum + rect.height, 0); |
| | | this.setData({ |
| | | scrollViewHeight: totalHeight, |
| | | }); |
| | | }).exec(); |
| | | }, |
| | | startPullDownRefresh() { |
| | | if (getApp().globalData.isLoggedIn) { |
| | | if (!this.data.isWXRefreshing) { |
| | | var self = this; |
| | | console.log(this.data.isRefreshing); |
| | | this.setData({ |
| | | isRefreshing: true |
| | | }); |
| | | this.getOpenList(); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | console.log('home页面onLoad开始,参数:', options); |
| | | //当开阀成功后调用刷新 |
| | | if (options.param === "1" || options.param === "2") { |
| | | this.setData({ |
| | | options: options |
| | | }) |
| | | } |
| | | // 检查是否从登录页面返回 |
| | | let fromLogin = false; |
| | | |
| | | // 检查URL参数 |
| | | if (options && options.fromLogin === 'true') { |
| | | console.log('检测到URL参数fromLogin=true'); |
| | | fromLogin = true; |
| | | } |
| | | |
| | | console.log('home页面加载,fromLogin:', fromLogin, '参数:', options); |
| | | |
| | | // 设置fromLogin标志 |
| | | if (fromLogin) { |
| | | console.log('设置isFromLogin=true'); |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | } |
| | | |
| | | // 延迟执行剩余的初始化过程,以确保临时标记和URL参数能被正确处理 |
| | | setTimeout(() => { |
| | | this.initializePage(options, fromLogin); |
| | | }, 100); |
| | | }, |
| | | |
| | | // 新增的初始化页面辅助函数,分离出onLoad中的逻辑以便延迟执行 |
| | | initializePage(options, fromLogin) { |
| | | // 检查是否已选择项目 |
| | | const { |
| | | PROJECT_URLS |
| | | } = require('../../api/config.js'); |
| | | |
| | | // 确保全局变量存在 |
| | | getApp().globalData = getApp().globalData || {}; |
| | | |
| | | storage.getItemSafe('selectedProject') |
| | | .then((project) => { |
| | | if (project) { |
| | | this.setData({ |
| | | selectedProject: project |
| | | }); |
| | | |
| | | // 设置 baseUrl |
| | | const baseUrl = PROJECT_URLS[project]; |
| | | getApp().globalData.baseUrl = baseUrl; |
| | | getApp().globalData.selectedProject = project; |
| | | |
| | | // 根据项目设置对应的tag |
| | | const projectConfig = PROJECT_CONFIG[project]; |
| | | if (projectConfig) { |
| | | getApp().globalData.tag = projectConfig.tag; |
| | | this.setData({ |
| | | userName: projectConfig.displayName |
| | | }); |
| | | } |
| | | |
| | | // 根据项目设置对应的operator和clientId |
| | | if (projectConfig && projectConfig.operatorId) { |
| | | getApp().globalData.operator = projectConfig.operatorId; |
| | | getApp().globalData.clientId = projectConfig.operatorId; |
| | | getApp().globalData.isLoggedIn = true; |
| | | getApp().globalData.sessionId = projectConfig.operatorId; |
| | | |
| | | // 如果有vcId,也设置 |
| | | if (projectConfig.vcId) { |
| | | getApp().globalData.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | // 持久化存储项目参数 |
| | | const params = { |
| | | operator: projectConfig.operatorId, |
| | | clientId: projectConfig.operatorId, |
| | | isLoggedIn: true, |
| | | sessionId: projectConfig.operatorId |
| | | }; |
| | | |
| | | if (projectConfig.vcId) { |
| | | params.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | storage.setItem(`${project}_params`, params); |
| | | } |
| | | |
| | | // 继续初始化页面 |
| | | this.continueInitPage(options); |
| | | } else { |
| | | // 首次进入,显示项目选择弹窗 |
| | | this.setData({ |
| | | showProjectDialog: true |
| | | }); |
| | | return Promise.reject({ |
| | | type: 'project_not_selected', |
| | | message: '未选择项目' |
| | | }); // 终止后续处理 |
| | | } |
| | | }) |
| | | .then(() => { |
| | | // 继续初始化页面 |
| | | this.continueInitPage(options); |
| | | }) |
| | | .catch(err => { |
| | | // 将错误对象规范化 |
| | | const error = typeof err === 'object' ? err : { |
| | | type: 'unknown', |
| | | message: String(err) |
| | | }; |
| | | console.log('获取存储数据中断:', error.message); |
| | | |
| | | // 如果是从登录页返回或已登录,不再跳转 |
| | | if (fromLogin) { |
| | | console.log('从登录页返回或已登录,继续初始化页面'); |
| | | this.continueInitPage(options); |
| | | return; |
| | | } |
| | | |
| | | // 处理未选择项目的情况 |
| | | if (error.type === 'project_not_selected') { |
| | | console.log('未选择项目,显示项目选择弹窗'); |
| | | this.setData({ |
| | | showProjectDialog: true |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 其他未知错误,尝试继续初始化页面 |
| | | console.warn('未知错误,尝试继续初始化页面:', error); |
| | | this.continueInitPage(options); |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | // 检查是否有options和param |
| | | if (this.data.options && this.data.options.param) { |
| | | if (this.data.options.param === "1" || this.data.options.param === "2") { |
| | | this.getOpenList(); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | console.log('home页面onShow开始'); |
| | | |
| | | // 获取当前页面的参数 |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | |
| | | let fromLogin = false; |
| | | |
| | | // 检查是否有fromLogin参数 |
| | | if (currentPage && currentPage.options && currentPage.options.fromLogin === 'true') { |
| | | console.log('onShow: 检测到fromLogin参数,设置isFromLogin标记'); |
| | | fromLogin = true; |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | } |
| | | |
| | | // 初始化处理 |
| | | if (fromLogin || this.data.isFromLogin) { |
| | | console.log('onShow: 从登录页返回,不进行登录检查'); |
| | | } else { |
| | | console.log('onShow: 正常显示页面'); |
| | | // 延迟检查登录状态,确保能正确识别临时标记 |
| | | setTimeout(() => { |
| | | this.checkLoginStatusIfNeeded(); |
| | | }, 300); |
| | | } |
| | | }, |
| | | |
| | | // 检查登录状态(仅在需要时) |
| | | checkLoginStatusIfNeeded() { |
| | | // 再次确认是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('检测到从登录页返回的标记,不进行登录检查'); |
| | | return; |
| | | } |
| | | |
| | | console.log('执行登录状态检查'); |
| | | this.checkLoginStatus(); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { |
| | | // 页面隐藏时考虑清理临时标记 |
| | | this.cleanupTempMarkers(); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | // 页面卸载时清理临时标记 |
| | | this.cleanupTempMarkers(); |
| | | }, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | // 下拉刷新触发的逻辑,可以是请求数据等操作 |
| | | // 例如,请求数据后更新页面内容 |
| | | console.log(this.data.isRefreshing); |
| | | this.setData({ |
| | | isWXRefreshing: true |
| | | }); |
| | | console.log(this.data.isRefreshing); |
| | | // 数据请求完成后,停止下拉刷新的动画 |
| | | this.getOpenList(); |
| | | }, |
| | | |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | }, |
| | | recharge() { |
| | | // wx.navigateTo({ |
| | | // url: '/pages/rechargeCard/rechargeCard', |
| | | // }) |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | openValveList() { |
| | | // wx.navigateTo({ |
| | | // url: '/pages/valveList/valveList', |
| | | // }) |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | feedBack() { |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | //解绑用户 |
| | | unbind() { |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = getApp().globalData.selectedProject; |
| | | const projectConfig = PROJECT_CONFIG[currentProject]; |
| | | |
| | | // 如果当前项目配置为不需要登录,则提示用户不可解绑 |
| | | if (projectConfig && !projectConfig.needLogin) { |
| | | wx.showToast({ |
| | | title: '当前用户不可解绑', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (getApp().globalData.isLoggedIn) { |
| | | wx.showModal({ |
| | | title: '解绑确认', |
| | | content: '确定要解绑当前账号吗?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | this.unBindPost() |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '还未绑定', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | //轮灌 |
| | | irrigation() { |
| | | if (getApp().globalData.isLoggedIn) { |
| | | wx.navigateTo({ |
| | | url: '/pages/irrigation/irrigation', |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | handleChange(e) { |
| | | const item = e.currentTarget.dataset.item; |
| | | console.log(item); |
| | | this.setData({ |
| | | showConfirm: true, |
| | | waterIntakeName: item.intakeNum, |
| | | myItem: item |
| | | }); |
| | | }, |
| | | closeDialog() { |
| | | console.log("closeDialog"); |
| | | this.setData({ |
| | | showConfirm: false, |
| | | showErrorDialog: false, |
| | | showForceConfirm: false |
| | | }); |
| | | }, |
| | | cancelDialog() { |
| | | this.setData({ |
| | | showForceConfirm: false, |
| | | showConfirm: false |
| | | }); |
| | | }, |
| | | /** |
| | | * 关闭阀门 |
| | | * @param {*} orderNo 订单号 |
| | | * @param {*} rtuAddr 阀控器地址 |
| | | * @param {*} vcNum 虚拟卡编号 |
| | | */ |
| | | postCloseValaue(orderNo, rtuAddr, vcNum) { |
| | | wx.showLoading({ |
| | | title: '正在关阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const app = getApp(); |
| | | const data = { |
| | | rtuAddr: rtuAddr, |
| | | vcNum: vcNum, //虚拟卡ID |
| | | orderNo: orderNo, |
| | | operator: app.globalData.clientId //操作员 |
| | | }; |
| | | console.log("postCloseValaue" + data); |
| | | post({ |
| | | url: "wx/valve/close_wx", |
| | | data: data, |
| | | isShowLoding: false, |
| | | timeout: 185000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | this.getOpenList(); |
| | | wx.showToast({ |
| | | title: '关阀成功', |
| | | icon: 'success', |
| | | duration: 3000 |
| | | }) |
| | | }).catch(error => { |
| | | wx.hideLoading(); |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "关阀错误" |
| | | }) |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | |
| | | }); |
| | | }, |
| | | /** |
| | | * 获取为关阀记录 |
| | | */ |
| | | getOpenList() { |
| | | const app = getApp(); |
| | | if (!getApp().globalData.isLoggedIn) { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | this.setData({ |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }); |
| | | return; |
| | | } |
| | | // 检查是否从登录页返回 |
| | | const fromLogin = this.getFromLogin(); |
| | | |
| | | // 检查clientId是否存在 |
| | | if (!app.globalData.clientId) { |
| | | console.log('getOpenList: clientId不存在,不执行API请求'); |
| | | |
| | | // 如果是从登录页返回,就显示空列表而不是错误提示 |
| | | this.setData({ |
| | | /** |
| | | * 页面的初始数据 |
| | | */ |
| | | data: { |
| | | sessionId: "", |
| | | showConfirm: false, |
| | | myItem: {}, |
| | | waterIntakeName: "", |
| | | image: "/images/ic_head_bg.jpg", |
| | | userPhone: "", |
| | | userName: "请点击登录", |
| | | scrollViewHeight: 0, |
| | | listData: [], |
| | | isRefreshing: false, |
| | | isWXRefreshing: false |
| | | }); |
| | | isWXRefreshing: false, |
| | | errorData: '', //错误内容 |
| | | showErrorDialog: false, |
| | | confirmBtn: { |
| | | content: '确认' |
| | | }, |
| | | errorDialogTitle: "关阀错误", |
| | | showForceConfirm: false, //是否强制开阀 |
| | | lastIntakeName: "", |
| | | showProjectDialog: false, |
| | | selectedProject: '', |
| | | avatarTapCount: 0, |
| | | isFromLogin: false, |
| | | showTipDialog: '', |
| | | projectConfig: PROJECT_CONFIG, // 添加项目配置到data中 |
| | | showInfoDialog: false |
| | | }, |
| | | |
| | | // 如果不是从登录页返回且不处于刷新状态,考虑检查登录状态 |
| | | if (!fromLogin && !this.data.isRefreshing && !this.data.isWXRefreshing) { |
| | | console.log('getOpenList: 非刷新状态下检测到无clientId,尝试自动登录'); |
| | | // 延迟调用微信登录,尝试自动恢复会话 |
| | | setTimeout(() => { |
| | | if (!getApp().globalData.clientId && !this.getFromLogin()) { |
| | | this.wxLogin(); |
| | | } |
| | | }, 1000); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | console.log('getOpenList: 开始获取列表数据, clientId:', app.globalData.clientId); |
| | | |
| | | const params = { |
| | | url: 'wx/valve/get', |
| | | data: { |
| | | operator: app.globalData.clientId |
| | | } |
| | | }; |
| | | |
| | | get(params).then(data => { |
| | | console.log('获取列表数据成功:', data); |
| | | this.setData({ |
| | | listData: data.content, |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }); |
| | | |
| | | // 成功获取数据后刷新UI高度 |
| | | setTimeout(() => { |
| | | this.calculateScrollViewHeight(); |
| | | }, 200); |
| | | }).catch(err => { |
| | | console.error('获取列表数据失败:', err); |
| | | // 错误回调 |
| | | this.setData({ |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }); |
| | | |
| | | // 检查错误类型 |
| | | if (err && err.code === '0003') { |
| | | console.log('会话无效或过期,但不进行跳转'); |
| | | |
| | | // 如果不是从登录页返回,显示错误提示 |
| | | if (!fromLogin) { |
| | | wx.showToast({ |
| | | title: '登录已过期,请刷新重试', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | } else { |
| | | // 一般错误,显示错误信息 |
| | | wx.showToast({ |
| | | title: err.msg || '获取列表数据失败', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | /** |
| | | * 确认关闭回调 |
| | | * @param {} item |
| | | */ |
| | | confirmDialog() { |
| | | this.setData({ |
| | | showConfirm: false |
| | | }); |
| | | this.postCloseValaue(this.data.myItem.orderNo, this.data.myItem.rtuAddr, this.data.myItem.vcNum); |
| | | }, |
| | | //根据session获取农户信息 |
| | | getUserDataBySession() { |
| | | // 先检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('getUserDataBySession: 检测到从登录页返回的标记,不执行API请求'); |
| | | return; |
| | | } |
| | | |
| | | const app = getApp(); |
| | | |
| | | // 检查是否有sessionId |
| | | if (!app.globalData.sessionId) { |
| | | console.log('getUserDataBySession: sessionId不存在,不执行API请求'); |
| | | return; |
| | | } |
| | | |
| | | console.log('getUserDataBySession: 开始获取用户数据, sessionId:', app.globalData.sessionId); |
| | | |
| | | const params = { |
| | | url: 'wx/client/simple_info', |
| | | data: { |
| | | sessionId: app.globalData.sessionId |
| | | } |
| | | }; |
| | | |
| | | get(params).then(data => { |
| | | console.log('获取用户数据成功:', data); |
| | | this.setData({ |
| | | userName: data.content.clientName, |
| | | userPhone: this.maskPhoneNumber(data.content.phone) |
| | | }); |
| | | }).catch(err => { |
| | | console.error('获取用户数据失败:', err); |
| | | // 错误回调,但不进行页面跳转 |
| | | |
| | | // 检查错误类型 |
| | | if (err && err.code === '0003') { |
| | | console.log('会话无效或过期,但不进行跳转'); |
| | | // 不再直接跳转到登录页 |
| | | |
| | | // 清除会话信息 |
| | | app.globalData.sessionId = ''; |
| | | app.globalData.isLoggedIn = false; |
| | | |
| | | // 如果不是从登录页返回,显示错误提示 |
| | | if (!this.getFromLogin()) { |
| | | wx.showToast({ |
| | | title: '登录已过期,请重新登录', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | } else { |
| | | // 其他错误,显示错误信息 |
| | | wx.showToast({ |
| | | title: err.msg || '获取用户信息失败', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | maskPhoneNumber(phoneNumber) { |
| | | if (phoneNumber.length !== 11) { |
| | | throw new Error("Phone number must be 11 digits"); |
| | | } |
| | | // 使用正则表达式替换中间四位数字为星号 |
| | | const maskedPhoneNumber = phoneNumber.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"); |
| | | return maskedPhoneNumber; |
| | | }, |
| | | |
| | | closeDialog() { |
| | | this.setData({ |
| | | showErrorDialog: false |
| | | }) |
| | | }, |
| | | /** |
| | | * 扫码开阀 |
| | | */ |
| | | scenCode() { |
| | | const that = this; |
| | | wx.scanCode({ |
| | | success(res) { |
| | | console.log(res.result); // 当且仅当扫码为非微信二维码时,会返回result |
| | | if (res.result.startsWith("content://")) { |
| | | let jsonStr = res.result.replace("content://", "") |
| | | try { |
| | | |
| | | that.saveData(jsonStr) |
| | | } catch (error) { |
| | | console.error('Error parsing JSON:', error); |
| | | } |
| | | |
| | | openValve: function (e) { |
| | | const app = getApp(); |
| | | if (app.globalData.isLoggedIn) { |
| | | wx.navigateTo({ |
| | | url: '/pages/waterIntake/waterIntake', |
| | | }) |
| | | } else { |
| | | that.postOppenValva(res.result) |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | |
| | | }, |
| | | fail(err) { |
| | | console.error(err); |
| | | } |
| | | }) |
| | | }, |
| | | confirmForceDialog() { |
| | | console.log("confirmForceDialog"); |
| | | this.setData({ |
| | | showForceConfirm: false |
| | | }) |
| | | this.postOppenValva(this.data.lastIntakeName, true) |
| | | }, |
| | | /** |
| | | * |
| | | * @param {*} intakeName |
| | | */ |
| | | postOppenValva(intakeName, isforce) { |
| | | const that = this; |
| | | wx.showLoading({ |
| | | title: '正在开阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const app = getApp(); |
| | | that.setData({ |
| | | lastIntakeName: intakeName |
| | | }) |
| | | const data = { |
| | | intakeName: intakeName, //取水口ID |
| | | // vcId: vcId, //虚拟卡ID |
| | | operator: app.globalData.clientId, //操作员 |
| | | forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/open_wx", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "10005") { |
| | | that.setData({ |
| | | showForceConfirm: true |
| | | }) |
| | | } else { |
| | | that.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | /** |
| | | * 扫描后保存用户id和tag |
| | | */ |
| | | saveData(userData) { |
| | | storage.setItem("userData", userData).then(() => { |
| | | this.initData(); |
| | | }).catch((error) => {}); |
| | | |
| | | }, |
| | | //进入界面获取界面数据 |
| | | initData() { |
| | | const app = getApp(); |
| | | console.log("initData开始,tag:", app.globalData.tag); |
| | | |
| | | // 首先检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('initData: 检测到从登录页返回的标记,仅获取基本数据'); |
| | | |
| | | // 即使从登录页返回,也尝试获取开阀列表以显示基本UI |
| | | // 但先检查是否有客户端ID可用 |
| | | if (!app.globalData.clientId) { |
| | | console.log('initData: 从登录页返回且无clientId,尝试从存储恢复'); |
| | | // 尝试从存储恢复clientId |
| | | storage.getItemSafe('clientId') |
| | | .then(clientId => { |
| | | if (clientId) { |
| | | console.log('initData: 从存储恢复clientId成功:', clientId); |
| | | app.globalData.clientId = clientId; |
| | | this.getOpenList(); |
| | | } else { |
| | | console.log('initData: 无法恢复clientId,显示空列表'); |
| | | this.setData({ |
| | | listData: [] |
| | | }); |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error('initData: 恢复clientId失败:', err); |
| | | }, |
| | | calculateScrollViewHeight: function () { |
| | | wx.createSelectorQuery().selectAll('.list-item').boundingClientRect((rects) => { |
| | | let totalHeight = rects.reduce((sum, rect) => sum + rect.height, 0); |
| | | this.setData({ |
| | | listData: [] |
| | | scrollViewHeight: totalHeight, |
| | | }); |
| | | }); |
| | | } else { |
| | | this.getOpenList(); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = app.globalData.selectedProject; |
| | | const projectConfig = PROJECT_CONFIG[currentProject]; |
| | | const needLogin = projectConfig && projectConfig.needLogin; |
| | | |
| | | // 尝试获取用户数据和已开阀记录 |
| | | try { |
| | | // 优先检查全局变量中是否有sessionId |
| | | if (app.globalData.sessionId) { |
| | | console.log('initData: 使用全局sessionId获取数据'); |
| | | |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | }).exec(); |
| | | }, |
| | | startPullDownRefresh() { |
| | | if (getApp().globalData.isLoggedIn) { |
| | | if (!this.data.isWXRefreshing) { |
| | | var self = this; |
| | | console.log(this.data.isRefreshing); |
| | | this.setData({ |
| | | isRefreshing: true |
| | | }); |
| | | this.getOpenList(); |
| | | } |
| | | } else { |
| | | console.log('initData: 当前项目不需要登录,跳过获取用户数据'); |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | |
| | | |
| | | |
| | | }, |
| | | |
| | | |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad(options) { |
| | | console.log('home页面onLoad开始,参数:', options); |
| | | //当开阀成功后调用刷新 |
| | | if (options.param === "1" || options.param === "2") { |
| | | this.setData({ |
| | | options: options |
| | | }) |
| | | } |
| | | // 检查是否从登录页面返回 |
| | | let fromLogin = false; |
| | | |
| | | // 检查URL参数 |
| | | if (options && options.fromLogin === 'true') { |
| | | console.log('检测到URL参数fromLogin=true'); |
| | | fromLogin = true; |
| | | } |
| | | |
| | | console.log('home页面加载,fromLogin:', fromLogin, '参数:', options); |
| | | |
| | | // 设置fromLogin标志 |
| | | if (fromLogin) { |
| | | console.log('设置isFromLogin=true'); |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | } |
| | | |
| | | // 延迟执行剩余的初始化过程,以确保临时标记和URL参数能被正确处理 |
| | | setTimeout(() => { |
| | | this.initializePage(options, fromLogin); |
| | | }, 100); |
| | | }, |
| | | |
| | | // 新增的初始化页面辅助函数,分离出onLoad中的逻辑以便延迟执行 |
| | | initializePage(options, fromLogin) { |
| | | // 检查是否已选择项目 |
| | | const { |
| | | PROJECT_URLS |
| | | } = require('../../api/config.js'); |
| | | |
| | | // 确保全局变量存在 |
| | | getApp().globalData = getApp().globalData || {}; |
| | | |
| | | storage.getItemSafe('selectedProject') |
| | | .then((project) => { |
| | | if (project) { |
| | | this.setData({ |
| | | selectedProject: project |
| | | }); |
| | | |
| | | // 设置 baseUrl |
| | | const baseUrl = PROJECT_URLS[project]; |
| | | getApp().globalData.baseUrl = baseUrl; |
| | | getApp().globalData.selectedProject = project; |
| | | |
| | | // 根据项目设置对应的tag |
| | | const projectConfig = PROJECT_CONFIG[project]; |
| | | if (projectConfig) { |
| | | getApp().globalData.tag = projectConfig.tag; |
| | | this.setData({ |
| | | userName: projectConfig.displayName |
| | | }); |
| | | } |
| | | |
| | | // 根据项目设置对应的operator和clientId |
| | | if (projectConfig && projectConfig.operatorId) { |
| | | getApp().globalData.operator = projectConfig.operatorId; |
| | | getApp().globalData.clientId = projectConfig.operatorId; |
| | | getApp().globalData.isLoggedIn = true; |
| | | getApp().globalData.sessionId = projectConfig.operatorId; |
| | | |
| | | // 如果有vcId,也设置 |
| | | if (projectConfig.vcId) { |
| | | getApp().globalData.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | // 持久化存储项目参数 |
| | | const params = { |
| | | operator: projectConfig.operatorId, |
| | | clientId: projectConfig.operatorId, |
| | | isLoggedIn: true, |
| | | sessionId: projectConfig.operatorId |
| | | }; |
| | | |
| | | if (projectConfig.vcId) { |
| | | params.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | storage.setItem(`${project}_params`, params); |
| | | } |
| | | |
| | | // 继续初始化页面 |
| | | this.continueInitPage(options); |
| | | } else { |
| | | // 首次进入,显示项目选择弹窗 |
| | | this.setData({ |
| | | showProjectDialog: true |
| | | }); |
| | | return Promise.reject({ |
| | | type: 'project_not_selected', |
| | | message: '未选择项目' |
| | | }); // 终止后续处理 |
| | | } |
| | | }) |
| | | .then(() => { |
| | | // 继续初始化页面 |
| | | this.continueInitPage(options); |
| | | }) |
| | | .catch(err => { |
| | | // 将错误对象规范化 |
| | | const error = typeof err === 'object' ? err : { |
| | | type: 'unknown', |
| | | message: String(err) |
| | | }; |
| | | console.log('获取存储数据中断:', error.message); |
| | | |
| | | // 如果是从登录页返回或已登录,不再跳转 |
| | | if (fromLogin) { |
| | | console.log('从登录页返回或已登录,继续初始化页面'); |
| | | this.continueInitPage(options); |
| | | return; |
| | | } |
| | | |
| | | // 处理未选择项目的情况 |
| | | if (error.type === 'project_not_selected') { |
| | | console.log('未选择项目,显示项目选择弹窗'); |
| | | this.setData({ |
| | | showProjectDialog: true |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 其他未知错误,尝试继续初始化页面 |
| | | console.warn('未知错误,尝试继续初始化页面:', error); |
| | | this.continueInitPage(options); |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面初次渲染完成 |
| | | */ |
| | | onReady() { |
| | | // 检查是否有options和param |
| | | if (this.data.options && this.data.options.param) { |
| | | if (this.data.options.param === "1" || this.data.options.param === "2") { |
| | | this.getOpenList(); |
| | | } |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面显示 |
| | | */ |
| | | onShow() { |
| | | console.log('home页面onShow开始'); |
| | | |
| | | // 获取当前页面的参数 |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | |
| | | let fromLogin = false; |
| | | |
| | | // 检查是否有fromLogin参数 |
| | | if (currentPage && currentPage.options && currentPage.options.fromLogin === 'true') { |
| | | console.log('onShow: 检测到fromLogin参数,设置isFromLogin标记'); |
| | | fromLogin = true; |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | } |
| | | |
| | | // 初始化处理 |
| | | if (fromLogin || this.data.isFromLogin) { |
| | | console.log('onShow: 从登录页返回,不进行登录检查'); |
| | | } else { |
| | | console.log('onShow: 正常显示页面'); |
| | | // 延迟检查登录状态,确保能正确识别临时标记 |
| | | setTimeout(() => { |
| | | this.checkLoginStatusIfNeeded(); |
| | | }, 300); |
| | | } |
| | | }, |
| | | |
| | | // 检查登录状态(仅在需要时) |
| | | checkLoginStatusIfNeeded() { |
| | | // 再次确认是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('检测到从登录页返回的标记,不进行登录检查'); |
| | | return; |
| | | } |
| | | |
| | | console.log('执行登录状态检查'); |
| | | this.checkLoginStatus(); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面隐藏 |
| | | */ |
| | | onHide() { |
| | | // 页面隐藏时考虑清理临时标记 |
| | | this.cleanupTempMarkers(); |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面卸载 |
| | | */ |
| | | onUnload() { |
| | | // 页面卸载时清理临时标记 |
| | | this.cleanupTempMarkers(); |
| | | }, |
| | | |
| | | /** |
| | | * 页面相关事件处理函数--监听用户下拉动作 |
| | | */ |
| | | onPullDownRefresh() { |
| | | // 下拉刷新触发的逻辑,可以是请求数据等操作 |
| | | // 例如,请求数据后更新页面内容 |
| | | console.log(this.data.isRefreshing); |
| | | this.setData({ |
| | | isWXRefreshing: true |
| | | }); |
| | | console.log(this.data.isRefreshing); |
| | | // 数据请求完成后,停止下拉刷新的动画 |
| | | this.getOpenList(); |
| | | return; |
| | | } |
| | | }, |
| | | |
| | | // 检查是否有存储的userData |
| | | const hasUserData = storage.isHasKeySync("userData"); |
| | | console.log('initData: 是否存在userData:', hasUserData); |
| | | /** |
| | | * 页面上拉触底事件的处理函数 |
| | | */ |
| | | onReachBottom() { |
| | | |
| | | if (hasUserData) { |
| | | storage.getItemSafe('userData') |
| | | .then((data) => { |
| | | console.log('initData: 成功读取userData'); |
| | | if (data) { |
| | | try { |
| | | let jsonObj = JSON.parse(data); |
| | | app.globalData.sessionId = jsonObj.sessionId; |
| | | app.globalData.tag = jsonObj.tag; |
| | | console.log("userData已加载:", data); |
| | | } catch (e) { |
| | | console.error('userData解析失败:', e); |
| | | } |
| | | } |
| | | |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | }, |
| | | |
| | | /** |
| | | * 用户点击右上角分享 |
| | | */ |
| | | onShareAppMessage() { |
| | | |
| | | }, |
| | | recharge() { |
| | | // wx.navigateTo({ |
| | | // url: '/pages/rechargeCard/rechargeCard', |
| | | // }) |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | openValveList() { |
| | | // wx.navigateTo({ |
| | | // url: '/pages/valveList/valveList', |
| | | // }) |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | feedBack() { |
| | | wx.showToast({ |
| | | title: '暂未开放', |
| | | icon: 'none' |
| | | }) |
| | | }, |
| | | //解绑用户 |
| | | unbind() { |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = getApp().globalData.selectedProject; |
| | | const projectConfig = PROJECT_CONFIG[currentProject]; |
| | | |
| | | // 如果当前项目配置为不需要登录,则提示用户不可解绑 |
| | | if (projectConfig && !projectConfig.needLogin) { |
| | | wx.showToast({ |
| | | title: '当前用户不可解绑', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | if (getApp().globalData.isLoggedIn) { |
| | | wx.showModal({ |
| | | title: '解绑确认', |
| | | content: '确定要解绑当前账号吗?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | this.unBindPost() |
| | | } |
| | | } |
| | | }); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '还未绑定', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | //轮灌 |
| | | irrigation() { |
| | | if (getApp().globalData.isLoggedIn) { |
| | | wx.navigateTo({ |
| | | url: '/pages/irrigation/irrigation', |
| | | }) |
| | | } else { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | } |
| | | }, |
| | | handleChange(e) { |
| | | const item = e.currentTarget.dataset.item; |
| | | console.log(item); |
| | | this.setData({ |
| | | showConfirm: true, |
| | | waterIntakeName: item.intakeNum, |
| | | myItem: item |
| | | }); |
| | | }, |
| | | closeDialog() { |
| | | console.log("closeDialog"); |
| | | this.setData({ |
| | | showConfirm: false, |
| | | showErrorDialog: false, |
| | | showForceConfirm: false |
| | | }); |
| | | }, |
| | | cancelDialog() { |
| | | this.setData({ |
| | | showForceConfirm: false, |
| | | showConfirm: false |
| | | }); |
| | | }, |
| | | /** |
| | | * 关闭阀门 |
| | | * @param {*} orderNo 订单号 |
| | | * @param {*} rtuAddr 阀控器地址 |
| | | * @param {*} vcNum 虚拟卡编号 |
| | | */ |
| | | postCloseValaue(orderNo, rtuAddr, vcNum) { |
| | | wx.showLoading({ |
| | | title: '正在关阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const app = getApp(); |
| | | const data = { |
| | | rtuAddr: rtuAddr, |
| | | vcNum: vcNum, //虚拟卡ID |
| | | orderNo: orderNo, |
| | | operator: app.globalData.clientId //操作员 |
| | | }; |
| | | console.log("postCloseValaue" + data); |
| | | post({ |
| | | url: "wx/valve/close_wx", |
| | | data: data, |
| | | isShowLoding: false, |
| | | timeout: 185000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | this.getOpenList(); |
| | | }) |
| | | .catch((err) => { |
| | | console.error('加载userData失败:', err); |
| | | wx.showToast({ |
| | | title: '关阀成功', |
| | | icon: 'success', |
| | | duration: 3000 |
| | | }) |
| | | }).catch(error => { |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "关阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "关阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | /** |
| | | * 获取为关阀记录 |
| | | */ |
| | | getOpenList() { |
| | | const app = getApp(); |
| | | if (!getApp().globalData.isLoggedIn) { |
| | | wx.showToast({ |
| | | title: '请先登录', |
| | | icon: 'error' |
| | | }) |
| | | this.setData({ |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }); |
| | | return; |
| | | } |
| | | // 检查是否从登录页返回 |
| | | const fromLogin = this.getFromLogin(); |
| | | |
| | | // 检查clientId是否存在 |
| | | if (!app.globalData.clientId) { |
| | | console.log('getOpenList: clientId不存在,不执行API请求'); |
| | | |
| | | // 如果是从登录页返回,就显示空列表而不是错误提示 |
| | | this.setData({ |
| | | listData: [], |
| | | isRefreshing: false, |
| | | isWXRefreshing: false |
| | | }); |
| | | |
| | | // 如果不是从登录页返回且不处于刷新状态,考虑检查登录状态 |
| | | if (!fromLogin && !this.data.isRefreshing && !this.data.isWXRefreshing) { |
| | | console.log('getOpenList: 非刷新状态下检测到无clientId,尝试自动登录'); |
| | | // 延迟调用微信登录,尝试自动恢复会话 |
| | | setTimeout(() => { |
| | | if (!getApp().globalData.clientId && !this.getFromLogin()) { |
| | | this.wxLogin(); |
| | | } |
| | | }, 1000); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | console.log('getOpenList: 开始获取列表数据, clientId:', app.globalData.clientId); |
| | | |
| | | const params = { |
| | | url: 'wx/valve/get', |
| | | data: { |
| | | operator: app.globalData.clientId |
| | | } |
| | | }; |
| | | |
| | | get(params).then(data => { |
| | | console.log('获取列表数据成功:', data); |
| | | this.setData({ |
| | | listData: data.content, |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }); |
| | | |
| | | // 成功获取数据后刷新UI高度 |
| | | setTimeout(() => { |
| | | this.calculateScrollViewHeight(); |
| | | }, 200); |
| | | }).catch(err => { |
| | | console.error('获取列表数据失败:', err); |
| | | // 错误回调 |
| | | this.setData({ |
| | | isRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | isWXRefreshing: false, // 将triggered属性设置为false,表示下拉刷新已完成 |
| | | }); |
| | | |
| | | // 检查错误类型 |
| | | if (err && err.code === '0003') { |
| | | console.log('会话无效或过期,但不进行跳转'); |
| | | |
| | | // 如果不是从登录页返回,显示错误提示 |
| | | if (!fromLogin) { |
| | | wx.showToast({ |
| | | title: '登录已过期,请刷新重试', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | } else { |
| | | // 一般错误,显示错误信息 |
| | | wx.showToast({ |
| | | title: err.msg || '获取列表数据失败', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | /** |
| | | * 确认关闭回调 |
| | | * @param {} item |
| | | */ |
| | | confirmDialog() { |
| | | this.setData({ |
| | | showConfirm: false |
| | | }); |
| | | this.postCloseValaue(this.data.myItem.orderNo, this.data.myItem.rtuAddr, this.data.myItem.vcNum); |
| | | }, |
| | | //根据session获取农户信息 |
| | | getUserDataBySession() { |
| | | // 先检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('getUserDataBySession: 检测到从登录页返回的标记,不执行API请求'); |
| | | return; |
| | | } |
| | | |
| | | const app = getApp(); |
| | | |
| | | // 检查是否有sessionId |
| | | if (!app.globalData.sessionId) { |
| | | console.log('getUserDataBySession: sessionId不存在,不执行API请求'); |
| | | return; |
| | | } |
| | | |
| | | console.log('getUserDataBySession: 开始获取用户数据, sessionId:', app.globalData.sessionId); |
| | | |
| | | const params = { |
| | | url: 'wx/client/simple_info', |
| | | data: { |
| | | sessionId: app.globalData.sessionId |
| | | } |
| | | }; |
| | | |
| | | get(params).then(data => { |
| | | console.log('获取用户数据成功:', data); |
| | | this.setData({ |
| | | userName: data.content.clientName, |
| | | userPhone: this.maskPhoneNumber(data.content.phone) |
| | | }); |
| | | }).catch(err => { |
| | | console.error('获取用户数据失败:', err); |
| | | // 错误回调,但不进行页面跳转 |
| | | |
| | | // 检查错误类型 |
| | | if (err && err.code === '0003') { |
| | | console.log('会话无效或过期,但不进行跳转'); |
| | | // 不再直接跳转到登录页 |
| | | |
| | | // 清除会话信息 |
| | | app.globalData.sessionId = ''; |
| | | app.globalData.isLoggedIn = false; |
| | | |
| | | // 如果不是从登录页返回,显示错误提示 |
| | | if (!this.getFromLogin()) { |
| | | wx.showToast({ |
| | | title: '登录已过期,请重新登录', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | } else { |
| | | // 其他错误,显示错误信息 |
| | | wx.showToast({ |
| | | title: err.msg || '获取用户信息失败', |
| | | icon: 'none', |
| | | duration: 3000 |
| | | }); |
| | | } |
| | | }); |
| | | }, |
| | | maskPhoneNumber(phoneNumber) { |
| | | if (phoneNumber.length !== 11) { |
| | | throw new Error("Phone number must be 11 digits"); |
| | | } |
| | | // 使用正则表达式替换中间四位数字为星号 |
| | | const maskedPhoneNumber = phoneNumber.replace(/^(\d{3})\d{4}(\d{4})$/, "$1****$2"); |
| | | return maskedPhoneNumber; |
| | | }, |
| | | |
| | | closeDialog() { |
| | | this.setData({ |
| | | showErrorDialog: false |
| | | }) |
| | | }, |
| | | /** |
| | | * 扫码开阀 |
| | | */ |
| | | scenCode() { |
| | | const that = this; |
| | | wx.scanCode({ |
| | | success(res) { |
| | | console.log(res.result); // 当且仅当扫码为非微信二维码时,会返回result |
| | | if (res.result.startsWith("content://")) { |
| | | let jsonStr = res.result.replace("content://", "") |
| | | try { |
| | | |
| | | that.saveData(jsonStr) |
| | | } catch (error) { |
| | | console.error('Error parsing JSON:', error); |
| | | } |
| | | |
| | | } else { |
| | | that.postOppenValva(res.result) |
| | | } |
| | | |
| | | }, |
| | | fail(err) { |
| | | console.error(err); |
| | | } |
| | | }) |
| | | }, |
| | | confirmForceDialog() { |
| | | console.log("confirmForceDialog"); |
| | | this.setData({ |
| | | showForceConfirm: false |
| | | }) |
| | | this.postOppenValva(this.data.lastIntakeName, true) |
| | | }, |
| | | /** |
| | | * |
| | | * @param {*} intakeName |
| | | */ |
| | | postOppenValva(intakeName, isforce) { |
| | | const that = this; |
| | | wx.showLoading({ |
| | | title: '正在开阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const app = getApp(); |
| | | that.setData({ |
| | | lastIntakeName: intakeName |
| | | }) |
| | | const data = { |
| | | intakeName: intakeName, //取水口ID |
| | | // vcId: vcId, //虚拟卡ID |
| | | operator: app.globalData.clientId, //操作员 |
| | | forceOpen: !!isforce // 使用逻辑非操作符 !! 来确保 isForce 是布尔值 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/open_wx", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "10005") { |
| | | that.setData({ |
| | | showForceConfirm: true |
| | | }) |
| | | } else { |
| | | that.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | /** |
| | | * 扫描后保存用户id和tag |
| | | */ |
| | | saveData(userData) { |
| | | storage.setItem("userData", userData).then(() => { |
| | | this.initData(); |
| | | }).catch((error) => { }); |
| | | |
| | | }, |
| | | //进入界面获取界面数据 |
| | | initData() { |
| | | const app = getApp(); |
| | | console.log("initData开始,tag:", app.globalData.tag); |
| | | |
| | | // 首先检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('initData: 检测到从登录页返回的标记,仅获取基本数据'); |
| | | |
| | | // 即使从登录页返回,也尝试获取开阀列表以显示基本UI |
| | | // 但先检查是否有客户端ID可用 |
| | | if (!app.globalData.clientId) { |
| | | console.log('initData: 从登录页返回且无clientId,尝试从存储恢复'); |
| | | // 尝试从存储恢复clientId |
| | | storage.getItemSafe('clientId') |
| | | .then(clientId => { |
| | | if (clientId) { |
| | | console.log('initData: 从存储恢复clientId成功:', clientId); |
| | | app.globalData.clientId = clientId; |
| | | this.getOpenList(); |
| | | } else { |
| | | console.log('initData: 无法恢复clientId,显示空列表'); |
| | | this.setData({ |
| | | listData: [] |
| | | }); |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error('initData: 恢复clientId失败:', err); |
| | | this.setData({ |
| | | listData: [] |
| | | }); |
| | | }); |
| | | } else { |
| | | this.getOpenList(); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = app.globalData.selectedProject; |
| | | const projectConfig = PROJECT_CONFIG[currentProject]; |
| | | const needLogin = projectConfig && projectConfig.needLogin; |
| | | |
| | | // 尝试获取用户数据和已开阀记录 |
| | | try { |
| | | // 优先检查全局变量中是否有sessionId |
| | | if (app.globalData.sessionId) { |
| | | console.log('initData: 使用全局sessionId获取数据'); |
| | | |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否有存储的userData |
| | | const hasUserData = storage.isHasKeySync("userData"); |
| | | console.log('initData: 是否存在userData:', hasUserData); |
| | | |
| | | if (hasUserData) { |
| | | storage.getItemSafe('userData') |
| | | .then((data) => { |
| | | console.log('initData: 成功读取userData'); |
| | | if (data) { |
| | | try { |
| | | let jsonObj = JSON.parse(data); |
| | | app.globalData.sessionId = jsonObj.sessionId; |
| | | app.globalData.tag = jsonObj.tag; |
| | | console.log("userData已加载:", data); |
| | | } catch (e) { |
| | | console.error('userData解析失败:', e); |
| | | } |
| | | } |
| | | |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | }) |
| | | .catch((err) => { |
| | | console.error('加载userData失败:', err); |
| | | |
| | | // 再次检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('initData:catch: 检测到从登录页返回的标记,只获取开阀列表'); |
| | | this.getOpenList(); |
| | | } else { |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData:catch: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData:catch: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | } |
| | | }); |
| | | } else { |
| | | console.log('未找到userData,直接获取数据'); |
| | | |
| | | // 再次检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('initData:else: 检测到从登录页返回的标记,只获取开阀列表'); |
| | | this.getOpenList(); |
| | | } else { |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData:else: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData:else: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | } |
| | | } |
| | | } catch (e) { |
| | | console.error('initData执行出错:', e); |
| | | |
| | | // 再次检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('initData:catch: 检测到从登录页返回的标记,只获取开阀列表'); |
| | | this.getOpenList(); |
| | | console.log('initData:error: 检测到从登录页返回的标记,只获取开阀列表'); |
| | | this.getOpenList(); |
| | | } else { |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData:catch: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData:catch: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData:error: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData:error: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | } |
| | | }); |
| | | } else { |
| | | console.log('未找到userData,直接获取数据'); |
| | | |
| | | // 再次检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('initData:else: 检测到从登录页返回的标记,只获取开阀列表'); |
| | | this.getOpenList(); |
| | | } else { |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData:else: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData:else: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | } |
| | | } |
| | | } catch (e) { |
| | | console.error('initData执行出错:', e); |
| | | |
| | | // 再次检查是否从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('initData:error: 检测到从登录页返回的标记,只获取开阀列表'); |
| | | this.getOpenList(); |
| | | } else { |
| | | // 只有需要登录的项目才调用getUserDataBySession |
| | | if (needLogin) { |
| | | console.log('initData:error: 当前项目需要登录,获取用户数据'); |
| | | this.getUserDataBySession(); |
| | | } else { |
| | | console.log('initData:error: 当前项目不需要登录,跳过获取用户数据'); |
| | | } |
| | | |
| | | this.getOpenList(); |
| | | } |
| | | } |
| | | }, |
| | | // 处理头像点击 |
| | | handleAvatarTap() { |
| | | this.setData({ |
| | | avatarTapCount: this.data.avatarTapCount + 1 |
| | | }); |
| | | |
| | | if (this.data.avatarTapCount >= 5) { |
| | | this.setData({ |
| | | showProjectDialog: true, |
| | | avatarTapCount: 0 |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 处理弹窗可见性变化 |
| | | onVisibleChange(e) { |
| | | // 如果尝试关闭弹窗且没有选择项目,则阻止关闭 |
| | | if (!e.detail.visible && !this.data.selectedProject) { |
| | | return; |
| | | } |
| | | this.setData({ |
| | | showProjectDialog: e.detail.visible |
| | | }); |
| | | }, |
| | | |
| | | // 处理项目选择变化 |
| | | onProjectChange(event) { |
| | | console.log('选择的项目:', event.detail.value); |
| | | this.setData({ |
| | | selectedProject: event.detail.value |
| | | }); |
| | | }, |
| | | |
| | | // 处理项目选择确认 |
| | | handleProjectConfirm() { |
| | | if (!this.data.selectedProject) { |
| | | wx.showToast({ |
| | | title: '请选择项目', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 获取当前已选项目和新选择的项目 |
| | | const currentProject = getApp().globalData.selectedProject; |
| | | const newProject = this.data.selectedProject; |
| | | const projectConfig = PROJECT_CONFIG[newProject]; |
| | | |
| | | if (!projectConfig) { |
| | | wx.showToast({ |
| | | title: '项目配置错误', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否切换了项目(如果当前项目不同于新选择的项目) |
| | | const isProjectChanged = currentProject && currentProject !== newProject; |
| | | |
| | | // 如果切换了项目,先清除登录状态 |
| | | if (isProjectChanged) { |
| | | console.log(`正在从项目 ${currentProject} 切换到 ${newProject},将清除登录状态`); |
| | | |
| | | // 清除全局登录状态 |
| | | getApp().globalData.sessionId = ''; |
| | | getApp().globalData.clientId = ''; |
| | | getApp().globalData.isLoggedIn = false; |
| | | getApp().globalData.userInfo = null; |
| | | |
| | | // 清除存储中的登录状态 |
| | | try { |
| | | wx.removeStorageSync('sessionId'); |
| | | wx.removeStorageSync('clientId'); |
| | | wx.removeStorageSync('userData'); |
| | | wx.removeStorageSync('isLoggedIn'); |
| | | console.log('已清除登录相关的存储数据'); |
| | | } catch (e) { |
| | | console.error('清除存储数据失败:', e); |
| | | } |
| | | |
| | | // 重置UI显示状态 |
| | | this.setData({ |
| | | userName: "请登录", |
| | | userPhone: "", |
| | | listData: [] |
| | | }); |
| | | } |
| | | |
| | | // 保存项目选择到本地存储 |
| | | storage.setItem('selectedProject', newProject).then(() => { |
| | | // 更新 BASEURL |
| | | const baseUrl = PROJECT_URLS[newProject]; |
| | | |
| | | // 更新全局变量 |
| | | getApp().globalData = getApp().globalData || {}; |
| | | getApp().globalData.baseUrl = baseUrl; |
| | | getApp().globalData.selectedProject = newProject; |
| | | |
| | | // 通过配置对象统一设置项目参数 |
| | | getApp().globalData.tag = projectConfig.tag; |
| | | |
| | | // 设置用户界面显示的项目名称 |
| | | this.setData({ |
| | | userName: projectConfig.displayName |
| | | }); |
| | | |
| | | // 对于不需要登录的项目,直接设置operator和clientId |
| | | if (!projectConfig.needLogin && projectConfig.operatorId) { |
| | | const operatorId = projectConfig.operatorId; |
| | | getApp().globalData.operator = operatorId; |
| | | getApp().globalData.clientId = operatorId; |
| | | getApp().globalData.isLoggedIn = true; |
| | | getApp().globalData.sessionId = operatorId; |
| | | |
| | | // 如果有vcId,也设置 |
| | | if (projectConfig.vcId) { |
| | | getApp().globalData.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | // 持久化存储项目参数 |
| | | const params = { |
| | | operator: operatorId, |
| | | clientId: operatorId, |
| | | isLoggedIn: true, |
| | | sessionId: operatorId |
| | | }; |
| | | |
| | | if (projectConfig.vcId) { |
| | | params.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | storage.setItem(`${newProject}_params`, params); |
| | | } |
| | | |
| | | console.log('已切换到项目:', projectConfig.displayName, '域名:', baseUrl, 'tag:', getApp().globalData.tag); |
| | | |
| | | this.setData({ |
| | | showProjectDialog: false |
| | | }); |
| | | |
| | | // 显示切换成功提示 |
| | | wx.showToast({ |
| | | title: `已选择${projectConfig.displayName}`, |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }); |
| | | setTimeout(() => { |
| | | console.log('项目已切换,正在初始化数据'); |
| | | this.initData(); |
| | | }, 1000); |
| | | |
| | | }).catch(err => { |
| | | console.error('保存项目选择失败:', err); |
| | | wx.showToast({ |
| | | title: '保存失败,请重试', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 检查登录状态 |
| | | checkLoginStatus() { |
| | | const app = getApp(); |
| | | |
| | | // 检查是否已登录 |
| | | if (app.globalData.isLoggedIn && app.globalData.sessionId) { |
| | | console.log('已从全局变量检测到登录状态'); |
| | | return; |
| | | } |
| | | |
| | | // 检查本页面是否正在处理返回逻辑 |
| | | const fromLogin = this.getFromLogin(); |
| | | if (fromLogin) { |
| | | console.log('从登录页返回,不再重定向'); |
| | | return; |
| | | } |
| | | |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = app.globalData.selectedProject; |
| | | if (currentProject && PROJECT_CONFIG[currentProject] && !PROJECT_CONFIG[currentProject].needLogin) { |
| | | console.log('当前项目不需要登录:', currentProject); |
| | | return; |
| | | } |
| | | |
| | | // 获取当前页面路由和参数 |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | const currentRoute = currentPage ? currentPage.route : ''; |
| | | const currentOptions = currentPage ? currentPage.options || {} : {}; |
| | | |
| | | console.log('当前页面路由:', currentRoute, '参数:', currentOptions); |
| | | |
| | | // 检查URL参数中是否有fromLogin |
| | | if (currentOptions.fromLogin === 'true') { |
| | | console.log('URL参数中检测到fromLogin=true,不执行跳转'); |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 如果当前已在登录页,不再跳转 |
| | | if (currentRoute === 'pages/login/login') { |
| | | console.log('当前已在登录页,不再跳转'); |
| | | return; |
| | | } |
| | | |
| | | // Promise链处理存储检查 |
| | | Promise.all([ |
| | | storage.getItemSafe('sessionId'), |
| | | storage.getItemSafe('clientId'), |
| | | storage.getItemSafe('isLoggedIn') |
| | | ]) |
| | | .then(([sessionId, clientId, isLoggedIn]) => { |
| | | if (sessionId) { |
| | | // 从存储中恢复登录状态 |
| | | app.globalData.sessionId = sessionId; |
| | | app.globalData.isLoggedIn = true; |
| | | |
| | | if (clientId) { |
| | | app.globalData.clientId = clientId; |
| | | } |
| | | |
| | | console.log('已从存储恢复登录状态'); |
| | | // 已登录,刷新页面 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home' |
| | | }); |
| | | } else { |
| | | // 标记当前页面正在处理返回逻辑 |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | |
| | | // 未登录,可能需要跳转到登录页面 |
| | | console.log('未检测到登录状态,可能需要跳转到登录页'); |
| | | |
| | | // 最后再检查一次是否已从登录页返回 |
| | | const finalCheck = this.getFromLogin(); |
| | | if (finalCheck) { |
| | | console.log('最终检查: 已从登录页返回,不再跳转'); |
| | | return; |
| | | } |
| | | |
| | | // 检查项目是否需要登录 |
| | | if (currentProject && PROJECT_CONFIG[currentProject] && !PROJECT_CONFIG[currentProject].needLogin) { |
| | | console.log('最终检查: 当前项目不需要登录:', currentProject); |
| | | return; |
| | | } |
| | | |
| | | console.log('确认需要跳转到登录页'); |
| | | |
| | | // 跳转前再次检查登录页面临时标记 |
| | | try { |
| | | wx.setStorageSync('_attempted_login_redirect', 'true'); |
| | | } catch (e) {} |
| | | |
| | | // wx.navigateTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}`, |
| | | // success: () => console.log('成功跳转到登录页'), |
| | | // fail: (err) => console.error('跳转到登录页失败:', err) |
| | | // }); |
| | | } |
| | | }) |
| | | .catch(err => { |
| | | console.error('检查登录状态时出错:', err); |
| | | |
| | | // 标记当前页面正在处理返回逻辑 |
| | | }, |
| | | // 处理头像点击 |
| | | handleAvatarTap() { |
| | | this.setData({ |
| | | isFromLogin: true |
| | | avatarTapCount: this.data.avatarTapCount + 1 |
| | | }); |
| | | |
| | | // 再次检查是否已从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('错误处理: 已从登录页返回,不再跳转'); |
| | | return; |
| | | if (this.data.avatarTapCount >= 5) { |
| | | this.setData({ |
| | | showProjectDialog: true, |
| | | avatarTapCount: 0 |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 处理弹窗可见性变化 |
| | | onVisibleChange(e) { |
| | | // 如果尝试关闭弹窗且没有选择项目,则阻止关闭 |
| | | if (!e.detail.visible && !this.data.selectedProject) { |
| | | return; |
| | | } |
| | | this.setData({ |
| | | showProjectDialog: e.detail.visible |
| | | }); |
| | | }, |
| | | |
| | | // 处理项目选择变化 |
| | | onProjectChange(event) { |
| | | console.log('选择的项目:', event.detail.value); |
| | | this.setData({ |
| | | selectedProject: event.detail.value |
| | | }); |
| | | }, |
| | | |
| | | // 处理项目选择确认 |
| | | handleProjectConfirm() { |
| | | if (!this.data.selectedProject) { |
| | | wx.showToast({ |
| | | title: '请选择项目', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 检查项目是否需要登录 |
| | | // 获取当前已选项目和新选择的项目 |
| | | const currentProject = getApp().globalData.selectedProject; |
| | | const newProject = this.data.selectedProject; |
| | | const projectConfig = PROJECT_CONFIG[newProject]; |
| | | |
| | | if (!projectConfig) { |
| | | wx.showToast({ |
| | | title: '项目配置错误', |
| | | icon: 'none' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 检查是否切换了项目(如果当前项目不同于新选择的项目) |
| | | const isProjectChanged = currentProject && currentProject !== newProject; |
| | | |
| | | // 如果切换了项目,先清除登录状态 |
| | | if (isProjectChanged) { |
| | | console.log(`正在从项目 ${currentProject} 切换到 ${newProject},将清除登录状态`); |
| | | |
| | | // 清除全局登录状态 |
| | | getApp().globalData.sessionId = ''; |
| | | getApp().globalData.clientId = ''; |
| | | getApp().globalData.isLoggedIn = false; |
| | | getApp().globalData.userInfo = null; |
| | | |
| | | // 清除存储中的登录状态 |
| | | try { |
| | | wx.removeStorageSync('sessionId'); |
| | | wx.removeStorageSync('clientId'); |
| | | wx.removeStorageSync('userData'); |
| | | wx.removeStorageSync('isLoggedIn'); |
| | | console.log('已清除登录相关的存储数据'); |
| | | } catch (e) { |
| | | console.error('清除存储数据失败:', e); |
| | | } |
| | | |
| | | // 重置UI显示状态 |
| | | this.setData({ |
| | | userName: "请登录", |
| | | userPhone: "", |
| | | listData: [] |
| | | }); |
| | | } |
| | | |
| | | // 保存项目选择到本地存储 |
| | | storage.setItem('selectedProject', newProject).then(() => { |
| | | // 更新 BASEURL |
| | | const baseUrl = PROJECT_URLS[newProject]; |
| | | |
| | | // 更新全局变量 |
| | | getApp().globalData = getApp().globalData || {}; |
| | | getApp().globalData.baseUrl = baseUrl; |
| | | getApp().globalData.selectedProject = newProject; |
| | | |
| | | // 通过配置对象统一设置项目参数 |
| | | getApp().globalData.tag = projectConfig.tag; |
| | | |
| | | // 设置用户界面显示的项目名称 |
| | | this.setData({ |
| | | userName: projectConfig.displayName |
| | | }); |
| | | |
| | | // 对于不需要登录的项目,直接设置operator和clientId |
| | | if (!projectConfig.needLogin && projectConfig.operatorId) { |
| | | const operatorId = projectConfig.operatorId; |
| | | getApp().globalData.operator = operatorId; |
| | | getApp().globalData.clientId = operatorId; |
| | | getApp().globalData.isLoggedIn = true; |
| | | getApp().globalData.sessionId = operatorId; |
| | | |
| | | // 如果有vcId,也设置 |
| | | if (projectConfig.vcId) { |
| | | getApp().globalData.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | // 持久化存储项目参数 |
| | | const params = { |
| | | operator: operatorId, |
| | | clientId: operatorId, |
| | | isLoggedIn: true, |
| | | sessionId: operatorId |
| | | }; |
| | | |
| | | if (projectConfig.vcId) { |
| | | params.vcId = projectConfig.vcId; |
| | | } |
| | | |
| | | storage.setItem(`${newProject}_params`, params); |
| | | } |
| | | |
| | | console.log('已切换到项目:', projectConfig.displayName, '域名:', baseUrl, 'tag:', getApp().globalData.tag); |
| | | |
| | | this.setData({ |
| | | showProjectDialog: false |
| | | }); |
| | | |
| | | // 显示切换成功提示 |
| | | wx.showToast({ |
| | | title: `已选择${projectConfig.displayName}`, |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }); |
| | | setTimeout(() => { |
| | | console.log('项目已切换,正在初始化数据'); |
| | | this.initData(); |
| | | }, 1000); |
| | | |
| | | }).catch(err => { |
| | | console.error('保存项目选择失败:', err); |
| | | wx.showToast({ |
| | | title: '保存失败,请重试', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | // 检查登录状态 |
| | | checkLoginStatus() { |
| | | const app = getApp(); |
| | | |
| | | // 检查是否已登录 |
| | | if (app.globalData.isLoggedIn && app.globalData.sessionId) { |
| | | console.log('已从全局变量检测到登录状态'); |
| | | return; |
| | | } |
| | | |
| | | // 检查本页面是否正在处理返回逻辑 |
| | | const fromLogin = this.getFromLogin(); |
| | | if (fromLogin) { |
| | | console.log('从登录页返回,不再重定向'); |
| | | return; |
| | | } |
| | | |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = app.globalData.selectedProject; |
| | | if (currentProject && PROJECT_CONFIG[currentProject] && !PROJECT_CONFIG[currentProject].needLogin) { |
| | | console.log('错误处理: 当前项目不需要登录:', currentProject); |
| | | return; |
| | | console.log('当前项目不需要登录:', currentProject); |
| | | return; |
| | | } |
| | | |
| | | // 出错时也跳转到登录页 |
| | | // wx.navigateTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}`, |
| | | // success: () => console.log('错误后成功跳转到登录页'), |
| | | // fail: (err) => console.error('错误后跳转到登录页失败:', err) |
| | | // }); |
| | | }); |
| | | }, |
| | | // 获取当前页面路由和参数 |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | const currentRoute = currentPage ? currentPage.route : ''; |
| | | const currentOptions = currentPage ? currentPage.options || {} : {}; |
| | | |
| | | // 辅助函数:检查是否从登录页返回 |
| | | getFromLogin() { |
| | | // 检查当前页面的options |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | if (currentPage && currentPage.options && currentPage.options.fromLogin === 'true') { |
| | | console.log('getFromLogin: 检测到URL参数fromLogin=true'); |
| | | // 设置标志,确保下次检查时能识别 |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | return true; |
| | | } |
| | | console.log('getFromLogin: 未检测到从登录页返回的标记'); |
| | | return false; |
| | | }, |
| | | console.log('当前页面路由:', currentRoute, '参数:', currentOptions); |
| | | |
| | | // 继续初始化页面 |
| | | continueInitPage(options) { |
| | | console.log('继续初始化页面,options:', options); |
| | | |
| | | // 检查是否从登录页返回 |
| | | let fromLogin = false; |
| | | |
| | | // 从URL参数中检查 |
| | | if (options && options.fromLogin === 'true') { |
| | | console.log('continueInitPage: 从URL参数检测到fromLogin=true'); |
| | | fromLogin = true; |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | } |
| | | |
| | | // 从页面数据中检查 |
| | | if (this.data.isFromLogin) { |
| | | console.log('continueInitPage: 从页面数据中检测到isFromLogin=true'); |
| | | fromLogin = true; |
| | | } |
| | | |
| | | // 判断本地是否保存sessionId |
| | | // 使用 wx.nextTick 等待页面渲染完成 |
| | | wx.nextTick(() => { |
| | | this.calculateScrollViewHeight(); |
| | | }); |
| | | |
| | | // 当开阀成功后调用刷新 |
| | | if (options && options.param) { |
| | | console.log("开阀成功参数:", options.param); |
| | | wx.showToast({ |
| | | title: '开阀成功', |
| | | icon: 'success', |
| | | duration: 3000 |
| | | }); |
| | | this.getOpenList(); |
| | | } |
| | | |
| | | // 初始化数据 |
| | | this.initData(); |
| | | |
| | | // 如果不是从登录页返回,则设置延迟检查登录状态 |
| | | if (!fromLogin) { |
| | | console.log('不是从登录页返回,延迟检查登录状态'); |
| | | setTimeout(() => { |
| | | // 仅在未登录且不是从登录页返回时检查登录状态 |
| | | if (!getApp().globalData.isLoggedIn) { |
| | | console.log('延迟检查:未登录且不是从登录页返回,执行登录状态检查'); |
| | | this.checkLoginStatus(); |
| | | // 检查URL参数中是否有fromLogin |
| | | if (currentOptions.fromLogin === 'true') { |
| | | console.log('URL参数中检测到fromLogin=true,不执行跳转'); |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | return; |
| | | } |
| | | }, 500); |
| | | } else { |
| | | console.log('从登录页返回,不检查登录状态'); |
| | | } |
| | | }, |
| | | |
| | | // 微信登录 |
| | | wxLogin() { |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = getApp().globalData.selectedProject; |
| | | if (currentProject && PROJECT_CONFIG[currentProject] && !PROJECT_CONFIG[currentProject].needLogin) { |
| | | console.log('wxLogin: 当前项目不需要登录:', currentProject); |
| | | return; |
| | | } |
| | | |
| | | if (!getApp().globalData.isLoggedIn) { |
| | | wx.showLoading({ |
| | | title: '正在登录请稍候...', |
| | | mask: true |
| | | }); |
| | | // 如果当前已在登录页,不再跳转 |
| | | if (currentRoute === 'pages/login/login') { |
| | | console.log('当前已在登录页,不再跳转'); |
| | | return; |
| | | } |
| | | |
| | | wx.login({ |
| | | success: (res) => { |
| | | if (res.code) { |
| | | // 将code发送到服务器获取openid |
| | | post({ |
| | | url: "wx/client/code_login", |
| | | data: { |
| | | code: res.code |
| | | } |
| | | }).then(response => { |
| | | wx.hideLoading(); |
| | | if (response.code === "0001") { |
| | | if (response.content.client.clientId === "") { |
| | | // 未绑定账号,跳转到登录页面 |
| | | // wx.navigateTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}` |
| | | // }); |
| | | // Promise链处理存储检查 |
| | | Promise.all([ |
| | | storage.getItemSafe('sessionId'), |
| | | storage.getItemSafe('clientId'), |
| | | storage.getItemSafe('isLoggedIn') |
| | | ]) |
| | | .then(([sessionId, clientId, isLoggedIn]) => { |
| | | if (sessionId) { |
| | | // 从存储中恢复登录状态 |
| | | app.globalData.sessionId = sessionId; |
| | | app.globalData.isLoggedIn = true; |
| | | |
| | | if (clientId) { |
| | | app.globalData.clientId = clientId; |
| | | } |
| | | |
| | | console.log('已从存储恢复登录状态'); |
| | | // 已登录,刷新页面 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home' |
| | | }); |
| | | } else { |
| | | this.setData({ |
| | | userName: response.content.client.clientName, |
| | | userPhone: response.content.client.userPhone |
| | | }) |
| | | // 已有账号,保存数据并初始化 |
| | | const sessionId = response.content.client.sessionId; |
| | | const clientId = response.content.client.clientId; |
| | | |
| | | // 设置全局变量 |
| | | getApp().globalData.sessionId = sessionId; |
| | | getApp().globalData.clientId = clientId; |
| | | getApp().globalData.isLoggedIn = true; |
| | | |
| | | // 设置正确的项目tag |
| | | const projectConfig = PROJECT_CONFIG[this.data.selectedProject]; |
| | | if (projectConfig) { |
| | | getApp().globalData.tag = projectConfig.tag; |
| | | } |
| | | |
| | | // 保存到存储 |
| | | storage.setItem("sessionId", sessionId); |
| | | storage.setItem("clientId", clientId); |
| | | storage.setItem("isLoggedIn", "true"); |
| | | |
| | | // 保存userData信息,包含sessionId和tag |
| | | const userData = JSON.stringify({ |
| | | sessionId: sessionId, |
| | | tag: projectConfig ? projectConfig.tag : 'ym', |
| | | project: this.data.selectedProject, |
| | | userName: response.content.client.clientName, |
| | | userPhone: response.content.client.userPhone |
| | | }); |
| | | storage.setItem("userData", userData) |
| | | .then(() => { |
| | | console.log('用户数据保存成功,包含项目信息:', this.data.selectedProject, 'tag:', projectConfig ? projectConfig.tag : 'ym'); |
| | | this.initData(); |
| | | }) |
| | | .catch(err => { |
| | | console.warn('保存userData失败,但继续初始化:', err); |
| | | this.initData(); |
| | | // 标记当前页面正在处理返回逻辑 |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | |
| | | // 未登录,可能需要跳转到登录页面 |
| | | console.log('未检测到登录状态,可能需要跳转到登录页'); |
| | | |
| | | // 最后再检查一次是否已从登录页返回 |
| | | const finalCheck = this.getFromLogin(); |
| | | if (finalCheck) { |
| | | console.log('最终检查: 已从登录页返回,不再跳转'); |
| | | return; |
| | | } |
| | | |
| | | // 检查项目是否需要登录 |
| | | if (currentProject && PROJECT_CONFIG[currentProject] && !PROJECT_CONFIG[currentProject].needLogin) { |
| | | console.log('最终检查: 当前项目不需要登录:', currentProject); |
| | | return; |
| | | } |
| | | |
| | | console.log('确认需要跳转到登录页'); |
| | | |
| | | // 跳转前再次检查登录页面临时标记 |
| | | try { |
| | | wx.setStorageSync('_attempted_login_redirect', 'true'); |
| | | } catch (e) { } |
| | | |
| | | // wx.navigateTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}`, |
| | | // success: () => console.log('成功跳转到登录页'), |
| | | // fail: (err) => console.error('跳转到登录页失败:', err) |
| | | // }); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: '登录失败', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }) |
| | | .catch(err => { |
| | | console.error('检查登录状态时出错:', err); |
| | | |
| | | // 标记当前页面正在处理返回逻辑 |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | |
| | | // 再次检查是否已从登录页返回 |
| | | if (this.getFromLogin()) { |
| | | console.log('错误处理: 已从登录页返回,不再跳转'); |
| | | return; |
| | | } |
| | | |
| | | // 检查项目是否需要登录 |
| | | if (currentProject && PROJECT_CONFIG[currentProject] && !PROJECT_CONFIG[currentProject].needLogin) { |
| | | console.log('错误处理: 当前项目不需要登录:', currentProject); |
| | | return; |
| | | } |
| | | |
| | | // 出错时也跳转到登录页 |
| | | // wx.navigateTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}` |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}`, |
| | | // success: () => console.log('错误后成功跳转到登录页'), |
| | | // fail: (err) => console.error('错误后跳转到登录页失败:', err) |
| | | // }); |
| | | } |
| | | }).catch(error => { |
| | | wx.hideLoading(); |
| | | console.error('登录请求失败:', error); |
| | | wx.showToast({ |
| | | title: '登录失败,请重试', |
| | | icon: 'none' |
| | | }); |
| | | // wx.redirectTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}` |
| | | // }); |
| | | }); |
| | | } else { |
| | | wx.hideLoading(); |
| | | console.log('登录失败!' + res.errMsg); |
| | | wx.showToast({ |
| | | title: '微信登录失败', |
| | | icon: 'none' |
| | | }, |
| | | |
| | | // 辅助函数:检查是否从登录页返回 |
| | | getFromLogin() { |
| | | // 检查当前页面的options |
| | | const pages = getCurrentPages(); |
| | | const currentPage = pages[pages.length - 1]; |
| | | if (currentPage && currentPage.options && currentPage.options.fromLogin === 'true') { |
| | | console.log('getFromLogin: 检测到URL参数fromLogin=true'); |
| | | // 设置标志,确保下次检查时能识别 |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | wx.hideLoading(); |
| | | console.error('微信登录API调用失败:', err); |
| | | wx.showToast({ |
| | | title: '登录失败,请重试', |
| | | icon: 'none' |
| | | }); |
| | | return true; |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | console.log('getFromLogin: 未检测到从登录页返回的标记'); |
| | | return false; |
| | | }, |
| | | |
| | | // 辅助函数:清理临时标记 |
| | | cleanupTempMarkers() { |
| | | // 只有在isFromLogin为true时才进行清理 |
| | | if (this.data.isFromLogin) { |
| | | // 继续初始化页面 |
| | | continueInitPage(options) { |
| | | console.log('继续初始化页面,options:', options); |
| | | |
| | | // 检查是否从登录页返回 |
| | | let fromLogin = false; |
| | | |
| | | // 从URL参数中检查 |
| | | if (options && options.fromLogin === 'true') { |
| | | console.log('continueInitPage: 从URL参数检测到fromLogin=true'); |
| | | fromLogin = true; |
| | | this.setData({ |
| | | isFromLogin: true |
| | | }); |
| | | } |
| | | |
| | | // 从页面数据中检查 |
| | | if (this.data.isFromLogin) { |
| | | console.log('continueInitPage: 从页面数据中检测到isFromLogin=true'); |
| | | fromLogin = true; |
| | | } |
| | | |
| | | // 判断本地是否保存sessionId |
| | | // 使用 wx.nextTick 等待页面渲染完成 |
| | | wx.nextTick(() => { |
| | | this.calculateScrollViewHeight(); |
| | | }); |
| | | |
| | | // 当开阀成功后调用刷新 |
| | | if (options && options.param) { |
| | | console.log("开阀成功参数:", options.param); |
| | | wx.showToast({ |
| | | title: '开阀成功', |
| | | icon: 'success', |
| | | duration: 3000 |
| | | }); |
| | | this.getOpenList(); |
| | | } |
| | | |
| | | // 初始化数据 |
| | | this.initData(); |
| | | |
| | | // 如果不是从登录页返回,则设置延迟检查登录状态 |
| | | if (!fromLogin) { |
| | | console.log('不是从登录页返回,延迟检查登录状态'); |
| | | setTimeout(() => { |
| | | // 仅在未登录且不是从登录页返回时检查登录状态 |
| | | if (!getApp().globalData.isLoggedIn) { |
| | | console.log('延迟检查:未登录且不是从登录页返回,执行登录状态检查'); |
| | | this.checkLoginStatus(); |
| | | } |
| | | }, 500); |
| | | } else { |
| | | console.log('从登录页返回,不检查登录状态'); |
| | | } |
| | | }, |
| | | |
| | | // 微信登录 |
| | | wxLogin() { |
| | | // 检查当前项目是否需要登录 |
| | | const currentProject = getApp().globalData.selectedProject; |
| | | if (currentProject && PROJECT_CONFIG[currentProject] && !PROJECT_CONFIG[currentProject].needLogin) { |
| | | console.log('wxLogin: 当前项目不需要登录:', currentProject); |
| | | return; |
| | | } |
| | | |
| | | if (!getApp().globalData.isLoggedIn) { |
| | | wx.showLoading({ |
| | | title: '正在登录请稍候...', |
| | | mask: true |
| | | }); |
| | | |
| | | wx.login({ |
| | | success: (res) => { |
| | | if (res.code) { |
| | | // 将code发送到服务器获取openid |
| | | post({ |
| | | url: "wx/client/code_login", |
| | | data: { |
| | | code: res.code |
| | | } |
| | | }).then(response => { |
| | | wx.hideLoading(); |
| | | if (response.code === "0001") { |
| | | if (response.content.client.clientId === "") { |
| | | // 未绑定账号,跳转到登录页面 |
| | | // wx.navigateTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}` |
| | | // }); |
| | | } else { |
| | | this.setData({ |
| | | userName: response.content.client.clientName, |
| | | userPhone: response.content.client.userPhone |
| | | }) |
| | | // 已有账号,保存数据并初始化 |
| | | const sessionId = response.content.client.sessionId; |
| | | const clientId = response.content.client.clientId; |
| | | |
| | | // 设置全局变量 |
| | | getApp().globalData.sessionId = sessionId; |
| | | getApp().globalData.clientId = clientId; |
| | | getApp().globalData.isLoggedIn = true; |
| | | |
| | | // 设置正确的项目tag |
| | | const projectConfig = PROJECT_CONFIG[this.data.selectedProject]; |
| | | if (projectConfig) { |
| | | getApp().globalData.tag = projectConfig.tag; |
| | | } |
| | | |
| | | // 保存到存储 |
| | | storage.setItem("sessionId", sessionId); |
| | | storage.setItem("clientId", clientId); |
| | | storage.setItem("isLoggedIn", "true"); |
| | | |
| | | // 保存userData信息,包含sessionId和tag |
| | | const userData = JSON.stringify({ |
| | | sessionId: sessionId, |
| | | tag: projectConfig ? projectConfig.tag : 'ym', |
| | | project: this.data.selectedProject, |
| | | userName: response.content.client.clientName, |
| | | userPhone: response.content.client.userPhone |
| | | }); |
| | | storage.setItem("userData", userData) |
| | | .then(() => { |
| | | console.log('用户数据保存成功,包含项目信息:', this.data.selectedProject, 'tag:', projectConfig ? projectConfig.tag : 'ym'); |
| | | this.initData(); |
| | | }) |
| | | .catch(err => { |
| | | console.warn('保存userData失败,但继续初始化:', err); |
| | | this.initData(); |
| | | }); |
| | | |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | title: '登录失败', |
| | | icon: 'error', |
| | | duration: 2000 |
| | | }); |
| | | // wx.navigateTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}` |
| | | // }); |
| | | } |
| | | }).catch(error => { |
| | | wx.hideLoading(); |
| | | console.error('登录请求失败:', error); |
| | | wx.showToast({ |
| | | title: '登录失败,请重试', |
| | | icon: 'none' |
| | | }); |
| | | // wx.redirectTo({ |
| | | // url: `/pages/login/login?project=${this.data.selectedProject}` |
| | | // }); |
| | | }); |
| | | } else { |
| | | wx.hideLoading(); |
| | | console.log('登录失败!' + res.errMsg); |
| | | wx.showToast({ |
| | | title: '微信登录失败', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }, |
| | | fail: (err) => { |
| | | wx.hideLoading(); |
| | | console.error('微信登录API调用失败:', err); |
| | | wx.showToast({ |
| | | title: '登录失败,请重试', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | |
| | | // 辅助函数:清理临时标记 |
| | | cleanupTempMarkers() { |
| | | // 只有在isFromLogin为true时才进行清理 |
| | | if (this.data.isFromLogin) { |
| | | |
| | | |
| | | // 重设isFromLogin为false,但添加延迟,避免影响当前页面的返回逻辑 |
| | | setTimeout(() => { |
| | | // 重设isFromLogin为false,但添加延迟,避免影响当前页面的返回逻辑 |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | isFromLogin: false |
| | | }); |
| | | console.log('重置isFromLogin=false'); |
| | | }, 5000); |
| | | } |
| | | }, //确认解绑 |
| | | unBindPost() { |
| | | this.setData({ |
| | | isFromLogin: false |
| | | }); |
| | | console.log('重置isFromLogin=false'); |
| | | }, 5000); |
| | | } |
| | | }, //确认解绑 |
| | | unBindPost() { |
| | | this.setData({ |
| | | showUnBind: false |
| | | }) |
| | | wx.showLoading({ |
| | | title: '正在解绑请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const data = { |
| | | sessionId: getApp().globalData.sessionId //取水口ID |
| | | }; |
| | | post({ |
| | | url: 'wx/client/unbind', |
| | | data: data, |
| | | useParams: true |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | const app = getApp(); |
| | | |
| | | // 清除全局登录状态 |
| | | app.globalData.sessionId = ''; |
| | | app.globalData.clientId = ''; |
| | | app.globalData.isLoggedIn = false; |
| | | app.globalData.userInfo = null; |
| | | |
| | | // 清除存储中的登录状态 |
| | | const storage = require('../../utils/storage.js'); |
| | | storage.removeItem('sessionId') |
| | | .then(() => storage.removeItem('clientId')) |
| | | .then(() => storage.removeItem('userData')) |
| | | .then(() => storage.removeItem('isLoggedIn')) |
| | | .then(() => { |
| | | wx.showToast({ |
| | | title: '解绑成功', |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }); |
| | | |
| | | // 重置UI显示状态 |
| | | this.setData({ |
| | | userName: "请点击登录", |
| | | userPhone: "", |
| | | listData: [] |
| | | }); |
| | | showUnBind: false |
| | | }) |
| | | .catch(err => { |
| | | console.error('解绑过程中出错:', err); |
| | | wx.showToast({ |
| | | title: '解绑失败,请重试', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | wx.showLoading({ |
| | | title: '正在解绑请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | wx.showToast({ |
| | | title: '解绑失败', |
| | | icon: 'error', |
| | | duration: 3000 |
| | | }) |
| | | }); |
| | | }, |
| | | onShareAppMessage: function (options) { |
| | | // 设置分享内容 |
| | | return { |
| | | title: '大禹灌溉助手', // 分享标题 |
| | | path: '/pages/home/home', // 分享路径,该路径需要是当前小程序存在的页面路径 |
| | | imageUrl: '/images/logo2.jpg', // 分享图标,可以是网络图片路径或本地图片路径 |
| | | success: function (res) { |
| | | // 分享成功的回调函数 |
| | | }, |
| | | fail: function (res) { |
| | | // 分享失败的回调函数 |
| | | } |
| | | }; |
| | | } |
| | | const data = { |
| | | sessionId: getApp().globalData.sessionId //取水口ID |
| | | }; |
| | | post({ |
| | | url: 'wx/client/unbind', |
| | | data: data, |
| | | useParams: true |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | const app = getApp(); |
| | | |
| | | // 清除全局登录状态 |
| | | app.globalData.sessionId = ''; |
| | | app.globalData.clientId = ''; |
| | | app.globalData.isLoggedIn = false; |
| | | app.globalData.userInfo = null; |
| | | |
| | | // 清除存储中的登录状态 |
| | | const storage = require('../../utils/storage.js'); |
| | | storage.removeItem('sessionId') |
| | | .then(() => storage.removeItem('clientId')) |
| | | .then(() => storage.removeItem('userData')) |
| | | .then(() => storage.removeItem('isLoggedIn')) |
| | | .then(() => { |
| | | wx.showToast({ |
| | | title: '解绑成功', |
| | | icon: 'success', |
| | | duration: 2000 |
| | | }); |
| | | |
| | | // 重置UI显示状态 |
| | | this.setData({ |
| | | userName: "请点击登录", |
| | | userPhone: "", |
| | | listData: [] |
| | | }); |
| | | }) |
| | | .catch(err => { |
| | | console.error('解绑过程中出错:', err); |
| | | wx.showToast({ |
| | | title: '解绑失败,请重试', |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | wx.showToast({ |
| | | title: '解绑失败', |
| | | icon: 'error', |
| | | duration: 3000 |
| | | }) |
| | | }); |
| | | }, |
| | | onShareAppMessage: function (options) { |
| | | // 设置分享内容 |
| | | return { |
| | | title: '大禹灌溉助手', // 分享标题 |
| | | path: '/pages/home/home', // 分享路径,该路径需要是当前小程序存在的页面路径 |
| | | imageUrl: '/images/logo2.jpg', // 分享图标,可以是网络图片路径或本地图片路径 |
| | | success: function (res) { |
| | | // 分享成功的回调函数 |
| | | }, |
| | | fail: function (res) { |
| | | // 分享失败的回调函数 |
| | | } |
| | | }; |
| | | }, |
| | | //点击提示按钮 |
| | | infoShow() { |
| | | this.setData({ |
| | | showInfoDialog: true |
| | | }) |
| | | }, |
| | | //提示窗确认按钮 |
| | | confirmBtnInfoDialog() { |
| | | this.setData({ |
| | | showInfoDialog: false |
| | | }) |
| | | }, |
| | | }) |
| | |
| | | |
| | | |
| | | <view class="bottom-title"> |
| | | <text class="bottom-title-text">快速关阀</text> |
| | | <view class="title-center"> |
| | | <text class="bottom-title-text">快速关阀</text> |
| | | <image class="info-img" bind:tap="infoShow" src="/images/info.svg"></image> |
| | | </view> |
| | | <text class="refresh-button" bind:tap="startPullDownRefresh">刷新</text> |
| | | </view> |
| | | <view class="divider"></view> |
| | |
| | | </view> |
| | | </view> |
| | | <t-dialog class="dialog" title="通知结果" visible="{{showTipDialog}}" content="{{tipData}}" confirm-btn="{{ confirmBtn }}" bind:confirm="cancelDialog" /> |
| | | <t-dialog visible="{{showInfoDialog}}" title="友情提示" confirm-btn="{{ confirmBtn }}" bind:confirm="confirmBtnInfoDialog"> |
| | | <!-- 适配skyline,增加type="list" --> |
| | | <scroll-view slot="content" type="list" scroll-y class="long-content"> |
| | | <view class="content-container"> |
| | | <text class="content-container"> |
| | | 1.网络等不可抗力因素可能导致设备状态显示延迟或错误。 |
| | | 2.当提示您操作失败后您可稍后尝试重新操作。 |
| | | 3.在定时或定量开阀的预约式开阀后,只有阀门到达约定的时间成功开阀后未关阀记录才会显示。 |
| | | 4.我们诚挚地邀请您通过意见反馈渠道提出宝贵的建议或意见。 |
| | | </text> |
| | | |
| | | </view> |
| | | </scroll-view> |
| | | </t-dialog> |
| | | </view> |
| | |
| | | /* pages/home/home.wxss */ |
| | | .base-wrapper { |
| | | background-color: #ececec; |
| | | width: 100%; |
| | | height: 100vh; |
| | | overflow: hidden; |
| | | /* 防止底部区域滚动 */ |
| | | display: flex; |
| | | flex-direction: column; |
| | | background-color: #ececec; |
| | | width: 100%; |
| | | height: 100vh; |
| | | overflow: hidden; |
| | | /* 防止底部区域滚动 */ |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .head-wrapper { |
| | | background-color: #1890FF; |
| | | height: 25vh; |
| | | width: 100%; |
| | | padding-left: 40rpx; |
| | | display: grid; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | border-bottom-left-radius: 5rpx; |
| | | border-bottom-right-radius: 5rpx; |
| | | z-index: 1; |
| | | border-top: 1px solid #0484fc; |
| | | background-color: #1890FF; |
| | | height: 25vh; |
| | | width: 100%; |
| | | padding-left: 40rpx; |
| | | display: grid; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | border-bottom-left-radius: 5rpx; |
| | | border-bottom-right-radius: 5rpx; |
| | | z-index: 1; |
| | | border-top: 1px solid #0484fc; |
| | | |
| | | } |
| | | |
| | | .head-top { |
| | | display: flex; |
| | | align-items: center; |
| | | /* 在纵向方向上居中对齐 */ |
| | | display: flex; |
| | | align-items: center; |
| | | /* 在纵向方向上居中对齐 */ |
| | | } |
| | | |
| | | |
| | | .head-text-wrapper { |
| | | flex: 1; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: left; |
| | | justify-content: center; |
| | | margin-left: 15rpx; |
| | | flex: 1; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: left; |
| | | justify-content: center; |
| | | margin-left: 15rpx; |
| | | } |
| | | |
| | | .head-button-wrapper { |
| | | flex: 1; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | margin-left: 15rpx; |
| | | flex: 1; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | justify-content: center; |
| | | margin-left: 15rpx; |
| | | } |
| | | |
| | | |
| | | .head-bottom { |
| | | margin-top: 20rpx; |
| | | color: #fff; |
| | | font-size: 35rpx; |
| | | margin-top: 20rpx; |
| | | color: #fff; |
| | | font-size: 35rpx; |
| | | } |
| | | |
| | | .unbind { |
| | | font-size: 30rpx; |
| | | /* 按钮文字的字体大小 */ |
| | | color: #1890FF; |
| | | /* 按钮文字颜色 */ |
| | | background-color: #fff; |
| | | /* 按钮背景颜色 */ |
| | | border: none; |
| | | /* 去掉按钮边框 */ |
| | | border-radius: 20px; |
| | | /* 按钮圆角 */ |
| | | padding-left: 20rpx; |
| | | padding-right: 20rpx; |
| | | padding-top: 5rpx; |
| | | padding-bottom: 5rpx; |
| | | margin-bottom: 10rpx; |
| | | font-size: 30rpx; |
| | | /* 按钮文字的字体大小 */ |
| | | color: #1890FF; |
| | | /* 按钮文字颜色 */ |
| | | background-color: #fff; |
| | | /* 按钮背景颜色 */ |
| | | border: none; |
| | | /* 去掉按钮边框 */ |
| | | border-radius: 20px; |
| | | /* 按钮圆角 */ |
| | | padding-left: 20rpx; |
| | | padding-right: 20rpx; |
| | | padding-top: 5rpx; |
| | | padding-bottom: 5rpx; |
| | | margin-bottom: 10rpx; |
| | | } |
| | | |
| | | .head-text-wrapper text { |
| | | color: #fff; |
| | | font-size: 32rpx; |
| | | color: #fff; |
| | | font-size: 32rpx; |
| | | } |
| | | |
| | | .balance-label { |
| | | margin-bottom: 40rpx; |
| | | color: #fff; |
| | | font-size: 35rpx; |
| | | margin-bottom: 40rpx; |
| | | color: #fff; |
| | | font-size: 35rpx; |
| | | } |
| | | |
| | | .center-wrapper { |
| | | margin-top: -40rpx; |
| | | margin-right: 20rpx; |
| | | margin-left: 20rpx; |
| | | margin-bottom: 10rpx; |
| | | height: 18vh; |
| | | background-color: #fff; |
| | | border-radius: 5px; |
| | | display: flex; |
| | | padding-top: 20rpx; |
| | | padding-bottom: 20rpx; |
| | | justify-content: space-around; |
| | | z-index: 1; |
| | | /* 使 center-wrapper 在头部之上 */ |
| | | margin-top: -40rpx; |
| | | margin-right: 20rpx; |
| | | margin-left: 20rpx; |
| | | margin-bottom: 10rpx; |
| | | height: 18vh; |
| | | background-color: #fff; |
| | | border-radius: 5px; |
| | | display: flex; |
| | | padding-top: 20rpx; |
| | | padding-bottom: 20rpx; |
| | | justify-content: space-around; |
| | | z-index: 1; |
| | | /* 使 center-wrapper 在头部之上 */ |
| | | } |
| | | |
| | | .center-view { |
| | | flex: 1; |
| | | /* 每个元素平分宽度 */ |
| | | display: flex; |
| | | flex-direction: column; |
| | | /* 在纵向上排列子元素 */ |
| | | align-items: center; |
| | | /* 在纵向上居中显示子元素 */ |
| | | justify-content: center; |
| | | /* 在横向和纵向上都居中显示子元素 */ |
| | | flex: 1; |
| | | /* 每个元素平分宽度 */ |
| | | display: flex; |
| | | flex-direction: column; |
| | | /* 在纵向上排列子元素 */ |
| | | align-items: center; |
| | | /* 在纵向上居中显示子元素 */ |
| | | justify-content: center; |
| | | /* 在横向和纵向上都居中显示子元素 */ |
| | | } |
| | | |
| | | .center-view image, |
| | | .center-view t-avatar { |
| | | width: 90rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | height: 90rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | margin-bottom: 10rpx; |
| | | /* 图标和文本之间的间距 */ |
| | | width: 90rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | height: 90rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | margin-bottom: 10rpx; |
| | | /* 图标和文本之间的间距 */ |
| | | } |
| | | |
| | | .center-view text { |
| | | margin-top: 15rpx; |
| | | font-size: 30rpx; |
| | | color: #1890FF; |
| | | margin-top: 15rpx; |
| | | font-size: 30rpx; |
| | | color: #1890FF; |
| | | } |
| | | |
| | | .bottom-wrapper { |
| | | margin-right: 20rpx; |
| | | margin-left: 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | margin-top: 48vh; |
| | | margin-right: 20rpx; |
| | | margin-left: 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | margin-top: 48vh; |
| | | } |
| | | |
| | | .scroll-view { |
| | | flex: 1; |
| | | overflow-y: auto; |
| | | /* 允许垂直滚动 */ |
| | | z-index: 0; |
| | | /* 确保 scroll-view 在头部和 center-wrapper 之下 */ |
| | | flex: 1; |
| | | overflow-y: auto; |
| | | /* 允许垂直滚动 */ |
| | | z-index: 0; |
| | | /* 确保 scroll-view 在头部和 center-wrapper 之下 */ |
| | | } |
| | | |
| | | |
| | | |
| | | .list-item { |
| | | background-color: #fff; |
| | | margin-bottom: 2rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding-left: 30rpx; |
| | | padding-right: 30rpx; |
| | | padding-top: 30rpx; |
| | | padding-bottom: 30rpx; |
| | | margin-left: 20rpx; |
| | | margin-right: 20rpx; |
| | | background-color: #fff; |
| | | margin-bottom: 2rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding-left: 30rpx; |
| | | padding-right: 30rpx; |
| | | padding-top: 30rpx; |
| | | padding-bottom: 30rpx; |
| | | margin-left: 20rpx; |
| | | margin-right: 20rpx; |
| | | } |
| | | |
| | | .list-item text { |
| | | font-size: 30rpx; |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | | |
| | | |
| | | .list-item-piping { |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | display: flex; |
| | | flex-direction: column; |
| | | align-items: center; |
| | | } |
| | | |
| | | .bottom-title { |
| | | border-radius: 5px 5px 0 0; |
| | | background-color: #fff; |
| | | display: flex; |
| | | align-items: center; |
| | | /* 垂直方向居中 */ |
| | | justify-content: space-between; |
| | | /* 子元素在主轴上的对齐方式 */ |
| | | padding: 10px; |
| | | /* 容器的内边距 */ |
| | | margin-left: 20rpx; |
| | | margin-right: 20rpx; |
| | | margin-top: 20rpx; |
| | | border-radius: 5px 5px 0 0; |
| | | background-color: #fff; |
| | | display: flex; |
| | | align-items: center; |
| | | /* 垂直方向居中 */ |
| | | justify-content: space-between; |
| | | /* 子元素在主轴上的对齐方式 */ |
| | | padding: 10px; |
| | | /* 容器的内边距 */ |
| | | margin-left: 20rpx; |
| | | margin-right: 20rpx; |
| | | margin-top: 20rpx; |
| | | } |
| | | |
| | | .bottom-title-text { |
| | | position: absolute; |
| | | /* 绝对定位 */ |
| | | left: 50%; |
| | | /* 移动到容器的中间 */ |
| | | transform: translateX(-50%); |
| | | /* 通过平移自身宽度的一半来实现真正的居中 */ |
| | | font-size: 16px; |
| | | /* 字体大小 */ |
| | | color: #333; |
| | | /* 字体颜色 */ |
| | | } |
| | | margin-right: 10rpx; |
| | | /* 给文本和图标之间添加一些间距 */ |
| | | font-size: 35rpx; |
| | | /* 字体大小 */ |
| | | color: #333; |
| | | /* 字体颜色 */ |
| | | } |
| | | |
| | | |
| | | .refresh-button { |
| | | margin-left: auto; |
| | | /* 将按钮推到容器的最右侧 */ |
| | | font-size: 30rpx; |
| | | /* 按钮文字的字体大小 */ |
| | | color: #fff; |
| | | /* 按钮文字颜色 */ |
| | | background-color: #1890FF; |
| | | /* 按钮背景颜色 */ |
| | | border: none; |
| | | /* 去掉按钮边框 */ |
| | | border-radius: 5px; |
| | | /* 按钮圆角 */ |
| | | padding-left: 25rpx; |
| | | padding-right: 25rpx; |
| | | padding-top: 15rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding-bottom: 15rpx; |
| | | margin-left: auto; |
| | | /* 将按钮推到容器的最右侧 */ |
| | | font-size: 30rpx; |
| | | /* 按钮文字的字体大小 */ |
| | | color: #fff; |
| | | /* 按钮文字颜色 */ |
| | | background-color: #1890FF; |
| | | /* 按钮背景颜色 */ |
| | | border: none; |
| | | /* 去掉按钮边框 */ |
| | | border-radius: 5px; |
| | | /* 按钮圆角 */ |
| | | padding-left: 25rpx; |
| | | padding-right: 25rpx; |
| | | padding-top: 15rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding-bottom: 15rpx; |
| | | } |
| | | .refresh-button:active{ |
| | | background-color: #7c7c7c; /* Change to a darker color when pressed */ |
| | | |
| | | .refresh-button:active { |
| | | background-color: #7c7c7c; |
| | | /* Change to a darker color when pressed */ |
| | | } |
| | | |
| | | .refresh-view { |
| | | text-align: center; |
| | | padding: 30rpx; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | text-align: center; |
| | | padding: 30rpx; |
| | | display: flex; |
| | | justify-content: center; |
| | | align-items: center; |
| | | } |
| | | |
| | | .dot { |
| | | width: 20rpx; |
| | | height: 20rpx; |
| | | background-color: #333; |
| | | border-radius: 50%; |
| | | margin: 0 5px; |
| | | animation: blink 1.4s infinite both; |
| | | width: 20rpx; |
| | | height: 20rpx; |
| | | background-color: #333; |
| | | border-radius: 50%; |
| | | margin: 0 5px; |
| | | animation: blink 1.4s infinite both; |
| | | } |
| | | |
| | | .dot:nth-child(2) { |
| | | animation-delay: 0.2s; |
| | | animation-delay: 0.2s; |
| | | } |
| | | |
| | | .dot:nth-child(3) { |
| | | animation-delay: 0.4s; |
| | | animation-delay: 0.4s; |
| | | } |
| | | |
| | | @keyframes blink { |
| | | |
| | | 0%, |
| | | 80%, |
| | | 100% { |
| | | opacity: 0; |
| | | } |
| | | 0%, |
| | | 80%, |
| | | 100% { |
| | | opacity: 0; |
| | | } |
| | | |
| | | 40% { |
| | | opacity: 1; |
| | | } |
| | | 40% { |
| | | opacity: 1; |
| | | } |
| | | } |
| | | |
| | | .switch { |
| | | --td-switch-checked-color: #1890FF; |
| | | --td-switch-checked-color: #1890FF; |
| | | } |
| | | |
| | | |
| | | .item-left { |
| | | display: flex; |
| | | align-items: center; |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | |
| | | .item-left text { |
| | | font-size: 40rpx; |
| | | min-width: 150rpx; |
| | | font-size: 40rpx; |
| | | min-width: 150rpx; |
| | | } |
| | | |
| | | .item-img { |
| | | width: 40rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | height: 40rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | margin-left: 20rpx; |
| | | width: 40rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | height: 40rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | margin-left: 20rpx; |
| | | } |
| | | |
| | | .dialog { |
| | | --td-dialog-content-font-size: 40rpx; |
| | | --td-dialog-content-line-height: 50rpx |
| | | --td-dialog-content-font-size: 40rpx; |
| | | --td-dialog-content-line-height: 50rpx |
| | | } |
| | | |
| | | .noMore-View-home { |
| | | display: flex; |
| | | flex-direction: column; |
| | | /* 确保子元素纵向排列 */ |
| | | justify-content: center; |
| | | /* 垂直居中 */ |
| | | align-items: center; |
| | | /* 水平居中 */ |
| | | height: 100%; |
| | | /* 让容器高度占满父元素 */ |
| | | display: flex; |
| | | flex-direction: column; |
| | | /* 确保子元素纵向排列 */ |
| | | justify-content: center; |
| | | /* 垂直居中 */ |
| | | align-items: center; |
| | | /* 水平居中 */ |
| | | height: 100%; |
| | | /* 让容器高度占满父元素 */ |
| | | } |
| | | |
| | | .item-button { |
| | | display: flex; |
| | | height: 80rpx; |
| | | padding: 0 60rpx; |
| | | background-color: #1890FF; |
| | | color: white; |
| | | border: none; |
| | | border-radius: 20rpx; |
| | | font-size: 30rpx; |
| | | align-items: center; |
| | | justify-content: center; |
| | | display: flex; |
| | | height: 80rpx; |
| | | padding: 0 60rpx; |
| | | background-color: #1890FF; |
| | | color: white; |
| | | border: none; |
| | | border-radius: 20rpx; |
| | | font-size: 30rpx; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .item-button:active { |
| | | background-color: #7c7c7c; /* Change to a darker color when pressed */ |
| | | background-color: #7c7c7c; |
| | | /* Change to a darker color when pressed */ |
| | | } |
| | | |
| | | .divider { |
| | | width: 100%; |
| | | margin-top: 2rpx; |
| | | /* background-color: #e0e0e0; */ |
| | | width: 100%; |
| | | margin-top: 2rpx; |
| | | /* background-color: #e0e0e0; */ |
| | | } |
| | | |
| | | |
| | | .error-dialog { |
| | | --td-dialog-title-color: red; |
| | | --td-dialog-title-font-size: 40rpx; |
| | | --td-dialog-title-color: red; |
| | | --td-dialog-title-font-size: 40rpx; |
| | | } |
| | | |
| | | .scen-view { |
| | | position: absolute; |
| | | /* 添加这行 */ |
| | | top: 15rpx; |
| | | /* 根据需要调整距离顶部的距离 */ |
| | | right: 30rpx; |
| | | /* 根据需要调整距离右侧的距离 */ |
| | | display: flex; |
| | | align-items: center; |
| | | /* 垂直方向居中 */ |
| | | justify-content: space-between; |
| | | position: absolute; |
| | | /* 添加这行 */ |
| | | top: 15rpx; |
| | | /* 根据需要调整距离顶部的距离 */ |
| | | right: 30rpx; |
| | | /* 根据需要调整距离右侧的距离 */ |
| | | display: flex; |
| | | align-items: center; |
| | | /* 垂直方向居中 */ |
| | | justify-content: space-between; |
| | | } |
| | | |
| | | .scen-code { |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | } |
| | | |
| | | .scen-view text { |
| | | font-size: 30rpx; |
| | | color: #ffffff; |
| | | font-size: 30rpx; |
| | | color: #ffffff; |
| | | } |
| | | |
| | | .project-select-container { |
| | | padding: 20rpx 0; |
| | | padding: 20rpx 0; |
| | | } |
| | | |
| | | .project-select-container .t-radio { |
| | | margin-bottom: 20rpx; |
| | | padding: 10rpx 0; |
| | | margin-bottom: 20rpx; |
| | | padding: 10rpx 0; |
| | | } |
| | | |
| | | .project-select-container .t-radio:last-child { |
| | | margin-bottom: 0; |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .project-select-container .t-radio__label { |
| | | font-size: 28rpx; |
| | | color: #333; |
| | | font-size: 28rpx; |
| | | color: #333; |
| | | } |
| | | |
| | | .project-select-container .t-radio--checked { |
| | | background: #e6f4ff; |
| | | background: #e6f4ff; |
| | | } |
| | | |
| | | /* 弹窗按钮样式 */ |
| | | .dialog__button-group { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-top: 32rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | margin-top: 32rpx; |
| | | } |
| | | |
| | | .dialog__button-group .t-button { |
| | | flex: 1; |
| | | margin: 0 16rpx; |
| | | flex: 1; |
| | | margin: 0 16rpx; |
| | | } |
| | | |
| | | .dialog__button-group .t-button:first-child { |
| | | margin-left: 0; |
| | | margin-left: 0; |
| | | } |
| | | |
| | | .dialog__button-group .t-button:last-child { |
| | | margin-right: 0; |
| | | margin-right: 0; |
| | | } |
| | | |
| | | .project-select-popup { |
| | | background-color: #fff; |
| | | border-radius: 16rpx; |
| | | width: 600rpx; |
| | | background-color: #fff; |
| | | border-radius: 16rpx; |
| | | width: 600rpx; |
| | | } |
| | | |
| | | .popup-title { |
| | | font-size: 32rpx; |
| | | font-weight: bold; |
| | | text-align: center; |
| | | padding: 32rpx; |
| | | border-bottom: 1px solid #f0f0f0; |
| | | font-size: 32rpx; |
| | | font-weight: bold; |
| | | text-align: center; |
| | | padding: 32rpx; |
| | | border-bottom: 1px solid #f0f0f0; |
| | | } |
| | | |
| | | .popup-content { |
| | | padding: 32rpx; |
| | | padding: 32rpx; |
| | | } |
| | | |
| | | .radio-group { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20rpx; |
| | | } |
| | | |
| | | .radio-group .t-radio { |
| | | margin-bottom: 20rpx; |
| | | padding: 20rpx; |
| | | background: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | margin-bottom: 20rpx; |
| | | padding: 20rpx; |
| | | background: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | } |
| | | |
| | | .radio-group .t-radio:last-child { |
| | | margin-bottom: 0; |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | .popup-footer { |
| | | padding: 32rpx; |
| | | border-top: 1px solid #f0f0f0; |
| | | padding: 32rpx; |
| | | border-top: 1px solid #f0f0f0; |
| | | } |
| | | |
| | | .dialog-content { |
| | | padding: 32rpx; |
| | | max-height: 60vh; |
| | | padding: 32rpx; |
| | | max-height: 60vh; |
| | | } |
| | | |
| | | .project-options { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20rpx; |
| | | } |
| | | |
| | | .project-option { |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 30rpx; |
| | | background: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | font-size: 32rpx; |
| | | display: flex; |
| | | justify-content: space-between; |
| | | align-items: center; |
| | | padding: 30rpx; |
| | | background: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | font-size: 32rpx; |
| | | } |
| | | |
| | | .project-option.selected { |
| | | background: #e6f4ff; |
| | | border: 2rpx solid #1890FF; |
| | | background: #e6f4ff; |
| | | border: 2rpx solid #1890FF; |
| | | } |
| | | |
| | | .selected-icon { |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | } |
| | | |
| | | .project-dialog-content { |
| | | padding: 20rpx; |
| | | padding: 20rpx; |
| | | } |
| | | |
| | | .project-item { |
| | | margin: 20rpx 0; |
| | | padding: 30rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | text-align: center; |
| | | font-size: 32rpx; |
| | | margin: 20rpx 0; |
| | | padding: 30rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | text-align: center; |
| | | font-size: 32rpx; |
| | | } |
| | | |
| | | .project-item-selected { |
| | | background-color: #e6f4ff; |
| | | color: #1890FF; |
| | | border: 2rpx solid #1890FF; |
| | | background-color: #e6f4ff; |
| | | color: #1890FF; |
| | | border: 2rpx solid #1890FF; |
| | | } |
| | | |
| | | .radio-content { |
| | | padding: 30rpx 20rpx 10rpx; |
| | | padding: 30rpx 20rpx 10rpx; |
| | | } |
| | | |
| | | .radio-content .t-radio { |
| | | margin-bottom: 20rpx; |
| | | padding: 20rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | margin-bottom: 20rpx; |
| | | padding: 20rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | } |
| | | |
| | | .radio-content .t-radio--checked { |
| | | background-color: #e6f4ff; |
| | | background-color: #e6f4ff; |
| | | } |
| | | |
| | | .project-modal { |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | z-index: 9999; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | position: fixed; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | z-index: 9999; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | } |
| | | |
| | | .project-modal-mask { |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background-color: rgba(0, 0, 0, 0.6); |
| | | position: absolute; |
| | | top: 0; |
| | | left: 0; |
| | | right: 0; |
| | | bottom: 0; |
| | | background-color: rgba(0, 0, 0, 0.6); |
| | | } |
| | | |
| | | .project-modal-content { |
| | | position: relative; |
| | | width: 80%; |
| | | max-width: 600rpx; |
| | | background-color: #fff; |
| | | border-radius: 16rpx; |
| | | overflow: hidden; |
| | | display: flex; |
| | | flex-direction: column; |
| | | position: relative; |
| | | width: 80%; |
| | | max-width: 600rpx; |
| | | background-color: #fff; |
| | | border-radius: 16rpx; |
| | | overflow: hidden; |
| | | display: flex; |
| | | flex-direction: column; |
| | | } |
| | | |
| | | .project-modal-header { |
| | | padding: 30rpx; |
| | | text-align: center; |
| | | border-bottom: 1rpx solid #f0f0f0; |
| | | padding: 30rpx; |
| | | text-align: center; |
| | | border-bottom: 1rpx solid #f0f0f0; |
| | | } |
| | | |
| | | .project-modal-title { |
| | | font-size: 36rpx; |
| | | font-weight: bold; |
| | | color: #333; |
| | | font-size: 36rpx; |
| | | font-weight: bold; |
| | | color: #333; |
| | | } |
| | | |
| | | .project-modal-body { |
| | | padding: 30rpx; |
| | | padding: 30rpx; |
| | | } |
| | | |
| | | .project-modal-tip { |
| | | display: block; |
| | | font-size: 28rpx; |
| | | color: #999; |
| | | margin-bottom: 30rpx; |
| | | text-align: center; |
| | | display: block; |
| | | font-size: 28rpx; |
| | | color: #999; |
| | | margin-bottom: 30rpx; |
| | | text-align: center; |
| | | } |
| | | |
| | | .project-radio-group { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20rpx; |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 20rpx; |
| | | } |
| | | |
| | | .project-radio { |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 20rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | display: flex; |
| | | align-items: center; |
| | | padding: 20rpx; |
| | | background-color: #f5f5f5; |
| | | border-radius: 8rpx; |
| | | } |
| | | |
| | | .project-radio-selected { |
| | | background-color: #e6f4ff; |
| | | border: 2rpx solid #1890FF; |
| | | background-color: #e6f4ff; |
| | | border: 2rpx solid #1890FF; |
| | | } |
| | | |
| | | .project-radio text { |
| | | margin-left: 10rpx; |
| | | font-size: 32rpx; |
| | | margin-left: 10rpx; |
| | | font-size: 32rpx; |
| | | } |
| | | |
| | | .project-modal-footer { |
| | | padding: 30rpx; |
| | | border-top: 1rpx solid #f0f0f0; |
| | | padding: 30rpx; |
| | | border-top: 1rpx solid #f0f0f0; |
| | | } |
| | | |
| | | .project-modal-btn { |
| | | width: 100%; |
| | | height: 80rpx; |
| | | line-height: 80rpx; |
| | | text-align: center; |
| | | background-color: #1890FF; |
| | | color: #fff; |
| | | font-size: 32rpx; |
| | | border-radius: 8rpx; |
| | | width: 100%; |
| | | height: 80rpx; |
| | | line-height: 80rpx; |
| | | text-align: center; |
| | | background-color: #1890FF; |
| | | color: #fff; |
| | | font-size: 32rpx; |
| | | border-radius: 8rpx; |
| | | } |
| | | |
| | | .project-modal-btn[disabled] { |
| | | background-color: #cccccc; |
| | | color: #ffffff; |
| | | background-color: #cccccc; |
| | | color: #ffffff; |
| | | } |
| | | |
| | | .info-img { |
| | | width: 50rpx; |
| | | height: 50rpx; |
| | | } |
| | | |
| | | .title-center { |
| | | position: absolute; |
| | | /* 绝对定位 */ |
| | | left: 50%; |
| | | /* 移动到容器的中间 */ |
| | | transform: translateX(-50%); |
| | | display: flex; |
| | | justify-content: space-between; |
| | | /* 使子元素在主轴上均匀分布 */ |
| | | align-items: center; |
| | | /* 垂直居中对齐 */ |
| | | } |
| | | .content-container { |
| | | white-space: pre-line; |
| | | word-wrap: break-word; |
| | | /* 防止长单词无法换行 */ |
| | | } |
| | | |
| | | .long-content { |
| | | height: 450rpx; |
| | | margin-top: 16rpx; |
| | | font-size: 32rpx; |
| | | color: #888; |
| | | } |
| | | |
| | |
| | | url: '/wx/plan/getNotCompletePlans' |
| | | }).then(res => { |
| | | if (res.success) { |
| | | const activeList = res.content.map(item => ({ |
| | | id: item.planId, |
| | | title: item.planName, |
| | | projectName: item.projectName || '未分配项目', |
| | | status: item.planState, |
| | | planStartTime: item.planStartTime, |
| | | planStopTime: item.planStopTime, |
| | | duration: item.duration, |
| | | startupMode: item.startupMode |
| | | })); |
| | | const activeList = res.content.map(item => { |
| | | // 确保将planState转换为字符串 |
| | | const planState = String(item.planState); |
| | | return { |
| | | id: item.planId, |
| | | title: item.planName, |
| | | projectName: item.projectName || '未分配项目', |
| | | status: planState, |
| | | planStartTime: item.planStartTime, |
| | | planStopTime: item.planStopTime, |
| | | duration: item.duration, |
| | | startupMode: item.startupMode |
| | | }; |
| | | }); |
| | | |
| | | console.log('轮灌计划数据:', activeList); |
| | | |
| | |
| | | url: '/wx/plan/getCompletedPlans' |
| | | }).then(res => { |
| | | if (res.success) { |
| | | const completedList = res.content.map(item => ({ |
| | | id: item.planId, |
| | | title: item.planName, |
| | | projectName: item.projectName || '未分配项目', |
| | | status: item.planState, |
| | | planStartTime: item.planStartTime, |
| | | planStopTime: item.planStopTime, |
| | | duration: item.duration, |
| | | startupMode: item.startupMode |
| | | })); |
| | | const completedList = res.content.map(item => { |
| | | // 确保将planState转换为字符串 |
| | | const planState = String(item.planState); |
| | | return { |
| | | id: item.planId, |
| | | title: item.planName, |
| | | projectName: item.projectName || '未分配项目', |
| | | status: planState, |
| | | planStartTime: item.planStartTime, |
| | | planStopTime: item.planStopTime, |
| | | duration: item.duration, |
| | | startupMode: item.startupMode |
| | | }; |
| | | }); |
| | | |
| | | console.log('已完成轮灌计划数据:', completedList); |
| | | |
| | |
| | | const id = e.currentTarget.dataset.id; |
| | | const status = e.currentTarget.dataset.status; |
| | | |
| | | console.log('点击项目状态:', status, '类型:', typeof status); |
| | | |
| | | // 判断计划状态,如果是1(未发布),则提示用户 |
| | | if (status === '1' || status === 1) { |
| | | wx.showModal({ |
| | | title: '提示', |
| | | content: '当前计划未发布,请发布后查看', |
| | | showCancel: false, |
| | | confirmText: '确认' |
| | | }); |
| | | return; |
| | | } |
| | | |
| | | // 导航到灌溉详情页面,并传递参数 |
| | | wx.navigateTo({ |
| | | url: `/pages/irrigationDetail/irrigationDetail?id=${id}&fromList=true` |
| | | url: `/pages/irrigationDetail/irrigationDetail?planId=${id}&fromList=true` |
| | | }); |
| | | }, |
| | | |
| | |
| | | content: '确定要终止该轮灌计划吗?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | // 这里应该调用API终止轮灌计划 |
| | | wx.showToast({ |
| | | title: '已终止', |
| | | icon: 'success' |
| | | }); |
| | | // 刷新数据 |
| | | this.loadIrrigationData(); |
| | | this.postStop(id) |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 点击删除按钮 |
| | | */ |
| | | onDelete: function (e) { |
| | | const id = e.currentTarget.dataset.id; |
| | | wx.showModal({ |
| | | title: '确认删除', |
| | | content: '确定要删除该轮灌计划吗?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | // 调用删除接口 |
| | | post({ |
| | | url: '/wx/plan/deletePlan', |
| | | data: { |
| | | planId: id, |
| | | operatorId: app.globalData.clientId |
| | | }, |
| | | isShowLoding: true |
| | | }).then(res => { |
| | | if (res.success) { |
| | | wx.showToast({ |
| | | title: '删除成功', |
| | | icon: 'success' |
| | | }); |
| | | // 刷新数据 |
| | | this.loadIrrigationData(); |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.msg || '删除失败', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | console.error('删除失败:', err); |
| | | wx.showToast({ |
| | | title: '删除失败', |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | //终止轮灌计划 |
| | | postStop(planID){ |
| | | post({ |
| | | url: '/wx/plan/terminatePlan', |
| | | data: { |
| | | planId: planID, |
| | | operatorId: app.globalData.clientId |
| | | }, |
| | | isShowLoding: true |
| | | }).then(res => { |
| | | if (res.success) { |
| | | wx.showToast({ |
| | | title: '终止成功', |
| | | icon: 'success' |
| | | }); |
| | | // 刷新数据 |
| | | this.loadIrrigationData(); |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.msg || '终止失败', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | console.error('终止失败:', err); |
| | | wx.showToast({ |
| | | title: '终止失败', |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 点击立即执行按钮 |
| | | */ |
| | | onExecute: function (e) { |
| | |
| | | <block wx:if="{{currentList.length > 0}}"> |
| | | <view class="list-item" wx:for="{{currentList}}" wx:key="id" bindtap="onItemTap" data-id="{{item.id}}" data-status="{{item.status}}"> |
| | | <!-- 状态标签 --> |
| | | <view class="status-tag {{item.status === '1' ? 'draft' : item.status === '2' ? 'published' : item.status === '3' ? 'executing' : 'completed'}}"> |
| | | {{item.status === '1' ? '草稿' : item.status === '2' ? '未执行' : item.status === '3' ? '执行中' : '已完成'}} |
| | | <view class="status-tag {{item.status === '1' ? 'draft' : item.status === '2' ? 'published' : item.status === '3' ? 'executing' : item.status === '5' ? 'terminated' : 'completed'}}"> |
| | | {{item.status === '1' ? '草稿' : item.status === '2' ? '未执行' : item.status === '3' ? '执行中' : item.status === '5' ? '已终止' : '已完成'}} |
| | | </view> |
| | | |
| | | <!-- 主要内容区 --> |
| | |
| | | </view> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 执行中状态额外信息 --> |
| | | <block wx:if="{{item.status === '3'}}"> |
| | | <view class="executing-info"> |
| | | <view class="info-item"> |
| | | <view class="info-icon"> |
| | | <image src="/images/progress-icon.svg" mode="aspectFit"></image> |
| | | </view> |
| | | <view class="info-content"> |
| | | <view class="info-label">已灌溉时间</view> |
| | | <view class="info-value">{{item.irrigatedTime}}</view> |
| | | </view> |
| | | </view> |
| | | <view class="info-item"> |
| | | <view class="info-icon"> |
| | | <image src="/images/group-icon.svg" mode="aspectFit"></image> |
| | | </view> |
| | | <view class="info-content"> |
| | | <view class="info-label">已灌溉轮组</view> |
| | | <view class="info-value">{{item.irrigatedGroups}}</view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | |
| | | <!-- 操作按钮区域 --> |
| | | <view class="action-section" catchtap="stopPropagation" wx:if="{{item.status !== '4'}}"> |
| | | <block wx:if="{{item.status === '1'}}"> |
| | | <view class="action-buttons"> |
| | | <button class="action-button delete-button" hover-class="delete-button-hover" bindtap="onDelete" data-id="{{item.id}}"> |
| | | <image src="/images/delete_bt.svg" mode="aspectFit"></image> |
| | | <text>删除</text> |
| | | </button> |
| | | <button class="action-button publish-button" hover-class="publish-button-hover" bindtap="onPublish" data-id="{{item.id}}"> |
| | | <image src="/images/publish-icon.svg" mode="aspectFit"></image> |
| | | <text>发布</text> |
| | |
| | | bottom: 0; |
| | | left: 50%; |
| | | transform: translateX(-50%); |
| | | width: 40rpx; |
| | | width: 50rpx; |
| | | height: 4rpx; |
| | | background-color: #0052d9; |
| | | border-radius: 2rpx; |
| | |
| | | } |
| | | |
| | | .status-tag.draft { |
| | | background-color: #ff9d00; |
| | | background-color: #9E9E9E; |
| | | } |
| | | |
| | | .status-tag.published { |
| | | background-color: #0052d9; |
| | | background-color: #90CAF9; |
| | | } |
| | | |
| | | .status-tag.executing { |
| | | background-color: #00a870; |
| | | background-color: #2196F3; |
| | | } |
| | | |
| | | .status-tag.completed { |
| | | background-color: #999; |
| | | background-color: #4CAF50; |
| | | } |
| | | |
| | | .status-tag.terminated { |
| | | background-color: #F44336; |
| | | color: #ffffff; |
| | | } |
| | | |
| | | /* 内容区域样式 */ |
| | |
| | | background-color: #1890FF !important; |
| | | } |
| | | |
| | | .delete-button { |
| | | background-color: #ff4d4f !important; |
| | | } |
| | | |
| | | .stop-button { |
| | | background-color: #ff4d4f !important; |
| | | } |
| | |
| | | opacity: 0.8 !important; |
| | | } |
| | | |
| | | .delete-button-hover { |
| | | opacity: 0.8 !important; |
| | | } |
| | | |
| | | .stop-button-hover { |
| | | opacity: 0.8 !important; |
| | | } |
| | |
| | | */ |
| | | data: { |
| | | planCode: '', |
| | | projectName: '', |
| | | startTime: '', |
| | | stopTime: '', |
| | | isRefreshing: false, |
| | | projects: [] |
| | | groupList: [], |
| | | planId: '', |
| | | planStatusText: '', |
| | | planStatusClass: '' |
| | | }, |
| | | |
| | | /** |
| | | * 生命周期函数--监听页面加载 |
| | | */ |
| | | onLoad: function (options) { |
| | | // 模拟数据 |
| | | if (options.planId) { |
| | | this.setData({ |
| | | planId: options.planId |
| | | }); |
| | | this.fetchIrrigationData(options.planId); |
| | | } else { |
| | | wx.showToast({ |
| | | title: '缺少计划ID', |
| | | icon: 'none' |
| | | }); |
| | | setTimeout(() => { |
| | | wx.navigateBack(); |
| | | }, 1500); |
| | | } |
| | | }, |
| | | |
| | | /** |
| | | * 获取灌溉计划数据 |
| | | */ |
| | | fetchIrrigationData: function(planId) { |
| | | const { get } = require('../../api/request'); |
| | | |
| | | const data = { |
| | | planId: planId || this.data.planId, |
| | | }; |
| | | |
| | | get({ |
| | | url: 'wx/plan/getPublishResults', |
| | | isShowLoding: true, |
| | | useParams: true, |
| | | data: data |
| | | }).then(res => { |
| | | if (res.success) { |
| | | this.processIrrigationData(res.content); |
| | | } else { |
| | | wx.showToast({ |
| | | title: res.msg || '获取数据失败', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }).catch(err => { |
| | | console.error('请求失败:', err); |
| | | wx.showToast({ |
| | | title: '请求失败', |
| | | icon: 'none' |
| | | }); |
| | | }); |
| | | }, |
| | | |
| | | /** |
| | | * 处理接口返回的数据 |
| | | */ |
| | | processIrrigationData: function(data) { |
| | | console.log('灌溉计划详情数据:', data); |
| | | |
| | | // 处理轮灌组状态 |
| | | const statusMap = { |
| | | 2: {status: 'pending', statusText: '未开始'}, |
| | | 3: {status: 'in_progress', statusText: '灌溉中'}, |
| | | 4: {status: 'completed', statusText: '已结束'} |
| | | }; |
| | | |
| | | // 处理计划状态 |
| | | let planStatusText = ''; |
| | | let planStatusClass = ''; |
| | | |
| | | // 根据计划的状态设置不同的文本和样式 |
| | | // 注意:接口返回的是state而不是planState |
| | | console.log('计划状态值:', data.state, '类型:', typeof data.state); |
| | | |
| | | // 确保state是数字类型 |
| | | const planState = parseInt(data.state); |
| | | |
| | | switch(planState) { |
| | | case 1: |
| | | planStatusText = '草稿'; |
| | | planStatusClass = 'draft'; |
| | | break; |
| | | case 2: |
| | | planStatusText = '未执行'; |
| | | planStatusClass = 'published'; |
| | | break; |
| | | case 3: |
| | | planStatusText = '执行中'; |
| | | planStatusClass = 'executing'; |
| | | break; |
| | | case 4: |
| | | planStatusText = '已完成'; |
| | | planStatusClass = 'completed'; |
| | | break; |
| | | case 5: |
| | | planStatusText = '已终止'; |
| | | planStatusClass = 'terminated'; |
| | | break; |
| | | default: |
| | | planStatusText = '未知状态'; |
| | | planStatusClass = 'draft'; |
| | | console.log('未识别的计划状态值:', planState); |
| | | } |
| | | |
| | | // 转换数据格式 |
| | | const groupList = data.groups.map(group => { |
| | | const statusInfo = statusMap[group.state] || {status: 'unknown', statusText: '未知状态'}; |
| | | |
| | | return { |
| | | id: group.groupId, |
| | | name: group.groupCode, |
| | | status: statusInfo.status, |
| | | statusText: statusInfo.statusText, |
| | | startTime: group.startTime, |
| | | endTime: group.stopTime, |
| | | duration: group.duration, |
| | | publishResult: group.publishResult || [] |
| | | }; |
| | | }); |
| | | |
| | | this.setData({ |
| | | planCode: 'IRR-2024-001', |
| | | startTime: '2024-03-20 08:00', |
| | | projects: [{ |
| | | id: 1, |
| | | name: '示例项目', |
| | | groups: [ |
| | | { |
| | | id: 1, |
| | | name: '轮灌组1', |
| | | status: 'pending', |
| | | statusText: '待灌溉', |
| | | startTime: '08:00', |
| | | endTime: '09:00', |
| | | duration: 60 |
| | | }, |
| | | { |
| | | id: 2, |
| | | name: '轮灌组2', |
| | | status: 'in_progress', |
| | | statusText: '灌溉中', |
| | | startTime: '09:00', |
| | | endTime: '10:00', |
| | | duration: 60 |
| | | }, |
| | | { |
| | | id: 3, |
| | | name: '轮灌组3', |
| | | status: 'completed', |
| | | statusText: '已完成', |
| | | startTime: '10:00', |
| | | endTime: '11:00', |
| | | duration: 60 |
| | | } |
| | | ] |
| | | }] |
| | | planCode: data.planName, |
| | | projectName: data.projectName, |
| | | startTime: data.planStartTime, |
| | | stopTime: data.planStopTime, |
| | | groupList: groupList, |
| | | planStatusText: planStatusText, |
| | | planStatusClass: planStatusClass |
| | | }); |
| | | }, |
| | | |
| | |
| | | isRefreshing: true |
| | | }); |
| | | |
| | | // 模拟刷新数据 |
| | | this.fetchIrrigationData(this.data.planId); |
| | | |
| | | // 完成刷新 |
| | | setTimeout(() => { |
| | | this.setData({ |
| | | isRefreshing: false |
| | |
| | | <text class="label">计划编号:</text> |
| | | <text class="value">{{planCode}}</text> |
| | | </view> |
| | | <image class="status-icon" src="/images/progress.svg" mode="aspectFit"></image> |
| | | <view class="plan-status {{planStatusClass}}"> |
| | | <text>{{planStatusText}}</text> |
| | | </view> |
| | | </view> |
| | | <!-- 项目信息 --> |
| | | <view class="project-info"> |
| | | <text class="label">项目名称:</text> |
| | | <text class="value">{{projects[0].name}}</text> |
| | | <text class="value">{{projectName}}</text> |
| | | </view> |
| | | <!-- 灌溉时间信息 --> |
| | | <view class="time-info"> |
| | | <text class="label">灌溉开始时间:</text> |
| | | <text class="value">{{startTime}}</text> |
| | | </view> |
| | | |
| | | |
| | | |
| | | <!-- 新增结束时间信息 --> |
| | | <view class="time-info"> |
| | | <text class="label">灌溉结束时间:</text> |
| | | <text class="value">{{stopTime}}</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 轮灌组列表 --> |
| | |
| | | refresher-triggered="{{isRefreshing}}" |
| | | bindrefresherrefresh="onPullDownRefresh"> |
| | | <view class="scroll-content"> |
| | | <block wx:for="{{projects[0].groups}}" wx:key="id" wx:for-item="group"> |
| | | <view class="group-item {{group.status}}" bindtap="navigateToGroupDetail" data-project-name="{{projects[0].name}}" data-group-name="{{group.name}}" data-group-id="{{group.id}}" data-status="{{group.status}}"> |
| | | <!-- 轮灌组状态标识 --> |
| | | <view class="group-status-indicator"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">{{group.statusText}}</text> |
| | | </view> |
| | | |
| | | <block wx:for="{{groupList}}" wx:key="id" wx:for-item="group"> |
| | | <view class="group-item {{group.status}}" bindtap="navigateToGroupDetail" data-project-name="{{projectName}}" data-group-name="{{group.name}}" data-group-id="{{group.id}}" data-status="{{group.status}}"> |
| | | <!-- 轮灌组信息 --> |
| | | <view class="group-info"> |
| | | <view class="group-name">{{group.name}}</view> |
| | | <view class="group-name-row"> |
| | | <text class="group-label">轮灌组:</text> |
| | | <text class="group-name">{{group.name}}</text> |
| | | <!-- 轮灌组状态标识 --> |
| | | <view class="group-status-indicator"> |
| | | <view class="status-dot"></view> |
| | | <text class="status-text">{{group.statusText}}</text> |
| | | </view> |
| | | </view> |
| | | <view class="group-time-info"> |
| | | <view class="time-row"> |
| | | <text class="time-label">开始时间:</text> |
| | |
| | | <text class="time-value">{{group.duration}}分钟</text> |
| | | </view> |
| | | </view> |
| | | |
| | | <!-- 取水口信息 --> |
| | | <view class="intake-info" wx:if="{{group.publishResult && group.publishResult.length > 0}}"> |
| | | <view class="intake-header">取水口信息</view> |
| | | <view class="intake-list"> |
| | | <block wx:for="{{group.publishResult}}" wx:key="intakeName" wx:for-item="intake"> |
| | | <view class="intake-item {{intake.code === 0 ? 'success' : 'error'}}"> |
| | | <view class="intake-name"> |
| | | <text class="intake-status-dot"></text> |
| | | <text>{{intake.intakeName}}</text> |
| | | </view> |
| | | <view class="intake-result" wx:if="{{intake.result}}"> |
| | | <text>{{intake.result}}</text> |
| | | </view> |
| | | </view> |
| | | </block> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </view> |
| | | </block> |
| | |
| | | .plan-code .label { |
| | | color: #666; |
| | | font-size: 28rpx; |
| | | margin-right: 8rpx; |
| | | } |
| | | |
| | | .plan-code .value { |
| | | color: #333; |
| | | font-size: 28rpx; |
| | | font-size: 32rpx; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .status-icon { |
| | | width: 80rpx; |
| | | height: 80rpx; |
| | | /* 状态标签样式 */ |
| | | .plan-status { |
| | | padding: 4rpx 16rpx; |
| | | border-radius: 20rpx; |
| | | font-size: 24rpx; |
| | | color: #fff; |
| | | text-align: center; |
| | | margin-left: 20rpx; |
| | | flex-shrink: 0; |
| | | margin-top: -10rpx; |
| | | margin-bottom: -10rpx; |
| | | } |
| | | |
| | | .plan-status.draft { |
| | | background-color: #9E9E9E; |
| | | } |
| | | |
| | | .plan-status.published { |
| | | background-color: #90CAF9; |
| | | } |
| | | |
| | | .plan-status.executing { |
| | | background-color: #2196F3; |
| | | } |
| | | |
| | | .plan-status.completed { |
| | | background-color: #4CAF50; |
| | | } |
| | | |
| | | .plan-status.terminated { |
| | | background-color: #F44336; |
| | | } |
| | | |
| | | .time-info, .project-info { |
| | |
| | | .time-info .value, .project-info .value { |
| | | color: #333; |
| | | font-size: 28rpx; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | /* 项目列表样式 */ |
| | |
| | | .group-status-indicator { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 16rpx; |
| | | margin-left: auto; |
| | | background-color: #f5f7fa; |
| | | padding: 4rpx 10rpx; |
| | | border-radius: 8rpx; |
| | | } |
| | | |
| | | .status-dot { |
| | |
| | | height: 16rpx; |
| | | border-radius: 50%; |
| | | margin-right: 8rpx; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .group-item.pending .status-dot { |
| | |
| | | .status-text { |
| | | font-size: 26rpx; |
| | | color: #666; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .group-item.pending .status-text { |
| | | color: #e6c100; |
| | | } |
| | | |
| | | .group-item.in_progress .status-text { |
| | | color: #4CAF50; |
| | | } |
| | | |
| | | .group-item.completed .status-text { |
| | | color: #2196F3; |
| | | } |
| | | |
| | | /* 根据不同状态显示不同背景色 */ |
| | | .group-item.pending .group-status-indicator { |
| | | background-color: rgba(255, 215, 0, 0.1); |
| | | } |
| | | |
| | | .group-item.in_progress .group-status-indicator { |
| | | background-color: rgba(76, 175, 80, 0.1); |
| | | } |
| | | |
| | | .group-item.completed .group-status-indicator { |
| | | background-color: rgba(33, 150, 243, 0.1); |
| | | } |
| | | |
| | | /* 轮灌组信息样式 */ |
| | |
| | | margin-top: 12rpx; |
| | | } |
| | | |
| | | .group-name-row { |
| | | display: flex; |
| | | align-items: center; |
| | | margin-bottom: 12rpx; |
| | | width: 100%; |
| | | } |
| | | |
| | | .group-label { |
| | | font-size: 32rpx; |
| | | color: #666; |
| | | margin-right: 8rpx; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .group-name { |
| | | font-size: 32rpx; |
| | | font-weight: 500; |
| | | color: #333; |
| | | margin-bottom: 12rpx; |
| | | flex-shrink: 0; |
| | | } |
| | | |
| | | .group-time-info { |
| | |
| | | .time-value { |
| | | color: #333; |
| | | font-size: 26rpx; |
| | | } |
| | | |
| | | /* 取水口信息样式 */ |
| | | .intake-info { |
| | | margin-top: 20rpx; |
| | | border-top: 1rpx dashed #e0e0e0; |
| | | padding-top: 16rpx; |
| | | } |
| | | |
| | | .intake-header { |
| | | font-size: 28rpx; |
| | | color: #333; |
| | | font-weight: 500; |
| | | margin-bottom: 12rpx; |
| | | } |
| | | |
| | | .intake-list { |
| | | display: flex; |
| | | flex-direction: column; |
| | | gap: 10rpx; |
| | | } |
| | | |
| | | .intake-item { |
| | | background-color: #f9f9f9; |
| | | border-radius: 8rpx; |
| | | padding: 12rpx 16rpx; |
| | | } |
| | | |
| | | .intake-item.success { |
| | | border-left: 4rpx solid #4CAF50; |
| | | } |
| | | |
| | | .intake-item.error { |
| | | border-left: 4rpx solid #F44336; |
| | | } |
| | | |
| | | .intake-name { |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 26rpx; |
| | | color: #333; |
| | | } |
| | | |
| | | .intake-status-dot { |
| | | width: 12rpx; |
| | | height: 12rpx; |
| | | border-radius: 50%; |
| | | margin-right: 8rpx; |
| | | } |
| | | |
| | | .intake-item.success .intake-status-dot { |
| | | background-color: #4CAF50; |
| | | } |
| | | |
| | | .intake-item.error .intake-status-dot { |
| | | background-color: #F44336; |
| | | } |
| | | |
| | | .intake-result { |
| | | margin-top: 6rpx; |
| | | font-size: 24rpx; |
| | | color: #F44336; |
| | | padding-left: 20rpx; |
| | | } |
| | |
| | | openTime: "", //计划开泵的开始时间 |
| | | openTimeText: "", |
| | | isShowOpenTime: "false", |
| | | isOpenTiming: false, //是否是计划开阀时间样式的开阀 |
| | | postMinutes: 0, //定灌溉时长的时间 |
| | | showForceConfirm: false, |
| | | showErrorDialog: false, //错误提示 |
| | | errorData: "", |
| | |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=true' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | |
| | | forceIntakeId: intakeId, |
| | | showForceConfirm: true |
| | | }) |
| | | } else if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | // vcId: app.globalData.vcId, //虚拟卡ID |
| | | minutes: this.data.postMinutes, //分钟 |
| | | operator: app.globalData.clientId, //操作员 |
| | | plannedOpenTime: this.data.openTime |
| | | }; |
| | | post({ |
| | | url: "wx/valve/planed_open_timed_close", |
| | | data: data |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | }) |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | //定时关阀式开阀 |
| | |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | // vcId: app.globalData.vcId, //虚拟卡ID |
| | | minutes: this.data.postMinutes, //分钟 |
| | | operator: app.globalData.clientId //操作员 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/timed_close", |
| | | data: data |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg |
| | | }) |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | // 通过小时转换成分钟 |
| | |
| | | isOpenTiming: false, |
| | | radioValue: "0" |
| | | }) |
| | | }, // 定量开泵按钮 |
| | | btnOpenOnWater() { |
| | | if (this.data.waterAmount > 0) { |
| | | if (this.data.isOpenTiming) { |
| | | this.quantifyOpenTime(); |
| | | } else { |
| | | this.quantifyOpen(); |
| | | } |
| | | } else { |
| | | wx.showToast({ |
| | | icon: 'error', |
| | | title: '请选择或输入灌溉时间!', |
| | | }) |
| | | } |
| | | },//定量开阀式计划开阀 |
| | | quantifyOpenTime() { |
| | | const app = getApp(); |
| | | wx.showLoading({ |
| | | title: '正在通信请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | waterAmount: this.data.waterAmount, //水量 |
| | | operator: app.globalData.clientId, //操作员 |
| | | plannedOpenTime: this.data.openTime |
| | | }; |
| | | post({ |
| | | url: "wx/valve/planed_open_quantify_close", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=2' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | },//定量开阀 |
| | | quantifyOpen() { |
| | | const app = getApp(); |
| | | wx.showLoading({ |
| | | title: '正在开阀请稍候...', // 加载提示文字 |
| | | mask: true // 是否显示透明蒙层,防止触摸穿透,默认为 false |
| | | }); |
| | | const data = { |
| | | intakeId: this.data.choseItem.intakeId, //取水口ID |
| | | waterAmount: this.data.waterAmount, //水量 |
| | | operator: app.globalData.clientId //操作员 |
| | | }; |
| | | post({ |
| | | url: "wx/valve/quantify_close", |
| | | data: data, |
| | | timeout: 180000 |
| | | }).then(response => { |
| | | // 处理成功响应 |
| | | console.log('请求成功:', response); |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | //完成后回到首页 |
| | | wx.reLaunch({ |
| | | url: '/pages/home/home?param=1' // 首页的路径,根据实际情况填写 |
| | | }); |
| | | }).catch(error => { |
| | | // 加载完成后隐藏加载动画 |
| | | wx.hideLoading(); |
| | | // 处理错误响应 |
| | | console.error('请求失败:', error); |
| | | if (error.code === "ECONNABORTED" || error.message?.includes('timeout')) { |
| | | // 处理超时错误 |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: "通信超时,请稍后再试", |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } else { |
| | | this.setData({ |
| | | showErrorDialog: true, |
| | | errorData: error.msg, |
| | | errorDialogTitle: "开阀错误" |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | }) |
| | |
| | | .container { |
| | | padding: 5rpx 20rpx; |
| | | padding: 0; |
| | | background-color: #fff; |
| | | width: 100%; |
| | | height: 100vh; |
| | |
| | | z-index: 0; |
| | | display: flex; |
| | | flex-direction: column; |
| | | padding-bottom: 20rpx; /* 增加底部填充 */ |
| | | padding: 20rpx; |
| | | background-color: #f5f5f5; |
| | | box-sizing: border-box; |
| | | /* 隐藏滚动条 */ |
| | | -webkit-overflow-scrolling: touch; |
| | | scrollbar-width: none; |
| | | -ms-overflow-style: none; |
| | | } |
| | | |
| | | .list-container::-webkit-scrollbar { |
| | | display: none; |
| | | width: 0; |
| | | height: 0; |
| | | color: transparent; |
| | | background: transparent; |
| | | } |
| | | |
| | | /* 为微信小程序添加特定样式 */ |
| | | .list-container { |
| | | -webkit-overflow-scrolling: touch; |
| | | scrollbar-width: none; |
| | | -ms-overflow-style: none; |
| | | overflow: -moz-scrollbars-none; |
| | | } |
| | | |
| | | .item { |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: space-between; |
| | | padding: 15px 20rpx; |
| | | border-bottom: 1px solid #eee; |
| | | padding: 30rpx; |
| | | margin: 0 20rpx 20rpx 10rpx; |
| | | background-color: #ffffff; |
| | | border-radius: 12rpx; |
| | | box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08); |
| | | transition: all 0.3s ease; |
| | | box-sizing: border-box; |
| | | width: calc(100% - 20rpx); |
| | | } |
| | | |
| | | .item:active { |
| | | transform: scale(0.98); |
| | | box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.1); |
| | | } |
| | | |
| | | .item-left { |
| | | display: flex; |
| | | align-items: center; |
| | | flex: 1; |
| | | padding-right: 20rpx; |
| | | } |
| | | |
| | | .item-left text{ |
| | | font-size: 40rpx; |
| | | min-width: 150rpx; |
| | | .item-img-left { |
| | | width: 48rpx; |
| | | height: 48rpx; |
| | | margin-right: 20rpx; |
| | | } |
| | | |
| | | .water-intake-name { |
| | | font-size: 36rpx !important; |
| | | color: #333; |
| | | font-weight: 500; |
| | | } |
| | | |
| | | .item-img { |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | margin-left: 20rpx; |
| | | width: 32rpx; |
| | | height: 32rpx; |
| | | margin-left: 16rpx; |
| | | } |
| | | |
| | | .item-button { |
| | | display: flex; |
| | | height: 80rpx; |
| | | padding: 0 60rpx; |
| | | background-color: #1890FF; |
| | | height: 64rpx; |
| | | min-width: 120rpx; |
| | | padding: 0 32rpx; |
| | | background: linear-gradient(135deg, #1890FF, #096DD9); |
| | | color: white; |
| | | border: none; |
| | | border-radius: 20rpx; |
| | | font-size: 30rpx; |
| | | border-radius: 32rpx; |
| | | font-size: 28rpx; |
| | | font-weight: 500; |
| | | align-items: center; |
| | | justify-content: center; |
| | | box-shadow: 0 4rpx 12rpx rgba(24, 144, 255, 0.2); |
| | | transition: all 0.3s ease; |
| | | margin-left: auto; |
| | | } |
| | | |
| | | .item-button:active { |
| | | background-color: #7c7c7c; /* Change to a darker color when pressed */ |
| | | transform: scale(0.95); |
| | | box-shadow: 0 2rpx 6rpx rgba(24, 144, 255, 0.2); |
| | | } |
| | | |
| | | .indicator { |
| | | width: 100%; |
| | | height: 3px; |
| | |
| | | padding-bottom: 10rpx; /* 增加底部填充 */ |
| | | } |
| | | |
| | | |
| | | .error-dialog{ |
| | | --td-dialog-title-color:red; |
| | | --td-dialog-title-font-size:45rpx; |
| | |
| | | .result-item { |
| | | padding: 20rpx; |
| | | border-bottom: 1px solid #eaeaea; |
| | | } |
| | | |
| | | .item-img-left { |
| | | width: 40rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | height: 40rpx; |
| | | /* 根据需要调整图标大小 */ |
| | | |
| | | } |
| | | |
| | | .item-img { |
| | | width: 40rpx; |
| | | height: 40rpx; |
| | | margin-left: 20rpx; |
| | | } |
| | | .water-intake-name { |
| | | font-size: 50rpx !important; |
| | | margin-left: 15rpx; |
| | | } |
| | | |
| | | .item-balance-img { |
| | |
| | | color: #FF6A6A; |
| | | font-size: 50rpx; |
| | | margin-left: 5rpx; |
| | | } |
| | | |
| | | .item-button { |
| | | margin-left: auto; |
| | | /* 将按钮固定在右边 */ |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | /* 使按钮内部水平和垂直居中 */ |
| | | background-color: #32CD32; |
| | | color: white; |
| | | padding-left: 40rpx; |
| | | padding-right: 40rpx; |
| | | padding-bottom: 10rpx; |
| | | padding-top: 10rpx; |
| | | border-radius: 30rpx; |
| | | font-size: 35rpx; |
| | | border: none; |
| | | } |
| | | |
| | | .item-button-gray { |
| | |
| | | display: flex; |
| | | align-items: flex-end; |
| | | /* 底部对齐 */ |
| | | } |
| | | |
| | | .list-container { |
| | | display: flex; |
| | | flex-grow: 1; /* 占满剩余高度 */ |
| | | padding-bottom: 30rpx; |
| | | height: 100%; |
| | | flex-direction: column; /* 确保内部元素按列排列 */ |
| | | } |
| | | |
| | | .dialog { |
| | |
| | | font-size: 30rpx; |
| | | } |
| | | |
| | | .item { |
| | | background-color: #1890FF; |
| | | margin-top: 20rpx; |
| | | margin-left: 20rpx; |
| | | margin-right: 20rpx; |
| | | padding: 30rpx; |
| | | border-radius: 30rpx; |
| | | } |
| | | |
| | | .item-gray { |
| | | background-color: #D3D3D3; |
| | | margin-top: 20rpx; |
New file |
| | |
| | | // 项目配置,包含各项目的专有设置 |
| | | const PROJECT_CONFIG = { |
| | | JYG: { |
| | | tag: 'ym', |
| | | displayName: '嘉峪关项目', |
| | | needLogin: true // 需要登录 |
| | | }, |
| | | MQ: { |
| | | tag: 'mq', |
| | | displayName: '民勤项目', |
| | | operatorId: '2025033115305200006', // 统一ID用于operator和clientId |
| | | needLogin: false // 不需要登录 |
| | | }, |
| | | TEST: { |
| | | tag: 'ym', |
| | | displayName: '测试项目', |
| | | operatorId: '2024122617295800009', // 统一ID用于operator和clientId |
| | | vcId: '2024122617295800009', |
| | | needLogin: false // 不需要登录 |
| | | }, |
| | | SCHOOL: { |
| | | tag: 'XX', |
| | | displayName: '学校项目', |
| | | operatorId: '2025040215305200006', // 统一ID用于operator和clientId |
| | | needLogin: true // 不需要登录 |
| | | } |
| | | }; |
| | | |
| | | module.exports = { |
| | | PROJECT_CONFIG |
| | | }; |