From ba4baca76d4476d0bad710a7d2816a5f6909a7fc Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期二, 14 三月 2023 18:43:46 +0800 Subject: [PATCH] (微信一键登录,登录界面完善)(注册,司机上传图片接口)(提煤单详情页的优化,呼叫客服测试环境完成)(称重详情的页面,以及接口对接) --- pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue | 132 ++++++++++++++++ pages/driver-page/appointment/appointment.vue | 1 api/globalApi.js | 2 pages/login/login.vue | 160 ++++++++++++------- pages/register/register.vue | 2 pages.json | 9 + pages/tabbar-page/index-tabbar/index-tabbar.vue | 39 ++++ api/index.js | 1 pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue | 71 ++++---- pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue | 52 +++++- README.md | 4 11 files changed, 359 insertions(+), 114 deletions(-) diff --git a/README.md b/README.md index 40faa6d..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,4 +0,0 @@ -## unattended-app - -鏃犱汉鍊煎畧寰俊灏忕▼搴� - diff --git a/api/globalApi.js b/api/globalApi.js index 26744a6..9c2afe4 100644 --- a/api/globalApi.js +++ b/api/globalApi.js @@ -170,7 +170,7 @@ //鍒犻櫎鍙告満 deleteSiJi: { url: "/wrzs/wx/deleteSiJi", - method: "POST" + method: "POST", }, diff --git a/api/index.js b/api/index.js index 540f8bb..87ad6ff 100644 --- a/api/index.js +++ b/api/index.js @@ -45,6 +45,7 @@ opt.header = typeObj['headerPOST']; } else if (urlType == 'json') { opt.header = typeObj['jsonPOST']; + opt.data = params; } else { opt.data = params; opt.header = typeObj['headerPOST']; diff --git a/pages.json b/pages.json index ad35b5b..5cbe4f4 100644 --- a/pages.json +++ b/pages.json @@ -136,6 +136,15 @@ } } + ,{ + "path" : "pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice", + "style" : + { + "navigationBarTitleText": "绉伴噸", + "enablePullDownRefresh": false + } + + } ], "tabBar": { // "color": "#999794", diff --git a/pages/driver-page/appointment/appointment.vue b/pages/driver-page/appointment/appointment.vue index 15f6515..3981d85 100644 --- a/pages/driver-page/appointment/appointment.vue +++ b/pages/driver-page/appointment/appointment.vue @@ -97,7 +97,6 @@ this.rcsqData.yyId = value.id; this.rcsqData.deptId = value.deptId; this.rcsqData.filedId = value.filedId; - console.log(this.rcsqData, '鍏ュ満鐢宠璇锋眰'); this.$reqPost('saveRCSQ', this.rcsqData, 'json').then(res => { if (res.code == 0) { this.$u.toast('鏂板缓鍏ュ満鐢宠鎴愬姛銆�'); diff --git a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue index 01ac4c9..27b78fa 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/bill-of-lading-details.vue @@ -1,15 +1,17 @@ <template> <view class="bill-of-lading-details"> <view class="bangDanMessage"><text>纾呭崟淇℃伅</text></view> - <view class="timeLine" style="font-size: 16rpx;"><u-text v-for="(item, index) in dayRZ" :key="index" :text="item.taskStatusDes"></u-text></view> + <view class="timeLine" style="font-size: 16rpx;"> + <u--text type="primary" size="30" plain text="涓昏壊" v-for="(item, index) in dayRZ" :key="index" :text="item.taskStatusDes"></u--text> + </view> <view class="utilsBox"> <view class="utils_chil utils_chilTop"> - <u-button text="绛惧埌" type="primary" @click="arriveClick"></u-button> - <u-button text="鍏ュ満鐢宠" type="primary" @click="rcsqClick"></u-button> - <u-button text="鏀剧┖" type="primary"></u-button> - <u-button text="鍛煎彨瀹㈡湇" type="primary"></u-button> + <u-button text="绛惧埌" type="primary" plain @click="arriveClick"></u-button> + <u-button text="鍏ュ満鐢宠" type="primary" plain @click="rcsqClick"></u-button> + <u-button text="鏀剧┖" type="primary" plain></u-button> + <u-button text="鍛煎彨瀹㈡湇" type="primary" plain></u-button> </view> - <view class="utils_chil"><u-button text="灞曠ず鎻愮叅鍗�" @click="showCaolPickUpBill" type="primary"></u-button></view> + <view class="utils_chil"><u-button text="灞曠ず鎻愮叅鍗�" @click="showCaolPickUpBill" type="primary" ></u-button></view> <view class="utils_chil"><u-button text="涓婄璁¢噺" @click="cengZhongClick" type="primary"></u-button></view> </view> </view> @@ -34,6 +36,14 @@ onShow() { this.init(); }, + computed:{ + userName(){ + return uni.getStorageSync('username') + }, + openid(){ + return uni.getStorageSync('openid') + } + }, methods: { init() { this.coalDayPage(); @@ -46,6 +56,7 @@ } }); }, + // 灞曠ず鎻愮叅鍗曡鎯� showCaolPickUpBill() { uni.navigateTo({ url: `/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill?orderPlanId=${this.orderPlanId}` @@ -57,12 +68,27 @@ console.log(res, '绛惧埌'); }); }, + // 鍏ュ満鐢宠 rcsqClick() { uni.navigateTo({ url: `/pages/driver-page/appointment/appointment?takeCoalId=${this.orderPlanId}&type=鍏ュ満鐢宠&yyId=${this.yyId}` }); }, - cengZhongClick() {} + // 鍛煎彨瀹㈡湇 + callCustomerService(){ + wx.join1v1Chat({ + caller: { nickname:this.userName , openid: this.openid }, + listener: { nickname: '瀹㈡湇', openid: 'orutI5YT0yEvARVngdsTmBpisWmw' }, // 杩欓噷鐨刼penid鏄痜yy鐨勶紝鍏呭綋鍥哄畾鐨勫鏈峯penid + backgroundType: 2, + roomType: 'voice' + }); + }, + // 绉伴噸 + cengZhongClick() { + uni.navigateTo({ + url:`/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice?takeCoalId=${this.orderPlanId}` + }) + } /** * @desc 绛夊緟鍙栫叅鍗曟帴鍙� * */ @@ -81,7 +107,7 @@ .bangDanMessage { font-size: vww(20); font-weight: 500; - border: vww(1) solid #dddddd; + border: vww(2) solid #dddddd; border-radius: vww(20); margin: vww(20); margin-bottom: vww(10); @@ -92,12 +118,18 @@ justify-content: center; } .timeLine { + height: 45%; margin: vww(20); margin-top: vww(10); margin-bottom: vww(10); - border: vww(1) solid #dddddd; + border: vww(2) solid #dddddd; border-radius: vww(20); - flex: 2; + padding: vww(20); + box-sizing: border-box; + overflow-y: overlay; //琛屼负涓� auto 鐩稿悓锛屼絾鏄粴鍔ㄦ潯缁樺埗鍦ㄥ唴瀹逛箣涓婏紝鑰屼笉鏄崰鎹┖闂淬�� + .u-text{ + margin-bottom: vww(5)!important; + } } .utilsBox { padding: vww(20); diff --git a/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue b/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue index 0115454..286b841 100644 --- a/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue +++ b/pages/driver-page/driver-index/bill-of-lading-details/coal-pick-up-bill/coal-pick-up-bill.vue @@ -3,13 +3,13 @@ <view class="driver" style="background:url(../../../../../static/image/coalBackgroud/coal-background.png) no-repeat;background-size:100% 100%;"> <view class="driver-coalOne">鐢靛瓙鎻愮叅鍗�</view> <view class="driver-coalTwo"> - <view class="">涓滃簽鐭垮寳浜�</view> - <view class="">1/3鐒�</view> - <view class="">鍐�A37U98</view> + <view class="">{{ coalData.deptName || '鏆傛棤鎵�灞炵熆' }}</view> + <view class="">{{ coalData.coalName || '鏆傛棤鐓ょ' }}</view> + <view class="">{{ coalData.carNo || '鏆傛棤杞︾墝' }}</view> </view> <view class="driver-coalThree"> - <view class="">鏃槼鐒﹀寲鏈夐檺璐d换鍏徃</view> - <view class="">2022骞�8鏈�28鏃� 15:00:56</view> + <view class="">{{ coalData.customerName || '鏆傛棤鍗曚綅' }}</view> + <view class="">{{ coalData.yuYueTime || '鏆傛棤鏃堕棿' }}</view> </view> <view class="driver-coalFour"><image src="@/static/logo.gif" mode=""></image></view> </view> @@ -17,36 +17,40 @@ </template> <script> - export default { - onLoad(value) { - console.log('椤甸潰鍔犺浇', value); - if (value.orderPlanId) { - this.orderPlanId = value.orderPlanId; - } - }, - data() { - return { - orderPlanId: null - }; - }, - onShow() { - this.init(); - }, - methods: { - init() { - this.getTakeCoal(); - }, - // 鑾峰彇鎻愮叅鍗曡鎯� - getTakeCoal() { - this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => { - console.log('鑾峰彇鎻愮叅鍗曡鎯�', res); - }); - } - /** - * @desc 绛夊緟鍙栫叅鍗曟帴鍙� - * */ +export default { + onLoad(value) { + console.log('椤甸潰鍔犺浇', value); + if (value.orderPlanId) { + this.orderPlanId = value.orderPlanId; } + }, + data() { + return { + orderPlanId: null, + coalData: {} + }; + }, + onShow() { + this.init(); + }, + methods: { + init() { + this.getTakeCoal(); + }, + // 鑾峰彇鎻愮叅鍗曡鎯� + getTakeCoal() { + this.$reqGet('getTakeCoal', { takeCoalId: this.orderPlanId }).then(res => { + console.log('鑾峰彇鎻愮叅鍗曡鎯�', res); + if (res.code == 0) { + this.coalData = res.data[0]; + } + }); + } + /** + * @desc 绛夊緟鍙栫叅鍗曟帴鍙� + * */ } +}; </script> <style lang="scss" scoped> @@ -103,4 +107,3 @@ } } </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 new file mode 100644 index 0000000..060f670 --- /dev/null +++ b/pages/driver-page/driver-index/bill-of-lading-details/weighingDevice/weighingDevice.vue @@ -0,0 +1,132 @@ +<template> + <view class="weighingDevice"> + <view class="one"> + <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> + </view> + <view class="bottom"><text>TIP:褰撳墠鐘舵�佹甯稿彲浠ョО閲�</text></view> + </view> + <view class="two"> + <p>璁㈠崟缂栧彿锛歿{ weighList.code || '' }}</p> + <p>璁㈠崟绫诲瀷锛歿{ weighList.orderTye || '' }}</p> + <p>璁㈠崟浣欓噺锛歿{ weighList.allowance }}</p> + <p>鐨噸锛歿{ weighList.skin || '' }}</p> + <p>姣涢噸锛歿{ weighList.hair || '' }}</p> + <p>鍑�閲嶏細{{ weighList.clean || '' }}</p> + </view> + <view class="three"> + <!-- 澶栭攢璁㈠崟鎴愮毊鏃讹紝杩斿洖鍔犲噺鍚ㄦ寜閽疆鐏般�傜О姣涙椂鍙敤.澶栬喘璁㈠崟锛屼笉鍑虹幇杩斿洖鍔犲噺鍚ㄧ殑鎸夐挳 --> + <u-button type="primary" text="纭畾绉伴噸" @click="confirmWeigh"></u-button> + <u-button type="primary" text="杩斿洖鍔犲噺鍚�"></u-button> + </view> + <view class="four">濡傛偍闇�瑕佽皟鏁磋杞借揣鍝佸惃鏁帮紝璇风偣鍑昏繑鍥炲姞鍑忓惃</view> + </view> +</template> + +<script> +export default { + onLoad(params) { + console.log('绉伴噸椤甸潰', params); + this.takeCoalId = params.takeCoalId; + }, + data() { + return { + takeCoalId: null, + weighList: {} + }; + }, + onShow() { + this.init(); + }, + methods: { + init() { + // 鑾峰彇绉伴噸淇℃伅 + this.$reqGet('weighList', { id: this.takeCoalId }).then(res => { + console.log(res, '鑾峰彇绉伴噸淇℃伅'); + if (res.code == 0) { + this.weighList = res.data; + } + }); + }, + /** + * @纭绉伴噸绛夊緟鍚庣鎻愪緵瀹炴椂绉伴噸鎺ュ彛锛岃幏鍙栫毊閲嶏紝姣涢噸 + */ + confirmWeigh(){ + // this.$reqPost('saveWeigh',{id:this.takeCoalId,skin:'',hair:''}).then(res=>{ + // console.log(res,"纭绉伴噸"); + // }) + } + } +}; +</script> + +<style lang="scss" scoped> +::v-deep.weighingDevice { + width: 100%; + height: 100vh; + display: flex; + flex-direction: column; + .one { + flex: 2; + border: vww(1) solid #dddddd; + margin: vww(20) vww(20) 0 vww(20); + border-radius: vww(15); + .top { + height: 80%; + display: flex; + .top_left { + flex: 3; + font-size: vww(50); + display:flex; + align-items: center; + justify-content: center; + } + .top_right { + display:flex; + flex-direction: column; + justify-content: center; + flex: 2; + view{ + display: flex; + } + } + } + .bottom { + text-align: center; + } + } + .two { + flex: 4; + border: vww(1) solid #dddddd; + margin: vww(20); + border-radius: vww(10); + padding: vww(20); + p { + text-align: center; + font-size: vww(20); + font-weight: 500; + margin-top: vww(5); + } + } + .three { + margin: 0 auto vww(20); + flex: 0.7; + display: flex; + color: #939393; + .u-button { + &:nth-of-type(2) { + margin-left: vww(10); + } + } + } + .four { + margin: vww(10) auto; + flex: 0.5; + } +} +</style> diff --git a/pages/login/login.vue b/pages/login/login.vue index d7fe141..961779e 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,25 +1,29 @@ <template> <view class="login"> - <!-- <view class="loginBtn"> - <u-button text="寰俊涓�閿櫥褰�" type="success" shape="circle" icon="weixin-fill" @click="apiLogin"></u-button> - </view> --> - - <!--鍥介檯鍖�--> - <js-lang title="login.title" :showBtn="false"></js-lang> <view class="logo">鏃犱汉鍊煎畧</view> - <!-- 绉熸埛鍒楄〃 --> - <!-- <view class="tenantList"> - <u-input v-model="tenantId" placeholder="璇疯緭鍏ュ唴瀹�" type="select" border="true" @click="show = true" /> - <u-action-sheet :list="tenantList" v-model="show" @click="selectTenant"></u-action-sheet> - </view> --> <!--鐢ㄦ埛鍚嶅瘑鐮佺櫥褰�--> <user-password /> - - <!-- #ifdef MP --> - <view class="loginBtn"><u-button class="button" @click.stop="getUserProfile" :disabled="btnLoading" :loading="btnLoading" type="primary" text="寰俊涓�閿櫥褰�"></u-button></view> + <!-- 寰俊openid鐧诲綍 --> + <view class="loginBtn"> + <u-button class="button" @click.stop="beforeLoginEvent" :disabled="btnLoading" :loading="btnLoading" type="primary" text="寰俊涓�閿櫥褰�"></u-button> + </view> <view class="register" @click="registerClick"><text>娉ㄥ唽</text></view> - <!-- #endif --> - <view class="login-bottom-box"><view class="copyright">2023鍐�涓兘婧愭棤浜哄�煎畧寰俊灏忕▼搴�</view></view> + <view class="login-bottom-box"> + <view class="copyright">鍐�涓兘婧愭棤浜哄�煎畧寰俊灏忕▼搴�</view> + <view class="copyright">灏忕▼搴忎粎渚涘凡鎷ユ湁绯荤粺璐﹀彿鐗瑰畾鍐呴儴浜哄憳浣跨敤</view> + </view> + <!-- 寰俊鎺堟潈鍓嶇殑寮规 --> + <view class="loginPopup"> + <u-popup :show="loginPopupShow" mode="bottom" @close="closePopup" @open="openPopup" round="10" :safeAreaInsetBottom="true"> + <view class="popup-warp"> + <view class="body"><text>鏈皬绋嬪簭锛屼粎渚涘凡鎷ユ湁绯荤粺璐﹀彿鐗瑰畾鍐呴儴浜哄憳鐧诲綍浣跨敤锛岀偣鍑诲悓鎰忓嵆琛ㄧず鎮ㄥ凡鍚屾剰鐩稿簲淇℃伅鎺堟潈銆�</text></view> + <view class="btn"> + <u-button @click="loginPopupShow = false" type="error" text="涓嶅悓鎰�" shape="circle" :plain="true"></u-button> + <u-button @click="wxLogin" type="error" text="鍚屾剰" throttleTime="3000" shape="circle"></u-button> + </view> + </view> + </u-popup> + </view> </view> </template> @@ -31,19 +35,9 @@ export default { data() { return { - // wxcode: '31363631363534303739323636', // 瀹㈡埛 - // wxcode: '31363631363534303700000000', // 璐т唬1 - // wxcode: '31363631363534303700000004', // 璐т唬2 - wxcode: '31363631363534303700000001', // 鍙告満1 - // wxcode: '31363631363534303700000005', // 鍙告満2 - // wxcode: '', // 瀹㈡埛 - openid: '', - roleId: 0, - - tenantId: undefined, + wxcode: '', // 鍙告満1 btnLoading: false, - show: false, - tenantList: [] + loginPopupShow: false }; }, components: { @@ -52,51 +46,76 @@ methods: { ...mapMutations(['setUserTabbar']), // 璁块棶wx.login,鑾峰彇code - login() { - // let _this = this; + beforeLoginEvent() { + this.loginPopupShow = true; + }, + wxLogin() { // 鑾峰彇鐧诲綍鐢ㄦ埛code uni.login({ success: res => { - console.log('鐧诲綍loginRes', res); if (res.code) { this.wxcode = res.code; + this.apiLogin(); } else { uni.showToast({ title: '寰俊鐧诲綍澶辫触锛�', duration: 2000 }); } - // this.apiLogin(); } }); }, // 鐧诲綍鎺ュ彛 apiLogin() { - // console.log(this.$uStoreKey.roleType); - apiLogin2({ code: this.wxcode }) - .then(res => { - console.log('璇锋眰鐧诲綍', res); - if (res.msg == '闇�缁戝畾') { - uni.navigateTo({ - url: `/pages/register/register?code=${res.data}` - }); - } - if (res.msg == '鐧诲綍鎴愬姛') { - uni.setStorageSync('userInfo', res.data); - this.setUserTabbar(res.data.type); - uni.switchTab({ - url: '/pages/tabbar-page/index-tabbar/index-tabbar' - }); - } - }) - .catch(err => { - console.log('閿欒', err); - }); + // apiLogin2({ code: this.wxcode }) + // .then(res => { + // console.log('璇锋眰鐧诲綍', res); + // if (res.msg == '闇�缁戝畾') { + // uni.navigateTo({ + // url: `/pages/register/register?code=${res.data}` + // }); + // } + // if (res.msg == '鐧诲綍鎴愬姛') { + // uni.setStorageSync('userInfo', res.data); + // this.setUserTabbar(res.data.type); + // uni.switchTab({ + // url: '/pages/tabbar-page/index-tabbar/index-tabbar' + // }); + // } + // }) + // .catch(err => { + // console.log('閿欒', err); + // }); + + /** + * @openid + * 鑾峰彇寰俊鐢ㄦ埛openid,寰俊涓�閿櫥褰曟殏鏃犵浉鍏虫帴鍙o紝鐢ㄤ簬娴嬭瘯鍛煎彨瀹㈡湇鍔熻兘 + */ + + wx.request({ + url: `https://api.weixin.qq.com/sns/jscode2session?appid=wx30f254cbb0b90b3c&secret=938a068410796cda21e5e03b9435cdbf&js_code=${this.wxcode}&grant_type=authorization_code`, + success(res) { + let id = res.data.openid; + uni.setStorageSync('openid', id); + uni.showToast({ + title: '鎴愬姛鑾峰彇娴嬭瘯openid', + icon: 'none' + }); + } + }); + this.loginPopupShow = false }, - registerClick(){ + // 寮瑰嚭灞傛椂闂� + closePopup() { + this.loginPopupShow = false; + }, + openPopup() { + console.log('鎵撳紑浜�'); + }, + registerClick() { uni.navigateTo({ - url:"/pages/register/register" - }) + url: '/pages/register/register' + }); } } }; @@ -135,7 +154,7 @@ width: 80%; font-size: 64rpx; color: #497bff; - margin: 50rpx auto 0; + margin: vww(100) auto 0; text-align: center; } @@ -204,12 +223,29 @@ padding: 0 70rpx; } - .tenantList { - font-size: 32rpx; - width: 80%; - height: 80rpx; - text-align: center; - margin: 50rpx auto 0; + // 寮瑰嚭妗� + .loginPopup { + .u-popup { + .u-transition { + .u-popup__content { + .popup-warp { + height: vww(200); + padding: vww(10) vww(20); + .body { + width: 100%; + height: 70%; + } + .btn { + display: flex; + justify-content: space-between; + .u-button { + width: 40%; + } + } + } + } + } + } } } </style> diff --git a/pages/register/register.vue b/pages/register/register.vue index 0f1fb88..45d970d 100644 --- a/pages/register/register.vue +++ b/pages/register/register.vue @@ -305,7 +305,7 @@ uploadFilePromise(url) { return new Promise((resolve, reject) => { let a = uni.uploadFile({ - url: 'http://192.168.2.21:7001/upload', // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧� + url: 'http://192.168.0.120:9999/admin/sys-file/uploadUnToken', // 浠呬负绀轰緥锛岄潪鐪熷疄鐨勬帴鍙e湴鍧� filePath: url, name: 'file', formData: { diff --git a/pages/tabbar-page/index-tabbar/index-tabbar.vue b/pages/tabbar-page/index-tabbar/index-tabbar.vue index aa4986c..1704840 100644 --- a/pages/tabbar-page/index-tabbar/index-tabbar.vue +++ b/pages/tabbar-page/index-tabbar/index-tabbar.vue @@ -25,11 +25,11 @@ }, onShow() { this.init(); + this.userAuthorization(); }, methods: { init() { this.roleType = uni.getStorageSync('roleType'); - console.log(this.roleType, 'indexTabbar'); switch (this.roleType) { case 1: console.log('customerIndexRef'); @@ -52,6 +52,43 @@ default: break; } + }, + // 瑕佹眰鐢ㄦ埛鎺堟潈鐩告満/楹﹀厠椋庢潈闄� + userAuthorization() { + wx.getSetting({ + success(res) { + wx.startRecord(); + console.log('success'); + if (!res.authSetting['scope.record'] || !res.authSetting['scope.camera']) { + if (!res.authSetting['scope.camera']) { + wx.authorize({ + scope: 'scope.camera', + success() { + // 鐢ㄦ埛宸茬粡鍚屾剰灏忕▼搴忎娇鐢ㄥ綍闊冲姛鑳斤紝鍚庣画璋冪敤 wx.startRecord 鎺ュ彛涓嶄細寮圭獥璇㈤棶 + console.log('鎺堟潈鎴愬姛'); + }, + fail() { + console.log('鎺堟潈澶辫触'); + } + }); + } else if (!res.authSetting['scope.record']) { + wx.authorize({ + scope: 'scope.record', + success() { + // 鐢ㄦ埛宸茬粡鍚屾剰灏忕▼搴忎娇鐢ㄥ綍闊冲姛鑳斤紝鍚庣画璋冪敤 wx.startRecord 鎺ュ彛涓嶄細寮圭獥璇㈤棶 + console.log('鎺堟潈鎴愬姛'); + }, + fail: () => { + console.log('鎺堟潈澶辫触'); + } + }); + } + } + }, + fail() { + console.log('鑾峰彇澶辫触'); + } + }); } } }; -- Gitblit v1.9.1