refactor: 重构模板叠加式编译产物
This commit is contained in:
1 parent
c46297b13b
commit
25d1fe983c
93 files changed
+870
-2467
No files matched your search
@@ -0,0 +1,37 @@
|
||||
const { loadWorkspaceWithFallback } = require("../../utils/runtime-workspace");
|
||||
const { customerRequest, customerTokenKey } = require("../../utils/request");
|
||||
|
||||
Page({
|
||||
data: { brand: {}, records: [], error: "" },
|
||||
onLoad() {
|
||||
loadWorkspaceWithFallback()
|
||||
.then((workspace) => this.setData({ brand: workspace.brand || {} }))
|
||||
.catch((error) => this.setData({ error: error.message }));
|
||||
},
|
||||
onShow() {
|
||||
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.phone || this.data.brand.contactPhone || "").replace(
|
||||
/[^0-9-]/g,
|
||||
"",
|
||||
),
|
||||
});
|
||||
},
|
||||
copyWechat() {
|
||||
wx.setClipboardData({
|
||||
data: this.data.brand.wechat || this.data.brand.contactWechat || "",
|
||||
success: () => wx.showToast({ title: "微信号已复制", icon: "none" }),
|
||||
});
|
||||
},
|
||||
recordsPage() {
|
||||
wx.navigateTo({ url: "/pages/records/index" });
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"navigationBarTitleText": "主理人与我",
|
||||
"navigationBarBackgroundColor": "#FBF7F1",
|
||||
"navigationBarTextStyle": "black",
|
||||
"usingComponents": {
|
||||
"linjing-profile": "/components/templates/linjing-profile/linjing-profile"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<view class="page">
|
||||
<view wx:if="{{error}}" class="runtime-error">{{error}}</view>
|
||||
<linjing-profile wx:else brand="{{brand}}" presentation="{{brand.visualPresentation.profile}}" records-count="{{records.length}}" bind:call="call" bind:copy="copyWechat" bind:records="recordsPage" />
|
||||
</view>
|
||||
@@ -0,0 +1 @@
|
||||
/* 页面样式由林境模板组件提供。 */
|
||||
Reference in new issue
Block a user