Skip to content

Commit c50d296

Browse files
committed
First commit
1 parent 11e47e8 commit c50d296

File tree

107 files changed

+47843
-0
lines changed

Some content is hidden

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

107 files changed

+47843
-0
lines changed

.npmrc

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
registry=https://r.cnpmjs.org
2+
disturl=https://r.cnpmjs.org/node
3+
sass_binary_site=https://r.cnpmjs.org/node-sass/
4+
fse_binary_host_mirror=https://r.cnpmjs.org/fsevents

config/dev.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
env: {
3+
NODE_ENV: '"development"'
4+
},
5+
defineConstants: {
6+
},
7+
weapp: {},
8+
h5: {}
9+
}

config/index.js

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
const config = {
2+
projectName: 'techcat',
3+
date: '2019-8-9',
4+
designWidth: 750,
5+
deviceRatio: {
6+
'640': 2.34 / 2,
7+
'750': 1,
8+
'828': 1.81 / 2
9+
},
10+
sourceRoot: 'src',
11+
outputRoot: 'dist',
12+
plugins: {
13+
babel: {
14+
sourceMap: true,
15+
presets: [
16+
['env', {
17+
modules: false
18+
}]
19+
],
20+
plugins: [
21+
'transform-decorators-legacy',
22+
'transform-class-properties',
23+
'transform-object-rest-spread'
24+
]
25+
}
26+
},
27+
defineConstants: {
28+
},
29+
copy: {
30+
patterns: [
31+
],
32+
options: {
33+
}
34+
},
35+
weapp: {
36+
module: {
37+
postcss: {
38+
autoprefixer: {
39+
enable: true,
40+
config: {
41+
browsers: [
42+
'last 3 versions',
43+
'Android >= 4.1',
44+
'ios >= 8'
45+
]
46+
}
47+
},
48+
pxtransform: {
49+
enable: true,
50+
config: {
51+
52+
}
53+
},
54+
url: {
55+
enable: true,
56+
config: {
57+
limit: 10240 // 设定转换尺寸上限
58+
}
59+
},
60+
cssModules: {
61+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
62+
config: {
63+
namingPattern: 'module', // 转换模式,取值为 global/module
64+
generateScopedName: '[name]__[local]___[hash:base64:5]'
65+
}
66+
}
67+
}
68+
}
69+
},
70+
h5: {
71+
publicPath: '/',
72+
staticDirectory: 'static',
73+
module: {
74+
postcss: {
75+
autoprefixer: {
76+
enable: true,
77+
config: {
78+
browsers: [
79+
'last 3 versions',
80+
'Android >= 4.1',
81+
'ios >= 8'
82+
]
83+
}
84+
},
85+
cssModules: {
86+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
87+
config: {
88+
namingPattern: 'module', // 转换模式,取值为 global/module
89+
generateScopedName: '[name]__[local]___[hash:base64:5]'
90+
}
91+
}
92+
}
93+
}
94+
}
95+
}
96+
97+
module.exports = function (merge) {
98+
if (process.env.NODE_ENV === 'development') {
99+
return merge({}, config, require('./dev'))
100+
}
101+
return merge({}, config, require('./prod'))
102+
}

config/prod.js

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
env: {
3+
NODE_ENV: '"production"'
4+
},
5+
defineConstants: {
6+
},
7+
weapp: {},
8+
h5: {
9+
/**
10+
* 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
11+
* 参考代码如下:
12+
* webpackChain (chain) {
13+
* chain.plugin('analyzer')
14+
* .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
15+
* }
16+
*/
17+
}
18+
}

dist/actions/counter.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
exports.minus = exports.add = undefined;
7+
exports.asyncAdd = asyncAdd;
8+
9+
var _counter = require("../constants/counter.js");
10+
11+
var add = exports.add = function add() {
12+
return {
13+
type: _counter.ADD
14+
};
15+
};
16+
var minus = exports.minus = function minus() {
17+
return {
18+
type: _counter.MINUS
19+
};
20+
};
21+
22+
// 异步的action
23+
function asyncAdd() {
24+
return function (dispatch) {
25+
setTimeout(function () {
26+
dispatch(add());
27+
}, 2000);
28+
};
29+
}

