This commit is contained in:
2022-10-10 10:19:18 +08:00
commit b6c903fd4d
191 changed files with 51152 additions and 0 deletions

100
utils/api.js Normal file
View File

@@ -0,0 +1,100 @@
import request from './request.js'
// 登录
export const handLogin = (user, password) => request({
url:'api/aja/hand/handlogin',
// url:'api/pda/set/setPrint', // 测试接口
data: {
user: user,
password: password
}
})
// 任务下发
// 1.1查询所有区域信息
export const handArea = (type) => request({
url: 'api/aja/hand/area',
data: {
area_flag: type
}
})
// 1.2根据区域查询设备编号及状态
export const handPoint = (reg) => request({
url: 'api/aja/hand/point',
data: {
region: reg
}
})
// 喷漆任务
export const handTask = (scode, ncode, type, batch) => request({
url: 'api/aja/hand/task',
data: {
start_devicecode: scode,
next_devicecode: ncode,
material_type: type,
batch: batch
}
})
/** 站点管理 */
// 1查询物料下拉框
export const handMatrial = () => request({
url: 'api/aja/hand/matrial'
})
// 1.2修改设备状态
export const handDeviceStatus = (code, mtype, type, no, batch) => request({
url: 'api/aja/hand/deviceStatus',
data: {
device_code: code,
material_type: mtype,
type: type,
status: no,
batch: batch
}
})
/** 点位取放货确认 */
export const handpointPut = (code, type) => request({
url: 'api/aja/hand/pointPut',
data: {
device_code: code,
status_type: type
}
})
/** 任务管理 */
// 1.1 查询未完成指令
export const queryTask = (keyword, scode, ncode) => request({
url: 'api/aja/hand/tasks',
data: {
keyword: keyword,
start_devicecode: scode,
next_devicecode: ncode
}
})
// 1.2 指令操作
export const taskOperation = (uuid, type) => request({
url: 'api/aja/hand/taskoperation',
data: {
inst_uuid: uuid,
type: type
}
})
/** 指令管理 */
// 1.1 查询未完成指令
export const queryInstraction = (keyword, scode, ncode) => request({
url: 'api/aja/hand/insts',
data: {
keyword: keyword,
start_devicecode: scode,
next_devicecode: ncode
}
})
// 1.2 指令操作
export const instOperation = (uuid, type) => request({
url: 'api/aja/hand/inst',
data: {
inst_uuid: uuid,
type: type
}
})

12
utils/jsencrypt.js Normal file
View File

@@ -0,0 +1,12 @@
import JSEncrypt from '../node_modules/jsencrypt/bin/jsencrypt.js'
let publicKey = 'MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD\n' +
'2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ==';
function RSAencrypt(pas){
//实例化jsEncrypt对象
let jse = new JSEncrypt();
//设置公钥
jse.setPublicKey(publicKey);
return jse.encrypt(pas);
}
export {RSAencrypt}

5373
utils/jsencrypt2.js Normal file

File diff suppressed because it is too large Load Diff

101
utils/request.js Normal file
View File

@@ -0,0 +1,101 @@
// import qs from 'qs' // 处理data
import store from '@/vuex/store'
const request = (params) => {
let _self = this;
let url = params.url;
let method = params.method || 'POST';
let data = params.data || {};
// data.token = "default-access_token"
// if (!params.token) {
// let token = uni.getStorageSync('token');
// if (!token) {
// uni.navigateTo({
// url: '/pages/login/login'
// });
// } else {
// data.token = '179509245-9c91827e0224bdc18d0b118b8be1b5af';
// }
// }
let defaultOpot = {
// 'Content-Type': 'application/x-www-form-urlencoded',
'Terminal-Type': 'innerH5',
'Content-Type': 'application/json;charset=UTF-8',
}
let header = {}
method = method.toUpperCase()
if (method == 'POST') {
header = {
'Content-Type': 'application/json;charset=UTF-8',
}
// data = qs.stringify(data)
}
const requestUrl = `${store.getters.baseUrl}/` + url;
uni.showLoading({
title: '加载中...'
});
return new Promise((resolve, reject) => {
uni.request({
url: requestUrl,
method: method,
header: Object.assign({}, defaultOpot, header),
data: data,
dataType: 'json',
})
.then(res => { // 成功
if (res[1] && res[1].statusCode === 200) {
let {
data: dataType
} = res[1]
resolve(dataType)
// switch (dataType.code * 1) { // 拦截返回参数
// case 0:
// resolve(dataType)
// break;
// case 1003:
// uni.showModal({
// title: '登录已过期',
// content: '很抱歉,登录已过期,请重新登录',
// confirmText: '重新登录',
// success: function(res) {
// if (res.confirm) {
// uni.navigateTo({
// // 切记这儿需要哈pages.json保持一致不能有.vue后缀
// url: '/pages/login/login'
// });
// } else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// })
// break;
// case -1:
// uni.showModal({
// title: '请求数据失败',
// content: '获取数据失败!',
// confirmText: '确定',
// showCancel: false,
// success: function(res) {
// if (res.confirm) {} else if (res.cancel) {
// console.log('用户点击取消');
// }
// }
// })
// break
// }
}else {
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject(res[1].data.error)
}
})
.catch(err => { // 错误
reject(err)
})
.finally(() => {
uni.hideLoading();
})
})
}
export default request