├── README.md ├── app.js ├── app.json ├── app.wxss ├── assets ├── .DS_Store ├── icons │ ├── Thumbs.db │ ├── grid-01.png │ ├── grid-02.png │ ├── grid-03.png │ ├── grid-04.png │ ├── grid-05.png │ ├── grid-06.png │ ├── grid-07.png │ ├── grid-08.png │ └── grid-09.png ├── images │ ├── Thumbs.db │ ├── avatar.png │ ├── banner-01.png │ ├── banner-02.png │ ├── banner1.png │ ├── banner2.png │ ├── banner3.png │ ├── banner4.png │ ├── link-01.png │ ├── link-02.png │ ├── p0.png │ ├── p3.png │ ├── p4.png │ └── p5.png └── tabs │ ├── Thumbs.db │ ├── contact-active.png │ ├── contact.png │ ├── home-active.png │ ├── home.png │ ├── message-active.png │ ├── message.png │ ├── profile-active.png │ └── profile.png ├── mini_server ├── app.js ├── pool.js └── public │ ├── Thumbs.db │ └── images │ ├── Thumbs.db │ ├── avatar.png │ ├── banner-01.png │ ├── banner-02.png │ ├── banner1.jpg │ ├── banner1.png │ ├── banner2-1.png │ ├── banner2-2.png │ ├── banner2-3.png │ ├── banner2-4.png │ ├── banner2.jpg │ ├── banner2.png │ ├── banner3.jpg │ ├── banner3.png │ ├── banner4.png │ ├── img1.jpg │ ├── img2.jpg │ ├── img3.jpg │ ├── img4.jpg │ ├── left-image-static.png │ ├── link-01.png │ ├── link-02.png │ ├── menu_bg2.jpg │ ├── p0.png │ ├── p3.png │ ├── p4.png │ └── p5.png ├── nodejs ├── app.js ├── db.sql ├── pool.js ├── public │ ├── 08index.html │ ├── 09用户中心.html │ ├── 11-socket-client.html │ ├── index.html │ ├── jq.js │ ├── login.html │ ├── logout.html │ ├── sales_canvas_01.html │ ├── sales_canvas_03.html │ ├── sales_canvas_04.html │ ├── sales_canvas_05.html │ └── sales_svg_02.html └── readme.txt ├── pages ├── contact │ ├── contact.js │ ├── contact.json │ ├── contact.wxml │ └── contact.wxss ├── detail │ ├── detail.js │ ├── detail.json │ ├── detail.wxml │ └── detail.wxss ├── home │ ├── home.js │ ├── home.json │ ├── home.wxml │ └── home.wxss ├── index │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss └── news │ ├── news.js │ ├── news.json │ ├── news.wxml │ └── news.wxss ├── project.config.json ├── utils └── util.js └── 测试.txt /README.md: -------------------------------------------------------------------------------- 1 | 2 | ## 预览 3 | 4 | ![豆瓣电影演示](https://github.com/zce/weapp-demo/raw/tutorial/preview.gif) 5 | 6 | 7 | 8 | ## 完整特性 9 | 10 | - 开发阶段与生产阶段分离。 11 | - 自动化生成新页面所需文件并添加到配置中。 12 | - 以`Standard Code Style`校验全部的`js`和`json`文件。 13 | - 开发阶段`json`配置文件可以有注释,方便备注。 14 | - 代码中集成部分文档内容,减少查文档的时间。 15 | - 开发阶段可以使用`less`完成样式编码,原因你懂得~ (如果你了解这些,当然可以支持`sass`等其他预处理样式)。 16 | - 借助`babel`自动进行`ES2015`特性转换,放心使用新特性。 17 | - 开发阶段用`xml`文件后缀取代`wxml`后缀,避免在开发工具中配置代码高亮。 18 | - Source Map 19 | - Travis CI 20 | 21 | ## 操作步骤 22 | 23 | ### for English 24 | 25 | [README.en.md](./README.en.md) 26 | 27 | ### 将项目克隆到本地 28 | 29 | 用到了`GIT`环境,没有环境的话请自行解决吧。 30 | 31 | ```shell 32 | # 定位到任意目录 33 | $ cd path/to/root 34 | 35 | # 克隆仓库到指定的文件夹 36 | $ git clone git@github.com:TencentIT/weixinPro.git 37 | 38 | # 进入指定的文件夹 39 | $ cd [project-name] 40 | ``` 41 | 42 | ### 安装项目`NPM`依赖 43 | 44 | 用到了`Node`环境,没有环境的话也请自行解决吧。 45 | 46 | ```shell 47 | $ npm install 48 | ``` 49 | 50 | 51 | ## 使用说明 52 | 53 | ### for English 54 | 55 | [README.en.md](./README.en.md) 56 | 57 | ### 开发阶段 58 | 59 | 执行如下命令 60 | 61 | ```shell 62 | # 启动监视 63 | $ npm run watch 64 | ``` 65 | 66 | 通过`微信Web开放者工具`打开项目根目录下`dist`文件夹,预览~ 67 | 68 | - 打开`微信Web开放者工具`,选择`添加项目`,填写或选择相应信息 69 |  + AppID:点击右下角`无AppID`(个人用户可以申请) 70 | + 项目名称:随便填写,因为不涉及到部署,所以无所谓 71 | + 项目目录:选择项目根目录下`dist`文件夹 72 | + 点击`添加项目` 73 | - 可以通过任意开发工具完成`src`下的编码,`gulp`会监视项目根目录下`src`文件夹,当文件变化自动编译 74 | - 注意在微信公众平台后台添加域名白名单设置或者关闭开发阶段对请求域名安全的校验 75 | + https://api.map.baidu.com 76 | + https://douban.uieee.com 77 | 78 | #### 创建新页面 79 | 80 | 执行如下命令 81 | 82 | ```shell 83 | # 启动生成器 84 | $ npm run generate 85 | ? Input the page name (index) [page-name] 86 | ? Do you need a configuration file (y/N) N 87 | ? Select a style framework (Use arrow keys) 88 | > less 89 | # 自动生成... 90 | ``` 91 | 92 | 由于微信小程序的每一个页面有特定的结构,新建工作比较繁琐。可以通过此任务减少操作。 93 | 94 | ### 生产阶段 95 | 96 | 执行如下命令 97 | 98 | ```shell 99 | # 启动编译 100 | $ npm run build 101 | ``` 102 | 103 | 生产阶段的代码会经过压缩处理,最终输出到`dist`下。 104 | 105 | 同样可以通过`微信Web开放者工具`测试。 106 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | App({ 2 | 3 | /** 4 | * 当小程序初始化完成时,会触发 onLaunch(全局只触发一次) 5 | */ 6 | onLaunch: function () { 7 | console.log("1 程序初始化完成") 8 | }, 9 | 10 | /** 11 | * 当小程序启动,或从后台进入前台显示,会触发 onShow 12 | */ 13 | onShow: function (options) { 14 | console.log("2 程序启动") 15 | console.log(options) 16 | }, 17 | 18 | /** 19 | * 当小程序从前台进入后台,会触发 onHide 20 | */ 21 | onHide: function () { 22 | console.log("3 进入后台") 23 | }, 24 | 25 | /** 26 | * 当小程序发生脚本错误,或者 api 调用失败时,会触发 onError 并带上错误信息 27 | */ 28 | onError: function (msg) { 29 | 30 | } 31 | }) 32 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages": [ 3 | "pages/detail/detail", 4 | "pages/contact/contact", 5 | "pages/logs/logs", 6 | "pages/home/home", 7 | "pages/index/index", 8 | "pages/news/news" 9 | ], 10 | "window": { 11 | "backgroundTextStyle": "light", 12 | "navigationBarBackgroundColor": "#e8e", 13 | "navigationBarTitleText": "学子商城", 14 | "navigationBarTextStyle": "white", 15 | "enablePullDownRefresh": true 16 | }, 17 | "tabBar": { 18 | "position": "bottom", 19 | "color": "#000", 20 | "selectedColor": "#fc0", 21 | "backgroundColor": "#aaa", 22 | "borderStyle": "#f00", 23 | "list": [{ 24 | "pagePath": "pages/logs/logs", 25 | "text": "首页", 26 | "iconPath": "assets/tabs/home.png", 27 | "selectedIconPath": "assets/tabs/home-active.png" 28 | }, 29 | { 30 | "pagePath": "pages/index/index", 31 | "text": "消息", 32 | "iconPath": "assets/tabs/message.png", 33 | "selectedIconPath": "assets/tabs/message-active.png" 34 | }, 35 | { 36 | "pagePath": "pages/logs/logs", 37 | "text": "我的", 38 | "iconPath": "assets/tabs/profile.png", 39 | "selectedIconPath": "assets/tabs/profile-active.png" 40 | }, 41 | { 42 | "pagePath": "pages/index/index", 43 | "text": "联系我们", 44 | "iconPath": "assets/tabs/contact.png", 45 | "selectedIconPath": "assets/tabs/contact-active.png" 46 | } 47 | ] 48 | } 49 | } -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | 3 | .container { 4 | height: 100%; 5 | display: flex; 6 | flex-direction: column; 7 | align-items: center; 8 | justify-content: space-between; 9 | padding: 200rpx 0; 10 | box-sizing: border-box; 11 | } 12 | 13 | li { 14 | list-style: none; 15 | } 16 | 17 | 18 | /* 右侧边线 */ 19 | 20 | .bdr { 21 | position: relative; 22 | } 23 | 24 | .bdr::after { 25 | content: ""; 26 | display: block; 27 | width: 1rpx; 28 | height: 100%; 29 | position: absolute; 30 | right: 0; 31 | top: 0; 32 | border-right: 1px solid #ccc; 33 | } 34 | 35 | 36 | /* 通用灰色分割块 */ 37 | 38 | .divider { 39 | height: 20px; 40 | background: #f1f1f1; 41 | box-shadow: 0 5rpx 5rpx rgba(0, 0, 0, .1) inset; 42 | } 43 | 44 | .cell-item { 45 | border-bottom: 1rpx solid #ddd; 46 | padding: 20rpx 30rpx; 47 | } -------------------------------------------------------------------------------- /assets/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/.DS_Store -------------------------------------------------------------------------------- /assets/icons/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/Thumbs.db -------------------------------------------------------------------------------- /assets/icons/grid-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-01.png -------------------------------------------------------------------------------- /assets/icons/grid-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-02.png -------------------------------------------------------------------------------- /assets/icons/grid-03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-03.png -------------------------------------------------------------------------------- /assets/icons/grid-04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-04.png -------------------------------------------------------------------------------- /assets/icons/grid-05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-05.png -------------------------------------------------------------------------------- /assets/icons/grid-06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-06.png -------------------------------------------------------------------------------- /assets/icons/grid-07.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-07.png -------------------------------------------------------------------------------- /assets/icons/grid-08.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-08.png -------------------------------------------------------------------------------- /assets/icons/grid-09.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/icons/grid-09.png -------------------------------------------------------------------------------- /assets/images/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/Thumbs.db -------------------------------------------------------------------------------- /assets/images/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/avatar.png -------------------------------------------------------------------------------- /assets/images/banner-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/banner-01.png -------------------------------------------------------------------------------- /assets/images/banner-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/banner-02.png -------------------------------------------------------------------------------- /assets/images/banner1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/banner1.png -------------------------------------------------------------------------------- /assets/images/banner2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/banner2.png -------------------------------------------------------------------------------- /assets/images/banner3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/banner3.png -------------------------------------------------------------------------------- /assets/images/banner4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/banner4.png -------------------------------------------------------------------------------- /assets/images/link-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/link-01.png -------------------------------------------------------------------------------- /assets/images/link-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/link-02.png -------------------------------------------------------------------------------- /assets/images/p0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/p0.png -------------------------------------------------------------------------------- /assets/images/p3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/p3.png -------------------------------------------------------------------------------- /assets/images/p4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/p4.png -------------------------------------------------------------------------------- /assets/images/p5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/images/p5.png -------------------------------------------------------------------------------- /assets/tabs/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/Thumbs.db -------------------------------------------------------------------------------- /assets/tabs/contact-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/contact-active.png -------------------------------------------------------------------------------- /assets/tabs/contact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/contact.png -------------------------------------------------------------------------------- /assets/tabs/home-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/home-active.png -------------------------------------------------------------------------------- /assets/tabs/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/home.png -------------------------------------------------------------------------------- /assets/tabs/message-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/message-active.png -------------------------------------------------------------------------------- /assets/tabs/message.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/message.png -------------------------------------------------------------------------------- /assets/tabs/profile-active.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/profile-active.png -------------------------------------------------------------------------------- /assets/tabs/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/assets/tabs/profile.png -------------------------------------------------------------------------------- /mini_server/app.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const mysql = require("mysql"); 3 | const pool = require("./pool"); 4 | var app = express(); 5 | app.use(express.static(__dirname+"/public")); 6 | app.listen(3003); 7 | 8 | app.get("/imgList",(req,res)=>{ 9 | var obj = [ 10 | {id:1,pic:"http://127.0.0.1:3003/images/banner1.png"}, 11 | {id:1,pic:"http://127.0.0.1:3003/images/banner2.png"}, 12 | {id:1,pic:"http://127.0.0.1:3003/images/banner3.png"}, 13 | {id:1,pic:"http://127.0.0.1:3003/images/banner4.png"} 14 | ]; 15 | res.send(obj) 16 | }) 17 | 18 | app.get("/message",(req,res)=>{ 19 | var rows = []; 20 | rows.push({ 21 | title:"手机大促",date:"2018-11-11",img_url:"http://127.0.0.1:3003/images/banner1.png",des:"越努力,越...",}) 22 | rows.push({ 23 | title:"pad大促",date:"2018-11-11", 24 | img_url:"http://127.0.0.1:3003/images/banner2.png",des:"越努力,越...",}) 25 | rows.push( 26 | {title:"洗衣粉大促",date:"2018-11-11", 27 | img_url:"http://127.0.0.1:3003/images/banner3.png",des:"越努力,越...",}) 28 | rows.push( 29 | {title:"洗衣粉大促",date:"2018-11-11", 30 | img_url:"http://127.0.0.1:3003/images/banner4.png",des:"越努力,越...",}) 31 | res.send(rows); 32 | }); -------------------------------------------------------------------------------- /mini_server/pool.js: -------------------------------------------------------------------------------- 1 | //创建mysql连接池 2 | const mysql = require('mysql'); 3 | var pool = mysql.createPool({ 4 | host: '127.0.0.1', 5 | user: 'root', 6 | password: '', 7 | database: 'web1806', 8 | connectionLimit: 10 9 | }); 10 | //把创建好的连接池导出 11 | module.exports = pool; 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /mini_server/public/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/Thumbs.db -------------------------------------------------------------------------------- /mini_server/public/images/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/Thumbs.db -------------------------------------------------------------------------------- /mini_server/public/images/avatar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/avatar.png -------------------------------------------------------------------------------- /mini_server/public/images/banner-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner-01.png -------------------------------------------------------------------------------- /mini_server/public/images/banner-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner-02.png -------------------------------------------------------------------------------- /mini_server/public/images/banner1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner1.jpg -------------------------------------------------------------------------------- /mini_server/public/images/banner1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner1.png -------------------------------------------------------------------------------- /mini_server/public/images/banner2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner2-1.png -------------------------------------------------------------------------------- /mini_server/public/images/banner2-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner2-2.png -------------------------------------------------------------------------------- /mini_server/public/images/banner2-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner2-3.png -------------------------------------------------------------------------------- /mini_server/public/images/banner2-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner2-4.png -------------------------------------------------------------------------------- /mini_server/public/images/banner2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner2.jpg -------------------------------------------------------------------------------- /mini_server/public/images/banner2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner2.png -------------------------------------------------------------------------------- /mini_server/public/images/banner3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner3.jpg -------------------------------------------------------------------------------- /mini_server/public/images/banner3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner3.png -------------------------------------------------------------------------------- /mini_server/public/images/banner4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/banner4.png -------------------------------------------------------------------------------- /mini_server/public/images/img1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/img1.jpg -------------------------------------------------------------------------------- /mini_server/public/images/img2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/img2.jpg -------------------------------------------------------------------------------- /mini_server/public/images/img3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/img3.jpg -------------------------------------------------------------------------------- /mini_server/public/images/img4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/img4.jpg -------------------------------------------------------------------------------- /mini_server/public/images/left-image-static.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/left-image-static.png -------------------------------------------------------------------------------- /mini_server/public/images/link-01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/link-01.png -------------------------------------------------------------------------------- /mini_server/public/images/link-02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/link-02.png -------------------------------------------------------------------------------- /mini_server/public/images/menu_bg2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/menu_bg2.jpg -------------------------------------------------------------------------------- /mini_server/public/images/p0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/p0.png -------------------------------------------------------------------------------- /mini_server/public/images/p3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/p3.png -------------------------------------------------------------------------------- /mini_server/public/images/p4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/p4.png -------------------------------------------------------------------------------- /mini_server/public/images/p5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/mini_server/public/images/p5.png -------------------------------------------------------------------------------- /nodejs/app.js: -------------------------------------------------------------------------------- 1 | //1:加载相应模块 2 | const express = require("express"); 3 | const mysql = require("mysql"); 4 | const pool = require("./pool"); 5 | //2:创建express服务器 6 | var app = express(); 7 | app.use(express.static(__dirname+"/public")); 8 | //3:绑定监听端口 9 | app.listen(3000); 10 | //4:处理请求分析 11 | //GET /sales 查询销售数据 12 | //商品编号 商品名称 商品销售额 13 | //?参数 没参数 14 | //?sql 多表查询套路 15 | //(1)将查询表名保存FROM 后面 16 | // FROM yaopin INNER JOIN xiaoshou 17 | //(2)为表名起一个别名 18 | // FROM yaopin y INNER JOIN xiaoshou x 19 | //(3)找二个表之间关系(两个列相等 不相等 大于 小于) 20 | // ON y.id = x.yid 21 | app.get("/sales",(req,res)=>{ 22 | var sql = " SELECT y.id,y.name,x.sales"; 23 | sql +=" FROM yaopin y INNER JOIN xiaoshou x"; 24 | sql +=" ON y.id = x.yid"; 25 | pool.query(sql,(err,result)=>{ 26 | if(err)throw err; 27 | res.send(result); 28 | }); 29 | }); 30 | 31 | app.get("/salesmonth",(req,res)=>{ 32 | var id = parseInt(req.query.id); 33 | var sql = " SELECT y.id,y.name,x.sales,x.month"; 34 | sql+=" FROM yaopin y INNER JOIN xiaoshou x"; 35 | sql+=" ON y.id = x.yid"; 36 | sql+=" WHERE x.yid = ?"; 37 | pool.query(sql,[id],(err,result)=>{ 38 | if(err)throw err; 39 | res.send(result); 40 | }) 41 | }) 42 | 43 | //5:处理请求 44 | // GET /bank 查询库存数据 45 | // 商品编号 商品名称 库存量 46 | 47 | app.get("/salesyear",(req,res)=>{ 48 | var sql = "SELECT year ,sum(sales) as c " 49 | sql+=" FROM xiaoshou" 50 | sql+=" Group BY year" 51 | pool.query(sql,(err,result)=>{ 52 | if(err) throw err; 53 | res.send(result) 54 | }) 55 | }) 56 | 57 | app.get("/img",(req,res)=>{ 58 | var obj = [ 59 | {id:1,pic:"http://localhost:3000/assets/images/banner-01.png"}, 60 | {id:1,pic:"http://localhost:3000/assets/images/banner1.jpg"}, 61 | {id:1,pic:"http://localhost:3000/assets/images/banner-02.png"}, 62 | {id:1,pic:"http://localhost:3000/assets/images/banner2.jpg"} 63 | ]; 64 | res.send(obj) 65 | 66 | }) -------------------------------------------------------------------------------- /nodejs/db.sql: -------------------------------------------------------------------------------- 1 | USE web1806; 2 | #药品yaopin [id,name,price] 3 | #库存kucun [id,yid,bank] 4 | #销售xiaoshou [id,yid,sales] 5 | CREATE TABLE yaopin( 6 | id INT PRIMARY KEY AUTO_INCREMENT, 7 | name VARCHAR(255), 8 | price DECIMAL(10,2) 9 | ); 10 | CREATE TABLE kucun( 11 | id INT PRIMARY KEY AUTO_INCREMENT, 12 | yid INT, 13 | bank INT 14 | ); 15 | CREATE TABLE xiaoshou( 16 | id INT PRIMARY KEY AUTO_INCREMENT, 17 | yid INT, 18 | sales DECIMAL(10,2) 19 | ); 20 | INSERT INTO yaopin VALUES(null,'六味地黄丸',100); 21 | INSERT INTO yaopin VALUES(null,'五味地黄丸',90); 22 | INSERT INTO yaopin VALUES(null,'999感冒灵',10); 23 | INSERT INTO yaopin VALUES(null,'阿莫西林',12); 24 | INSERT INTO kucun VALUES(null,1,900); 25 | INSERT INTO kucun VALUES(null,2,300); 26 | INSERT INTO kucun VALUES(null,3,3000); 27 | INSERT INTO kucun VALUES(null,4,10000); 28 | INSERT INTO xiaoshou VALUES(null,1,3000.00); 29 | INSERT INTO xiaoshou VALUES(null,2,3200.00); 30 | INSERT INTO xiaoshou VALUES(null,3,9000.00); 31 | INSERT INTO xiaoshou VALUES(null,4,1200.00); 32 | 33 | -------------------------------------------------------------------------------- /nodejs/pool.js: -------------------------------------------------------------------------------- 1 | //创建mysql连接池 2 | const mysql = require('mysql'); 3 | var pool = mysql.createPool({ 4 | host: '127.0.0.1', 5 | user: 'root', 6 | password: '', 7 | database: 'web1806', 8 | connectionLimit: 10 9 | }); 10 | //把创建好的连接池导出 11 | module.exports = pool; 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /nodejs/public/08index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 22 | 23 | 24 |

