configuration.vue 4.7 KB

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