Layout.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. "use strict";
  2. var common_vendor = require("../../../common/vendor.js");
  3. var api_healthTongue = require("../../../api/healthTongue.js");
  4. require("../../../common/request.js");
  5. const _sfc_main = {
  6. data() {
  7. return {
  8. baseUrl: common_vendor.index.getStorageSync("requestPath"),
  9. cameraHeight: "",
  10. optionsHeight: "",
  11. counts: 0,
  12. url: null
  13. };
  14. },
  15. onLoad() {
  16. this.getCount();
  17. },
  18. methods: {
  19. switchCamera() {
  20. this.$emit("switchCamera");
  21. },
  22. getCount() {
  23. api_healthTongue.getCount().then((res) => {
  24. if (res.code == 200) {
  25. this.counts = res.data;
  26. } else {
  27. common_vendor.index.showToast({
  28. icon: "none",
  29. title: "\u8BF7\u6C42\u5931\u8D25"
  30. });
  31. }
  32. }, (rej) => {
  33. });
  34. },
  35. takePhoto() {
  36. const ctx = wx.createCameraContext();
  37. console.log("ctx", ctx);
  38. ctx.takePhoto({
  39. quality: "high",
  40. success: (res) => {
  41. common_vendor.index.setStorageSync("tongueUrl", res.tempImagePath);
  42. console.log("res", res.tempImagePath);
  43. this.$emit("takePhoto");
  44. }
  45. });
  46. },
  47. handleClikFn(instruct) {
  48. this.$emit("instruct", instruct);
  49. }
  50. },
  51. mounted() {
  52. const query = common_vendor.index.createSelectorQuery().in(this);
  53. query.select("#camera-footer").boundingClientRect((data) => {
  54. this.cameraHeight = common_vendor.index.getSystemInfoSync().screenHeight - data.height;
  55. }).exec();
  56. }
  57. };
  58. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  59. return {
  60. a: $data.cameraHeight + "px",
  61. b: common_vendor.t($data.counts || 0),
  62. c: $data.baseUrl + "/images/album_icon.png",
  63. d: common_vendor.o(($event) => $options.handleClikFn("album")),
  64. e: common_vendor.o(($event) => $options.takePhoto()),
  65. f: $data.baseUrl + "/images/tongue_info.png",
  66. g: common_vendor.o(($event) => $options.handleClikFn("reportlist")),
  67. h: common_vendor.o(($event) => $options.switchCamera())
  68. };
  69. }
  70. var Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-0404ee55"], ["__file", "E:/Project/2023/\u95EE\u8BCA\u5E73\u53F0/his_user_miniapp/components/CustomCamera/WeChat/Layout.vue"]]);
  71. wx.createComponent(Component);