改为使用vue-cli打包,修改所有的请求方式
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
<template>
|
||||
<div style="padding-top: 50px;" class="user-login-vue">
|
||||
<div style="padding-top: 50px;">
|
||||
<el-form :model="loginParam" :rules="loginRules" ref="loginParam" label-position="left" label-width="0px"
|
||||
class="demo-ruleForm login-container">
|
||||
<h3 class="title">系统登录</h3>
|
||||
<el-form-item>
|
||||
<el-form-item prop="username">
|
||||
<el-input type="text" v-model="loginParam.username" auto-complete="off" placeholder="账号" @keyup.enter="loginSubmit"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-form-item prop="password">
|
||||
<el-input type="password" v-model="loginParam.password" auto-complete="off" placeholder="密码" @keyup.enter="loginSubmit"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item style="width:100%;">
|
||||
<el-button type="primary" style="width:100%;" @click.native.prevent="loginSubmit" :loading="logining">登录
|
||||
</el-button>
|
||||
<el-button type="primary" style="width:100%;" @click.native.prevent="loginSubmit" :loading="logining">登录</el-button>
|
||||
<!--<el-button @click.native.prevent="handleReset2">重置</el-button>-->
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -19,6 +18,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import userApi from '../../common/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -44,14 +44,13 @@
|
||||
},
|
||||
methods: {
|
||||
loginSubmit() {
|
||||
var that = this;
|
||||
this.$refs.loginParam.validate((valid) => {
|
||||
if (!valid) return;
|
||||
that.common.post(that.apilist1.userLogin, that.loginParam, function (json) {
|
||||
if(!!that.redirect) {
|
||||
location.href = decodeURIComponent(that.redirect);
|
||||
userApi.userLogin(this.loginParam).then(() => {
|
||||
if (!!this.redirect) {
|
||||
location.href = decodeURIComponent(this.redirect);
|
||||
} else {
|
||||
that.$router.back();
|
||||
this.$router.back();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -61,7 +60,7 @@
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.user-login-vue .login-container {
|
||||
.login-container {
|
||||
-webkit-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
@@ -73,12 +72,14 @@
|
||||
border: 1px solid #eaeaea;
|
||||
box-shadow: 0 0 25px #cac6c6;
|
||||
}
|
||||
.user-login-vue .title {
|
||||
|
||||
.title {
|
||||
margin: 0px auto 40px auto;
|
||||
text-align: center;
|
||||
color: #505458;
|
||||
}
|
||||
.user-login-vue .remember {
|
||||
|
||||
.remember {
|
||||
margin: 0px 0px 35px 0px;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<template>
|
||||
<div class="user-my-info-vue">
|
||||
<el-breadcrumb separator-class="el-icon-arrow-right" style="padding: 20px 10px;">
|
||||
<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
|
||||
<el-breadcrumb-item>我的信息</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<div class="my-info-vue">
|
||||
<div style="margin: 0 auto;max-width: 1000px;">
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">我的信息</div>
|
||||
@@ -21,7 +17,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
var app;
|
||||
import userApi from '../../common/api/user'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -29,13 +25,12 @@
|
||||
};
|
||||
},
|
||||
mounted: function () {
|
||||
app = this;
|
||||
this.getUserInfo();
|
||||
},
|
||||
methods: {
|
||||
getUserInfo() {
|
||||
this.common.post(this.apilist1.getSelfUserInfo, this.searchParam, function (json) {
|
||||
app.userInfo = json.data;
|
||||
userApi.getSelfUserInfo().then(json => {
|
||||
this.userInfo = json.data;
|
||||
});
|
||||
},
|
||||
}
|
||||
@@ -43,7 +38,7 @@
|
||||
|
||||
</script>
|
||||
<style>
|
||||
.user-my-info-vue{}
|
||||
.user-my-info-vue .box-card{margin: 10px;}
|
||||
.my-info-vue{}
|
||||
.my-info-vue .box-card{margin: 10px;}
|
||||
</style>
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user