Commit a34ecd77 by me

添加token验证

parent ec801e35
......@@ -18,8 +18,8 @@
<el-submenu index="1">
<template slot="title"><i class="icon"><img src="../assets/img/icon/ico3.png" alt=""></i>菜单管理</template>
<el-menu-item-group>
<el-menu-item index="/tab/bannerList">banner管理</el-menu-item>
<el-menu-item index="/tab/cookbook">菜谱管理</el-menu-item>
<el-menu-item index="/tab/bannerList" >banner管理</el-menu-item>
<el-menu-item index="/tab/cookbook" >菜谱管理</el-menu-item>
<el-menu-item index="/tab/cookList">厨师人员管理</el-menu-item>
<el-menu-item index="/tab/bjList">保洁人员管理</el-menu-item>
<el-menu-item index="/tab/wxList">维修人员管理</el-menu-item>
......@@ -46,7 +46,7 @@
</div>
</div>
</el-header>
<el-main class="main">
<el-main class="main">
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
......@@ -62,7 +62,9 @@ export default {
data () {
return {
userName: '',
currentDate: ''
currentDate: '',
index:0,
index1:0,
}
},
mounted () {
......@@ -71,6 +73,9 @@ export default {
},
methods: {
getUserInfor () {
// var routerParams = this.$route.query.nameId;
// this.index = routerParams;
// console.log(routerParams)
if (window.localStorage.length > 0) {
var userInfo = localStorage.getItem('userInfo')
if (userInfo != null) {
......
......@@ -15,8 +15,8 @@ import 'quill/dist/quill.bubble.css'
// use
Vue.use(VueQuillEditor)
axios.defaults.baseURL = 'http://47.94.209.240:8088/'
// axios.defaults.baseURL = 'https://slbjgfwj.cn/api/'
// axios.defaults.baseURL = 'http://47.94.209.240:8088/'
axios.defaults.baseURL = 'https://slbjgfwj.cn/api/'
Vue.prototype.$ImageUploadUrl = 'https://slbjgfwj.cn/api/file/fileUpload'
......
......@@ -19,8 +19,9 @@ export default {
userForm: {
loginName: '',
passWord: '',
locPwd: false
}
locPwd: false,
},
// nameId:1,
}
},
created () {
......@@ -29,16 +30,22 @@ export default {
methods: {
login () {
if (this.userForm.loginName && this.userForm.passWord) {
let _this = this
let _this = this;
this.$axios({
method: 'post',
url: '/operator/login/user',
data: _this.userForm
data: _this.userForm,
}).then((res) => {
console.log(res.data)
console.log(res.data.data.accessToken)
if (res.data.code === '0') {
this.$router.push({ name: 'userList' })
window.localStorage.setItem('userInfo', JSON.stringify(res.data))
this.$router.push({
name: 'userList',
// query:{
// nameId:_this.nameId,
// },
})
window.localStorage.setItem('userInfo', JSON.stringify(res.data))
window.localStorage.setItem('token', JSON.stringify(res.data.data.accessToken))
}
})
} else {
......
......@@ -100,8 +100,14 @@ export default {
postUrl = '/pcbanner/update/banner'
params.id = this.addForm.id
}
this.$axios.post(postUrl, params, {
}).then((res)=> {
this.$axios({
method: 'post',
url: postUrl,
data: params,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res)=> {
this.$router.go(-1)
})
},
......
......@@ -139,7 +139,10 @@ export default {
this.$axios({
method: 'post',
url: '/pcbanner/get/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.orderListData = res.data.data.resultList
this.countPage = res.data.data.countPage
......
......@@ -84,7 +84,13 @@ export default {
},
methods: {
getData () {
this.$axios.get('/pccleaning/get/' + this.$route.params.id).then((res)=>{
this.$axios({
method:'get',
url:'/pccleaning/get/' + this.$route.params.id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res)=>{
this.cookData = res.data.data
})
},
......
......@@ -125,6 +125,9 @@ export default {
this.$axios({
method: 'get',
url: '/pccook/delete/' + id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getList()
})
......@@ -141,7 +144,10 @@ export default {
this.$axios({
method: 'post',
url: '/pccleaning/get/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.data = res.data.data.resultList
this.countPage = res.data.data.countPage
......
......@@ -109,7 +109,13 @@ export default {
},
methods: {
getData () {
this.$axios.get('/pccook/get/' + this.$route.params.id).then((res)=>{
this.$axios({
method:'get',
url:'/pccook/get/' + this.$route.params.id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res)=>{
this.addForm = res.data.data
this.imageUrl = this.addForm.url
res.data.data.status == 'Y' ? this.addForm.status = true : this.addForm.status = false
......
......@@ -60,7 +60,13 @@ export default {
},
methods: {
getData () {
this.$axios.get('/pccook/get/' + this.$route.params.id).then((res)=>{
this.$axios.get({
method:'get',
url:'/pccook/get/' + this.$route.params.id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res)=>{
this.cookData = res.data.data
})
},
......
......@@ -138,6 +138,9 @@ export default {
this.$axios({
method: 'get',
url: '/pccook/delete/' + id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getList()
})
......@@ -154,7 +157,10 @@ export default {
this.$axios({
method: 'post',
url: '/pccook/get/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.data = res.data.data.resultList
this.countPage = res.data.data.countPage
......
......@@ -50,7 +50,7 @@
align="center"
label="菜品图片">
<template slot-scope="scope">
<img class="cookImage" v-if="scope.row.imgUrl" :src="scope.row.imgUrl" alt="">
<img class="cookImage" v-if="scope.row.imgBase64" :src="scope.row.imgBase64" alt="">
</template>
</el-table-column>
<el-table-column
......@@ -159,11 +159,15 @@ export default {
this.$axios({
method: 'post',
url: '/pcfood/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.orderListData = res.data.data.resultList
this.countPage = res.data.data.countPage
this.page = res.data.data.page
console.log()
})
},
handleRowChange (row, event, column) {
......
......@@ -116,6 +116,9 @@ export default {
this.$axios({
method: 'get',
url: '/pccook/delete/' + id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getList()
})
......@@ -130,7 +133,10 @@ export default {
this.$axios({
method: 'post',
url: '/pcproduct/get/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.data = res.data.data.resultList
this.countPage = res.data.data.countPage
......
......@@ -123,7 +123,10 @@ export default {
this.$axios({
method: 'post',
url: '/pclog/get/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.orderListData = res.data.data.resultList
this.countPage = res.data.data.countPage
......
......@@ -133,7 +133,12 @@
<el-col :span="3" class="align-right padding-right10">支付方式:</el-col>
<el-col :span="5">{{orderObg.payType}}</el-col>
</el-row>
<!-- <el-row v-if="orderObg.type == 'CS'">
<el-col :span="3" class="align-right padding-right10">取货时间:</el-col>
<el-col :span="8">付款后一周(工作日 11:30~13:30 16:30~17:00)</el-col>
<el-col :span="3" class="align-right padding-right10">取货方式:</el-col>
<el-col :span="5">{{orderObg.payType}}</el-col>
</el-row> -->
<el-row v-if="orderObg.type == 'WM' || orderObg.type == 'CS'">
<el-col :span="3" class="align-right padding-right10">状态:</el-col>
<el-col :span="5">{{renderStatus(orderObg.status)}}</el-col>
......@@ -197,8 +202,13 @@ export default {
methods: {
getDetail () {
var _this = this
this.$axios.get('/pc/trade/get/id/' + this.$route.params.id, {
}).then(function (res) {
this.$axios({
method:'get',
url:'/pc/trade/get/id/' + this.$route.params.id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then(function (res) {
console.log(res.data)
_this.orderObg = res.data.data
})
......
......@@ -274,7 +274,10 @@ export default {
data: {
id: id,
userName: JSON.parse(window.localStorage.getItem('userInfo')).data.userResponse.userName
}
},
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getOrderList()
})
......@@ -287,7 +290,10 @@ export default {
data: {
id: id,
userName: JSON.parse(window.localStorage.getItem('userInfo')).data.userResponse.userName
}
},
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getOrderList()
})
......@@ -300,7 +306,10 @@ export default {
data: {
id: id,
userName: JSON.parse(window.localStorage.getItem('userInfo')).data.userResponse.userName
}
},
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getOrderList()
})
......@@ -313,7 +322,10 @@ export default {
data: {
id: id,
userName: JSON.parse(window.localStorage.getItem('userInfo')).data.userResponse.userName
}
},
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getOrderList()
})
......@@ -335,7 +347,10 @@ export default {
this.$axios({
method: 'post',
url: '/pc/trade/get/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
res.data.data.resultList.forEach((item)=>{
if (item.type == 'WM' || item.type == 'CS') {
......@@ -378,7 +393,10 @@ export default {
this.$axios({
method: 'post',
url: '/pc/trade/get/group',
data: params
data: params,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
res.data.data.forEach((item)=>{
item.num = parseInt(item.num)
......
......@@ -109,7 +109,7 @@ export default {
currentPage: 10,
countPage: '',
page: '',
orderListData: []
orderListData: [],
}
},
created () {
......@@ -128,7 +128,10 @@ export default {
this.$axios({
method: 'post',
url: '/pcuser/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.orderListData = res.data.data.resultList
this.countPage = res.data.data.countPage
......
......@@ -73,7 +73,13 @@ export default {
},
methods: {
getData () {
this.$axios.get('/pcrepair/get/' + this.$route.params.id).then((res)=>{
this.$axios({
method: 'get',
url:'/pcrepair/get/' + this.$route.params.id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res)=>{
this.cookData = res.data.data
})
},
......
......@@ -125,6 +125,9 @@ export default {
this.$axios({
method: 'get',
url: '/pccook/delete/' + id,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.getList()
})
......@@ -141,7 +144,10 @@ export default {
this.$axios({
method: 'post',
url: '/pcrepair/get/list?p=' + this.allPage + '&c=' + this.currentPage,
data: parms
data: parms,
headers: {
'token':JSON.parse(window.localStorage.getItem('token')),
}
}).then((res) => {
this.data = res.data.data.resultList
this.countPage = res.data.data.countPage
......
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 sign in to comment