wechat-mp-controller 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -0
- package/dist/index.js +26 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,4 +21,11 @@ export declare class Controller {
|
|
|
21
21
|
message: string;
|
|
22
22
|
}>;
|
|
23
23
|
getDevVersionInfos(): Promise<UploadVersionInfo[]>;
|
|
24
|
+
submitAudit(options: {
|
|
25
|
+
message: string;
|
|
26
|
+
uploaderOfTargetVersion: {
|
|
27
|
+
name: string;
|
|
28
|
+
openid: string;
|
|
29
|
+
};
|
|
30
|
+
}): Promise<void>;
|
|
24
31
|
}
|
package/dist/index.js
CHANGED
|
@@ -104,4 +104,30 @@ export class Controller {
|
|
|
104
104
|
}
|
|
105
105
|
return versionInfos;
|
|
106
106
|
}
|
|
107
|
+
async submitAudit(options) {
|
|
108
|
+
if (!this.page) {
|
|
109
|
+
throw new Error('请先进行初始化');
|
|
110
|
+
}
|
|
111
|
+
const versionManageLink = await this.page.$eval('#menuBar a[title="版本管理"]', node => node.href);
|
|
112
|
+
await this.page.goto(versionManageLink);
|
|
113
|
+
await this.page.waitForSelector('.main_bd .code_version_dev .mod_default_bd:nth-child(2) .code_version_logs .code_version_log');
|
|
114
|
+
const url = new URL(this.page.url());
|
|
115
|
+
const urlToken = url.searchParams.get('token');
|
|
116
|
+
if (!urlToken) {
|
|
117
|
+
throw new Error('获取token失败');
|
|
118
|
+
}
|
|
119
|
+
const searchParams = new URLSearchParams({
|
|
120
|
+
action: 'get_class',
|
|
121
|
+
token: urlToken,
|
|
122
|
+
lang: 'zh-CN',
|
|
123
|
+
openid: options.uploaderOfTargetVersion.openid,
|
|
124
|
+
user_name: encodeURIComponent(options.uploaderOfTargetVersion.name)
|
|
125
|
+
});
|
|
126
|
+
await this.page.goto(`https://mp.weixin.qq.com/wxamp/wadevelopcode/get_class?${searchParams.toString()}`);
|
|
127
|
+
await this.page.waitForSelector('.weui-desktop-form__control-group textarea');
|
|
128
|
+
await this.page.locator('.weui-desktop-form__control-group textarea').fill(options.message);
|
|
129
|
+
await this.page.locator('.btn.btn_primary[data-msgid="提交审核"]').click();
|
|
130
|
+
await this.page.waitForSelector('div[data-component="sumbitPage"] .main_bd *[data-msgid="已提交审核"]');
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
107
133
|
}
|