登录
This commit is contained in:
27
components/NavBar.vue
Normal file
27
components/NavBar.vue
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<template>
|
||||||
|
<view class="header">
|
||||||
|
<text class="icon-back"></text>
|
||||||
|
<text></text>
|
||||||
|
<text class="icon-home"></text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="stylus">
|
||||||
|
@import '@/common/style/mixin.styl';
|
||||||
|
.header
|
||||||
|
_fj()
|
||||||
|
position fixed
|
||||||
|
_wh(100%, 86rpx)
|
||||||
|
background-color $red
|
||||||
|
z-index 100
|
||||||
|
</style>
|
||||||
44
pages.json
44
pages.json
@@ -4,7 +4,7 @@
|
|||||||
"path" : "pages/login/login",
|
"path" : "pages/login/login",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,{
|
,{
|
||||||
"path" : "pages/home/home",
|
"path" : "pages/home/home",
|
||||||
@@ -22,34 +22,56 @@
|
|||||||
}
|
}
|
||||||
,{
|
,{
|
||||||
"path" : "pages/ProductManage/EmptyPipeInStore",
|
"path" : "pages/ProductManage/EmptyPipeInStore",
|
||||||
"style" : {
|
"style": {
|
||||||
"navigationBarTitleText": "空管入库",
|
"navigationStyle": "custom"
|
||||||
"navigationStyle": "default",
|
|
||||||
"enablePullDownRefresh": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,{
|
,{
|
||||||
"path" : "pages/ProductManage/ZjCasing",
|
"path" : "pages/ProductManage/ZjCasing",
|
||||||
"style" : {
|
"style" : {
|
||||||
"navigationBarTitleText": "子卷套管",
|
"navigationBarTitleText": "子卷套管",
|
||||||
"navigationStyle": "default",
|
"app-plus": {
|
||||||
"enablePullDownRefresh": false
|
"titleNView": {
|
||||||
|
"buttons":[
|
||||||
|
{
|
||||||
|
"type":"home"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,{
|
,{
|
||||||
"path" : "pages/ProductManage/ZjDelivery",
|
"path" : "pages/ProductManage/ZjDelivery",
|
||||||
"style" : {
|
"style" : {
|
||||||
"navigationBarTitleText": "子卷配送",
|
"navigationBarTitleText": "子卷配送",
|
||||||
"navigationStyle": "default",
|
"app-plus": {
|
||||||
"enablePullDownRefresh": false
|
"titleNView": {
|
||||||
|
"buttons":[
|
||||||
|
{
|
||||||
|
"type":"home"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,{
|
,{
|
||||||
"path" : "pages/ProductManage/ZjOutStore",
|
"path" : "pages/ProductManage/ZjOutStore",
|
||||||
"style" : {
|
"style" : {
|
||||||
"navigationBarTitleText": "子卷出站",
|
"navigationBarTitleText": "子卷出站",
|
||||||
"navigationStyle": "default",
|
"app-plus": {
|
||||||
"enablePullDownRefresh": false
|
"titleNView": {
|
||||||
|
"buttons":[
|
||||||
|
{
|
||||||
|
"type":"home"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
,{
|
,{
|
||||||
|
|||||||
@@ -1,15 +1,28 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view>
|
||||||
|
<nav-bar title="空管入库"></nav-bar>
|
||||||
|
<view class="content">
|
||||||
|
<view class="container"></view>
|
||||||
|
<view class="submit-bar">
|
||||||
|
<button class="submit-button btn-disabled">入库确认</button>
|
||||||
|
<button class="submit-button">查询</button>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import NavBar from '@/components/NavBar.vue'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
NavBar
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -18,20 +18,31 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import {handRequest} from '@/utils/api.js'
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
menu: [{url: '/pages/ProductManage/EmptyPipeInStore', name: '空管入库'}, {url: '/pages/ProductManage/ZjCasing', name: '子卷套管'}, {url: '/pages/ProductManage/ZjDelivery', name: '子卷配送'}, {url: '/pages/ProductManage/ZjOutStore', name: '子卷出站'}, {url: '/pages/task/painttask', name: '任务生成'}, {url: '/pages/task/sitemanage', name: '站点管理'}, {url: '/pages/task/pointrelease', name: '点位取放货确认'}, {url: '/pages/task/taskmanage', name: '任务管理'}, {url: '/pages/task/zlmanage', name: '指令管理'}]
|
menu: [{url: '/pages/ProductManage/EmptyPipeInStore', name: '空管入库'}, {url: '/pages/ProductManage/ZjCasing', name: '子卷套管'}, {url: '/pages/ProductManage/ZjDelivery', name: '子卷配送'}, {url: '/pages/ProductManage/ZjOutStore', name: '子卷出站'}, {url: '/pages/task/painttask', name: '任务生成'}, {url: '/pages/task/sitemanage', name: '站点管理'}, {url: '/pages/task/pointrelease', name: '点位取放货确认'}, {url: '/pages/task/taskmanage', name: '任务管理'}, {url: '/pages/task/zlmanage', name: '指令管理'}]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this._handRequest()
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async _handRequest () {
|
||||||
|
let res = await handRequest()
|
||||||
|
uni.showModal({
|
||||||
|
content: res.desc,
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
},
|
||||||
toPage (url) {
|
toPage (url) {
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: url
|
url: url
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
Quit () {
|
Quit () {
|
||||||
this.$store.dispatch('setSignOut')
|
this.$store.dispatch('delUserInfo')
|
||||||
uni.redirectTo({
|
uni.redirectTo({
|
||||||
url: '/pages/login/login'
|
url: '/pages/login/login'
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -46,9 +46,9 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async toLogin() {
|
async toLogin() {
|
||||||
uni.redirectTo({
|
// uni.redirectTo({
|
||||||
url: '/pages/home/home'
|
// url: '/pages/home/home'
|
||||||
})
|
// })
|
||||||
this.disabled = true
|
this.disabled = true
|
||||||
if (this.user === '') {
|
if (this.user === '') {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
@@ -68,22 +68,16 @@
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
let res = await handLogin(this.user, RSAencrypt(this.password))
|
let res = await handLogin(this.user, RSAencrypt(this.password))
|
||||||
if(res.code === '1') {
|
if (this.saveUser) {
|
||||||
if (this.saveUser) {
|
this.$store.dispatch('saveLoginName', this.user)
|
||||||
this.$store.dispatch('saveLoginName', this.user)
|
|
||||||
} else {
|
|
||||||
this.$store.dispatch('delLoginName', '')
|
|
||||||
}
|
|
||||||
this.$store.dispatch('saveUserInfo', JSON.stringify(res.result))
|
|
||||||
uni.redirectTo({
|
|
||||||
url: '/pages/home/home'
|
|
||||||
})
|
|
||||||
} else {
|
} else {
|
||||||
uni.showToast({
|
this.$store.dispatch('delLoginName', '')
|
||||||
title: res.desc,
|
|
||||||
icon: 'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
|
||||||
|
this.$store.dispatch('saveToken', res.token)
|
||||||
|
uni.redirectTo({
|
||||||
|
url: '/pages/home/home'
|
||||||
|
})
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.disabled = false
|
this.disabled = false
|
||||||
|
|||||||
11
utils/api.js
11
utils/api.js
@@ -1,14 +1,19 @@
|
|||||||
import request from './request.js'
|
import request from './request.js'
|
||||||
// 登录
|
// 登录
|
||||||
export const handLogin = (user, password) => request({
|
export const handLogin = (user, password) => request({
|
||||||
url:'api/aja/hand/handlogin',
|
url:'mobile/auth/login',
|
||||||
// url:'api/pda/set/setPrint', // 测试接口
|
|
||||||
data: {
|
data: {
|
||||||
user: user,
|
username: user,
|
||||||
password: password
|
password: password
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 测试状态码报错接口
|
||||||
|
export const handRequest = () => request({
|
||||||
|
url:'getInfo/4',
|
||||||
|
data: {}
|
||||||
|
})
|
||||||
|
|
||||||
// 任务下发
|
// 任务下发
|
||||||
// 1.1查询所有区域信息
|
// 1.1查询所有区域信息
|
||||||
export const handArea = (type) => request({
|
export const handArea = (type) => request({
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ const request = (params) => {
|
|||||||
// data.token = '179509245-9c91827e0224bdc18d0b118b8be1b5af';
|
// data.token = '179509245-9c91827e0224bdc18d0b118b8be1b5af';
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
let token = ''
|
||||||
|
if (store.getters.saveToken !== '') {
|
||||||
|
token = store.getters.saveToken
|
||||||
|
}
|
||||||
let defaultOpot = {
|
let defaultOpot = {
|
||||||
// 'Content-Type': 'application/x-www-form-urlencoded',
|
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
'Terminal-Type': 'innerH5',
|
'Terminal-Type': 'innerH5',
|
||||||
@@ -26,6 +30,7 @@ const request = (params) => {
|
|||||||
if (method == 'POST') {
|
if (method == 'POST') {
|
||||||
header = {
|
header = {
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
|
'Authorization': token
|
||||||
}
|
}
|
||||||
// data = qs.stringify(data)
|
// data = qs.stringify(data)
|
||||||
}
|
}
|
||||||
@@ -42,7 +47,19 @@ const request = (params) => {
|
|||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
})
|
})
|
||||||
.then(res => { // 成功
|
.then(res => { // 成功
|
||||||
if (res[1] && res[1].statusCode === 200) {
|
if (res.length === 1) {
|
||||||
|
uni.showModal({
|
||||||
|
content: 'request:fail',
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
reject('request:fail')
|
||||||
|
} else if (res[1] && res[1].statusCode === 400) {
|
||||||
|
uni.showModal({
|
||||||
|
content: res[1].data.message,
|
||||||
|
showCancel: false
|
||||||
|
})
|
||||||
|
reject(res[1].data.message)
|
||||||
|
} else if (res[1] && res[1].statusCode === 200) {
|
||||||
let {
|
let {
|
||||||
data: dataType
|
data: dataType
|
||||||
} = res[1]
|
} = res[1]
|
||||||
@@ -83,11 +100,11 @@ const request = (params) => {
|
|||||||
// break
|
// break
|
||||||
// }
|
// }
|
||||||
}else {
|
}else {
|
||||||
uni.showToast({
|
uni.showModal({
|
||||||
title: '网络错误',
|
content: res[1].data.message,
|
||||||
icon: 'none'
|
showCancel: false
|
||||||
})
|
})
|
||||||
reject(res[1].data.error)
|
reject(res[1].data.message)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(err => { // 错误
|
.catch(err => { // 错误
|
||||||
|
|||||||
@@ -5,13 +5,15 @@ const state = {
|
|||||||
baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
|
baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
|
||||||
setTime: uni.getStorageSync('setTime') || 5000,
|
setTime: uni.getStorageSync('setTime') || 5000,
|
||||||
loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '',
|
loginName: uni.getStorageSync('loginName') ? uni.getStorageSync('loginName') : '',
|
||||||
userInfo: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo') : ''
|
userInfo: uni.getStorageSync('userInfo') ? uni.getStorageSync('userInfo') : '',
|
||||||
|
saveToken: uni.getStorageSync('saveToken') || ''
|
||||||
}
|
}
|
||||||
const getters = {
|
const getters = {
|
||||||
baseUrl: state => state.baseUrl,
|
baseUrl: state => state.baseUrl,
|
||||||
setTime: state => state.setTime,
|
setTime: state => state.setTime,
|
||||||
loginName: state => state.loginName,
|
loginName: state => state.loginName,
|
||||||
userInfo: state => state.userInfo
|
userInfo: state => state.userInfo,
|
||||||
|
saveToken: state => state.saveToken
|
||||||
}
|
}
|
||||||
const actions = {
|
const actions = {
|
||||||
setConfig ({commit}, res) {
|
setConfig ({commit}, res) {
|
||||||
@@ -33,7 +35,12 @@ const actions = {
|
|||||||
},
|
},
|
||||||
delUserInfo({commit}, res) {
|
delUserInfo({commit}, res) {
|
||||||
uni.clearStorageSync('userInfo')
|
uni.clearStorageSync('userInfo')
|
||||||
|
uni.clearStorageSync('saveToken')
|
||||||
commit(types.DEL_USER_INFO, res)
|
commit(types.DEL_USER_INFO, res)
|
||||||
|
},
|
||||||
|
saveToken({commit}, res) {
|
||||||
|
uni.setStorageSync('saveToken', res)
|
||||||
|
commit(types.SAVE_TOKEN, res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const mutations = {
|
const mutations = {
|
||||||
@@ -53,6 +60,9 @@ const mutations = {
|
|||||||
[types.DEL_USER_INFO] (state, res) {
|
[types.DEL_USER_INFO] (state, res) {
|
||||||
state.userInfo = res
|
state.userInfo = res
|
||||||
},
|
},
|
||||||
|
[types.SAVE_TOKEN] (state, res) {
|
||||||
|
state.saveToken = res
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ export const SAVE_LOGIN_NAME = 'SAVE_LOGIN_NAME'
|
|||||||
export const DEL_LOGIN_NAME = 'DEL_LOGIN_NAME'
|
export const DEL_LOGIN_NAME = 'DEL_LOGIN_NAME'
|
||||||
export const COM_CONFIG = 'COM_CONFIG'
|
export const COM_CONFIG = 'COM_CONFIG'
|
||||||
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
|
export const SAVE_USER_INFO = 'SAVE_USER_INFO'
|
||||||
export const DEL_USER_INFO = 'DEL_USER_INFO'
|
export const DEL_USER_INFO = 'DEL_USER_INFO'
|
||||||
|
export const SAVE_TOKEN = 'SAVE_TOKEN'
|
||||||
Reference in New Issue
Block a user