//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) { } })