| | |
| | | |
| | | |
| | | |
| | | <template> |
| | | <view class="content" > |
| | | <image class="logo" src="/static/favicon.ico"></image> |
| | |
| | | <text class="title">NorthGlass_Scaner 初始化</text> |
| | | </view> |
| | | |
| | | |
| | | <view class="text-area" > |
| | | <uni-easyinput |
| | | @blur="changeIP" |
| | | class='input_1' |
| | | style="text-align: center;" |
| | | placeholder="请输入服务器ip" |
| | | :passwordIcon='false' |
| | | v-model="ipVal" |
| | | v-model.trim="ipVal" |
| | | type="input" /> |
| | | |
| | | </view> |
| | | <view class="text-area" > |
| | | <uni-easyinput |
| | | class='input_1' |
| | | style="text-align: center;" |
| | | placeholder="请输入端口号" |
| | | :passwordIcon='false' |
| | | v-model="portVal" |
| | | type="number" /> |
| | | </view> |
| | | |
| | | <view class="text-area" > |
| | | <button @click="save" type="primary" size="mini">保存</button> |
| | | </view> |
| | | |
| | | <view> |
| | |
| | | import userInfo from '@/stores/userInfo' |
| | | import request from '@/utils/request' |
| | | import {ip,webPort} from '@/utils/config.js' |
| | | import { debounce } from 'lodash' |
| | | |
| | | const store=userInfo() |
| | | let searchUserList = ref({ |
| | |
| | | const messageText=ref('') |
| | | const viewShow = ref(false) |
| | | let ipVal = ref(null) |
| | | let portVal = ref(null) |
| | | |
| | | onMounted(async()=>{ |
| | | onMounted(() => { |
| | | |
| | | /* if(ip===null){ |
| | | return |
| | | if(uni.getStorageSync('port') === ""){ |
| | | portVal.value = 8086 |
| | | }else{ |
| | | portVal.value = uni.getStorageSync('port') |
| | | } |
| | | uni.reLaunch({ |
| | | url: `/pages/login/login` |
| | | }) */ |
| | | }) |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | const changeIP =async () => { |
| | | const ipRegex = /^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; |
| | | if(ipRegex.test(ipVal.value)){ |
| | | await uni.setStorageSync('ip', ipVal.value); |
| | | plus.runtime.restart() |
| | | // const changeIP =async () => { |
| | | // const ipRegex = /^(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/; |
| | | // if(ipRegex.test(ipVal.value)){ |
| | | // await uni.setStorageSync('ip', ipVal.value); |
| | | // plus.runtime.restart() |
| | | |
| | | }else{ |
| | | messageToggle('error','请输入IP范围:0.0.0.0~255.255.255.255') |
| | | } |
| | | } |
| | | // }else{ |
| | | // messageToggle('error','请输入IP范围:0.0.0.0~255.255.255.255') |
| | | // } |
| | | // } |
| | | |
| | | const save = debounce(async() => { |
| | | if(portVal.value === null || portVal.value === "" || ipVal === null || ipVal === ""){ |
| | | messageToggle('error','ip或端口号不能为空') |
| | | return |
| | | } |
| | | await uni.setStorageSync('ip', ipVal.value); |
| | | await uni.setStorageSync('port', portVal.value); |
| | | plus.runtime.restart() |
| | | |
| | | },200) |
| | | </script> |
| | | |
| | | <style> |