|
|
|
@ -5,7 +5,6 @@ import {
|
|
|
|
|
lookup
|
|
|
|
|
} from '../../../../utils/util'
|
|
|
|
|
Page({
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 页面的初始数据
|
|
|
|
|
*/
|
|
|
|
@ -34,23 +33,23 @@ Page({
|
|
|
|
|
rank: [{
|
|
|
|
|
name: '全部日期',
|
|
|
|
|
is: true,
|
|
|
|
|
month:''
|
|
|
|
|
month: ''
|
|
|
|
|
}, {
|
|
|
|
|
name: '一个月内',
|
|
|
|
|
is: false,
|
|
|
|
|
month:1
|
|
|
|
|
month: 1
|
|
|
|
|
}, {
|
|
|
|
|
name: '三个月内',
|
|
|
|
|
is: false,
|
|
|
|
|
month:3
|
|
|
|
|
month: 3
|
|
|
|
|
}, {
|
|
|
|
|
name: '半年内',
|
|
|
|
|
is: false,
|
|
|
|
|
month:6
|
|
|
|
|
month: 6
|
|
|
|
|
}, {
|
|
|
|
|
name: '一年内',
|
|
|
|
|
is: false,
|
|
|
|
|
month:12
|
|
|
|
|
month: 12
|
|
|
|
|
}]
|
|
|
|
|
}, {
|
|
|
|
|
id: 2,
|
|
|
|
@ -69,13 +68,14 @@ Page({
|
|
|
|
|
id: null,
|
|
|
|
|
listdata: [],
|
|
|
|
|
cdn: getApp().globalData.cdn,
|
|
|
|
|
max: 1,
|
|
|
|
|
max: 0,
|
|
|
|
|
page: 1,
|
|
|
|
|
month: '',
|
|
|
|
|
tagIdList: [],
|
|
|
|
|
brandIdList: [],
|
|
|
|
|
keyword: '',
|
|
|
|
|
cdn: getApp().globalData.cdn
|
|
|
|
|
cdn: getApp().globalData.cdn,
|
|
|
|
|
flag: true
|
|
|
|
|
},
|
|
|
|
|
/**
|
|
|
|
|
* 生命周期函数--监听页面加载
|
|
|
|
@ -130,32 +130,27 @@ Page({
|
|
|
|
|
groupId: Number(this.data.id),
|
|
|
|
|
pageNum: this.data.page,
|
|
|
|
|
month: this.data.month,
|
|
|
|
|
tagIdList: this.data.tagIdList[0]?this.data.tagIdList:[],
|
|
|
|
|
brandIdList: this.data.brandIdList[0]?this.data.brandIdList:[],
|
|
|
|
|
keyword: this.data.keyword
|
|
|
|
|
tagIdList: this.data.tagIdList[0] ? this.data.tagIdList : [],
|
|
|
|
|
brandIdList: this.data.brandIdList[0] ? this.data.brandIdList : [],
|
|
|
|
|
keyword: this.data.keyword,
|
|
|
|
|
}).then(res => {
|
|
|
|
|
let arr = res.data.records
|
|
|
|
|
for (let index = 0; index < arr.length; index++) {
|
|
|
|
|
arr[index].all = false
|
|
|
|
|
arr[index].referenceList.forEach(el=>{
|
|
|
|
|
el.choose = false
|
|
|
|
|
el.father = index
|
|
|
|
|
let arr = []
|
|
|
|
|
res.data.records.forEach(el => {
|
|
|
|
|
el.referenceList.forEach(e => {
|
|
|
|
|
arr.push(e)
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
flag: false
|
|
|
|
|
})
|
|
|
|
|
this.setData({
|
|
|
|
|
listdata: arr
|
|
|
|
|
listdata: arr,
|
|
|
|
|
max: res.data.pages,
|
|
|
|
|
flag: true
|
|
|
|
|
})
|
|
|
|
|
// this.selectComponent("#pic").loadData()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
to(e) {
|
|
|
|
|
if (this.data.choose) {} else {
|
|
|
|
|
// wx.navigateTo({
|
|
|
|
|
// url: e.currentTarget.dataset.url,
|
|
|
|
|
// })
|
|
|
|
|
lookup(e.currentTarget.dataset.item)
|
|
|
|
|
}
|
|
|
|
|
// lookup(e.currentTarget.dataset.item)
|
|
|
|
|
},
|
|
|
|
|
// 点击菜单栏触发的事件函数
|
|
|
|
|
handleClick: function (e) {
|
|
|
|
|
const index = e.currentTarget.dataset.id;
|
|
|
|
@ -228,25 +223,25 @@ Page({
|
|
|
|
|
navItem,
|
|
|
|
|
selectedItem
|
|
|
|
|
})
|
|
|
|
|
this.data.selectItem[1].rank.forEach(el=>{
|
|
|
|
|
this.data.selectItem[1].rank.forEach(el => {
|
|
|
|
|
// console.log(el)
|
|
|
|
|
if(el.is){
|
|
|
|
|
if (el.is) {
|
|
|
|
|
this.setData({
|
|
|
|
|
month: el.month
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.data.selectItem[0].rank.forEach(el=>{
|
|
|
|
|
this.data.selectItem[0].rank.forEach(el => {
|
|
|
|
|
// console.log(el)
|
|
|
|
|
if(el.is){
|
|
|
|
|
if (el.is) {
|
|
|
|
|
this.setData({
|
|
|
|
|
'tagIdList[0]': el.id
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
this.data.selectItem[2].rank.forEach(el=>{
|
|
|
|
|
this.data.selectItem[2].rank.forEach(el => {
|
|
|
|
|
// console.log(el)
|
|
|
|
|
if(el.is){
|
|
|
|
|
if (el.is) {
|
|
|
|
|
this.setData({
|
|
|
|
|
'brandIdList[0]': el.id
|
|
|
|
|
})
|
|
|
|
@ -259,13 +254,13 @@ Page({
|
|
|
|
|
})
|
|
|
|
|
this.getdata()
|
|
|
|
|
},
|
|
|
|
|
handleSearch(e){
|
|
|
|
|
handleSearch(e) {
|
|
|
|
|
console.log(e)
|
|
|
|
|
this.setData({
|
|
|
|
|
keyword: e.detail,
|
|
|
|
|
listdata: [],
|
|
|
|
|
max:1,
|
|
|
|
|
page:1
|
|
|
|
|
max: 1,
|
|
|
|
|
page: 1
|
|
|
|
|
})
|
|
|
|
|
this.getdata()
|
|
|
|
|
},
|
|
|
|
@ -280,13 +275,12 @@ Page({
|
|
|
|
|
let c = 'listdata[' + a + '].referenceList[' + b + '].choose'
|
|
|
|
|
// console.log(e.currentTarget.dataset.data)
|
|
|
|
|
this.setData({
|
|
|
|
|
[c] : !this.data.listdata[a].referenceList[b].choose
|
|
|
|
|
[c]: !this.data.listdata[a].referenceList[b].choose
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
let flag = true
|
|
|
|
|
for (let i = 0; i < this.data.listdata[a].referenceList.length; i++) {
|
|
|
|
|
if (this.data.listdata[a].referenceList[i].choose) {
|
|
|
|
|
} else {
|
|
|
|
|
if (this.data.listdata[a].referenceList[i].choose) {} else {
|
|
|
|
|
flag = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -318,19 +312,19 @@ Page({
|
|
|
|
|
batch() {
|
|
|
|
|
let arr = []
|
|
|
|
|
this.data.listdata.forEach(el => {
|
|
|
|
|
el.referenceList.forEach(e=> {
|
|
|
|
|
el.referenceList.forEach(e => {
|
|
|
|
|
// console.log(e.choose)
|
|
|
|
|
if(e.choose){
|
|
|
|
|
if (e.choose) {
|
|
|
|
|
arr.push(e)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
return arr
|
|
|
|
|
},
|
|
|
|
|
add () {
|
|
|
|
|
add() {
|
|
|
|
|
let arr = this.batch()
|
|
|
|
|
let b = []
|
|
|
|
|
arr.forEach(el=>{
|
|
|
|
|
arr.forEach(el => {
|
|
|
|
|
b.push(el.id)
|
|
|
|
|
})
|
|
|
|
|
if (b.length === 0) {
|
|
|
|
@ -338,8 +332,8 @@ Page({
|
|
|
|
|
title: '请选择',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 1000
|
|
|
|
|
})
|
|
|
|
|
return 0
|
|
|
|
|
})
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
http("/userReference/addGroup", "post", {
|
|
|
|
|
referenceIdList: b
|
|
|
|
@ -349,7 +343,7 @@ Page({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (re.code === 200){
|
|
|
|
|
if (re.code === 200) {
|
|
|
|
|
this.setData({
|
|
|
|
|
listdata: [],
|
|
|
|
|
page: 1
|
|
|
|
@ -359,10 +353,10 @@ Page({
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
del () {
|
|
|
|
|
del() {
|
|
|
|
|
let arr = this.batch()
|
|
|
|
|
let b = []
|
|
|
|
|
arr.forEach(el=>{
|
|
|
|
|
arr.forEach(el => {
|
|
|
|
|
b.push(el.id)
|
|
|
|
|
})
|
|
|
|
|
if (b.length === 0) {
|
|
|
|
@ -370,8 +364,8 @@ Page({
|
|
|
|
|
title: '请选择',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 1000
|
|
|
|
|
})
|
|
|
|
|
return 0
|
|
|
|
|
})
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
http("/userReference/delGroup", "post", {
|
|
|
|
|
referenceIdList: b
|
|
|
|
@ -381,7 +375,7 @@ Page({
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 2000
|
|
|
|
|
}).then(res => {
|
|
|
|
|
if (re.code === 200){
|
|
|
|
|
if (re.code === 200) {
|
|
|
|
|
this.setData({
|
|
|
|
|
listdata: [],
|
|
|
|
|
page: 1
|
|
|
|
@ -391,10 +385,10 @@ Page({
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
batchdown(){
|
|
|
|
|
batchdown() {
|
|
|
|
|
let arr = this.batch()
|
|
|
|
|
let b = []
|
|
|
|
|
arr.forEach(el=>{
|
|
|
|
|
arr.forEach(el => {
|
|
|
|
|
b.push(el.fileUrl)
|
|
|
|
|
})
|
|
|
|
|
if (b.length === 0) {
|
|
|
|
@ -402,14 +396,14 @@ Page({
|
|
|
|
|
title: '请选择',
|
|
|
|
|
icon: 'none',
|
|
|
|
|
duration: 1000
|
|
|
|
|
})
|
|
|
|
|
return 0
|
|
|
|
|
})
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
b.forEach(el=>{
|
|
|
|
|
b.forEach(el => {
|
|
|
|
|
this.downloadfile(el)
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
downloadfile(url){
|
|
|
|
|
downloadfile(url) {
|
|
|
|
|
wx.showLoading({
|
|
|
|
|
title: '正在下载',
|
|
|
|
|
mask: true
|
|
|
|
@ -417,7 +411,7 @@ Page({
|
|
|
|
|
console.log(this.data.cdn + url)
|
|
|
|
|
//下载文件,生成临时地址
|
|
|
|
|
wx.downloadFile({
|
|
|
|
|
url: this.data.cdn + url,
|
|
|
|
|
url: this.data.cdn + url,
|
|
|
|
|
success(res) {
|
|
|
|
|
console.log(res)
|
|
|
|
|
//保存到本地
|
|
|
|
@ -425,12 +419,12 @@ Page({
|
|
|
|
|
tempFilePath: res.tempFilePath,
|
|
|
|
|
success: function (res) {
|
|
|
|
|
console.log(res)
|
|
|
|
|
console.log('保存到本地',res)
|
|
|
|
|
console.log('保存到本地', res)
|
|
|
|
|
wx.saveImageToPhotosAlbum({
|
|
|
|
|
filePath: res.savedFilePath,
|
|
|
|
|
complete(res){
|
|
|
|
|
complete(res) {
|
|
|
|
|
wx.hideLoading();
|
|
|
|
|
console.log('保存到相册',res)
|
|
|
|
|
console.log('保存到相册', res)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
@ -438,7 +432,7 @@ Page({
|
|
|
|
|
wx.hideLoading();
|
|
|
|
|
console.log('保存失败:', err)
|
|
|
|
|
},
|
|
|
|
|
complete(res){
|
|
|
|
|
complete(res) {
|
|
|
|
|
wx.hideLoading();
|
|
|
|
|
console.log(res)
|
|
|
|
|
}
|
|
|
|
@ -459,7 +453,7 @@ Page({
|
|
|
|
|
onShow() {
|
|
|
|
|
this.setData({
|
|
|
|
|
listdata: [],
|
|
|
|
|
page: 1
|
|
|
|
|
page: 1,
|
|
|
|
|
})
|
|
|
|
|
this.getdata()
|
|
|
|
|
},
|
|
|
|
@ -489,7 +483,7 @@ Page({
|
|
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
|
|
*/
|
|
|
|
|
onReachBottom() {
|
|
|
|
|
this.getdata()
|
|
|
|
|
this.getmore()
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|