Commit fe265c9389fd73e0cdf9477bc47524c525a5fd23

Authored by xianghenggang
1 parent 921d144cfc

我的收藏页面和反馈页面

Showing 10 changed files with 498 additions and 0 deletions

littleApp_child/app.json View file @ fe265c9
1 1 {
2 2 "pages": [
  3 + "pages/mySaved/mySaved",
  4 + "pages/feedback/feedback",
3 5  
4 6 "pages/home/home",
5 7  
littleApp_child/pages/feedback/feedback.js View file @ fe265c9
  1 +//hospitalList.js 医院列表 联系医院
  2 +
  3 +// 网络请求工具类
  4 +var networkUtil = require('../../utils/network_util.js')
  5 +var api = require('../../utils/apiFile.js')
  6 +
  7 +// 页码
  8 +var page = 0
  9 +// 地理位置信息
  10 +var latitude = 0
  11 +var longitude = 0
  12 +// 是否有更多
  13 +var hasMore = true
  14 +
  15 +Page({
  16 + data: {
  17 + list: [
  18 + {
  19 + checked: false, id: 1, title: "title1", introduction: "introductionintroductionintroductionintroductionintroductionintroductionintroduction", isLike: 1, likeCount:2,image:{
  20 + medium:"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  21 +
  22 + } },
  23 + {
  24 + checked: false, id: 2, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  25 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  26 +
  27 + } },
  28 + {
  29 + checked: false, id: 3, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  30 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  31 +
  32 + } },
  33 + {
  34 + checked: false, id: 4, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  35 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  36 +
  37 + } },
  38 +
  39 + {
  40 + checked: false, id: 5, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  41 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  42 +
  43 + } },
  44 + {
  45 + checked: false, id: 6, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  46 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  47 +
  48 + } },
  49 + {
  50 + checked: false, id: 7, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  51 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  52 +
  53 + } },
  54 + {
  55 + checked: false, id: 8, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  56 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  57 +
  58 + } },
  59 +
  60 + ],
  61 + isShowCheckbox: false,
  62 + },
  63 + /*---------生命周期--------*/
  64 + onLoad: function () {
  65 +
  66 +
  67 + },
  68 + checkboxChange: function (e) {
  69 + console.log(e)
  70 + if (this.data.isShowCheckbox){
  71 + var self = this
  72 + var id = e.target.dataset.id
  73 + var checked = e.target.dataset.checked ? false : true
  74 + console.log(this.data.list)
  75 + for (var i = 0; i < this.data.list.length; i++) {
  76 + if (id == this.data.list[i].id) {
  77 + this.data.list[i].checked = checked
  78 + }
  79 + }
  80 + // console.log(this.data.list)
  81 + this.setData({
  82 + list: this.data.list
  83 + })
  84 + }
  85 +
  86 + },
  87 + showChoose: function (e) {
  88 + var self = this
  89 + var isShowCheckbox = !self.data.isShowCheckbox
  90 +
  91 + self.setData({
  92 + isShowCheckbox: isShowCheckbox
  93 + })
  94 + },
  95 + chooseAll: function (e) {
  96 + var list = this.data.list
  97 + for (var i = 0; i < list.length; i++) {
  98 + list[i].checked = true
  99 + }
  100 + this.setData({
  101 + list: list
  102 + })
  103 + },
  104 + cancle: function (e) {
  105 + var self = this
  106 + var list = this.data.list
  107 + for (var i = 0; i < list.length; i++) {
  108 + list[i].checked = false
  109 + }
  110 + var isShowCheckbox = !self.data.isShowCheckbox
  111 +
  112 + self.setData({
  113 + isShowCheckbox: isShowCheckbox,
  114 + list: list
  115 + })
  116 + },
  117 + deleteAll: function (e) {
  118 +
  119 + }
  120 +})
littleApp_child/pages/feedback/feedback.json View file @ fe265c9
  1 +{
  2 + "navigationBarBackgroundColor": "#48C17B",
  3 + "navigationBarTitleText": "用户反馈",
  4 + "navigationBarTextStyle": "white",
  5 + "backgroundColor": "#d8dbd4"
  6 +}
