From 1ab29b3567574a721bd37d5ff9d7e9db386272d6 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期四, 16 三月 2023 17:08:44 +0800 Subject: [PATCH] thirdCommit --- pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue | 78 ++++ pages/public-page/forward/forward.vue | 6 api/publicInterface.js | 147 +++++---- pages/login/userPassword.vue | 67 +++- pages/driver-page/drvier-my/drvier-my.vue | 159 +++++++--- pages/login/login.vue | 56 +++ pages/login/wxLogin.vue | 39 ++ pages/register/register.vue | 179 ++++++----- pages.json | 41 +- pages/customer-page/customer-index/customer-index.vue | 10 pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue | 3 pages/customer-page/customer-my/customer-my.vue | 24 pages/driver-page/driver-index/driver-index.vue | 31 + store/index.js | 2 pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue | 10 pages/driver-page/appointment/appointment.vue | 24 + api/globalApi.js | 6 manifest.json | 2 pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue | 9 19 files changed, 599 insertions(+), 294 deletions(-) diff --git a/api/globalApi.js b/api/globalApi.js index 9c2afe4..4dbc45f 100644 --- a/api/globalApi.js +++ b/api/globalApi.js @@ -1,4 +1,10 @@ export const globalApi = { + // 缁戝畾寰俊 + wxBind:{ + url:'/wrzs/social/bind', + method:"POST" + }, + // 鎻愮叅鍗� // 鑾峰彇鍙戣繍璁″垝鍒楄〃 GetOrderPlan: { diff --git a/api/publicInterface.js b/api/publicInterface.js index 54e06bf..4e5801f 100644 --- a/api/publicInterface.js +++ b/api/publicInterface.js @@ -3,77 +3,46 @@ // 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" // 鐧诲綍 -function apiLogin({ - code -}) { - uni.showLoading({ - title: '鐧诲綍涓�...', - }) - return new Promise((resolve, reject) => { - uni.request({ - url: BaseUrl + "/wrzs/wx/login", - method: "POST", - data: { - code - }, - header: { - // "TENANT-ID": "5", - // "Authorization": "Basic cGlnOnBpZw==", - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: (res) => { - uni.hideLoading(); - // console.log(res) - resolve(res.data); - }, - fail: (err) => { - console.log('閿欒', err); - uni.hideLoading(); - uni.showToast({ - icon: 'none', - title: '鏈嶅姟鍣ㄩ敊璇�' - }) - } - }) - }) -} +// function apiLogin({ +// code +// }) { +// uni.showLoading({ +// title: '鐧诲綍涓�...', +// }) +// return new Promise((resolve, reject) => { +// uni.request({ +// url: BaseUrl + "/wrzs/wx/login", +// method: "POST", +// data: { +// code +// }, +// header: { +// // "TENANT-ID": "5", +// // "Authorization": "Basic cGlnOnBpZw==", +// 'Content-Type': 'application/x-www-form-urlencoded' +// }, +// success: (res) => { +// uni.hideLoading(); +// // console.log(res) +// resolve(res.data); +// }, +// fail: (err) => { +// console.log('閿欒', err); +// uni.hideLoading(); +// uni.showToast({ +// icon: 'none', +// title: '鏈嶅姟鍣ㄩ敊璇�' +// }) +// } +// }) +// }) +// } -function apiLogin2({ - code -}) { - uni.showLoading({ - title: '鍔犺浇涓�...' - }) - return new Promise((resolve, reject) => { - uni.request({ - url: BaseUrl + "/wrzs/wx/login2", - method: "POST", - data: { - code - }, - header: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - success: (res) => { - uni.hideLoading(); - resolve(res.data) - }, - fail: (err) => { - console.log('閿欒', err); - uni.hideLoading(); - uni.showToast({ - icon: 'none', - title: '鏈嶅姟鍣ㄩ敊璇�' - }) - } - }) - }) -} + // 娉ㄥ唽 @@ -130,6 +99,7 @@ }) } + // 鑾峰彇token function apiLoginPassword({ username, @@ -170,6 +140,45 @@ } +// 寰俊灏忕▼搴忎竴閿櫥褰� +function apiLoginWx({ + code +}) { + uni.showLoading({ + title: '鍔犺浇涓�...' + }) + return new Promise((resolve, reject) => { + uni.request({ + url: BaseUrl + '/admin/oauth2/token', + method: "POST", + data: { + grant_type:'mobile', + mobile:`MINI@${code}`, + code + }, + header: { + "Authorization": 'Basic c29jaWFsOnNvY2lhbA==', //app:app + 'content-type': 'application/x-www-form-urlencoded', + "CLIENT_TOC": "Y", + "isToken": "false" + }, + success: (res) => { + uni.hideLoading(); + resolve(res.data) + }, + fail: (err) => { + console.log('閿欒', err); + uni.hideLoading(); + uni.showToast({ + icon: 'none', + title: '鏈嶅姟鍣ㄩ敊璇�' + }) + } + }) + }) +} + + // 鑾峰彇娴佺▼鏁版嵁 // export const getProcessDataList = (params) => { @@ -178,8 +187,8 @@ export { - apiLogin, - apiLogin2, + apiLoginWx, apiRegister, - apiLoginPassword + apiLoginPassword, + BaseUrl } diff --git a/manifest.json b/manifest.json index 08c67fe..c97e162 100644 --- a/manifest.json +++ b/manifest.json @@ -50,7 +50,7 @@ "quickapp" : {}, /* 灏忕▼搴忕壒鏈夌浉鍏� */ "mp-weixin" : { - "appid" : "wx30f254cbb0b90b3c", + "appid" : "wx4a62fc1684c429a9", "setting" : { "urlCheck" : false, "es6" : true, diff --git a/pages.json b/pages.json index 5cbe4f4..b69ae57 100644 --- a/pages.json +++ b/pages.json @@ -126,26 +126,29 @@ "enablePullDownRefresh": false } + }, { + "path": "pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill", + "style": { + "navigationBarTitleText": "鎻愮叅鍗�", + "enablePullDownRefresh": false + } + + }, { + "path": "pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice", + "style": { + "navigationBarTitleText": "绉伴噸", + "enablePullDownRefresh": false + } + + }, { + "path": "pages/login/wxLogin", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false + } + } - ,{ - "path" : "pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill", - "style" : - { - "navigationBarTitleText": "鎻愮叅鍗�", - "enablePullDownRefresh": false - } - - } - ,{ - "path" : "pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice", - "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 ab4c21c..f4379b0 100644 --- a/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue +++ b/pages/customer-page/addTo-freightForwarder-driver/addTo-freightForwarder-driver.vue @@ -63,16 +63,18 @@ } }, // 閭�璇疯揣浠� - bindHuoDai() { + bindHuoDai() { // this.$reqPost('bindHuoDai', { customerId: this.customerId, name: this.name, phone: this.phone }, 'params').then(res => { - this.$reqPost('bindHuoDai', { name: this.name, phone: this.phone }).then(res => { + this.$reqPost('bindHuoDai', { name: this.name, phone: this.phone }, 'params').then(res => { if (res.code == 0) { - this.$u.toast(res.msg ? res.msg : res.data); + this.$u.toast('娣诲姞鎴愬姛'); setTimeout(() => { uni.navigateBack({ delta: 1 }); }, 1000); + } else { + this.$u.toast(res.msg ? res.msg : '鏈垚鍔熸坊鍔�'); } console.log('閭�璇疯揣浠�', res); }); @@ -82,7 +84,7 @@ this.$reqPost('bindUserFleet', { fleetId: this.fleetId, name: this.name, phone: this.phone, carNo: this.carNo }, 'params').then(res => { console.log('閭�璇峰徃鏈�', res); if (res.code == 0) { - this.$u.toast(res.data?res.data:'鎿嶄綔鎴愬姛'); + this.$u.toast(res.data ? res.data : '鎿嶄綔鎴愬姛'); uni.navigateBack({ delta: 1 }); diff --git a/pages/customer-page/customer-index/customer-index.vue b/pages/customer-page/customer-index/customer-index.vue index 0c403a4..a90caf0 100644 --- a/pages/customer-page/customer-index/customer-index.vue +++ b/pages/customer-page/customer-index/customer-index.vue @@ -1,6 +1,7 @@ <template> <view class="customer-index"> <view class="customer-index-body"> + <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" textSize="30" iconSize="1000" v-if="orderPlanData.length == 0"></u-empty> <card v-for="(item, index) in orderPlanData" :key="index" :name="item.id" @click="cardBodyClick"> <template v-slot:left> <view class="card-left__top"> @@ -86,11 +87,12 @@ }, // 鑾峰彇鍙戣繍璁″垝鍒楄〃 GetOrderPlan() { - // this.$reqGet('GetOrderPlan', { customerId: customerId }).then(res => { - // this.orderPlanData = res.data; - // }); + uni.showLoading({ + title: '鍔犺浇涓�...' + }); this.$reqGet('GetOrderPlan').then(res => { this.orderPlanData = res.data; + uni.hideLoading() }); }, // 棰嗗彇鐐瑰嚮 @@ -152,7 +154,7 @@ // 杞彂 forwardClick(obj) { uni.navigateTo({ - url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNum=${obj.carNum}` + url: `/pages/public-page/forward/forward?orderPlanId=${obj.id}&carNum=${obj.cars2}` }); } } diff --git a/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue b/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue index 95f1ba0..9d73963 100644 --- a/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue +++ b/pages/customer-page/customer-index/fayunPlanDetails/fayunPlanDetails.vue @@ -42,6 +42,9 @@ orderPlanDetail: {} }; }, + onShow(){ + this.init(); + }, methods: { init() { this.GetOrderPlanDetail(); diff --git a/pages/customer-page/customer-my/customer-my.vue b/pages/customer-page/customer-my/customer-my.vue index 67fdd6b..69316dc 100644 --- a/pages/customer-page/customer-my/customer-my.vue +++ b/pages/customer-page/customer-my/customer-my.vue @@ -9,7 +9,7 @@ <view class="huodai-list"> <u-swipe-action> <u-cell-group :border="false"> - <u-swipe-action-item :options="options1" v-for="(item, index) in huoDaiData" :index="index" :name="item.id" :key="index" @click="deleteHuoDaiClick"> + <u-swipe-action-item :options="options1" v-for="(item, index) in huoDaiData" :index="index" :name="item.userId" :key="index" @click="deleteHuoDaiClick"> <u-cell :title="item.name" value="璇︽儏" @click="toFreightForwarderDetails(item.id)"></u-cell> </u-swipe-action-item> </u-cell-group> @@ -26,7 +26,7 @@ <u-swipe-action> <u-cell-group :border="false"> <u-swipe-action-item :options="options1" v-for="(item, index) in fleetData" :index="index" :name="item.id" :key="index" @click="deleteFleetClick"> - <u-cell :title="item.name" value="25杈�" @click="tofleetDetails(item.id)"></u-cell> + <u-cell :title="item.name" :value="item.userSijisum + '杈�'" @click="tofleetDetails(item.id)"></u-cell> </u-swipe-action-item> </u-cell-group> </u-swipe-action> @@ -90,7 +90,7 @@ <script> import combinedTitle from '@/components/combined-title/combined-title.vue'; -import { customerId ,redirectLogin} from '@/utils/status'; +import { customerId, redirectLogin } from '@/utils/status'; export default { components: { combinedTitle @@ -140,7 +140,7 @@ }, // 鑾峰彇璐т唬鍒楄〃 getAllHuoDaiByCustomerId() { - this.$reqGet('getAllHuoDaiByCustomerId', { customerId }).then(res => { + this.$reqGet('getAllHuoDaiByCustomerId').then(res => { this.huoDaiData = res.data; console.log('璐т唬鍒楄〃', res); }); @@ -184,12 +184,12 @@ }, // 鍒犻櫎璐т唬 deleteHuoDaiClick(args) { - console.log(args.name, '璐т唬id'); + console.log(args, '璐т唬id'); this.deleteHuoDaiId = args.name; this.deleteHuoDaiShow = true; this.huoDaiData.forEach(item => { - if (item.id == this.deleteHuoDaiId) { - this.deleteHuoDaiContent = '纭鍒犻櫎璐т唬' + item.huoDaiName; + if (item.userId == this.deleteHuoDaiId) { + this.deleteHuoDaiContent = '纭鍒犻櫎璐т唬' + item.name + '鍚楋紵'; } }); }, @@ -207,9 +207,13 @@ this.$reqPost('deleteHuoDai', { id: this.deleteHuoDaiId }, 'params').then(res => { uni.hideLoading(); if (res.code == 0) { - this.$u.toast('鍒犻櫎鎴愬姛'); + if (res.data) { + this.$u.toast('鍒犻櫎鎴愬姛'); + this.getAllHuoDaiByCustomerId(); + } else { + this.$u.toast('鍒犻櫎澶辫触'); + } } - this.getAllHuoDaiByCustomerId(); }); }, // 鍒犻櫎杞﹂槦 @@ -259,7 +263,7 @@ this.logoutShow = true; }, logoutConfirm() { - redirectLogin() + redirectLogin(); }, logoutCancel() { this.logoutShow = false; diff --git a/pages/driver-page/appointment/appointment.vue b/pages/driver-page/appointment/appointment.vue index 3981d85..4e8099d 100644 --- a/pages/driver-page/appointment/appointment.vue +++ b/pages/driver-page/appointment/appointment.vue @@ -30,8 +30,15 @@ }, data() { return { - takeCoalId: null, - yuYueId: null, + yuYueListParams: { + filedId: '', + deptId: '', + sendDate: '' + }, + yuYuePostParams:{ + takeCoalId: null, + yuYueId: null, + }, yuYueData: [], isRCSQ: false, // 鍏ュ満鐢宠鎺ュ彛鎺у埗 rcsqData: { @@ -50,7 +57,10 @@ this.isRCSQ = true; this.rcsqData.originalYyId = params.yyId; } - this.takeCoalId = params.takeCoalId; + this.yuYuePostParams.takeCoalId = params.takeCoalId; + this.yuYueListParams.filedId = params.filedId; + this.yuYueListParams.deptId = params.deptId; + this.yuYueListParams.sendDate = params.sendDate; }, onShow() { this.init(); @@ -64,7 +74,7 @@ uni.showLoading({ title: '鍔犺浇涓�...' }); - this.$reqGet('yuYueList').then(res => { + this.$reqGet('yuYueList', this.yuYueListParams).then(res => { uni.hideLoading(); if (res.code == 0) { this.yuYueData = res.data; @@ -74,7 +84,7 @@ // 棰勭害鍜屽叆鍦虹敵璇峰叡鐢ㄤ簨浠� yuYueBtnClick(value) { if (this.isRCSQ) { - this.rcsqData.taskId = this.takeCoalId; + this.rcsqData.taskId = this.yuYuePostParams.takeCoalId; this.saveRCSQ(value); } else { this.yuYueClick(value.id); @@ -82,8 +92,8 @@ }, // 棰勭害 yuYueClick(id) { - this.yuYueId = id; - this.$reqPost('yuYue', { takeCoalId: this.takeCoalId, yuYueId: this.yuYueId }, 'params').then(res => { + this.yuYuePostParams.yuYueId = id; + this.$reqPost('yuYue', { takeCoalId: this.yuYuePostParams.takeCoalId, yuYueId: this.yuYuePostParams.yuYueId }, 'params').then(res => { if (res.code == 0) { this.$u.toast('棰勭害鎴愬姛锛�'); } diff --git a/pages/driver-page/driver-index/driver-index.vue b/pages/driver-page/driver-index/driver-index.vue index 26009b6..1520179 100644 --- a/pages/driver-page/driver-index/driver-index.vue +++ b/pages/driver-page/driver-index/driver-index.vue @@ -3,6 +3,13 @@ <view class="driver-index-body"> <!-- 寰呴鍙栨彁鐓ゅ崟 --> <combined-title title="寰呴鍙�"></combined-title> + <u-empty + mode="data" + icon="http://cdn.uviewui.com/uview/empty/data.png" + textSize="30" + iconSize="1000" + v-if="driverBillOfLoadingData.list1 ? (driverBillOfLoadingData.list1.length == 0 ? true : false) : true" + ></u-empty> <card v-for="(item, index) in driverBillOfLoadingData.list1" :key="index" :name="item.id" backgroundType="2"> <template v-slot:left> <view class="card-left__top"> @@ -34,6 +41,23 @@ <combined-title title="鎴戠殑鎻愮叅鍗�"></combined-title> <!-- 鍗$墖 --> <!-- <view v-for="(item, index) in driverBillOfLoadingData.list2" :key="index"> --> + <u-empty + mode="data" + icon="http://cdn.uviewui.com/uview/empty/data.png" + textSize="30" + iconSize="1000" + v-if=" + driverBillOfLoadingData.list2 + ? driverBillOfLoadingData.list2.length == 0 + ? true + : false + : true && driverBillOfLoadingData.list3 + ? driverBillOfLoadingData.list3.length == 0 + ? true + : false + : true + " + ></u-empty> <view> <!-- 寰呴绾︽彁鐓ゅ崟 --> <view class="daiYuYue" v-for="(item, index) in driverBillOfLoadingData.list3" :key="index"> @@ -45,7 +69,7 @@ <view>{{ item.coalName }}</view> <view>宸查绾︼細{{ item.cars }} 杞�</view> </view> - <view><u-button text="棰勭害" type="primary" @click="toAppointmentClick(item.id)"></u-button></view> + <view><u-button text="棰勭害" type="primary" @click="toAppointmentClick(item)"></u-button></view> </view> <!-- 宸查绾︽彁鐓ゅ崟 --> <view @click="list3CardIconClick(item)" class="haveYuYue" v-for="(item, index) in driverBillOfLoadingData.list2" :key="index"> @@ -68,6 +92,7 @@ <script> import { customerId } from '@/utils/status'; + export default { data() { return { @@ -116,9 +141,9 @@ }); }, // 鍘婚绾� - toAppointmentClick(id) { + toAppointmentClick(value) { uni.navigateTo({ - url: `/pages/driver-page/appointment/appointment?takeCoalId=${id}` + url: `/pages/driver-page/appointment/appointment?takeCoalId=${value.id}&filedId=${value.filedId}&deptId=${value.deptId}&sendDate=${value.sendDate}` }); } } diff --git a/pages/driver-page/drvier-my/drvier-my.vue b/pages/driver-page/drvier-my/drvier-my.vue index 6f63d96..59b3200 100644 --- a/pages/driver-page/drvier-my/drvier-my.vue +++ b/pages/driver-page/drvier-my/drvier-my.vue @@ -1,6 +1,6 @@ <template> <view class="driver-my"> - <view class="jifen"> + <!-- <view class="jifen"> <view class="zheng"> <image src="../../../static/image/鏃犱汉鍊煎畧/缁� 38_1.png"></image> <view class="font"> @@ -15,7 +15,7 @@ <view class="font-bottom">璐熺Н鍒�</view> </view> </view> - </view> + </view> --> <view class="personal-information-form"> <u--form labelPosition="left" :model="userInfo" ref="form1"> @@ -34,68 +34,92 @@ <u-form-item labelWidth="20%" label="浣撻噸" ref="item1"> <u--input v-model="userInfo.weight" border="none" inputAlign="right" disabled disabledColor="#fff"></u--input> </u-form-item> - <u-form-item labelWidth="20%" label="杞﹁酱鏁�" ref="item1"> - <u--input v-model="userInfo.carNo" border="none" inputAlign="right" disabled disabledColor="#fff"></u--input> + <u-form-item v-model="userInfo.axleNum" labelWidth="20%" label="杞﹁酱鏁�" ref="item1"> + <u--input border="none" inputAlign="right" disabled disabledColor="#fff"></u--input> </u-form-item> <u-form-item labelWidth="20%" label="杞﹁締鐓х墖" ref="item1"> - <!-- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10" disabled></u-upload> --> - <u--image :showLoading="true" :src="src" width="80px" height="80px" @click="imageClick(0)"></u--image> + <u--image :showLoading="true" :src="BaseUrl + userInfo.carImg" width="80px" height="80px" @click="imageClick(1)"></u--image> </u-form-item> - <u-form-item labelWidth="20%" label="琛岄┒璇佺収鐗�" ref="item1"> - <!-- <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10" disabled></u-upload> --> - <u--image :showLoading="true" :src="src" width="80px" height="80px" @click="imageClick(1)"></u--image> + <u-form-item labelWidth="25%" label="琛岄┒璇佺収鐗�" ref="item1"> + <u--image :showLoading="true" :src="BaseUrl + userInfo.drivingImg" width="80px" height="80px" @click="imageClick(2)"></u--image> </u-form-item> </u--form> - <view class="push-information-button"><u-button text="淇敼涓汉璧勬枡" type="primary" @click="editBtnClick"></u-button></view> + <view class="push-information-button"> + <u-button text="閫�鍑虹櫥褰�" type="primary" @click="logout"></u-button> + <u-button text="淇敼涓汉璧勬枡" type="primary" @click="editBtnClick"></u-button> + </view> </view> <!-- 鍥剧墖棰勮寮瑰嚭妗� --> <view class="previewImage-container"> <u-popup :show="previewImageShow" mode="center" @close="previewImageClose" @open="previewImageOpen"> - <u--image :src="previewImageSrc" width="200px" height="200px"></u--image> + <u--image :src="BaseUrl + previewImageSrc" width="400px" height="400px"></u--image> </u-popup> </view> <!-- 淇敼寮瑰嚭妗� --> <view class="editDriverPopup-container"> - <u-popup :show="editDriverPopupShow" mode="bottom" @close="editDriverPopupClose" @open="editDriverPopupOpen"> + <u-popup :show="editDriverPopupShow" mode="bottom" @close="editDriverPopupClose" @open="editDriverPopupOpen" :closeable="true"> + <combined-title title="淇敼涓汉淇℃伅" style="margin-left:20rpx"></combined-title> <view class="editDriverPopup-container-box"> - <u--form labelPosition="left" :model="userInfo" ref="form1"> - <u-form-item labelWidth="20%" label="濮撳悕" ref="item1"><u--input v-model="userInfo.name" border="none" inputAlign="left"></u--input></u-form-item> - <u-form-item labelWidth="20%" label="韬唤璇佸彿" ref="item1"><u--input v-model="userInfo.idCard" border="none" inputAlign="left"></u--input></u-form-item> - <u-form-item labelWidth="20%" label="鎵嬫満鍙�" ref="item1"><u--input v-model="userInfo.phone" border="none" inputAlign="left"></u--input></u-form-item> - <u-form-item labelWidth="20%" label="杞︾墝鍙�" ref="item1"><u--input v-model="userInfo.carNo" border="none" inputAlign="left"></u--input></u-form-item> - <u-form-item labelWidth="20%" label="浣撻噸" ref="item1"><u--input v-model="userInfo.weight" border="none" inputAlign="left"></u--input></u-form-item> - <u-form-item labelWidth="20%" label="杞﹁酱鏁�" ref="item1"><u--input v-model="userInfo.carCS" border="none" inputAlign="left"></u--input></u-form-item> - <u-form-item labelWidth="20%" label="杞﹁締鐓х墖" ref="item1"> - <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10"></u-upload> + <u--form labelPosition="left" :model="editUserInfo" ref="form1"> + <u-form-item labelWidth="20%" label="濮撳悕" ref="item1"><u--input v-model="editUserInfo.name" border="none" inputAlign="left"></u--input></u-form-item> + <u-form-item labelWidth="20%" label="韬唤璇佸彿" ref="item1"><u--input v-model="editUserInfo.idCard" border="none" inputAlign="left"></u--input></u-form-item> + <u-form-item labelWidth="20%" label="鎵嬫満鍙�" ref="item1"><u--input v-model="editUserInfo.phone" border="none" inputAlign="left"></u--input></u-form-item> + <u-form-item labelWidth="20%" label="杞︾墝鍙�" ref="item1"><u--input v-model="editUserInfo.carNo" border="none" inputAlign="left"></u--input></u-form-item> + <u-form-item labelWidth="20%" label="浣撻噸" ref="item1"><u--input v-model="editUserInfo.weight" border="none" inputAlign="left"></u--input></u-form-item> + <u-form-item labelWidth="20%" label="杞﹁酱鏁�" ref="item1"><u--input v-model="editUserInfo.axleNum" border="none" inputAlign="left"></u--input></u-form-item> + <u-form-item labelWidth="25%" label="杞﹁締鐓х墖" ref="item1"> + <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="1" width="250" height="150"></u-upload> </u-form-item> - <u-form-item labelWidth="20%" label="琛岄┒璇佺収鐗�" ref="item1"> - <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="10"></u-upload> + <u-form-item labelWidth="25%" label="琛岄┒璇佺収鐗�" ref="item1"> + <u-upload :fileList="fileList2" @afterRead="afterRead" @delete="deletePic" name="2" multiple :maxCount="1" width="250" height="150"></u-upload> </u-form-item> </u--form> <u-button text="鎻愪氦" @click="updateUser" type="primary"></u-button> </view> </u-popup> </view> + <view class="logoutModel"> + <u-modal :show="logoutShow" :title="logoutTitle" showCancelButton :content="logoutContent" @confirm="logoutConfirm" @cancel="logoutCancel"></u-modal> + </view> </view> </template> <script> -import { customerId, userInfo } from '@/utils/status'; +import { customerId, userInfo, redirectLogin } from '@/utils/status'; +import { BaseUrl } from '@/api/publicInterface.js'; export default { data() { return { - userInfo: { - carCS:'', + // 鑾峰彇鐨勫徃鏈鸿鎯� + userInfo: {}, + // 淇敼鍙告満璇︽儏 + editUserInfo: { + phone: '', + name: '', + username: '', + type: 3, + idCard: '', + carNo: '', + carImg: '', + drivingImg: '', + axleNum: '', + weight: '' }, - src: 'https://cdn.uviewui.com/uview/album/1.jpg', + src: '', fileList1: [], + fileList2: [], // 淇敼淇℃伅寮瑰嚭妗� editDriverPopupShow: false, // previewImage previewImageShow: false, - previewImageSrc: 'https://cdn.uviewui.com/uview/album/1.jpg' + previewImageSrc: '', + // 閫�鍑烘ā鎬佹 + logoutShow: false, + logoutTitle: '鎻愮ず', + logoutContent: '鏄惁纭閫�鍑�', + BaseUrl }; }, onShow() { @@ -103,7 +127,6 @@ }, methods: { init() { - // this.getUserById(); this.getUserEntity(); }, getUserEntity() { @@ -114,18 +137,14 @@ console.log(res, '鍙告満璇︽儏'); uni.hideLoading(); this.userInfo = res.data; + Object.keys(this.editUserInfo).map(item => { + console.log(res.data[item]); + if (res.data[item]) { + this.editUserInfo[item] = res.data[item]; + } + }); }); }, - // 鑾峰彇鐢ㄦ埛淇℃伅 - // getUserById() { - // uni.showLoading({ - // title: '鍔犺浇涓�...' - // }); - // this.$reqPost('getUserById', { id: customerId }, 'params').then(res => { - // uni.hideLoading(); - // this.userInfo = res.data; - // }); - // }, // 淇敼鎸夐挳鐐瑰嚮 editBtnClick() { this.editDriverPopupShow = true; @@ -133,7 +152,14 @@ imageClick(index) { // 閫氳繃index鍒囨崲鍥剧墖 console.log('鍒囨崲鍥剧墖', index); - this.previewImageShow = true; + if (index == 1) { + this.previewImageSrc = this.userInfo.carImg; + } else { + this.previewImageSrc = this.userInfo.drivingImg; + } + this.$nextTick(() => { + this.previewImageShow = true; + }); }, // 鍒犻櫎 deletePic(event) { @@ -152,7 +178,7 @@ }); }); for (let i = 0; i < lists.length; i++) { - const result = await this.uploadFilePromise(lists[i].url); + const result = await this.uploadFilePromise(lists[i].url, event.name); let item = this[`fileList${event.name}`][fileListLen]; this[`fileList${event.name}`].splice( fileListLen, @@ -166,19 +192,22 @@ fileListLen++; } }, - uploadFilePromise(url) { + uploadFilePromise(url, num) { return new Promise((resolve, reject) => { let a = uni.uploadFile({ - url: 'http://192.168.2.21:7001/upload', // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧� + url: BaseUrl + '/admin/sys-file/uploadUnToken', // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧� filePath: url, name: 'file', - formData: { - user: 'test' - }, + // formData: { + // user: 'test' + // }, success: res => { - setTimeout(() => { - resolve(res.data.data); - }, 1000); + resolve(JSON.parse(res.data).data.url); + if (num == 1) { + this.editUserInfo.carImg = JSON.parse(res.data).data.url; + } else if (num == 2) { + this.editUserInfo.drivingImg = JSON.parse(res.data).data.url; + } } }); }); @@ -203,12 +232,12 @@ }, // 淇敼鐢ㄦ埛淇℃伅 updateUser() { - this.$reqPost('updateUser', this.userInfo, 'params').then(res => { + this.$reqPost('updateUser', this.editUserInfo, 'json').then(res => { console.log('鏇存柊鏁版嵁', res); this.editDriverPopupShow = false; if (res.code == 0) { this.$u.toast('淇敼鎴愬姛'); - this.getUserById(); + this.init(); } else { uni.showToast({ title: res.msg, @@ -217,6 +246,15 @@ }); } }); + }, + logout() { + this.logoutShow = true; + }, + logoutConfirm() { + redirectLogin(); + }, + logoutCancel() { + this.logoutShow = false; } } }; @@ -289,10 +327,16 @@ } // 琛ㄥ崟 .personal-information-form { - margin-top: vww(24); + // margin-top: vww(24); .push-information-button { + display: flex; margin: vww(20) auto 0; width: 80%; + .u-button { + &:nth-of-type(2) { + margin-left: vww(10); + } + } } } @@ -305,13 +349,22 @@ .u-popup { .u-transition { height: 95%; - .u-popup__content { overflow: scroll !important; .editDriverPopup-container-box { width: 90%; margin: 0 auto; } + + //closeIcon + .u-popup__content__close--top-right { + top: vww(20) !important; + .u-icon { + .u-icon__icon { + font-size: vww(20) !important; + } + } + } } } } diff --git a/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue b/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue index fda4b50..1199872 100644 --- a/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue +++ b/pages/freight-forwarder-page/freightForwarder-index/freightForwarder-index.vue @@ -1,10 +1,11 @@ <template> <view class="freightForwarder-index"> <view class="freightForwarder-index-body"> + <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png" textSize="30" iconSize="1000" v-if="orderPlanData.length == 0"></u-empty> <card v-for="(item, index) in orderPlanData" :key="index" :name="item.id" @click="cardBodyClick" backgroundType="1"> <template v-slot:left> <view class="card-left__top"> - <text>{{ item.orderPlan.cars }}</text> + <text>{{ item.carNum }}</text> 寮� </view> <view class="card-left__utils"><u-button text="杞彂" type="primary" @tap.stop="forwardClick(item.id)" shape="circle"></u-button></view> @@ -13,17 +14,17 @@ <view class="right-top"> <view class="card-right-top-row"> <view> - <text>{{ item.orderPlan.compName }}</text> + <text>{{ item.deptName||'' }}</text> </view> <view> - <text>{{ item.orderPlan.coalName }}</text> + <text>{{ item.coalName||'' }}</text> </view> </view> </view> </template> <template v-slot:right-bottom> <view class="code"> - <text>缂栧彿锛歿{ item.orderPlan.code }}</text> + <text>缂栧彿锛歿{ item.orderCode||'' }}</text> </view> </template> </card> diff --git a/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue b/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue index 20ac0ba..ca82383 100644 --- a/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue +++ b/pages/freight-forwarder-page/freightForwarder-my/freightForwarder-my.vue @@ -10,7 +10,7 @@ <u-swipe-action> <u-cell-group :border="false"> <u-swipe-action-item :options="options1" v-for="(item, index) in fleetData" :index="index" :name="item.id" :key="index" @click="deleteFleetClick"> - <u-cell :title="item.name" value="鏃�" @click="tofleetDetails(item.id)"></u-cell> + <u-cell :title="item.name" :value="item.userSijisum + '杈�'" @click="tofleetDetails(item.id)"></u-cell> </u-swipe-action-item> </u-cell-group> </u-swipe-action> @@ -34,25 +34,53 @@ <view class="addCarButton"><u-button text="娣诲姞" type="primary" @click="addNewGroupClick"></u-button></view> </u-popup> </view> + <view class="utils"><u-button text="閫�鍑虹櫥褰�" type="primary" @click="logout"></u-button></view> + <!-- 鍒犻櫎杞﹂槦妯℃�佹 --> + <view class="deleteFleetModal"> + <u-modal + :show="deleteFleetShow" + :title="deleteFleetTitle" + @close="deleteFleetClose" + @cancel="deleteFleetCancel" + @confirm="deleteFleetConfirm" + :closeOnClickOverlay="true" + :showCancelButton="true" + > + <view class="slot-content"><rich-text :nodes="deleteFleetContent"></rich-text></view> + </u-modal> + </view> + <view class="logoutModel"> + <u-modal :show="logoutShow" :title="logoutTitle" showCancelButton :content="logoutContent" @confirm="logoutConfirm" @cancel="logoutCancel"></u-modal> + </view> </view> </template> <script> +import { redirectLogin } from '@/utils/status'; export default { data() { return { fleetData: [], // 鏂板缓杞﹂槦 addGroupForm: { - name: '', - wxUserId: uni.getStorageSync('userInfo').id + name: '' + // wxUserId: uni.getStorageSync('userInfo').id }, updateGroupShow: false, options1: [ { text: '鍒犻櫎' } - ] + ], + // 鍒犻櫎杞﹂槦妯℃�佹 + deleteFleetId: null, // 鍒犻櫎杞﹂槦id + deleteFleetShow: false, + deleteFleetTitle: '', + deleteFleetContent: '', + // 閫�鍑烘ā鎬佹 + logoutShow: false, + logoutTitle: '鎻愮ず', + logoutContent: '鏄惁纭閫�鍑�' }; }, onShow() { @@ -92,15 +120,51 @@ } }); }, - toFreightForwarderDetails() { - uni.navigateTo({ - url: '/pages/customer-page/freight-forwarder-details/freight-forwarder-details' + // 鍒犻櫎杞﹂槦 + deleteFleetClick(args) { + console.log(args.name, '杞﹂槦id'); + this.deleteFleetId = args.name; + this.deleteFleetShow = true; + this.fleetData.forEach(item => { + if (item.id == this.deleteFleetId) { + this.deleteFleetContent = '纭鍒犻櫎杞﹂槦' + item.name; + } }); }, + deleteFleetClose() { + this.deleteFleetShow = false; + }, + deleteFleetCancel() { + this.deleteFleetShow = false; + }, + deleteFleetConfirm() { + this.deleteFleetShow = false; + uni.showLoading({ + title: '鍔犺浇涓�...' + }); + this.$reqPost('deleteFleet', { id: this.deleteFleetId }, 'params').then(res => { + console.log('鍒犻櫎杞﹂槦', res); + if (res.code == 0) { + this.$u.toast('鍒犻櫎鎴愬姛'); + } + uni.hideLoading(); + this.getFleet(); + }); + }, + // 杞﹂槦璇︽儏 tofleetDetails(id) { uni.navigateTo({ url: `/pages/customer-page/fleet-management/fleet-management?id=${id}` }); + }, + logout() { + this.logoutShow = true; + }, + logoutConfirm() { + redirectLogin(); + }, + logoutCancel() { + this.logoutShow = false; } } }; diff --git a/pages/login/login.vue b/pages/login/login.vue index 961779e..7a3b0b5 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -2,7 +2,7 @@ <view class="login"> <view class="logo">鏃犱汉鍊煎畧</view> <!--鐢ㄦ埛鍚嶅瘑鐮佺櫥褰�--> - <user-password /> + <user-password :btnText='0'/> <!-- 寰俊openid鐧诲綍 --> <view class="loginBtn"> <u-button class="button" @click.stop="beforeLoginEvent" :disabled="btnLoading" :loading="btnLoading" type="primary" text="寰俊涓�閿櫥褰�"></u-button> @@ -24,20 +24,28 @@ </view> </u-popup> </view> + <!-- 璇㈤棶鏄惁缁戝畾寰俊 --> + <view class="bindWxModel"> + <u-modal :show="bindWxModelShow" :title="bindWxModelTitle" showCancelButton :content="bindWxContent" @confirm="bindWxConfirm" @cancel="bindWxCancel"></u-modal> + </view> </view> </template> <script> -import { apiLogin, apiLogin2, apiLoginPassword } from '@/api/publicInterface.js'; +import { apiLoginWx, apiLoginPassword } from '@/api/publicInterface.js'; import { mapMutations } from 'vuex'; import userPassword from './userPassword.vue'; - +import { setToken, setRefreshToken, setUsernameKey, setCustomerId, redirectHome } from '@/utils/status.js'; export default { data() { return { wxcode: '', // 鍙告満1 btnLoading: false, - loginPopupShow: false + loginPopupShow: false, + // 缁戝畾寰俊妯℃�佹 + bindWxModelShow: false, + bindWxModelTitle: '鎻愮ず', + bindWxContent: '濡傛灉宸叉嫢鏈夌郴缁熻处鍙凤紝鍙互鐩存帴璺宠浆缁戝畾寰俊椤甸潰' }; }, components: { @@ -67,7 +75,7 @@ }, // 鐧诲綍鎺ュ彛 apiLogin() { - // apiLogin2({ code: this.wxcode }) + // apiLoginWx({ code: this.wxcode }) // .then(res => { // console.log('璇锋眰鐧诲綍', res); // if (res.msg == '闇�缁戝畾') { @@ -93,7 +101,7 @@ */ wx.request({ - url: `https://api.weixin.qq.com/sns/jscode2session?appid=wx30f254cbb0b90b3c&secret=938a068410796cda21e5e03b9435cdbf&js_code=${this.wxcode}&grant_type=authorization_code`, + url: `https://api.weixin.qq.com/sns/jscode2session?appid=wx4a62fc1684c429a9&secret=ee90afe376cdcec2fdd947c0a4db961a&js_code=${this.wxcode}&grant_type=authorization_code`, success(res) { let id = res.data.openid; uni.setStorageSync('openid', id); @@ -103,7 +111,41 @@ }); } }); - this.loginPopupShow = false + this.$nextTick(() => { + apiLoginWx({ code: uni.getStorageSync('openid') }).then(res => { + if (res.code != 1) { + this.$u.toast('鎭枩鎮紝鐧诲綍鎴愬姛锛�'); + // 鐧婚檰鎴愬姛锛屽瓨鍌ㄧ浉鍏充俊鎭� + setToken(res.access_token); + setRefreshToken(res.refresh_token); + setUsernameKey(res.username); + //鏌ヨ鐢ㄦ埛璇︾粏淇℃伅骞跺偍瀛� + this.$reqGet('getUserEntity').then(res => { + this.setUserTabbar(res.data.type); + uni.setStorageSync('roleType', res.data.type); + setCustomerId(res.data.customerid); + //璺宠浆椤甸潰 + this.$nextTick(() => { + redirectHome(); + }); + }); + } else { + this.$u.toast(res.msg); + this.bindWxModelShow = true; + } + }); + }); + + this.loginPopupShow = false; + }, + bindWxConfirm() { + uni.navigateTo({ + url: `/pages/login/wxLogin?code=${uni.getStorageSync('openid')}` + }); + this.bindWxModelShow = false; + }, + bindWxCancel() { + this.bindWxModelShow = false; }, // 寮瑰嚭灞傛椂闂� closePopup() { diff --git a/pages/login/userPassword.vue b/pages/login/userPassword.vue index 92bd04f..1a37db5 100644 --- a/pages/login/userPassword.vue +++ b/pages/login/userPassword.vue @@ -24,7 +24,7 @@ ></u--input> </view> </view> - <view class="loginBtn"><u-button type="primary" text="鐧诲綍" @click="submit()"></u-button></view> + <view class="loginBtn"><u-button type="primary" :text="btnText == 1 ? '缁戝畾' : '鐧诲綍'" @click="submit()"></u-button></view> </view> </template> @@ -34,11 +34,16 @@ import { setToken, setRefreshToken, setUsernameKey, setCustomerId, redirectHome } from '@/utils/status.js'; export default { name: 'userPassword', + props: { + //0:姝e父锛�1锛氬井淇$粦瀹� + btnText: { + type: Number, + default: 0 + } + }, data() { return { - // username: 'appUser', - // username:'siJi1', - username:'siJi2', + username: '18812345677', password: '123456', remember: true, baseUrl: '' @@ -48,6 +53,9 @@ ...mapMutations(['setUserTabbar']), //鐧诲綍 async submit() { + uni.showLoading({ + title: '鐧婚檰涓�...' + }); //琛ㄥ崟鏍¢獙 if (this.username.length === 0) { this.$u.toast('璇疯緭鍏ヨ处鍙�'); @@ -57,7 +65,7 @@ this.$u.toast('璇疯緭鍏ュ瘑鐮�'); return; } - let grant_type = 'password' + let grant_type = 'password'; //鐧诲綍鎺ュ彛 await apiLoginPassword({ username: this.username, @@ -66,24 +74,45 @@ scope: 'server' }) .then(res => { - this.$u.toast('鎭枩鎮紝鐧诲綍鎴愬姛锛�'); - - // 鐧婚檰鎴愬姛锛屽瓨鍌ㄧ浉鍏充俊鎭� setToken(res.access_token); setRefreshToken(res.refresh_token); - setUsernameKey(res.username); - - //鏌ヨ鐢ㄦ埛璇︾粏淇℃伅骞跺偍瀛� - this.$reqGet('getUserEntity').then(res => { - this.setUserTabbar(res.data.type); - uni.setStorageSync('roleType', res.data.type); - setCustomerId(res.data.customerid); - - //璺宠浆椤甸潰 + if (this.btnText == 0) { + if (res.code != 1) { + this.$u.toast('鎭枩鎮紝鐧诲綍鎴愬姛锛�'); + // 鐧婚檰鎴愬姛锛屽瓨鍌ㄧ浉鍏充俊鎭� + setToken(res.access_token); + setRefreshToken(res.refresh_token); + setUsernameKey(res.username); + //鏌ヨ鐢ㄦ埛璇︾粏淇℃伅骞跺偍瀛� + this.$reqGet('getUserEntity').then(res => { + this.setUserTabbar(res.data.type); + uni.setStorageSync('roleType', res.data.type); + setCustomerId(res.data.customerid); + uni.hideLoading(); + //璺宠浆椤甸潰 + this.$nextTick(() => { + redirectHome(); + }); + }); + } else { + uni.hideLoading(); + this.$u.toast(res.msg); + } + } else { this.$nextTick(() => { - redirectHome(); + this.$reqPost('wxBind', { state: 'MINI', code: uni.getStorageSync('code') }, 'params').then(res => { + uni.hideLoading(); + if (res.code == 0) { + this.$u.toast('缁戝畾鎴愬姛锛佸嵆灏嗗洖鍒扮櫥褰曢〉锛�'); + setTimeout(() => { + uni.navigateBack(); + }, 1000); + } else { + this.$u.toast(res.msg ? res.msg : '缁戝畾澶辫触'); + } + }); }); - }); + } }) .catch(e => { this.$u.toast(e); diff --git a/pages/login/wxLogin.vue b/pages/login/wxLogin.vue new file mode 100644 index 0000000..7a84069 --- /dev/null +++ b/pages/login/wxLogin.vue @@ -0,0 +1,39 @@ +<template> + <view class="login"> + <view class="logo">寰俊缁戝畾</view> + <!--鐢ㄦ埛鍚嶅瘑鐮佺櫥褰�--> + <user-password :btnText="1" /> + </view> +</template> + +<script> +import userPassword from './userPassword.vue'; +export default { + components: { + userPassword + }, + data() { + return {}; + }, + methods: {} +}; +</script> + +<style lang="scss"> +@import 'index.scss'; +.login { + .logo { + width: 80%; + font-size: 64rpx; + color: #497bff; + margin: vww(100) auto 0; + text-align: center; + } + .loginBtn { + margin-top: vww(20); + .u-button { + width: 80%; + } + } +} +</style> diff --git a/pages/public-page/forward/forward.vue b/pages/public-page/forward/forward.vue index c3d81d6..52e564a 100644 --- a/pages/public-page/forward/forward.vue +++ b/pages/public-page/forward/forward.vue @@ -141,9 +141,8 @@ // 杞彂閫夋嫨璐т唬 forwardHuoDaiObjectSelect(item) { this.selectPopupShow = false; - this.forwardForm.userId = item.id; - // this.forwardForm.name = item.huoDaiName; - this.name = item.huoDaiName; + this.forwardForm.userId = item.userId; + this.name = item.name; this.forwardForm.fleetId = 0; console.log('璐т唬閫夋嫨', this.forwardForm); }, @@ -151,7 +150,6 @@ forwardFleetObjectSelect(item) { this.selectPopupShow = false; this.forwardForm.fleetId = item.id; - // this.forwardForm.name = item.name; this.name = item.name; this.forwardForm.userId = 0; console.log('杞﹂槦閫夋嫨', this.forwardForm); diff --git a/pages/register/register.vue b/pages/register/register.vue index 45d970d..1b90898 100644 --- a/pages/register/register.vue +++ b/pages/register/register.vue @@ -18,49 +18,49 @@ </u-radio-group> </u-form-item> <u-form-item prop="name" label="濮撳悕" labelWidth="20%" borderBottom required> - <u--input v-model="registerFormModel.name" placeholder="璇疯緭鍏ュ唴瀹�"></u--input> + <u--input v-model="registerFormModel.name" placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input> </u-form-item> <u-form-item prop="idCard" label="韬唤璇�" labelWidth="20%" borderBottom required> - <u--input v-model="registerFormModel.idCard" placeholder="璇疯緭鍏ュ唴瀹�"></u--input> + <u--input v-model="registerFormModel.idCard" placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input> </u-form-item> <u-form-item prop="phone" label="鎵嬫満鍙�" labelWidth="20%" borderBottom required> - <u--input v-model="registerFormModel.phone" placeholder="璇疯緭鍏ュ唴瀹�"></u--input> + <u--input v-model="registerFormModel.phone" placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input> </u-form-item> <u-form-item prop="password" label="瀵嗙爜" labelWidth="20%" borderBottom required> - <u--input v-model="registerFormModel.password" placeholder="璇疯緭鍏ュ唴瀹�"></u--input> + <u--input v-model="registerFormModel.password" placeholder="璇疯緭鍏ュ唴瀹�" password clearable></u--input> + </u-form-item> + <u-form-item prop="confirmPassword" label="纭瀵嗙爜" labelWidth="20%" borderBottom required> + <u--input v-model="registerFormModel.confirmPassword" placeholder="璇疯緭鍏ュ唴瀹�" password clearable @blur="jiaoYanPassword"></u--input> </u-form-item> <u-form-item prop="carNo" label="杞︾墝鍙�" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required> - <u--input v-model="registerFormModel.carNo" placeholder="璇疯緭鍏ュ唴瀹�"></u--input> + <u--input v-model="registerFormModel.carNo" placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input> </u-form-item> - <u-form-item prop="carPhoto" label="杞﹁締鐓х墖" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required> - <u-upload :fileList="fileList6" @afterRead="afterRead" @delete="deletePic" name="6" multiple :maxCount="1" width="250" height="150"> + <u-form-item prop="carImg" label="杞﹁締鐓х墖" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required> + <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple :maxCount="1" width="250" height="150"> <!-- <image src="https://cdn.uviewui.com/uview/demo/upload/positive.png" mode="widthFix" style="width: 250px;height: 150px;"></image> --> </u-upload> </u-form-item> - <u-form-item prop="drivingLicense" label="琛岄┒璇�" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required> - <u-upload :fileList="fileList5" @afterRead="afterRead" @delete="deletePic" name="5" multiple :maxCount="1" width="250" height="150"> + <u-form-item prop="drivingImg" label="琛岄┒璇�" labelWidth="20%" borderBottom v-if="radiovalue1 == '鍙告満'" required> + <u-upload :fileList="fileList2" @afterRead="afterRead" @delete="deletePic" name="2" multiple :maxCount="1" width="250" height="150"> <!-- <image src="https://cdn.uviewui.com/uview/demo/upload/positive.png" mode="widthFix" style="width: 250px;height: 150px;"></image> --> </u-upload> </u-form-item> - <u-form-item label="鎺ㄨ崘浜鸿处鍙�" labelWidth="25%" borderBottom ><u--input v-model="registerFormModel.tuiJianMa" placeholder="璇疯緭鍏ュ唴瀹�"></u--input></u-form-item> + <u-form-item label="鎺ㄨ崘浜鸿处鍙�" labelWidth="25%" borderBottom><u--input v-model="registerFormModel.tuiJianMa" placeholder="璇疯緭鍏ュ唴瀹�" clearable></u--input></u-form-item> </u--form> </view> <view class="roleModel"> <u-modal :show="editRoleModelShow" :title="title" :content="content" :showCancelButton="true" @confirm="roleConfirm" @cancel="roleCancel"></u-modal> </view> <view class="registerBtn"><u-button text="娉ㄥ唽" type="primary" @click="registerClick"></u-button></view> - - <!-- <view class="utils"> - <text @click="callingIn">鎵撶數璇�</text> - </view> --> </view> </template> <script> // import HomeSpecies from '@/components/home-species/HomeSpecies.vue'; import { apiRegister } from '@/api/publicInterface.js'; +import { BaseUrl } from '@/api/publicInterface.js'; export default { // onLoad: function() { // // 鏌ョ湅鏄惁鎺堟潈 @@ -99,15 +99,18 @@ phone: '', password: '', name: '', - username:'', + username: '', openId: '', type: 2, idCard: '', carNo: '', carImg: '', drivingImg: '', - tuiJianMa: '' + tuiJianMa: '', + confirmPassword:'' }, + fileList1: [], + fileList2: [], rules: { name: { type: 'string', @@ -142,8 +145,20 @@ }, { min: 6, - max: 8, - message: '闀垮害鍦�6-8涓瓧绗︿箣闂�' + max: 12, + message: '闀垮害鍦�6-12涓瓧绗︿箣闂�' + } + ], + confirmPassword:[ + { + required: true, + message: '璇疯缃垵濮嬪瘑鐮�', + trigger: ['blur', 'change'] + }, + { + min: 6, + max: 12, + message: '闀垮害鍦�6-12涓瓧绗︿箣闂�' } ], carNo: [ @@ -154,19 +169,20 @@ trigger: ['blur', 'change'] } ], - // carPhoto: { - // type: 'string', - // required: true, - // message: '璇蜂笂浼犺溅杈嗗浘鐗�', - // trigger: ['blur', 'change'] - // }, - // drivingLicense: { - // type: 'string', - // required: true, - // message: '璇蜂笂浼犺椹惰瘉鐓х墖', - // trigger: ['blur', 'change'] - // } + carImg: { + type: 'string', + required: true, + message: '璇蜂笂浼犺溅杈嗗浘鐗�', + trigger: ['blur', 'change'] + }, + drivingImg: { + type: 'string', + required: true, + message: '璇蜂笂浼犺椹惰瘉鐓х墖', + trigger: ['blur', 'change'] + } }, + confirmPassword:'', // 鍩烘湰妗堝垪鏁版嵁 radiolist1: [ { @@ -181,8 +197,6 @@ // u-radio-group鐨剉-model缁戝畾鐨勫�煎鏋滆缃负鏌愪釜radio鐨刵ame锛屽氨浼氳榛樿閫変腑 radiovalue1: '璐т唬', beforeChangeValue: '', - fileList5: [], - fileList6: [], // 鏇存崲瑙掕壊寮规 editRoleModelShow: false, title: '鎻愮ず', @@ -215,35 +229,39 @@ }, methods: { registerClick() { - this.$refs.regesterFormRef - .validate() - .then(res => { - console.log(this.registerFormModel); - this.registerFormModel.username = this.registerFormModel.name - apiRegister(this.registerFormModel) - .then(res => { - console.log(res); - if (res.data.code == 0) { - uni.showToast({ - title: '娉ㄥ唽鎴愬姛,鍗冲皢杩涘叆鐧诲綍锛�', - icon: 'none', - duration: 1000 - }); - setTimeout(() => { - uni.redirectTo({ url: '/pages/login/login' }); - }, 1000); - } else { - this.$u.toast(res.data.msg) - } - }) - .catch(err => { - console.log('閿欒', err); - }); - }) - .catch(err => { - console.log('err', err); - uni.$u.toast('鏁堥獙澶辫触'); - }); + if(this.registerFormModel.password == this.registerFormModel.confirmPassword){ + this.$refs.regesterFormRef + .validate() + .then(res => { + console.log(this.registerFormModel); + this.registerFormModel.username = this.registerFormModel.phone; + apiRegister(this.registerFormModel) + .then(res => { + console.log(res); + if (res.data.code == 0) { + uni.showToast({ + title: '娉ㄥ唽鎴愬姛,鍗冲皢杩涘叆鐧诲綍锛�', + icon: 'none', + duration: 1000 + }); + setTimeout(() => { + uni.redirectTo({ url: '/pages/login/login' }); + }, 1000); + } else { + this.$u.toast(res.data.msg); + } + }) + .catch(err => { + console.log('閿欒', err); + }); + }) + .catch(err => { + console.log('err', err); + uni.$u.toast('璇疯鑼冭緭鍏ュ唴瀹�'); + }); + } else { + this.$u.toast('涓ゆ瀵嗙爜涓嶄竴鑷�') + } }, // 闊宠棰戦�氳瘽 // callingIn() { @@ -269,6 +287,12 @@ this.beforeChangeValue = e; } }, + jiaoYanPassword(){ + console.log('瀵嗙爜锛�',this.registerFormModel.password ,'纭瀵嗙爜锛�',this.confirmPassword); + // if(this.registerFormModel.password != this.confirmPassword){ + // this.$u.toast('涓ゆ瀵嗙爜涓嶄竴鑷�') + // } + }, // 涓婁紶鍥剧墖鏂规硶 // 鍒犻櫎鍥剧墖 deletePic(event) { @@ -288,7 +312,7 @@ }); }); for (let i = 0; i < lists.length; i++) { - const result = await this.uploadFilePromise(lists[i].url); + const result = await this.uploadFilePromise(lists[i].url, event.name); let item = this[`fileList${event.name}`][fileListLen]; this[`fileList${event.name}`].splice( fileListLen, @@ -302,19 +326,22 @@ fileListLen++; } }, - uploadFilePromise(url) { + uploadFilePromise(url, num) { return new Promise((resolve, reject) => { let a = uni.uploadFile({ - url: 'http://192.168.0.120:9999/admin/sys-file/uploadUnToken', // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧� + url: BaseUrl + '/admin/sys-file/uploadUnToken', filePath: url, name: 'file', - formData: { - user: 'test' - }, + // formData: { + // user: 'test' + // }, success: res => { - setTimeout(() => { - resolve(res.data.data); - }, 1000); + resolve(JSON.parse(res.data).data.url); + if (num == 1) { + this.registerFormModel.carImg = JSON.parse(res.data).data.url; + } else if (num == 2) { + this.registerFormModel.drivingImg = JSON.parse(res.data).data.url; + } } }); }); @@ -331,7 +358,6 @@ * @resetFields 涓嶇鐢ㄦ椂鍊欑敤涓婅竟鐨勪唬鏇� */ this.$refs.regesterFormRef.resetFields(); - this.editRoleModelShow = false; }, roleCancel() { @@ -339,17 +365,6 @@ this.$nextTick(() => { this.editRoleModelShow = false; }); - // switch (this.radiovalue1) { - // case '瀹㈡埛': - // this.radiovalue1 = ''; - // break; - // case '璐т唬': - // this.radiovalue1 = '鍙告満'; - // break; - // case '鍙告満': - // this.radiovalue1 = '璐т唬'; - // break; - // } } } }; diff --git a/store/index.js b/store/index.js index 3a8f2cb..1396e8d 100644 --- a/store/index.js +++ b/store/index.js @@ -36,7 +36,7 @@ // 鐢ㄦ埗鐣岄潰鍒ゆ柗 userInfo: {}, roleType: null, // 1瀹㈡埛锛�2璐т唬锛�3鍙告満 - userTabbar: [] // 鐢ㄦ埛鎵�鍦ㄨ鑹插簳閮ㄨ彍鍗� + userTabbar: [] ,// 鐢ㄦ埛鎵�鍦ㄨ鑹插簳閮ㄨ彍鍗曪紝 }, mutations: { setUserInfo(state, identity) { -- Gitblit v1.9.1