123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- let Parse = getApp().Parse;
- const company = getApp().globalData.company
- Page({
-
- data: {
- department: []
- },
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- async getDepartment() {
- let Department = new Parse.Query('Department')
- Department.equalTo('company', company)
- Department.notEqualTo('isDeleted', "true")
-
- Department.limit(3)
- let department = await Department.find()
- if (department && department.length > 0) {
- let listJSON = []
- department.forEach(c => {
- let dJSON = c.toJSON()
- let imageExtend = [
- "png", "jpg", "jpeg", "ico", "gif", "JPG", "PNG", "JPEG", "ICO", "GIF"
- ]
- let videoExtend = [
- "mp4", "flv", "avi", "MP4", "FLV", "AIV"
- ]
- let nameArray = dJSON.logo ? dJSON.logo.split(".") : ''
- let extend = nameArray.length > 0 ? nameArray[nameArray.length - 1] : ""
- let logoType
- if (imageExtend.indexOf(extend) > -1) {
- logoType = "image"
- }
- if (videoExtend.indexOf(extend) > -1) {
- logoType = "video"
- }
- dJSON.logoType = logoType
- listJSON.push(dJSON)
- })
- this.setData({
- department: listJSON
- })
- }
- console.log(this.data.department);
- },
- villagedetails(e) {
- let id = e.currentTarget.dataset.item.objectId
- console.log(id);
- wx.navigateTo({
- url: '/nova-tourism/pages/home/village/village-details/index?id=' + id
- });
- },
-
- onLoad: function(options) {
- this.getDepartment()
- },
-
- onReady: function() {
- },
-
- onShow: function() {
- },
-
- onHide: function() {
- },
-
- onUnload: function() {
- },
-
- onPullDownRefresh: function() {
- },
-
- onReachBottom: function() {
- },
-
- onShareAppMessage: function() {
- }
- })
|