[AppleScript] 纯文本查看 复制代码
?
001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042
043
044
045
046
047
048
049
050
051
052
053
054
055
056
057
058
059
060
061
062
063
064
065
066
067
068
069
070
071
072
073
074
075
076
077
078
079
080
081
082
083
084
085
086
087
088
089
090
091
092
093
094
095
096
097
098
099
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
var app = getApp()
Page({
data: {
dataList : []
},
initData : function(){
return [
{
id : 1,
title : '紧急任务',
themes :[{
id : 11,
selected : true,
interact : false,
partake : true,
complete :'Page() 函数用来注册一个页面。接受一个 object 参数,其指定页面的初始数据、生命周期函数、事件处理函数等。',
partakes :[
'../../images/1.jpg',
'../../images/2.jpg',
'../../images/3.jpg',
'../../images/4.png',
'../../images/5.jpg',
'../../images/0.jpg']
},{
id : 12,
selected : false,
interact : false,
partake : true,
complete :'在组件上使用wx:for控制属性绑定一个数组,即可使用数组中各项的数据重复渲染该组件。',
partakes :[
'../../images/1.jpg',
'../../images/2.jpg',
'../../images/3.jpg']
}]
},{
id : 2,
title : '延期任务',
themes :[{
id : 21,
selected : false,
interact : false,
partake : true,
complete :'App() 函数用来注册一个小程序。接受一个 object 参数,其指定小程序的生命周期函数等。',
partakes :[
'../../images/2.jpg',
'../../images/3.jpg',
'../../images/4.png',
'../../images/5.jpg',
'../../images/0.jpg']
}]
}
]
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
var that = this
wx.showNavigationBarLoading()
that.setData({
dataList : that.initData()
})
wx.hideNavigationBarLoading()
},
onPullDownRefresh : function(){ //下拉刷新
var that = this
wx.showNavigationBarLoading()
that.setData({
dataList : that.initData()
})
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
},
onReachBottom : function(){ //下拉底部分页
var that = this
wx.showNavigationBarLoading()
that.setData({
dataList : that.initData()
})
wx.stopPullDownRefresh()
wx.hideNavigationBarLoading()
},
onSelected : function(e){ //处理
wx.showNavigationBarLoading()
var that = this
var value = e.detail.value[0]
var themeId = e.target.dataset.id
var dataId = e.target.dataset.parentId
var selectItem = that.lgGetThemeItemById(dataId, themeId)
var dataItem = that.lgGetDataItemById(dataId)
selectItem.selected = !selectItem.selected
console.log(selectItem)
wx.hideNavigationBarLoading()
},
onThemeInfo : function(e){ //详情
var themeId = e.target.dataset.id
wx.navigateTo({
url: '../work-info/work-info?id='+themeId
})
},
lgGetDataList : function(){ //逻辑处理
var that = this
return that.data.dataList
},
lgGetDataItemById : function(id){
var that = this
var dataList = that.lgGetDataList()
var i = 0 , len = dataList.length
var retItem = null
for(; i < len; ++i){
var item = dataList[i]
if(id == item.id){
retItem = item
break
}
}
return retItem
},
lgGetThemes : function(dataId){
var that = this
return that.lgGetDataItemById(dataId).themes
},
lgGetThemeItemById : function(dataId, themeId){
var that = this
var themes = that.lgGetThemes(dataId)
console.log(themes)
var i = 0, len = themes.length
var retItem = null
for(; i < len; ++i){
var item = themes[i]
if(themeId == item.id){
retItem = item
break
}
}
return retItem
}
})
|