...
|
...
|
@@ -14,7 +14,7 @@ Page({ |
|
|
style_array: ['时尚', '学院', '欧美风'],
|
|
|
style_index: -1,
|
|
|
height_array: [
|
|
|
'150cm-153cm', '153cm-156cm', '156cm-159cm', '159cm-162cm', '162cm-165cm', '165cm-168cm', '168cm-171cm', '171cm-174cm', '174cm-177cm', '174cm-177cm', '177cm-180cm', '180cm-183cm', '183cm-186cm', '186cm-189cm', '192cm-195cm', '195cm-198cm',
|
|
|
'150cm-153cm', '153cm-156cm', '156cm-159cm', '159cm-162cm', '162cm-165cm', '165cm-168cm', '168cm-171cm', '171cm-174cm', '174cm-177cm', '177cm-180cm', '180cm-183cm', '183cm-186cm', '186cm-190cm',
|
|
|
],
|
|
|
height_index: -1,
|
|
|
weight_array: [
|
...
|
...
|
@@ -27,7 +27,6 @@ Page({ |
|
|
stature: '',
|
|
|
weight: '',
|
|
|
status: 0,
|
|
|
|
|
|
order: 1,
|
|
|
poster_list: [],
|
|
|
img_state: false,
|
...
|
...
|
@@ -37,12 +36,8 @@ Page({ |
|
|
list: [],
|
|
|
list2: [],
|
|
|
last_page: '',
|
|
|
|
|
|
// https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534766809331&di=012cc4ad15d457ffa55c6537503eb84a&imgtype=0&src=http%3A%2F%2Fpicture.5068.com%2Fallimg%2F121120%2F4-1211201G920.jpg
|
|
|
cardPath: '',
|
|
|
headPath: '',
|
|
|
// https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1534765039080&di=1e81a596bc89cd54db55c0dbc7c4bb87&imgtype=0&src=http%3A%2F%2Fimg3.100bt.com%2Fupload%2Fttq%2F20140529%2F1401337844678_middle.png
|
|
|
sendName: ''
|
|
|
state: true,
|
|
|
tempHeight: ''
|
|
|
},
|
|
|
|
|
|
saveImg(e) {
|
...
|
...
|
@@ -108,39 +103,56 @@ Page({ |
|
|
return false
|
|
|
} else {
|
|
|
this.setData({
|
|
|
order: current
|
|
|
order: current,
|
|
|
page: 1,
|
|
|
list: []
|
|
|
})
|
|
|
}
|
|
|
this.getData()
|
|
|
},
|
|
|
|
|
|
//点击关注
|
|
|
attention(e) {
|
|
|
var status = this.data.status
|
|
|
showMask(e) {
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var id = e.currentTarget.dataset.id
|
|
|
var list = this.data.list
|
|
|
var status = this.data.status
|
|
|
var host = e.currentTarget.dataset.host
|
|
|
if (list[index].user_host == 1) {
|
|
|
list[index].user_host = 0
|
|
|
status = 2
|
|
|
} else {
|
|
|
list[index].user_host = 1
|
|
|
status = 1
|
|
|
}
|
|
|
this.attentionInfo(id, status)
|
|
|
this.setData({
|
|
|
status: status,
|
|
|
list: list
|
|
|
})
|
|
|
wx.setStorageSync('id', id)
|
|
|
wx.setStorageSync('status', status)
|
|
|
wx.setStorageSync('index', index)
|
|
|
if (host == 1) {
|
|
|
this.setData({
|
|
|
mask_state: true,
|
|
|
})
|
|
|
} else {
|
|
|
this.attentionInfo()
|
|
|
}
|
|
|
},
|
|
|
|
|
|
cancleMask() {
|
|
|
this.setData({
|
|
|
mask_state: false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//关注接口
|
|
|
attentionInfo(id, status) {
|
|
|
let that = this;
|
|
|
attentionInfo() {
|
|
|
var id = wx.getStorageSync('id')
|
|
|
var status = parseInt(wx.getStorageSync('status'))
|
|
|
var list = this.data.list
|
|
|
var index = wx.getStorageSync('index')
|
|
|
var that = this
|
|
|
let url = '/home/index/host';
|
|
|
let param = {
|
|
|
open_user_id: id,
|
|
|
status: status
|
|
|
status: status,
|
|
|
}
|
|
|
let header = {
|
|
|
'XX-Token': wx.getStorageSync('token'),
|
...
|
...
|
@@ -148,16 +160,27 @@ Page({ |
|
|
}
|
|
|
app.post(url, param, header).then((res) => {
|
|
|
if (res.data.code == 20000) {
|
|
|
this.getData()
|
|
|
status == 1 ? list[index].user_host = 1 : list[index].user_host = 2
|
|
|
console.log(status)
|
|
|
that.setData({
|
|
|
status: status,
|
|
|
list: list
|
|
|
})
|
|
|
that.setData({
|
|
|
list: [],
|
|
|
page: 1,
|
|
|
})
|
|
|
that.getData()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//点赞
|
|
|
likeCharge(e) {
|
|
|
var that = this
|
|
|
var id = e.currentTarget.dataset.id
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var list = this.data.list
|
|
|
var list = that.data.list
|
|
|
var status = ''
|
|
|
if (list[index].user_support == 1) {
|
|
|
list[index].user_support = 0
|
...
|
...
|
@@ -166,14 +189,14 @@ Page({ |
|
|
list[index].user_support = 1
|
|
|
status = 1
|
|
|
}
|
|
|
this.setData({
|
|
|
that.setData({
|
|
|
list: list
|
|
|
})
|
|
|
this.like(id, status)
|
|
|
// this.getData()
|
|
|
that.like(id, status)
|
|
|
},
|
|
|
|
|
|
like(id, status) {
|
|
|
var that = this
|
|
|
let url = '/home/index/support'
|
|
|
let params = {
|
|
|
list_id: id,
|
...
|
...
|
@@ -185,7 +208,12 @@ Page({ |
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
if (res.data.code == 20000) {
|
|
|
this.getData()
|
|
|
var page = parseInt(this.data.page)-1
|
|
|
that.setData({
|
|
|
list: [],
|
|
|
page: page,
|
|
|
})
|
|
|
that.getData()
|
|
|
}
|
|
|
})
|
|
|
},
|
...
|
...
|
@@ -222,6 +250,10 @@ Page({ |
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log(res)
|
|
|
if (res.data.code == 20000) {
|
|
|
this.setData({
|
|
|
list: [],
|
|
|
page: 1,
|
|
|
})
|
|
|
this.getData()
|
|
|
}
|
|
|
})
|
...
|
...
|
@@ -234,13 +266,7 @@ Page({ |
|
|
wx.navigateTo({
|
|
|
url: '/pages/index/comment/comment?id=' + id + '&type=' + type,
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//事件处理函数
|
|
|
bindViewTap: function() {
|
|
|
wx.navigateTo({
|
|
|
url: '../logs/logs'
|
|
|
})
|
|
|
},
|
|
|
|
|
|
showClassify() {
|
...
|
...
|
@@ -248,6 +274,21 @@ Page({ |
|
|
classify_state: !(this.data.classify_state)
|
|
|
})
|
|
|
},
|
|
|
cancleClassify() {
|
|
|
this.setData({
|
|
|
classify_state: false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
showMore(e) {
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var list = this.data.list
|
|
|
list[index].more_state = !(list[index].more_state)
|
|
|
this.setData({
|
|
|
more_state: !(this.data.more_state),
|
|
|
list: list
|
|
|
})
|
|
|
},
|
|
|
|
|
|
showPoster(e) {
|
|
|
var id = e.currentTarget.dataset.id
|
...
|
...
|
@@ -257,11 +298,9 @@ Page({ |
|
|
title: '加载中',
|
|
|
icon: 'loading'
|
|
|
})
|
|
|
// setTimeout(function() {
|
|
|
that.setData({
|
|
|
poster_state: true
|
|
|
})
|
|
|
// }, 2000)
|
|
|
this.getPoster(id)
|
|
|
},
|
|
|
|
...
|
...
|
@@ -277,7 +316,6 @@ Page({ |
|
|
wx.showTabBar({})
|
|
|
},
|
|
|
|
|
|
|
|
|
getPoster(id) {
|
|
|
let that = this;
|
|
|
let url = '/home/index/fashionShare';
|
...
|
...
|
@@ -292,27 +330,30 @@ Page({ |
|
|
console.log(res)
|
|
|
|
|
|
if (res.data.code == 20000) {
|
|
|
this.setData({
|
|
|
that.setData({
|
|
|
poster: res.data.data.url,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
})
|
|
|
},
|
|
|
that.setData({
|
|
|
state: true
|
|
|
})
|
|
|
} else if (res.data.code == 30001) {
|
|
|
wx.showToast({
|
|
|
title: '上传图片才可生成海报',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
setTimeout(function() {
|
|
|
that.setData({
|
|
|
poster_state: false
|
|
|
})
|
|
|
wx.showTabBar({
|
|
|
|
|
|
cancleClassify() {
|
|
|
this.setData({
|
|
|
classify_state: false
|
|
|
})
|
|
|
},
|
|
|
})
|
|
|
}, 2000)
|
|
|
that.setData({
|
|
|
state: false
|
|
|
})
|
|
|
}
|
|
|
|
|
|
showMore(e) {
|
|
|
var index = e.currentTarget.dataset.index
|
|
|
var list = this.data.list
|
|
|
list[index].more_state = !(list[index].more_state)
|
|
|
this.setData({
|
|
|
more_state: !(this.data.more_state),
|
|
|
list: list
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -338,9 +379,16 @@ Page({ |
|
|
},
|
|
|
|
|
|
releaseInfo() {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/index/release/release',
|
|
|
})
|
|
|
if (this.data.tempHeight == '') {
|
|
|
wx.showToast({
|
|
|
title: '请去完善身份信息',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
} else {
|
|
|
wx.navigateTo({
|
|
|
url: '/pages/index/release/release',
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
|
|
|
//设置查询的关键词
|
...
|
...
|
@@ -442,22 +490,14 @@ Page({ |
|
|
console.log('data', res)
|
|
|
if (res.data.code == 20000) {
|
|
|
var list = this.data.list
|
|
|
console.log(list, '33')
|
|
|
console.log(list.concat(res.data.data.list))
|
|
|
// list2.concat(res.data.data.list)
|
|
|
// var list = list2
|
|
|
// for (var i = 0; i < list.length; i++) {
|
|
|
// list[i].more_state = false
|
|
|
// }
|
|
|
|
|
|
|
|
|
if (res.data.data.list != '') {
|
|
|
console.log(that.data.list2)
|
|
|
that.setData({
|
|
|
list: list.concat(res.data.data.list),
|
|
|
last_page: res.data.data.last_page,
|
|
|
})
|
|
|
console.log('list', that.data.list)
|
|
|
} else if (this.data.page > res.data.data.last_page) {
|
|
|
wx.showToast({
|
|
|
title: '没有更多数据了',
|
...
|
...
|
@@ -477,107 +517,43 @@ Page({ |
|
|
}).catch((errMsg) => {})
|
|
|
},
|
|
|
|
|
|
//画图
|
|
|
drawCanvas: function() {
|
|
|
console.log(this.data.cardPath, 'aa')
|
|
|
this.setData({
|
|
|
cardPath: this.data.cardPath,
|
|
|
headPath: this.data.headPath,
|
|
|
sendName: this.data.sendName
|
|
|
});
|
|
|
let ctx = wx.createCanvasContext('myCanvas');
|
|
|
let ctxW = this.data.windowWidth;
|
|
|
let ctxH = 1210;
|
|
|
|
|
|
// 默认像素比
|
|
|
let pixelRatio = this.data.pixelRatio;
|
|
|
// 垂直渐变
|
|
|
const grd = ctx.createLinearGradient(0, 0, 0, ctxH);
|
|
|
grd.addColorStop(0, '#ffffff');
|
|
|
grd.addColorStop(1, '#ffffff');
|
|
|
ctx.setFillStyle(grd);
|
|
|
ctx.fillRect(0, 0, ctxW, ctxH);
|
|
|
|
|
|
wx.getImageInfo({
|
|
|
src: this.data.cardPath,
|
|
|
success: (res) => {
|
|
|
console.log('canvas', res)
|
|
|
ctx.drawImage(res.path, 15, 15, 345, 470); //card
|
|
|
wx.getImageInfo({
|
|
|
src: this.data.headPath,
|
|
|
success: (res) => {
|
|
|
/**/
|
|
|
ctx.arc(46, 358, 25, 0, 2 * Math.PI)
|
|
|
ctx.fill()
|
|
|
ctx.save();
|
|
|
ctx.beginPath(); //开始绘制
|
|
|
ctx.clip(); //剪切
|
|
|
ctx.drawImage(res.path, 23, 333, 50, 50); //userHeader // 推进去图片必须是https
|
|
|
ctx.restore(); //恢复之前保存的绘图上下文 继续绘制
|
|
|
/**/
|
|
|
ctx.setTextAlign('left');
|
|
|
ctx.setTextBaseline('middle');
|
|
|
ctx.setFontSize(16);
|
|
|
ctx.setFillStyle('#fff');
|
|
|
this.fontLineFeed(ctx, this.data.sendName, 450, 30, 79, 328);
|
|
|
ctx.stroke();
|
|
|
ctx.draw();
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 保存图片
|
|
|
saveImage: function(e) {
|
|
|
wx.canvasToTempFilePath({
|
|
|
canvasId: 'myCanvas',
|
|
|
success: function(res) {
|
|
|
wx.saveImageToPhotosAlbum({
|
|
|
filePath: res.tempFilePath,
|
|
|
success(result) {
|
|
|
wx.showToast({
|
|
|
title: '图片保存成功',
|
|
|
icon: 'success',
|
|
|
duration: 2000
|
|
|
})
|
|
|
}
|
|
|
getUserInfo() {
|
|
|
let url = '/home/index/userLook'
|
|
|
let params = {}
|
|
|
let header = {
|
|
|
"XX-Token": wx.getStorageSync('token'),
|
|
|
'XX-Device-Type': 'wxapp'
|
|
|
}
|
|
|
app.post(url, params, header).then((res) => {
|
|
|
console.log('userinfo', res)
|
|
|
if (res.data.code == 20000) {
|
|
|
this.setData({
|
|
|
// avatar: res.data.data.avatar,
|
|
|
// birthday: birthday,
|
|
|
// constellation: res.data.data.constellation,
|
|
|
// sex_index: sex_index,
|
|
|
// signature: res.data.data.signature,
|
|
|
tempHeight: res.data.data.stature,
|
|
|
// user_name: res.data.data.user_nickname,
|
|
|
// weight: res.data.data.weight,
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
// 文字换行
|
|
|
fontLineFeed: function(ctx, str, splitLen, strHeight, x, y) {
|
|
|
let strArr = [];
|
|
|
for (let i = 0, len = str.length / splitLen; i < len; i++) {
|
|
|
strArr.push(str.substring(i * splitLen, i * splitLen + splitLen));
|
|
|
}
|
|
|
let s = 0;
|
|
|
for (let j = 0, len = strArr.length; j < len; j++) {
|
|
|
s = s + strHeight;
|
|
|
ctx.fillText(strArr[j], x, y + s);
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
onLoad: function() {
|
|
|
this.getData()
|
|
|
// this.getData()
|
|
|
this.getStyle()
|
|
|
var that = this;
|
|
|
wx: wx.getSystemInfo({
|
|
|
success: function(res) {
|
|
|
that.setData({
|
|
|
pixelRatio: res.pixelRatio,
|
|
|
windowWidth: res.windowWidth,
|
|
|
windowHeight: res.windowHeight
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
that.drawCanvas();
|
|
|
this.getUserInfo()
|
|
|
},
|
|
|
|
|
|
onShow() {
|
|
|
// this.getData()
|
|
|
this.setData({
|
|
|
list: [],
|
|
|
page: 1
|
|
|
})
|
|
|
this.getData()
|
|
|
},
|
|
|
|
|
|
onReachBottom: function() {
|
...
|
...
|
|