From 67271e43ba60ea115e0e92d9639ecb5a50e59e2c Mon Sep 17 00:00:00 2001 From: whycq <913841844@qq.com> Date: 星期一, 16 十月 2023 21:33:30 +0800 Subject: [PATCH] # --- components/z-input/z-input.vue | 9 +- pages/api/addMat.js | 14 +-- pages/home/home.vue | 2 pages/project/project.json | 9 ++ pages/LoginDemo/LoginDemo.vue | 1 pages/component/demo.vue | 2 pages/project/pakin/pakin.vue | 169 +++++++++++++++++++++++++++++++++++++++++- store/index.js | 7 - 8 files changed, 185 insertions(+), 28 deletions(-) diff --git a/components/z-input/z-input.vue b/components/z-input/z-input.vue index 7ed0848..8d94627 100644 --- a/components/z-input/z-input.vue +++ b/components/z-input/z-input.vue @@ -119,9 +119,8 @@ display: flex; align-items: center; min-height: 35px; - background-color: #FFF; + background-color: #f8f8f8; margin: 8px; - /* border-bottom: 1px solid darkgray; */ } .put { display: flex; @@ -129,14 +128,14 @@ } .inner1 { - width: 65px; + width: 55px; padding-left: 8px; color: #606164; font-weight: 900; font-family:'Helvetica Neue'; } .inner2 { - background-color: #f1f3f4; + background-color: #FFF; flex: 1; display: flex; align-items: center; @@ -146,7 +145,7 @@ } .p-input { flex:1; - padding-left: 8px; + padding: 4px; } .p-icon { margin-left: 8px; diff --git a/pages/LoginDemo/LoginDemo.vue b/pages/LoginDemo/LoginDemo.vue index 590a03f..7eb0309 100644 --- a/pages/LoginDemo/LoginDemo.vue +++ b/pages/LoginDemo/LoginDemo.vue @@ -103,7 +103,6 @@ this.$refs.settings.open() }, cancel() { - console.log(uni.getStorageSync('Network')); this.$refs.settings.close() }, confirm() { diff --git a/pages/api/addMat.js b/pages/api/addMat.js index bc6b2ff..9a82460 100644 --- a/pages/api/addMat.js +++ b/pages/api/addMat.js @@ -1,7 +1,9 @@ -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://192.168.4.188:8089/bfwms/mat/auth', + url: `${baseUrl}/mat/auth`, data: {matnr: '3CPPJ.B.GMB.LZ.QBY4-10/15P316LLZ'}, }).then((result)=> { let mat = result.data.data @@ -18,14 +20,6 @@ return item } -function isEmpty(obj) { - if (JSON.stringify(obj) === '{}') { - return true - } - return obj == "undefined" || obj == null || obj === "" || obj == {}; -} - module.exports = { addMat: addMat, - isEmpty: isEmpty } \ No newline at end of file diff --git a/pages/component/demo.vue b/pages/component/demo.vue index ce9bbd7..f4e6e87 100644 --- a/pages/component/demo.vue +++ b/pages/component/demo.vue @@ -37,7 +37,7 @@ </template> <script> - import addMat, { isEmpty } from '../api/addMat.js' + import addMat from '../api/addMat.js' export default { data() { return { diff --git a/pages/home/home.vue b/pages/home/home.vue index 18c0f84..f89fbf0 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -3,7 +3,7 @@ <scroll-view scroll-y class="page"> <view class="nav-list"> <navigator hover-class='none' class="nav-li" navigateTo - :url="'/pages' + item.url" + :url="'/pages/project' + item.url" :class="'bg-'+item.color" :style="[{animation: 'show ' + ((index+1)*0.2+1) + 's 1',width: item.width}]" v-for="(item,index) in menu" diff --git a/pages/project/pakin/pakin.vue b/pages/project/pakin/pakin.vue index ddc6279..e07fa62 100644 --- a/pages/project/pakin/pakin.vue +++ b/pages/project/pakin/pakin.vue @@ -1,24 +1,185 @@ <template> <view> + <view class="head"> + <z-input v-for="it in page" + :desc="it.title" + :name="it.name" + :btn="it.btn" + :btn-name="it.btnName" + v-model="it.val" + :index="it.id" + :lenCheck="it.lenCheck" + :focus="it.focus" + @inputVal='input2' + ></z-input> + </view> + + <u-sticky > + <view class="sticky">鍟嗗搧鍒楄〃</view> + </u-sticky> + + <z-data-list class="data-list" + v-for="(it,i) in zDataList" + :key="i" + :list="it.detl" + :index="i+1" + @goDetail='goDetail(it.detl,i)' + ></z-data-list> + + <!-- 鍨珮 --> + <view style="height: 100rpx;"></view> </view> </template> <script> import { mapState } from 'vuex' + import addMat from '@/pages/api/addMat.js' export default { data() { - return {} + return { + zDataList: [ + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 1}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 2}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 3}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 4}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 5}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 1}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 2}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 3}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�5.2x25'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 4}, + ] + }, + { + detl: [ + {key: '鍟嗗搧鐮�',value: 'LSH90152025',valText: 'val-text'}, + {key: '鍟嗗搧鍚嶇О',value: '灏奸緳澶达紙鐏扮櫧锛�'}, + {key: '瑙勬牸',value: '700*699*80'}, + {key: '鎵瑰彿',value: '20231007204944',type: 'input'}, + {key: '鏁伴噺',value: 951326478,type: 'number-box',valText: 'val-num'}, + {key: '搴忓彿',value: 5}, + ] + } + ], + list: [ + {} + ] + } }, onShow() { console.log(this.page); }, computed: mapState({ - page: state => state.project.menu - }) + page: state => state.project.menu[0].page.input + }), + methods: { + input2(arr) { + if(arr[1] == 'matnr') { + this.getMat(arr[0]) + } + }, + async getMat(matnr) { + let mat = await addMat.addMat() + if (!addMat.isEmpty(mat)) { + this.zDataList.push(mat) + } + }, + } } </script> <style> - + .head { + background-color: #f8f8f8; + margin-top: -8px; + } + .sticky { + height: 70rpx; + margin-top: -8px; + text-align: center; + background-color: #f8f8f8; + display: flex; + align-items: center; + justify-content: center; + } </style> + diff --git a/pages/project/project.json b/pages/project/project.json index a2db84b..2196470 100644 --- a/pages/project/project.json +++ b/pages/project/project.json @@ -10,7 +10,14 @@ "cuIcon": "pullup", "width": "90%", "sort": 1, - "page": 0 + "page": { + "input": [ + {"id":1,"name": "barcode","title": "鎵樼洏鐮�","val": "2","lenCheck": 8,"focus": true}, + {"id":2,"name": "matnr","title": "鐗╂枡鐮�","val": "2","btn": true,"btnName": "鎻愬彇","focus": true} + ], + "list": {} + + } }, { "title": "璁㈠崟缁勬墭", diff --git a/store/index.js b/store/index.js index 4b54b5a..2c5abb9 100644 --- a/store/index.js +++ b/store/index.js @@ -3,13 +3,10 @@ import Vuex from 'vuex' import project from '@/pages/project/project' -Vue.use(Vuex);//vue鐨勬彃浠舵満鍒� +Vue.use(Vuex); -//Vuex.Store 鏋勯�犲櫒閫夐」 const store = new Vuex.Store({ - state:{//瀛樻斁鐘舵�� - "username":"foo", - "age":18, + state:{ "homeList": [ { name: '鍏ュ簱', -- Gitblit v1.9.1