初始化参股

This commit is contained in:
2026-01-27 18:06:04 +08:00
commit 2774a539bf
254 changed files with 33255 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
"use strict";
const ENV = new UTSJSONObject(
{
// 开发环境
development: new UTSJSONObject({
baseUrl: "http://localhost:3000/api",
imageBaseUrl: "http://localhost:3000"
}),
// 生产环境
production: new UTSJSONObject({
baseUrl: "https://api.youyijia.com/api",
imageBaseUrl: "https://api.youyijia.com"
})
}
// 当前环境 - 切换为 'production' 上线
);
const getEnvConfig = () => {
return new UTSJSONObject({
baseUrl: ENV.development.baseUrl,
imageBaseUrl: ENV.development.imageBaseUrl
});
};
const PAGE_SIZE = 10;
new UTSJSONObject(
{
maxSize: 5 * 1024 * 1024,
maxCount: 9,
accept: ["image/jpeg", "image/png", "image/gif"]
}
// 缓存Key
);
const STORAGE_KEYS = new UTSJSONObject(
{
TOKEN: "user_token",
USER_INFO: "user_info",
FAVORITES: "user_favorites",
SEARCH_HISTORY: "search_history"
}
// 沙发分类
);
const SOFA_CATEGORIES = [
new UTSJSONObject({ id: "all", name: "全部" }),
new UTSJSONObject({ id: "leather", name: "皮沙发" }),
new UTSJSONObject({ id: "fabric", name: "布艺沙发" }),
new UTSJSONObject({ id: "functional", name: "功能沙发" }),
new UTSJSONObject({ id: "antique", name: "古典沙发" }),
new UTSJSONObject({ id: "office", name: "办公沙发" })
];
const SERVICE_TYPES = [
new UTSJSONObject({ id: "repair", name: "局部修复", icon: "/static/icons/repair.png" }),
new UTSJSONObject({ id: "recolor", name: "改色翻新", icon: "/static/icons/recolor.png" }),
new UTSJSONObject({ id: "refurbish", name: "整体翻新", icon: "/static/icons/refurbish.png" }),
new UTSJSONObject({ id: "custom", name: "定制换皮", icon: "/static/icons/custom.png" })
];
exports.PAGE_SIZE = PAGE_SIZE;
exports.SERVICE_TYPES = SERVICE_TYPES;
exports.SOFA_CATEGORIES = SOFA_CATEGORIES;
exports.STORAGE_KEYS = STORAGE_KEYS;
exports.getEnvConfig = getEnvConfig;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/config.js.map

View File

