Compare commits
3 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
22e28b4666 | |
|
|
9406ee5413 | |
|
|
6004f63e9f |
|
|
@ -2,45 +2,43 @@
|
|||
|
||||
const path = require('path')
|
||||
|
||||
var proxyUrl =
|
||||
|
||||
module.exports = {
|
||||
dev: {
|
||||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: false,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
cacheBusting: true,
|
||||
cssSourceMap: true,
|
||||
proxyTable: {
|
||||
'/screen': {
|
||||
// target: 'http://112.29.103.165:21626',//重庆
|
||||
target: 'http://192.168.0.14:21624',//测试
|
||||
// target: 'http://10.40.92.74:8080',
|
||||
changeOrigin: true,
|
||||
// secure: true, //如果是https接口,需要配置这个参数
|
||||
pathRewrite: {
|
||||
'^/screen': '/'
|
||||
}
|
||||
var proxyUrl = (module.exports = {
|
||||
dev: {
|
||||
// Paths
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
|
||||
autoOpenBrowser: false,
|
||||
errorOverlay: true,
|
||||
notifyOnErrors: true,
|
||||
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
|
||||
devtool: 'cheap-module-eval-source-map',
|
||||
cacheBusting: true,
|
||||
cssSourceMap: true,
|
||||
proxyTable: {
|
||||
'/screen': {
|
||||
// target: 'http://112.29.103.165:21626',//重庆
|
||||
target: 'http://192.168.2.158:49080', //测试
|
||||
// target: 'http://10.40.92.74:8080',
|
||||
changeOrigin: true,
|
||||
// secure: true, //如果是https接口,需要配置这个参数
|
||||
pathRewrite: {
|
||||
'^/screen': '/',
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
build: {
|
||||
index: path.resolve(__dirname, '../dist/index01.html'),
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static01',
|
||||
assetsPublicPath: '/bigScrap/',
|
||||
productionSourceMap: false,
|
||||
devtool: '#source-map',
|
||||
productionGzip: false,
|
||||
productionGzipExtensions: ['js', 'css'],
|
||||
bundleAnalyzerReport: process.env.npm_config_report
|
||||
}
|
||||
}
|
||||
},
|
||||
build: {
|
||||
index: path.resolve(__dirname, '../dist/index01.html'),
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../dist'),
|
||||
assetsSubDirectory: 'static01',
|
||||
assetsPublicPath: '/bigScrap/',
|
||||
productionSourceMap: false,
|
||||
devtool: '#source-map',
|
||||
productionGzip: false,
|
||||
productionGzipExtensions: ['js', 'css'],
|
||||
bundleAnalyzerReport: process.env.npm_config_report,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ var testUrl = '112.29.103.165:21624/'
|
|||
module.exports = {
|
||||
NODE_ENV: '"production"',
|
||||
//post用当前域名
|
||||
// API_ROOT: '"http://' + testUrl + '/iot"'
|
||||
API_ROOT: '"/screen"',
|
||||
// API_ROOT: '/sgzbgl-api/',
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -22,6 +22,7 @@
|
|||
"jquery": "^3.6.1",
|
||||
"js-base64": "^3.6.0",
|
||||
"js-md5": "^0.7.3",
|
||||
"jsencrypt": "^3.3.2",
|
||||
"less-loader": "^4.1.0",
|
||||
"moment": "^2.29.1",
|
||||
"scss": "^0.2.4",
|
||||
|
|
|
|||
86
src/App.vue
86
src/App.vue
|
|
@ -9,12 +9,24 @@ export default {
|
|||
created() {
|
||||
// console.log(this.$route)
|
||||
// localStorage.setItem('token', this.$route.query.token)
|
||||
var link = document.querySelector("link[rel*='icon']") || document.createElement("link");
|
||||
link.type = "image/x-icon";
|
||||
link.rel = "shortcut icon";
|
||||
link.href = require('./assets/img/myImage/logo.png');
|
||||
document.getElementsByTagName("head")[0].appendChild(link);
|
||||
|
||||
var link =
|
||||
document.querySelector("link[rel*='icon']") ||
|
||||
document.createElement('link')
|
||||
link.type = 'image/x-icon'
|
||||
link.rel = 'shortcut icon'
|
||||
link.href = require('./assets/img/myImage/logo.png')
|
||||
document.getElementsByTagName('head')[0].appendChild(link)
|
||||
},
|
||||
watch: {
|
||||
$route: {
|
||||
handler(newValue) {
|
||||
console.log(newValue, '路由监听--')
|
||||
if (newValue.query.token) {
|
||||
localStorage.setItem('token', newValue.query.token)
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
@ -22,7 +34,7 @@ export default {
|
|||
.el-dialog {
|
||||
// 背景色透明
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
// background-color: transparent;
|
||||
// background-color: transparent;
|
||||
// background-color: #000;
|
||||
background-image: url('./assets/img/dialog/window.png');
|
||||
background-size: 100% 100%;
|
||||
|
|
@ -43,76 +55,78 @@ export default {
|
|||
|
||||
.el-table th {
|
||||
// #253855 #30619B 背景色从上到下渐变
|
||||
background: linear-gradient(to bottom, #2B313D, #3267A7);
|
||||
background: linear-gradient(to bottom, #2b313d, #3267a7);
|
||||
color: #fff;
|
||||
border-bottom: 1px solid #84FCFD !important;
|
||||
border-bottom: 1px solid #84fcfd !important;
|
||||
}
|
||||
.el-table tr {
|
||||
background-color: #335684;
|
||||
color: #fff;
|
||||
}
|
||||
.el-table--striped .el-table__body tr.el-table__row--striped td {
|
||||
background-color: #25447D;
|
||||
background-color: #25447d;
|
||||
color: #fff;
|
||||
}
|
||||
.el-table td,.building-top .el-table th.is-leaf {
|
||||
border-bottom: 1px solid #6983A5;
|
||||
.el-table td,
|
||||
.building-top .el-table th.is-leaf {
|
||||
border-bottom: 1px solid #6983a5;
|
||||
}
|
||||
.el-table::before{
|
||||
border-bottom: 1px solid #6983A5;
|
||||
background-color: #6983A5;
|
||||
.el-table::before {
|
||||
border-bottom: 1px solid #6983a5;
|
||||
background-color: #6983a5;
|
||||
height: 1px;
|
||||
}
|
||||
.el-table--enable-row-hover .el-table__body tr:hover>td {
|
||||
background-color: #6983A5;
|
||||
.el-table--enable-row-hover .el-table__body tr:hover > td {
|
||||
background-color: #6983a5;
|
||||
}
|
||||
.el-pagination__total {
|
||||
color: #E1E3E6;
|
||||
color: #e1e3e6;
|
||||
}
|
||||
.el-pagination__jump {
|
||||
color: #E1E3E6;
|
||||
color: #e1e3e6;
|
||||
}
|
||||
.el-input__inner {
|
||||
background-color: transparent;
|
||||
border: 1px solid #77E2E7;
|
||||
color: #E1E3E6;
|
||||
border: 1px solid #77e2e7;
|
||||
color: #e1e3e6;
|
||||
}
|
||||
.el-pagination__sizes .el-input .el-input__inner {
|
||||
color: #E3E4E7;
|
||||
border: 1px solid #E3E4E7;
|
||||
color: #e3e4e7;
|
||||
border: 1px solid #e3e4e7;
|
||||
}
|
||||
.el-pagination__editor.el-input .el-input__inner {
|
||||
color: #E3E4E7;
|
||||
border: 1px solid #E3E4E7;
|
||||
color: #e3e4e7;
|
||||
border: 1px solid #e3e4e7;
|
||||
}
|
||||
.el-pagination.is-background .btn-prev, .el-pagination.is-background .el-pager li {
|
||||
color: #E3E4E7;
|
||||
border: 1px solid #E3E4E7;
|
||||
.el-pagination.is-background .btn-prev,
|
||||
.el-pagination.is-background .el-pager li {
|
||||
color: #e3e4e7;
|
||||
border: 1px solid #e3e4e7;
|
||||
background-color: transparent;
|
||||
}
|
||||
.el-pagination.is-background .btn-next {
|
||||
color: #E3E4E7;
|
||||
border: 1px solid #E3E4E7;
|
||||
color: #e3e4e7;
|
||||
border: 1px solid #e3e4e7;
|
||||
background-color: transparent;
|
||||
}
|
||||
.el-pagination.is-background .el-pager li:not(.disabled).active {
|
||||
background-color: #98F4FB;
|
||||
background-color: #98f4fb;
|
||||
color: #000;
|
||||
}
|
||||
.el-button--primary {
|
||||
background-color: #84FCFD;
|
||||
border: #84FCFD;
|
||||
background-color: #84fcfd;
|
||||
border: #84fcfd;
|
||||
color: #285050;
|
||||
}
|
||||
.el-button--default {
|
||||
background-color: transparent;
|
||||
border: 1px solid #84FCFD;
|
||||
color: #D5D6DA;
|
||||
border: 1px solid #84fcfd;
|
||||
color: #d5d6da;
|
||||
}
|
||||
.el-table__empty-block {
|
||||
background-color: #335684;
|
||||
.el-table__empty-text {
|
||||
color: #D5D6DA;
|
||||
color: #d5d6da;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,39 @@
|
|||
/**
|
||||
* axios全局配置
|
||||
*/
|
||||
import axios from 'axios';
|
||||
import axios from 'axios'
|
||||
// axios.defaults.timeout = 30000
|
||||
|
||||
// 默认配置
|
||||
// axios.defaults.baseURL = process.env.API_ROOT;
|
||||
// axios.defaults.baseURL = '/sgzbgl-api/';
|
||||
|
||||
|
||||
const axiosService = axios.create({
|
||||
baseURL: "http://192.168.8.163:21624/sgzbgl-api/",// you can use "process.env.VUE_APP_BASE_API" too
|
||||
timeout: 30000
|
||||
// baseURL: "http://192.168.0.62:21624/sgzbgl-api/",// you can use "process.env.VUE_APP_BASE_API" too
|
||||
baseURL: process.env.API_ROOT,
|
||||
timeout: 30000,
|
||||
})
|
||||
axiosService.interceptors.request.use(
|
||||
config => {
|
||||
(config) => {
|
||||
let token = localStorage.getItem('token')
|
||||
if (token) {
|
||||
config.headers.accessToken = `${token}`;
|
||||
config.headers.Authorization = `${token}`;
|
||||
config.headers.accessToken = `${token}`
|
||||
config.headers.Authorization = `${token}`
|
||||
}
|
||||
return config;
|
||||
return config
|
||||
},
|
||||
error => {
|
||||
return Promise.reject(error);
|
||||
(error) => {
|
||||
return Promise.reject(error)
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
// 添加一个请求拦截器
|
||||
axiosService.interceptors.response.use(
|
||||
response => {
|
||||
(response) => {
|
||||
if (response.data) {
|
||||
if (response.data.code === 401) {
|
||||
localStorage.clear()
|
||||
location.href = '/bigScrap/login/index'
|
||||
} else if (response.data.code === 200) {
|
||||
return Promise.resolve(response.data)
|
||||
} else {
|
||||
|
|
@ -40,32 +42,36 @@ axiosService.interceptors.response.use(
|
|||
} else {
|
||||
return Promise.reject(response.data)
|
||||
}
|
||||
|
||||
},
|
||||
error => {
|
||||
if (error.code === 'ECONNABORTED' && error.message.indexOf('timeout') !== -1)
|
||||
(error) => {
|
||||
if (
|
||||
error.code === 'ECONNABORTED' &&
|
||||
error.message.indexOf('timeout') !== -1
|
||||
)
|
||||
console.log('请求超时!')
|
||||
return Promise.reject(error)
|
||||
}
|
||||
);
|
||||
)
|
||||
|
||||
// 通用POST方法
|
||||
export const POST = (url, params) => {
|
||||
return axiosService.post(`${url}`, params).then(response => response);
|
||||
};
|
||||
return axiosService.post(`${url}`, params).then((response) => response)
|
||||
}
|
||||
|
||||
// 通用POST_JSON方法
|
||||
export const POST_JSON = (url, json, params) => {
|
||||
return axiosService.post(`${url}`, json, {
|
||||
params: params
|
||||
}).then(response => response);
|
||||
};
|
||||
return axiosService
|
||||
.post(`${url}`, json, {
|
||||
params: params,
|
||||
})
|
||||
.then((response) => response)
|
||||
}
|
||||
|
||||
// 通用GET方法
|
||||
export const GET = (url, params) => {
|
||||
return axiosService.get(`${url}`, {
|
||||
params: params
|
||||
}).then(response => response);
|
||||
};
|
||||
|
||||
|
||||
return axiosService
|
||||
.get(`${url}`, {
|
||||
params: params,
|
||||
})
|
||||
.then((response) => response)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ Vue.use(Router)
|
|||
|
||||
const originalPush = Router.prototype.push
|
||||
Router.prototype.push = function push(location) {
|
||||
return originalPush.call(this, location).catch(err => err)
|
||||
return originalPush.call(this, location).catch((err) => err)
|
||||
}
|
||||
|
||||
const Layout = () => import('@/views/layout');
|
||||
const Home = () => import('@/views/Home/index');
|
||||
const Login = () => import('@/views/Login/index');
|
||||
const Layout = () => import('@/views/layout')
|
||||
const Home = () => import('@/views/Home/index')
|
||||
const Login = () => import('@/views/Login/index')
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
|
|
@ -49,10 +49,10 @@ const routes = [
|
|||
name: 'Login',
|
||||
meta: {
|
||||
title: '登录',
|
||||
requireLoginAuth: true
|
||||
}
|
||||
}
|
||||
]
|
||||
requireLoginAuth: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: '*',
|
||||
|
|
@ -63,26 +63,25 @@ const routes = [
|
|||
const router = new Router({
|
||||
mode: 'history',
|
||||
routes,
|
||||
base: '/bigScrap'
|
||||
base: '/bigScrap',
|
||||
})
|
||||
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
if (to.path === '/login/index') {
|
||||
return next();
|
||||
return next()
|
||||
}
|
||||
|
||||
|
||||
if (to.query.token) {
|
||||
localStorage.setItem('token', to.query.token)
|
||||
}
|
||||
const token = to.query.token || localStorage.getItem('token') || null;
|
||||
// if (to.query.token) {
|
||||
// localStorage.setItem('token', to.query.token)
|
||||
// }
|
||||
// const token = to.query.token || localStorage.getItem('token') || null
|
||||
const token = localStorage.getItem('token')
|
||||
if (!token) {
|
||||
next('/bigScrap/login/index'); // 跳转到登录页
|
||||
next('/bigScrap/login/index') // 跳转到登录页
|
||||
} else {
|
||||
next(); // 放行
|
||||
next() // 放行
|
||||
}
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
// if (to.matched.some(r => r.meta.requireLoginAuth)) {
|
||||
// next();
|
||||
|
|
@ -91,4 +90,3 @@ router.beforeEach(async (to, from, next) => {
|
|||
// }
|
||||
|
||||
export default router
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
|
||||
|
||||
// 密钥对生成 http://web.chacuo.net/netrsakeypair
|
||||
|
||||
const publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKoR8mX0rGKLqzcWmOzbfj64K8ZIgOdHnzkXSOVOZbFu/TJhZ7rFAN+eaGkl3C4buccQd/EjEsj9ir7ijT7h96MCAwEAAQ=='
|
||||
|
||||
const privateKey = 'MIIBVAIBADANBgkqhkiG9w0BAQEFAASCAT4wggE6AgEAAkEAqhHyZfSsYourNxaY7Nt+PrgrxkiA50efORdI5U5lsW79MmFnusUA355oaSXcLhu5xxB38SMSyP2KvuKNPuH3owIDAQABAkAfoiLyL+Z4lf4Myxk6xUDgLaWGximj20CUf+5BKKnlrK+Ed8gAkM0HqoTt2UZwA5E2MzS4EI2gjfQhz5X28uqxAiEA3wNFxfrCZlSZHb0gn2zDpWowcSxQAgiCstxGUoOqlW8CIQDDOerGKH5OmCJ4Z21v+F25WaHYPxCFMvwxpcw99EcvDQIgIdhDTIqD2jfYjPTY8Jj3EDGPbH2HHuffvflECt3Ek60CIQCFRlCkHpi7hthhYhovyloRYsM+IS9h/0BzlEAuO0ktMQIgSPT3aFAgJYwKpqRYKlLDVcflZFCKY7u3UP8iWi1Qw0Y='
|
||||
|
||||
// 加密
|
||||
export function encrypt(txt) {
|
||||
const encryptor = new JSEncrypt()
|
||||
encryptor.setPublicKey(publicKey) // 设置公钥
|
||||
return encryptor.encrypt(txt) // 对数据进行加密
|
||||
}
|
||||
|
||||
// 解密
|
||||
export function decrypt(txt) {
|
||||
const encryptor = new JSEncrypt()
|
||||
encryptor.setPrivateKey(privateKey) // 设置私钥
|
||||
return encryptor.decrypt(txt) // 对数据进行解密
|
||||
}
|
||||
|
||||
|
|
@ -112,6 +112,8 @@ import {
|
|||
getSendIphoneCodeApi,
|
||||
loginCodeApi,
|
||||
} from '../../api/userLogin'
|
||||
|
||||
import { encrypt } from '@/untils/jsencrypt.js'
|
||||
export default {
|
||||
name: 'Login',
|
||||
data() {
|
||||
|
|
@ -182,10 +184,11 @@ export default {
|
|||
username: this.form.userName,
|
||||
password: this.form.passWord,
|
||||
}
|
||||
params.password = encrypt(params.password)
|
||||
authLoginApi(params).then((res) => {
|
||||
if (res.code == 200) {
|
||||
localStorage.setItem('token', res.data.access_token)
|
||||
this.$router.push('./Home/index')
|
||||
this.$router.push({ name: 'home' })
|
||||
} else {
|
||||
this.$message.error(res.msg)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue