- 弃用 service 请求,重新设计了 request 请求方案。

- 用户信息绑定方式更改为 userInfo
This commit is contained in:
icssoa
2025-08-27 19:27:52 +08:00
parent 2bab42954a
commit d4c7467f8b
25 changed files with 222 additions and 528 deletions

View File

@@ -16,7 +16,7 @@ type PagerResponse = {
};
// 分页回调函数类型
type PagerCallback = (params: UTSJSONObject) => Promise<UTSJSONObject>;
type PagerCallback = (params: UTSJSONObject) => Promise<any>;
// 分页器类
export class Pager {
@@ -75,9 +75,6 @@ export class Pager {
this.size = pagination.size;
this.total = pagination.total;
// 更新加载完成状态
this.finished.value = this.list.value.length >= this.total;
// 更新列表数据
if (data.page == 1) {
this.list.value = [...list];
@@ -85,6 +82,9 @@ export class Pager {
this.list.value.push(...list);
}
// 更新加载完成状态
this.finished.value = this.list.value.length >= this.total;
resolve(res);
})
.catch((err) => {

View File

@@ -2,10 +2,12 @@ import { reactive } from "vue";
import { isNull } from "../utils";
// #ifdef APP
// @ts-ignore
type Instance = ComponentPublicInstance | null;
// #endif
// #ifndef APP
// @ts-ignore
type Instance = any;
// #endif

View File

@@ -1,6 +1,6 @@
import { ref } from "vue";
import { assign, getUrlParam, storage } from "../utils";
import { service } from "../service";
import { request } from "../service";
import { t } from "@/locale";
import { config } from "@/config";
@@ -62,20 +62,28 @@ export class Wx {
*/
getMpConfig() {
if (this.isWxBrowser()) {
service.user.comm
.wxMpConfig({
request({
url: "/app/user/common/wxMpConfig",
method: "POST",
data: {
url: `${location.origin}${location.pathname}`
})
.then((res) => {
}
}).then((res) => {
if (res != null) {
wx.config({
debug: config.wx.debug,
jsApiList: ["chooseWXPay"],
...res
jsApiList: res.jsApiList || ["chooseWXPay"],
appId: res.appId,
timestamp: res.timestamp,
nonceStr: res.nonceStr,
signature: res.signature,
openTagList: res.openTagList
});
// 合并配置到mpConfig
assign(this.mpConfig, res);
});
}
});
}
}