littleApp_child/pages/feedback/feedback.wxml View file @ fe265c9
  1 +<!--hospitalList.wxml 医院列表 联系医院-->
  2 +<view class="main">
  3 + <textarea class="content" placeholder="写下你的意见或建议..." />
  4 +
  5 +</view>
  6 +
  7 +<button class="delete_bt2" bindtap="showChoose">提交</button>
littleApp_child/pages/feedback/feedback.wxss View file @ fe265c9
  1 +.main {
  2 + background: white;
  3 + height: 100%;
  4 +}
  5 +
  6 +.content {
  7 + width: 100%;
  8 + left: 10px;
  9 + right: 10px;
  10 + background: #fff;
  11 + border: 1px solid #e6e6e6;
  12 + border-radius: 4px;
  13 + padding: 10px;
  14 + font-size: 14px;
  15 + color: #888;
  16 + margin-top: 10px;
  17 + height: 120px;
  18 +}
  19 +
  20 +.delete_bt2 {
  21 + background: #48c17b;
  22 + border-radius: 100px;
  23 + position: fixed;
  24 + color: white;
  25 + font-size: 14px;
  26 + bottom: 20px;
  27 + left: 10px;
  28 + right: 10px;
  29 + height: 36px;
  30 +}
littleApp_child/pages/mySaved/mySaved.js View file @ fe265c9
  1 +//hospitalList.js 医院列表 联系医院
  2 +
  3 +// 网络请求工具类
  4 +var networkUtil = require('../../utils/network_util.js')
  5 +var api = require('../../utils/apiFile.js')
  6 +
  7 +// 页码
  8 +var page = 0
  9 +// 地理位置信息
  10 +var latitude = 0
  11 +var longitude = 0
  12 +// 是否有更多
  13 +var hasMore = true
  14 +
  15 +Page({
  16 + data: {
  17 + list: [
  18 + {
  19 + checked: false, id: 1, title: "title1", introduction: "introductionintroductionintroductionintroductionintroductionintroductionintroduction", isLike: 1, likeCount:2,image:{
  20 + medium:"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  21 +
  22 + } },
  23 + {
  24 + checked: false, id: 2, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  25 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  26 +
  27 + } },
  28 + {
  29 + checked: false, id: 3, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  30 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  31 +
  32 + } },
  33 + {
  34 + checked: false, id: 4, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  35 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  36 +
  37 + } },
  38 +
  39 + {
  40 + checked: false, id: 5, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  41 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  42 +
  43 + } },
  44 + {
  45 + checked: false, id: 6, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  46 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  47 +
  48 + } },
  49 + {
  50 + checked: false, id: 7, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  51 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  52 +
  53 + } },
  54 + {
  55 + checked: false, id: 8, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
  56 + medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"
  57 +
  58 + } },
  59 +
  60 + ],
  61 + isShowCheckbox: false,
  62 + },
  63 + /*---------生命周期--------*/
  64 + onLoad: function () {
  65 +
  66 +
  67 + },
  68 + checkboxChange: function (e) {
  69 + console.log(e)
  70 + if (this.data.isShowCheckbox){
  71 + var self = this
  72 + var id = e.target.dataset.id
  73 + var checked = e.target.dataset.checked ? false : true
  74 + console.log(this.data.list)
  75 + for (var i = 0; i < this.data.list.length; i++) {
  76 + if (id == this.data.list[i].id) {
  77 + this.data.list[i].checked = checked
  78 + }
  79 + }
  80 + // console.log(this.data.list)
  81 + this.setData({
  82 + list: this.data.list
  83 + })
  84 + }
  85 +
  86 + },
  87 + showChoose: function (e) {
  88 + var self = this
  89 + var isShowCheckbox = !self.data.isShowCheckbox
  90 +
  91 + self.setData({
  92 + isShowCheckbox: isShowCheckbox
  93 + })
  94 + },
  95 + chooseAll: function (e) {
  96 + var list = this.data.list
  97 + for (var i = 0; i < list.length; i++) {
  98 + list[i].checked = true
  99 + }
  100 + this.setData({
  101 + list: list
  102 + })
  103 + },
  104 + cancle: function (e) {
  105 + var self = this
  106 + var list = this.data.list
  107 + for (var i = 0; i < list.length; i++) {
  108 + list[i].checked = false
  109 + }
  110 + var isShowCheckbox = !self.data.isShowCheckbox
  111 +
  112 + self.setData({
  113 + isShowCheckbox: isShowCheckbox,
  114 + list: list
  115 + })
  116 + },
  117 + deleteAll: function (e) {
  118 +
  119 + }
  120 +})
