Skip to content

Commit ea69f33

Browse files
committed
first commit
0 parents  commit ea69f33

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3831
-0
lines changed

.babelrc

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"presets": ["es2015", "stage-0", "react"],
3+
"plugins": [
4+
"add-module-exports",
5+
"transform-react-display-name",
6+
"transform-class-properties",
7+
"transform-decorators-legacy",
8+
["transform-react-jsx", { "pragma": "createElement" }],
9+
["transform-imports", {
10+
"nuke": {
11+
"transform": "nuke/lib/${member}",
12+
"preventFullImport": true
13+
},
14+
}]
15+
]
16+
}

.editorconfig

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.eslintrc

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"parser": "babel-eslint",
3+
"plugins": [
4+
"weex-rx"
5+
],
6+
"parserOptions": {
7+
"ecmaVersion": 6,
8+
"sourceType": "module",
9+
"ecmaFeatures": {
10+
"jsx": true,
11+
"arrowFunctions": true,
12+
"blockBindings": true,
13+
"defaultParams": true,
14+
"destructuring": true,
15+
"forOf": true,
16+
"generators": true,
17+
"objectLiteralComputedProperties": true,
18+
"objectLiteralShorthandMethods": true,
19+
"objectLiteralShorthandProperties": true,
20+
"restParams": true,
21+
"spread": true,
22+
"templateStrings": true,
23+
"modules": true,
24+
"classes": true
25+
}
26+
},
27+
"rules": {
28+
no-unused-vars: 0,
29+
"no-unreachable":[2],
30+
comma-dangle: ["error", "ignore"],
31+
"indent": 0,
32+
"space-infix-ops":0,
33+
"weex-rx/no-unsupported-style":[2, { "forbid": [], "allow":[] }],
34+
"weex-rx/jsx-no-undef":[2],
35+
"weex-rx/jsx-wrap-multilines":[2],
36+
}
37+
}

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
_output/

.npmignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
.travis.yml
3+
*.swp
4+
.sass-cache/
5+
mods/.sass-cache/
6+
.DS_Store
7+
.idea
8+
_output
9+
build

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# example-qap-plugin
2+
qap 插件示例
3+
## step-1
4+
高性能Tab页搭建
5+
6+
## step-2
7+
应用首页/引导页面
8+
9+
## step-3
10+
列表页开发
11+
12+
## step-4
13+
页面事件通信

build/evaluate/index.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/home/index.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/index.js

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/msg/index.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/order/index.js

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/order/orderlist.js

+5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/setting/index.js

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

data/detail.detail.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
3+
"item":{
4+
"pic_path": "https://gd3.alicdn.com/imgextra/i3/179209434/TB2B98sXqzyQeBjSszfXXX7OVXa_!!179209434.jpg",
5+
"title" : "高端纯手工茧型韩版宽松双排扣中长款双面羊毛羊绒大衣毛呢外套女",
6+
"price" : "10000.00",
7+
"num" :1
8+
},
9+
"buyer":{
10+
11+
"nick" : "fwefwef啊",
12+
"phone" : "18612345678",
13+
"addr" : "浙江省杭州市余杭区文一西路969号8号楼",
14+
"note" : "今天一定要发货哦"
15+
},
16+
"order":{
17+
"order_id" : "123423232432432",
18+
"submit_time" : "2016-11-11 23:22:22",
19+
"pay_time" : "2016-11-11 23:22:22",
20+
"status": "已付款"
21+
},
22+
23+
24+
25+
26+
27+
"total_fee" : "100.00"
28+
29+
}

data/home.userinfo.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"userInfo": {
3+
"avatar": "https://img.alicdn.com/tps/TB1Lm1OOVXXXXXXXVXXXXXXXXXX-200-200.jpg",
4+
"userNick": "qn店铺测试账号003"
5+
}
6+
}

