feat: 收口多品牌与模板构建基础
This commit is contained in:
1 parent
0425a1c672
commit
77224ea51f
317 files changed
+11290
-1158
No files matched your search
@@ -1,28 +1,49 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const { customerRequest, customerTokenKey } = require("../../utils/request");
|
||||
Page({
|
||||
data: {
|
||||
brand: {},
|
||||
trustContent: [],
|
||||
records: [],
|
||||
pageRenderer: "",
|
||||
error: "",
|
||||
templateKey: "",
|
||||
navigation: [],
|
||||
},
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback().then((workspace) =>
|
||||
this.setData({
|
||||
brand: workspace.brand || {},
|
||||
trustContent: workspace.trustContent || [],
|
||||
records: wx.getStorageSync("linjingInquiryRecords") || [],
|
||||
}),
|
||||
);
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) =>
|
||||
this.setData({
|
||||
brand: workspace.brand || {},
|
||||
trustContent: workspace.trustContent || [],
|
||||
pageRenderer: workspace.pageRenderers?.profile || "",
|
||||
records: [],
|
||||
templateKey: workspace.visualTemplate?.key || "",
|
||||
navigation: workspace.navigation || [],
|
||||
}),
|
||||
)
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
onShow() {
|
||||
this.setData({ records: wx.getStorageSync("linjingInquiryRecords") || [] });
|
||||
this.loadRecords();
|
||||
},
|
||||
loadRecords() {
|
||||
if (!wx.getStorageSync(customerTokenKey())) return this.setData({ records: [] });
|
||||
customerRequest("/customer/inquiry-submissions")
|
||||
.then((records) => this.setData({ records: Array.isArray(records) ? records : [] }))
|
||||
.catch(() => this.setData({ records: [] }));
|
||||
},
|
||||
call() {
|
||||
wx.makePhoneCall({ phoneNumber: (this.data.brand.contactPhone || "").replace(/[^0-9-]/g, "") });
|
||||
wx.makePhoneCall({
|
||||
phoneNumber: (this.data.brand.phone || this.data.brand.contactPhone || "").replace(
|
||||
/[^0-9-]/g,
|
||||
"",
|
||||
),
|
||||
});
|
||||
},
|
||||
copyWechat() {
|
||||
wx.setClipboardData({
|
||||
data: this.data.brand.contactWechat || "",
|
||||
data: this.data.brand.wechat || this.data.brand.contactWechat || "",
|
||||
success: () => wx.showToast({ title: "微信号已复制", icon: "none" }),
|
||||
});
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user