...
|
...
|
@@ -27,8 +27,10 @@ Page({ |
|
|
open_time: '',
|
|
|
temp_time2: '',
|
|
|
temp_time: '',
|
|
|
list_id:0,
|
|
|
|
|
|
list_id: 0,
|
|
|
imgsUrl: [],
|
|
|
open: 1,
|
|
|
more_info: '公开',
|
|
|
},
|
|
|
|
|
|
setTitle(e) {
|
...
|
...
|
@@ -71,7 +73,6 @@ Page({ |
|
|
var tempUrl = this.data.tempUrl
|
|
|
var imgInfo = this.data.imgInfo
|
|
|
images[index].text = imgInfo
|
|
|
console.log(images)
|
|
|
this.setData({
|
|
|
img_state: false,
|
|
|
images: images
|
...
|
...
|
@@ -88,11 +89,11 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
|
|
|
getStyleId(){
|
|
|
getStyleId() {
|
|
|
var styles = this.data.styles
|
|
|
var classify = this.data.classify
|
|
|
for(var i=0;i<classify;i++){
|
|
|
if(classify[i].state){
|
|
|
for (var i = 0; i < classify; i++) {
|
|
|
if (classify[i].state) {
|
|
|
styles.push(classify[i].id)
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -190,11 +191,18 @@ Page({ |
|
|
var lastMonth = this.data.lastMonth
|
|
|
var currentTime = this.data.currentTime
|
|
|
var time = lastMonth[currentTime]
|
|
|
var time2 = lastMonth[currentTime]
|
|
|
var temp_time = this.data.temp_time
|
|
|
if (currentTime == 0) {
|
|
|
time2 = '今天'
|
|
|
} else if (currentTime == 1) {
|
|
|
time2 = '明天'
|
|
|
}
|
|
|
var open_time = time + ' ' + temp_time
|
|
|
console.log(open_time)
|
|
|
var open_time2 = time2 + ' ' + temp_time
|
|
|
this.setData({
|
|
|
open_time: open_time
|
|
|
open_time: open_time,
|
|
|
time_info: open_time2
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -248,10 +256,16 @@ Page({ |
|
|
//服务器返回格式: { "Catalog": "testFolder", "FileName": "1.jpg", "Url": "https://test.com/1.jpg" }
|
|
|
let images = that.data.images;
|
|
|
images.push(data.data);
|
|
|
var imgsUrl = []
|
|
|
for (var i in images) {
|
|
|
var tempImg = {}
|
|
|
tempImg.url = images[i].url
|
|
|
imgsUrl.push(tempImg)
|
|
|
}
|
|
|
that.setData({
|
|
|
images: images
|
|
|
images: imgsUrl
|
|
|
});
|
|
|
console.log(images)
|
|
|
|
|
|
//如果是最后一张,则隐藏等待中
|
|
|
if (uploadImgCount == tempFilePaths.length) {
|
|
|
wx.hideToast();
|
...
|
...
|
@@ -325,9 +339,20 @@ Page({ |
|
|
wx.showToast({
|
|
|
title: '设置成功',
|
|
|
})
|
|
|
var more_info = this.data.more_info
|
|
|
if (e.currentTarget.dataset.open == 1) {
|
|
|
more_info = '公开'
|
|
|
} else if (e.currentTarget.dataset.open == 2) {
|
|
|
more_info = '粉丝可见'
|
|
|
} else if (e.currentTarget.dataset.open == 3) {
|
|
|
more_info = '仅自己可见'
|
|
|
} else if (e.currentTarget.dataset.open == 4) {
|
|
|
more_info = '草稿箱'
|
|
|
}
|
|
|
this.setData({
|
|
|
open: e.currentTarget.dataset.open,
|
|
|
more_state:false
|
|
|
more_state: false,
|
|
|
more_info: more_info
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -363,15 +388,80 @@ Page({ |
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res)
|
|
|
if (res.data.code == 20000) {
|
|
|
wx.showToast({
|
|
|
title: '提交成功',
|
|
|
})
|
|
|
setTimeout((res) => {
|
|
|
wx.navigateBack({
|
|
|
dalta:1
|
|
|
dalta: 1
|
|
|
})
|
|
|
}, 1000)
|
|
|
} else {
|
|
|
wx.showToast({
|
|
|
title: res.data.msg,
|
|
|
icon: 'none'
|
|
|
})
|
|
|
}
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
|
|
getData() {
|
|
|
let url = '/home/index/draftsEdit'
|
|
|
let params = {
|
|
|
list_id: this.data.list_id,
|
|
|
}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token'),
|
|
|
'XX-Device-Type': 'wxapp'
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res)
|
|
|
var open = res.data.data.open
|
|
|
var more_info = this.data.more_info
|
|
|
if (open == 1) {
|
|
|
more_info = '公开'
|
|
|
} else if (open == 2) {
|
|
|
more_info = '粉丝可见'
|
|
|
} else if (open == 3) {
|
|
|
more_info = '仅自己可见'
|
|
|
} else if (open == 4) {
|
|
|
more_info = '草稿箱'
|
|
|
}
|
|
|
var classify = this.data.classify
|
|
|
var styles = res.data.data.styles
|
|
|
for (var i in classify) {
|
|
|
for (var j in styles) {
|
|
|
if (classify[i].id == styles[j]) {
|
|
|
classify[i].state = true
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var images = res.data.data.img
|
|
|
var imgsUrl = []
|
|
|
for (var i in images) {
|
|
|
var tempImg = {}
|
|
|
tempImg.url = images[i].url
|
|
|
tempImg.text = images[i].text
|
|
|
imgsUrl.push(tempImg)
|
|
|
}
|
|
|
// console.log(imgsUrl)
|
|
|
if (res.data.code == 20000) {
|
|
|
this.setData({
|
|
|
title: res.data.data.title,
|
|
|
text: res.data.data.text,
|
|
|
open: open,
|
|
|
more_info: more_info,
|
|
|
time_info: res.data.data.open_time,
|
|
|
open_time: res.data.data.open_time,
|
|
|
images: imgsUrl,
|
|
|
classify: classify,
|
|
|
styles: styles
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -380,6 +470,12 @@ Page({ |
|
|
onLoad: function(options) {
|
|
|
this.getStyle()
|
|
|
this.getTime()
|
|
|
this.setData({
|
|
|
list_id: options.id ? options.id : ''
|
|
|
})
|
|
|
if (options.id != 0) {
|
|
|
this.getData()
|
|
|
}
|
|
|
},
|
|
|
|
|
|
/**
|
...
|
...
|
|