Skip to content

Commit 9fc60cf

Browse files
committed
init
0 parents  commit 9fc60cf

39 files changed

+1307
-0
lines changed

.babelrc

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": [
3+
"es2015",
4+
"stage-3"
5+
],
6+
"plugins": ["transform-class-properties"]
7+
}

.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
### OSX template
2+
.DS_Store
3+
.AppleDouble
4+
.LSOverride
5+
6+
# Icon must end with two \r
7+
Icon
8+
9+
# Thumbnails
10+
._*
11+
12+
# Files that might appear in the root of a volume
13+
.DocumentRevisions-V100
14+
.fseventsd
15+
.Spotlight-V100
16+
.TemporaryItems
17+
.Trashes
18+
.VolumeIcon.icns
19+
20+
# Directories potentially created on remote AFP share
21+
.AppleDB
22+
.AppleDesktop
23+
Network Trash Folder
24+
Temporary Items
25+
.apdisk
26+
27+
# Created by .ignore support plugin (hsz.mobi)
28+
29+
.idea
30+
node_modules
31+
publish.sh
32+
npm-debug.log
33+
dist

README.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
### weui-wechat
2+
3+
a Wechat web demo build with weui
4+
5+
### 开发
6+
7+
```
8+
git clone https://github.com/progrape/weui-wechat.git
9+
cd weui-wechat
10+
npm install
11+
npm start
12+
```
13+
14+
### 编译输出
15+
16+
```
17+
npm run build
18+
```
19+
20+
### License
21+
22+
MIT

package.json

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
{
2+
"name": "weui-wechat",
3+
"version": "1.0.0",
4+
"description": "wechat build with weui",
5+
"main": "index.js",
6+
"scripts": {
7+
"start": "webpack-dev-server --hot --inline --progress --colors --port 8080 --host 0.0.0.0",
8+
"build": "npm run clean && NODE_ENV=production webpack --progress --colors",
9+
"deploy": "npm run build && gh-pages -d dist",
10+
"clean": "rimraf ./dist"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/progrape/weui-wechat.git"
15+
},
16+
"keywords": [
17+
"weui",
18+
"example",
19+
"wechat",
20+
"weixin"
21+
],
22+
"author": "jf <[email protected]>",
23+
"license": "MIT",
24+
"bugs": {
25+
"url": "https://github.com/progrape/weui-wechat/issues"
26+
},
27+
"homepage": "https://weui.io",
28+
"dependencies": {
29+
"art-template": "^3.0.3",
30+
"fastclick": "^1.0.6",
31+
"jquery": "^2.2.1",
32+
"router": "git+https://github.com/progrape/router.git",
33+
"weui": "^0.4.2",
34+
"weui.js": "git+https://github.com/weui/weui.js.git"
35+
},
36+
"devDependencies": {
37+
"autoprefixer": "^6.3.3",
38+
"babel-core": "^6.7.0",
39+
"babel-loader": "^6.2.4",
40+
"babel-plugin-transform-class-properties": "^6.6.0",
41+
"babel-preset-es2015": "^6.6.0",
42+
"babel-preset-stage-3": "^6.5.0",
43+
"css-loader": "^0.23.1",
44+
"eslint": "^2.3.0",
45+
"file-loader": "^0.8.5",
46+
"gh-pages": "^0.12.0",
47+
"gulp": "^3.9.1",
48+
"gulp-tap": "^0.1.3",
49+
"html-webpack-plugin": "^2.15.0",
50+
"json-stable-stringify": "^1.0.1",
51+
"less": "^2.6.1",
52+
"less-loader": "^2.2.2",
53+
"open-browser-webpack-plugin": "0.0.2",
54+
"postcss-loader": "^0.8.1",
55+
"raw-loader": "^0.5.1",
56+
"rimraf": "^2.5.2",
57+
"style-loader": "^0.13.0",
58+
"url-loader": "^0.5.7",
59+
"vconsole": "^2.0.0",
60+
"webpack": "^1.12.14",
61+
"webpack-dev-server": "^1.14.1"
62+
}
63+
}

src/app.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import './app.less';
2+
import './lib/jsapi/jsapi';
3+
import attachFastClick from 'fastclick';
4+
import Router from 'router';
5+
import Lunch from './pages/lunch/lunch';
6+
import Home from './pages/home/home';
7+
import Profile from './pages/profile/profile';
8+
import Setting from './pages/setting/setting';
9+
import Security from './pages/security/security';
10+
import Notice from './pages/notice/notice';
11+
import Privacy from './pages/privacy/privacy';
12+
import Common from './pages/common/common';
13+
14+
attachFastClick.attach(document.body);
15+
16+
const router = new Router();
17+
router
18+
.push(Lunch)
19+
.push(Home)
20+
.push(Profile)
21+
.push(Setting)
22+
.push(Security)
23+
.push(Notice)
24+
.push(Privacy)
25+
.push(Common)
26+
.setDefault('/lunch')
27+
.init();

src/app.less

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
:global {
2+
html, body, .container, .home {
3+
height: 100%;
4+
}
5+
body {
6+
background-color: #FBF9FE;
7+
-webkit-tap-highlight-color: transparent;
8+
-webkit-touch-callout: none;
9+
-webkit-user-select: none;
10+
-khtml-user-select: none;
11+
-moz-user-select: none;
12+
-ms-user-select: none;
13+
user-select: none;
14+
}
15+
.weui-cells_checkbox {
16+
& > .weui-cell {
17+
& > * {
18+
pointer-events: none;
19+
}
20+
}
21+
}
22+
}

