ipConfig.vue 3.5 KB

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