From f272d94fbc6021869eb83b4a756b0927d31cac5c Mon Sep 17 00:00:00 2001 From: whycq <10027870+whycq@user.noreply.gitee.com> Date: 星期一, 13 十一月 2023 08:08:29 +0800 Subject: [PATCH] # --- pages/api/addMat.js | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/pages/api/addMat.js b/pages/api/addMat.js index 31055b8..b573c20 100644 --- a/pages/api/addMat.js +++ b/pages/api/addMat.js @@ -1,27 +1,28 @@ -async function addMat() { +let network = uni.getStorageSync('Network') +let baseUrl = `http://${network[0].ip}:${network[0].port}/${network[0].address}` +async function addMat(matnr) { let that = this,item = {}; var ress = await uni.request({ - url: 'http://127.0.0.1:8089/bfwms/mat/auth', - data: {matnr: '3CPPJ.B.GMB.LZ.QBY4-10/15P316LLZ'}, + url: `${baseUrl}/mat/auth`, + header: {'token': uni.getStorageSync('token')}, + data: {matnr: matnr}, }).then((result)=> { let mat = result.data.data - item['detl'] = [ - {key: '鍟嗗搧鐮�',value: mat.matnr}, - {key: '鍟嗗搧鍚嶇О',value: mat.maktx}, - {key: '瑙勬牸',value: mat.specs}, - {key: '鏁伴噺',value: 100}, - ] + item = mat + console.log(mat); + // item['detl'] = [ + // {key: '鍟嗗搧鐮�',value: mat.matnr}, + // {key: '鍟嗗搧鍚嶇О',value: mat.maktx}, + // {key: '瑙勬牸',value: mat.specs}, + // {key: '鎵瑰彿',value: '',type: 'input'}, + // {key: '鏁伴噺',value: 0,type: 'number-box',valText: 'val-num'}, + // ] },(res)=>{ console.log(res); }) return item } -function isEmpty(obj) { - return typeof obj == "undefined" || obj == null || obj === ""; -} - module.exports = { addMat: addMat, - isEmpty: isEmpty } \ No newline at end of file -- Gitblit v1.9.1