feat(miniprogram): add WeChat mini program plugin

This commit is contained in:
wolfkill
2026-04-27 16:08:22 +08:00
committed by lyingbug
parent d55b52652c
commit d06111e5f7
27 changed files with 705 additions and 6 deletions
+32
View File
@@ -0,0 +1,32 @@
const { getSettings, saveSettings } = require("../../utils/config");
Page({
data: {
baseUrl: "",
apiKey: ""
},
onShow() {
const settings = getSettings();
this.setData({
baseUrl: settings.baseUrl,
apiKey: settings.apiKey
});
},
onBaseUrlInput(event) {
this.setData({ baseUrl: event.detail.value });
},
onApiKeyInput(event) {
this.setData({ apiKey: event.detail.value });
},
save() {
saveSettings({
baseUrl: this.data.baseUrl,
apiKey: this.data.apiKey
});
wx.showToast({ title: "Saved", icon: "success" });
}
});
+3
View File
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "Settings"
}
+18
View File
@@ -0,0 +1,18 @@
<view class="page">
<view class="card">
<view class="title">Connect WeKnora</view>
<view class="muted">Use your WeKnora API endpoint and tenant API key.</view>
<view class="field">
<text class="label">API Base URL</text>
<input value="{{baseUrl}}" placeholder="https://your-weknora.example.com" bindinput="onBaseUrlInput" />
</view>
<view class="field">
<text class="label">API Key</text>
<input value="{{apiKey}}" password placeholder="sk-..." bindinput="onApiKeyInput" />
</view>
<button bindtap="save">Save settings</button>
</view>
</view>
+3
View File
@@ -0,0 +1,3 @@
.card {
margin-top: 40rpx;
}