Commit b335d09e authored by honghuiliu's avatar honghuiliu 💬

Merge remote-tracking branch 'origin/master'

parents 6b6904ea 1e668922
#!/bin/sh -l
#cd phone
#npm i
#npm run build
#\cp -rfp dist/* ../dist_phone
cd server
bee pack -a "qsh-wc-test" -exp=".git:.idea:phone:pc" exs="Dockerfile:build.sh"
\ No newline at end of file
#!/bin/sh -l
cd phone
npm i
npm run build
mv dist/env/prod.js dist/env.js
\cp -rfp dist/* ../dist_phone
cd ../
bee pack -a "cf_data_monitor_prod" -exp=".git:.idea:phone:pc" exs="Dockerfile:build.sh"
\ No newline at end of file
......@@ -5,10 +5,9 @@ import { ElMessage } from 'element-plus'
import {useStore} from '@/store/modules/app';
import myPublic from '@/utils/public';
let id = 0;
const API_HOST = '';
const API_HOST = '/api';
const list = [
'phone/sms/sendCode',
'phone/login/login'
'web/login/login'
];
axios.interceptors.request.use(config => {
// loading
......@@ -53,7 +52,7 @@ function checkCode(res,url) {
});
}
if (res.code == 1000) {
localStorage.removeItem('token');
localStorage.removeItem('qsh-wc-token');
location.href = location.origin+location.pathname+'#/login';
return res
}
......
import test from './test';
import http from '../getData';
export default {
test:test,
//用户登录
login(params) {
return http.post('web/login/login', params)
},
//公厕详情
getToiletDetail(params) {
return http.post('web/toilet/getToiletDetail', params)
},
//公厕列表
toiletList(params) {
return http.post('web/toilet/toiletList', params)
},
//工单列表
getPatrolList(params) {
return http.post('web/toilet/getPatrolList', params)
}
}
import http from '../getData';
export default {
//待检查车辆
// getToCheck(params) {
// return http.post('phone/back_detail/getToCheck', params)
// }
}
......@@ -34,24 +34,27 @@ const router = createRouter({
history: createWebHashHistory(process.env.BASE_URL),
routes
});
router.beforeEach((to, from, next) => {
router.beforeEach(async (to, from, next) => {
const store = useStore();
// let token = myPublic.getStorage('token');
// if(!token){
// if(to.path!='/login'){
// next({path:'/login'})
// }else{
// next();
// }
// }else{
// if(!store.state.token){
// store.commit('token',token);
// }
// if(store.state.firstGo){
//
// }
// next()
// }
next()
let token = myPublic.getStorage('qsh-wc-token')?myPublic.getStorage('qsh-wc-token'):myPublic.getUrlKey('token');
if(!token){
store.FirstGO(0);
if(to.path!='/login'){
next({path:'/login'})
}else{
next();
}
}else{
if(!store.token){
store.TOKEN(token);
if(token!=myPublic.getStorage('qsh-wc-token')){
myPublic.setStorage('qsh-wc-token',token);
}
}
if(store.firstGo<3){
store.FirstGO(1);
}
next()
}
});
export default router
......@@ -7,14 +7,14 @@
<p class="account-title">账户登录</p>
<div class="row">
<span class="icon icon-16"></span>
<input class="input" type="text" v-model="name" placeholder="请输入您的账号" />
<input class="input" type="text" v-model="username" placeholder="请输入您的账号" />
</div>
<div class="row">
<span class="icon icon-17"></span>
<input class="input" type="password" v-model="password" placeholder="请输入密码" />
</div>
<div class="opt">
<span class="btn">登录</span>
<span class="btn" @click="submit">登录</span>
</div>
</div>
</div>
......@@ -23,16 +23,48 @@
<script>
// @ is an alias to /src
import {reactive,ref} from "vue"
import {reactive,toRefs} from "vue"
import {ElMessage} from "element-plus"
import api from "@/api/methods/index"
import myPublic from "@/utils/public"
import {useRouter} from "vue-router"
export default {
name: 'login',
setup(props,{emit}){
const router = useRouter();
const state = reactive({
name:'',
username:'',
password:''
});
function submit() {
if(!state.username){
return ElMessage({
type:'warning',
message:'请输入用户名'
})
}
if(!state.password){
return ElMessage({
type:'warning',
message:'请输入密码'
})
}
api.login({
username:state.username,
password:state.password,
}).then(async (res)=>{
if(res.code==0){
if(res.data){
myPublic.setStorage("qsh-wc-token",res.data);
await router.replace({path:"/home"});
window.reload();
}
}
})
}
return {
...ref(state)
...toRefs(state),
submit
}
},
components: {}
......
......@@ -59,16 +59,17 @@ module.exports = {
},
devServer:{
open:true,
// proxy: {
// '/phone_html/phone': {
// target: 'http://127.0.0.1:14101/phone',
// changeOrigin: true,
// pathRewrite: {
// // '^/apis': ''表示把/apis替换为‘’(空字符串),这样既能使用代理,
// // 又能在请求接口api时去掉/apis,获得正确的短信api路径。
// '^/phone_html/phone': ''
// },
// }
// }
port:80,
proxy: {
'/api': {
target: 'http://qsh-wc-test.linanquan.com/api',
changeOrigin: true,
pathRewrite: {
// '^/apis': ''表示把/apis替换为‘’(空字符串),这样既能使用代理,
// 又能在请求接口api时去掉/apis,获得正确的短信api路径。
'^/api': ''
},
}
}
}
};
......@@ -123,7 +123,7 @@ redis:
password: "rRk2k3nf9JJi283lk119Jvwz"
system:
env: public
addr: 8888
addr: 9801
db-type: mysql
oss-type: local
use-multipoint: false
......
{
"apps": [
{
"name": "cf-data-monitor-prod",
"exec_mode": "fork",
"autorestart": true,
"instances": 1,
"script": "cf_data_monitor_prod",
"node_args": [],
"args": [
],
"env": {
"GO_RUN_MODE": "prod"
}
}
]
}
{
"apps": [
{
"name": "qsh-wc-test",
"exec_mode": "fork",
"autorestart": true,
"instances": 1,
"script": "qsh-wc-test",
"node_args": [],
"args": [
],
"env": {
"GO_RUN_MODE": "test"
}
}
]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment