fix: 解决出码的一些问题 (#87)

* fix: 🐛 修正一些示例地址
* chore: update release scripts
* chore(release): 1.0.1
This commit is contained in:
Clarence Pan 2022-03-08 12:51:44 +08:00 committed by GitHub
parent 926136d02a
commit 4a01c97ea6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 855 additions and 1800 deletions

View File

@ -111,3 +111,7 @@ codealike.json
# types
/types
# backup files
*.bak

View File

@ -2,6 +2,32 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [1.0.1](https://github.com/alibaba/lowcode-engine/compare/@alilc/lowcode-code-generator@1.0.0...@alilc/lowcode-code-generator@1.0.1) (2022-03-08)
### Features
* 在 skeleton 增加几个方法和事件 ([a7d436a](https://github.com/alibaba/lowcode-engine/commit/a7d436a0525a0ce0c7229710077111f283b452f4))
* modify npm private control & version ([ee55d02](https://github.com/alibaba/lowcode-engine/commit/ee55d024a7f964ccf35a0efabec817364cea8041))
* modify yuque link in README ([d522034](https://github.com/alibaba/lowcode-engine/commit/d522034879d20a7b5ed12f8fe02a30662a2ea7c6))
* remove CHANGELOG.md ([b996414](https://github.com/alibaba/lowcode-engine/commit/b996414c436b5d2439c8368eb4e001cdbcd02892))
* remove module field in material-parser package.json ([6141c27](https://github.com/alibaba/lowcode-engine/commit/6141c273c9c32eea22b5374679fe625e6ea15394))
* rename build:umd ([23c7959](https://github.com/alibaba/lowcode-engine/commit/23c795931e1d5cf43e9c21cd902441c69c1ecc63))
* replace tnpm with npm ([36caf0f](https://github.com/alibaba/lowcode-engine/commit/36caf0f18980c16f7ebb82ac845ad6b33e033567))
* support UMD packageing for react-renderer ([982d0d6](https://github.com/alibaba/lowcode-engine/commit/982d0d676b3dfbfc10a2190c0040126d6925ed37))
### Bug Fixes
* 🐛 修正一些示例地址 ([8d21283](https://github.com/alibaba/lowcode-engine/commit/8d212832e77a1ec763db668683917705774acd0d))
* 兼容 setters 为空的情况 ([56b459a](https://github.com/alibaba/lowcode-engine/commit/56b459a017a8350a911ef20f0166d1e62b6390e4))
* 修复 setup 的逻辑 ([1cfb15a](https://github.com/alibaba/lowcode-engine/commit/1cfb15aebea9796af23b2135f2aa4409d81283d7))
* 修正一些对内的地址 ([07cc1f2](https://github.com/alibaba/lowcode-engine/commit/07cc1f2954530c64a1a3d260e8d532c9e19892e8))
* 增加必要的方法 ([1b38a81](https://github.com/alibaba/lowcode-engine/commit/1b38a812653656aa02100a3b1b2a581188d1b3ef))
* fix tsconfig of material-parser ([46725cb](https://github.com/alibaba/lowcode-engine/commit/46725cb9f3166912c8f5b42f1e0b1177158c1ee3))
* lint&fix auto generated types.ts ([7dde970](https://github.com/alibaba/lowcode-engine/commit/7dde9701c7960b29523abddf32421cdbac47016d))
* The outline tree does not display the loop flag when the loop is an empty array ([191e284](https://github.com/alibaba/lowcode-engine/commit/191e284f2fa190c2b3aecb4df31849b2bdc99d38))
## 1.0.0 (2022-02-17)

View File

@ -110,4 +110,4 @@ console.log(result); // 出码结果(默认是递归结构描述的,可以传
## 参与共建
欢迎参与共建,如何共建请参阅:[./CONTRIBUTING.md](https://code.aone.alibaba-inc.com/ali-lowcode/code-generator/blob/develop/CONTRIBUTING.md)
欢迎参与共建,如何共建请参阅:[./CONTRIBUTING.md](https://github.com/alibaba/lowcode-engine/blob/main/modules/code-generator/CONTRIBUTING.md)

View File

@ -87,7 +87,7 @@
"type": "fetch",
"options": {
"method": "GET",
"uri": "https://shs.alibaba-inc.com/mock/1458/demo/user",
"uri": "https://shs.xxx.com/mock/1458/demo/user",
"isSync": true
},
"dataHandler": {
@ -101,7 +101,7 @@
"type": "fetch",
"options": {
"method": "GET",
"uri": "https://shs.alibaba-inc.com/mock/1458/demo/orders",
"uri": "https://shs.xxx.com/mock/1458/demo/orders",
"isSync": true
},
"dataHandler": {
@ -245,7 +245,7 @@
],
"constants": {
"ENV": "prod",
"DOMAIN": "xxx.alibaba-inc.com"
"DOMAIN": "xxx.xxx.com"
},
"css": "body {font-size: 12px;} .table { width: 100px;}",
"config": {

View File

@ -87,7 +87,7 @@
type: 'fetch',
options: {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/user',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
},
dataHandler: {
@ -101,7 +101,7 @@
type: 'fetch',
options: {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/orders',
uri: 'https://shs.xxx.com/mock/1458/demo/orders',
isSync: true,
},
dataHandler: {
@ -245,7 +245,7 @@
],
constants: {
ENV: 'prod',
DOMAIN: 'xxx.alibaba-inc.com',
DOMAIN: 'xxx.xxx.com',
},
css: 'body {font-size: 12px;} .table { width: 100px;}',
config: {

View File

@ -1,6 +1,6 @@
{
"name": "@alilc/lowcode-code-generator",
"version": "1.0.0",
"version": "1.0.1",
"description": "出码引擎 for LowCode Engine",
"license": "MIT",
"main": "lib/index.js",
@ -42,7 +42,8 @@
"test:update-snapshots": "cross-env UPDATE_EXPECTED=true jest -u",
"analyze:standalone": "ANALYZE=true node scripts/build-standalone",
"release:beta": "standard-version -t @alilc/lowcode-code-generator\\@ --prerelease beta && git push --follow-tags && npm publish --tag beta",
"release": "standard-version -t @alilc/lowcode-code-generator\\@ && git push --follow-tags && npm publish",
"release:patch": "standard-version -t @alilc/lowcode-code-generator\\@ -r patch && git push --follow-tags && npm publish",
"release:minor": "standard-version -t @alilc/lowcode-code-generator\\@ -r minor && git push --follow-tags && npm publish",
"prepublishOnly": "npm run build",
"demo": "node bin/lowcode-code-generator.js -i example-schema.json -o demo -s icejs"
},

View File

@ -309,7 +309,7 @@ codealike.json
"type": "fetch",
"options": {
"method": "GET",
"uri": "https://shs.alibaba-inc.com/mock/1458/demo/user",
"uri": "https://shs.xxx.com/mock/1458/demo/user",
"isSync": true
},
"dataHandler": {
@ -323,7 +323,7 @@ codealike.json
"type": "fetch",
"options": {
"method": "GET",
"uri": "https://shs.alibaba-inc.com/mock/1458/demo/orders",
"uri": "https://shs.xxx.com/mock/1458/demo/orders",
"isSync": true
},
"dataHandler": {
@ -467,7 +467,7 @@ codealike.json
],
"constants": {
"ENV": "prod",
"DOMAIN": "xxx.alibaba-inc.com"
"DOMAIN": "xxx.xxx.com"
},
"css": "body {font-size: 12px;} .table { width: 100px;}",
"config": {
@ -556,7 +556,7 @@ codealike.json
"author": "",
"license": "ISC",
"publishConfig": {
"registry": "https://registry.npm.alibaba-inc.com"
"registry": "https://registry.npm.xxx.com"
},
"dependencies": {
"@alilc/lowcode-code-generator": "^1.0.0-beta.16",

View File

@ -75,7 +75,7 @@ const pluginFactory: BuilderComponentPluginFactory<unknown> = () => {
},
repository: {
type: 'git',
url: 'http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master',
url: 'http://gitlab.xxx.com/msd/leak-scan/tree/master',
},
private: true,
originTemplate: '@alifd/scaffold-lite-js',

View File

@ -16,7 +16,6 @@ export type RaxFrameworkOptions = {
/**
*
* @see https://rax.alibaba-inc.com/docs/guide/build-config
*/
buildConfig?: {
inlineStyle?: boolean | { forceEnableCSS: boolean };

View File

@ -6,8 +6,6 @@ import { JSExpression, JSFunction, isJSExpression, isJSFunction } from '@alilc/l
import { CodeGeneratorError, IScope } from '../types';
import { transformExpressionLocalRef, ParseError } from './expressionParser';
// demo: https://riddle.alibaba-inc.com/riddles/3d4c977f
function parseFunction(content: string): t.FunctionExpression | null {
try {
const ast = parser.parse(`(${content});`);

View File

@ -248,7 +248,7 @@ class Home$$Page extends Component {
options: function () {
return {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/user',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
};
},

View File

@ -78,13 +78,13 @@
id: 'urlParams',
type: 'urlParams',
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/user
// 示例数据源https://shs.xxx.com/mock/1458/demo/user
{
id: 'user',
type: 'fetch',
options: {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/user',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
},
dataHandler: {
@ -92,7 +92,7 @@
value: 'function (response) {\nif (!response.success){\n throw new Error(response.message);\n }\n return response.data;\n}',
},
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/orders
// 示例数据源https://shs.xxx.com/mock/1458/demo/orders
{
id: 'orders',
type: 'fetch',

View File

@ -133,76 +133,4 @@
spma: 'spmademo',
creator: '张三',
},
b6ExtAttrs: {
externals: [
{
name: 'moment',
jsUrl: 'https://g.alicdn.com/code/lib/moment.js/2.29.1/moment-with-locales.min.js',
},
{
name: '@alilc/b6-setters',
jsUrl: 'https://build-success.oss-cn-hangzhou.aliyuncs.com/bundle/umd-pkg/default/library/%40ali/b6-setters/0.1.15.js',
},
{
name: 'shallowequal',
jsUrl: 'https://build-success.oss-cn-hangzhou.aliyuncs.com/bundle/umd-pkg/default/library/shallowequal/1.1.0.js',
},
{
name: 'tslib',
jsUrl: 'https://build-success.oss-cn-hangzhou.aliyuncs.com/bundle/umd-pkg/default/library/tslib/2.1.0.js',
},
{
name: 'antd',
jsUrl: 'https://g.alicdn.com/code/lib/antd/3.26.15/antd-with-locales.min.js',
cssUrl: 'https://g.alicdn.com/code/lib/antd/3.26.15/antd.min.css',
},
{
name: 'lodash',
jsUrl: 'https://g.alicdn.com/code/lib/lodash.js/4.17.20/lodash.min.js',
},
],
utils: [
{
name: 'message',
type: 'npm',
content: {
package: 'antd',
version: '3.x',
destructuring: true,
exportName: 'message',
},
},
{
name: 'modal',
type: 'npm',
content: {
package: 'antd',
version: '3.x',
destructuring: true,
exportName: 'Modal',
},
},
{
name: 'legaoBuiltin',
type: 'npm',
content: {
exportName: 'legaoBuiltin',
package: '@alilc/b6-compact-legao-builtin',
version: '1.x',
},
},
{
name: 'mocks',
type: 'npm',
content: {
package: '@alilc/b6-util-mocks',
version: '1.x',
exportName: 'mocks',
destructuring: true,
},
},
],
routerType: 'memory',
routerExact: true,
},
}

View File

@ -36,7 +36,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.alibaba-inc.com" };
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
export default __$$constants;

View File

@ -70,7 +70,7 @@ class Test$$Page extends React.Component {
options: function () {
return {
method: "GET",
uri: "https://shs.alibaba-inc.com/mock/1458/demo/user",
uri: "https://shs.xxx.com/mock/1458/demo/user",
isSync: true,
};
},
@ -91,7 +91,7 @@ class Test$$Page extends React.Component {
options: function () {
return {
method: "GET",
uri: "https://shs.alibaba-inc.com/mock/1458/demo/orders",
uri: "https://shs.xxx.com/mock/1458/demo/orders",
isSync: true,
};
},

View File

@ -81,13 +81,13 @@
id: 'urlParams',
type: 'urlParams',
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/user
// 示例数据源https://shs.xxx.com/mock/1458/demo/user
{
id: 'user',
type: 'fetch',
options: {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/user',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
},
dataHandler: {
@ -95,13 +95,13 @@
value: 'function (response) {\nif (!response.data.success){\n throw new Error(response.data.message);\n }\n return response.data.data;\n}',
},
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/orders
// 示例数据源https://shs.xxx.com/mock/1458/demo/orders
{
id: 'orders',
type: 'fetch',
options: {
method: 'GET',
uri: "https://shs.alibaba-inc.com/mock/1458/demo/orders",
uri: "https://shs.xxx.com/mock/1458/demo/orders",
isSync: true,
},
dataHandler: {
@ -245,7 +245,7 @@
],
"constants": {
"ENV": "prod",
"DOMAIN": "xxx.alibaba-inc.com"
"DOMAIN": "xxx.xxx.com"
},
"css": "body {font-size: 12px;} .table { width: 100px;}",
"config": {

View File

@ -40,7 +40,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -120,76 +120,4 @@
spma: 'spmademo',
creator: '张三',
},
b6ExtAttrs: {
externals: [
{
name: 'moment',
jsUrl: 'https://g.alicdn.com/code/lib/moment.js/2.29.1/moment-with-locales.min.js',
},
{
name: '@alilc/b6-setters',
jsUrl: 'https://build-success.oss-cn-hangzhou.aliyuncs.com/bundle/umd-pkg/default/library/%40ali/b6-setters/0.1.15.js',
},
{
name: 'shallowequal',
jsUrl: 'https://build-success.oss-cn-hangzhou.aliyuncs.com/bundle/umd-pkg/default/library/shallowequal/1.1.0.js',
},
{
name: 'tslib',
jsUrl: 'https://build-success.oss-cn-hangzhou.aliyuncs.com/bundle/umd-pkg/default/library/tslib/2.1.0.js',
},
{
name: 'antd',
jsUrl: 'https://g.alicdn.com/code/lib/antd/3.26.15/antd-with-locales.min.js',
cssUrl: 'https://g.alicdn.com/code/lib/antd/3.26.15/antd.min.css',
},
{
name: 'lodash',
jsUrl: 'https://g.alicdn.com/code/lib/lodash.js/4.17.20/lodash.min.js',
},
],
utils: [
{
name: 'message',
type: 'npm',
content: {
package: 'antd',
version: '3.x',
destructuring: true,
exportName: 'message',
},
},
{
name: 'modal',
type: 'npm',
content: {
package: 'antd',
version: '3.x',
destructuring: true,
exportName: 'Modal',
},
},
{
name: 'legaoBuiltin',
type: 'npm',
content: {
exportName: 'legaoBuiltin',
package: '@alilc/b6-compact-legao-builtin',
version: '1.x',
},
},
{
name: 'mocks',
type: 'npm',
content: {
package: '@alilc/b6-util-mocks',
version: '1.x',
exportName: 'mocks',
destructuring: true,
},
},
],
routerType: 'memory',
routerExact: true,
},
}

View File

@ -36,7 +36,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.alibaba-inc.com" };
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
export default __$$constants;

View File

@ -215,7 +215,7 @@
],
"constants": {
"ENV": "prod",
"DOMAIN": "xxx.alibaba-inc.com"
"DOMAIN": "xxx.xxx.com"
},
"i18n": {
"zh-CN": {

View File

@ -36,7 +36,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.alibaba-inc.com" };
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
export default __$$constants;

View File

@ -118,7 +118,7 @@
],
"constants": {
"ENV": "prod",
"DOMAIN": "xxx.alibaba-inc.com"
"DOMAIN": "xxx.xxx.com"
},
"i18n": {
"zh-CN": {

View File

@ -37,7 +37,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -72,7 +72,7 @@ class Test$$Page extends React.Component {
isCors: true,
timeout: 5000,
headers: {},
uri: "https://mocks.alibaba-inc.com/mock/jjpin/user/list",
uri: "https://mocks.xxx.com/mock/jjpin/user/list",
};
},
id: "users",

View File

@ -78,7 +78,7 @@
"isCors": true,
"timeout": 5000,
"headers": {},
"uri": "https://mocks.alibaba-inc.com/mock/jjpin/user/list"
"uri": "https://mocks.xxx.com/mock/jjpin/user/list"
},
"id": "users"
}
@ -350,4 +350,4 @@
}
],
"i18n": {}
}
}

View File

@ -39,7 +39,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -60,128 +60,34 @@ class Test$$Page extends React.Component {
};
componentWillUnmount() {
console.log("will umount");
/* ... */
}
componentDidUpdate(prevProps, prevState, snapshot) {
console.log(this.state);
componentDidUpdate() {
/* ... */
}
onChange(optionItem, data) {
this.setState({
selectedGateway: optionItem.value,
});
fetch(
"https://oneapi.alibaba-inc.com/mock/knk1s2w7/ws/tconf/gate/publish/list/" +
optionItem.value
)
.then((res) => {
return res.json();
})
.then((resData) => {
this.setState({
records: resData.data,
});
});
onChange() {
/* ... */
}
getActions(item) {
const actions = [];
if (item.show_detail) {
actions.push({
text: "详情",
needConfirm: false,
handler: () => {
console.log("详情");
},
});
}
if (item.show_roll_back) {
actions.push({
text: "回滚到此版本",
needConfirm: false,
handler: () => {
console.log("回滚到此版本");
},
});
}
if (item.show_continue) {
actions.push({
text: "继续",
needConfirm: false,
handler: () => {
console.log("继续");
},
});
}
return actions;
getActions() {
/* ... */
}
onCreateOrder() {
if (!this.state.selectedGateway) {
alert("请先选择网关");
return;
}
this.setState({
modalVisible: true,
});
/* ... */
}
onCancelModal() {
this.setState({
modalVisible: false,
});
/* ... */
}
onConfirmCreateOrder() {
fetch(
`https://oneapi.alibaba-inc.com/mock/knk1s2w7/ws/tconf/gate/publish/app/${this.state.selectedGateway}`,
{
method: "POST",
}
)
.then((res) => {
return res.json();
})
.then((resJson) => {
console.log("create result: ", resJson);
if (resJson.result !== true) {
throw new Error(resJson.message + resJson.errdetail);
}
})
.then(() => {
console.log("创建发布单成功");
this.onCancelModal();
})
.catch((err) => {
console.error(err);
alert("创建失败");
});
/* ... */
}
componentDidMount() {
this.setState({
gateways: [
{
domain: "uniproxy.amap.com:7001",
gate_code: "auto-edd-uniproxy",
gate_status_desc: "解锁",
label: "auto-edd-uniproxy",
value: "auto-edd-uniproxy",
},
],
});
console.log("-----------", this, this.page);
setTimeout(() => {
console.log(this.state.gateways);
}, 1000);
}
componentDidMount() {}
render() {
const __$$context = this;

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.alibaba-inc.com" };
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
export default __$$constants;

View File

@ -70,7 +70,7 @@ class Test$$Page extends React.Component {
options: function () {
return {
method: "GET",
uri: "https://shs.alibaba-inc.com/mock/1458/demo/user",
uri: "https://shs.xxx.com/mock/1458/demo/user",
isSync: true,
};
},
@ -91,7 +91,7 @@ class Test$$Page extends React.Component {
options: function () {
return {
method: "GET",
uri: "https://shs.alibaba-inc.com/mock/1458/demo/orders",
uri: "https://shs.xxx.com/mock/1458/demo/orders",
isSync: true,
};
},

View File

@ -81,13 +81,13 @@
id: 'urlParams',
type: 'urlParams',
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/user
// 示例数据源https://shs.xxx.com/mock/1458/demo/user
{
id: 'user',
type: 'fetch',
options: {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/user',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
},
dataHandler: {
@ -95,13 +95,13 @@
value: 'function (response) {\nif (!response.data.success){\n throw new Error(response.data.message);\n }\n return response.data.data;\n}',
},
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/orders
// 示例数据源https://shs.xxx.com/mock/1458/demo/orders
{
id: 'orders',
type: 'fetch',
options: {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/orders',
uri: 'https://shs.xxx.com/mock/1458/demo/orders',
isSync: true,
},
dataHandler: {
@ -242,7 +242,7 @@
],
constants: {
ENV: 'prod',
DOMAIN: 'xxx.alibaba-inc.com',
DOMAIN: 'xxx.xxx.com',
},
css: 'body {font-size: 12px;} .table { width: 100px;}',
config: {

View File

@ -38,7 +38,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -87,46 +87,6 @@ class Test$$Page extends React.Component {
{ label: "X64", value: "X64" },
],
};
// customerProjectInfo: {
// id: null,
// systemProjectName: 'AR',
// projectVersionTypeArray: ['1', '2'],
// projectVersionType: '1,2',
// versionLine: 1,
// expectedTime: '2021-05-06',
// expectedNum: '5000',
// projectModal: 1,
// displayWidth: 12,
// displayHeight: 13,
// displayInch: 14,
// displayDpi: 15,
// mainSoc: 'MTK856',
// cpuCoreNum: 6,
// instructions: 'ARMv7',
// osVersion: 2,
// status: 1,
// },
// "customerProjectInfo": {
// "id": null,
// "systemProjectName": null,
// "projectVersionTypeArray": null,
// "projectVersionType": null,
// "versionLine": 2,
// "expectedTime": null,
// "expectedNum": null,
// "projectModal": 0,
// "displayWidth": null,
// "displayHeight": null,
// "displayInch": null,
// "displayDpi": null,
// "mainSoc": null,
// "cpuCoreNum": null,
// "instructions": null,
// "osVersion": 0
// "status": null,
// },
this.__jp__init();
}
$ = (refName) => {
@ -146,263 +106,39 @@ class Test$$Page extends React.Component {
componentWillUnmount() {}
__jp__init() {
this.__jp__initEnv();
this.__jp__initDataSource();
this.__jp__initRouter();
this.__jp__initUtils();
/*...*/
}
__jp__initRouter() {
if (window.arsenal) {
this.$router = new window.jianpin.ArsenalRouter({
app: this.props.microApp,
});
} else {
this.$router = new window.jianpin.ArsenalRouter();
}
/*...*/
}
__jp__initDataSource() {
//
this.$apis = {
ADD_OR_UPDATE_CUSTOMER_PROJECT: {
name: "添加或删除用户项目",
code: "ADD_OR_UPDATE_CUSTOMER_PROJECT",
url: "/customer/project/addOrUpdate",
method: "POST",
state: "customerProjectInfo",
params: {},
data: {},
dataHandler: (res) => {
console.log("res.data.data = " + JSON.stringify(res.data.data));
if (res.data.code === "200") {
this.$utils.message.success(res.data.message); //
this.setState({
isModifyStatus: false,
});
this.setState({
currentStep: 2,
});
} else {
this.$utils.message.error(res.data.message);
} //
switch (res.data.data.status) {
case 1:
this.setState({
thirdAuditText: "审核中",
thirdButtonText: "修改",
});
break;
case 2:
this.setState({
thirdAuditText: "审核未通过",
thirdButtonText: "修改",
});
break;
case 3:
case 4:
case 5:
case 6:
this.setState({
thirdAuditText: "审核通过",
thirdButtonText: "开始配置",
});
break;
}
return res.data.data;
},
},
};
this.$ds = new window.jianpin.DataSource(this, {
apiPrefix: {
dev: "http://localhost:7001/ws/autozeus",
online: "/ws/autozeus",
},
headers: {
"X-Tproxy-User-Mozi-Tid": "10005920384",
"X-Tproxy-User-Mozi-Uid": "1627124",
"X-Tproxy-User-Mozi-User": "shitao",
"X-Tproxy-User-Refer-Id": "239355",
},
});
/*...*/
}
__jp__initEnv() {
const hostname = window.location.hostname;
let env = "prod";
if (window.jianpin.env === "dev") {
env = "dev";
} else if (window.arsenalConfig) {
env = window.arsenalConfig.env;
}
const urlSearchParams = new URLSearchParams(window.location.search);
const searchParams = {};
for (const [key, value] of urlSearchParams) {
searchParams[key] = value;
}
this.$env = env;
this.$searchParams = searchParams;
/*...*/
}
__jp__initUtils() {
this.$utils = {
message: window.jianpin.utils.message,
axios: window.jianpin.utils.axios,
moment: window.jianpin.utils.moment,
};
/*...*/
}
onFinishFirst(data) {
//
console.log("first data", data);
this.setState({
//customerProjectInfo: data,
currentStep: 1,
}); // this.state.customerProjectInfo.systemProjectName = data.systemProjectName;
// this.state.customerProjectInfo.projectVersionTypeArray = data.projectVersionTypeArray;
// this.state.customerProjectInfo.projectVersionType = data.projectVersionType;
// this.state.customerProjectInfo.versionLine = data.versionLine;
// this.state.customerProjectInfo.expectedTime = data.expectedTime;
// this.state.customerProjectInfo.expectedNum = data.expectedNum;
this.setState({
customerProjectInfo: {
...this.state.customerProjectInfo,
...data, // systemProjectName: data.systemProjectName,
// projectVersionTypeArray: data.projectVersionTypeArray,
// projectVersionType: data.projectVersionType,
// versionLine: data.versionLine,
// expectedTime: data.expectedTime,
// expectedNum: data.expectedNum,
},
});
console.log("first customerProjectInfo", this.state.customerProjectInfo);
if (this.state.customerProjectInfo.id > 0 && !this.state.isModifyStatus) {
//
this.setState({
secondCommitText: "下一步",
});
} else {
//
this.setState({
secondCommitText: "完成并提交",
});
}
onFinishFirst() {
/*...*/
}
onClickPreSecond() {
//
this.setState({
currentStep: 0,
});
/*...*/
}
onFinishSecond(data) {
//
console.log("second data", data);
if (this.state.customerProjectInfo.id > 0 && !this.state.isModifyStatus) {
//
//
switch (this.state.customerProjectInfo.status) {
case 1:
this.setState({
thirdAuditText: "审核中",
thirdButtonText: "修改",
});
break;
case 2:
this.setState({
thirdAuditText: "审核未通过",
thirdButtonText: "修改",
});
break;
case 3:
case 4:
case 5:
case 6:
this.setState({
thirdAuditText: "审核通过",
thirdButtonText: "开始配置",
});
break;
}
this.setState({
currentStep: 2,
});
} else {
//
// this.setState({
// currentStep: 2,
// });
// this.state.customerProjectInfo.projectModal = data.projectModal;
// this.state.customerProjectInfo.displayWidth = data.displayWidth;
// this.state.customerProjectInfo.displayHeight = data.displayHeight;
// this.state.customerProjectInfo.displayInch = data.displayInch;
// this.state.customerProjectInfo.displayDpi = data.displayDpi;
// this.state.customerProjectInfo.mainSoc = data.mainSoc;
// this.state.customerProjectInfo.cpuCoreNum = data.cpuCoreNum;
// this.state.customerProjectInfo.instructions = data.instructions;
// this.state.customerProjectInfo.osVersion = data.osVersion;
this.setState({
customerProjectInfo: {
...this.state.customerProjectInfo,
...data, // projectModal: data.projectModal,
// displayWidth: data.displayWidth,
// displayHeight: data.displayHeight,
// displayInch: data.displayInch,
// displayDpi: data.displayDpi,
// mainSoc: data.mainSoc,
// cpuCoreNum: data.cpuCoreNum,
// instructions: data.instructions,
// osVersion: data.osVersion,
},
});
console.log("second customerProjectInfo", this.state.customerProjectInfo);
this.$ds.resolve(this.$apis.ADD_OR_UPDATE_CUSTOMER_PROJECT, {
data: this.state.customerProjectInfo,
});
}
onFinishSecond() {
/*...*/
}
onClickModifyThird() {
//
if (this.state.customerProjectInfo.status > 2) {
//2
// todo
alert("功能配置/版本管理等功能暂未上线,敬请期待");
this.$router.push("/");
} else {
//2
//
// this.setState({
// isModifyDialogVisible: true,
// isModifyStatus: true,
// });
//20210609
this.setState({
isModifyDialogVisible: false,
isModifyStatus: true,
currentStep: 0,
});
}
/*...*/
}
onOkModifyDialogThird() {

View File

@ -164,7 +164,7 @@
lifeCycles: {
constructor: {
type: 'JSFunction',
value: 'function() {\n // customerProjectInfo: {\n // id: null,\n // systemProjectName: \'锐捷AR\',\n // projectVersionTypeArray: [\'1\', \'2\'],\n // projectVersionType: \'1,2\',\n // versionLine: 1,\n // expectedTime: \'2021-05-06\',\n // expectedNum: \'5000\',\n // projectModal: 1,\n // displayWidth: 12,\n // displayHeight: 13,\n // displayInch: 14,\n // displayDpi: 15,\n // mainSoc: \'MTK856\',\n // cpuCoreNum: 6,\n // instructions: \'ARMv7\',\n // osVersion: 2,\n // status: 1,\n // },\n // "customerProjectInfo": {\n // "id": null,\n // "systemProjectName": null,\n // "projectVersionTypeArray": null,\n // "projectVersionType": null,\n // "versionLine": 2,\n // "expectedTime": null,\n // "expectedNum": null,\n // "projectModal": 0,\n // "displayWidth": null,\n // "displayHeight": null,\n // "displayInch": null,\n // "displayDpi": null,\n // "mainSoc": null,\n // "cpuCoreNum": null,\n // "instructions": null,\n // "osVersion": 0\n // "status": null,\n // },\n\n this.__jp__init();\n }',
value: "function() { /*...*/ }",
},
componentDidMount: {
type: 'JSFunction',
@ -182,39 +182,39 @@
methods: {
__jp__init: {
type: 'JSFunction',
value: 'function() {\n this.__jp__initEnv();\n this.__jp__initDataSource();\n this.__jp__initRouter();\n this.__jp__initUtils();\n}',
value: "function() { /*...*/ }",
},
__jp__initRouter: {
type: 'JSFunction',
value: 'function() {\n if (window.arsenal) {\n this.$router = new window.jianpin.ArsenalRouter({\n app: this.props.microApp,\n });\n } else {\n this.$router = new window.jianpin.ArsenalRouter();\n }\n}',
value: "function() { /*...*/ }",
},
__jp__initDataSource: {
type: 'JSFunction',
value: "function() {\n // 数据源面板存在缺陷,先用次数代码模式代替\n this.$apis = {\n ADD_OR_UPDATE_CUSTOMER_PROJECT: {\n name: '添加或删除用户项目',\n code: 'ADD_OR_UPDATE_CUSTOMER_PROJECT',\n url: '/customer/project/addOrUpdate',\n method: 'POST',\n state: 'customerProjectInfo',\n params: {},\n data: {},\n dataHandler: res => {\n console.log('res.data.data = ' + JSON.stringify(res.data.data));\n if (res.data.code === '200') {\n this.$utils.message.success(res.data.message);\n //关闭修改状态\n this.setState({\n isModifyStatus: false,\n });\n this.setState({\n currentStep: 2,\n });\n } else {\n this.$utils.message.error(res.data.message);\n }\n //修改步骤三审核的显示文本\n switch (res.data.data.status) {\n case 1:\n this.setState({\n thirdAuditText: '审核中',\n thirdButtonText: '修改',\n });\n break;\n case 2:\n this.setState({\n thirdAuditText: '审核未通过',\n thirdButtonText: '修改',\n });\n break;\n case 3:\n case 4:\n case 5:\n case 6:\n this.setState({\n thirdAuditText: '审核通过',\n thirdButtonText: '开始配置',\n });\n break;\n }\n\n return res.data.data;\n },\n },\n};\n\n this.$ds = new window.jianpin.DataSource(this,{\n apiPrefix: {\n dev: 'http://localhost:7001/ws/autozeus',\n online: '/ws/autozeus',\n },\n headers: {\n 'X-Tproxy-User-Mozi-Tid': '10005920384',\n 'X-Tproxy-User-Mozi-Uid': '1627124',\n 'X-Tproxy-User-Mozi-User': 'shitao',\n 'X-Tproxy-User-Refer-Id': '239355',\n },\n});\n }",
value: "function() { /*...*/ }",
},
__jp__initEnv: {
type: 'JSFunction',
value: "function() {\n const hostname = window.location.hostname;\n let env = 'prod';\n\n if (window.jianpin.env === 'dev') {\n env = 'dev';\n } else if (window.arsenalConfig) {\n env = window.arsenalConfig.env;\n }\n\n const urlSearchParams = new URLSearchParams(window.location.search);\n const searchParams = {};\n for (const [key, value] of urlSearchParams) {\n searchParams[key] = value;\n }\n this.$env = env;\n this.$searchParams = searchParams;\n}",
value: "function() { /*...*/ }",
},
__jp__initUtils: {
type: 'JSFunction',
value: 'function() {\n this.$utils = {\n message: window.jianpin.utils.message,\n axios: window.jianpin.utils.axios,\n moment: window.jianpin.utils.moment,\n };\n}',
value: "function() { /*...*/ }",
},
onFinishFirst: {
type: 'JSFunction',
value: "function(data) {\n //第一步 下一步\n\n console.log('first data', data);\n this.setState({\n //customerProjectInfo: data,\n currentStep: 1,\n });\n // this.state.customerProjectInfo.systemProjectName = data.systemProjectName;\n // this.state.customerProjectInfo.projectVersionTypeArray = data.projectVersionTypeArray;\n // this.state.customerProjectInfo.projectVersionType = data.projectVersionType;\n // this.state.customerProjectInfo.versionLine = data.versionLine;\n // this.state.customerProjectInfo.expectedTime = data.expectedTime;\n // this.state.customerProjectInfo.expectedNum = data.expectedNum;\n\n this.setState({\n customerProjectInfo: {\n ...this.state.customerProjectInfo,\n ...data,\n // systemProjectName: data.systemProjectName,\n // projectVersionTypeArray: data.projectVersionTypeArray,\n // projectVersionType: data.projectVersionType,\n // versionLine: data.versionLine,\n // expectedTime: data.expectedTime,\n // expectedNum: data.expectedNum,\n },\n });\n\n console.log(\n 'first customerProjectInfo',\n this.state.customerProjectInfo\n );\n\n if (\n this.state.customerProjectInfo.id > 0 &&\n !this.state.isModifyStatus\n ) {\n //按钮显示为下一步\n this.setState({\n secondCommitText: '下一步',\n });\n } else {\n //按钮显示为完成并提交\n this.setState({\n secondCommitText: '完成并提交',\n });\n }\n }",
value: "function() { /*...*/ }",
},
onClickPreSecond: {
type: 'JSFunction',
value: 'function() {\n //第二步 上一步\n\n this.setState({\n currentStep: 0,\n });\n }',
value: "function() { /*...*/ }",
},
onFinishSecond: {
type: 'JSFunction',
value: "function(data) {\n //第二步 完成并提交 下一步\n\n console.log('second data', data);\n\n if (\n this.state.customerProjectInfo.id > 0 &&\n !this.state.isModifyStatus\n ) {\n //下一步 执行的动作\n\n //修改步骤三审核的显示文本\n switch (this.state.customerProjectInfo.status) {\n case 1:\n this.setState({\n thirdAuditText: '审核中',\n thirdButtonText: '修改',\n });\n break;\n case 2:\n this.setState({\n thirdAuditText: '审核未通过',\n thirdButtonText: '修改',\n });\n break;\n case 3:\n case 4:\n case 5:\n case 6:\n this.setState({\n thirdAuditText: '审核通过',\n thirdButtonText: '开始配置',\n });\n break;\n }\n\n this.setState({\n currentStep: 2,\n });\n } else {\n // 完成并提交 执行的动作\n\n // this.setState({\n // currentStep: 2,\n // });\n\n // this.state.customerProjectInfo.projectModal = data.projectModal;\n // this.state.customerProjectInfo.displayWidth = data.displayWidth;\n // this.state.customerProjectInfo.displayHeight = data.displayHeight;\n // this.state.customerProjectInfo.displayInch = data.displayInch;\n // this.state.customerProjectInfo.displayDpi = data.displayDpi;\n // this.state.customerProjectInfo.mainSoc = data.mainSoc;\n // this.state.customerProjectInfo.cpuCoreNum = data.cpuCoreNum;\n // this.state.customerProjectInfo.instructions = data.instructions;\n // this.state.customerProjectInfo.osVersion = data.osVersion;\n\n this.setState({\n customerProjectInfo: {\n ...this.state.customerProjectInfo,\n ...data,\n // projectModal: data.projectModal,\n // displayWidth: data.displayWidth,\n // displayHeight: data.displayHeight,\n // displayInch: data.displayInch,\n // displayDpi: data.displayDpi,\n // mainSoc: data.mainSoc,\n // cpuCoreNum: data.cpuCoreNum,\n // instructions: data.instructions,\n // osVersion: data.osVersion,\n },\n });\n\n console.log(\n 'second customerProjectInfo',\n this.state.customerProjectInfo\n );\n\n this.$ds.resolve(this.$apis.ADD_OR_UPDATE_CUSTOMER_PROJECT, {\n data: this.state.customerProjectInfo,\n });\n }\n }",
value: "function() { /*...*/ }",
},
onClickModifyThird: {
type: 'JSFunction',
value: "function() {\n //第三步 修改 开始配置\n\n if (this.state.customerProjectInfo.status > 2) {\n //状态大于2说明审核通过了可以开始配置\n // todo 路由跳转\n alert('功能配置/版本管理等功能暂未上线,敬请期待');\n this.$router.push('/');\n } else {\n //状态小于2说明审核未通过了可以修改\n //置为修改状态\n // this.setState({\n // isModifyDialogVisible: true,\n // isModifyStatus: true,\n // });\n //20210609 产品修改为直接跳转到第一步,无需对话框\n this.setState({\n isModifyDialogVisible: false,\n isModifyStatus: true,\n currentStep: 0,\n });\n }\n }",
value: "function() { /*...*/ }",
},
onOkModifyDialogThird: {
type: 'JSFunction',

View File

@ -36,7 +36,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -36,7 +36,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -39,7 +39,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -80,11 +80,7 @@ class Test$$Page extends React.Component {
componentWillUnmount() {}
__jp__init() {
this.__jp__initEnv && this.__jp__initEnv();
this.__jp__initConfig && this.__jp__initConfig();
this.__jp__initDataSource && this.__jp__initDataSource();
this.__jp__initRouter && this.__jp__initRouter();
this.__jp__initUtils && this.__jp__initUtils();
/*...*/
}
__jp__initRouter() {
@ -98,103 +94,15 @@ class Test$$Page extends React.Component {
}
__jp__initDataSource() {
this.$apis = {
PKG_LIST: {
name: "打包列表",
code: "PKG_LIST",
url: "https://auto-nvwa.amap.com/cpp/api/configbuild/",
method: "GET",
dataHandler: (res) => {
console.log("debug res", res);
return res;
},
},
PROJECTS: {
name: "项目名称/渠道号",
code: "PROJECTS",
url: "http://auto-nvwa-staging.alibaba.com/ws/nvwa/cpp/select_projects/",
method: "GET",
state: "projects",
dataHandler: (res) => {
console.log("debug res", res);
return res.data.data.result.map((d) => {
const { id, channelId, project_name } = d;
return {
label: `${project_name}/${channelId}`,
value: id,
};
});
},
},
RELOAD: {
name: "重新执行",
code: "RELOAD",
url: "https://auto-nvwa.amap.com/cpp/configbuild/rebuild/",
method: "GET",
},
BUILD_RESULT: {
name: "打包结果",
code: "BUILD_RESULT",
url: "https://auto-nvwa.amap.com/cpp/api/configbuild/get_build_result/",
method: "GET",
state: "results",
dataHandler: (res) => {
return res.data.result;
},
},
};
this.$ds = new window.jianpin.DataSource(this, {});
/*...*/
}
__jp__initEnv() {
const hostname = window.location.hostname;
let env = "prod";
if (window.jianpin && window.jianpin.env === "dev") {
env = "dev";
} else if (window.arsenalConfig) {
env = window.arsenalConfig.env;
}
const urlSearchParams = new URLSearchParams(window.location.search);
const searchParams = {};
for (const [key, value] of urlSearchParams) {
searchParams[key] = value;
}
this.$env = env;
this.$searchParams = searchParams;
if (window.arsenal && window.arsenal.store) {
this.$user = window.arsenal.store.getState("user");
this.$store = window.arsenal.store;
window.arsenal.store.subscribe("user", () => {
this.$user = window.arsenal.store.getState("user");
});
} else {
this.$store = {
subscribe: () => {},
getState: () => {},
};
this.$user = this.__jp__mockUser || {};
}
/*...*/
}
__jp__initConfig() {
const __config = {
default: {},
dev: {},
daily: {},
pre: {},
prod: {},
};
this.$config = window.jianpin.utils.extend(
true,
{},
__config.default,
__config[this.$env]
);
/*...*/
}
__jp__initUtils() {
@ -205,21 +113,8 @@ class Test$$Page extends React.Component {
};
}
fetchPkgs(params) {
const { pageIndex, pageSize } = this.pageParams;
this.$ds
.resolve("PKG_LIST", {
params: { ...params, page: pageIndex, page_size: pageSize },
})
.then((res) => {
const { builds, page } = res.data;
const { num_pages, per_page } = page;
this.setState({
isSearch: true,
pkgs: builds,
total: num_pages * per_page,
});
});
fetchPkgs() {
/*...*/
}
onPageChange(pageIndex, pageSize) {
@ -238,64 +133,12 @@ class Test$$Page extends React.Component {
return user.user_name;
}
reload(id) {
if (!confirm("确实要重新执行?")) {
return;
}
this.$ds
.resolve("RELOAD", {
params: {
build_id: id,
},
})
.then((res) => {
const { code, message } = res.data.status;
if (code == 0) {
this.$utils.message.error(message);
} else {
const { pageIndex, pageSize } = this.pageParams;
this.onPageChange(pageIndex, pageSize);
}
})
.catch((err) => {
this.$utils.message.error(err.message);
});
reload() {
/*...*/
}
handleResult(e) {
// e.persist();
e.preventDefault();
e.stopPropagation();
let href;
let tagName;
let target = e.target;
do {
tagName = target.tagName.toUpperCase();
href = target.getAttribute("href");
target = target.parentNode;
} while (!href && tagName !== "TD");
if (!href) {
return;
}
this.$ds
.resolve("BUILD_RESULT", {
params: {
build_id: href,
},
})
.then((res) => {
this.setState({
resultVisible: true,
});
})
.catch((err) => {
this.$utils.message.error(`打包结果获取失败: ${err.message}`);
});
handleResult() {
/*...*/
}
handleDetail() {
@ -318,34 +161,11 @@ class Test$$Page extends React.Component {
}
handleDownload() {
const { results } = this.state;
if (!results || results.length < 1) {
return;
}
let link = document.createElement("a");
link.style.display = "none";
document.body.appendChild(link);
results.forEach((r) => {
link.href = r.download_link;
link.click();
});
document.body.removeChild(link);
link = null;
/*...*/
}
onFinish(f) {
const params = Object.keys(f).reduce((pre, key) => {
const value = f[key];
if (value === undefined) {
return pre;
}
return { ...pre, [key]: value };
}, {});
this.fetchPkgs(params);
onFinish() {
/*...*/
}
componentDidMount() {

View File

@ -191,7 +191,7 @@
methods: {
__jp__init: {
type: 'JSFunction',
value: 'function() {\n this.__jp__initEnv && this.__jp__initEnv();\n this.__jp__initConfig && this.__jp__initConfig();\n this.__jp__initDataSource && this.__jp__initDataSource();\n this.__jp__initRouter && this.__jp__initRouter();\n this.__jp__initUtils && this.__jp__initUtils();\n}',
value: 'function() { /*...*/ }',
},
__jp__initRouter: {
type: 'JSFunction',
@ -199,15 +199,15 @@
},
__jp__initDataSource: {
type: 'JSFunction',
value: "function() {\n this.$apis = {\n PKG_LIST: {\n name: '打包列表',\n code: 'PKG_LIST',\n url: 'https://auto-nvwa.amap.com/cpp/api/configbuild/',\n method: 'GET',\n dataHandler: res => {\n console.log('debug res', res);\n return res;\n },\n },\n PROJECTS: {\n name: '项目名称/渠道号',\n code: 'PROJECTS',\n url:\n 'http://auto-nvwa-staging.alibaba.com/ws/nvwa/cpp/select_projects/',\n method: 'GET',\n state: 'projects',\n dataHandler: res => {\n console.log('debug res', res);\n return res.data.data.result.map(d => {\n const { id, channelId, project_name } = d;\n return {\n label: `${project_name}/${channelId}`,\n value: id,\n };\n });\n },\n },\n RELOAD: {\n name: '重新执行',\n code: 'RELOAD',\n url: 'https://auto-nvwa.amap.com/cpp/configbuild/rebuild/',\n method: 'GET',\n },\n BUILD_RESULT: {\n name: '打包结果',\n code: 'BUILD_RESULT',\n url:\n 'https://auto-nvwa.amap.com/cpp/api/configbuild/get_build_result/',\n method: 'GET',\n state: 'results',\n dataHandler: res => {\n return res.data.result;\n },\n },\n};\n this.$ds = new window.jianpin.DataSource(this, {});\n}",
value: 'function() { /*...*/ }',
},
__jp__initEnv: {
type: 'JSFunction',
value: "function() {\n const hostname = window.location.hostname;\n let env = 'prod';\n\n if (window.jianpin && window.jianpin.env === 'dev') {\n env = 'dev';\n } else if (window.arsenalConfig) {\n env = window.arsenalConfig.env;\n }\n\n const urlSearchParams = new URLSearchParams(window.location.search);\n const searchParams = {};\n for (const [key, value] of urlSearchParams) {\n searchParams[key] = value;\n }\n this.$env = env;\n this.$searchParams = searchParams;\n\n if (window.arsenal && window.arsenal.store) {\n this.$user = window.arsenal.store.getState('user');\n this.$store = window.arsenal.store;\n window.arsenal.store.subscribe('user', () => {\n this.$user = window.arsenal.store.getState('user');\n });\n } else {\n this.$store = {\n subscribe: () => {},\n getState: () => {},\n };\n this.$user = this.__jp__mockUser || {};\n }\n}",
value: 'function() { /*...*/ }',
},
__jp__initConfig: {
type: 'JSFunction',
value: 'function() {\n const __config = {\n "default": {},\n "dev": {},\n "daily": {},\n "pre": {},\n "prod": {}\n};\n\n this.$config = window.jianpin.utils.extend(true, {}, __config.default, __config[this.$env]);\n}',
value: 'function() { /*...*/ }',
},
__jp__initUtils: {
type: 'JSFunction',
@ -215,7 +215,7 @@
},
fetchPkgs: {
type: 'JSFunction',
value: "function(params) {\n const { pageIndex, pageSize } = this.pageParams;\n this.$ds\n .resolve('PKG_LIST', {\n params: {\n ...params,\n page: pageIndex,\n page_size: pageSize,\n },\n })\n .then(res => {\n const { builds, page } = res.data;\n const { num_pages, per_page } = page;\n this.setState({\n isSearch: true,\n pkgs: builds,\n total: num_pages * per_page,\n });\n });\n }",
value: 'function() { /*...*/ }',
},
onPageChange: {
type: 'JSFunction',
@ -231,11 +231,11 @@
},
reload: {
type: 'JSFunction',
value: "function(id) {\n if (!confirm('确实要重新执行?')) {\n return;\n }\n this.$ds\n .resolve('RELOAD', {\n params: {\n build_id: id,\n },\n })\n .then(res => {\n const { code, message } = res.data.status;\n if (code == 0) {\n this.$utils.message.error(message);\n } else {\n const { pageIndex, pageSize } = this.pageParams;\n this.onPageChange(pageIndex, pageSize);\n }\n })\n .catch(err => {\n this.$utils.message.error(err.message);\n });\n }",
value: 'function() { /*...*/ }',
},
handleResult: {
type: 'JSFunction',
value: "function(e) {\n // e.persist();\n e.preventDefault();\n e.stopPropagation();\n let href;\n let tagName;\n let target = e.target;\n do {\n tagName = target.tagName.toUpperCase();\n href = target.getAttribute('href');\n target = target.parentNode;\n } while (!href && tagName !== 'TD');\n if (!href) {\n return;\n }\n\n this.$ds\n .resolve('BUILD_RESULT', {\n params: {\n build_id: href,\n },\n })\n .then(res => {\n this.setState({\n resultVisible: true,\n });\n })\n .catch(err => {\n this.$utils.message.error(`打包结果获取失败: ${err.message}`);\n });\n }",
value: 'function() { /*...*/ }',
},
handleDetail: {
type: 'JSFunction',
@ -251,11 +251,11 @@
},
handleDownload: {
type: 'JSFunction',
value: "function() {\n const { results } = this.state;\n if (!results || results.length < 1) {\n return;\n }\n let link = document.createElement('a');\n link.style.display = 'none';\n document.body.appendChild(link);\n results.forEach(r => {\n link.href = r.download_link;\n link.click();\n });\n document.body.removeChild(link);\n link = null;\n }",
value: 'function() { /*...*/ }',
},
onFinish: {
type: 'JSFunction',
value: 'function(f) {\n const params = Object.keys(f).reduce((pre, key) => {\n const value = f[key];\n if (value === undefined) {\n return pre;\n }\n return {\n ...pre,\n [key]: value,\n };\n }, {});\n this.fetchPkgs(params);\n }',
value: 'function() { /*...*/ }',
},
},
state: {

View File

@ -39,7 +39,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -88,195 +88,39 @@ class Test$$Page extends React.Component {
componentWillUnmount() {}
__jp__init() {
this.__jp__initEnv && this.__jp__initEnv();
this.__jp__initConfig && this.__jp__initConfig();
this.__jp__initDataSource && this.__jp__initDataSource();
this.__jp__initRouter && this.__jp__initRouter();
this.__jp__initUtils && this.__jp__initUtils();
/*...*/
}
__jp__initRouter() {
if (window.arsenal) {
this.$router = new window.jianpin.ArsenalRouter({
app: this.props.microApp,
});
} else {
this.$router = new window.jianpin.ArsenalRouter();
}
/*...*/
}
__jp__initDataSource() {
this.$apis = {
PKG_LIST: {
name: "打包列表",
code: "PKG_LIST",
url: "https://auto-nvwa.amap.com/ws/nvwa/cpp5x/packages/",
method: "GET",
dataHandler: (res) => res.data,
},
PROJECTS: {
name: "项目名称/渠道号",
code: "PROJECTS",
url: "http://auto-nvwa-staging.alibaba.com/ws/nvwa/cpp/select_projects/",
method: "GET",
state: "projects",
params: {
size: 5000,
},
dataHandler: (res) => {
return res.data.data.result.map((d) => {
const { id, channelId, project_name } = d;
return {
label: `${project_name} / ${channelId}`,
value: id,
};
});
},
},
RELOAD: {
name: "重新执行",
code: "RELOAD",
url: "https://auto-nvwa.amap.com/cpp/configbuild/rebuild/",
method: "GET",
},
BUILD_RESULT: {
name: "打包结果",
code: "BUILD_RESULT",
url: "https://auto-nvwa.amap.com/cpp/api/configbuild/get_build_result/",
method: "GET",
state: "results",
dataHandler: (res) => {
return res.data.result;
},
},
BUC_USER: {
name: "搜索用户",
code: "BUC_USER",
url: "https://auto-nvwa.amap.com/ws/nvwa/sso_users/",
method: "GET",
dataHandler: (res) => res.data.items,
},
};
this.$ds = new window.jianpin.DataSource(this, {});
/*...*/
}
__jp__initEnv() {
const hostname = window.location.hostname;
let env = "prod";
if (window.jianpin && window.jianpin.env === "dev") {
env = "dev";
} else if (window.arsenalConfig) {
env = window.arsenalConfig.env;
}
const urlSearchParams = new URLSearchParams(window.location.search);
const searchParams = {};
for (const [key, value] of urlSearchParams) {
searchParams[key] = value;
}
this.$env = env;
this.$searchParams = searchParams;
if (window.arsenal && window.arsenal.store) {
this.$user = window.arsenal.store.getState("user");
this.$store = window.arsenal.store;
window.arsenal.store.subscribe("user", () => {
this.$user = window.arsenal.store.getState("user");
});
} else {
this.$store = {
subscribe: () => {},
getState: () => {},
};
this.$user = this.__jp__mockUser || {};
}
/*...*/
}
__jp__initConfig() {
const __config = {
default: {},
dev: {},
daily: {},
pre: {},
prod: {},
};
this.$config = window.jianpin.utils.extend(
true,
{},
__config.default,
__config[this.$env]
);
/*...*/
}
__jp__initUtils() {
this.$utils = {
message: window.jianpin.utils.message,
axios: window.jianpin.utils.axios,
moment: window.jianpin.utils.moment,
};
/*...*/
}
setSearchItem(item) {
const searchState = this.state.searchValues;
const reducer = (pre, key) => {
let value = searchState[key];
if (item.hasOwnProperty(key)) {
value = item[key];
}
return { ...pre, [key]: value || null };
};
const searchValues = Object.keys(searchState).reduce(reducer, {});
this.setState({
searchValues,
});
setSearchItem() {
/*...*/
}
fetchProject(value, callback) {
if (this.projectTimeout) {
clearTimeout(this.projectTimeout);
this.projectTimeout = null;
}
this.currentProject = value;
const fake = () => {
this.$ds
.resolve("PROJECTS", {
params: {
search_param: value,
},
})
.then((res) => {
if (this.currentProject !== value) {
return;
}
callback(res || []);
});
};
this.projectTimeout = setTimeout(fake, 300);
fetchProject() {
/*...*/
}
handleProjectSearch(value) {
if (value) {
this.fetchProject(value, (projects) => {
this.setState({
projects,
});
});
} else {
this.setState({
projects: [],
});
}
handleProjectSearch() {
/*...*/
}
handleProjectChange(id) {
@ -285,49 +129,12 @@ class Test$$Page extends React.Component {
});
}
fetchUser(value, callback) {
if (this.userTimeout) {
clearTimeout(this.userTimeout);
this.userTimeout = null;
}
this.currentUser = value;
const fake = () => {
this.$ds
.resolve("BUC_USER", {
params: {
q: value,
},
})
.then((res) => {
if (this.currentUser !== value) {
return;
}
const data = res.slice(0, 8).map((r) => ({
label: `${r.id} / ${r.label}`,
value: r.id,
}));
callback(data);
});
};
this.userTimeout = setTimeout(fake, 300);
fetchUser() {
/*...*/
}
handleUserSearch(value) {
if (value) {
this.fetchUser(value, (userOptions) => {
this.setState({
userOptions,
});
});
} else {
this.setState({
userOptions: [],
});
}
handleUserSearch() {
/*...*/
}
handleUserChange(user) {
@ -338,20 +145,7 @@ class Test$$Page extends React.Component {
}
fetchPkgs() {
const { pageIndex, pageSize } = this.pageParams;
this.$ds
.resolve("PKG_LIST", {
params: { ...this.searchParams, page: pageIndex, size: pageSize },
})
.then((res) => {
const { result, page } = res.data;
const { count } = page;
this.setState({
isSearch: true,
pkgs: result,
total: count,
});
});
/*...*/
}
onPageChange(pageIndex, pageSize) {
@ -370,115 +164,32 @@ class Test$$Page extends React.Component {
return user.user_name;
}
reload(id) {
if (!confirm("确实要重新执行?")) {
return;
}
this.$ds
.resolve("RELOAD", {
params: {
build_id: id,
},
})
.then((res) => {
const { code, message } = res.data.status;
if (code == 0) {
this.$utils.message.error(message);
} else {
const { pageIndex, pageSize } = this.pageParams;
this.onPageChange(pageIndex, pageSize);
}
})
.catch((err) => {
this.$utils.message.error(err.message);
});
reload() {
/*...*/
}
handleResult(e) {
// e.persist();
e.preventDefault();
e.stopPropagation();
let href;
let tagName;
let target = e.target;
do {
tagName = target.tagName.toUpperCase();
href = target.getAttribute("href");
target = target.parentNode;
} while (!href && tagName !== "TD");
if (!href) {
return;
}
this.$ds
.resolve("BUILD_RESULT", {
params: {
build_id: href,
},
})
.then((res) => {
this.setState({
resultVisible: true,
});
})
.catch((err) => {
this.$utils.message.error(`打包结果获取失败: ${err.message}`);
});
handleResult() {
/*...*/
}
handleDetail() {
// TODO
/*...*/
}
onResultCancel() {
this.setState({
resultVisible: false,
});
/*...*/
}
formatResult(item) {
if (!item) {
return "暂无结果";
}
const { channel, plat, version, status } = item;
return [channel, plat, version, status].join("-");
formatResult() {
/*...*/
}
handleDownload() {
const { results } = this.state;
if (!results || results.length < 1) {
return;
}
let link = document.createElement("a");
link.style.display = "none";
document.body.appendChild(link);
results.forEach((r) => {
link.href = r.download_link;
link.click();
});
document.body.removeChild(link);
link = null;
/*...*/
}
onFinish(f) {
const params = Object.keys(f).reduce((pre, key) => {
const value = f[key];
if (value === undefined) {
return pre;
}
return { ...pre, [key]: value };
}, {});
this.searchParams = params;
this.fetchPkgs();
onFinish() {
/*...*/
}
componentDidMount() {

View File

@ -191,39 +191,39 @@
methods: {
__jp__init: {
type: 'JSFunction',
value: 'function() {\n this.__jp__initEnv && this.__jp__initEnv();\n this.__jp__initConfig && this.__jp__initConfig();\n this.__jp__initDataSource && this.__jp__initDataSource();\n this.__jp__initRouter && this.__jp__initRouter();\n this.__jp__initUtils && this.__jp__initUtils();\n}',
value: 'function() { /*...*/ }',
},
__jp__initRouter: {
type: 'JSFunction',
value: 'function() {\n if (window.arsenal) {\n this.$router = new window.jianpin.ArsenalRouter({\n app: this.props.microApp,\n });\n } else {\n this.$router = new window.jianpin.ArsenalRouter();\n }\n}',
value: 'function() { /*...*/ }',
},
__jp__initDataSource: {
type: 'JSFunction',
value: "function() {\n this.$apis = {\n PKG_LIST: {\n name: '打包列表',\n code: 'PKG_LIST',\n url: 'https://auto-nvwa.amap.com/ws/nvwa/cpp5x/packages/',\n method: 'GET',\n dataHandler: res => res.data,\n },\n PROJECTS: {\n name: '项目名称/渠道号',\n code: 'PROJECTS',\n url:\n 'http://auto-nvwa-staging.alibaba.com/ws/nvwa/cpp/select_projects/',\n method: 'GET',\n state: 'projects',\n params: {\n size: 5000,\n },\n dataHandler: res => {\n return res.data.data.result.map(d => {\n const { id, channelId, project_name } = d;\n return {\n label: `${project_name} / ${channelId}`,\n value: id,\n };\n });\n },\n },\n RELOAD: {\n name: '重新执行',\n code: 'RELOAD',\n url: 'https://auto-nvwa.amap.com/cpp/configbuild/rebuild/',\n method: 'GET',\n },\n BUILD_RESULT: {\n name: '打包结果',\n code: 'BUILD_RESULT',\n url:\n 'https://auto-nvwa.amap.com/cpp/api/configbuild/get_build_result/',\n method: 'GET',\n state: 'results',\n dataHandler: res => {\n return res.data.result;\n },\n },\n BUC_USER: {\n name: '搜索用户',\n code: 'BUC_USER',\n url: 'https://auto-nvwa.amap.com/ws/nvwa/sso_users/',\n method: 'GET',\n dataHandler: res => res.data.items,\n },\n};\n this.$ds = new window.jianpin.DataSource(this, {});\n}",
value: 'function() { /*...*/ }',
},
__jp__initEnv: {
type: 'JSFunction',
value: "function() {\n const hostname = window.location.hostname;\n let env = 'prod';\n\n if (window.jianpin && window.jianpin.env === 'dev') {\n env = 'dev';\n } else if (window.arsenalConfig) {\n env = window.arsenalConfig.env;\n }\n\n const urlSearchParams = new URLSearchParams(window.location.search);\n const searchParams = {};\n for (const [key, value] of urlSearchParams) {\n searchParams[key] = value;\n }\n this.$env = env;\n this.$searchParams = searchParams;\n\n if (window.arsenal && window.arsenal.store) {\n this.$user = window.arsenal.store.getState('user');\n this.$store = window.arsenal.store;\n window.arsenal.store.subscribe('user', () => {\n this.$user = window.arsenal.store.getState('user');\n });\n } else {\n this.$store = {\n subscribe: () => {},\n getState: () => {},\n };\n this.$user = this.__jp__mockUser || {};\n }\n}",
value: 'function() { /*...*/ }',
},
__jp__initConfig: {
type: 'JSFunction',
value: 'function() {\n const __config = {\n "default": {},\n "dev": {},\n "daily": {},\n "pre": {},\n "prod": {}\n};\n\n this.$config = window.jianpin.utils.extend(true, {}, __config.default, __config[this.$env]);\n}',
value: 'function() { /*...*/ }',
},
__jp__initUtils: {
type: 'JSFunction',
value: 'function() {\n this.$utils = {\n message: window.jianpin.utils.message,\n axios: window.jianpin.utils.axios,\n moment: window.jianpin.utils.moment,\n };\n}',
value: 'function() { /*...*/ }',
},
setSearchItem: {
type: 'JSFunction',
value: 'function(item) {\n const searchState = this.state.searchValues;\n const reducer = (pre, key) => {\n let value = searchState[key];\n if (item.hasOwnProperty(key)) {\n value = item[key];\n }\n return {\n ...pre,\n [key]: value || null,\n };\n };\n const searchValues = Object.keys(searchState).reduce(reducer, {});\n this.setState({\n searchValues,\n });\n }',
value: 'function() { /*...*/ }',
},
fetchProject: {
type: 'JSFunction',
value: "function(value, callback) {\n if (this.projectTimeout) {\n clearTimeout(this.projectTimeout);\n this.projectTimeout = null;\n }\n this.currentProject = value;\n\n const fake = () => {\n this.$ds\n .resolve('PROJECTS', {\n params: { search_param: value },\n })\n .then(res => {\n if (this.currentProject !== value) {\n return;\n }\n callback(res || []);\n });\n };\n this.projectTimeout = setTimeout(fake, 300);\n }",
value: 'function() { /*...*/ }',
},
handleProjectSearch: {
type: 'JSFunction',
value: 'function(value) {\n if (value) {\n this.fetchProject(value, projects => {\n this.setState({ projects });\n });\n } else {\n this.setState({ projects: [] });\n }\n }',
value: 'function() { /*...*/ }',
},
handleProjectChange: {
type: 'JSFunction',
@ -231,11 +231,11 @@
},
fetchUser: {
type: 'JSFunction',
value: "function(value, callback) {\n if (this.userTimeout) {\n clearTimeout(this.userTimeout);\n this.userTimeout = null;\n }\n this.currentUser = value;\n\n const fake = () => {\n this.$ds\n .resolve('BUC_USER', {\n params: { q: value },\n })\n .then(res => {\n if (this.currentUser !== value) {\n return;\n }\n const data = res.slice(0, 8).map(r => ({\n label: `${r.id} / ${r.label}`,\n value: r.id,\n }));\n callback(data);\n });\n };\n this.userTimeout = setTimeout(fake, 300);\n }",
value: 'function() { /*...*/ }',
},
handleUserSearch: {
type: 'JSFunction',
value: 'function(value) {\n if (value) {\n this.fetchUser(value, userOptions => {\n this.setState({ userOptions });\n });\n } else {\n this.setState({ userOptions: [] });\n }\n }',
value: 'function() { /*...*/ }',
},
handleUserChange: {
type: 'JSFunction',
@ -243,7 +243,7 @@
},
fetchPkgs: {
type: 'JSFunction',
value: "function() {\n const { pageIndex, pageSize } = this.pageParams;\n this.$ds\n .resolve('PKG_LIST', {\n params: {\n ...this.searchParams,\n page: pageIndex,\n size: pageSize,\n },\n })\n .then(res => {\n const { result, page } = res.data;\n const { count } = page;\n this.setState({\n isSearch: true,\n pkgs: result,\n total: count,\n });\n });\n }",
value: 'function() { /*...*/ }',
},
onPageChange: {
type: 'JSFunction',
@ -259,31 +259,31 @@
},
reload: {
type: 'JSFunction',
value: "function(id) {\n if (!confirm('确实要重新执行?')) {\n return;\n }\n this.$ds\n .resolve('RELOAD', {\n params: {\n build_id: id,\n },\n })\n .then(res => {\n const { code, message } = res.data.status;\n if (code == 0) {\n this.$utils.message.error(message);\n } else {\n const { pageIndex, pageSize } = this.pageParams;\n this.onPageChange(pageIndex, pageSize);\n }\n })\n .catch(err => {\n this.$utils.message.error(err.message);\n });\n }",
value: 'function() { /*...*/ }',
},
handleResult: {
type: 'JSFunction',
value: "function(e) {\n // e.persist();\n e.preventDefault();\n e.stopPropagation();\n let href;\n let tagName;\n let target = e.target;\n do {\n tagName = target.tagName.toUpperCase();\n href = target.getAttribute('href');\n target = target.parentNode;\n } while (!href && tagName !== 'TD');\n if (!href) {\n return;\n }\n\n this.$ds\n .resolve('BUILD_RESULT', {\n params: {\n build_id: href,\n },\n })\n .then(res => {\n this.setState({\n resultVisible: true,\n });\n })\n .catch(err => {\n this.$utils.message.error(`打包结果获取失败: ${err.message}`);\n });\n }",
value: 'function() { /*...*/ }',
},
handleDetail: {
type: 'JSFunction',
value: 'function() {\n // 跳转详情页面 TODO\n }',
value: 'function() { /*...*/ }',
},
onResultCancel: {
type: 'JSFunction',
value: 'function() {\n this.setState({\n resultVisible: false,\n });\n }',
value: 'function() { /*...*/ }',
},
formatResult: {
type: 'JSFunction',
value: "function(item) {\n if (!item) {\n return '暂无结果';\n }\n const { channel, plat, version, status } = item;\n return [channel, plat, version, status].join('-');\n }",
value: 'function() { /*...*/ }',
},
handleDownload: {
type: 'JSFunction',
value: "function() {\n const { results } = this.state;\n if (!results || results.length < 1) {\n return;\n }\n let link = document.createElement('a');\n link.style.display = 'none';\n document.body.appendChild(link);\n results.forEach(r => {\n link.href = r.download_link;\n link.click();\n });\n document.body.removeChild(link);\n link = null;\n }",
value: 'function() { /*...*/ }',
},
onFinish: {
type: 'JSFunction',
value: 'function(f) {\n const params = Object.keys(f).reduce((pre, key) => {\n const value = f[key];\n if (value === undefined) {\n return pre;\n }\n return {\n ...pre,\n [key]: value,\n };\n }, {});\n this.searchParams = params;\n this.fetchPkgs();\n }',
value: 'function() { /*...*/ }',
},
},
state: {

View File

@ -30,7 +30,7 @@
"engines": { "node": ">=8.0.0" },
"repository": {
"type": "git",
"url": "http://gitlab.alibaba-inc.com/msd/leak-scan/tree/master"
"url": "http://gitlab.xxx.com/msd/leak-scan/tree/master"
},
"private": true,
"originTemplate": "@alifd/scaffold-lite-js"

View File

@ -1,3 +1,3 @@
const __$$constants = { ENV: "prod", DOMAIN: "xxx.alibaba-inc.com" };
const __$$constants = { ENV: "prod", DOMAIN: "xxx.xxx.com" };
export default __$$constants;

View File

@ -81,13 +81,13 @@
id: 'urlParams',
type: 'urlParams',
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/user
// 示例数据源https://shs.xxx.com/mock/1458/demo/user
{
id: 'user',
type: 'fetch',
options: {
method: 'GET',
uri: 'https://shs.alibaba-inc.com/mock/1458/demo/user',
uri: 'https://shs.xxx.com/mock/1458/demo/user',
isSync: true,
},
dataHandler: {
@ -95,7 +95,7 @@
value: 'function (response) {\nif (!response.success){\n throw new Error(response.message);\n }\n return response.data;\n}',
},
},
// 示例数据源https://shs.alibaba-inc.com/mock/1458/demo/orders
// 示例数据源https://shs.xxx.com/mock/1458/demo/orders
{
id: 'orders',
type: 'fetch',
@ -255,7 +255,7 @@
],
"constants": {
"ENV": "prod",
"DOMAIN": "xxx.alibaba-inc.com"
"DOMAIN": "xxx.xxx.com"
},
"i18n": {
"zh-CN": {

View File

@ -200,55 +200,55 @@
"methods": {
"__jp__init": {
"type": "JSFunction",
"value": "function() {\n window.jianpin.emitter.emit('rootIns', this);\n this.__jp__initEnv && this.__jp__initEnv();\n this.__jp__initConfig && this.__jp__initConfig();\n this.__jp__initDataSource && this.__jp__initDataSource();\n this.__jp__initRouter && this.__jp__initRouter();\n this.__jp__initUtils && this.__jp__initUtils();\n this.__jp__initUziModel && this.__jp__initUziModel();\n this.__jp__registerModel && this.__jp__registerModel();\n this.__jp__finishedFn && this.__jp__finishedFn();\n}"
"value": "function() { /*...*/ }"
},
"__jp__initRouter": {
"type": "JSFunction",
"value": "function() {\n if (window.arsenal) {\n this.$router = new window.jianpin.ArsenalRouter({\n app: this.props.microApp,\n });\n } else {\n this.$router = new window.jianpin.ArsenalRouter();\n }\n}"
"value": "function() { /*...*/ }"
},
"__jp__initDataSource": {
"type": "JSFunction",
"value": "function() {\n this.$apis = {\n BUILD_LIST: {\n name: '打包列表',\n code: 'BUILD_LIST',\n url: '/ws/nvwa/android/combuild/get_build/',\n method: 'GET',\n dataHandler: res => res.data,\n },\n BUC_USER: {\n name: '搜索用户',\n code: 'BUC_USER',\n url: '/ws/nvwa/sso_users/',\n method: 'GET',\n },\n CHANNELS: {\n name: '渠道列表',\n code: 'CHANNELS',\n url: '/ws/nvwa/android/adaptproject/search/',\n method: 'GET',\n },\n};\n this.$ds = new window.jianpin.DataSource(this, {});\n}"
"value": "function() { /*...*/ }"
},
"__jp__initEnv": {
"type": "JSFunction",
"value": "function() {\n let env = 'prod';\n\n if (window.jianpin && window.jianpin.env === 'dev') {\n env = 'dev';\n } else if (window.arsenalConfig) {\n env = window.arsenalConfig.env;\n }\n\n const urlSearchParams = new URLSearchParams(window.location.search);\n const searchParams = {};\n for (const [key, value] of urlSearchParams) {\n searchParams[key] = value;\n }\n this.$env = env === 'local' ? (window.$arsenalEnv || 'dev') : env;\n this.$searchParams = searchParams;\n\n if (window.arsenal && window.arsenal.store) {\n this.$user = window.arsenal.store.getState('user');\n this.$store = window.arsenal.store;\n window.arsenal.store.subscribe('user', () => {\n this.$user = window.arsenal.store.getState('user');\n });\n } else {\n this.$store = {\n subscribe: () => {},\n getState: () => {},\n };\n this.$user = {};\n if (window.jianpin && typeof window.jianpin.getUser === 'function') {\n this.$user = window.jianpin.getUser() || {};\n }\n }\n}"
"value": "function() { /*...*/ }"
},
"__jp__initConfig": {
"type": "JSFunction",
"value": "function() {\n const __config = {\n \"default\": {},\n \"dev\": {\n \"apiOptions\": {\n \"apiPrefix\": \"https://auto-nvwa-test.alibaba.net\"\n }\n },\n \"daily\": {},\n \"pre\": {},\n \"prod\": {}\n};\n\n this.$config = window.jianpin.utils.extend(true, {}, __config.default, __config[this.$env]);\n\n this.$totalConfig = __config;\n}"
"value": "function() { /*...*/ }"
},
"__jp__initUtils": {
"type": "JSFunction",
"value": "function() {\n this.$utils = window.jianpin.utils;\n}"
"value": "function() { /*...*/ }"
},
"__jp__initUziModel": {
"type": "JSFunction",
"value": "function () {\n const defModel = {\n apis: {},\n state: {},\n exposes: {},\n effects: {},\n reducers: {},\n};\n this.$uziModel = {\n ...defModel,\n };\n}"
"value": "function() { /*...*/ }"
},
"__jp__registerModel": {
"type": "JSFunction",
"value": "function () {\n if (this.props.microModel) {\n this.$uziModel = this.props.microModel;\n return;\n }\n const ns = \"jianpin-ns\";\n const uziContext = window.jianpin.uziCore.createUziContext();\n const { register, subscribe, getUzi, getState } = uziContext;\n const { extend, parseJSFunc } = window.jianpin.utils;\n const model = extend(true, {}, this.$uziModel);\n parseJSFunc(model);\n register(ns, model);\n\n const uzi = getUzi(ns);\n subscribe((state) => {\n this.$uziModel = {\n ...this.$uziModel,\n state,\n };\n this.forceUpdate();\n }, ns);\n\n this.$uziModel = {\n apis: uzi.apis,\n uzi,\n loading: {},\n state: getState(ns),\n };\n}"
"value": "function() { /*...*/ }"
},
"__jp__finishedFn": {
"type": "JSFunction",
"value": "function () {\n window.jianpin.utils.parseJSFunc(this.$config);\n}"
"value": "function() { /*...*/ }"
},
"initUrl": {
"type": "JSFunction",
"value": "function() {\n const apiOptions = this.$config.apiOptions;\n const apiPrefix = (apiOptions && apiOptions.apiPrefix) || '';\n this.userUrl = `${apiPrefix}${this.$apis.BUC_USER.url}`;\n this.channelUrl = `${apiPrefix}${this.$apis.CHANNELS.url}`;\n }"
"value": "function() { /*...*/ }"
},
"initUserHeaders": {
"type": "JSFunction",
"value": "function() {\n this.userHeaders = {};\n if (this.$user && this.$user.workid) {\n this.userHeaders = {\n headers: {\n 'buc-user': window.jianpin.utils.Base64.encode(\n JSON.stringify(this.$user)\n ),\n },\n };\n }\n }"
"value": "function() { /*...*/ }"
},
"fetchBuilds": {
"type": "JSFunction",
"value": "function() {\n this.$ds\n .resolve('BUILD_LIST', {\n params: this.searchParams,\n })\n .then(res => {\n const { page, builds } = res;\n const { num_pages, page_number, per_page } = page;\n this.setState({\n page: page_number,\n pageSize: per_page,\n total: num_pages * per_page,\n builds,\n });\n });\n }"
"value": "function() { /*...*/ }"
},
"userHandler": {
"type": "JSFunction",
"value": "function(res) {\n const data = res.data.items.map(item => {\n const { id, label } = item;\n return {\n label: `${id}/${label}`,\n value: id,\n };\n });\n return data;\n }"
"value": "function() { /*...*/ }"
},
"channelHandler": {
"type": "JSFunction",

View File

@ -188,63 +188,63 @@
"methods": {
"__jp__init": {
"type": "JSFunction",
"value": "function() {\n window.jianpin.emitter.emit('rootIns', this);\n this.__jp__initEnv && this.__jp__initEnv();\n this.__jp__initConfig && this.__jp__initConfig();\n this.__jp__initDataSource && this.__jp__initDataSource();\n this.__jp__initRouter && this.__jp__initRouter();\n this.__jp__initUtils && this.__jp__initUtils();\n this.__jp__initUziModel && this.__jp__initUziModel();\n this.__jp__registerModel && this.__jp__registerModel();\n this.__jp__finishedFn && this.__jp__finishedFn();\n}"
"value": "function() { /* ... */ }"
},
"__jp__initRouter": {
"type": "JSFunction",
"value": "function() {\n if (window.arsenal) {\n this.$router = new window.jianpin.ArsenalRouter({\n app: this.props.microApp,\n });\n } else {\n this.$router = new window.jianpin.ArsenalRouter();\n }\n}"
"value": "function() { /* ... */ }"
},
"__jp__initDataSource": {
"type": "JSFunction",
"value": "function() {\n this.$apis = {\n PROJECTS: {\n name: '项目列表',\n code: 'PROJECTS',\n url: '/ws/nvwa/android/adaptproject/list/',\n method: 'GET',\n dataHandler: res => res.data,\n },\n CHANNEL: {\n name: '项目名称或渠道号',\n code: 'CHANNEL',\n url: '/ws/nvwa/cpp/select_projects/',\n method: 'GET',\n dataHandler: res => res.data.data,\n },\n};\n this.$ds = new window.jianpin.DataSource(this,{});\n}"
"value": "function() { /* ... */ }"
},
"__jp__initEnv": {
"type": "JSFunction",
"value": "function() {\n let env = 'prod';\n\n if (window.jianpin && window.jianpin.env === 'dev') {\n env = 'dev';\n } else if (window.arsenalConfig) {\n env = window.arsenalConfig.env;\n }\n\n const urlSearchParams = new URLSearchParams(window.location.search);\n const searchParams = {};\n for (const [key, value] of urlSearchParams) {\n searchParams[key] = value;\n }\n this.$env = env === 'local' ? (window.$arsenalEnv || 'dev') : env;\n this.$searchParams = searchParams;\n\n if (window.arsenal && window.arsenal.store) {\n this.$user = window.arsenal.store.getState('user');\n this.$store = window.arsenal.store;\n window.arsenal.store.subscribe('user', () => {\n this.$user = window.arsenal.store.getState('user');\n });\n } else {\n this.$store = {\n subscribe: () => {},\n getState: () => {},\n };\n this.$user = {};\n if (window.jianpin && typeof window.jianpin.getUser === 'function') {\n this.$user = window.jianpin.getUser() || {};\n }\n }\n}"
"value": "function() { /* ... */ }"
},
"__jp__initConfig": {
"type": "JSFunction",
"value": "function() {\n const __config = {\n \"default\": {\n \"mockUser\": {\n \"userid\": \"melon.lbw\",\n \"dep\": \"阿里集团-高德事业群-汽车业务中心-工程研发部-服务效率组\",\n \"cname\": \"永元\",\n \"lastName\": \"刘博文1222222\",\n \"workid\": \"166380\",\n \"siteLanguage\": \"ZH-CN\",\n \"bucid\": 111409615,\n \"login\": \"melon.lbw\",\n \"email\": \"melon.lbw@alibaba.net\",\n \"name\": \"永元\",\n \"html_url\": \"https://work.alibaba-inc.com/work/u/166380\",\n \"avatar_url\": \"https://work.alibaba-inc.com/photo/166380.220x220.jpg\",\n \"im_url\": \"https://work.alibaba-inc.com/new_amos_im_alisoft_com/msg.aw?v=2&uid=%E6%B0%B8%E5%85%83&site=cntaobao&charset=utf-8&s=1\",\n \"umid\": \"\",\n \"namespace\": \"buc\",\n \"realmId\": 10000,\n \"token\": \"d4526b5fa0f845a688055935b8962606a3f9cf00\",\n \"tokenDt\": 1639969093256\n }\n },\n \"dev\": {\n \"apiOptions\": {\n \"apiPrefix\": \"https://auto-nvwa.alibaba.net\"\n }\n },\n \"daily\": {},\n \"pre\": {},\n \"prod\": {}\n};\n\n this.$config = window.jianpin.utils.extend(true, {}, __config.default, __config[this.$env]);\n\n this.$totalConfig = __config;\n}"
"value": "function() { /* ... */ }"
},
"__jp__initUtils": {
"type": "JSFunction",
"value": "function() {\n this.$utils = window.jianpin.utils;\n}"
"value": "function() { /* ... */ }"
},
"__jp__initUziModel": {
"type": "JSFunction",
"value": "function () {\n const defModel = {\n \"apis\": {},\n \"state\": {\n \"channelId\": \"C04010264004\"\n },\n \"exposes\": {},\n \"effects\": {},\n \"reducers\": {}\n};\n this.$uziModel = {\n ...defModel,\n };\n}"
"value": "function() { /* ... */ }"
},
"__jp__registerModel": {
"type": "JSFunction",
"value": "function () {\n if (this.props.microModel) {\n this.$uziModel = this.props.microModel;\n return;\n }\n const ns = \"jianpin-ns\";\n const uziContext = window.jianpin.uziCore.createUziContext();\n const { register, subscribe, getUzi, getState } = uziContext;\n const { extend, parseJSFunc } = window.jianpin.utils;\n const model = extend(true, {}, this.$uziModel);\n parseJSFunc(model);\n register(ns, model);\n\n const uzi = getUzi(ns);\n subscribe((state) => {\n this.$uziModel = {\n ...this.$uziModel,\n state,\n };\n this.forceUpdate();\n }, ns);\n\n this.$uziModel = {\n apis: uzi.apis,\n uzi,\n loading: {},\n state: getState(ns),\n };\n}"
"value": "function() { /* ... */ }"
},
"__jp__finishedFn": {
"type": "JSFunction",
"value": "function () {\n window.jianpin.utils.parseJSFunc(this.$config);\n}"
"value": "function() { /* ... */ }"
},
"initUrl": {
"type": "JSFunction",
"value": "function() {\n const apiOptions = this.$config.apiOptions;\n const apiPrefix = (apiOptions && apiOptions.apiPrefix) || '';\n this.channelUrl = `${apiPrefix}${this.$apis.CHANNEL.url}?size=5000`;\n }"
"value": "function() { /* ... */ }"
},
"channelHandler": {
"type": "JSFunction",
"value": "function(res) {\n const data = res.data.data.result.map(item => {\n const { id, project_name } = item;\n return {\n label: project_name,\n value: id,\n };\n });\n return data;\n }"
"value": "function() { /* ... */ }"
},
"fetchProjects": {
"type": "JSFunction",
"value": "function() {\n this.$ds\n .resolve('PROJECTS', {\n params: this.searchParams,\n })\n .then(res => {\n const { project_list, page } = res;\n const { num_pages: total } = page;\n const projects = project_list.map(r => {\n const { dec_channels, ...rest } = r;\n const { id } = rest;\n let col = {};\n if (dec_channels && dec_channels.length > 0) {\n col = {\n children: dec_channels,\n };\n }\n return {\n key: id,\n ...rest,\n ...col,\n };\n });\n this.setState({\n projects,\n total,\n });\n });\n }"
"value": "function() { /* ... */ }"
},
"setSearchParams": {
"type": "JSFunction",
"value": "function(params) {\n this.searchParams = {\n ...this.searchParams,\n ...params,\n };\n }"
"value": "function() { /* ... */ }"
},
"onPageChange": {
"type": "JSFunction",
"value": "function(pageIndex, pageSize) {\n this.setSearchParams({\n page: pageIndex,\n page_size: pageSize,\n });\n this.fetchProjects();\n }"
"value": "function() { /* ... */ }"
},
"renderName": {
"type": "JSFunction",
"value": "function(col) {\n return col.name;\n }"
"value": "function() { /* ... */ }"
},
"renderPlatform": {
"type": "JSFunction",
@ -256,7 +256,7 @@
},
"onFinish": {
"type": "JSFunction",
"value": "function(f) {\n const params = Object.keys(f).reduce((pre, key) => {\n const value = f[key];\n if (value === undefined) {\n return pre;\n }\n return {\n ...pre,\n [key]: value,\n };\n }, {});\n this.setSearchParams(params);\n this.fetchProjects();\n }"
"value": "function() { /* ... */ }"
},
"onSearchChannel": {
"type": "JSFunction",
@ -264,11 +264,11 @@
},
"toNewAddPage": {
"type": "JSFunction",
"value": "function() {\n this.$router.push('/android/adapt_project/add');\n }"
"value": "function() { /* ... */ }"
},
"handlerModify": {
"type": "JSFunction",
"value": "function({ id }) {\n this.$router.push('/android/adapt_project/change?id=' + id);\n }"
"value": "function() { /* ... */ }"
},
"infoTip": {
"type": "JSFunction",
@ -276,7 +276,7 @@
},
"renderCreator": {
"type": "JSFunction",
"value": "function(creator) {\n return creator ? creator.user_name : '暂无';\n }"
"value": "function() { /* ... */ }"
}
},
"hidden": false,

View File

@ -173,15 +173,15 @@
"lifeCycles": {
"constructor": {
"type": "JSFunction",
"value": "function() {\n this.__jp__init();\n this.statusDesc = {\n 0: '失败',\n 1: '成功',\n 2: '构建中',\n 3: '构建超时',\n };\n this.pageParams = {};\n this.searchParams = {};\n this.userTimeout = null;\n this.currentUser = null;\n this.notFoundContent = null;\n this.projectTimeout = null;\n this.currentProject = null;\n }"
"value": "function() { /*...*/ }"
},
"componentDidMount": {
"type": "JSFunction",
"value": "function() {\n this.$ds.resolve('PROJECTS');\n if (this.userTimeout) {\n clearTimeout(this.userTimeout);\n this.userTimeout = null;\n }\n if (this.projectTimeout) {\n clearTimeout(this.projectTimeout);\n this.projectTimeout = null;\n }\n }"
"value": "function() { /*...*/ }"
},
"componentDidUpdate": {
"type": "JSFunction",
"value": "function(prevProps, prevState, snapshot) {}"
"value": "function() { /*...*/ }"
},
"componentWillUnmount": {
"type": "JSFunction",
@ -191,99 +191,99 @@
"methods": {
"__jp__init": {
"type": "JSFunction",
"value": "function() {\n this.__jp__initEnv && this.__jp__initEnv();\n this.__jp__initConfig && this.__jp__initConfig();\n this.__jp__initDataSource && this.__jp__initDataSource();\n this.__jp__initRouter && this.__jp__initRouter();\n this.__jp__initUtils && this.__jp__initUtils();\n}"
"value": "function() { /*...*/ }"
},
"__jp__initRouter": {
"type": "JSFunction",
"value": "function() {\n if (window.arsenal) {\n this.$router = new window.jianpin.ArsenalRouter({\n app: this.props.microApp,\n });\n } else {\n this.$router = new window.jianpin.ArsenalRouter();\n }\n}"
"value": "function() { /*...*/ }"
},
"__jp__initDataSource": {
"type": "JSFunction",
"value": "function() {\n this.$apis = {\n PKG_LIST: {\n name: '打包列表',\n code: 'PKG_LIST',\n url: 'https://auto-nvwa.amap.com/ws/nvwa/cpp5x/packages/',\n method: 'GET',\n dataHandler: res => res.data,\n },\n PROJECTS: {\n name: '项目名称/渠道号',\n code: 'PROJECTS',\n url:\n 'http://auto-nvwa-staging.alibaba.com/ws/nvwa/cpp/select_projects/',\n method: 'GET',\n state: 'projects',\n params: {\n size: 5000,\n },\n dataHandler: res => {\n return res.data.data.result.map(d => {\n const { id, channelId, project_name } = d;\n return {\n label: `${project_name} / ${channelId}`,\n value: id,\n };\n });\n },\n },\n RELOAD: {\n name: '重新执行',\n code: 'RELOAD',\n url: 'https://auto-nvwa.amap.com/cpp/configbuild/rebuild/',\n method: 'GET',\n },\n BUILD_RESULT: {\n name: '打包结果',\n code: 'BUILD_RESULT',\n url:\n 'https://auto-nvwa.amap.com/cpp/api/configbuild/get_build_result/',\n method: 'GET',\n state: 'results',\n dataHandler: res => {\n return res.data.result;\n },\n },\n BUC_USER: {\n name: '搜索用户',\n code: 'BUC_USER',\n url: 'https://auto-nvwa.amap.com/ws/nvwa/sso_users/',\n method: 'GET',\n dataHandler: res => res.data.items,\n },\n};\n this.$ds = new window.jianpin.DataSource(this, {});\n}"
"value": "function() { /*...*/ }"
},
"__jp__initEnv": {
"type": "JSFunction",
"value": "function() {\n const hostname = window.location.hostname;\n let env = 'prod';\n\n if (window.jianpin && window.jianpin.env === 'dev') {\n env = 'dev';\n } else if (window.arsenalConfig) {\n env = window.arsenalConfig.env;\n }\n\n const urlSearchParams = new URLSearchParams(window.location.search);\n const searchParams = {};\n for (const [key, value] of urlSearchParams) {\n searchParams[key] = value;\n }\n this.$env = env;\n this.$searchParams = searchParams;\n\n if (window.arsenal && window.arsenal.store) {\n this.$user = window.arsenal.store.getState('user');\n this.$store = window.arsenal.store;\n window.arsenal.store.subscribe('user', () => {\n this.$user = window.arsenal.store.getState('user');\n });\n } else {\n this.$store = {\n subscribe: () => {},\n getState: () => {},\n };\n this.$user = this.__jp__mockUser || {};\n }\n}"
"value": "function() { /*...*/ }"
},
"__jp__initConfig": {
"type": "JSFunction",
"value": "function() {\n const __config = {\n \"default\": {},\n \"dev\": {},\n \"daily\": {},\n \"pre\": {},\n \"prod\": {}\n};\n\n this.$config = window.jianpin.utils.extend(true, {}, __config.default, __config[this.$env]);\n}"
"value": "function() { /*...*/ }"
},
"__jp__initUtils": {
"type": "JSFunction",
"value": "function() {\n this.$utils = {\n message: window.jianpin.utils.message,\n axios: window.jianpin.utils.axios,\n moment: window.jianpin.utils.moment,\n };\n}"
"value": "function() { /*...*/ }"
},
"setSearchItem": {
"type": "JSFunction",
"value": "function(item) {\n const searchState = this.state.searchValues;\n const reducer = (pre, key) => {\n let value = searchState[key];\n if (item.hasOwnProperty(key)) {\n value = item[key];\n }\n return {\n ...pre,\n [key]: value || null,\n };\n };\n const searchValues = Object.keys(searchState).reduce(reducer, {});\n this.setState({\n searchValues,\n });\n }"
"value": "function() { /*...*/ }"
},
"fetchProject": {
"type": "JSFunction",
"value": "function(value, callback) {\n if (this.projectTimeout) {\n clearTimeout(this.projectTimeout);\n this.projectTimeout = null;\n }\n this.currentProject = value;\n\n const fake = () => {\n this.$ds\n .resolve('PROJECTS', {\n params: { search_param: value },\n })\n .then(res => {\n if (this.currentProject !== value) {\n return;\n }\n callback(res || []);\n });\n };\n this.projectTimeout = setTimeout(fake, 300);\n }"
"value": "function() { /*...*/ }"
},
"handleProjectSearch": {
"type": "JSFunction",
"value": "function(value) {\n if (value) {\n this.fetchProject(value, projects => {\n this.setState({ projects });\n });\n } else {\n this.setState({ projects: [] });\n }\n }"
"value": "function() { /*...*/ }"
},
"handleProjectChange": {
"type": "JSFunction",
"value": "function(id) {\n this.setSearchItem({\n channel_id: id,\n });\n }"
"value": "function() { /*...*/ }"
},
"fetchUser": {
"type": "JSFunction",
"value": "function(value, callback) {\n if (this.userTimeout) {\n clearTimeout(this.userTimeout);\n this.userTimeout = null;\n }\n this.currentUser = value;\n\n const fake = () => {\n this.$ds\n .resolve('BUC_USER', {\n params: { q: value },\n })\n .then(res => {\n if (this.currentUser !== value) {\n return;\n }\n const data = res.slice(0, 8).map(r => ({\n label: `${r.id} / ${r.label}`,\n value: r.id,\n }));\n callback(data);\n });\n };\n this.userTimeout = setTimeout(fake, 300);\n }"
"value": "function() { /*...*/ }"
},
"handleUserSearch": {
"type": "JSFunction",
"value": "function(value) {\n if (value) {\n this.fetchUser(value, userOptions => {\n this.setState({ userOptions });\n });\n } else {\n this.setState({ userOptions: [] });\n }\n }"
"value": "function() { /*...*/ }"
},
"handleUserChange": {
"type": "JSFunction",
"value": "function(user) {\n console.log('debug user', user);\n this.setSearchItem({\n user_id: user,\n });\n }"
"value": "function() { /*...*/ }"
},
"fetchPkgs": {
"type": "JSFunction",
"value": "function() {\n const { pageIndex, pageSize } = this.pageParams;\n this.$ds\n .resolve('PKG_LIST', {\n params: {\n ...this.searchParams,\n page: pageIndex,\n size: pageSize,\n },\n })\n .then(res => {\n const { result, page } = res.data;\n const { count } = page;\n this.setState({\n isSearch: true,\n pkgs: result,\n total: count,\n });\n });\n }"
"value": "function() { /*...*/ }"
},
"onPageChange": {
"type": "JSFunction",
"value": "function(pageIndex, pageSize) {\n this.pageParams = {\n pageIndex,\n pageSize,\n };\n this.fetchPkgs();\n }"
"value": "function() { /*...*/ }"
},
"renderTime": {
"type": "JSFunction",
"value": "function(time) {\n return this.$utils.moment(time).format('YYYY-MM-DD HH:mm');\n }"
"value": "function() { /*...*/ }"
},
"renderUserName": {
"type": "JSFunction",
"value": "function(user) {\n return user.user_name;\n }"
"value": "function() { /*...*/ }"
},
"reload": {
"type": "JSFunction",
"value": "function(id) {\n if (!confirm('确实要重新执行?')) {\n return;\n }\n this.$ds\n .resolve('RELOAD', {\n params: {\n build_id: id,\n },\n })\n .then(res => {\n const { code, message } = res.data.status;\n if (code == 0) {\n this.$utils.message.error(message);\n } else {\n const { pageIndex, pageSize } = this.pageParams;\n this.onPageChange(pageIndex, pageSize);\n }\n })\n .catch(err => {\n this.$utils.message.error(err.message);\n });\n }"
"value": "function() { /*...*/ }"
},
"handleResult": {
"type": "JSFunction",
"value": "function(e) {\n // e.persist();\n e.preventDefault();\n e.stopPropagation();\n let href;\n let tagName;\n let target = e.target;\n do {\n tagName = target.tagName.toUpperCase();\n href = target.getAttribute('href');\n target = target.parentNode;\n } while (!href && tagName !== 'TD');\n if (!href) {\n return;\n }\n\n this.$ds\n .resolve('BUILD_RESULT', {\n params: {\n build_id: href,\n },\n })\n .then(res => {\n this.setState({\n resultVisible: true,\n });\n })\n .catch(err => {\n this.$utils.message.error(`打包结果获取失败: ${err.message}`);\n });\n }"
"value": "function() { /*...*/ }"
},
"handleDetail": {
"type": "JSFunction",
"value": "function() {\n // 跳转详情页面 TODO\n }"
"value": "function() { /*...*/ }"
},
"onResultCancel": {
"type": "JSFunction",
"value": "function() {\n this.setState({\n resultVisible: false,\n });\n }"
"value": "function() { /*...*/ }"
},
"formatResult": {
"type": "JSFunction",
"value": "function(item) {\n if (!item) {\n return '暂无结果';\n }\n const { channel, plat, version, status } = item;\n return [channel, plat, version, status].join('-');\n }"
"value": "function() { /*...*/ }"
},
"handleDownload": {
"type": "JSFunction",
"value": "function() {\n const { results } = this.state;\n if (!results || results.length < 1) {\n return;\n }\n let link = document.createElement('a');\n link.style.display = 'none';\n document.body.appendChild(link);\n results.forEach(r => {\n link.href = r.download_link;\n link.click();\n });\n document.body.removeChild(link);\n link = null;\n }"
"value": "function() { /*...*/ }"
},
"onFinish": {
"type": "JSFunction",
"value": "function(f) {\n const params = Object.keys(f).reduce((pre, key) => {\n const value = f[key];\n if (value === undefined) {\n return pre;\n }\n return {\n ...pre,\n [key]: value,\n };\n }, {});\n this.searchParams = params;\n this.fetchPkgs();\n }"
"value": "function() { /*...*/ }"
}
},
"state": {

View File

@ -173,11 +173,11 @@
"lifeCycles": {
"constructor": {
"type": "JSFunction",
"value": "function() {\n this.__jp__init();\n this.statusDesc = {\n 0: '失败',\n 1: '成功',\n 2: '构建中',\n 3: '构建超时',\n };\n this.pageParams = {};\n this.searchParams = {};\n this.userTimeout = null;\n this.currentUser = null;\n this.notFoundContent = null;\n this.projectTimeout = null;\n this.currentProject = null;\n }"
"value": "function() { /*...*/ }"
},
"componentDidMount": {
"type": "JSFunction",
"value": "function() {\n this.$ds.resolve('PROJECTS');\n if (this.userTimeout) {\n clearTimeout(this.userTimeout);\n this.userTimeout = null;\n }\n if (this.projectTimeout) {\n clearTimeout(this.projectTimeout);\n this.projectTimeout = null;\n }\n }"
"value": "function() { /*...*/ }"
},
"componentDidUpdate": {
"type": "JSFunction",
@ -191,99 +191,99 @@
"methods": {
"__jp__init": {
"type": "JSFunction",
"value": "function() {\n this.__jp__initEnv && this.__jp__initEnv();\n this.__jp__initConfig && this.__jp__initConfig();\n this.__jp__initDataSource && this.__jp__initDataSource();\n this.__jp__initRouter && this.__jp__initRouter();\n this.__jp__initUtils && this.__jp__initUtils();\n}"
"value": "function() { /*...*/ }"
},
"__jp__initRouter": {
"type": "JSFunction",
"value": "function() {\n if (window.arsenal) {\n this.$router = new window.jianpin.ArsenalRouter({\n app: this.props.microApp,\n });\n } else {\n this.$router = new window.jianpin.ArsenalRouter();\n }\n}"
"value": "function() { /*...*/ }"
},
"__jp__initDataSource": {
"type": "JSFunction",
"value": "function() {\n this.$apis = {\n PKG_LIST: {\n name: '打包列表',\n code: 'PKG_LIST',\n url: 'https://auto-nvwa.amap.com/ws/nvwa/cpp5x/packages/',\n method: 'GET',\n dataHandler: res => res.data,\n },\n PROJECTS: {\n name: '项目名称/渠道号',\n code: 'PROJECTS',\n url:\n 'http://auto-nvwa-staging.alibaba.com/ws/nvwa/cpp/select_projects/',\n method: 'GET',\n state: 'projects',\n params: {\n size: 5000,\n },\n dataHandler: res => {\n return res.data.data.result.map(d => {\n const { id, channelId, project_name } = d;\n return {\n label: `${project_name} / ${channelId}`,\n value: id,\n };\n });\n },\n },\n RELOAD: {\n name: '重新执行',\n code: 'RELOAD',\n url: 'https://auto-nvwa.amap.com/cpp/configbuild/rebuild/',\n method: 'GET',\n },\n BUILD_RESULT: {\n name: '打包结果',\n code: 'BUILD_RESULT',\n url:\n 'https://auto-nvwa.amap.com/cpp/api/configbuild/get_build_result/',\n method: 'GET',\n state: 'results',\n dataHandler: res => {\n return res.data.result;\n },\n },\n BUC_USER: {\n name: '搜索用户',\n code: 'BUC_USER',\n url: 'https://auto-nvwa.amap.com/ws/nvwa/sso_users/',\n method: 'GET',\n dataHandler: res => res.data.items,\n },\n};\n this.$ds = new window.jianpin.DataSource(this, {});\n}"
"value": "function() { /*...*/ }"
},
"__jp__initEnv": {
"type": "JSFunction",
"value": "function() {\n const hostname = window.location.hostname;\n let env = 'prod';\n\n if (window.jianpin && window.jianpin.env === 'dev') {\n env = 'dev';\n } else if (window.arsenalConfig) {\n env = window.arsenalConfig.env;\n }\n\n const urlSearchParams = new URLSearchParams(window.location.search);\n const searchParams = {};\n for (const [key, value] of urlSearchParams) {\n searchParams[key] = value;\n }\n this.$env = env;\n this.$searchParams = searchParams;\n\n if (window.arsenal && window.arsenal.store) {\n this.$user = window.arsenal.store.getState('user');\n this.$store = window.arsenal.store;\n window.arsenal.store.subscribe('user', () => {\n this.$user = window.arsenal.store.getState('user');\n });\n } else {\n this.$store = {\n subscribe: () => {},\n getState: () => {},\n };\n this.$user = this.__jp__mockUser || {};\n }\n}"
"value": "function() { /*...*/ }"
},
"__jp__initConfig": {
"type": "JSFunction",
"value": "function() {\n const __config = {\n \"default\": {},\n \"dev\": {},\n \"daily\": {},\n \"pre\": {},\n \"prod\": {}\n};\n\n this.$config = window.jianpin.utils.extend(true, {}, __config.default, __config[this.$env]);\n}"
"value": "function() { /*...*/ }"
},
"__jp__initUtils": {
"type": "JSFunction",
"value": "function() {\n this.$utils = {\n message: window.jianpin.utils.message,\n axios: window.jianpin.utils.axios,\n moment: window.jianpin.utils.moment,\n };\n}"
"value": "function() { /*...*/ }"
},
"setSearchItem": {
"type": "JSFunction",
"value": "function(item) {\n const searchState = this.state.searchValues;\n const reducer = (pre, key) => {\n let value = searchState[key];\n if (item.hasOwnProperty(key)) {\n value = item[key];\n }\n return {\n ...pre,\n [key]: value || null,\n };\n };\n const searchValues = Object.keys(searchState).reduce(reducer, {});\n this.setState({\n searchValues,\n });\n }"
"value": "function() { /*...*/ }"
},
"fetchProject": {
"type": "JSFunction",
"value": "function(value, callback) {\n if (this.projectTimeout) {\n clearTimeout(this.projectTimeout);\n this.projectTimeout = null;\n }\n this.currentProject = value;\n\n const fake = () => {\n this.$ds\n .resolve('PROJECTS', {\n params: { search_param: value },\n })\n .then(res => {\n if (this.currentProject !== value) {\n return;\n }\n callback(res || []);\n });\n };\n this.projectTimeout = setTimeout(fake, 300);\n }"
"value": "function() { /*...*/ }"
},
"handleProjectSearch": {
"type": "JSFunction",
"value": "function(value) {\n if (value) {\n this.fetchProject(value, projects => {\n this.setState({ projects });\n });\n } else {\n this.setState({ projects: [] });\n }\n }"
"value": "function() { /*...*/ }"
},
"handleProjectChange": {
"type": "JSFunction",
"value": "function(id) {\n this.setSearchItem({\n channel_id: id,\n });\n }"
"value": "function() { /*...*/ }"
},
"fetchUser": {
"type": "JSFunction",
"value": "function(value, callback) {\n if (this.userTimeout) {\n clearTimeout(this.userTimeout);\n this.userTimeout = null;\n }\n this.currentUser = value;\n\n const fake = () => {\n this.$ds\n .resolve('BUC_USER', {\n params: { q: value },\n })\n .then(res => {\n if (this.currentUser !== value) {\n return;\n }\n const data = res.slice(0, 8).map(r => ({\n label: `${r.id} / ${r.label}`,\n value: r.id,\n }));\n callback(data);\n });\n };\n this.userTimeout = setTimeout(fake, 300);\n }"
"value": "function() { /*...*/ }"
},
"handleUserSearch": {
"type": "JSFunction",
"value": "function(value) {\n if (value) {\n this.fetchUser(value, userOptions => {\n this.setState({ userOptions });\n });\n } else {\n this.setState({ userOptions: [] });\n }\n }"
"value": "function() { /*...*/ }"
},
"handleUserChange": {
"type": "JSFunction",
"value": "function(user) {\n console.log('debug user', user);\n this.setSearchItem({\n user_id: user,\n });\n }"
"value": "function() { /*...*/ }"
},
"fetchPkgs": {
"type": "JSFunction",
"value": "function() {\n const { pageIndex, pageSize } = this.pageParams;\n this.$ds\n .resolve('PKG_LIST', {\n params: {\n ...this.searchParams,\n page: pageIndex,\n size: pageSize,\n },\n })\n .then(res => {\n const { result, page } = res.data;\n const { count } = page;\n this.setState({\n isSearch: true,\n pkgs: result,\n total: count,\n });\n });\n }"
"value": "function() { /*...*/ }"
},
"onPageChange": {
"type": "JSFunction",
"value": "function(pageIndex, pageSize) {\n this.pageParams = {\n pageIndex,\n pageSize,\n };\n this.fetchPkgs();\n }"
"value": "function() { /*...*/ }"
},
"renderTime": {
"type": "JSFunction",
"value": "function(time) {\n return this.$utils.moment(time).format('YYYY-MM-DD HH:mm');\n }"
"value": "function() { /*...*/ }"
},
"renderUserName": {
"type": "JSFunction",
"value": "function(user) {\n return user.user_name;\n }"
"value": "function() { /*...*/ }"
},
"reload": {
"type": "JSFunction",
"value": "function(id) {\n if (!confirm('确实要重新执行?')) {\n return;\n }\n this.$ds\n .resolve('RELOAD', {\n params: {\n build_id: id,\n },\n })\n .then(res => {\n const { code, message } = res.data.status;\n if (code == 0) {\n this.$utils.message.error(message);\n } else {\n const { pageIndex, pageSize } = this.pageParams;\n this.onPageChange(pageIndex, pageSize);\n }\n })\n .catch(err => {\n this.$utils.message.error(err.message);\n });\n }"
"value": "function() { /*...*/ }"
},
"handleResult": {
"type": "JSFunction",
"value": "function(e) {\n // e.persist();\n e.preventDefault();\n e.stopPropagation();\n let href;\n let tagName;\n let target = e.target;\n do {\n tagName = target.tagName.toUpperCase();\n href = target.getAttribute('href');\n target = target.parentNode;\n } while (!href && tagName !== 'TD');\n if (!href) {\n return;\n }\n\n this.$ds\n .resolve('BUILD_RESULT', {\n params: {\n build_id: href,\n },\n })\n .then(res => {\n this.setState({\n resultVisible: true,\n });\n })\n .catch(err => {\n this.$utils.message.error(`打包结果获取失败: ${err.message}`);\n });\n }"
"value": "function() { /*...*/ }"
},
"handleDetail": {
"type": "JSFunction",
"value": "function() {\n // 跳转详情页面 TODO\n }"
"value": "function() { /*...*/ }"
},
"onResultCancel": {
"type": "JSFunction",
"value": "function() {\n this.setState({\n resultVisible: false,\n });\n }"
"value": "function() { /*...*/ }"
},
"formatResult": {
"type": "JSFunction",
"value": "function(item) {\n if (!item) {\n return '暂无结果';\n }\n const { channel, plat, version, status } = item;\n return [channel, plat, version, status].join('-');\n }"
"value": "function() { /*...*/ }"
},
"handleDownload": {
"type": "JSFunction",
"value": "function() {\n const { results } = this.state;\n if (!results || results.length < 1) {\n return;\n }\n let link = document.createElement('a');\n link.style.display = 'none';\n document.body.appendChild(link);\n results.forEach(r => {\n link.href = r.download_link;\n link.click();\n });\n document.body.removeChild(link);\n link = null;\n }"
"value": "function() { /*...*/ }"
},
"onFinish": {
"type": "JSFunction",
"value": "function(f) {\n const params = Object.keys(f).reduce((pre, key) => {\n const value = f[key];\n if (value === undefined) {\n return pre;\n }\n return {\n ...pre,\n [key]: value,\n };\n }, {});\n this.searchParams = params;\n this.fetchPkgs();\n }"
"value": "function() { /*...*/ }"
}
},
"state": {