123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- <template>
- <view class="window-box container-box">
- <view class="flow-box" @click="changeStep">
- <view class="flow-info">
- <view class="flow-info-item">
- <image :src="`${imgUrl}/start_img_web.png`" />
- <view>网络检测</view>
- </view>
- <view class="flow-info-item">
- <image :src="curStep > 1 ? `${imgUrl}/start_img_log_selected.png` : `${imgUrl}/start_img_log_disabled.png`" />
- <view>登陆</view>
- </view>
- <view class="flow-info-item">
- <image
- :src="curStep > 2 ? `${imgUrl}/start_img_system_selected.png` : `${imgUrl}/start_img_system_disabled.png`" />
- <view>进入系统</view>
- </view>
- </view>
- <view class="flow-step">
- <view v-if="curStep == 1" class="flow-step-item flow-step-item1">1</view>
- <image v-else :src="`${imgUrl}/start_icon_done_blue.png`" />
- <view class="flow-step-point" :class="curStep > 1 ? 'flow-step-point-active1' : ''">········</view>
- <view v-if="curStep <= 1" class="flow-step-item">2</view>
- <view v-else-if="curStep == 2" class="flow-step-item flow-step-item2">2</view>
- <image v-else :src="`${imgUrl}/start_icon_done_green.png`" />
- <view class="flow-step-point" :class="curStep > 2 ? 'flow-step-point-active2' : ''">········</view>
- <view v-if="curStep < 3" class="flow-step-item">3</view>
- <view v-else-if="curStep == 3" class="flow-step-item flow-step-item3">3</view>
- <image v-else :src="`${imgUrl}/start_icon_done_yellow.png`" />
- </view>
- </view>
- <view class="info-box">
- <view v-if="curStep == 1" class="step1-box">
- <image :src="`${imgUrl}/start_img_default.png`" />
- <view class="tips-box">
- <view class="tips">暂无网络连接,请重试</view>
- <view class="btn btn-primary" @click="initNetwork">重新检测</view>
- </view>
- </view>
- <view v-else-if="curStep == 2" class="step2-box">
- <uv-input placeholder="请输入设备码" border="surround" fontSize="28upx" height="97upx" v-model="loginForm.mac"
- class="step2-input"></uv-input>
- <uv-input placeholder="请输入密码" border="surround" fontSize="28upx" v-model="loginForm.pwd" password="true"
- class="step2-input"></uv-input>
- <view style="display: flex;">
- <view class="btn btn-green" @click="handleLogin">登录</view>
- </view>
- </view>
- <view v-else class="step3-box">
- <image :src="`${imgUrl}/start_img_system.png`" />
- <view class="tips-box">
- <view class="tips">正在进入系统中,请耐心等待...</view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script setup>
- import { onActivated, onMounted, reactive, ref } from "vue";
- import { navTo, showToast } from "@/utils/app";
- import {useUserStore} from "@/store/useUserStore";
- import {logs, sleep} from "@/utils/util";
- import { onLoad } from '@dcloudio/uni-app';
- const userStore = useUserStore()
- const imgUrl = ref('/static/image/bmi-init')
- const curStep = ref(0)
- const loginForm = ref({
- mac: '',
- pwd: ''
- })
- const networkType = ref({})
- const changeStep = () => {
- curStep.value += 1
-
- if(curStep.value == 5){
- navTo('pages/index/index', {
- })
- }
- }
- const initNetwork = () =>{
- uni.getNetworkType({
- success: async (res) => {
- networkType.value = res.networkType
- if (res.networkType == 'none') {
- showToast('无网络连接')
- curStep.value = 1
- } else {
- await sleep(1100)
- curStep.value = 2
- }
- }
- })
- }
- const handleLogin = async () =>{
- if(loginForm.value.mac == ''){
- return showToast('请输入设备码')
- }
- if(loginForm.value.pwd == ''){
- return showToast('请输入密码')
- }
- userStore.login(loginForm.value).then(async (data)=>{
- curStep.value += 1
- await sleep(1000)
- curStep.value += 1
- await sleep(1000)
- navTo('pages/index/index', {})
- }).catch(()=>{
- })
- }
- onLoad(() => {
- initNetwork()
- })
- </script>
- <style scoped>
- .btn {
- width: 480upx;
- border-radius: 21upx;
- margin: 0 auto;
- }
- .flow-box {
- margin: 50upx auto 0;
- width: 650upx;
- }
- .flow-info {
- display: flex;
- justify-content: space-between;
- }
- .flow-info-item {
- width: 200upx;
- height: 230upx;
- position: relative;
- border-radius: 21upx;
- }
- .flow-info-item view {
- text-align: center;
- font-weight: bold;
- font-size: 35upx;
- color: #FFF;
- margin-top: 24upx;
- z-index: 9;
- width: 200upx;
- height: 230upx;
- position: absolute;
- }
- .flow-info image {
- width: 200upx;
- height: 230upx;
- position: absolute;
- border-radius: 21upx;
- }
- .flow-step {
- display: flex;
- width: 550upx;
- line-height: 70upx;
- justify-content: space-around;
- margin: 20upx auto 0;
- }
- .flow-step-item {
- width: 70upx;
- height: 70upx;
- text-align: center;
- font-weight: bold;
- font-size: 35upx;
- border-radius: 50%;
- border: 8upx solid #D9D9D9;
- background: #fff;
- color: #D9D9D9;
- }
- .flow-step image {
- height: 86upx;
- width: 86upx;
- position: relative;
- }
- .flow-step-item1 {
- border: 8upx solid rgb(205, 223, 252);
- background: #2F87F5;
- color: #fff;
- }
- .flow-step-item2 {
- border: 8upx solid rgb(183, 232, 227);
- background: #01CF7A;
- color: #fff;
- }
- .flow-step-item3 {
- border: 8upx solid rgb(236, 230, 218);
- background: #FFC64D;
- color: #fff;
- }
- .flow-step-point {
- font-size: 40upx;
- font-weight: 700;
- position: relative;
- top: 10upx;
- color: #D9D9D9;
- }
- .flow-step-point-active1 {
- color: #0369E8;
- }
- .flow-step-point-active2 {
- color: #01CF7A;
- }
- .info-box {
- background: #fff;
- width: 650upx;
- height: 650upx;
- border-radius: 35upx;
- margin: 20upx auto 0;
- }
- .container-box {
- background-image: url('/static/image/bmi-init/img_bg.png');
- background-repeat: repeat-x;
- }
- .step2-box {
- width: 650upx;
- height: 650upx;
- padding-top: 60upx;
- box-sizing: border-box;
- }
- .step1-box image {
- width: 490upx;
- height: 313upx;
- margin: 0 auto 0;
- padding-top: 40upx;
- display: block;
- }
- .step3-box image {
- width: 479upx;
- height: 479upx;
- margin: 0 auto 0;
- padding-top: 40upx;
- display: block;
- }
- .tips-box {
- display: flex;
- flex-direction: column;
- }
- .tips {
- font-size: 21rpx;
- color: #6F6F6F;
- text-align: center;
- margin: 30upx 0;
- }
- .step2-box .step2-input {
- width: 547upx;
- height: 97upx !important;
- background: #FFFFFF;
- border-width: 3upx !important;
- border-color: #01CF7A !important;
- font-size: 28upx;
- color: #6F6F6F;
- border-radius: 20upx !important;
- line-height: 97upx !important;
- margin: 0 auto 60upx;
- }
- .btn-green {
- color: #FFFFFF;
- background: #01CF7A;
- border-color: #01CF7A;
- margin: 0 auto;
- }
- </style>
|