index.js 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _easycom_u_avatar2 = common_vendor.resolveComponent("u-avatar");
  5. _easycom_u_avatar2();
  6. }
  7. const _easycom_u_avatar = () => "../../node-modules/uview-plus/components/u-avatar/u-avatar.js";
  8. if (!Math) {
  9. _easycom_u_avatar();
  10. }
  11. const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  12. __name: "index",
  13. setup(__props) {
  14. var _a, _b, _c;
  15. (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
  16. (_b = common_vendor.getCurrentInstance()) == null ? void 0 : _b.appContext.config.globalProperties.$config;
  17. (_c = common_vendor.getCurrentInstance()) == null ? void 0 : _c.appContext.config.globalProperties.$apifile;
  18. common_vendor.computed(() => {
  19. return common_vendor.index.getStorageSync("openid");
  20. });
  21. const config = common_vendor.ref({ logoUrl: "" });
  22. const form = common_vendor.ref({ icon: "", city: "", sex: "", nickname: "", phone: "" });
  23. const sexList = common_vendor.ref([]);
  24. common_vendor.onLoad(async () => {
  25. await searchOther();
  26. await searchConfig();
  27. await search();
  28. common_vendor.index.$on("setCity", function(city) {
  29. form.value.city = city;
  30. });
  31. });
  32. const searchOther = async () => {
  33. };
  34. const searchConfig = async () => {
  35. config.value = common_vendor.index.getStorageSync("config");
  36. };
  37. const search = async () => {
  38. };
  39. const sexChange = (e) => {
  40. const data = sexList.value[e.detail.value];
  41. if (data)
  42. form.value.sex = data.dictLabel;
  43. };
  44. const Preview = () => {
  45. common_vendor.index.chooseImage({
  46. count: 1,
  47. sizeType: ["original", "compressed"],
  48. sourceType: ["album", "camera"],
  49. success: async function(res) {
  50. let tempFile = JSON.parse(JSON.stringify(res.tempFilePaths));
  51. console.log(tempFile);
  52. }
  53. });
  54. };
  55. const formSubmit = async (e) => {
  56. let data = e.detail.value;
  57. data.icon = form.value.icon;
  58. data = delEmptyQueryNodes(data);
  59. console.log(data);
  60. };
  61. const delEmptyQueryNodes = (obj = {}) => {
  62. Object.keys(obj).forEach((key) => {
  63. let value = obj[key];
  64. value && typeof value === "object" && delEmptyQueryNodes(value);
  65. (value === "" || value === null || value === void 0 || value.length === 0 || Object.keys(value).length === 0) && delete obj[key];
  66. });
  67. return obj;
  68. };
  69. return (_ctx, _cache) => {
  70. return common_vendor.e({
  71. a: form.value.id,
  72. b: form.value.icon
  73. }, form.value.icon ? {
  74. c: form.value.icon,
  75. d: common_vendor.o(Preview)
  76. } : {
  77. e: common_vendor.p({
  78. text: "车",
  79. fontSize: "20",
  80. randomBgColor: true,
  81. colorIndex: 0
  82. })
  83. }, {
  84. f: form.value.name,
  85. g: form.value.nickname,
  86. h: common_vendor.t(form.value.sex || "请选择性别"),
  87. i: common_vendor.o(sexChange),
  88. j: _ctx.index,
  89. k: sexList.value,
  90. l: form.value.phone,
  91. m: common_vendor.o(formSubmit)
  92. });
  93. };
  94. }
  95. });
  96. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-bf1a7b85"], ["__file", "D:/project/二手车/car_applet/pagesMy/basic/index.vue"]]);
  97. wx.createPage(MiniProgramPage);