diff --git a/scr/lt2/README.md b/scr/lt2/README.md new file mode 100644 index 0000000..d34deef --- /dev/null +++ b/scr/lt2/README.md @@ -0,0 +1,51 @@ +# weapp-wechat-zhihu + +微信中的知乎--微信小程序 demo // Zhihu in Wechat + +![](images/v_index.png) + +### description +- 界面及交互设计来自知乎 Android 版本 +- _工具_: [微信 web 开发者工具](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html?t=1477579747265) +- _数据_: 没有开放 API, 所以使用伪造本地数据 + +#### 功能及使用的组件等 +* 列表式渲染数据 +* 自定义顶部 tabbar +* 下拉刷新 +* 上拉加载更多 +* 轮播图 +
等... + +### Setup + +``` +git@github.com:RebeccaHanjw/weapp-wechat-zhihu.git +``` +下载安装Wechat DEV Tools, 并导入项目 + +### 演示 + +首页下拉刷新等 + +![](images/index_scroll.gif) + +底部 tab 切换 + +![](images/bottom_tab.gif) + +顶部自定义 tab 切换 + +![](images/top_tab.gif) + +页面跳转 + +![](images/navigation.gif) + + +##### Demo 用于学习交流, 转载请注明出处 + + + + + diff --git a/scr/lt2/app.js b/scr/lt2/app.js new file mode 100644 index 0000000..f942f70 --- /dev/null +++ b/scr/lt2/app.js @@ -0,0 +1,35 @@ +//app.js +App({ + onLaunch: function () { + wx.cloud.init({ + env:"cloud1-8g5wmepxce8a3b8a", + traceUser:true//是否访问权限可见 + })}}) + /* + //调用API从本地缓存中获取数据 + var logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + }, + getUserInfo:function(cb){ + var that = this + if(this.globalData.userInfo){ + typeof cb == "function" && cb(this.globalData.userInfo) + }else{ + //调用登录接口 + wx.login({ + success: function () { + wx.getUserInfo({ + success: function (res) { + that.globalData.userInfo = res.userInfo + typeof cb == "function" && cb(that.globalData.userInfo) + } + }) + } + }) + } + }, + globalData:{ + userInfo:null + } +})*/ \ No newline at end of file diff --git a/scr/lt2/app.json b/scr/lt2/app.json new file mode 100644 index 0000000..b2ea63c --- /dev/null +++ b/scr/lt2/app.json @@ -0,0 +1,43 @@ +{ + "pages":[ + "pages/login/login", + "pages/index/index", + "pages/submit/submit", + "pages/notify/notify", + + + "pages/answer/answer", + "pages/question/question" + ], + "window":{ + "backgroundTextStyle":"light", + "navigationBarBackgroundColor": "#0068C4", + "navigationBarTitleText": "知乎", + "navigationBarTextStyle":"white", + "enablePullDownRefresh":true + }, + "tabBar": { + "color": "#626567", + "selectedColor": "#2A8CE5", + "backgroundColor": "#FBFBFB", + "borderStyle": "white", + "list": [{ + "pagePath": "pages/index/index", + "text": "", + "iconPath": "images/index.png", + "selectedIconPath": "images/index_focus.png" + },{ + "pagePath": "pages/notify/notify", + "text": "", + "iconPath": "images/ring.png", + "selectedIconPath": "images/ring_focus.png" + }] + }, + "networkTimeout": { + "request": 10000, + "downloadFile": 10000 + }, + "debug": true, + "style": "v2", + "sitemapLocation": "sitemap.json" +} diff --git a/scr/lt2/app.wxss b/scr/lt2/app.wxss new file mode 100644 index 0000000..6b95370 --- /dev/null +++ b/scr/lt2/app.wxss @@ -0,0 +1,127 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + /*padding: 200rpx 0;*/ + box-sizing: border-box; + background: #F0F4F3; +} + +.container.withtab{ + margin: 105rpx 0 0 0; + /*top: 105rpx;*/ +} +.flex-wrp{ + display: flex; +} +.flex-tab{ + flex-flow: row nowrap; + justify-content: space-around; + align-items: stretch; +} +.flex-item{ + flex-grow: 1; + text-align: center; +} +.top-tab{ + width: 750rpx; + height: 100rpx; + background: #298DE5; + color: #8CCEFD; + font-size: 28rpx; + line-height: 100rpx; + box-shadow: 0 2px 2px #bebebe; + margin: 0 0 8rpx 0; + position: fixed; + top: 0; + z-index: 9999; +} +.toptab.active{ + color: #ffffff; + border-bottom: solid 2px #ffffff; +} +.container{ + padding: 0; + font-size: 14rpx; + color: #000; +} +.container .feed-item{ + width: 690rpx; + padding: 30rpx 30rpx 20rpx; + margin: 7rpx 0 6rpx 0; + background: #ffffff; + border-top: 1px solid #eee; + border-bottom: 1px solid #eee; + box-shadow: 0 2px 5px #eeeeee; +} +.container .feed-item .feed-source{ + width: 690rpx; + left: 0; + height: 50rpx; +} +.container .feed-item .feed-source .avatar{ + position: relative; + display: inline-block; +} +.container .feed-item .feed-source a{ + display: inline-block; + height: 40rpx; +} +.container .feed-item .feed-source .avatar image{ + /*position: absolute;*/ + display: inline-block; + width: 45rpx; + height: 45rpx; + border-radius: 45rpx; + top: 10rpx; + vertical-align: middle; +} +.container .feed-item .feed-source text{ + /*position: absolute;*/ + display: inline-block; + height: 40rpx; + line-height: 40rpx; + vertical-align: middle; + margin: 0 0 0 15rpx; + color: #a0acac; + font-size: 26rpx; +} +.container .feed-item .feed-source .item-more{ + display: inline-block; + width: 40rpx; + height: 45rpx; + float: right; +} +.container .feed-item .feed-content{ + padding: 10rpx 0 0 0; +} +.container .feed-item .feed-content .question text{ + font-size: 28rpx; + font-weight: 600px; + line-height: 40rpx; + word-spacing: 5rpx; +} +.container .feed-item .feed-content .answer-body{ + padding: 10rpx 0 0 0; + /*height: 10rpx;*/ + font-size: 24rpx; + line-height: 28rpx; + color: #5b5b5b; +} +.container .feed-item .feed-content .answer-actions{ + width: 690rpx; + padding: 10rpx 0 0; + color: #a0acac; +} +.container .feed-item .feed-content .answer-actions view{ + display: inline-block; + vertical-align: text-bottom; + padding: 0 10rpx 0 0; + font-size: 24rpx; +} +.container .feed-item .feed-content .answer-actions .dot ::after{ + content: "•"; +} \ No newline at end of file diff --git a/scr/lt2/images/1444983318907-_DSC1826.jpg b/scr/lt2/images/1444983318907-_DSC1826.jpg new file mode 100644 index 0000000..f2ed30b Binary files /dev/null and b/scr/lt2/images/1444983318907-_DSC1826.jpg differ diff --git a/scr/lt2/images/24213.jpg b/scr/lt2/images/24213.jpg new file mode 100644 index 0000000..067cfc7 Binary files /dev/null and b/scr/lt2/images/24213.jpg differ diff --git a/scr/lt2/images/allread.png b/scr/lt2/images/allread.png new file mode 100644 index 0000000..987930a Binary files /dev/null and b/scr/lt2/images/allread.png differ diff --git a/scr/lt2/images/book.png b/scr/lt2/images/book.png new file mode 100644 index 0000000..0f6ef7f Binary files /dev/null and b/scr/lt2/images/book.png differ diff --git a/scr/lt2/images/bottom_tab.gif b/scr/lt2/images/bottom_tab.gif new file mode 100644 index 0000000..8e0430e Binary files /dev/null and b/scr/lt2/images/bottom_tab.gif differ diff --git a/scr/lt2/images/burger.png b/scr/lt2/images/burger.png new file mode 100644 index 0000000..eb406bc Binary files /dev/null and b/scr/lt2/images/burger.png differ diff --git a/scr/lt2/images/burger_focus.png b/scr/lt2/images/burger_focus.png new file mode 100644 index 0000000..a9da1bd Binary files /dev/null and b/scr/lt2/images/burger_focus.png differ diff --git a/scr/lt2/images/chat.png b/scr/lt2/images/chat.png new file mode 100644 index 0000000..b5c51ce Binary files /dev/null and b/scr/lt2/images/chat.png differ diff --git a/scr/lt2/images/chat_focus.png b/scr/lt2/images/chat_focus.png new file mode 100644 index 0000000..6bd3a74 Binary files /dev/null and b/scr/lt2/images/chat_focus.png differ diff --git a/scr/lt2/images/comment.png b/scr/lt2/images/comment.png new file mode 100644 index 0000000..ceb2137 Binary files /dev/null and b/scr/lt2/images/comment.png differ diff --git a/scr/lt2/images/comment2.png b/scr/lt2/images/comment2.png new file mode 100644 index 0000000..63e1947 Binary files /dev/null and b/scr/lt2/images/comment2.png differ diff --git a/scr/lt2/images/discovery.png b/scr/lt2/images/discovery.png new file mode 100644 index 0000000..91f3a63 Binary files /dev/null and b/scr/lt2/images/discovery.png differ diff --git a/scr/lt2/images/discovery_focus.png b/scr/lt2/images/discovery_focus.png new file mode 100644 index 0000000..1abc985 Binary files /dev/null and b/scr/lt2/images/discovery_focus.png differ diff --git a/scr/lt2/images/draft.png b/scr/lt2/images/draft.png new file mode 100644 index 0000000..6cd6fbb Binary files /dev/null and b/scr/lt2/images/draft.png differ diff --git a/scr/lt2/images/eye.png b/scr/lt2/images/eye.png new file mode 100644 index 0000000..e54b53f Binary files /dev/null and b/scr/lt2/images/eye.png differ diff --git a/scr/lt2/images/flag.png b/scr/lt2/images/flag.png new file mode 100644 index 0000000..a138c87 Binary files /dev/null and b/scr/lt2/images/flag.png differ diff --git a/scr/lt2/images/food.jpg b/scr/lt2/images/food.jpg new file mode 100644 index 0000000..1d6e4fc Binary files /dev/null and b/scr/lt2/images/food.jpg differ diff --git a/scr/lt2/images/good-bad.png b/scr/lt2/images/good-bad.png new file mode 100644 index 0000000..7d4e354 Binary files /dev/null and b/scr/lt2/images/good-bad.png differ diff --git a/scr/lt2/images/heart2.png b/scr/lt2/images/heart2.png new file mode 100644 index 0000000..1b082a6 Binary files /dev/null and b/scr/lt2/images/heart2.png differ diff --git a/scr/lt2/images/icon1.jpeg b/scr/lt2/images/icon1.jpeg new file mode 100644 index 0000000..3689b12 Binary files /dev/null and b/scr/lt2/images/icon1.jpeg differ diff --git a/scr/lt2/images/icon8.jpg b/scr/lt2/images/icon8.jpg new file mode 100644 index 0000000..5272258 Binary files /dev/null and b/scr/lt2/images/icon8.jpg differ diff --git a/scr/lt2/images/icon9.jpeg b/scr/lt2/images/icon9.jpeg new file mode 100644 index 0000000..b7cc97d Binary files /dev/null and b/scr/lt2/images/icon9.jpeg differ diff --git a/scr/lt2/images/index.png b/scr/lt2/images/index.png new file mode 100644 index 0000000..7794006 Binary files /dev/null and b/scr/lt2/images/index.png differ diff --git a/scr/lt2/images/index_focus.png b/scr/lt2/images/index_focus.png new file mode 100644 index 0000000..527f1ef Binary files /dev/null and b/scr/lt2/images/index_focus.png differ diff --git a/scr/lt2/images/index_scroll.gif b/scr/lt2/images/index_scroll.gif new file mode 100644 index 0000000..fa2cabd Binary files /dev/null and b/scr/lt2/images/index_scroll.gif differ diff --git a/scr/lt2/images/invite.png b/scr/lt2/images/invite.png new file mode 100644 index 0000000..2cb0726 Binary files /dev/null and b/scr/lt2/images/invite.png differ diff --git a/scr/lt2/images/lighting.png b/scr/lt2/images/lighting.png new file mode 100644 index 0000000..3ece534 Binary files /dev/null and b/scr/lt2/images/lighting.png differ diff --git a/scr/lt2/images/live.png b/scr/lt2/images/live.png new file mode 100644 index 0000000..ff20683 Binary files /dev/null and b/scr/lt2/images/live.png differ diff --git a/scr/lt2/images/more.png b/scr/lt2/images/more.png new file mode 100644 index 0000000..b79bca4 Binary files /dev/null and b/scr/lt2/images/more.png differ diff --git a/scr/lt2/images/navigation.gif b/scr/lt2/images/navigation.gif new file mode 100644 index 0000000..5adab3d Binary files /dev/null and b/scr/lt2/images/navigation.gif differ diff --git a/scr/lt2/images/recent.png b/scr/lt2/images/recent.png new file mode 100644 index 0000000..296b935 Binary files /dev/null and b/scr/lt2/images/recent.png differ diff --git a/scr/lt2/images/ring.png b/scr/lt2/images/ring.png new file mode 100644 index 0000000..c66a69a Binary files /dev/null and b/scr/lt2/images/ring.png differ diff --git a/scr/lt2/images/ring_focus.png b/scr/lt2/images/ring_focus.png new file mode 100644 index 0000000..05491b9 Binary files /dev/null and b/scr/lt2/images/ring_focus.png differ diff --git a/scr/lt2/images/search.png b/scr/lt2/images/search.png new file mode 100644 index 0000000..0d023ba Binary files /dev/null and b/scr/lt2/images/search.png differ diff --git a/scr/lt2/images/star.png b/scr/lt2/images/star.png new file mode 100644 index 0000000..f720599 Binary files /dev/null and b/scr/lt2/images/star.png differ diff --git a/scr/lt2/images/star2.png b/scr/lt2/images/star2.png new file mode 100644 index 0000000..1c10cf2 Binary files /dev/null and b/scr/lt2/images/star2.png differ diff --git a/scr/lt2/images/top_tab.gif b/scr/lt2/images/top_tab.gif new file mode 100644 index 0000000..933257f Binary files /dev/null and b/scr/lt2/images/top_tab.gif differ diff --git a/scr/lt2/images/upload.png b/scr/lt2/images/upload.png new file mode 100644 index 0000000..d32a604 Binary files /dev/null and b/scr/lt2/images/upload.png differ diff --git a/scr/lt2/images/v_discovery.png b/scr/lt2/images/v_discovery.png new file mode 100644 index 0000000..6b294fe Binary files /dev/null and b/scr/lt2/images/v_discovery.png differ diff --git a/scr/lt2/images/v_index.png b/scr/lt2/images/v_index.png new file mode 100644 index 0000000..3988fdd Binary files /dev/null and b/scr/lt2/images/v_index.png differ diff --git a/scr/lt2/images/write.png b/scr/lt2/images/write.png new file mode 100644 index 0000000..2a0b9af Binary files /dev/null and b/scr/lt2/images/write.png differ diff --git a/scr/lt2/images/zhi.png b/scr/lt2/images/zhi.png new file mode 100644 index 0000000..5bcfba2 Binary files /dev/null and b/scr/lt2/images/zhi.png differ diff --git a/scr/lt2/pages/answer/answer.js b/scr/lt2/pages/answer/answer.js new file mode 100644 index 0000000..6a47837 --- /dev/null +++ b/scr/lt2/pages/answer/answer.js @@ -0,0 +1,56 @@ +//answer.js + + +var app = getApp() +Page({ + data: { + motto: '知乎--微信小程序版', + userInfo: {}, + feed: [], + }, + //事件处理函数 + toQuestion: function() { + wx.navigateTo({ + url: '../question/question' + }) + }, + onLoad: function (options) { + var aid=options.aid + console.log(options); + console.log(options.aid); + console.log('onLoad') + var that = this + //调用应用实例的方法获取全局数据 + /*app.getUserInfo(function(userInfo){ + //更新数据 + that.setData({ + userInfo:userInfo + }) + })*/ + wx.cloud.database().collection('tiezi') + .where({ + _id:aid + }) + .get({ + success(res) { + console.log("请求成功", res) + that.setData({ + feed:res.data + }), + console.log(res.data) + }, + fail(res) { + console.log("请求失败", res) + } + }) + + }, + /* + onLoad: function (options) { + + },*/ + tapName: function(event){ + console.log(event) + }, + +}) diff --git a/scr/lt2/pages/answer/answer.json b/scr/lt2/pages/answer/answer.json new file mode 100644 index 0000000..efa73f8 --- /dev/null +++ b/scr/lt2/pages/answer/answer.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "回答" +} \ No newline at end of file diff --git a/scr/lt2/pages/answer/answer.wxml b/scr/lt2/pages/answer/answer.wxml new file mode 100644 index 0000000..2151cc9 --- /dev/null +++ b/scr/lt2/pages/answer/answer.wxml @@ -0,0 +1,94 @@ + + + + + + {{item.title}} + + + + + + + + + {{item.feed_source_name}} + 快来关注我吧~ + + + + + + {{item.content}} + + + + + + + \ No newline at end of file diff --git a/scr/lt2/pages/answer/answer.wxss b/scr/lt2/pages/answer/answer.wxss new file mode 100644 index 0000000..fc07e38 --- /dev/null +++ b/scr/lt2/pages/answer/answer.wxss @@ -0,0 +1,151 @@ +/**answer.wxss**/ + +.a { + padding: 0; + font-size: 14rpx; + background: #F0F4F3; + color: #000; +} + +.question { + position: relative; + width: 650rpx; + padding: 40rpx 50rpx 30rpx; + background: #298DE5; + color: #fff; + font-size: 38rpx; + line-height: 48rpx; +} +.answerer-wrp{ + position: relative; + width: 750rpx; + height: 150rpx; + background: #fff; +} +.answerer-wrp .bg-half{ + position: absolute; + top: 0; + width: 750rpx; + height: 75rpx; + background: #298DE5; +} +.answerer { + position: relative; + margin: 0 auto; + width: 630rpx; + height: 90rpx; + padding: 30rpx; + background: #fff; + border: solid 1px #ebebeb; + border-radius: 3px; + box-shadow: 0 1px 2px #bebebe; +} +.answerer .avatar { + flex: 1; + width: 90rpx; + height: 90rpx; +} + +.answerer .avatar image { + display: inline-block; + width: 90rpx; + height: 90rpx; + border-radius: 90rpx; +} +.answerer .answerer-info{ + flex: 5; + text-align: left; + padding: 10rpx 20rpx; + line-height: 38rpx; +} +.answerer .answerer-info text{ + display: block; +} +.answerer .answerer-info .answerer-name{ + font-size: 32rpx; +} +.answerer .answerer-info .answerer-des{ + font-size: 22rpx; + color: #808080; + line-height: 28rpx; +} +.answerer .follow{ + flex: 2; + padding: 15rpx 0; + font-size: 22rpx; +} +.answerer .follow text{ + display: inline-block; + padding: 15rpx 20rpx; + color: #40bcd0; + border: solid 2px #40bcd0; + border-radius: 6rpx; +} +.answer-content{ + padding: 30rpx 40rpx; + background: #ffffff; +} +.answer-content text{ + font-size: 32rpx; + color: #454545; + line-height: 44rpx; + word-break: break-all; +} +.answer-content image{ + width: 100%; + margin: 20rpx 0; +} +.answer-footer{ + position: fixed; + bottom: 0; + height: 70rpx; + border-top: solid 1px #ebebeb; + background: #ffffff; + width: 670rpx; + padding: 20rpx 40rpx; +} +.answer-footer .good{ + flex: 1; + /*display: inline-block;*/ + height: 40rpx; + border: solid 1px #d1d1d1; + border-radius: 3px; + padding: 10rpx 8rpx; + margin: 10rpx 0; +} +.answer-footer .good .good-bad{ + display: inline-block; +} +.answer-footer .good image{ + display: inline-block; + width: 38rpx; + height: 38rpx; + vertical-align: middle; +} +.answer-footer .good .good-num{ + display: inline-block; + padding: 10rpx 4rpx; + /*font-size: 24rpx;*/ +} +.answer-footer .operation-wrp{ + flex: 5; +} +.answer-footer .operation{ + justify-content: space-between; + padding: 0 0 0 60rpx; +} +.answer-footer .operation-btn{ + flex: 1; + text-align: center; +} +.answer-footer .operation image{ + display: block; + margin: 0 auto; + width: 50rpx; + height: 50rpx; +} +.answer-footer .operation-btn text{ + display: block; + font-size: 14rpx; + color: #bebebe; +} diff --git a/scr/lt2/pages/index/index.js b/scr/lt2/pages/index/index.js new file mode 100644 index 0000000..7739010 --- /dev/null +++ b/scr/lt2/pages/index/index.js @@ -0,0 +1,159 @@ +//index.js +let currentPage = 0 // 当前第几页,0代表第一页 +let pageSize = 1 +var util = require('../../utils/util.js') +var app = getApp() +Page({ + data: { + feed: [], + feed_length: 0, + loadMore: false, //"上拉加载"的变量,默认false,隐藏 + loadAll: false //“没有数据”的变量,默认false,隐藏 + //imgList:[] + }, + //事件处理函数 +bindItemTap: function(event) { + /*wx.navigateTo({ + url: '../answer/answer' + })*/ + var aid=event.currentTarget.dataset.aid; + console.log(aid) + //console.log("1") + wx.navigateTo({ + url: '../answer/answer?aid='+aid,//要跳转到的页面路径 +}) + + }, +bindQueTap: function() {//跳转que 可不用此函数 + + }, +onLoad: function () { + console.log('onLoad') + let that = this + //调用应用实例的方法获取全局数据 + this.getData(); + }, + + upper: function () { + wx.showNavigationBarLoading() + this.refresh(); + console.log("upper"); + setTimeout(function(){wx.hideNavigationBarLoading();wx.stopPullDownRefresh();}, 2000); + }, + lower: function (e) { + wx.showNavigationBarLoading(); + var that = this; + setTimeout(function(){wx.hideNavigationBarLoading();that.nextLoad();}, 1000); + console.log("lower") + }, + scroll: function (e) { + console.log("scroll") + }, + + //网络请求数据, 实现首页刷新 + refresh0: function(){ + this.getData; + /*var index_api = ''; + util.getData(index_api) + .then(function(data){ + //this.setData({ + // + //}); + console.log(data); + });*/ + }, + + //使用本地 fake 数据实现刷新效果 + getData() { + let that = this; + //第一次加载数据 + if (currentPage == 1) { + this.setData({ + loadMore: true, //把"上拉加载"的变量设为true,显示 + loadAll: false //把“没有数据”设为false,隐藏 + }) + } + //云数据的请求 + wx.cloud.database().collection("tiezi") + .orderBy('createTime', 'desc') //按发布视频排序 + .skip(currentPage * pageSize) //从第几个数据开始 + .limit(pageSize) + .get({ + success(res) { + if (res.data && res.data.length > 0) { + console.log("请求成功", res.data) + currentPage++ + //把新请求到的数据添加到dataList里 + let list = that.data.feed.concat(res.data) + that.setData({ + feed: list, //获取数据数组 + loadMore: false //把"上拉加载"的变量设为false,显示 + }); + if (res.data.length < pageSize) { + that.setData({ + loadMore: false, //隐藏加载中。。 + loadAll: true //所有数据都加载完了 + }); + } + } else { + that.setData({ + loadAll: true, //把“没有数据”设为true,显示 + loadMore: false //把"上拉加载"的变量设为false,隐藏 + }); + } + }, + fail(res) { + console.log("请求失败", res) + that.setData({ + loadAll: false, + loadMore: false + }); + } + }) + }, + refresh: function(){ + wx.showToast({ + title: '刷新中', + icon: 'loading', + duration: 3000 + }); + this.getData() + + + }, + + //使用本地 fake 数据实现继续加载效果 + nextLoad: function(){ + console.log("上拉触底事件") + let that = this + if (!that.data.loadMore) { + that.setData({ + loadMore: true, //加载中 + loadAll: false //是否加载完所有数据 + }); + + //加载更多,这里做下延时加载 + setTimeout(function() { + that.getData() + }, 500) + } + + }, + // 清缓存 + clearCache:function(){ + currentPage = 0;//分页标识归零 + this.setData({ + feed: [] //列表数组清空 + }); + }, + goto(){ + + wx.navigateTo({ + url: '../submit/submit',//要跳转到的页面路径 +}) + + }, + + +}) + diff --git a/scr/lt2/pages/index/index.json b/scr/lt2/pages/index/index.json new file mode 100644 index 0000000..d15edac --- /dev/null +++ b/scr/lt2/pages/index/index.json @@ -0,0 +1,4 @@ + +{ + +} \ No newline at end of file diff --git a/scr/lt2/pages/index/index.wxml b/scr/lt2/pages/index/index.wxml new file mode 100644 index 0000000..b559bf7 --- /dev/null +++ b/scr/lt2/pages/index/index.wxml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + {{item.feed_source_name}} + + + + + + + + {{item.title}} + + + + + {{item.content}} + + + + + {{item.comment_num}} 评论 + + + + + + + + diff --git a/scr/lt2/pages/index/index.wxss b/scr/lt2/pages/index/index.wxss new file mode 100644 index 0000000..10439be --- /dev/null +++ b/scr/lt2/pages/index/index.wxss @@ -0,0 +1,57 @@ +/**index.wxss**/ + +.container{ + height: 1500rpx; +} +.container .search{ + width: 735rpx; + height: 65rpx; + padding: 12.5rpx 0 12.5rpx 15rpx; + background: #2A8CE5; +} +.container .search-left{ + flex: 8; + background: #4EA3E7; + text-align: left; +} +.container .search-left input{ + display: inline-block; + height: 65rpx; + font-size: 26rpx; +} +.search-placeholder{ + color: #8CCEFD; + line-height: 20rpx; +} +.container .search .search-left image{ + display: inline-block; + width: 35rpx; + height: 35rpx; + padding: 15rpx 15rpx 15rpx 20rpx; +} +.container .search .search-right{ + flex: 1; +} +.container .search .search-right image{ + width: 45rpx; + height: 45rpx; + padding: 10rpx; +} + +.container{ + padding: 0; + font-size: 14rpx; + background: #F0F4F3; + color: #000; +} +/*feed-item part is in app.wxss for multiplexing*/ +.answer-txt{ + width:700rpx; + height:49rpx; + font-size:25rpx; + overflow:hidden; + text-overflow: ellipsis; + display:-webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; +} \ No newline at end of file diff --git a/scr/lt2/pages/login/login.js b/scr/lt2/pages/login/login.js new file mode 100644 index 0000000..8638f1a --- /dev/null +++ b/scr/lt2/pages/login/login.js @@ -0,0 +1,53 @@ +// pages/login/login.js +Page({ + data:{ + userInfo:'', + avatarUrl:'', + nickName:'' + }, + onLoad(){ + /* + let user=wx.getStorageSync('user') + this.setData({ + userInfo:user + }) + wx.switchTab({ + url: '/pages/index/index' + }) + */ + }, + login(){ + console.log('点击事件执行了') + wx.getUserProfile({ + desc: '必须授权才能使用', + success:res=>{ + let user=res.userInfo + let avatarUrl=res.userInfo.avatarUrl + let nickName=res.userInfo.nickName + wx.setStorageSync('user', user) + wx.setStorageSync('avatarUrl', avatarUrl) + wx.setStorageSync('nickName', nickName) + console.log('成功',res) + wx.cloud.database().collection('user').add({ + data: { + userInfo:user, + avatarUrl:user.avatarUrl, + nickName:user.nickName + } + }) + }, + fall:res=>{ + console.log('失败',res) + } + }) + wx.switchTab({ + url: '/pages/index/index' + }) + }, + nologin(){ + this.setData({ + userInfo:'' + }) + wx.setStorageSync('user', null) + }, +}) \ No newline at end of file diff --git a/scr/lt2/pages/login/login.json b/scr/lt2/pages/login/login.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/scr/lt2/pages/login/login.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/scr/lt2/pages/login/login.wxml b/scr/lt2/pages/login/login.wxml new file mode 100644 index 0000000..2732ee3 --- /dev/null +++ b/scr/lt2/pages/login/login.wxml @@ -0,0 +1,13 @@ + + + + + + {{userInfo.nickName}} + + + + + diff --git a/scr/lt2/pages/login/login.wxss b/scr/lt2/pages/login/login.wxss new file mode 100644 index 0000000..381c9b4 --- /dev/null +++ b/scr/lt2/pages/login/login.wxss @@ -0,0 +1,12 @@ +/* pages/login/login.wxss */ +.touxiang { + width: 150rpx; + height: 150rpx; + border-radius: 50%; + margin-top: 20rpx; + margin-bottom: 10rpx; + margin-left: 40%; +} +.nicheng{ + color:white; +} \ No newline at end of file diff --git a/scr/lt2/pages/notify/notify.js b/scr/lt2/pages/notify/notify.js new file mode 100644 index 0000000..6af5491 --- /dev/null +++ b/scr/lt2/pages/notify/notify.js @@ -0,0 +1,32 @@ +//logs.js +var util = require('../../utils/util.js') +var app=getApp() +Page({ + data: { + navTab: ["通知", "赞与感谢", "关注"], + currentNavtab: "0", + imgList:[] + }, + onLoad: function () { + var that = this + wx.cloud.database().collection('food') + /*.where({ + food_name:"烤盘饭", + _openid:undefined + })*/ + .get({ + success(res) { + console.log("请求成功", res) + that.setData({ + imgList:res.data + }), + console.log(res.data) + }, + fail(res) { + console.log("请求失败", res) + } + }) + + }, + +}) diff --git a/scr/lt2/pages/notify/notify.json b/scr/lt2/pages/notify/notify.json new file mode 100644 index 0000000..dd42c12 --- /dev/null +++ b/scr/lt2/pages/notify/notify.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "" +} \ No newline at end of file diff --git a/scr/lt2/pages/notify/notify.wxml b/scr/lt2/pages/notify/notify.wxml new file mode 100644 index 0000000..a0bdf2e --- /dev/null +++ b/scr/lt2/pages/notify/notify.wxml @@ -0,0 +1,7 @@ + + + + {{item.food_name}} + + + diff --git a/scr/lt2/pages/notify/notify.wxss b/scr/lt2/pages/notify/notify.wxss new file mode 100644 index 0000000..700806c --- /dev/null +++ b/scr/lt2/pages/notify/notify.wxss @@ -0,0 +1,149 @@ +.a { + padding: 0; + font-size: 14rpx; + background: #F0F4F3; + color: #000; +} + +.question { + position: relative; + width: 650rpx; + padding: 40rpx 50rpx 30rpx; + background: #298DE5; + color: #fff; + font-size: 38rpx; + line-height: 48rpx; +} +.answerer-wrp{ + position: relative; + width: 750rpx; + height: 150rpx; + background: #fff; +} +.answerer-wrp .bg-half{ + position: absolute; + top: 0; + width: 750rpx; + height: 75rpx; + background: #298DE5; +} +.answerer { + position: relative; + margin: 0 auto; + width: 630rpx; + height: 90rpx; + padding: 30rpx; + background: #fff; + border: solid 1px #ebebeb; + border-radius: 3px; + box-shadow: 0 1px 2px #bebebe; +} +.answerer .avatar { + flex: 1; + width: 90rpx; + height: 90rpx; +} + +.answerer .avatar image { + display: inline-block; + width: 90rpx; + height: 90rpx; + border-radius: 90rpx; +} +.answerer .answerer-info{ + flex: 5; + text-align: left; + padding: 10rpx 20rpx; + line-height: 38rpx; +} +.answerer .answerer-info text{ + display: block; +} +.answerer .answerer-info .answerer-name{ + font-size: 32rpx; +} +.answerer .answerer-info .answerer-des{ + font-size: 22rpx; + color: #808080; + line-height: 28rpx; +} +.answerer .follow{ + flex: 2; + padding: 15rpx 0; + font-size: 22rpx; +} +.answerer .follow text{ + display: inline-block; + padding: 15rpx 20rpx; + color: #40bcd0; + border: solid 2px #40bcd0; + border-radius: 6rpx; +} +.answer-content{ + padding: 30rpx 40rpx; + background: #ffffff; +} +.answer-content text{ + font-size: 32rpx; + color: #454545; + line-height: 44rpx; + word-break: break-all; +} +.answer-content image{ + width: 100%; + margin: 20rpx 0; +} +.answer-footer{ + position: fixed; + bottom: 0; + height: 70rpx; + border-top: solid 1px #ebebeb; + background: #ffffff; + width: 670rpx; + padding: 20rpx 40rpx; +} +.answer-footer .good{ + flex: 1; + /*display: inline-block;*/ + height: 40rpx; + border: solid 1px #d1d1d1; + border-radius: 3px; + padding: 10rpx 8rpx; + margin: 10rpx 0; +} +.answer-footer .good .good-bad{ + display: inline-block; +} +.answer-footer .good image{ + display: inline-block; + width: 38rpx; + height: 38rpx; + vertical-align: middle; +} +.answer-footer .good .good-num{ + display: inline-block; + padding: 10rpx 4rpx; + /*font-size: 24rpx;*/ +} +.answer-footer .operation-wrp{ + flex: 5; +} +.answer-footer .operation{ + justify-content: space-between; + padding: 0 0 0 60rpx; +} +.answer-footer .operation-btn{ + flex: 1; + text-align: center; +} +.answer-footer .operation image{ + display: block; + margin: 0 auto; + width: 50rpx; + height: 50rpx; +} +.answer-footer .operation-btn text{ + display: block; + font-size: 14rpx; + color: #bebebe; +} diff --git a/scr/lt2/pages/question/question.js b/scr/lt2/pages/question/question.js new file mode 100644 index 0000000..4284906 --- /dev/null +++ b/scr/lt2/pages/question/question.js @@ -0,0 +1,30 @@ +//answer.js +var util = require('../../utils/util.js') + +var app = getApp() +Page({ + data: { + motto: '知乎--微信小程序版', + userInfo: {} + }, + //事件处理函数 + bindItemTap: function() { + wx.navigateTo({ + url: '../answer/answer' + }) + }, + onLoad: function () { + console.log('onLoad') + var that = this + //调用应用实例的方法获取全局数据 + app.getUserInfo(function(userInfo){ + //更新数据 + that.setData({ + userInfo:userInfo + }) + }) + }, + tapName: function(event){ + console.log(event) + } +}) diff --git a/scr/lt2/pages/question/question.json b/scr/lt2/pages/question/question.json new file mode 100644 index 0000000..700b897 --- /dev/null +++ b/scr/lt2/pages/question/question.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "问题" +} \ No newline at end of file diff --git a/scr/lt2/pages/question/question.wxml b/scr/lt2/pages/question/question.wxml new file mode 100644 index 0000000..de5d204 --- /dev/null +++ b/scr/lt2/pages/question/question.wxml @@ -0,0 +1,225 @@ + + + + + + 阅读 + 电子书 + Kindle + 书籍 + 文学 + + + 选择 Kindle 而不是纸质书的原因是什么? + + + WEB前端*不靠谱天气预报员*想做代码小仙女 + + + + + + 3316 + + + + 27 + + + + 关注 + + + + + + + 邀请回答 + + + + 写回答 + + + + + + + + + + + Rebecca + + + + + + 难道不明白纸质书更贵啊!!! 若觉得kindle更贵,我觉得要么阅读量太少,那确实没有买kindle的必要。要么买的都是盗版的纸质书?我不清楚不加以评论。。。 另外,用kindle看小说的... + + + + + 254 评论 + + + 2 个月前 + + + + + + + + + + + + + Rebecca + + + + + + 难道不明白纸质书更贵啊!!! 若觉得kindle更贵,我觉得要么阅读量太少,那确实没有买kindle的必要。要么买的都是盗版的纸质书?我不清楚不加以评论。。。 另外,用kindle看小说的... + + + + + 254 评论 + + + 2 个月前 + + + + + + + + + + + + + Rebecca + + + + + + 难道不明白纸质书更贵啊!!! 若觉得kindle更贵,我觉得要么阅读量太少,那确实没有买kindle的必要。要么买的都是盗版的纸质书?我不清楚不加以评论。。。 另外,用kindle看小说的... + + + + + 254 评论 + + + 2 个月前 + + + + + + + + + + + + + Rebecca + + + + + + 难道不明白纸质书更贵啊!!! 若觉得kindle更贵,我觉得要么阅读量太少,那确实没有买kindle的必要。要么买的都是盗版的纸质书?我不清楚不加以评论。。。 另外,用kindle看小说的... + + + + + 254 评论 + + + 2 个月前 + + + + + + + + + + + + + Rebecca + + + + + + 难道不明白纸质书更贵啊!!! 若觉得kindle更贵,我觉得要么阅读量太少,那确实没有买kindle的必要。要么买的都是盗版的纸质书?我不清楚不加以评论。。。 另外,用kindle看小说的... + + + + + 254 评论 + + + 2 个月前 + + + + + + + + + + + + + Rebecca + + + + + + 难道不明白纸质书更贵啊!!! 若觉得kindle更贵,我觉得要么阅读量太少,那确实没有买kindle的必要。要么买的都是盗版的纸质书?我不清楚不加以评论。。。 另外,用kindle看小说的... + + + + + 254 评论 + + + 2 个月前 + + + + + + + + + + + + diff --git a/scr/lt2/pages/question/question.wxss b/scr/lt2/pages/question/question.wxss new file mode 100644 index 0000000..4d2ec8a --- /dev/null +++ b/scr/lt2/pages/question/question.wxss @@ -0,0 +1,180 @@ +/**answer.wxss**/ + +.answer-feed { + padding: 0; + font-size: 14rpx; + background: #F0F4F3; + color: #000; +} +.question-wrp{ + border-radius: 3px; + box-shadow: 0 1px 2px #bebebe; +} +.question-item{ + width: 710rpx; + padding: 40rpx 20rpx 10rpx; + background: #fff; +} +.question-item .que-tag{ + +} +.question-item .que-tag .tag{ + height: 28rpx; + padding: 15rpx 20rpx; + border-radius: 28rpx; + margin: 0 10rpx; + background: #EEF5F8; + color: #2186E0; + font-size: 28rpx; + vertical-align: middle; +} +.question-item .que-title{ + padding: 40rpx 20rpx 30rpx; + font-size: 38rpx; +} +.question-item .que-content{ + padding: 0 20rpx; + font-size: 26rpx; +} +.question-item .que-follow{ + margin: 20rpx; + height: 68rpx; +} +.question-item .que-follow view{ + display: inline-block; + margin: 0 40rpx 0 0; +} + +.question-item .que-follow image{ + width: 50rpx; + height: 50rpx; + margin: 0 10rpx 0 0; + vertical-align: middle; +} +.question-item .que-follow .left{ + float: left; + padding: 10rpx 0; +} +.question-item .que-follow .left text{ + color: #AFAFAF; + height: 50rpx; + vertical-align: middle; + padding: 18rpx 0; + font-size: 24rpx; +} +.question-item .que-follow .right{ + float: right; + padding: 20rpx 55rpx; + color: #ffffff; + background: #52C980; + border-radius: 3px; + font-size: 26rpx; + margin: 0; +} +.que-operate{ + width: 750rpx; + border-top: solid 1px #ebebeb; + border-bottom: solid 1px #ebebeb; + color: #889091; + vertical-align: middle; + background: #ffffff; +} +.que-operate .flex-item{ + padding: 20rpx 0; + font-size: 26rpx; +} +.que-operate .invite{ + border-right: solid 2px #ebebeb; +} +.que-operate image{ + width: 50rpx; + height: 50rpx; + vertical-align: middle; + margin: 0 20rpx 0 0; +} + +/*.answer-feed .feed-item{*/ + /*width: 690rpx;*/ + /*padding: 30rpx 30rpx 20rpx;*/ + /*margin: 7rpx 0 6rpx 0;*/ + /*background: #ffffff;*/ + /*border-top: 1px solid #eee;*/ + /*border-bottom: 1px solid #eee;*/ + /*box-shadow: 0 2px 5px #eeeeee;*/ +/*}*/ +/*.answer-feed .feed-item .feed-source{*/ + /*width: 690rpx;*/ + /*left: 0;*/ + /*height: 50rpx;*/ +/*}*/ +/*.answer-feed .feed-item .feed-source .avatar{*/ + /*position: relative;*/ + /*display: inline-block;*/ +/*}*/ +/*.answer-feed .feed-item .feed-source a{*/ + /*display: inline-block;*/ + /*height: 40rpx;*/ +/*}*/ +/*.answer-feed .feed-item .feed-source .avatar image{*/ + /*/!*position: absolute;*!/*/ + /*display: inline-block;*/ + /*width: 45rpx;*/ + /*height: 45rpx;*/ + /*border-radius: 45rpx;*/ + /*top: 10rpx;*/ + /*vertical-align: middle;*/ +/*}*/ +/*.answer-feed .feed-item .feed-source text{*/ + /*/!*position: absolute;*!/*/ + /*display: inline-block;*/ + /*height: 40rpx;*/ + /*line-height: 40rpx;*/ + /*vertical-align: middle;*/ + /*margin: 0 0 0 15rpx;*/ + /*color: #a0acac;*/ + /*font-size: 16rpx;*/ +/*}*/ +/*.answer-feed .feed-item .feed-source .item-more{*/ + /*display: inline-block;*/ + /*width: 40rpx;*/ + /*height: 45rpx;*/ + /*float: right;*/ +/*}*/ +/*.answer-feed .feed-item .feed-content{*/ + /*padding: 10rpx 0 0 0;*/ +/*}*/ +/*.answer-feed .feed-item .feed-content .question text{*/ + /*font-size: 28rpx;*/ + /*font-weight: 600px;*/ + /*line-height: 40rpx;*/ + /*text-space: 5rpx;*/ +/*}*/ +.answer-feed .feed-item .feed-content .answer-body{ + padding: 0; + /*height: 10rpx;*/ + font-size: 24rpx; + line-height: 28rpx; + color: #5b5b5b; +} +/*.answer-feed .feed-item .feed-content .answer-actions{*/ + /*width: 690rpx;*/ + /*padding: 10rpx 0 0;*/ + /*color: #a0acac;*/ +/*}*/ +/*.answer-feed .feed-item .feed-content .answer-actions view{*/ + /*display: inline-block;*/ + /*vertical-align: text-bottom;*/ + /*padding: 0 10rpx 0 0;*/ + /*font-size: 24rpx;*/ +/*}*/ +/*.answer-feed .feed-item .feed-content .answer-actions .dot ::after{*/ + /*content: "•";*/ +/*}*/ + + + + + + + + diff --git a/scr/lt2/pages/submit/submit.js b/scr/lt2/pages/submit/submit.js new file mode 100644 index 0000000..640d56c --- /dev/null +++ b/scr/lt2/pages/submit/submit.js @@ -0,0 +1,396 @@ +Page({ + /** + * 页面的初始数据 + */ + + + //分类1 + data: { + title: '', + content: '', + question_id:'', + feed_source_img:'', + feed_source_name:'', + tempFilePaths: [], + nowCount:0,//当前的图片上传个数 + index:0, + nickName:"", + avatarUrl:"", + feed:[] + }, + bindPickerChange:function(e){ + console.log(e) + this.setData({ + index:e.detail.value + }) + }, + + + //图片的上传 + chooseImage:function(e){ + let that = this; + wx.chooseImage({ + count: 3, // 默认最多3张图片,可自行更改 + sizeType: ['original', 'compressed'],// 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success: res => { + wx.showToast({ + title: '正在上传...', + icon: 'loading', + mask: true, + duration: 1000 + }) + // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片 + let tempFilePath = res.tempFilePaths; + console.log(tempFilePath); + let nowCount = that.data.nowCount; + let tempFilePaths = that.data.tempFilePaths; + + if(that.data.nowCount + tempFilePath.length >=3){ + let i = 0; + while(nowCount<3){//还可以继续上传图片 + tempFilePaths.push(tempFilePath[i]); + i++; + nowCount++; + } + that.setData({ + nowCount:3, + tempFilePaths:tempFilePaths + }) + }else{ + let i = 0; + while(i { + that.setData({ + value1:'', + value2:'', + tempFilePaths:[], + nowCount:0 + }) + wx.showToast({ + title: '发布成功', + }) + }, + }) + },fail:function(e){ + wx.hideLoading({ + success: (res) => { + wx.showToast({ + title: '网络异常', + }) + that.setData({ + value1:'', + value2:'', + tempFilePaths:[], + nowCount:0 + }) + }, + }) + console.log(e); + } + })*/ + let a=wx.getStorageSync ("nickName") + let b=wx.getStorageSync ("avatarUrl") + wx.cloud.database().collection('tiezi').add({ + data: { + title:title, + content:content, + openid:that.data.openid, + url:url, + createTime: wx.cloud.database().serverDate(), + feed_source_img:b, + feed_source_name:a + } + }) + wx.hideLoading({ + success: (res) => { + that.setData({ + + + value1:'', + value2:'', + tempFilePaths:[], + nowCount:0 + }) + wx.showToast({ + title: '发布成功', + })}}) + + }else{ + //将所有的内容上传到云端去 + for(i=0;i { + count++; + url.push(res.fileID); + console.log('上传图片'); + console.log(i,url); + if(count==that.data.nowCount){ + console.log(url); + /* + wx.cloud.callFunction({ + name:'love_upload', + data:{ + title:title, + content:content, + openid:that.data.openid, + url:url, + type:parseInt(that.data.index)+1 + + },success:function(e){ + console.log(e); + wx.hideLoading({ + success: (res) => { + that.setData({ + value1:'', + value2:'', + tempFilePaths:[], + nowCount:0 + }) + + wx.showToast({ + title: '发布成功', + }) + }, + }) + },fail:function(e){ + wx.hideLoading({ + success: (res) => { + wx.showToast({ + title: '网络异常', + }) + that.setData({ + value1:'', + value2:'', + tempFilePaths:[], + nowCount:0 + }) + }, + }) + console.log(e); + } + })*/ + let a=wx.getStorageSync ("nickName") + let b=wx.getStorageSync ("avatarUrl") + wx.cloud.database().collection('tiezi').add({ + data: { + title:title, + content:content, + openid:that.data.openid, + url:url, + createTime: wx.cloud.database().serverDate(), + feed_source_img:b, + feed_source_name:a + } + }) + wx.hideLoading({ + success: (res) => { + that.setData({ + + value1:'', + value2:'', + tempFilePaths:[], + nowCount:0 + }) + wx.showToast({ + title: '发布成功', + })}}) + } + },fail:res=>{ + console.log(res); + } + }) + + } + } + + }, + + + + blur:function(e){ + console.log(e); + }, + + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let loveSort = wx.getStorageSync('loveSort') + console.log(loveSort) + this.setData({ + loveSort:loveSort + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + }, + onAdd_s: function () { + + wx.cloud.init({ + env: 'cloud1-8g5wmepxce8a3b8a' + }); + const db = wx.cloud.database() + db.collection('tiezi').add({ + data: { + title:title, + content:content, + openid:that.data.openid, + url:[], + }, + success: res => { + // 在返回结果中会包含新创建的记录的 _id + this.setData({ + counterId: res._id, + count: 1 + }) + wx.showToast({ + title: '成功扔进树洞~', + }) + console.log('[数据库] [留言] 成功,记录 _id: ', res._id) + }, + fail: err => { + wx.showToast({ + icon: 'none', + title: '种种原因树洞拒绝了~' + }) + console.error('[数据库] [新增记录] 失败:', err) + } + }) + + } + +}) \ No newline at end of file diff --git a/scr/lt2/pages/submit/submit.json b/scr/lt2/pages/submit/submit.json new file mode 100644 index 0000000..7d1e76c --- /dev/null +++ b/scr/lt2/pages/submit/submit.json @@ -0,0 +1,3 @@ +{ + "navigationBarTitleText": "我要发帖" +} \ No newline at end of file diff --git a/scr/lt2/pages/submit/submit.wxml b/scr/lt2/pages/submit/submit.wxml new file mode 100644 index 0000000..7c255de --- /dev/null +++ b/scr/lt2/pages/submit/submit.wxml @@ -0,0 +1,31 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/scr/lt2/pages/submit/submit.wxss b/scr/lt2/pages/submit/submit.wxss new file mode 100644 index 0000000..7b24204 --- /dev/null +++ b/scr/lt2/pages/submit/submit.wxss @@ -0,0 +1,73 @@ +/* pages/submit/submit.wxss */ +form{ + display: block; + width: 100%; + padding: 20rpx 17rpx; +} +.title{ + font-size: 38rpx; + display: flex; + margin-top: 25rpx; + padding: 13px 0; + margin-bottom: 30rpx; + border-bottom: 1px solid #ccc; +} +textarea{ + margin-bottom: 30rpx; + border-bottom: 1px solid #ccc; + padding-right: 50rpx; + margin-top: 30rpx; + display: block; + width: 100%; + height: 550rpx !important; + box-sizing: border-box; +} +.picker{ + + display: flex; + padding: 13px 0; + margin-bottom: 35rpx; + border-bottom: 1px solid #ccc; + +} +.img_box{ + position:relative; + display: flex; + flex-wrap: wrap; + margin:0 auto; +} +.imgs{ + width:33.33333333%; + display: flex; + justify-content: center; + margin-bottom:20rpx; +} +.imgs image{ + width:90%; + max-height:212rpx; + border:1px solid rgba(214, 212, 212, 0.1); + /* box-shadow: 5rpx 5rpx 1rpx 3rpx #e2e0e0; */ +} +.imgs .images{ + position:relative; +} +.images button{ + width:100%; + height:100%; + position:absolute; + top:0; + left:0; +} +.img_box .images{ + width:90%; + height: 212rpx; + border:1px solid #E8E8E8; + border-radius:4rpx; + display: flex; + align-items: center; + justify-content: center; +} +.img_box .images>image{ + width:60rpx; + height:60rpx; +} \ No newline at end of file diff --git a/scr/lt2/project.config.json b/scr/lt2/project.config.json new file mode 100644 index 0000000..2611fde --- /dev/null +++ b/scr/lt2/project.config.json @@ -0,0 +1,30 @@ +{ + "compileType": "miniprogram", + "setting": { + "coverView": true, + "es6": true, + "postcss": true, + "minified": true, + "enhance": true, + "showShadowRootInWxmlPanel": true, + "packNpmRelationList": [], + "ignoreDevUnusedFiles": false, + "ignoreUploadUnusedFiles": true, + "babelSetting": { + "ignore": [], + "disablePlugins": [], + "outputPath": "" + } + }, + "condition": {}, + "editorSetting": { + "tabIndent": "insertSpaces", + "tabSize": 2 + }, + "libVersion": "2.27.0", + "packOptions": { + "ignore": [], + "include": [] + }, + "appid": "wxcc745ea897810e52" +} \ No newline at end of file diff --git a/scr/lt2/project.private.config.json b/scr/lt2/project.private.config.json new file mode 100644 index 0000000..736d4f8 --- /dev/null +++ b/scr/lt2/project.private.config.json @@ -0,0 +1,7 @@ +{ + "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", + "projectname": "lt2", + "setting": { + "compileHotReLoad": true + } +} \ No newline at end of file diff --git a/scr/lt2/utils/util.js b/scr/lt2/utils/util.js new file mode 100644 index 0000000..7e07d89 --- /dev/null +++ b/scr/lt2/utils/util.js @@ -0,0 +1,67 @@ +function formatTime(date) { + var year = date.getFullYear() + var month = date.getMonth() + 1 + var day = date.getDate() + + var hour = date.getHours() + var minute = date.getMinutes() + var second = date.getSeconds() + + + return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':') +} + +function formatNumber(n) { + n = n.toString() + return n[1] ? n : '0' + n +} + +module.exports = { + formatTime: formatTime +}; +/* +var index = require('../data/data_index.js') +var index_next = require('../data/data_index_next.js') + +function getData(url){ + return new Promise(function(resolve, reject){ + wx.request({ + url: url, + data: {}, + header: { + //'Content-Type': 'application/json' + }, + success: function(res) { + console.log("success") + resolve(res) + }, + fail: function (res) { + reject(res) + console.log("failed") + } + }) + }) +} + +function getData2(){ + return index.index; +} + +function getNext(){ + return index_next.next; +} + + + + + +module.exports.getData = getData; +module.exports.getData2 = getData2; +module.exports.getNext = getNext; +module.exports.getDiscovery = getDiscovery; +module.exports.discoveryNext = discoveryNext; + + + + +*/ \ No newline at end of file