首页

25 | //下拉列表 26 | 32 | 33 | 去用户中心 34 | 35 |
36 | 37 | 52 | 53 | -------------------------------------------------------------------------------- /nodejs/public/09用户中心.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 用户中心 5 | 19 | 20 | 21 |

用户中心

22 | 31 | 32 | -------------------------------------------------------------------------------- /nodejs/public/11-socket-client.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | websocket 5 | 6 | 7 |

websocket

8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 40 | -------------------------------------------------------------------------------- /nodejs/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | index.html 5 | 20 | 21 | 22 | 23 |
24 |

index.html

25 | 请登录
26 | 注销用户 27 |
28 | 29 | 48 | 49 | -------------------------------------------------------------------------------- /nodejs/public/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | login.html 5 | 17 | 18 | 19 |
20 |

login.html

21 | 22 |
23 | 用户名
24 | 密码
25 | 26 | 27 |
28 | 29 |
30 | 31 | 53 | 54 | -------------------------------------------------------------------------------- /nodejs/public/logout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | logout.html 5 | 17 | 18 | 19 |
20 |

logout.html

21 |

您已经退出登录

22 |
23 | 24 | 34 | 35 | -------------------------------------------------------------------------------- /nodejs/public/sales_canvas_01.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 12 | 13 | 14 |

