success
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import { takePhoto, TakePhotoOption, TakePhotoSuccessCallbackResult, GeneralCallbackResult } from '@/uni_modules/Skin-cameraUTS';
|
||||
const __sfc__ = defineComponent({
|
||||
data() {
|
||||
return {
|
||||
yanse: "red",
|
||||
widthNum: 750,
|
||||
heightNum: 200,
|
||||
flash: "on",
|
||||
device: "front",
|
||||
imagePath: "",
|
||||
videoPath: "https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4"
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// let permissionNeed = ["android.permission.CAMERA", "android.permission.RECORD_AUDIO",
|
||||
// "android.permission.WRITE_EXTERNAL_STORAGE"]
|
||||
// // 请求权限
|
||||
// UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _ : string[]) {
|
||||
// if (allRight) {
|
||||
// // 权限请求成功
|
||||
// } else {
|
||||
// //用户拒绝了部分权限
|
||||
// }
|
||||
// }, function (_ : boolean, _ : string[]) {
|
||||
// //用户拒绝了部分权限
|
||||
// })
|
||||
},
|
||||
methods: {
|
||||
onError(res: any) {
|
||||
console.log(res, " at pages/index/index.uvue:54");
|
||||
},
|
||||
_takePhoto() {
|
||||
takePhoto({
|
||||
success: (res: TakePhotoSuccessCallbackResult) => {
|
||||
console.log('takePhoto', res, " at pages/index/index.uvue:59");
|
||||
this.imagePath = res.tempImagePath;
|
||||
// _previewImage();
|
||||
},
|
||||
fail: (res: GeneralCallbackResult) => {
|
||||
console.log('takePhoto', res, " at pages/index/index.uvue:64");
|
||||
}
|
||||
} as TakePhotoOption);
|
||||
}
|
||||
}
|
||||
});
|
||||
export default __sfc__;
|
||||
function GenPagesIndexIndexRender(this: InstanceType<typeof __sfc__>): any | null {
|
||||
const _ctx = this;
|
||||
const _cache = this.$.renderCache;
|
||||
return _cE("scroll-view", _uM({ class: "page-scroll-view" }), [
|
||||
_cE("view", null, [
|
||||
_cE("button", _uM({ onClick: _ctx._takePhoto }), "拍照", 8 /* PROPS */, ["onClick"]),
|
||||
_cE(XfCameraComponent.name, _uM({
|
||||
style: _nS(_uM({ "height": "750rpx", "background-color": "red" })),
|
||||
onError: _ctx.onError,
|
||||
flash: _ctx.flash,
|
||||
position: _ctx.device
|
||||
}), null, 44 /* STYLE, PROPS, NEED_HYDRATION */, ["onError", "flash", "position"]),
|
||||
isTrue(_ctx.imagePath)
|
||||
? _cE("image", _uM({
|
||||
key: 0,
|
||||
mode: "aspectFit",
|
||||
src: _ctx.imagePath
|
||||
}), null, 8 /* PROPS */, ["src"])
|
||||
: _cC("v-if", true)
|
||||
])
|
||||
]);
|
||||
}
|
||||
const GenPagesIndexIndexStyles = [_uM([["video", _pS(_uM([["width", "100%"], ["height", 200]]))]])];
|
||||
import { XfCameraComponent } from '@/uni_modules/Skin-cameraUTS?uts-proxy';
|
||||
//# sourceMappingURL=index.uvue.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["pages/index/index.uvue"],"names":[],"mappings":"AAgBC,OAAO,EACN,SAAS,EACT,eAAe,EACf,8BAA8B,EAC9B,qBAAoB,EACrB,MAAO,8BAA6B,CAAA;AAGpC,MAAK,OAAQ,GAAE,eAAA,CAAA;IACd,IAAI;QACH,OAAO;YACN,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,GAAG;YACb,SAAS,EAAE,GAAG;YAEd,KAAK,EAAE,IAAI;YACX,MAAM,EAAE,OAAO;YACf,SAAS,EAAE,EAAE;YACb,SAAS,EAAE,mEAAkE;SAC9E,CAAA;IACD,CAAC;IACD,MAAM;QACL,wFAAuF;QACvF,oDAAmD;QACnD,UAAS;QACT,iIAAgI;QAChI,mBAAkB;QAClB,cAAa;QACb,YAAW;QACX,gBAAe;QACf,KAAI;QACJ,4CAA2C;QAC3C,eAAc;QACd,KAAI;IACL,CAAC;IACD,OAAO,EAAE;QACR,OAAO,CAAC,GAAE,EAAI,GAAG;YAChB,OAAO,CAAC,GAAG,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.uvue","sourcesContent":["<template>\n\n\t<scroll-view class=\"page-scroll-view\">\n\n\t\t<view>\n\t\t\t<button @click=\"_takePhoto\">拍照</button>\n\t\t\t<xf-camera style=\"height:750rpx; background-color: red;\" @error=\"onError\" :flash=\"flash\"\n\t\t\t\t:position=\"device\"></xf-camera>\n\t\t\t<image v-if=\"imagePath\" mode=\"aspectFit\" :src=\"imagePath\"></image>\n\t\t</view>\n\n\t</scroll-view>\n\n</template>\n\n<script>\n\timport {\n\t\ttakePhoto,\n\t\tTakePhotoOption,\n\t\tTakePhotoSuccessCallbackResult,\n\t\tGeneralCallbackResult\n\t} from '@/uni_modules/Skin-cameraUTS'\n\t\n\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tyanse: \"red\",\n\t\t\t\twidthNum: 750,\n\t\t\t\theightNum: 200,\n\t\t\t\t\n\t\t\t\tflash: \"on\",\n\t\t\t\tdevice: \"front\",\n\t\t\t\timagePath: \"\",\n\t\t\t\tvideoPath: \"https://qiniu-web-assets.dcloud.net.cn/unidoc/zh/2minute-demo.mp4\"\n\t\t\t}\n\t\t},\n\t\tonLoad() {\n\t\t\t// let permissionNeed = [\"android.permission.CAMERA\", \"android.permission.RECORD_AUDIO\",\n\t\t\t// \t\t\t\t\t\"android.permission.WRITE_EXTERNAL_STORAGE\"]\n\t\t\t// // 请求权限\n\t\t\t// UTSAndroid.requestSystemPermission(UTSAndroid.getUniActivity()!, permissionNeed, function (allRight : boolean, _ : string[]) {\n\t\t\t// \tif (allRight) {\n\t\t\t// \t\t// 权限请求成功\n\t\t\t// \t} else {\n\t\t\t// \t\t//用户拒绝了部分权限\n\t\t\t// \t}\n\t\t\t// }, function (_ : boolean, _ : string[]) {\n\t\t\t// \t//用户拒绝了部分权限\n\t\t\t// })\n\t\t},\n\t\tmethods: {\n\t\t\tonError(res : any) {\n\t\t\t\tconsole.log(res)\n\t\t\t},\n\t\t\t_takePhoto() {\n\t\t\t\ttakePhoto({\n\t\t\t\t\tsuccess: (res : TakePhotoSuccessCallbackResult) => {\n\t\t\t\t\t\tconsole.log('takePhoto', res)\n\t\t\t\t\t\tthis.imagePath = res.tempImagePath;\n\t\t\t\t\t\t// _previewImage();\n\t\t\t\t\t},\n\t\t\t\t\tfail: (res : GeneralCallbackResult) => {\n\t\t\t\t\t\tconsole.log('takePhoto', res)\n\t\t\t\t\t}\n\t\t\t\t} as TakePhotoOption)\n\t\t\t}\n\t\t}\n\t}\n</script>\n\n<style>\n\t.video {\n\t\twidth: 100%;\n\t\theight: 200px;\n\t}\n</style>"]}
|
||||
Reference in New Issue
Block a user