littleApp_child/pages/mySaved/mySaved.json View file @ fe265c9
  1 +{
  2 + "navigationBarBackgroundColor": "#48C17B",
  3 + "navigationBarTitleText": "我的收藏",
  4 + "navigationBarTextStyle": "white",
  5 + "backgroundColor": "#d8dbd4",
  6 + "enablePullDownRefresh": true
  7 +}
littleApp_child/pages/mySaved/mySaved.wxml View file @ fe265c9
  1 +<!--hospitalList.wxml 医院列表 联系医院-->
  2 +<view class="main">
  3 +
  4 + <scroll-view scroll-y="true" style="height: 100%;" bindscrolltolower="loadMore">
  5 + <!--list的item-->
  6 + <view class="">
  7 + <view wx:for="{{list}}" style="display: flex">
  8 +
  9 + <image wx:if="{{isShowCheckbox}}" class="check_image" src="../../source/{{item.checked ? 'like.png' :'save_not.png'}}" bindtap="checkboxChange" data-id="{{item.id}}" data-checked="{{item.checked}}"></image>
  10 + <view class="content_item">
  11 + <view style="margin-right:75px;">
  12 + <view class="content_title">{{item.title}}</view>
  13 + <view class="content_content">{{item.introduction}}</view>
  14 + <view class="zarparent_box">
  15 +
  16 + <view class="zar_box" catchtap="articleLike" data-id="{{item.id}}" data-index="{{index}}">
  17 + <image class="zar_img" src="../../source/{{item.isLike == 1 ? 'zanguo.png' : 'like.png'}}"></image>
  18 + <view class="content_zar">{{item.likeCount}}</view>
  19 + </view>
  20 + <view class="zar_box">
  21 + <image class="zar_img" src="../../source/{{item.isLike == 1 ? 'save_not.png' : 'like.png'}}"></image>
  22 + <view class="content_zar">{{item.likeCount}}</view>
  23 + </view>
  24 + <view class="tags_view" >
  25 + <view class="tags1">新生儿</view>
  26 + <view class="tags1">健康宝宝</view>
  27 + </view>
  28 + </view>
  29 +
  30 + </view>
  31 + <image class="content_image" mode="aspectFill" src="{{item.image.medium}}"></image>
  32 + <view class="home__list-item__bottom"></view>
  33 + </view>
  34 +
  35 +
  36 + </view>
  37 +
  38 + <view class="loadMoreView" wx:if="{{hasMore}}">加载更多...</view>
  39 + </view>
  40 +
  41 + </scroll-view>
  42 +
  43 + <view wx:if="{{isShowCheckbox}}" class="bottom_view">
  44 + <view class="chooseAll" bindtap="chooseAll">全选</view>
  45 + <view class="chooseAll" bindtap="cancle">取消</view>
  46 + <view class="delete_bt" bindtap="deleteAll">删除</view>
  47 + </view>
  48 + <button wx:if="{{!isShowCheckbox}}" class="delete_bt2" bindtap="showChoose">删除</button>
  49 +</view>