data/order.list.json

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"datas": [{
3+
"iid": "c327531c3d817b25197f11aa1e3aba70",
4+
"pic_path": "https://gd3.alicdn.com/imgextra/i3/179209434/TB2B98sXqzyQeBjSszfXXX7OVXa_!!179209434.jpg",
5+
"adjust_fee": "0.00",
6+
"title": "高端纯手工茧型韩版宽松双排扣中长款双面羊毛羊绒大衣毛呢外套女",
7+
"sku_properties_name": "颜色:天蓝色;尺码:S",
8+
"refund_status": "NO_REFUND",
9+
"discount_fee": "0.00",
10+
"payment": "105.00",
11+
"status": "xxx",
12+
"num": 1,
13+
"total_fee": "100.00",
14+
"price": "10000.00"
15+
}, {
16+
"iid": "c327531c3d817b25197f11aa1e3aba70",
17+
"pic_path": "https://gd2.alicdn.com/imgextra/i4/TB1FqCONXXXXXXsXpXXYXGcGpXX_M2.SS2",
18+
"adjust_fee": "0.00",
19+
"title": "秋冬季男女士浅驼色米色白色粉纯色羊绒围巾羊毛披肩两用超大加厚",
20+
"sku_properties_name": "颜色:天蓝色;尺码:S",
21+
"refund_status": "NO_REFUND",
22+
"discount_fee": "0.00",
23+
"payment": "105.00",
24+
"status": "xxx",
25+
"num": 1,
26+
"total_fee": "100.00",
27+
"price": "10000.00"
28+
}]
29+
}

gulpfile.js

+111
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
var path = require('path'),
2+
gulp = require('gulp'),
3+
gutil = require('gulp-util'),
4+
webpack = require('webpack'),
5+
babel = require('gulp-babel'),
6+
os = require('os'),
7+
_ = require("underscore"),
8+
del = require('del'),
9+
open = require('open'),
10+
webpackDevServer = require('webpack-dev-server');
11+
12+
var work_path = process.cwd();
13+
var config = require(path.join(work_path, 'webpack.config.js'));
14+
15+
function getPublicIP() {
16+
var publicIP = "127.0.0.1"; //fallbck ip
17+
var ifaces = os.networkInterfaces();
18+
var address = _.flatten(_.values(ifaces));
19+
address = _.filter(address, function(ifObj) {
20+
return ifObj.family == "IPv4" && ifObj.address != "127.0.0.1";
21+
});
22+
if (address.length > 0) {
23+
publicIP = address[0].address;
24+
}
25+
return publicIP;
26+
}
27+
28+
var host = getPublicIP();
29+
30+
gulp.task('clean', function(cb) {
31+
del(['build', 'lib']).then(function() {
32+
cb();
33+
})
34+
});
35+
36+
gulp.task('start', function(cb) {
37+
var buildFirstTime = true;
38+
var webpackConfig = config.dev();
39+
var compiler = webpack(webpackConfig);
40+
var devHost = "http://" + host + ":" + webpackConfig.port;
41+
compiler.plugin('done', stats => {
42+
if (stats.hasErrors()) {
43+
console.log(stats.toString({ colors: true }));
44+
} else if (buildFirstTime) { //只有第一次启动start的时候才执行
45+
//只有第一次启动start的时候才执行
46+
buildFirstTime = false;
47+
cb && cb();
48+
// listening
49+
gutil.log("[webpack-dev-server]", gutil.colors.magenta(devHost));
50+
gutil.log("[webpack-dev-server]", "To stop service, press [Ctrl + C] ..");
51+
52+
if (typeof process.send === 'function') {
53+
process.send({ start: 'done' });
54+
}
55+
}else{
56+
console.log('\n编译成功,请刷新千牛或者刷新浏览器');
57+
}
58+
});
59+
60+
var server = new webpackDevServer(compiler, {
61+
hot: false,
62+
inline: true,
63+
quiet: true,
64+
publicPath: webpackConfig.output.publicPath,
65+
headers: { 'Access-Control-Allow-Origin': '*' },
66+
contentBase: path.resolve(__dirname, './')
67+
}).listen(webpackConfig.port, '0.0.0.0', function(err) {
68+
if (err) {
69+
throw new gutil.PluginError("webpack-dev-server", err)
70+
}
71+
72+
});
73+
});
74+
75+
76+
gulp.task('build:dist', ['clean'], function(cb) {
77+
78+
var webpackConfig = config.prod();
79+
80+
var compiler = webpack(webpackConfig, function(err, stats) {
81+
if (err) {
82+
gutil.log(err);
83+
}
84+
85+
gutil.log(stats.toString({
86+
colors: true,
87+
chunks: false
88+
}));
89+
});
90+
compiler.plugin('done', stats => {
91+
if (stats.hasErrors()) {
92+
console.log(stats.toString({ colors: true }));
93+
}
94+
cb && cb();
95+
if (typeof process.send === 'function') {
96+
process.send({ build: 'done' });
97+
}
98+
});
99+
100+
});
101+
102+
gulp.task('build:lib', ['clean'], function() {
103+
104+
return gulp.src('src/**/*.js?(x)')
105+
.pipe(babel())
106+
.pipe(gulp.dest('lib'));
107+
108+
});
109+
110+
gulp.task('default', ['start']);
111+
gulp.task('build', ['build:lib', 'build:dist']);

