guoyujie
2025-12-04 03627defbc56d0498e7778523da255eb972db6a4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
 
 
 
<template>
    <view class="content" >
        <image class="logo" src="/static/favicon.ico"></image>
        <view class="text-area">
            <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" 
                type="input" />
        </view>
        
        <view>
            <!-- 提示信息弹窗 -->
            <uni-popup ref="message" type="message">
                <uni-popup-message :type="msgType" :message="messageText" :duration="2000" />
            </uni-popup>
        </view>
    </view>
</template>
 
<script  setup>
    import {onMounted, reactive,ref} from "vue"
  import userInfo from '@/stores/userInfo'
    import request from '@/utils/request'
    import {ip,webPort} from '@/utils/config.js'
    
  const store=userInfo()
    let searchUserList = ref({
        userName:null
    })
    let users = ref([])
    const message = ref(null)
    const type=ref('center')
    const msgType=ref('success')
    const messageText=ref('')
    const viewShow = ref(false)
    let ipVal = ref(null)
    
    onMounted(async()=>{
        
        /* if(ip===null){
            return
        }
        uni.reLaunch({
          url: `/pages/login/login`
        }) */
    })
    
    
    
    //提示打开
    const messageToggle = (type,msg) =>{
        msgType.value = type
        messageText.value = msg
        message.value.open()
    }
    
    
    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')
        }
    }
 
</script>
 
<style>
    /* .login{
        width: 100px;height: 45px;margin: 0 auto;
    } */
    .content {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        margin-top: -30%;
    }
 
    .logo {
        height: 200rpx;
        width: 200rpx;
        margin-top: 200rpx;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 50rpx;
    }
 
    .text-area {
        display: flex;
        justify-content: center;
        padding-bottom: 1rem;
    }
</style>