├── .gitattributes ├── .gitignore ├── README.md ├── app.js ├── app.json ├── app.wxss ├── image ├── arrowright.png ├── avator.jpg ├── green_tri.png ├── icon64_appwx_logo.png ├── icon_API.png ├── icon_API_HL.png ├── icon_component.png ├── icon_component_HL.png ├── pause.png ├── play.png ├── plus.png ├── record.png ├── stop.png ├── test.png ├── trash.png ├── wechat.png └── wechatHL.png ├── pages ├── camera │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── component │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── i │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── index │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── list │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── live │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── logs │ ├── logs.js │ ├── logs.json │ ├── logs.wxml │ └── logs.wxss └── template │ ├── index.js │ ├── index.wxml │ └── index.wxss ├── style └── layout.wxss └── utils └── util.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Windows image file caches 2 | Thumbs.db 3 | ehthumbs.db 4 | 5 | # Folder config file 6 | Desktop.ini 7 | 8 | # Recycle Bin used on file shares 9 | $RECYCLE.BIN/ 10 | 11 | # Windows Installer files 12 | *.cab 13 | *.msi 14 | *.msm 15 | *.msp 16 | 17 | # Windows shortcuts 18 | *.lnk 19 | 20 | # ========================= 21 | # Operating System Files 22 | # ========================= 23 | 24 | # OSX 25 | # ========================= 26 | 27 | .DS_Store 28 | .AppleDouble 29 | .LSOverride 30 | 31 | # Thumbnails 32 | ._* 33 | 34 | # Files that might appear on external disk 35 | .Spotlight-V100 36 | .Trashes 37 | 38 | # Directories potentially created on remote AFP share 39 | .AppleDB 40 | .AppleDesktop 41 | Network Trash Folder 42 | Temporary Items 43 | .apdisk 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### 介绍: 2 | 最近微信小程序火爆,简单写了一个小程序demo。 3 | 微信web开发者工具 v0.9.092300 4 | ### 效果图: 5 | ![](https://github.com/qieangel2013/zys/blob/master/public/images/pw.jpg) 6 | ![](https://github.com/qieangel2013/SmallAPP/blob/master/image/test.png) 7 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | //app.js 2 | App({ 3 | onLaunch: function () { 4 | console.log('App Launch') 5 | //调用API从本地缓存中获取数据 6 | var logs = wx.getStorageSync('logs') || [] 7 | logs.unshift(Date.now()) 8 | wx.setStorageSync('logs', logs) 9 | }, 10 | getUserInfo:function(cb){ 11 | var that = this 12 | if(this.globalData.userInfo){ 13 | typeof cb == "function" && cb(this.globalData.userInfo) 14 | }else{ 15 | //调用登录接口 16 | wx.login({ 17 | success: function () { 18 | wx.getUserInfo({ 19 | success: function (res) { 20 | that.globalData.userInfo = res.userInfo 21 | typeof cb == "function" && cb(that.globalData.userInfo) 22 | } 23 | }) 24 | } 25 | }) 26 | } 27 | }, 28 | onShow: function () { 29 | console.log('App Show') 30 | }, 31 | onHide: function () { 32 | console.log('App Hide') 33 | }, 34 | globalData:{ 35 | userInfo:null 36 | } 37 | }) -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "pages":[ 3 | "pages/index/index", 4 | "pages/list/index", 5 | "pages/i/index", 6 | "pages/camera/index", 7 | "pages/live/index", 8 | "pages/template/index", 9 | "pages/component/index", 10 | "pages/logs/logs" 11 | ], 12 | "window":{ 13 | "backgroundTextStyle":"light", 14 | "navigationBarTextStyle": "white", 15 | "navigationBarTitleText": "SmallApp", 16 | "navigationBarBackgroundColor": "#0767c8", 17 | "backgroundColor": "#fbf9fe", 18 | "enablePullDownRefresh": true 19 | }, 20 | "tabBar": { 21 | "color": "#dddddd", 22 | "selectedColor": "#3cc51f", 23 | "borderStyle": "white", 24 | "backgroundColor": "#ffffff", 25 | "list": [{ 26 | "pagePath": "pages/index/index", 27 | "iconPath": "image/icon_component.png", 28 | "selectedIconPath": "image/icon_component_HL.png", 29 | "text": "首页" 30 | }, { 31 | "pagePath": "pages/list/index", 32 | "iconPath": "image/icon_API.png", 33 | "selectedIconPath": "image/icon_API_HL.png", 34 | "text": "分类" 35 | }, { 36 | "pagePath": "pages/component/index", 37 | "iconPath": "image/icon_API.png", 38 | "selectedIconPath": "image/icon_API_HL.png", 39 | "text": "购物车" 40 | }, { 41 | "pagePath": "pages/i/index", 42 | "iconPath": "image/icon_API.png", 43 | "selectedIconPath": "image/icon_API_HL.png", 44 | "text": "我的直播" 45 | }] 46 | }, 47 | "debug": true 48 | } 49 | -------------------------------------------------------------------------------- /app.wxss: -------------------------------------------------------------------------------- 1 | /**app.wxss**/ 2 | @import "./style/layout.wxss"; 3 | 4 | .container { 5 | font-family: Helvetica Neue,Helvetica,Arial,sans-serif; 6 | display: flex; 7 | flex-direction: column; 8 | justify-content: space-between; 9 | box-sizing: border-box; 10 | } 11 | 12 | page { 13 | background-color: #fbf9fe; 14 | } 15 | 16 | .green{ 17 | color: #09BB07; 18 | } 19 | .red{ 20 | color: #F76260; 21 | } 22 | .blue{ 23 | color: #10AEFF; 24 | } 25 | .yellow{ 26 | color: #FFBE00; 27 | } 28 | .gray{ 29 | color: #C9C9C9; 30 | } 31 | 32 | .strong{ 33 | font-weight: bold; 34 | } 35 | 36 | .bc_green{ 37 | background-color: #09BB07; 38 | } 39 | .bc_red{ 40 | background-color: #F76260; 41 | } 42 | .bc_blue{ 43 | background-color: #10AEFF; 44 | } 45 | .bc_yellow{ 46 | background-color: #FFBE00; 47 | } 48 | .bc_gray{ 49 | background-color: #C9C9C9; 50 | } 51 | 52 | .tc{ 53 | text-align: center; 54 | } 55 | -------------------------------------------------------------------------------- /image/arrowright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/arrowright.png -------------------------------------------------------------------------------- /image/avator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/avator.jpg -------------------------------------------------------------------------------- /image/green_tri.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/green_tri.png -------------------------------------------------------------------------------- /image/icon64_appwx_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/icon64_appwx_logo.png -------------------------------------------------------------------------------- /image/icon_API.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/icon_API.png -------------------------------------------------------------------------------- /image/icon_API_HL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/icon_API_HL.png -------------------------------------------------------------------------------- /image/icon_component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/icon_component.png -------------------------------------------------------------------------------- /image/icon_component_HL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/icon_component_HL.png -------------------------------------------------------------------------------- /image/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/pause.png -------------------------------------------------------------------------------- /image/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/play.png -------------------------------------------------------------------------------- /image/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/plus.png -------------------------------------------------------------------------------- /image/record.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/record.png -------------------------------------------------------------------------------- /image/stop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/stop.png -------------------------------------------------------------------------------- /image/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/test.png -------------------------------------------------------------------------------- /image/trash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/trash.png -------------------------------------------------------------------------------- /image/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/wechat.png -------------------------------------------------------------------------------- /image/wechatHL.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qieangel2013/SmallAPP/178f2ebdc05ba6fd2810ddf2cc816a28c32f9bec/image/wechatHL.png -------------------------------------------------------------------------------- /pages/camera/index.js: -------------------------------------------------------------------------------- 1 | var zqfdata; 2 | Page({ 3 | data: { 4 | title: '视频直播', 5 | source: 'https://github.com/qieangel2013/SmallApp', 6 | imgsrc:'' 7 | }, 8 | //事件处理函数 9 | onLoad: function (options) { 10 | this.title = options.type || '视频直播' 11 | }, 12 | onReady: function () { 13 | wx.setNavigationBarTitle({ 14 | title: '视频直播' 15 | }) 16 | var that = this 17 | wx.connectSocket({ 18 | url:'wss://xcx.tianlian.cn:9503' 19 | }); 20 | wx.onSocketOpen(function(res) { 21 | console.log('WebSocket连接已打开!'); 22 | //alert(11) 23 | //sendSocketMessage({data:"亲!我连上啦!",type:"mess"}); 24 | }) 25 | wx.onSocketMessage(function(data) 26 | { 27 | zqfdata = JSON.parse(data.data); 28 | //console.log(jsonobj) 29 | // that.setData({ 30 | // imgsrc:data.data 31 | // }); 32 | //zqfdata= jQuery.parseJSON(data.data); 33 | if(zqfdata.type=='video'){ 34 | that.setData({ 35 | imgsrc:zqfdata.data 36 | }); 37 | wx.setNavigationBarTitle({ 38 | title: '视频直播' 39 | }) 40 | } 41 | }); 42 | wx.onSocketClose(function(res) { 43 | console.log('WebSocket 已关闭!') 44 | }) 45 | }, 46 | }) 47 | -------------------------------------------------------------------------------- /pages/camera/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{source}} 5 | 6 | -------------------------------------------------------------------------------- /pages/camera/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 8px 0; 3 | } 4 | 5 | .item { 6 | padding: 8px; 7 | background-color: #fff; 8 | border-top: 1px solid #e4e4e4; 9 | color: #787878; 10 | } 11 | 12 | .item image { 13 | display: block; 14 | width: 129px; 15 | height: 114px; 16 | } 17 | 18 | .item-right { 19 | margin-left: 11px; 20 | } 21 | 22 | .title { 23 | margin-bottom: 25px; 24 | } 25 | .title text { 26 | font-size: 16px; 27 | color: #787878; 28 | } 29 | 30 | text { 31 | font-size: 15px; 32 | color: #444; 33 | } 34 | .c-1 { 35 | color: #09bb07; 36 | } -------------------------------------------------------------------------------- /pages/component/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | list: [ 4 | { 5 | id: 'view', 6 | name: '视图容器', 7 | open: false, 8 | pages: ['view', 'scroll-view', 'swiper'] 9 | }, { 10 | id: 'content', 11 | name: '基础内容', 12 | open: false, 13 | pages: ['text', 'icon', 'progress'] 14 | }, { 15 | id: 'form', 16 | name: '表单组件', 17 | open: false, 18 | pages: ['button', 'checkbox', 'form', 'input', 'label', 'picker', 'radio', 'slider', 'switch'] 19 | }, { 20 | id: 'feedback', 21 | name: '操作反馈', 22 | open: false, 23 | pages: ['action-sheet', 'modal', 'toast', 'loading'] 24 | }, { 25 | id: 'nav', 26 | name: '导航', 27 | open: false, 28 | pages: ['navigator'] 29 | }, { 30 | id: 'media', 31 | name: '媒体组件', 32 | open: false, 33 | pages: ['image', 'audio', 'video', 'map', 'canvas'] 34 | } 35 | ] 36 | }, 37 | widgetsToggle: function (e) { 38 | var id = e.currentTarget.id, list = this.data.list; 39 | for (var i = 0, len = list.length; i < len; ++i) { 40 | if (list[i].id == id) { 41 | list[i].open = !list[i].open; 42 | } else { 43 | list[i].open = false; 44 | } 45 | } 46 | this.setData({ 47 | list: list 48 | }); 49 | } 50 | }); 51 | -------------------------------------------------------------------------------- /pages/component/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 小程序组件 4 | 这里就当前已支持的组件进行演示 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {{item.name}} 13 | 14 | 15 | 16 | 17 | 18 | {{page}} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /pages/component/index.wxss: -------------------------------------------------------------------------------- 1 | .index{ 2 | background-color: #FBF9FE; 3 | font-family: -apple-system-font,Helvetica Neue,Helvetica,sans-serif; 4 | flex: 1; 5 | min-height: 100%; 6 | font-size: 32rpx; 7 | } 8 | .head{ 9 | padding: 80rpx; 10 | line-height: 1; 11 | } 12 | .body{ 13 | padding-left: 30rpx; 14 | padding-right: 30rpx; 15 | overflow: hidden; 16 | } 17 | .title{ 18 | font-size: 52rpx; 19 | } 20 | .desc{ 21 | margin-top: 10rpx; 22 | color: #888888; 23 | font-size: 28rpx; 24 | } 25 | 26 | .widgets__item{ 27 | margin-top: 20rpx; 28 | margin-bottom: 20rpx; 29 | background-color: #FFFFFF; 30 | overflow: hidden; 31 | border-radius: 4rpx; 32 | cursor: pointer; 33 | } 34 | .widgets__info{ 35 | display: flex; 36 | padding: 40rpx; 37 | align-items: center; 38 | flex-direction: row; 39 | } 40 | .widgets__info_show{ 41 | } 42 | .widgets__info_show .widgets__info-img{ 43 | transform: rotate(-90deg); 44 | } 45 | .widgets__info-name{ 46 | flex: 1; 47 | } 48 | .widgets__info-img{ 49 | width: 32rpx; 50 | height: 32rpx; 51 | transition: transform .4s; 52 | transform: rotate(90deg); 53 | } 54 | 55 | .widgets__list{ 56 | display: none; 57 | } 58 | .widgets__list_show{ 59 | display: block; 60 | } 61 | .widget{ 62 | position: relative; 63 | padding-top: 26rpx; 64 | padding-bottom: 26rpx; 65 | padding-left: 40rpx; 66 | padding-right: 40rpx; 67 | } 68 | .widget__arrow{ 69 | position: absolute; 70 | top: 28rpx; 71 | right: 44rpx; 72 | width: 32rpx; 73 | height: 32rpx; 74 | } 75 | .widget__line{ 76 | content: " "; 77 | position: absolute; 78 | left: 40rpx; 79 | top: 0; 80 | right: 0; 81 | height: 2rpx; 82 | background-color: #F0F0F0; 83 | } 84 | .widget__line_first{ 85 | left: 0; 86 | right: 0; 87 | background-color: #D8D8D8; 88 | } 89 | -------------------------------------------------------------------------------- /pages/i/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | var app = getApp() 4 | Page( { 5 | data: { 6 | userInfo: {avatarUrl:'../../image/avator.jpg',nickName:'qieangel2013'}, 7 | source: 'https://github.com/qieangel2013/SmallApp' 8 | }, 9 | //事件处理函数 10 | bindViewTap: function() { 11 | wx.navigateTo( { 12 | url: '../logs/logs' 13 | }) 14 | }, 15 | go: function(event) { 16 | wx.navigateTo({ 17 | url: '../live/index?type=' + event.currentTarget.dataset.type 18 | }) 19 | }, 20 | gos: function(event) { 21 | wx.navigateTo({ 22 | url: '../camera/index?type=' + event.currentTarget.dataset.type 23 | }) 24 | }, 25 | onLoad: function() { 26 | var that = this 27 | //调用应用实例的方法获取全局数据 28 | app.getUserInfo( function( userInfo ) { 29 | //更新数据 30 | that.setData( { 31 | userInfo: userInfo 32 | }) 33 | }) 34 | } 35 | }) 36 | -------------------------------------------------------------------------------- /pages/i/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{userInfo.nickName}} 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /pages/i/index.wxss: -------------------------------------------------------------------------------- 1 | /**index.wxss**/ 2 | .container { 3 | padding-top: 30px; 4 | } 5 | .userinfo { 6 | display: flex; 7 | flex-direction: column; 8 | align-items: center; 9 | } 10 | .userinfo-avatar { 11 | width: 128rpx; 12 | height: 128rpx; 13 | margin: 20rpx; 14 | border-radius: 50%; 15 | } 16 | .userinfo-nickname { 17 | color: #aaa; 18 | } 19 | .info { 20 | margin-top: 50px; 21 | text-align: center; 22 | } -------------------------------------------------------------------------------- /pages/index/index.js: -------------------------------------------------------------------------------- 1 | //index.js 2 | //获取应用实例 3 | var app = getApp() 4 | Page( { 5 | data: { 6 | // 轮播 7 | images: [], 8 | indicatorDots: true, 9 | vertical: false, 10 | autoplay: true, 11 | interval: 3000, 12 | duration: 1200, 13 | // nav 14 | navs: [ 15 | { 16 | image: 'https://m.youcai.xin/static/img/gravida.png', 17 | text: '孕妇' 18 | }, { 19 | image: 'https://m.youcai.xin/static/img/confinement.png', 20 | text: '月子' 21 | }, { 22 | image: 'https://m.youcai.xin/static/img/baby.png', 23 | text: '幼儿' 24 | }, { 25 | image: 'https://m.youcai.xin/static/img/old.png', 26 | text: '老人' 27 | } 28 | ], 29 | // item 30 | items: [ 31 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, 32 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/84439174cad04497beda3a076663beb4.jpg'}, 33 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/1987d8eb8b1748368b7f2382332c9718.jpg'}, 34 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, 35 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, 36 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, 37 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'}, 38 | {image: 'https://hamlet.b0.upaiyun.com/1609/22111/fe8765fa7f2f48cd87760c10ddd20ae6.jpg'} 39 | ] 40 | }, 41 | updatedata:function(){ 42 | console.log( 'ajax' ) 43 | var obj=this 44 | wx.request({ 45 | url: 'https://xcx.tianlian.cn/test.php', 46 | header: { 47 | 'Content-Type': 'application/json' 48 | }, 49 | success: function(res) { 50 | console.log( 'ajax2' ); 51 | console.log(res.data); 52 | obj.setData( { 53 | images: res.data 54 | }) 55 | }, 56 | fail:function(e){ 57 | console.log(e) 58 | } 59 | }) 60 | }, 61 | onLoad: function() { 62 | var that = this 63 | app.getUserInfo( function( userInfo ) { 64 | //更新数据 65 | that.setData( { 66 | userInfo: userInfo 67 | }) 68 | }) 69 | this.updatedata() 70 | }, 71 | //事件处理函数 72 | bindViewTap: function() { 73 | wx.navigateTo( { 74 | url: '../logs/logs' 75 | }) 76 | }, 77 | swiperchange: function(e) { 78 | //FIXME: 当前页码 79 | //console.log(e.detail.current) 80 | }, 81 | go: function(event) { 82 | wx.navigateTo({ 83 | url: '../list/index?type=' + event.currentTarget.dataset.type 84 | }) 85 | }, 86 | gos: function(event) { 87 | wx.navigateTo({ 88 | url: '../template/index?type=' + event.currentTarget.dataset.type 89 | }) 90 | } 91 | }) 92 | -------------------------------------------------------------------------------- /pages/index/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | {{item.text}} 19 | 20 | 21 | 22 | 23 | 24 | 25 | 精品特价 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /pages/index/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | background-color: #F2f2f2; 3 | } 4 | 5 | view.section { 6 | /*display: block;*/ 7 | /*width: 100%;*/ 8 | } 9 | 10 | /*轮播*/ 11 | .swiper_box { 12 | /*width: 100%;*/ 13 | height: 187.5px; 14 | } 15 | swiper.swiper { 16 | height: 100%; 17 | } 18 | .swiper-item { 19 | display: block; 20 | height: 100%; 21 | } 22 | .slide-image { 23 | height: 100%; 24 | width: 100%; 25 | display: inline-block; 26 | overflow: hidden; 27 | } 28 | 29 | /*分类*/ 30 | .index-nav { 31 | height: 80px; 32 | /*background: red;*/ 33 | display: flex; 34 | flex-direction: row; 35 | /*align-items: center;*/ 36 | background-color: #fff; 37 | color: #646464; 38 | } 39 | .index-nav view { 40 | flex: 1; 41 | flex-direction: column; 42 | border-right: 1px solid #F2f2f2; 43 | } 44 | .index-nav image { 45 | width: 38px; 46 | height: 38px; 47 | } 48 | .index-nav text { 49 | font-size: 16px; 50 | } 51 | 52 | 53 | view.text { 54 | display: flex; 55 | align-items: center; 56 | position: relative; 57 | padding: 10px 10px 10px 12px; 58 | font-size: 15px; 59 | color: #656565; 60 | } 61 | 62 | view.text:before { 63 | position: absolute; 64 | display: block; 65 | content: ' '; 66 | left: -5px; 67 | width: 2px; 68 | height: 100%; 69 | background-color: #09bb07; 70 | } 71 | .line_y { 72 | width: 3px; 73 | height: 100%; 74 | height: 18px; 75 | display: inline-block; 76 | background-color: #09bb07; 77 | } 78 | view.text text { 79 | margin-left: 10px; 80 | line-height: 18px; 81 | } 82 | 83 | .item { 84 | margin-bottom: 7px; 85 | height: 126px; 86 | } -------------------------------------------------------------------------------- /pages/list/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | title: '', 4 | items: [{"mprice":0,"maxpacks":100,"price":12800,"subcate":210,"remains":998,"type":1,"freight":0,"title":"北京油鸡(小公鸡)","imgs":["https://hamlet.b0.upaiyun.com/1609/22170/362ba7ea685440e5891d6f6c661d0552.jpg"],"unit":"只","id":302,"quantity":"1"},{"mprice":0,"maxpacks":14,"price":1600,"subcate":410,"remains":14,"type":4,"freight":1000,"title":"红糖粉","imgs":["https://hamlet.b0.upaiyun.com/1604/06200/34088f0a883f4b85ae573a822ff68381.jpg"],"unit":"g","id":93,"quantity":"400"},{"mprice":0,"maxpacks":100,"price":4800,"subcate":202,"remains":5,"type":1,"freight":1000,"title":"极致Q弹肉丸子","imgs":["https://hamlet.b0.upaiyun.com/1601/27161/2e8c13bc2d0847718c223bcd0f5f6fe3.png"],"unit":"g","id":69,"quantity":"300"},{"mprice":2200,"maxpacks":100,"price":1980,"subcate":410,"remains":42,"type":1,"freight":1000,"title":"女生红糖","imgs":["https://hamlet.b0.upaiyun.com/1604/06150/c500467218ea4ce8ace753a05e31a49e.jpg"],"unit":"g","id":91,"quantity":"220"},{"mprice":2280,"maxpacks":100,"price":1880,"subcate":410,"remains":29,"type":1,"freight":1000,"title":"姜母红糖","imgs":["https://hamlet.b0.upaiyun.com/1604/06150/bef4cca020764e91a194bba87c627a8a.jpg"],"unit":"g","id":90,"quantity":"215"},{"mprice":0,"maxpacks":100,"price":1800,"subcate":301,"remains":999936,"type":1,"freight":1000,"title":"“沁州黄”小米","imgs":["https://hamlet.b0.upaiyun.com/1511/12100/e31c7dc53a874d368fa4af8e54fbffb5.jpg"],"unit":"g","id":20,"quantity":"1000"},{"mprice":0,"maxpacks":1000,"price":12800,"subcate":301,"remains":9994,"type":4,"freight":0,"title":"富硒米家庭装","imgs":["https://hamlet.b0.upaiyun.com/1606/12101/e6bbd6b6cd474a97a1786b43a063f510.jpg"],"unit":"kg","id":171,"quantity":"5"},{"mprice":0,"maxpacks":10,"price":3000,"subcate":201,"remains":99885,"type":1,"freight":1000,"title":"优选香草贵妃鸡蛋","imgs":["https://hamlet.b0.upaiyun.com/1606/24001/5cdfc1d626a7407c86d82a3c99daeaa3.jpg"],"unit":"g","id":22,"quantity":"500"},{"mprice":0,"maxpacks":100,"price":16800,"subcate":210,"remains":49956,"type":4,"freight":1000,"title":"有菜推荐香草贵妃鸡","imgs":["https://hamlet.b0.upaiyun.com/1606/24001/c40521bd9f054e2988fde39527d8e6f0.jpg"],"unit":"g","id":19,"quantity":"1250"},{"mprice":0,"maxpacks":100,"price":3800,"subcate":202,"remains":999980,"type":1,"freight":1000,"title":"深山散养黑猪后臀尖","imgs":["https://hamlet.b0.upaiyun.com/1512/15160/620395fd67164f41aba7bdfdcabe5379.jpg"],"unit":"g","id":44,"quantity":"400"},{"mprice":2480,"maxpacks":100,"price":2280,"subcate":410,"remains":0,"type":1,"freight":1000,"title":"玫瑰红糖","imgs":["https://hamlet.b0.upaiyun.com/1604/06141/92c264a3dc5d4c49ae33c9a1fbdf54e5.jpg"],"unit":"g","id":89,"quantity":"175"}] 5 | }, 6 | //事件处理函数 7 | onLoad: function (options) { 8 | this.title = options.type || '列表' 9 | }, 10 | go: function(event) { 11 | wx.navigateTo({ 12 | url: '../template/index?type=' + event.currentTarget.dataset.type 13 | }) 14 | }, 15 | onReady: function () { 16 | wx.setNavigationBarTitle({ 17 | title: this.title 18 | }) 19 | }, 20 | }) 21 | -------------------------------------------------------------------------------- /pages/list/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{item.title}} 10 | {{item.quantity}}{{item.unit}}/份 11 | ¥{{item.price/100}} 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /pages/list/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 8px 0; 3 | } 4 | 5 | .item { 6 | padding: 8px; 7 | background-color: #fff; 8 | border-top: 1px solid #e4e4e4; 9 | color: #787878; 10 | } 11 | 12 | .item image { 13 | display: block; 14 | width: 129px; 15 | height: 114px; 16 | } 17 | 18 | .item-right { 19 | margin-left: 11px; 20 | } 21 | 22 | .title { 23 | margin-bottom: 25px; 24 | } 25 | .title text { 26 | font-size: 16px; 27 | color: #787878; 28 | } 29 | 30 | text { 31 | font-size: 15px; 32 | color: #444; 33 | } 34 | .c-1 { 35 | color: #09bb07; 36 | } -------------------------------------------------------------------------------- /pages/live/index.js: -------------------------------------------------------------------------------- 1 | var zqfdata; 2 | var context = wx.createContext(); 3 | var video=wx.createVideoContext('sourcevid'); 4 | function draw(){ 5 | context.drawImage(video,0,0, 320, 240) 6 | wx.drawCanvas({ 7 | canvasId: 3, 8 | actions: context.getActions() 9 | }) 10 | if(video.src){ 11 | data={data:back.toDataURL("image/jpeg", 0.5),type:'video'} 12 | socket.send(JSON.stringify(data)); 13 | // data_mic={data:gRecorder.getBlob(),type:'mic'} 14 | // socket.send(JSON.stringify(data_mic)); 15 | //gRecorder.clear(); 16 | //gRecorder.stop(); 17 | //door = false; 18 | } 19 | setTimeout(draw, 100); 20 | } 21 | Page({ 22 | data: { 23 | title: '录入视频', 24 | imgsrc:'' 25 | }, 26 | //事件处理函数 27 | onLoad: function (options) { 28 | this.title = options.type || '录视频' 29 | }, 30 | onReady: function () { 31 | wx.setNavigationBarTitle({ 32 | title: '录入视频' 33 | }) 34 | var that = this 35 | wx.chooseVideo({ 36 | sourceType: ['camera'], 37 | maxDuration: 60, 38 | camera: ['front','back'], 39 | success: function(res) { 40 | that.setData({ 41 | imgsrc: res.tempFilePath 42 | }) 43 | } 44 | }) 45 | wx.connectSocket({ 46 | url:'wss://xcx.tianlian.cn:9503' 47 | }); 48 | wx.onSocketOpen(function(res) { 49 | console.log('WebSocket连接已打开!'); 50 | draw(); 51 | //alert(11) 52 | //sendSocketMessage({data:"亲!我连上啦!",type:"mess"}); 53 | }) 54 | wx.onSocketClose(function(res) { 55 | console.log('WebSocket 已关闭!') 56 | }) 57 | 58 | }, 59 | }) -------------------------------------------------------------------------------- /pages/live/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /pages/live/index.wxss: -------------------------------------------------------------------------------- 1 | .container { 2 | padding: 8px 0; 3 | } 4 | 5 | .item { 6 | padding: 8px; 7 | background-color: #fff; 8 | border-top: 1px solid #e4e4e4; 9 | color: #787878; 10 | } 11 | 12 | .item image { 13 | display: block; 14 | width: 129px; 15 | height: 114px; 16 | } 17 | 18 | .item-right { 19 | margin-left: 11px; 20 | } 21 | 22 | .title { 23 | margin-bottom: 25px; 24 | } 25 | .title text { 26 | font-size: 16px; 27 | color: #787878; 28 | } 29 | 30 | text { 31 | font-size: 15px; 32 | color: #444; 33 | } 34 | .c-1 { 35 | color: #09bb07; 36 | } -------------------------------------------------------------------------------- /pages/logs/logs.js: -------------------------------------------------------------------------------- 1 | //logs.js 2 | var util = require('../../utils/util.js') 3 | Page({ 4 | data: { 5 | logs: [] 6 | }, 7 | onLoad: function () { 8 | this.setData({ 9 | logs: (wx.getStorageSync('logs') || []).map(function (log) { 10 | return util.formatTime(new Date(log)) 11 | }) 12 | }) 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /pages/logs/logs.json: -------------------------------------------------------------------------------- 1 | { 2 | "navigationBarTitleText": "查看启动日志" 3 | } -------------------------------------------------------------------------------- /pages/logs/logs.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{index + 1}}. {{log}} 5 | 6 | 7 | -------------------------------------------------------------------------------- /pages/logs/logs.wxss: -------------------------------------------------------------------------------- 1 | .log-list { 2 | display: flex; 3 | flex-direction: column; 4 | padding: 40rpx; 5 | } 6 | .log-item { 7 | margin: 10rpx; 8 | } 9 | -------------------------------------------------------------------------------- /pages/template/index.js: -------------------------------------------------------------------------------- 1 | Page({ 2 | data: { 3 | title: '详情页', 4 | userInfo: {avatarUrl:'../../image/avator.jpg',nickName:'qieangel2013'}, 5 | img:'https://hamlet.b0.upaiyun.com/1601/27161/2e8c13bc2d0847718c223bcd0f5f6fe3.png' 6 | }, 7 | //事件处理函数 8 | onLoad: function (options) { 9 | this.title = options.type || '详情页' 10 | }, 11 | onReady: function () { 12 | wx.setNavigationBarTitle({ 13 | title: '详情页' 14 | }) 15 | }, 16 | }) 17 | -------------------------------------------------------------------------------- /pages/template/index.wxml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{userInfo.nickName}} 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /pages/template/index.wxss: -------------------------------------------------------------------------------- 1 | /**index.wxss**/ 2 | .container { 3 | padding-top: 30px; 4 | } 5 | .userinfo { 6 | display: flex; 7 | flex-direction: column; 8 | align-items: center; 9 | } 10 | .userinfo-avatar { 11 | width: 128rpx; 12 | height: 128rpx; 13 | margin: 20rpx; 14 | border-radius: 50%; 15 | } 16 | .userinfo-nickname { 17 | color: #aaa; 18 | } 19 | .info { 20 | margin-top: 50px; 21 | text-align: center; 22 | } -------------------------------------------------------------------------------- /style/layout.wxss: -------------------------------------------------------------------------------- 1 | /** 2 | * layout 3 | * 4 | * 说明 5 | * l:layout 6 | * r:row 7 | * l:left 8 | * r:right 9 | * c:center 10 | */ 11 | 12 | .l-r { 13 | display: flex; 14 | } 15 | 16 | /*l_auto:占用剩下的*/ 17 | .l_auto { 18 | flex: 1; 19 | } 20 | 21 | /*& > * { 22 | display: block; 23 | } 24 | 25 | // 1行内元素平分 26 | // &[class^="l-r-auto"] { 27 | // flex: 1; 28 | // } 29 | 30 | // 1行内元素平分 31 | &[class^="l-r-auto"] { 32 | & > * { 33 | flex: 1; 34 | text-align: center; 35 | } 36 | } 37 | 38 | // 主轴为水平方向,起点在右端 39 | &[class^="l-r-r"] { 40 | flex-direction: row-reverse; 41 | } 42 | 43 | // 1行2列两边对齐 44 | &[class^="l-r-lr"] { 45 | justify-content: space-between; 46 | } 47 | */ 48 | 49 | .l-c { 50 | display: flex; 51 | /*justify-content: center;*/ 52 | align-items: center; 53 | } 54 | /*垂直水平居中对齐*/ 55 | .l-c-c { 56 | display: flex; 57 | justify-content: center; 58 | align-items: center; 59 | } 60 | -------------------------------------------------------------------------------- /utils/util.js: -------------------------------------------------------------------------------- 1 | function formatTime(date) { 2 | var year = date.getFullYear() 3 | var month = date.getMonth() + 1 4 | var day = date.getDate() 5 | 6 | var hour = date.getHours() 7 | var minute = date.getMinutes() 8 | var second = date.getSeconds() 9 | 10 | 11 | return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') 12 | } 13 | 14 | function formatNumber(n) { 15 | n = n.toString() 16 | return n[1] ? n : '0' + n 17 | } 18 | 19 | module.exports = { 20 | formatTime: formatTime 21 | } 22 | --------------------------------------------------------------------------------