From dc46a242306048ac558c287cdf8d421399cb4fdd Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期二, 21 三月 2023 11:11:39 +0800 Subject: [PATCH] code码调整 --- pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue | 5 api/publicInterface.js | 3 pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue | 74 ++++++++++++++++-- pages/login/userPassword.vue | 2 pages/driver-page/appointment/appointment.vue | 8 + pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue | 42 ++++++++++ api/request.js | 10 +- pages/register/register.vue | 14 --- pages.json | 11 ++ pages/customer-page/customer-index/customer-index.vue | 15 +-- pages/customer-page/customer-my/customer-my.vue | 8 + pages/driver-page/driver-index/driver-index.vue | 4 12 files changed, 146 insertions(+), 50 deletions(-) diff --git a/api/publicInterface.js b/api/publicInterface.js index 4e5801f..1e0c7bd 100644 --- a/api/publicInterface.js +++ b/api/publicInterface.js @@ -3,7 +3,8 @@ // const BaseUrl = "http://192.168.3.159:9999/"; import {BaseUrl as wrBaseUrl} from '@/api/request.js' -const BaseUrl = "http://192.168.0.120:9999" +// const BaseUrl = "http://192.168.0.120:9999" +const BaseUrl = "http://192.168.0.130:9999" // 鐧诲綍 // function apiLogin({ diff --git a/api/request.js b/api/request.js index 8d6d256..31b67e2 100644 --- a/api/request.js +++ b/api/request.js @@ -78,9 +78,10 @@ 500: responseError } -// const BaseUrl = "http://192.168.3.159:9999/"; -// const BaseUrl = "http://192.168.0.120:9997"; -const BaseUrl = "http://192.168.0.120:9997"; +// const BaseUrl = "http://192.168.0.120:9997" +// const webSocketUrl = "ws://192.168.0.120:9997/wrzs/ws/info" +const BaseUrl = "http://192.168.0.130:9997"; +const webSocketUrl = "ws://192.168.0.130:9997/wrzs/ws/info" // 璇锋眰鎷︽埅 const fetch = (url, opt) => { @@ -146,5 +147,6 @@ export { fetch, - BaseUrl + BaseUrl, + webSocketUrl } diff --git a/pages.json b/pages.json index b69ae57..576bbbe 100644 --- a/pages.json +++ b/pages.json @@ -148,7 +148,16 @@ } } - ], + ,{ + "path" : "pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + + } + ], "tabBar": { // "color": "#999794", // "selectedColor": "#007AFF", diff --git a/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue b/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue index c039c5b..8ee16d4 100644 --- a/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue +++ b/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue @@ -74,9 +74,8 @@ }); }, 1000); } else { - this.$u.toast(res.msg ? res.msg : '鏈垚鍔熸坊鍔�'); + this.$u.toast(res.data ? res.data : '鏈垚鍔熸坊鍔�'); } - console.log('閭�璇疯揣浠�', res); }); }, // 閭�璇峰徃鏈� @@ -90,7 +89,7 @@ }); } else { uni.showToast({ - title: res.msg, + title: res.data, icon: 'null', duration: 2000 }); diff --git a/pages/customer-page/customer-index/customer-index.vue b/pages/customer-page/customer-index/customer-index.vue index 5b11efb..3fb5769 100644 --- a/pages/customer-page/customer-index/customer-index.vue +++ b/pages/customer-page/customer-index/customer-index.vue @@ -61,7 +61,6 @@ <script> import card from '@/components/card/card.vue'; import { customerId } from '@/utils/status'; -// import colorGradient from '@/uni_modules/uview-ui/libs/function/colorGradient'; import { todayDate } from '@/utils/util.js'; export default { components: { @@ -80,7 +79,6 @@ }, onShow() { this.init(); - console.log(todayDate, '鑾峰彇浠婂ぉ鐨勬棩鏈�'); }, methods: { init() { @@ -96,10 +94,6 @@ uni.hideLoading(); }); }, - // 棰嗗彇鐐瑰嚮 - // numInput(id) { - - // }, popupDetermineClick() { if (this.receiveNum) { this.getOrderNum.num = this.receiveNum; @@ -116,6 +110,8 @@ icon: 'none', duration: 1000 }); + } else { + this.$u.toast(res.data ? res.data : '棰嗗彇澶辫触'); } }); } else { @@ -128,17 +124,14 @@ }, /** * @瀹㈡埛棰嗗彇 + * 棰嗗彇寮规 */ receiveClick(item) { this.show = true; - this.getOrderNum.id = item.id; // 鑾峰彇棰嗗彇鎻愮叅鍗曠殑id }, - open() { - console.log('鎵撳紑浜�'); - }, + open() {}, close() { - console.log('鍏抽棴鏂规硶'); this.show = false; this.receiveNum = null; }, diff --git a/pages/customer-page/customer-my/customer-my.vue b/pages/customer-page/customer-my/customer-my.vue index 39a651b..04a2b1b 100644 --- a/pages/customer-page/customer-my/customer-my.vue +++ b/pages/customer-page/customer-my/customer-my.vue @@ -177,8 +177,12 @@ // 鏂板缓杞﹂槦 this.$reqPost('saveFleet', this.addGroupForm, 'params').then(res => { uni.hideLoading(); - console.log('鏂板缓杞﹂槦', res); - this.getFleet(); + if (res.code == 0) { + this.$u.toast('娣诲姞鎴愬姛'); + this.getFleet(); + } else { + this.$u.toast(res.data ? res.data : '娣诲姞澶辫触'); + } }); this.updateGroupShow = false; }, diff --git a/pages/driver-page/appointment/appointment.vue b/pages/driver-page/appointment/appointment.vue index 80923af..71c7c3e 100644 --- a/pages/driver-page/appointment/appointment.vue +++ b/pages/driver-page/appointment/appointment.vue @@ -1,6 +1,6 @@ <template> <view class="appointment"> - <combined-title :title="yuYueData.length != 0?yuYueData[0].filedName + '鈥斺��' + yuYueData[0].sendDate:'鏆傛棤棰勭害鍒楄〃'"></combined-title> + <combined-title :title="yuYueData.length != 0 ? yuYueData[0].filedName + '鈥斺��' + yuYueData[0].sendDate : '鏆傛棤棰勭害鍒楄〃'"></combined-title> <view class="appointment-table"> <uni-table border stripe emptyText="鏆傛棤鏇村鏁版嵁"> <uni-tr> @@ -34,9 +34,9 @@ deptId: '', sendDate: '' }, - yuYuePostParams:{ + yuYuePostParams: { takeCoalId: null, - yuYueId: null, + yuYueId: null }, yuYueData: [], isRCSQ: false, // 鍏ュ満鐢宠鎺ュ彛鎺у埗 @@ -95,6 +95,8 @@ this.$reqPost('yuYue', { takeCoalId: this.yuYuePostParams.takeCoalId, yuYueId: this.yuYuePostParams.yuYueId }, 'params').then(res => { if (res.code == 0) { this.$u.toast('棰勭害鎴愬姛锛�'); + } else { + this.$u.toast(res.data ? res.data : '棰勭害澶辫触'); } setTimeout(() => { this.yuYueList(); diff --git a/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue b/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue new file mode 100644 index 0000000..6da7f10 --- /dev/null +++ b/pages/driver-page/driver-index/bill-of-lading-details/punchTheClock/punchTheClock.vue @@ -0,0 +1,42 @@ +<template> + <!-- 鎵撳崱 --> + <view class="punchTheClock"> + <!-- 鎵撳崱鎸夐挳 --> + <view class="punchTheClock_container"> + <view class="punchTheClock_btn">绛惧埌/鎵撳崱</view> + <view class="punchTheClock_text"><text>鏈繘鍏ヨ�冨嫟鍖哄煙</text></view> + </view> + </view> +</template> + +<script> +export default { + data() { + return {}; + }, + methods: {} +}; +</script> + +<style lang="scss" scoped> +.punchTheClock{ + display:flex; + justify-content: center; + align-items: center; + .punchTheClock_container{ + .punchTheClock_btn{ + width:vww(240); + height:vww(240); + border-radius: 50%; + background-color: #ffd63e; + display:flex; + justify-content: center; + align-items: center; + } + .punchTheClock_text{ + + } + } + +} +</style> diff --git a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue index 060f670..11f6dac 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue @@ -4,9 +4,18 @@ <view class="top"> <view class="top_left"><text>41.5</text></view> <view class="top_right"> - <view class="">绉伴噸: <u--text type="success" text="姝e父" size="34"></u--text></view> - <view class="">绾㈠: <u--text type="success" text="姝e父" size="34"></u--text></view> - <view class="">闆疯揪: <u--text type="success" text="姝e父" size="34"></u--text></view> + <view class=""> + 绉伴噸: + <u--text type="success" text="姝e父" size="34"></u--text> + </view> + <view class=""> + 绾㈠: + <u--text type="success" text="姝e父" size="34"></u--text> + </view> + <view class=""> + 闆疯揪: + <u--text type="success" text="姝e父" size="34"></u--text> + </view> </view> </view> <view class="bottom"><text>TIP:褰撳墠鐘舵�佹甯稿彲浠ョО閲�</text></view> @@ -29,6 +38,8 @@ </template> <script> +let socket = null; +import { webSocketUrl } from '@/api/request.js'; export default { onLoad(params) { console.log('绉伴噸椤甸潰', params); @@ -37,11 +48,28 @@ data() { return { takeCoalId: null, - weighList: {} + weighList: {}, + webSocket: null // webSocket瀹炰緥 + // lockReconnect: false, // 閲嶈繛閿侊紝閬垮厤澶氭閲嶈繛 + // maxReconnect: 6, // 鏈�澶ч噸杩炴鏁帮紝 -1 鏍囪瘑鏃犻檺閲嶈繛 + // reconnectTime: 0, // 閲嶈繛灏濊瘯娆℃暟 + // heartbeat: { + // interval: 30 * 1000, // 蹇冭烦闂撮殧鏃堕棿 + // timeout: 10 * 1000, // 鍝嶅簲瓒呮椂鏃堕棿 + // pingTimeoutObj: null, // 寤舵椂鍙戦�佸績璺崇殑瀹氭椂鍣� + // pongTimeoutObj: null, // 鎺ユ敹蹇冭烦鍝嶅簲鐨勫畾鏃跺櫒 + // pingMessage: JSON.stringify({ type: 'ping' }) // 蹇冭烦璇锋眰淇℃伅 + // } }; }, onShow() { this.init(); + this.initWebSocket(); + }, + computed: { + token() { + return uni.getStorageSync('token'); + } }, methods: { init() { @@ -55,11 +83,39 @@ }, /** * @纭绉伴噸绛夊緟鍚庣鎻愪緵瀹炴椂绉伴噸鎺ュ彛锛岃幏鍙栫毊閲嶏紝姣涢噸 - */ - confirmWeigh(){ + */ + confirmWeigh() { // this.$reqPost('saveWeigh',{id:this.takeCoalId,skin:'',hair:''}).then(res=>{ // console.log(res,"纭绉伴噸"); // }) + }, + /** + * 鍒濆鍖� weoSocket + */ + initWebSocket() { + // let wsUrl = `wss://192.168.0.120:9997/wrzs/ws/info?access_token=${this.token}`; + let wsUrl = `${webSocketUrl}?access_token=c954c7f5-f34b-453e-8c9d-e291747b401f`; + socket = uni.connectSocket({ + url: wsUrl, + header: { + CLIENT_TOC: 'Y' + }, + complete: res => { + console.log(res, 'socket缁撴灉'); + } + }); + socket.onOpen(() => { + console.log('onOpen'); + }); + socket.onMessage(res => { + console.log(res, '鏈嶅姟鍣ㄨ繑鍥炵殑鏁版嵁'); + }); // 鑾峰彇鏈嶅姟鍣ㄤ紶鏉ョ殑鏁版嵁锛屽仛鐩稿簲澶勭悊 + socket.onClose(() => { + console.log('close'); + }); + socket.onError(err => { + console.log('socket鎶ラ敊', err); + }); } } }; @@ -82,16 +138,16 @@ .top_left { flex: 3; font-size: vww(50); - display:flex; + display: flex; align-items: center; justify-content: center; } .top_right { - display:flex; + display: flex; flex-direction: column; justify-content: center; flex: 2; - view{ + view { display: flex; } } diff --git a/pages/driver-page/driver-index/driver-index.vue b/pages/driver-page/driver-index/driver-index.vue index a0867bd..e90e112 100644 --- a/pages/driver-page/driver-index/driver-index.vue +++ b/pages/driver-page/driver-index/driver-index.vue @@ -162,12 +162,12 @@ }, // 鎶㈠崟璇锋眰 qiangDan(id) { - // this.$reqPost('qiangDan', { orderPlanId: id, wxUserId: customerId }, 'params').then(res => { this.$reqPost('qiangDan', { orderPlanId: id }, 'params').then(res => { if (res.code == 0) { this.$u.toast('鎶㈠崟鎴愬姛'); + } else { + this.$u.toast(res.data ? res.data : '鎶㈠崟澶辫触'); } - console.log('鎶㈠崟', res); this.qiangDanList(); }); }, diff --git a/pages/login/userPassword.vue b/pages/login/userPassword.vue index 51b35b9..2fa9899 100644 --- a/pages/login/userPassword.vue +++ b/pages/login/userPassword.vue @@ -43,7 +43,7 @@ }, data() { return { - username: '18804050607',// 瀹㈡埛 + username: 'appuser',// 瀹㈡埛 // username: '18805080506',// 鐜嬫锛堝徃鏈猴級 password: '123456', remember: true, diff --git a/pages/register/register.vue b/pages/register/register.vue index f15f3bf..5767e42 100644 --- a/pages/register/register.vue +++ b/pages/register/register.vue @@ -1,6 +1,5 @@ <template> <view class="register"> - <!-- <home-species title="娉ㄥ唽"></home-species> --> <view class="registerForm"> <u--form :rules="rules" :model="registerFormModel" ref="regesterFormRef"> <u-form-item labelWidth="20%" label="閫夋嫨韬唤" borderBottom ref="roleRef" required> @@ -58,7 +57,6 @@ </template> <script> -// import HomeSpecies from '@/components/home-species/HomeSpecies.vue'; import { apiRegister } from '@/api/publicInterface.js'; import { BaseUrl } from '@/api/publicInterface.js'; export default { @@ -77,9 +75,6 @@ // } // }) // }, - components: { - // HomeSpecies - }, // 鐩戝惉椤甸潰鍒濇娓叉煋瀹屾垚銆傛敞鎰忓鏋滄覆鏌撻�熷害蹇紝浼氬湪椤甸潰杩涘叆鍔ㄧ敾瀹屾垚鍓嶈Е鍙� onReady() { // this.$refs.regesterFormRef.setRules(this.rules); @@ -236,7 +231,6 @@ this.registerFormModel.username = this.registerFormModel.phone; apiRegister(this.registerFormModel) .then(res => { - console.log(res); if (res.data.code == 0) { uni.showToast({ title: '娉ㄥ唽鎴愬姛,鍗冲皢杩涘叆鐧诲綍锛�', @@ -247,7 +241,7 @@ uni.redirectTo({ url: '/pages/login/login' }); }, 1000); } else { - this.$u.toast(res.data.msg); + this.$u.toast(res.data.data?res.data.data:'娣诲姞澶辫触'); } }) .catch(err => { @@ -262,12 +256,6 @@ this.$u.toast('涓ゆ瀵嗙爜涓嶄竴鑷�'); } }, - // 闊宠棰戦�氳瘽 - // callingIn() { - // uni.navigateTo({ - // url: '/pages/calling-index/calling-index' - // }); - // }, // 鍗曢�夋浜嬩欢 groupChange(e) { console.log('鍗曢�夋灏忕粍', e); -- Gitblit v1.9.1