12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- "use strict";
- var common_vendor = require("../../../common/vendor.js");
- const Layout = () => "./Layout.js";
- const _sfc_main = {
- components: {
- Layout
- },
- data() {
- return {
- baseUrl: common_vendor.index.getStorageSync("requestPath"),
- statusBarHeight: common_vendor.index.getSystemInfoSync().statusBarHeight + "px",
- device: "back",
- cameraContext: null,
- shutterShow: false,
- coverImage: null,
- menuLeft: "100%"
- };
- },
- mounted() {
- common_vendor.index.getSystemInfo({
- success: (result) => {
- const menuButtonInfo = common_vendor.index.getMenuButtonBoundingClientRect();
- this.menuLeft = menuButtonInfo.left + "px";
- },
- fail: (error) => {
- console.log(error);
- }
- });
- this.cameraContext = common_vendor.index.createCameraContext();
- },
- methods: {
- switchCamera() {
- this.device = this.device === "back" ? "front" : "back";
- },
- back() {
- common_vendor.index.navigateBack();
- },
- error(err) {
- console.log(err);
- },
- takePhoto() {
- this.$emit("takePhoto");
- },
- handleInstruct(instruct) {
- switch (instruct) {
- case "back":
- this.$emit("back");
- break;
- case "shutter":
- this.cameraContext.takePhoto({
- quality: "high",
- success: (res) => {
- this.$emit("getImage", res.tempImagePath);
- }
- });
- break;
- case "reversal":
- this.device = this.device === "back" ? "front" : "back";
- break;
- case "album":
- common_vendor.index.chooseImage({
- count: 1,
- sizeType: ["original", "compressed"],
- sourceType: ["album"],
- success: (res) => {
- common_vendor.index.setStorageSync("tongueUrl", res.tempFilePaths[0]);
- this.$emit("getImage");
- }
- });
- break;
- }
- }
- }
- };
- if (!Array) {
- const _component_Layout = common_vendor.resolveComponent("Layout");
- _component_Layout();
- }
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: $data.statusBarHeight,
- b: common_vendor.o((...args) => $options.back && $options.back(...args)),
- c: $data.baseUrl + "/images/ques.png",
- d: $data.menuLeft,
- e: $data.baseUrl + "/images/tongue.png",
- f: $data.device,
- g: common_vendor.o((...args) => $options.error && $options.error(...args)),
- h: common_vendor.o($options.handleInstruct),
- i: common_vendor.o(($event) => $options.switchCamera()),
- j: common_vendor.o($options.takePhoto)
- };
- }
- var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-4814c2d2"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/components/CustomCamera/WeChat/index.vue"]]);
- wx.createComponent(Component);
|