| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <template>
- <view class="content p-rel">
- <view :style="{ paddingTop: statusBarHeight + 'px' }"></view>
- <view class="box">
- <view class="mgb-10">当前连接:YThuwai</view>
- <view class="listbox">
- <view class="flex jc_between pdy-30 border-bottom" v-for="wifi in list">
- <view class="flex">
- <i class="fas fa-wifi"></i>
- {{ wifi.SSID }}
- </view>
- <view @click="connectedWifi(wifi)" :class="wifi.status ?'c_btn':'btn'">
- {{ wifi.status? '已连接': '连接' }}
- </view>
- </view>
- </view>
- </view>
- </view>
- <view class="ADBox">
- 横幅广告
- </view>
- </template>
- <script setup>
- import { ref, onMounted } from "vue";
- import { onShow } from "@dcloudio/uni-app";
- var statusBarHeight = uni.getStorageSync('statusBarHeight')
- const list = ref([
- {
- "SSID": "YThuwai",
- "BSSID": "XX:XX:XX:XX:XX:XX",
- status:true,
- },
- {
- "SSID": "YtZhe",
- "BSSID": "XX:XX:XX:XX:XX:XX",
- status:false,
- },
- {
- "SSID": "DIRECT-GQDESKTOP2E4TVT1-msPR",
- "BSSID": "YY:YY:YY:YY:YY:YY",
- status:false,
- },
- {
- "SSID": "4-426",
- "BSSID": "XX:XX:XX:XX:XX:XX",
- status:false,
- },
- {
- "SSID": "Tech_xxx",
- "BSSID": "YY:YY:YY:YY:YY:YY",
- status:false,
- },
- {
- "SSID": "88888888-pZ",
- "BSSID": "XX:XX:XX:XX:XX:XX",
- status:false,
- },
- {
- "SSID": "ChinaNet-bG62",
- "BSSID": "YY:YY:YY:YY:YY:YY",
- status:false,
- },
- {
- "SSID": "GF-1",
- "BSSID": "XX:XX:XX:XX:XX:XX",
- status:false,
- },
- {
- "SSID": "GAIF",
- "BSSID": "YY:YY:YY:YY:YY:YY",
- status:false,
- },
- {
- "SSID": "boss",
- "BSSID": "XX:XX:XX:XX:XX:XX",
- status:false,
- },
- {
- "SSID": "ChinaNet-LJmh",
- "BSSID": "YY:YY:YY:YY:YY:YY",
- status:false,
- },
- {
- "SSID": "Home_WiFi",
- "BSSID": "XX:XX:XX:XX:XX:XX",
- status:false,
- },
- {
- "SSID": "Office_WiFi",
- "BSSID": "YY:YY:YY:YY:YY:YY",
- status:false,
- }
- ])
- onMounted(()=>{
- // uni.getConnectedWifi({
- // success:(res)=>{
- // console.log('res',res)
- // }
- // })
- // uni.getWifiList({
- // success:(res)=>{
- // console.log('res',res.wifiList)
- // },
- // fail: (err) => {
- // console.log('err',err)
- // }
- // })
- })
- const connectedWifi = (wifi)=>{
- uni.showToast({
- title:`已连接`
- })
- list.value.map(item=>{ return item.status = false })
- wifi.status = true
- }
- </script>
- <style lang="scss" scoped>
- .content{
- height: 100vh;
- padding: 28rpx;
- background: linear-gradient(to bottom, #a9d4ff, #cce6ff);
- }
- .box{
- background-color: #fff;
- border-radius: 30rpx;
- height: 95vh;
- padding: 30rpx 28rpx;
- .listbox{
- max-height: 85vh;
- overflow-y: scroll;
- .c_btn{
- background-color: #399bfc;
- color: #fff;
- font-size: 22rpx;
- line-height: 48rpx;
- border-radius: 30rpx;
- cursor: pointer;
- width: 120rpx;
- height: 48rpx;
- text-align: center;
- }
- .btn{
- width: 120rpx;
- height: 48rpx;
- line-height: 48rpx;
- text-align: center;
- background-color: #fff;
- color: #399bfc;
- border: 1rpx solid #399bfc;
- font-size: 22rpx;
- border-radius: 30rpx;
- cursor: pointer;
- }
- }
- }
- .ADBox{
- position: fixed;
- bottom: 0;
- height: 120rpx;
- width: 100%;
- background-color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- </style>
|