ipConfig.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <view class="zai-box">
  3. <scroll-view scroll-y class="page">
  4. <view class="IPSet">
  5. <span class="text-style"><u-button :plain="true" color="#18a5ff" size="small" :text="IPSet ? IPSet : '选择IP地址'"
  6. @tap="changeIP()"></u-button></span>
  7. <u-picker :show="ipShow" :columns="IpConfig" @cancel="ipShow = false" @confirm="selectIpAddr"
  8. keyName="label"></u-picker>
  9. </view>
  10. </scroll-view>
  11. </view>
  12. </template>
  13. <script>
  14. import configService from "@/common/service/config.service.js";
  15. export default {
  16. data() {
  17. return {
  18. ipShow: false,
  19. IPSet: "",
  20. IpConfig: [
  21. [
  22. { label: "准东二矿", value: "http://172.19.7.101:9999", code: 'zdrk' },
  23. { label: "大海则煤矿", value: "http://172.16.53.16:9999", code: 'dhz' },
  24. { label: "大柳塔井", value: "http://10.248.135.10:9999", code: 'dlt' },
  25. { label: "活鸡兔井", value: "http://10.248.135.121:9999", code: 'hjt' },
  26. { label: "寸草塔二矿", value: "http://10.246.63.5:9999", code: 'cctr' },
  27. { label: "乌兰木伦", value: "http://10.246.183.35:9999", code: 'wlml' },
  28. { label: "哈拉沟煤矿", value: "http://10.248.223.12:9999", code: 'hlg' },
  29. { label: "布尔台", value: "http://10.246.95.4:9999", code: 'brt' },
  30. { label: "上湾", value: "http://10.246.167.205:9999", code: 'sw' },
  31. { label: "锦界", value: "http://10.248.151.42:9999", code: 'jj' },
  32. { label: "补连塔", value: "http://10.246.175.16:9999", code: 'blt' },
  33. { label: "寸草塔", value: "http://10.246.23.171:9999", code: 'cct' },
  34. { label: "柳塔", value: "http://10.246.87.121:9999", code: 'lt' },
  35. { label: "石圪台", value: "http://10.246.191.13:9999", code: 'sgt' },
  36. { label: "榆家梁", value: "http://10.248.143.211:9999", code: 'yjl' },
  37. { label: "开发", value: "http://182.92.126.35:9999", code: 'kf' },
  38. { label: "测试", value: "http://182.92.126.35:9998", code: 'cs' },
  39. { label: "特拉布拉", value: "http://10.7.0.19:9999", code: 'lblt' },
  40. ],
  41. ],
  42. fromSetting: false, // 是否来自设置页
  43. ip: "",
  44. };
  45. },
  46. onLoad(options) {
  47. this.fromSetting = options.from === "settings"; // 判断来源
  48. this.ip = uni.getStorageSync("serverIP") || ""; // 读取已存IP
  49. },
  50. computed: {},
  51. methods: {
  52. selectIpAddr(e) {
  53. this.ipShow = false;
  54. this.ip = e.value[0].value;
  55. const fullURL = e.value[0].value;
  56. console.log(fullURL,'fullURL')
  57. const apicode = e.value[0].code
  58. console.log(apicode,'9900')
  59. this.IPSet = e.value[0].label;
  60. configService.apiUrl = fullURL;
  61. uni.setStorageSync("selectedIP", true);
  62. uni.setStorageSync("apiCode", apicode);
  63. uni.setStorageSync("apiUrl", fullURL);
  64. // uni.showModal({
  65. // title: "提示",
  66. // content: fullURL,
  67. // cancelText: "取消",
  68. // confirmText: "确认",
  69. // });
  70. uni.redirectTo({
  71. url: "/pages/login/login?reload=" + 1,
  72. });
  73. },
  74. changeIP() {
  75. this.ipShow = true;
  76. },
  77. },
  78. beforeDestroy() { },
  79. };
  80. </script>
  81. <style>
  82. .login-paddingtop {
  83. padding-top: 300upx;
  84. }
  85. .zai-box {
  86. height: 100vh;
  87. background-image: url(/static/desk-img/loginBg.png);
  88. background-size: cover;
  89. padding: 0 20upx;
  90. padding-top: 100upx;
  91. position: relative;
  92. }
  93. .zai-logo {
  94. width: 200upx;
  95. height: 150px;
  96. }
  97. .zai-title {
  98. margin-top: 20upx;
  99. font-size: 58upx;
  100. color: #000000;
  101. text-align: center;
  102. }
  103. .input-placeholder,
  104. .zai-input {
  105. color: #94afce;
  106. }
  107. .zai-btn {
  108. background: #ff65a3;
  109. color: #fff;
  110. border: 0;
  111. border-radius: 100upx;
  112. font-size: 36upx;
  113. }
  114. .zai-btn:after {
  115. border: 0;
  116. }
  117. /*按钮点击效果*/
  118. .zai-btn.button-hover {
  119. transform: translate(1upx, 1upx);
  120. }
  121. .IPSet {
  122. display: flex;
  123. flex-direction: column;
  124. }
  125. .text-style {
  126. margin: 20px;
  127. }
  128. </style>