littleApp_child/pages/mySaved/mySaved.wxss View file @ fe265c9
  1 +.main {
  2 + background: white;
  3 + height: 100%;
  4 + width: 100%;
  5 +}
  6 +
  7 +.check_image {
  8 + width: 20px;
  9 + height: 20px;
  10 + margin-left: 10px;
  11 + transform: translateY(-55px);
  12 +}
  13 +
  14 +.content_item {
  15 + width: 100%;
  16 + height: 90px;
  17 + right: 75px;
  18 + margin-left: 10px;
  19 + position: flex;
  20 +}
  21 +
  22 +.content_title {
  23 + font-family: PingFangSC-Regular;
  24 + font-size: 14px;
  25 + padding-top: 7px;
  26 + color: #222;
  27 + display: -webkit-box;
  28 + -webkit-box-orient: vertical;
  29 + -webkit-line-clamp: 1;
  30 + overflow: hidden;
  31 +}
  32 +
  33 +.content_content {
  34 + height: 36px;
  35 + font-family: PingFangSC-Regular;
  36 + font-size: 12px;
  37 + color: #888;
  38 + line-height: 18px;
  39 + display: -webkit-box;
  40 + overflow: hidden;
  41 + text-overflow: ellipsis;
  42 + word-break: break-all;
  43 + -webkit-box-orient: vertical;
  44 + -webkit-line-clamp: 2;
  45 +}
  46 +
  47 +.content_image {
  48 + width: 50px;
  49 + transform: translateY(-75px);
  50 + float: right;
  51 + margin-right: 15px;
  52 + height: 50px;
  53 + position: absolute;
  54 + right: 0px;
  55 +}
  56 +
  57 +.zarparent_box {
  58 + display: flex;
  59 +}
  60 +
  61 +.zar_box {
  62 + display: flex;
  63 + margin-left: -5px;
  64 + width: 50px;
  65 +}
  66 +
  67 +.zar_img {
  68 + width: 25px;
  69 + height: 25px;
  70 +}
  71 +
  72 +.save_img {
  73 + width: 25px;
  74 + height: 25px;
  75 +}
  76 +
  77 +.content_zar {
  78 + font-family: PingFangSC-Regular;
  79 + font-size: 10px;
  80 + margin-left: 3px;
  81 + margin-top: 5px;
  82 + color: #c6c6c6;
  83 +}
  84 +
  85 +.tags_view{
  86 + display:flex;
  87 + float: right;
  88 + position: absolute;
  89 + right: 20px;
  90 +}
  91 +.tags1 {
  92 + background: #f2fdf7;
  93 + border-radius: 2px;
  94 + font-size: 12px;
  95 + margin-left: 10px;
  96 + color: #58a478;
  97 + margin-top: 5px;
  98 +}
  99 +
  100 +/*item 分割线*/
  101 +
  102 +.home__list-item__bottom {
  103 + height: 1px;
  104 + background: #e2e2e2;
  105 + margin-top: 5px;
  106 + margin-bottom: 5px;
  107 + left: 15px;
  108 + right: 15px;
  109 +}
  110 +
  111 +.list_scroll {
  112 + height: 100vh;
  113 + /* background: rebeccapurple */
  114 +}
  115 +
  116 +.bottom_view {
  117 + position: fixed;
  118 + display: flex;
  119 + bottom: 20px;
  120 + left: 10px;
  121 + right: 10px;
  122 + height: 36px;
  123 +}
  124 +
  125 +.chooseAll {
  126 + background: #eaeaea;
  127 + border: 1px solid #e6e6e6;
  128 + border-radius: 100px;
  129 + font-size: 14px;
  130 + color: #888;
  131 + margin-right: 10px;
  132 + text-align: center;
  133 + line-height: 36px;
  134 + width: 30%;
  135 +}
  136 +
  137 +.delete_bt {
  138 + background: #48c17b;
  139 + border-radius: 100px;
  140 + color: white;
  141 + font-size: 14px;
  142 + width: 30%;
  143 + line-height: 36px;
  144 + text-align: center;
  145 +}
  146 +
  147 +.delete_bt2 {
  148 + background: #48c17b;
  149 + border-radius: 100px;
  150 + position: fixed;
  151 + color: white;
  152 + font-size: 14px;
  153 + bottom: 20px;
  154 + left: 10px;
  155 + right: 10px;
  156 + height: 36px;
  157 +}
littleApp_child/source/save_not.png View file @ fe265c9

1.25 KB