configuration.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="content">
  3. <!-- <div class="rec"></div> -->
  4. <view class="title_ipunt">
  5. <text class="text">请求IP:</text>
  6. <input
  7. type="text"
  8. v-model="ip"
  9. name=""
  10. focus
  11. id=""
  12. @focus="focusState"
  13. :class="recshow ? 'rec' : ''"
  14. :placeholder="ip"
  15. style="
  16. border-bottom: 1px solid #dfdfdf;
  17. width: 80%;
  18. margin-left: 10px;
  19. " />
  20. </view>
  21. <view class="title_ipunt">
  22. <text class="text">端口:</text>
  23. <input
  24. v-model="host"
  25. type="text"
  26. name=""
  27. id=""
  28. @focus="focusStateto"
  29. :class="recshowto ? 'rec' : ''"
  30. :placeholder="host"
  31. style="
  32. border-bottom: 1px solid #dfdfdf;
  33. width: 80%;
  34. margin-left: 10px;
  35. " />
  36. </view>
  37. <!-- <view class="title_ipunt">
  38. <text class="text">服务包名:</text>
  39. <input
  40. type="text"
  41. name=""
  42. id=""
  43. @focus="focusStatethree"
  44. :class="recshowthree ? 'rec' : ''"
  45. placeholder="warewms"
  46. style="
  47. border-bottom: 1px solid #dfdfdf;
  48. width: 80%;
  49. margin-left: 10px;
  50. " />
  51. </view> -->
  52. <view class="botins">
  53. <wButton
  54. class="wbutton"
  55. text="确定"
  56. :rotate="isRotate"
  57. @click="startLogin"></wButton>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. let _this;
  63. import wButton from "../../components/watch-login/watch-button.vue"; //button
  64. export default {
  65. components: {
  66. wButton,
  67. },
  68. data() {
  69. return {
  70. ip: "",
  71. host: "",
  72. isRotate: false, //是否加载旋转
  73. isFocus: true, // 是否聚焦
  74. recshow: false,
  75. recshowto: false,
  76. recshowthree: false,
  77. //logo图片 base64
  78. list3: [
  79. "https://cdn.uviewui.com/uview/swiper/swiper3.png",
  80. "https://cdn.uviewui.com/uview/swiper/swiper2.png",
  81. "https://cdn.uviewui.com/uview/swiper/swiper1.png",
  82. ],
  83. };
  84. },
  85. mounted() {
  86. _this = this;
  87. uni.getStorage({
  88. key: "ip",
  89. success(res) {
  90. console.log("获取成功", res.data);
  91. _this.ip = res.data;
  92. },
  93. });
  94. uni.getStorage({
  95. key: "host",
  96. success(res) {
  97. console.log("获取成功", res.data);
  98. _this.host = res.data;
  99. },
  100. });
  101. },
  102. methods: {
  103. focusState() {
  104. this.recshow = true;
  105. this.recshowto = false;
  106. this.recshowthree = false;
  107. },
  108. focusStateto() {
  109. this.recshow = false;
  110. this.recshowthree = false;
  111. this.recshowto = true;
  112. },
  113. focusStatethree() {
  114. this.recshow = false;
  115. this.recshowto = false;
  116. this.recshowthree = true;
  117. },
  118. startLogin(e) {
  119. uni.removeStorage({
  120. key: "ip",
  121. });
  122. uni.removeStorage({
  123. key: "host",
  124. });
  125. console.log(e, "田炯", this.ip);
  126. let that = this;
  127. uni.setStorage({
  128. key: "ip",
  129. data: this.ip,
  130. });
  131. uni.setStorage({
  132. key: "host",
  133. data: this.host,
  134. });
  135. uni.getStorage({
  136. key: "ip",
  137. success(res) {
  138. console.log("获取成功", res.data);
  139. that.ip = res.data;
  140. },
  141. });
  142. uni.getStorage({
  143. key: "host",
  144. success(res) {
  145. console.log("获取成功", res.data);
  146. that.host = res.data;
  147. },
  148. });
  149. let host = that.ip + ":" + that.host;
  150. uni.setStorage({
  151. key: "hostappst",
  152. data: host,
  153. });
  154. uni.getStorage({
  155. key: "hostappst",
  156. success(res) {
  157. console.log("获取成功", res.data);
  158. uni.showToast({
  159. title: host,
  160. icon: "none",
  161. });
  162. },
  163. });
  164. //登录
  165. if (this.isRotate) {
  166. //判断是否加载中,避免重复点击请求
  167. return false;
  168. }
  169. console.log("登录成功");
  170. _this.isRotate = true;
  171. setTimeout(function () {
  172. uni.navigateTo({
  173. url: "/pages/index/login",
  174. });
  175. _this.isRotate = false;
  176. }, 1000);
  177. },
  178. Waereroter() {
  179. uni.navigateTo({
  180. url: "/pages/Warehousing/index",
  181. });
  182. },
  183. },
  184. };
  185. </script>
  186. <style scoped>
  187. .rec::before {
  188. position: absolute;
  189. bottom: 0;
  190. content: "";
  191. height: 2px;
  192. width: 258px;
  193. background-color: red;
  194. /* 依次对应:动画名、时长、匀速、无限循环 */
  195. animation: move 3s;
  196. }
  197. </style>
  198. <style scoped lang="scss">
  199. @import url("./css/main.css");
  200. .u-button--square {
  201. border-bottom-left-radius: 3px;
  202. border-bottom-right-radius: 3px;
  203. border-top-left-radius: 3px;
  204. width: 86%;
  205. border-top-right-radius: 3px;
  206. border-radius: 8vw;
  207. background: red;
  208. color: aliceblue;
  209. }
  210. .content {
  211. padding: 15px;
  212. margin-top: 17px;
  213. .title_ipunt {
  214. display: flex;
  215. width: 100%;
  216. font-size: 16px;
  217. font-weight: 400;
  218. color: #5a5a5a;
  219. margin: 0 0 6vw 0;
  220. .text {
  221. width: 22%;
  222. text-align-last: justify;
  223. }
  224. }
  225. .botins {
  226. position: absolute;
  227. bottom: 35px;
  228. left: 0;
  229. right: 0;
  230. }
  231. }
  232. </style>