yangteng 1 rok temu
rodzic
commit
f08ee8a4ed
2 zmienionych plików z 58 dodań i 7 usunięć
  1. 55
    4
      components/viewfinder.vue
  2. 3
    3
      pages/index/index.vue

+ 55
- 4
components/viewfinder.vue Wyświetl plik

} }


function takePhoto() { function takePhoto() {
// #ifdef MP-ALIPAY
const appAuthorizeSetting = my.getAppAuthorizeSetting();
console.log("---",appAuthorizeSetting,appAuthorizeSetting['cameraAuthorized']);
if(appAuthorizeSetting['cameraAuthorized']=='authorized'){
if (prop.showStartPhoto) {
let cameraContext = null
// #ifdef MP-WEIXIN
cameraContext = uni.createCameraContext();
// #endif
// #ifdef MP-ALIPAY
cameraContext = uni.createCameraContext('camera');
// #endif
// 调用拍照方法
cameraContext.takePhoto({
quality: 'normal',
success: (res : any) => {
// 在这里处理拍照成功后的逻辑,res.tempImagePath 为拍照的图片路径
// srcImg.value = res.tempImagePath
startPhoto.value = false
cameraContext.stopRecord();
emit('confirmReturn', res)
// getViewPosition(res.tempImagePath)
return
},
fail: (error) => {
console.error('拍照失败:', error);
emit('failReturn', error);
},
});
} else {
rotateDegree.value += 90
}
}else{
uni.showModal({
title: '提示',
content: '请打开摄像头权限',
success: function (res) {
if (res.confirm) {
uni.openSetting({
success(res) {
console.log("2222")
console.log(res.authSetting)
}
});
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
}
// #endif
// #ifdef MP-WEIXIN
uni.authorize({ uni.authorize({
scope: 'scope.camera', scope: 'scope.camera',
complete(res) { complete(res) {
emit('confirmReturn', res) emit('confirmReturn', res)
// getViewPosition(res.tempImagePath) // getViewPosition(res.tempImagePath)
return return
// console.log('拍照成功:', res.tempImagePath);
}, },
fail: (error) => { fail: (error) => {
console.error('拍照失败:', error); console.error('拍照失败:', error);
} }
} }
}) })

// console.log('输出内容', '===123')
// #endif


} }



+ 3
- 3
pages/index/index.vue Wyświetl plik

<view class="top_title">畅行高速·全国通行95折</view> <view class="top_title">畅行高速·全国通行95折</view>
<view class="top_bg nav"> <view class="top_bg nav">
<view class="item-box" <view class="item-box"
@click="$util.navTo('/subpackage/after-sale/activation-once-again/select-car',true)">
@click="showMask(1)">
<view class="item"> <view class="item">
<image :src="fileURL + 'image/yxb/yxb6.png'" mode="aspectFill" /> <image :src="fileURL + 'image/yxb/yxb6.png'" mode="aspectFill" />
</view> </view>
<view class="text">客车ETC</view> <view class="text">客车ETC</view>
</view> </view>
<view class="item-box"
<!-- <view class="item-box"
@click="$util.navTo('/subpackage/after-sale/activation-once-again/select-car',true)"> @click="$util.navTo('/subpackage/after-sale/activation-once-again/select-car',true)">
<view class="item "> <view class="item ">
<image :src="fileURL + 'image/yxb/yxb7.png'" mode="aspectFill" /> <image :src="fileURL + 'image/yxb/yxb7.png'" mode="aspectFill" />
</view> </view>
<view class="text">OBU重新激活</view> <view class="text">OBU重新激活</view>
</view>
</view> -->
<view class="item-box" <view class="item-box"
@click="$util.navTo('/subpackage/personal-center/install-activation-order',true)"> @click="$util.navTo('/subpackage/personal-center/install-activation-order',true)">
<view class="item"> <view class="item">

Ładowanie…
Anuluj
Zapisz