@@ -0,0 +1,178 @@
"use strict";
[
new UTSJSONObject({
id: "1",
image: "/static/mock/banner1.svg",
title: "专业沙发翻新服务",
link: "/pages/service/index"
}),
new UTSJSONObject({
id: "2",
image: "/static/mock/banner2.svg",
title: "十年品质保证",
link: "/pages/about/index"
}),
new UTSJSONObject({
id: "3",
image: "/static/mock/banner3.svg",
title: "免费上门评估",
link: "/pages/booking/index"
})
];
[
new UTSJSONObject({
id: "1",
title: "欧式真皮沙发翻新",
category: "leather",
categoryName: "皮沙发",
beforeImages: ["/static/mock/case1-before.svg"],
afterImages: ["/static/mock/case1-after.svg"],
coverImage: "/static/mock/case1-after.svg",
description: "这款欧式真皮沙发使用多年后出现皮面老化、褪色问题,经过我们专业的翻新处理,焕然一新。采用进口头层牛皮,色泽均匀,手感细腻。",
material: "进口头层牛皮",
duration: "7天",
price: "¥3800",
views: 1256,
likes: 89,
createTime: "2026-01-15"
}),
new UTSJSONObject({
id: "2",
title: "现代简约布艺沙发翻新",
category: "fabric",
categoryName: "布艺沙发",
beforeImages: ["/static/mock/case2-before.svg"],
afterImages: ["/static/mock/case2-after.svg"],
coverImage: "/static/mock/case2-after.svg",
description: "布艺沙发使用时间长了容易脏污、起球,这款沙发经过整体换布处理,选用高品质科技布,防水防污,易于打理。",
material: "高品质科技布",
duration: "5天",
price: "¥2200",
views: 986,
likes: 67,
createTime: "2026-01-12"
}),
new UTSJSONObject({
id: "3",
title: "美式复古沙发改色翻新",
category: "leather",
categoryName: "皮沙发",
beforeImages: ["/static/mock/case3-before.svg"],
afterImages: ["/static/mock/case3-after.svg"],
coverImage: "/static/mock/case3-after.svg",
description: "客户希望将原本深棕色的沙发改为更现代的米白色,我们采用专业改色工艺,色泽持久不脱落,触感保持柔软。",
material: "专业皮革改色",
duration: "6天",
price: "¥2800",
views: 756,
likes: 45,
createTime: "2026-01-10"
}),
new UTSJSONObject({
id: "4",
title: "功能沙发维修翻新",
category: "functional",
categoryName: "功能沙发",
beforeImages: ["/static/mock/case4-before.svg"],
afterImages: ["/static/mock/case4-after.svg"],
coverImage: "/static/mock/case4-after.svg",
description: "功能沙发的电动机构出现故障,同时皮面也有磨损。我们更换了电机和控制系统,并对皮面进行了局部修复。",
material: "原装配件+局部修复",
duration: "4天",
price: "¥1800",
views: 623,
likes: 38,
createTime: "2026-01-08"
}),
new UTSJSONObject({
id: "5",
title: "中式红木沙发垫翻新",
category: "antique",
categoryName: "古典沙发",
beforeImages: ["/static/mock/case5-before.svg"],
afterImages: ["/static/mock/case5-after.svg"],
coverImage: "/static/mock/case5-after.svg",
description: "红木沙发的坐垫和靠垫使用多年已经塌陷变形,我们重新填充高密度海绵,并更换了丝绸面料,古典韵味十足。",
material: "高密度海绵+丝绸面料",
duration: "5天",
price: "¥2500",
views: 512,
likes: 32,
createTime: "2026-01-05"
}),
new UTSJSONObject({
id: "6",
title: "办公室皮沙发组合翻新",
category: "office",
categoryName: "办公沙发",
beforeImages: ["/static/mock/case6-before.svg"],
afterImages: ["/static/mock/case6-after.svg"],
coverImage: "/static/mock/case6-after.svg",
description: "企业办公室的沙发组合整体翻新包括一套3+1+1沙发。采用耐磨商务皮革简约大气提升企业形象。",
material: "商务耐磨皮革",
duration: "10天",
price: "¥8800",
views: 445,
likes: 28,
createTime: "2026-01-02"
})
];
[
new UTSJSONObject({
step: 1,
title: "在线预约",
description: "通过小程序或电话预约上门服务",
icon: "/static/icons/step1.png"
}),
new UTSJSONObject({
step: 2,
title: "上门评估",
description: "专业师傅免费上门查看沙发状况",
icon: "/static/icons/step2.png"
}),
new UTSJSONObject({
step: 3,
title: "方案报价",
description: "根据沙发情况提供翻新方案和报价",
icon: "/static/icons/step3.png"
}),
new UTSJSONObject({
step: 4,
title: "确认订单",
description: "确认方案后签订服务合同",
icon: "/static/icons/step4.png"
}),
new UTSJSONObject({
step: 5,
title: "专业翻新",
description: "工厂或上门进行专业翻新作业",
icon: "/static/icons/step5.png"
}),
new UTSJSONObject({
step: 6,
title: "验收交付",
description: "翻新完成后客户验收,满意付款",
icon: "/static/icons/step6.png"
})
];
new UTSJSONObject(
{
name: "优艺家沙发翻新",
slogan: "让旧沙发焕发新生",
description: '优艺家是一家专业从事沙发翻新、维修、改色的服务公司,拥有十余年行业经验。我们秉承"品质至上、客户第一"的服务理念,为千家万户提供专业的沙发翻新服务。',
phone: "400-888-8888",
wechat: "youyijia2026",
address: "上海市浦东新区张江高科技园区",
workTime: "周一至周日 9:00-18:00",
features: [
new UTSJSONObject({ title: "专业团队", desc: "10年+从业经验" }),
new UTSJSONObject({ title: "品质保证", desc: "质保期内免费维护" }),
new UTSJSONObject({ title: "上门服务", desc: "免费上门评估" }),
new UTSJSONObject({ title: "价格透明", desc: "无隐形消费" })
]
}
/**
* 获取Mock数据
*/
);
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/mock.js.map

View File

