ipConfig.vue 4.0 KB

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