轻源码

  • QingYuanMa.com
  • 全球最大的互联网技术和资源下载平台
搜索
一起源码网 门户 微信小程序 查看主题

“文笔记+”春节纪念版demo:添加/编辑笔记,保存笔记

发布者: 天堂守护者 | 发布时间: 2018-1-1 13:22| 查看数: 3507| 评论数: 1|帖子模式

房间衣服满天飞,家里年货买买买。今年这个年真是忙成狗了,不多说了明早6点还要去医院,赶紧上传睡觉,这次回家有电脑了录制了GIF图,就不上代码了直接展示功能,下面附代码附件。

 
js:

  1. Page({
  2. data: {
  3. today: '',//当天日期
  4. image: '/pages/image/111.jpg',//背景图片
  5. desArr: []//数据源数组
  6. },
  7. getNowFormatDate() {
  8. //获取当天日期
  9. var date = new Date();
  10. var seperator1 = "-";
  11. var month = date.getMonth() + 1;
  12. var strDate = date.getDate();
  13. if (month >= 1 && month <= 9) {
  14. month = "0" + month;
  15. }
  16. if (strDate >= 0 && strDate <= 9) {
  17. strDate = "0" + strDate;
  18. }
  19. var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
  20. return currentdate;
  21. },
  22. onLoad: function (options) {
  23. //获取缓存内容
  24. this.setData({
  25. desArr: wx.getStorageSync('oldText')
  26. })
  27. if (this.data.desArr == null && this.data.desArr == '') {
  28. //如果没有缓存则为空
  29. this.setData({
  30. desArr: []
  31. })
  32. }
  33. //获取当天日期
  34. var day = this.getNowFormatDate()
  35. this.setData({
  36. today: day
  37. })
  38. },
  39. onShow: function () {
  40. // 生命周期函数--监听页面显示
  41. //获取当前缓存
  42. var arrayA = wx.getStorageSync('oldText');
  43. var isChange = wx.getStorageSync('isChange');
  44. if (arrayA.length != this.data.desArr.length) {
  45. //如果数量改变从新赋值
  46. this.setData({
  47. desArr: arrayA
  48. })
  49. } else if (isChange == 1) {
  50. wx.setStorageSync('isChange', 0);
  51. this.setData({
  52. desArr: arrayA
  53. })
  54. }
  55. },
  56. onShareAppMessage: function () {
  57. // 用户点击右上角分享
  58. return {
  59. title: '文笔记+', // 分享标题
  60. desc: '我们的功能不仅笔记', // 分享描述
  61. path: 'path' // 分享路径
  62. }
  63. },
  64. cancelTap(e) {
  65. //删除按钮
  66. console.log(e)
  67. }
  68. })

wxss:

  1. page {
  2. height: 100%;
  3. }
  4. .des-image {
  5. position: absolute;
  6. width: 100%;
  7. height: 100%;
  8. }
  9. .des-scr {
  10. width: 100%;
  11. height: 100%;
  12. }
  13. .des-view {
  14. margin: 5%;
  15. width: 90%;
  16. height: 180rpx;
  17. border: 1px solid orange;
  18. }
  19. .des-text {
  20. display: block;
  21. margin: 20rpx;
  22. height: 80rpx;
  23. overflow: hidden;
  24. }
  25. .des-tiemText {
  26. display: block;
  27. margin-right: 20rpx;
  28. margin-bottom: 20rpx;
  29. height: 40rpx;
  30. text-align: right;
  31. }
  32. .new-btn {
  33. position: absolute;
  34. bottom: 200rpx;
  35. right: 0rpx;
  36. width: 80rpx;
  37. height: 80rpx;
  38. background: darkorange;
  39. border-radius: 50%;
  40. font-size: 48rpx;
  41. line-height: 80rpx;
  42. }

wxml:

  1. <!--背景-->
  2. <image class="des-image" src="{{image}}"></image>
  3. <!--底部滚动-->
  4. <scroll-view class="des-scr" scroll-y="true" bindscroll="scroll">
  5. <!--循环view-->
  6. <block wx:for="{{desArr}}">
  7. <navigator url="../logs/logs?des={{item.des}}&time={{item.time}}&image={{image}}&id={{item.id}}&revise=1">
  8. <view class="des-view" bindtap="toiletDetails" id="{{index}}">
  9. <text class="des-text">{{item.des}}</text>
  10. <text class="des-tiemText">{{item.time}}</text>
  11. </view>
  12. </navigator>
  13. </block>
  14. </scroll-view>
  15. <!--添加按钮-->
  16. <navigator url="../logs/logs?des=&time={{today}}&image={{image}}&id=-1&revise=0">
  17. <button class="new-btn" bindtap="newBtnDown">+</button>
  18. </navigator>

有人的捧个人场,有钱的捧个钱场~ 来点浮云呗。。。 

最新评论

uoxman 发表于 2022-5-7 13:10
酷信源代码怎么下载

浏览过的版块

轻源码让程序更轻更快

QingYuanMa.com

工作时间 周一至周六 8:00-17:30

侵权处理

客服QQ点击咨询

关注抖音号

定期抽VIP

Copyright © 2016-2021 https://www.171739.xyz/ 滇ICP备13200218号

快速回复 返回顶部 返回列表