一路发发发药品公司

15 | 16 | 您的浏览器版本太低,请升级!!! 17 | 18 | 19 | 54 | 55 | -------------------------------------------------------------------------------- /nodejs/public/sales_canvas_03.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 12 | 13 | 14 |

一路发发发药品公司

15 | 16 | 您的浏览器版本太低,请升级!!! 17 | 18 | 19 | 42 | 43 | -------------------------------------------------------------------------------- /nodejs/public/sales_canvas_04.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 12 | 13 | 14 |

一路发发发药品公司

15 | 16 | 您的浏览器版本太低,请升级!!! 17 | 18 | 19 | 48 | 49 | -------------------------------------------------------------------------------- /nodejs/public/sales_canvas_05.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 12 | 13 | 14 |

一路发发发药品公司

15 | 16 | 您的浏览器版本太低,请升级!!! 17 | 18 | 19 | 45 | 46 | -------------------------------------------------------------------------------- /nodejs/public/sales_svg_02.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Document 8 | 12 | 13 | 14 |

一路发发发药品公司:svg版本

15 | 16 | 您的浏览器版本太低,请升级!!! 17 | 18 | 19 | 44 | 45 | -------------------------------------------------------------------------------- /nodejs/readme.txt: -------------------------------------------------------------------------------- 1 | 药品公司有一些数据 2 | 六味地黄丸,泻立停, 999感冒灵,阿莫西林 3 | 3月 15 4月 5 5月 5 6月 3[销售] 4 | 3000 2000 2000 1002 [库存] 5 | -依据数据创建表? 6 | 药品:[六味地黄丸,泻立停, 999感冒灵,阿莫西林] 7 | 销售:[3/4/5/6/7/8/..] 8 | 库存:[3/4/5/6/7/8..] 9 | web1806 10 | 药品yaopin [id,name,price] 11 | 库存kucun [id,yid,bank] 12 | 销售xiaoshou [id,yid,sales] 13 | db.sql 14 | 15 | 16 | -依据数据创建销售统计图;库存量图 17 | (1)app.js 18 | (2)public/sales.html bank.html 19 | jq.js 20 | 21 | 22 | 作业1:每一款药品销售额[一月,二月,...十二月] 23 | 作业2:修改表额售表[id,yid,sales,month,year] 24 | ALTER TABLE xiaoshou ADD month INT; 25 | ALTER TABLE xiaoshou ADD year INT; 26 | DELETE FROM xiaoshou; 27 | INSERT INTO xiaoshou VALUES(null,1,1000,1,2017); 28 | INSERT INTO xiaoshou VALUES(null,1,1200,2,2017); 29 | INSERT INTO xiaoshou VALUES(null,1,1200,3,2017); 30 | INSERT INTO xiaoshou VALUES(null,1,1300,4,2017); 31 | INSERT INTO xiaoshou VALUES(null,1,1400,5,2017); 32 | INSERT INTO xiaoshou VALUES(null,1,1500,6,2017); 33 | INSERT INTO xiaoshou VALUES(null,1,1600,7,2017); 34 | INSERT INTO xiaoshou VALUES(null,1,1100,8,2017); 35 | INSERT INTO xiaoshou VALUES(null,1,1900,9,2017); 36 | INSERT INTO xiaoshou VALUES(null,1,1900,10,2017); 37 | INSERT INTO xiaoshou VALUES(null,1,900,11,2017); 38 | INSERT INTO xiaoshou VALUES(null,1,200,12,2017); 39 | 40 | 药品id,药品名称,药品销售额,当前月份 41 | yaopin xiaoshou 42 | 43 | app.js GET /salesmonth?id=1 44 | 9:32 45 | SELECT y.id,y.name,x.sales,x.month 46 | FROM yaopin y INNER JOIN xiaoshou x 47 | ON y.id = x.yid 48 | WHERE y.id = 1; 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 作业3:药品名称[十二月销售额] 68 | -------------------------------------------------------------------------------- /pages/contact/contact.js: -------------------------------------------------------------------------------- 1 | // pages/contact/contact.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | 16 | }, 17 | 18 | /** 19 | * 生命周期函数--监听页面初次渲染完成 20 | */ 21 | onReady: function () { 22 | 23 | }, 24 | 25 | /** 26 | * 生命周期函数--监听页面显示 27 | */ 28 | onShow: function () { 29 | 30 | }, 31 | 32 | /** 33 | * 生命周期函数--监听页面隐藏 34 | */ 35 | onHide: function () { 36 | 37 | }, 38 | 39 | /** 40 | * 生命周期函数--监听页面卸载 41 | */ 42 | onUnload: function () { 43 | 44 | }, 45 | 46 | /** 47 | * 页面相关事件处理函数--监听用户下拉动作 48 | */ 49 | onPullDownRefresh: function () { 50 | 51 | }, 52 | 53 | /** 54 | * 页面上拉触底事件的处理函数 55 | */ 56 | onReachBottom: function () { 57 | 58 | }, 59 | 60 | /** 61 | * 用户点击右上角分享 62 | */ 63 | onShareAppMessage: function () { 64 | 65 | }, 66 | submitHandle(e){ 67 | // console.log(e); 68 | var uname = e.detail.value.uname; 69 | var upwd = e.detail.value.upwd; 70 | var reg = /^[a-z0-9]{3,12}$/i; 71 | if(!reg.test(uname)){ 72 | wx.showToast({ 73 | title:"用户名不能为空", 74 | icon:"loading", 75 | duration:2500 76 | }) 77 | } 78 | setTimeout(()=>{ 79 | wx.hideToast(); 80 | },3000) 81 | return; 82 | } 83 | }) -------------------------------------------------------------------------------- /pages/contact/contact.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/contact/contact.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 添加用户信息 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
-------------------------------------------------------------------------------- /pages/contact/contact.wxss: -------------------------------------------------------------------------------- 1 | /* pages/contact/contact.wxss */ -------------------------------------------------------------------------------- /pages/detail/detail.js: -------------------------------------------------------------------------------- 1 | // pages/detail/detail.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | imgList:[] 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | wx.request({ 16 | url:"http://127.0.0.1:3003/message", 17 | success:(res)=>{ 18 | console.log(res); 19 | this.setData({ 20 | imgList:res.data 21 | }) 22 | } 23 | }) 24 | }, 25 | 26 | /** 27 | * 生命周期函数--监听页面初次渲染完成 28 | */ 29 | onReady: function () { 30 | 31 | }, 32 | 33 | /** 34 | * 生命周期函数--监听页面显示 35 | */ 36 | onShow: function () { 37 | 38 | }, 39 | 40 | /** 41 | * 生命周期函数--监听页面隐藏 42 | */ 43 | onHide: function () { 44 | 45 | }, 46 | 47 | /** 48 | * 生命周期函数--监听页面卸载 49 | */ 50 | onUnload: function () { 51 | 52 | }, 53 | 54 | /** 55 | * 页面相关事件处理函数--监听用户下拉动作 56 | */ 57 | onPullDownRefresh: function () { 58 | 59 | }, 60 | 61 | /** 62 | * 页面上拉触底事件的处理函数 63 | */ 64 | onReachBottom: function () { 65 | 66 | }, 67 | 68 | /** 69 | * 用户点击右上角分享 70 | */ 71 | onShareAppMessage: function () { 72 | 73 | } 74 | }) -------------------------------------------------------------------------------- /pages/detail/detail.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/detail/detail.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /pages/detail/detail.wxss: -------------------------------------------------------------------------------- 1 | /* pages/detail/detail.wxss */ -------------------------------------------------------------------------------- /pages/home/home.js: -------------------------------------------------------------------------------- 1 | // pages/home/home.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | message:"小程序数据", 9 | app:"home", 10 | rows:[{id:1,name:"华为"},{id:2,name:"iPhone9"}], 11 | 12 | }, 13 | 14 | /** 15 | * 生命周期函数--监听页面加载 16 | */ 17 | onLoad: function (options) { 18 | wx.request({ 19 | url:"http://127.0.0.1:3000/imgList", 20 | pmethod:"get", 21 | success:(result)=>{ 22 | console.log(result) 23 | // this.rows = res.data; 错误的写法 24 | this.setData({ 25 | rows:result.data 26 | }) 27 | } 28 | }) 29 | }, 30 | 31 | /** 32 | * 生命周期函数--监听页面初次渲染完成 33 | */ 34 | onReady: function () { 35 | 36 | }, 37 | 38 | /** 39 | * 生命周期函数--监听页面显示 40 | */ 41 | onShow: function () { 42 | 43 | }, 44 | 45 | /** 46 | * 生命周期函数--监听页面隐藏 47 | */ 48 | onHide: function () { 49 | 50 | }, 51 | 52 | /** 53 | * 生命周期函数--监听页面卸载 54 | */ 55 | onUnload: function () { 56 | 57 | }, 58 | 59 | /** 60 | * 页面相关事件处理函数--监听用户下拉动作 61 | */ 62 | onPullDownRefresh: function () { 63 | 64 | }, 65 | 66 | /** 67 | * 页面上拉触底事件的处理函数 68 | */ 69 | onReachBottom: function () { 70 | 71 | }, 72 | 73 | /** 74 | * 用户点击右上角分享 75 | */ 76 | onShareAppMessage: function () { 77 | 78 | } 79 | }) -------------------------------------------------------------------------------- /pages/home/home.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/home/home.wxml: -------------------------------------------------------------------------------- 1 | 2 | {{message}} 3 | 4 | 5 | 6 | home 7 | 8 | 9 | 10 | {{item.name}} 11 | 12 | 13 | 14 | 15 | 16 | 17 | 跳转不同组件 18 | 19 | 20 | 21 | 代码方式跳转 22 | -------------------------------------------------------------------------------- /pages/home/home.wxss: -------------------------------------------------------------------------------- 1 | /* pages/home/home.wxss */ -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | const app = getApp() 4 | 5 | Page({ 6 | data: { 7 | motto: 'Hello World', 8 | userInfo: {}, 9 | hasUserInfo: false, 10 | canIUse: wx.canIUse('button.open-type.getUserInfo') 11 | }, 12 | //事件处理函数 13 | bindViewTap: function() { 14 | wx.navigateTo({ 15 | url: '../logs/logs' 16 | }) 17 | }, 18 | onLoad: function () { 19 | if (app.globalData.userInfo) { 20 | this.setData({ 21 | userInfo: app.globalData.userInfo, 22 | hasUserInfo: true 23 | }) 24 | } else if (this.data.canIUse){ 25 | // 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回 26 | // 所以此处加入 callback 以防止这种情况 27 | app.userInfoReadyCallback = res => { 28 | this.setData({ 29 | userInfo: res.userInfo, 30 | hasUserInfo: true 31 | }) 32 | } 33 | } else { 34 | // 在没有 open-type=getUserInfo 版本的兼容处理 35 | wx.getUserInfo({ 36 | success: res => { 37 | app.globalData.userInfo = res.userInfo 38 | this.setData({ 39 | userInfo: res.userInfo, 40 | hasUserInfo: true 41 | }) 42 | } 43 | }) 44 | } 45 | }, 46 | getUserInfo: function(e) { 47 | console.log(e) 48 | app.globalData.userInfo = e.detail.userInfo 49 | this.setData({ 50 | userInfo: e.detail.userInfo, 51 | hasUserInfo: true 52 | }) 53 | } 54 | }) 55 | -------------------------------------------------------------------------------- /pages/index/index.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | {{userInfo.nickName}} 8 | 9 | 10 | 11 | {{motto}} 12 | 13 | 14 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | /**index.wxss**/ 2 | .userinfo { 3 | display: flex; 4 | flex-direction: column; 5 | align-items: center; 6 | } 7 | 8 | .userinfo-avatar { 9 | width: 128rpx; 10 | height: 128rpx; 11 | margin: 20rpx; 12 | border-radius: 50%; 13 | } 14 | 15 | .userinfo-nickname { 16 | color: #aaa; 17 | } 18 | 19 | .usermotto { 20 | margin-top: 200px; 21 | } -------------------------------------------------------------------------------- /pages/logs/logs.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | 3 | /** 4 | * 页面的初始数据 5 | */ 6 | data: { 7 | logsImage:[] 8 | }, 9 | 10 | /** 11 | * 生命周期函数--监听页面加载 12 | */ 13 | onLoad: function (options) { 14 | wx.request({ 15 | url:"http://127.0.0.1:3003/imgList", 16 | type:"get", 17 | success:(result)=>{ 18 | console.log(result) 19 | this.setData({ 20 | logsImage:result.data 21 | }) 22 | 23 | } 24 | }) 25 | }, 26 | 27 | /** 28 | * 生命周期函数--监听页面初次渲染完成 29 | */ 30 | onReady: function () { 31 | 32 | }, 33 | 34 | /** 35 | * 生命周期函数--监听页面显示 36 | */ 37 | onShow: function () { 38 | 39 | }, 40 | 41 | /** 42 | * 生命周期函数--监听页面隐藏 43 | */ 44 | onHide: function () { 45 | 46 | }, 47 | 48 | /** 49 | * 生命周期函数--监听页面卸载 50 | */ 51 | onUnload: function () { 52 | 53 | }, 54 | 55 | /** 56 | * 页面相关事件处理函数--监听用户下拉动作 57 | */ 58 | onPullDownRefresh: function () { 59 | console.log("下拉") 60 | }, 61 | 62 | /** 63 | * 页面上拉触底事件的处理函数 64 | */ 65 | onReachBottom: function () { 66 | console.log("shang拉") 67 | }, 68 | 69 | /** 70 | * 用户点击右上角分享 71 | */ 72 | onShareAppMessage: function () { 73 | 74 | } 75 | }) -------------------------------------------------------------------------------- /pages/logs/logs.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "查看启动日志" 3 | } -------------------------------------------------------------------------------- /pages/logs/logs.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 美食 17 | 18 | 19 | 20 | 美食 21 | 22 | 23 | 24 | 美食 25 | 26 | 27 | 28 | 美食 29 | 30 | 31 | 32 | 美食 33 | 34 | 35 | 36 | 美食 37 | 38 | 39 | 40 | 美食 41 | 42 | 43 | 44 | 美食 45 | 46 | 47 | 48 | 美食 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /pages/logs/logs.wxss: -------------------------------------------------------------------------------- 1 | /* 局部样式 */ 2 | 3 | .slider, 4 | .slider image, 5 | .slider swiper { 6 | width: 100%; 7 | height: 390rpx; 8 | } 9 | 10 | .index-nav { 11 | display: flex; 12 | flex-wrap: wrap; 13 | } 14 | 15 | .index-nav .nav-item { 16 | height: 200rpx; 17 | width: 33.333%; 18 | box-sizing: border-box; 19 | display: flex; 20 | justify-content: center; 21 | align-items: center; 22 | /*列方向 垂直*/ 23 | flex-direction: column; 24 | /* 1rpx边框重合问题 解决方案1 */ 25 | /* border-right: 1px solid #ccc; 26 | border-bottom: 1px solid #ccc; */ 27 | font-size: 14px; 28 | border-bottom: 1px solid #ccc; 29 | position: relative; 30 | } 31 | 32 | 33 | /* 1rpx边框重合问题 解决方案2 */ 34 | 35 | 36 | /* 37 | .index-nav .nav-item:nth-child(3n)::after { 38 | border-right: 0; 39 | } */ 40 | 41 | 42 | /* .index-nav .nav-item:nth-child(3n) { 43 | border-right: 0; 44 | } */ 45 | 46 | .index-nav .nav-item image { 47 | width: 80rpx; 48 | height: 80rpx; 49 | display: block; 50 | } 51 | 52 | 53 | /* 入口样式 */ 54 | 55 | .index-enter { 56 | margin-top: 20rpx; 57 | display: flex; 58 | width: 100%; 59 | } 60 | 61 | .index-enter .enter-item { 62 | width: 50%; 63 | /* border: 1px solid red; */ 64 | box-sizing: border-box; 65 | display: flex; 66 | justify-content: center; 67 | } 68 | 69 | .index-enter .enter-item image { 70 | width: 320rpx; 71 | height: 178rpx; 72 | } -------------------------------------------------------------------------------- /pages/news/news.js: -------------------------------------------------------------------------------- 1 | // pages/news/news.js 2 | Page({ 3 | 4 | /** 5 | * 页面的初始数据 6 | */ 7 | data: { 8 | 9 | }, 10 | 11 | /** 12 | * 生命周期函数--监听页面加载 13 | */ 14 | onLoad: function (options) { 15 | console.log("1 news组件") 16 | console.log(options) 17 | }, 18 | 19 | /** 20 | * 生命周期函数--监听页面初次渲染完成 21 | */ 22 | onReady: function () { 23 | 24 | }, 25 | 26 | /** 27 | * 生命周期函数--监听页面显示 28 | */ 29 | onShow: function () { 30 | 31 | }, 32 | 33 | /** 34 | * 生命周期函数--监听页面隐藏 35 | */ 36 | onHide: function () { 37 | 38 | }, 39 | 40 | /** 41 | * 生命周期函数--监听页面卸载 42 | */ 43 | onUnload: function () { 44 | 45 | }, 46 | 47 | /** 48 | * 页面相关事件处理函数--监听用户下拉动作 49 | */ 50 | onPullDownRefresh: function () { 51 | 52 | }, 53 | 54 | /** 55 | * 页面上拉触底事件的处理函数 56 | */ 57 | onReachBottom: function () { 58 | 59 | }, 60 | 61 | /** 62 | * 用户点击右上角分享 63 | */ 64 | onShareAppMessage: function () { 65 | 66 | } 67 | }) -------------------------------------------------------------------------------- /pages/news/news.json: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /pages/news/news.wxml: -------------------------------------------------------------------------------- 1 | 2 | pages/news/news.wxml 3 | -------------------------------------------------------------------------------- /pages/news/news.wxss: -------------------------------------------------------------------------------- 1 | /* pages/news/news.wxss */ -------------------------------------------------------------------------------- /project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件", 3 | "packOptions": { 4 | "ignore": [] 5 | }, 6 | "setting": { 7 | "urlCheck": false, 8 | "es6": true, 9 | "postcss": true, 10 | "minified": true, 11 | "newFeature": true 12 | }, 13 | "compileType": "miniprogram", 14 | "libVersion": "2.0.4", 15 | "appid": "wxadd4d134a549aef7", 16 | "projectname": "weChatMiniProject", 17 | "debugOptions": { 18 | "hidedInDevtools": [] 19 | }, 20 | "isGameTourist": false, 21 | "condition": { 22 | "search": { 23 | "current": -1, 24 | "list": [] 25 | }, 26 | "conversation": { 27 | "current": -1, 28 | "list": [] 29 | }, 30 | "game": { 31 | "currentL": -1, 32 | "list": [] 33 | }, 34 | "miniprogram": { 35 | "current": -1, 36 | "list": [] 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | const formatTime = date => { 2 | const year = date.getFullYear() 3 | const month = date.getMonth() + 1 4 | const day = date.getDate() 5 | const hour = date.getHours() 6 | const minute = date.getMinutes() 7 | const second = date.getSeconds() 8 | 9 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') 10 | } 11 | 12 | const formatNumber = n => { 13 | n = n.toString() 14 | return n[1] ? n : '0' + n 15 | } 16 | 17 | module.exports = { 18 | formatTime: formatTime 19 | } 20 | -------------------------------------------------------------------------------- /测试.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TencentIT/weixinPro/98b509a7ef70b51c162c11c0031b1578b9a27c18/测试.txt --------------------------------------------------------------------------------