dist/app.js

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
"use strict";
2+
3+
Object.defineProperty(exports, "__esModule", {
4+
value: true
5+
});
6+
7+
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; }; }();
8+
9+
require("./npm/@tarojs/async-await/index.js");
10+
11+
var _index = require("./npm/@tarojs/taro-weapp/index.js");
12+
13+
var _index2 = _interopRequireDefault(_index);
14+
15+
var _index3 = require("./npm/@tarojs/redux/index.js");
16+
17+
var _index4 = require("./store/index.js");
18+
19+
var _index5 = _interopRequireDefault(_index4);
20+
21+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22+
23+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24+
25+
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; }
26+
27+
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; }
28+
29+
// 如果需要在 h5 环境中开启 React Devtools
30+
// 取消以下注释:
31+
// if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5') {
32+
// require('nerv-devtools')
33+
// }
34+
35+
var store = (0, _index5.default)();
36+
37+
(0, _index3.setStore)(store);
38+
39+
if (_index3.ReduxContext.Provider) {
40+
_index3.ReduxContext.Provider({
41+
store: store
42+
});
43+
_index3.ReduxContext.Provider({
44+
store: store
45+
});
46+
}
47+
48+
var _App = function (_BaseComponent) {
49+
_inherits(_App, _BaseComponent);
50+
51+
function _App() {
52+
var _ref;
53+
54+
var _temp, _this, _ret;
55+
56+
_classCallCheck(this, _App);
57+
58+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
59+
args[_key] = arguments[_key];
60+
}
61+
62+
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = _App.__proto__ || Object.getPrototypeOf(_App)).call.apply(_ref, [this].concat(args))), _this), _this.config = {
63+
pages: ['pages/index/index', 'pages/bookDetail/index', 'pages/bookShelter/index', 'pages/bookSorted/index', 'pages/about/index', 'pages/article/index'],
64+
window: {
65+
backgroundTextStyle: 'dark',
66+
navigationBarBackgroundColor: '#fff',
67+
navigationBarTitleText: '编程学习空间',
68+
navigationBarTextStyle: 'black'
69+
},
70+
tabBar: {
71+
list: [{
72+
pagePath: 'pages/index/index',
73+
text: '首页',
74+
iconPath: './assets/images/tabIndexOff.png',
75+
selectedIconPath: './assets/images/tabIndexOn.png'
76+
}, {
77+
pagePath: 'pages/bookShelter/index',
78+
text: '书架',
79+
iconPath: './assets/images/tabBooksOff.png',
80+
selectedIconPath: './assets/images/tabBooksOn.png'
81+
}, {
82+
pagePath: 'pages/about/index',
83+
text: '关于',
84+
iconPath: './assets/images/tabAboutOff.png',
85+
selectedIconPath: './assets/images/tabAboutOn.png'
86+
}],
87+
color: '#8a8a8a',
88+
selectedColor: '#2d8cf0',
89+
backgroundColor: '#ffffff',
90+
borderStyle: 'white'
91+
}
92+
}, _temp), _possibleConstructorReturn(_this, _ret);
93+
}
94+
95+
_createClass(_App, [{
96+
key: "componentDidMount",
97+
value: function componentDidMount() {}
98+
}, {
99+
key: "componentDidShow",
100+
value: function componentDidShow() {}
101+
}, {
102+
key: "componentDidHide",
103+
value: function componentDidHide() {}
104+
}, {
105+
key: "componentDidCatchError",
106+
value: function componentDidCatchError() {}
107+
108+
// 在 App 类中的 render() 函数没有实际作用
109+
// 请勿修改此函数
110+
111+
}, {
112+
key: "_createData",
113+
value: function _createData() {}
114+
}]);
115+
116+
return _App;
117+
}(_index.Component);
118+
119+
exports.default = _App;
120+
121+
App(require('./npm/@tarojs/taro-weapp/index.js').default.createApp(_App));
122+
_index2.default.initPxTransform({
123+
"designWidth": 750,
124+
"deviceRatio": {
125+
"640": 1.17,
126+
"750": 1,
127+
"828": 0.905
128+
}
129+
});

dist/app.json

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"pages": [
3+
"pages/index/index",
4+
"pages/bookDetail/index",
5+
"pages/bookShelter/index",
6+
"pages/bookSorted/index",
7+
"pages/about/index",
8+
"pages/article/index"
9+
],
10+
"window": {
11+
"backgroundTextStyle": "dark",
12+
"navigationBarBackgroundColor": "#fff",
13+
"navigationBarTitleText": "编程学习空间",
14+
"navigationBarTextStyle": "black"
15+
},
16+
"tabBar": {
17+
"list": [
18+
{
19+
"pagePath": "pages/index/index",
20+
"text": "首页",
21+
"iconPath": "./assets/images/tabIndexOff.png",
22+
"selectedIconPath": "./assets/images/tabIndexOn.png"
23+
},
24+
{
25+
"pagePath": "pages/bookShelter/index",
26+
"text": "书架",
27+
"iconPath": "./assets/images/tabBooksOff.png",
28+
"selectedIconPath": "./assets/images/tabBooksOn.png"
29+
},
30+
{
31+
"pagePath": "pages/about/index",
32+
"text": "关于",
33+
"iconPath": "./assets/images/tabAboutOff.png",
34+
"selectedIconPath": "./assets/images/tabAboutOn.png"
35+
}
36+
],
37+
"color": "#8a8a8a",
38+
"selectedColor": "#2d8cf0",
39+
"backgroundColor": "#ffffff",
40+
"borderStyle": "white"
41+
},
42+
"sitemapLocation": "sitemap.json"
43+
}

0 commit comments

Comments
 (0)