mySaved.js 4.08 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
//hospitalList.js 医院列表 联系医院

// 网络请求工具类
var networkUtil = require('../../utils/network_util.js')
var api = require('../../utils/apiFile.js')

// 页码
var page = 0
// 地理位置信息
var latitude = 0
var longitude = 0
// 是否有更多
var hasMore = true

Page({
data: {
list: [
{
checked: false, id: 1, title: "title1", introduction: "introductionintroductionintroductionintroductionintroductionintroductionintroduction", isLike: 1, likeCount:2,image:{
medium:"https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },
{
checked: false, id: 2, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },
{
checked: false, id: 3, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },
{
checked: false, id: 4, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },

{
checked: false, id: 5, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },
{
checked: false, id: 6, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },
{
checked: false, id: 7, title: "title1", introduction: "introduction", isLike: 1, likeCount: 2, image: {
medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },
{
checked: false, id: 8, title: "title2", introduction: "introduction", isLike: 1, likeCount: 2, image: {
medium: "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=4131634322,487666839&fm=26&gp=0.jpg"

} },

],
isShowCheckbox: false,
},
/*---------生命周期--------*/
onLoad: function () {


},
checkboxChange: function (e) {
console.log(e)
if (this.data.isShowCheckbox){
var self = this
var id = e.target.dataset.id
var checked = e.target.dataset.checked ? false : true
console.log(this.data.list)
for (var i = 0; i < this.data.list.length; i++) {
if (id == this.data.list[i].id) {
this.data.list[i].checked = checked
}
}
// console.log(this.data.list)
this.setData({
list: this.data.list
})
}
},
showChoose: function (e) {
var self = this
var isShowCheckbox = !self.data.isShowCheckbox

self.setData({
isShowCheckbox: isShowCheckbox
})
},
chooseAll: function (e) {
var list = this.data.list
for (var i = 0; i < list.length; i++) {
list[i].checked = true
}
this.setData({
list: list
})
},
cancle: function (e) {
var self = this
var list = this.data.list
for (var i = 0; i < list.length; i++) {
list[i].checked = false
}
var isShowCheckbox = !self.data.isShowCheckbox

self.setData({
isShowCheckbox: isShowCheckbox,
list: list
})
},
deleteAll: function (e) {

}
})