This commit is contained in:
2022-10-10 19:58:07 +08:00
parent e7806048b7
commit 1702a7c6a3
9 changed files with 142 additions and 42 deletions

27
components/NavBar.vue Normal file
View 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>

View File

@@ -4,7 +4,7 @@
"path" : "pages/login/login",
"style": {
"navigationStyle": "custom"
}
}
}
,{
"path" : "pages/home/home",
@@ -22,34 +22,56 @@
}
,{
"path" : "pages/ProductManage/EmptyPipeInStore",
"style" : {
"navigationBarTitleText": "空管入库",
"navigationStyle": "default",
"enablePullDownRefresh": false
"style": {
"navigationStyle": "custom"
}
}
,{
"path" : "pages/ProductManage/ZjCasing",
"style" : {
"navigationBarTitleText": "子卷套管",
"navigationStyle": "default",
"enablePullDownRefresh": false
"app-plus": {
"titleNView": {
"buttons":[
{
"type":"home"
}
]
}
},
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/ProductManage/ZjDelivery",
"style" : {
"navigationBarTitleText": "子卷配送",
"navigationStyle": "default",
"enablePullDownRefresh": false
"app-plus": {
"titleNView": {
"buttons":[
{
"type":"home"
}
]
}
},
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/ProductManage/ZjOutStore",
"style" : {
"navigationBarTitleText": "子卷出站",
"navigationStyle": "default",
"enablePullDownRefresh": false
"app-plus": {
"titleNView": {
"buttons":[
{
"type":"home"
}
]
}
},
"enablePullDownRefresh": false
}
}
,{

View File

@@ -1,15 +1,28 @@
<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>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
export default {
data() {
return {
};
},
components: {
NavBar
},
methods: {
}
}
</script>

View File

@@ -18,20 +18,31 @@
</template>
<script>
import {handRequest} from '@/utils/api.js'
export default {
data() {
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: '指令管理'}]
};
},
mounted () {
this._handRequest()
},
methods: {
async _handRequest () {
let res = await handRequest()
uni.showModal({
content: res.desc,
showCancel: false
})
},
toPage (url) {
uni.redirectTo({
url: url
})
},
Quit () {
this.$store.dispatch('setSignOut')
this.$store.dispatch('delUserInfo')
uni.redirectTo({
url: '/pages/login/login'
})

View File

@@ -46,9 +46,9 @@
})
},
async toLogin() {
uni.redirectTo({
url: '/pages/home/home'
})
// uni.redirectTo({
// url: '/pages/home/home'
// })
this.disabled = true
if (this.user === '') {
uni.showToast({
@@ -68,22 +68,16 @@
}
try {
let res = await handLogin(this.user, RSAencrypt(this.password))
if(res.code === '1') {
if (this.saveUser) {
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'
})
if (this.saveUser) {
this.$store.dispatch('saveLoginName', this.user)
} else {
uni.showToast({
title: res.desc,
icon: 'none'
})
this.$store.dispatch('delLoginName', '')
}
this.$store.dispatch('saveUserInfo', JSON.stringify(res.user.user))
this.$store.dispatch('saveToken', res.token)
uni.redirectTo({
url: '/pages/home/home'
})
this.disabled = false
} catch (e) {
this.disabled = false

View File

@@ -1,14 +1,19 @@
import request from './request.js'
// 登录
export const handLogin = (user, password) => request({
url:'api/aja/hand/handlogin',
// url:'api/pda/set/setPrint', // 测试接口
url:'mobile/auth/login',
data: {
user: user,
username: user,
password: password
}
})
// 测试状态码报错接口
export const handRequest = () => request({
url:'getInfo/4',
data: {}
})
// 任务下发
// 1.1查询所有区域信息
export const handArea = (type) => request({

View File

@@ -16,6 +16,10 @@ const request = (params) => {
// data.token = '179509245-9c91827e0224bdc18d0b118b8be1b5af';
// }
// }
let token = ''
if (store.getters.saveToken !== '') {
token = store.getters.saveToken
}
let defaultOpot = {
// 'Content-Type': 'application/x-www-form-urlencoded',
'Terminal-Type': 'innerH5',
@@ -26,6 +30,7 @@ const request = (params) => {
if (method == 'POST') {
header = {
'Content-Type': 'application/json;charset=UTF-8',
'Authorization': token
}
// data = qs.stringify(data)
}
@@ -42,7 +47,19 @@ const request = (params) => {
dataType: 'json',
})
.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 {
data: dataType
} = res[1]
@@ -83,11 +100,11 @@ const request = (params) => {
// break
// }
}else {
uni.showToast({
title: '网络错误',
icon: 'none'
uni.showModal({
content: res[1].data.message,
showCancel: false
})
reject(res[1].data.error)
reject(res[1].data.message)
}
})
.catch(err => { // 错误

View File

@@ -5,13 +5,15 @@ const state = {
baseUrl: uni.getStorageSync('baseUrl') || baseUrl,
setTime: uni.getStorageSync('setTime') || 5000,
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 = {
baseUrl: state => state.baseUrl,
setTime: state => state.setTime,
loginName: state => state.loginName,
userInfo: state => state.userInfo
userInfo: state => state.userInfo,
saveToken: state => state.saveToken
}
const actions = {
setConfig ({commit}, res) {
@@ -33,7 +35,12 @@ const actions = {
},
delUserInfo({commit}, res) {
uni.clearStorageSync('userInfo')
uni.clearStorageSync('saveToken')
commit(types.DEL_USER_INFO, res)
},
saveToken({commit}, res) {
uni.setStorageSync('saveToken', res)
commit(types.SAVE_TOKEN, res)
}
}
const mutations = {
@@ -53,6 +60,9 @@ const mutations = {
[types.DEL_USER_INFO] (state, res) {
state.userInfo = res
},
[types.SAVE_TOKEN] (state, res) {
state.saveToken = res
}
}
export default {

View File

@@ -5,4 +5,5 @@ export const SAVE_LOGIN_NAME = 'SAVE_LOGIN_NAME'
export const DEL_LOGIN_NAME = 'DEL_LOGIN_NAME'
export const COM_CONFIG = 'COM_CONFIG'
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'