123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- export const getPhotograph = () => {
- uni.chooseImage({
- count: 6, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['camera ', 'album'], //从相册选择
- success: function(res) {
- console.log(JSON.stringify(res.tempFilePaths));
- }
- });
- // // #ifdef APP-PLUS
- // var appid = plus.runtime.appid;
- // console.log('应用的 appid 为:' + appid);
- // // #endif
- // // #ifdef APP
- // var cmr = plus.camera.getCamera();
- // // 属性:
- // // supportedImageResolutions: 字符串数组,摄像头支持的拍照分辨率
- // // supportedVideoResolutions: 字符串数组,摄像头支持的摄像分辨率
- // // supportedImageFormats: 字符串数组,摄像头支持的拍照文件格式
- // // supportedVideoFormats: 字符串数组,摄像头支持的摄像文件格式
- // // 方法:
- // // captureImage: 进行拍照操作
- // // startVideoCapture: 调用摄像头进行摄像操作
- // // stopVideoCapture: 结束摄像操作
- // // 拍照 captureImage
- // var res = cmr.supportedImageResolutions[0];
- // var fmt = cmr.supportedImageFormats[0];
- // console.log("Resolution: " + res + ", Format: " + fmt);
- // cmr.captureImage(function(path) {
- // console.log("Capture image success: " + path);
- // },
- // function(error) {
- // console.log("Capture image failed: " + error.message);
- // }, {
- // resolution: res,
- // format: fmt
- // }
- // )
- // // 摄像
- // // function videoCapture(){
- // // }
- // // var cmr = plus.camera.getCamera();
- // // var res = cmr.supportedVideoResolutions[0];
- // // var fmt = cmr.supportedVideoFormats[0];
- // // console.log("Resolution: " + res + ", Format: " + fmt);
- // // cmr.startVideoCapture(function(path) {
- // // console.log("Capture video success: " + path);
- // // },
- // // function(error) {
- // // console.log("Capture video failed: " + error.message);
- // // }, {
- // // resolution: res,
- // // format: fmt
- // // }
- // // );
- // // #endif
- }
- export const distanceCalculate = (num) => {
- if (num < 1000) {
- return `${num}米`
- } else {
- const n = (num / 1000).toFixed(1);
- return `${n}公里`
- };
- }
|