前端登录
This commit is contained in:
parent
1e28ee7904
commit
7e5fa7696e
|
|
@ -3,6 +3,7 @@ package com.ruoyi.business.ajax;
|
|||
import com.ruoyi.business.domain.BizCashInfo;
|
||||
import com.ruoyi.business.domain.BizMember;
|
||||
import com.ruoyi.business.domain.BizMemberAddress;
|
||||
import com.ruoyi.business.service.IBizCashInfoService;
|
||||
import com.ruoyi.business.service.IBizMemberAddressService;
|
||||
import com.ruoyi.business.service.IBizMemberService;
|
||||
import com.ruoyi.common.annotation.AjaxLogin;
|
||||
|
|
@ -27,6 +28,9 @@ public class AjaxMemberController extends AuthController {
|
|||
@Resource
|
||||
private IBizMemberAddressService bizMemberAddressService;
|
||||
|
||||
@Resource
|
||||
private IBizCashInfoService bizCashInfoService;
|
||||
|
||||
//个人中心
|
||||
@PostMapping("/center")
|
||||
public AjaxResult center()
|
||||
|
|
|
|||
|
|
@ -10,7 +10,15 @@ module.exports = {
|
|||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
proxyTable: {},
|
||||
proxyTable: {
|
||||
'/': {
|
||||
target: 'http://192.168.1.101:80',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/': ''
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
|
|
|
|||
|
|
@ -280,6 +280,14 @@
|
|||
"postcss-value-parser": "^3.2.3"
|
||||
}
|
||||
},
|
||||
"axios": {
|
||||
"version": "0.20.0",
|
||||
"resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
|
||||
"integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
|
||||
"requires": {
|
||||
"follow-redirects": "^1.10.0"
|
||||
}
|
||||
},
|
||||
"babel-code-frame": {
|
||||
"version": "6.26.0",
|
||||
"resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz",
|
||||
|
|
@ -4090,8 +4098,7 @@
|
|||
"follow-redirects": {
|
||||
"version": "1.13.0",
|
||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
|
||||
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA=="
|
||||
},
|
||||
"for-in": {
|
||||
"version": "1.0.2",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = {
|
||||
plugins: {
|
||||
'autoprefixer': {browsers: 'last 5 version'}
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,7 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: 'Header',
|
||||
props: {
|
||||
|
|
@ -40,6 +41,16 @@ export default {
|
|||
return {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
//未登录检测
|
||||
if(this.$route.path == "/") return;
|
||||
let token = localStorage.getItem("loginToken");
|
||||
if(!token || token.length == 0){
|
||||
this.$router.push({
|
||||
path: '/',
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
if(this.type === 'close') {
|
||||
|
|
@ -47,7 +58,7 @@ export default {
|
|||
} else {
|
||||
this.$router.back();
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ const verbs = {
|
|||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization' : localStorage.getItem("loginUser")
|
||||
},
|
||||
body: JSON.stringify(params),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import {MessageBox} from "mint-ui";
|
||||
|
||||
export default {
|
||||
warnFunc: (res) => {
|
||||
if (res.code == 301) {
|
||||
MessageBox({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
showCancelButton: false
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -15,11 +15,13 @@
|
|||
import { Field } from 'mint-ui';
|
||||
import { Button } from 'mint-ui';
|
||||
import request from '../utils/request.js';
|
||||
import util from '../utils/util.js';
|
||||
import { Toast } from 'mint-ui';
|
||||
import { MessageBox } from 'mint-ui';
|
||||
import field from '../components/field';
|
||||
import Header from '../components/header';
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Field,
|
||||
|
|
@ -31,14 +33,21 @@ export default {
|
|||
},
|
||||
data () {
|
||||
return {
|
||||
username: '',
|
||||
password: '',
|
||||
}
|
||||
shopPhone: '',
|
||||
shopPwd: '',
|
||||
};
|
||||
},
|
||||
async created() {
|
||||
const url = 'https://api.apiopen.top/getJoke?page=1&count=2&type=video';
|
||||
const res = await request({}, url);
|
||||
console.log('res >>> ', res);
|
||||
|
||||
let dataStr = localStorage.getItem("loginUser");
|
||||
if(dataStr && dataStr.length > 0) {
|
||||
let user = JSON.parse(dataStr);
|
||||
this.$refs.shopPhone.val = user.mobile;
|
||||
this.$refs.shopPwd.val = user.password;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
login() {
|
||||
|
|
@ -51,8 +60,17 @@ export default {
|
|||
showCancelButton: false
|
||||
});
|
||||
} else {
|
||||
this.$router.push({
|
||||
path: '/home',
|
||||
let data = {mobile:username, password:password};
|
||||
request(data, "/ajax/login").then(res => {
|
||||
window.top.resss = res;
|
||||
if(util.warnFunc(res)) return;
|
||||
if(res.code == 0){
|
||||
localStorage.setItem("loginToken", res.msg);
|
||||
localStorage.setItem("loginUser", JSON.stringify(data));
|
||||
this.$router.push({
|
||||
path: '/home',
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue