mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-mobile.git
synced 2025-12-09 10:56:47 +08:00
2022年5月29日 从svn移到git
This commit is contained in:
93
pages/login/login.vue
Normal file
93
pages/login/login.vue
Normal file
@@ -0,0 +1,93 @@
|
||||
<template>
|
||||
<view style="padding-top: 100px;">
|
||||
<u-toast ref="loginToast"></u-toast>
|
||||
<view style="padding: 40uxp;background-color: #FFFFFF;">
|
||||
<view class="logo">
|
||||
<view style="font-size: 50upx;">京东方大学堂</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="">
|
||||
<u--input prefixIcon="account" placeholder="员工号" border="surround" v-model="loginName"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<view class="">
|
||||
<u--input prefixIcon="lock" placeholder="密码" :password="true" type="password" border="surround" v-model="password"></u--input>
|
||||
</view>
|
||||
</view>
|
||||
<view class="row">
|
||||
<u-button @tap="submitLogin" type="primary" text="登 录"></u-button>
|
||||
</view>
|
||||
<view class="getpass">
|
||||
<!-- <a href="#">忘记密码?</a> -->
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import apiLogin from '@/api/login.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
loginName: '',//10181457
|
||||
password: '',//666666
|
||||
loading:false,
|
||||
redirect: undefined
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
//对cookies进行操作,这里是写
|
||||
//document.cookie = "mytest=qweqwe131231; path=/; max-age=" + 30*24*60*60;
|
||||
},
|
||||
methods: {
|
||||
submitLogin(){
|
||||
const params={
|
||||
loginName:this.loginName,
|
||||
password:this.password,
|
||||
code:''
|
||||
}
|
||||
let $this=this;
|
||||
this.$store.dispatch("Login", params).then(rs => {
|
||||
$this.loading = false;
|
||||
if(rs.status==200){
|
||||
//console.log(rs);
|
||||
$this.$store.dispatch("InitData").then(res => {
|
||||
//console.log(res)
|
||||
//$this.$watermark.set(res.result.name + res.result.loginName);
|
||||
// uni.switchTab({
|
||||
// url:'/pages/index/index'
|
||||
// })
|
||||
uni.switchTab({
|
||||
url:'/pages/study/index'
|
||||
})
|
||||
});
|
||||
}else{
|
||||
console.log(rs.error);
|
||||
$this.$refs.loginToast.show({message:'登录失败',type:'error'});
|
||||
}
|
||||
}).catch(() => {
|
||||
$this.loading = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page{
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
.row{
|
||||
margin: 30upx 100upx;
|
||||
}
|
||||
.logo{
|
||||
text-align: center;
|
||||
margin: 40upx;
|
||||
}
|
||||
.getpass{
|
||||
text-align: right;
|
||||
margin: 20upx 100upx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user