lib/components/icon/iconFont.js

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
'use strict';
2+
3+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4+
5+
var _weexRx = require('weex-rx');
6+
7+
var _baseModule = require('$root/lib/baseModule');
8+
9+
var _baseModule2 = _interopRequireDefault(_baseModule);
10+
11+
var _Text = require('nuke/lib/Text');
12+
13+
var _Text2 = _interopRequireDefault(_Text);
14+
15+
var _iconSource = require('./iconSource');
16+
17+
var _iconSource2 = _interopRequireDefault(_iconSource);
18+
19+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20+
21+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22+
23+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
24+
25+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
26+
27+
var IconFont = function (_BaseModule) {
28+
_inherits(IconFont, _BaseModule);
29+
30+
function IconFont(props) {
31+
_classCallCheck(this, IconFont);
32+
33+
var _this = _possibleConstructorReturn(this, (IconFont.__proto__ || Object.getPrototypeOf(IconFont)).call(this, props));
34+
35+
_this.icons = _iconSource2.default;
36+
return _this;
37+
}
38+
39+
_createClass(IconFont, [{
40+
key: 'render',
41+
value: function render() {
42+
var iconStyle = this.props.iconStyle;
43+
44+
return (0, _weexRx.createElement)(
45+
_Text2.default,
46+
{ style: [iconStyle, styles.icon] },
47+
this.icons[this.props.name]
48+
);
49+
}
50+
}]);
51+
52+
return IconFont;
53+
}(_baseModule2.default);
54+
55+
IconFont.protTypes = {
56+
name: _weexRx.PropTypes.string
57+
};
58+
59+
60+
var styles = {
61+
icon: {
62+
fontFamily: 'iconfont',
63+
textAlign: 'center'
64+
}
65+
};
66+
67+
module.exports = IconFont;

lib/components/icon/iconSource.js

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
var _Iconfont = require('nuke/lib/Iconfont');
8+
9+
var _Iconfont2 = _interopRequireDefault(_Iconfont);
10+
11+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12+
13+
(0, _Iconfont2.default)({ name: 'iconfont', url: 'http://at.alicdn.com/t/font_w0iu3docuw4mfgvi.ttf' });
14+
15+
exports.default = {
16+
// 设置
17+
setting: '\uE61C',
18+
// 首页
19+
home: '\uE615',
20+
// 评价
21+
evaluate: '\uE611',
22+
// 短信
23+
msg: '\uE618',
24+
// 订单
25+
order: '\uE606',
26+
27+
home1: '\uE8E6',
28+
evaluate1: '\uE8F5',
29+
setting1: '\uE8F9',
30+
msg1: '\uE8EE',
31+
diamond: '\uE8DF',
32+
paperplane: '\uE8F3',
33+
search: '\uE8F8',
34+
note: '\uE8F2',
35+
calendar: '\uE8D8'
36+
};
37+
module.exports = exports['default'];

0 commit comments

Comments
 (0)