"use strict"; const common_vendor = require("../../common/vendor.js"); const api_index = require("../../api/index.js"); if (!Array) { const _easycom_section_header_1 = common_vendor.resolveComponent("section-header"); _easycom_section_header_1(); } const _easycom_section_header = () => "../../components/section-header/section-header.js"; if (!Math) { _easycom_section_header(); } class FeatureItem extends UTS.UTSType { static get$UTSMetadata$() { return { kind: 2, get fields() { return { title: { type: String, optional: false }, desc: { type: String, optional: false } }; }, name: "FeatureItem" }; } constructor(options, metadata = FeatureItem.get$UTSMetadata$(), isJSONParse = false) { super(); this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse); this.title = this.__props__.title; this.desc = this.__props__.desc; delete this.__props__; } } class CompanyInfo extends UTS.UTSType { static get$UTSMetadata$() { return { kind: 2, get fields() { return { name: { type: String, optional: false }, slogan: { type: String, optional: false }, description: { type: String, optional: false }, phone: { type: String, optional: false }, wechat: { type: String, optional: false }, address: { type: String, optional: false }, workTime: { type: String, optional: false }, features: { type: UTS.UTSType.withGenerics(Array, [FeatureItem]), optional: false } }; }, name: "CompanyInfo" }; } constructor(options, metadata = CompanyInfo.get$UTSMetadata$(), isJSONParse = false) { super(); this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse); this.name = this.__props__.name; this.slogan = this.__props__.slogan; this.description = this.__props__.description; this.phone = this.__props__.phone; this.wechat = this.__props__.wechat; this.address = this.__props__.address; this.workTime = this.__props__.workTime; this.features = this.__props__.features; delete this.__props__; } } const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({ __name: "index", setup(__props) { const companyInfo = common_vendor.ref(new CompanyInfo({ name: "优艺家沙发翻新", slogan: "让旧沙发焕发新生", description: "", phone: "400-888-8888", wechat: "youyijia2026", address: "", workTime: "", features: [] })); const fetchCompanyInfo = () => { return common_vendor.__awaiter(this, void 0, void 0, function* () { try { const res = yield api_index.getCompanyInfo(); const data = res.data; const featuresData = data["features"]; const features = featuresData.map((item) => { return new FeatureItem({ title: item["title"], desc: item["desc"] }); }); companyInfo.value = new CompanyInfo({ name: data["name"], slogan: data["slogan"], description: data["description"], phone: data["phone"], wechat: data["wechat"], address: data["address"], workTime: data["workTime"], features }); } catch (e) { common_vendor.index.__f__("error", "at pages/about/index.uvue:148", "获取公司信息失败", e); } }); }; const callPhone = () => { common_vendor.index.makePhoneCall({ phoneNumber: companyInfo.value.phone, fail: () => { common_vendor.index.showToast({ title: "拨打电话失败", icon: "none" }); } }); }; const copyWechat = () => { common_vendor.index.setClipboardData({ data: companyInfo.value.wechat, success: () => { common_vendor.index.showToast({ title: "微信号已复制", icon: "success" }); } }); }; const openLocation = () => { common_vendor.index.openLocation({ latitude: 31.2, longitude: 121.5, name: companyInfo.value.name, address: companyInfo.value.address, fail: () => { common_vendor.index.showToast({ title: "无法打开地图", icon: "none" }); } }); }; common_vendor.onLoad(() => { fetchCompanyInfo(); }); return (_ctx, _cache) => { "raw js"; const __returned__ = { a: common_vendor.t(common_vendor.unref(companyInfo).name), b: common_vendor.t(common_vendor.unref(companyInfo).slogan), c: common_vendor.p({ title: "公司简介" }), d: common_vendor.t(common_vendor.unref(companyInfo).description), e: common_vendor.p({ title: "我们的优势" }), f: common_vendor.f(common_vendor.unref(companyInfo).features, (item, k0, i0) => { return { a: common_vendor.t(item.title), b: common_vendor.t(item.desc), c: item.title }; }), g: common_vendor.p({ title: "联系我们" }), h: common_vendor.t(common_vendor.unref(companyInfo).phone), i: common_vendor.o(callPhone), j: common_vendor.t(common_vendor.unref(companyInfo).wechat), k: common_vendor.o(copyWechat), l: common_vendor.t(common_vendor.unref(companyInfo).address), m: common_vendor.o(openLocation), n: common_vendor.t(common_vendor.unref(companyInfo).workTime), o: common_vendor.sei(common_vendor.gei(_ctx, ""), "view") }; return __returned__; }; } }); wx.createPage(_sfc_main); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/about/index.js.map