<template>
|
<view class="box">
|
<view class="header">
|
<view class="titleFirst"><b>新疆维吾尔自治区自然灾害综合监测预警</b></view>
|
<view class="titleSecond"><b>自然灾害综合风险预警发布及响应联动系统</b></view>
|
</view>
|
<view>
|
<u-form :model="form" ref="uForm" class="form" >
|
<u-form-item ><u-input color="#fff" v-model="form.name" placeholder="请输入用户名" /></u-form-item>
|
<u-form-item ><u-input color="#fff" v-model="form.pwd" type="password" placeholder="请输入密码" /></u-form-item>
|
<!-- <view class="loginPsw">
|
<u-checkbox-group >
|
<u-checkbox disabled="true"></u-checkbox><text style="color: #fff;">自动登录</text>
|
</u-checkbox-group>
|
<text style="color: lightblue;">忘记密码</text>
|
</view> -->
|
<u-form-item ><u-button type="primary" style="width: 100%;" @click="Login">登录</u-button></u-form-item>
|
<view style="color: white;margin-left:25%;margin-top: 70%;">技术支持:中国科学院</view>
|
</u-form>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {login} from '../../api/index.js';
|
import store from '@/store/index.js'
|
export default {
|
data() {
|
return {
|
form: {
|
name: '',
|
pwd: ''
|
},
|
type: ''
|
}
|
},
|
onShow() {
|
uni.clearStorageSync();
|
uni.clearStorage();
|
},
|
methods: {
|
Login(){
|
login(this.form).then(res => {
|
console.log("res",res)
|
if (res.code === 100) {
|
uni.setStorageSync("tk", res.data.tk);
|
uni.setStorageSync("uid",res.data.uid);
|
uni.setStorageSync('user', res.data);
|
uni.setStorageSync('roleName', res.data.role.roleName);
|
if(res.data.role.roleName == '工作人员'){
|
this.$store.commit('setRoleId', 'user_other');
|
uni.switchTab({
|
url: '/pages/tabBar/notice/notice'
|
});
|
}else if (res.data.role.roleName == '管理员'){
|
this.$store.commit('setRoleId', '');
|
uni.showToast({
|
icon: "none",
|
title: '管理员请使用平台登录'
|
});
|
}else{
|
this.$store.commit('setRoleId', 'user_leader');
|
uni.switchTab({
|
url: '/pages/tabBar/examine/examine'
|
});
|
}
|
}
|
}).catch(err=>{
|
})
|
},
|
}
|
}
|
</script>
|
|
<style>
|
.box{
|
width: 100%;
|
height: 100vh;
|
background: url('../../static/bg.jpeg') no-repeat;
|
background-size: 100% 100%;
|
background-attachment: fixed;/* 不设置的话页面滑动时,背景会不铺满*/
|
display: flex;
|
flex-direction: column;
|
}
|
.titleFirst{
|
text-align: center;
|
font-size: 18px;
|
color:#fff;
|
}
|
.titleSecond{
|
text-align: center;
|
font-size: 19px;
|
color:#fff;
|
margin-top: 10px;
|
}
|
.header {
|
display: flex;
|
flex-direction: column;
|
align-items: center;
|
justify-content: center;
|
padding-top:100px;
|
text-shadow:0 0 1px #000;
|
}
|
.form{
|
width: 80%;
|
margin: 100px auto 0px;
|
|
}
|
.loginPsw{
|
margin-bottom: 20px;
|
display: flex;
|
justify-content: space-between;
|
}
|
</style>
|