@@ -0,0 +1,169 @@
"use strict";
const common_vendor = require("../common/vendor.js");
const utils_config = require("./config.js");
require("./mock.js");
class RequestOptions extends UTS.UTSType {
static get$UTSMetadata$() {
return {
kind: 2,
get fields() {
return {
url: { type: String, optional: false },
method: { type: "Unknown", optional: true },
data: { type: "Unknown", optional: true },
header: { type: "Unknown", optional: true },
showLoading: { type: Boolean, optional: true },
loadingText: { type: String, optional: true }
};
},
name: "RequestOptions"
};
}
constructor(options, metadata = RequestOptions.get$UTSMetadata$(), isJSONParse = false) {
super();
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
this.url = this.__props__.url;
this.method = this.__props__.method;
this.data = this.__props__.data;
this.header = this.__props__.header;
this.showLoading = this.__props__.showLoading;
this.loadingText = this.__props__.loadingText;
delete this.__props__;
}
}
class ResponseData extends UTS.UTSType {
static get$UTSMetadata$() {
return {
kind: 2,
get fields() {
return {
code: { type: Number, optional: false },
message: { type: String, optional: false },
data: { type: "Any", optional: false }
};
},
name: "ResponseData"
};
}
constructor(options, metadata = ResponseData.get$UTSMetadata$(), isJSONParse = false) {
super();
this.__props__ = UTS.UTSType.initProps(options, metadata, isJSONParse);
this.code = this.__props__.code;
this.message = this.__props__.message;
this.data = this.__props__.data;
delete this.__props__;
}
}
const requestInterceptor = (options) => {
const token = common_vendor.index.getStorageSync(utils_config.STORAGE_KEYS.TOKEN);
if (token != "") {
if (options.header == null) {
options.header = new UTSJSONObject({});
}
options.header["Authorization"] = `Bearer ${token}`;
}
return options;
};
const responseInterceptor = (response) => {
var _a, _b, _c;
const statusCode = response["statusCode"];
const data = response["data"];
if (statusCode == 200) {
const code = (_a = data["code"]) !== null && _a !== void 0 ? _a : 0;
if (code == 0 || code == 200) {
return new ResponseData({
code: 0,
message: "success",
data: data["data"]
});
} else if (code == 401) {
common_vendor.index.removeStorageSync(utils_config.STORAGE_KEYS.TOKEN);
common_vendor.index.showToast({
title: "请重新登录",
icon: "none"
});
return new ResponseData({
code,
message: (_b = data["message"]) !== null && _b !== void 0 ? _b : "请重新登录",
data: null
});
} else {
return new ResponseData({
code,
message: (_c = data["message"]) !== null && _c !== void 0 ? _c : "请求失败",
data: null
});
}
} else {
return new ResponseData({
code: statusCode,
message: "网络请求失败",
data: null
});
}
};
const request = (options) => {
return new Promise((resolve, reject) => {
var _b, _c;
const finalOptions = requestInterceptor(options);
if (finalOptions.showLoading == true) {
common_vendor.index.showLoading({
title: (_b = finalOptions.loadingText) !== null && _b !== void 0 ? _b : "加载中..."
});
}
const config = utils_config.getEnvConfig();
const baseUrl = config["baseUrl"];
common_vendor.index.request({
url: baseUrl + finalOptions.url,
method: (_c = finalOptions.method) !== null && _c !== void 0 ? _c : "GET",
data: finalOptions.data,
header: finalOptions.header,
success: (res) => {
if (finalOptions.showLoading == true) {
common_vendor.index.hideLoading();
}
const result = responseInterceptor(res);
if (result.code == 0) {
resolve(result);
} else {
common_vendor.index.showToast({
title: result.message,
icon: "none"
});
reject(result);
}
},
fail: (err) => {
if (finalOptions.showLoading == true) {
common_vendor.index.hideLoading();
}
common_vendor.index.showToast({
title: "网络连接失败",
icon: "none"
});
reject(new ResponseData({
code: -1,
message: "网络连接失败",
data: null
}));
}
});
});
};
const get = (url, data = null) => {
return request(new RequestOptions({
url,
method: "GET",
data
}));
};
const post = (url, data = null) => {
return request(new RequestOptions({
url,
method: "POST",
data
}));
};
exports.get = get;
exports.post = post;
//# sourceMappingURL=../../.sourcemap/mp-weixin/utils/request.js.map