src/index.html

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
6+
<meta name="format-detection" content="telephone=no">
7+
<meta name="keywords" content="微信,WeUI,示例,案例">
8+
<meta name="description" content="WeUI 为微信 Web 服务量身设计">
9+
<title>weui-wechat</title>
10+
<link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/1.1.0/weui.min.css">
11+
</head>
12+
<body ontouchstart>
13+
<div id="container" class="container"></div>
14+
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
15+
</body>
16+
</html>

src/lib/dataManager/dataManager.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import localStorage from '../localStorage/localStorage';
2+
3+
let data = {};
4+
5+
export default {
6+
/**
7+
*
8+
* @param {String} key
9+
*/
10+
getData: function (key) {
11+
data = JSON.parse(localStorage.getItem('weui-wechat') || '{}') || data;
12+
return data[key];
13+
},
14+
/**
15+
*
16+
* @param {String} key
17+
* @param {Object} value
18+
*/
19+
setData: function (key, value) {
20+
data[key] = value;
21+
localStorage.setItem('weui-wechat', JSON.stringify(data));
22+
}
23+
}

src/lib/jsapi/jsapi.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import $ from 'jquery';
2+
$.getJSON('https://team.weui.io/api/sign?url=' + encodeURIComponent(location.href.split('#')[0])).success((res) => {
3+
wx.config({
4+
beta: true,
5+
debug: false,
6+
appId: res.appid,
7+
timestamp: res.timestamp,
8+
nonceStr: res.nonceStr,
9+
signature: res.signature,
10+
jsApiList: [
11+
'onMenuShareTimeline',
12+
'onMenuShareAppMessage',
13+
'onMenuShareQQ',
14+
'onMenuShareWeibo',
15+
'onMenuShareQZone',
16+
'scanQRCode',
17+
'setBounceBackground'
18+
]
19+
});
20+
21+
const option = {
22+
title: 'WeUI',
23+
desc: 'WeUI, 为微信 Web 服务量身设计',
24+
link: 'https://team.weui.io/jfeng/weui-wechat',
25+
imgUrl: 'https://mmrb.github.io/avatar/bear.jpg'
26+
};
27+
wx.ready(function () {
28+
wx.invoke('setBounceBackground', {
29+
'backgroundColor': '#F2F2F2',
30+
'footerBounceColor': '#F2F2F2'
31+
});
32+
wx.onMenuShareTimeline(option);
33+
wx.onMenuShareQQ(option);
34+
wx.onMenuShareAppMessage(option);
35+
});
36+
});

src/lib/localStorage/localStorage.js

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
3+
export default localStorage || {
4+
getItem: () => {},
5+
setItem: () => {}
6+
};

src/lib/template/template.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import template from 'art-template/dist/template-debug';
2+
3+
// register helper
4+
5+
export default template;

src/pages/common/common.html

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<div >
2+
<section >
3+
<div class="weui-cells" >
4+
<div class="weui-cell" >
5+
<div class="weui-cell__bd" >多语言</div>
6+
<div class="weui-cell__ft" ></div>
7+
</div>
8+
</div>
9+
<div class="weui-cells" >
10+
<div class="weui-cell" >
11+
<div class="weui-cell__bd" >字体大小</div>
12+
<div class="weui-cell__ft" ></div>
13+
</div>
14+
<div class="weui-cell" >
15+
<div class="weui-cell__bd" >聊天背景</div>
16+
<div class="weui-cell__ft" ></div>
17+
</div>
18+
<div class="weui-cell" >
19+
<div class="weui-cell__bd" >我的表情</div>
20+
<div class="weui-cell__ft" ></div>
21+
</div>
22+
<div class="weui-cell" >
23+
<div class="weui-cell__bd" >朋友圈小视频</div>
24+
<div class="weui-cell__ft" ></div>
25+
</div>
26+
</div>
27+
<div class="weui-cells" >
28+
<div class="weui-cell weui-cell_switch" >
29+
<div class="weui-cell__bd" >听筒模式</div>
30+
<div class="weui-cell__ft" ><input type="checkbox" class="weui-switch"
31+
></div>
32+
</div>
33+
</div>
34+
<div class="weui-cells" >
35+
<div class="weui-cell" >
36+
<div class="weui-cell__bd" >功能</div>
37+
<div class="weui-cell__ft" ></div>
38+
</div>
39+
</div>
40+
<div class="weui-cells" >
41+
<div class="weui-cell" >
42+
<div class="weui-cell__bd" >聊天记录迁移</div>
43+
<div class="weui-cell__ft" ></div>
44+
</div>
45+
<div class="weui-cell" >
46+
<div class="weui-cell__bd" >清理微信存储空间</div>
47+
<div class="weui-cell__ft" ></div>
48+
</div>
49+
</div>
50+
</section>
51+
</div>

src/pages/common/common.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import 'weui.js';
2+
import template from '../../lib/template/template';
3+
import tpl from 'raw!./common.html';
4+
import styles from './common.less';
5+
6+
export default {
7+
url: '/common',
8+
className: 'common',
9+
render: function () {
10+
return template.compile(tpl)({styles: styles});
11+
},
12+
bind: function () {
13+
14+
}
15+
};

src/pages/common/common.less

Whitespace-only changes.

src/pages/home/chats.js

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

src/pages/home/contacts.js

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

0 commit comments

Comments
 (0)