作者 刘晓艳

整体接口对接

... ... @@ -5,7 +5,8 @@ Page({
* 页面的初始数据
*/
data: {
max: 100
max: 100,
index:'',
},
getText(e) {
... ... @@ -20,17 +21,23 @@ Page({
});
},
goCheck(){
goCheck(e){
wx.navigateTo({
url: '/pages/index/check/check',
url: '/pages/index/release/release?index='+this.data.index,
})
// wx.navigateTo({
// url: '/pages/index/check/check',
// })
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.setData({
index:options.index
})
},
/**
... ...
// pages/index/fans/fans.js
const app=getApp()
Page({
/**
* 页面的初始数据
*/
data: {
status:''
},
getData() {
let url = '/home/index/checkFans'
let params = {
status: this.data.status
}
let header = {
"XX-Token": wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res)
if (res.data.code == 20000) {
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
options.status?(this.getData()):''
},
/**
... ...
... ... @@ -31,10 +31,11 @@ Page({
order: 1,
poster_list: [],
cardPath: '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',
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: '文字描述描述文字'
// 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: ''
},
... ... @@ -229,10 +230,10 @@ Page({
console.log(res)
if (res.data.code == 20000) {
this.setData({
poster_list: res.data.data,
// cardPath: res.data.data.img,
// headPath: res.data.data.img,
// sendName: res.data.data.text,
// poster_list: res.data.data,
cardPath: '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',
headPath: res.data.data.img,
sendName: res.data.data.text,
})
}
})
... ... @@ -406,6 +407,7 @@ Page({
//画图
drawCanvas: function() {
console.log(this.data.cardPath,'aa')
this.setData({
cardPath: this.data.cardPath,
headPath: this.data.headPath,
... ...
... ... @@ -11,6 +11,8 @@ Page({
mask_state: false,
sex_array: ['男', '女'],
sex_index: -1,
birthday:'',
constellation: ['白羊座', '金牛座', '双子座', '巨蟹座', '狮子座', '处女座', '天秤座', '天蝎座', '射手座', '摩羯座', '水瓶座','双鱼座'],
},
//选择性别
... ... @@ -21,24 +23,27 @@ Page({
})
},
getText(e) {
var content = e.detail.value
var len = content.length
if (len > this.data.max) return;
setTime(e) {
this.setData({
current_num: len
birthday: e.detail.value
})
},
showMask() {
this.setData({
mask_state: true
})
},
cancleMak() {
this.setData({
mask_state: false
})
},
chooseImg() { //这里是选取图片的方法
var that = this;
wx.chooseImage({
... ... @@ -50,24 +55,20 @@ Page({
'XX-Device-Type': 'wxapp'
}
wx.uploadFile({
url: 'http://fashion.w.bronet.cn/api/user/upload/upload', //仅为示例,非真实的接口地址
url: 'http://fashion.w.bronet.cn/user/upload/upload', //仅为示例,非真实的接口地址
filePath: tempFilePaths[0],
name: 'picurl',
name: 'file',
header: header,
formData: {
// file
file: tempFilePaths[0]
},
success: function(res) {
console.log(res)
// var data = JSON.parse(res.data);
// var picurl = data.data.picurl;
// picurl = picurl.indexOf('http') != '-1' ? picurl : "http://" + picurl
// var list = that.data.list
// list.picurl = picurl
// that.setData({
// hasimg: picurl,
// list: list
// })
var data = JSON.parse(res.data)
var avatar = data.data.url;
that.setData({
avatar: avatar,
})
}
})
}
... ... @@ -85,11 +86,13 @@ Page({
console.log(res)
if (res.data.code == 20000) {
var sex = res.data.data.sex
var sex_index = this.data.sex_index
sex_index = sex - 1
this.setData({
avatar: res.data.data.avatar,
birthday: res.data.data.birthday,
constellation: res.data.data.constellation,
sex: sex,
sex_index: sex_index,
signature: res.data.data.signature,
stature: res.data.data.stature,
user_name: res.data.data.user_nickname,
... ...
... ... @@ -29,7 +29,7 @@
</view>
<view class='list_input'>
<picker class='chassify_picker' range='{{sex_array}}' value='{{sex_index}}' bindchange='setSex'>
<input placeholder='请选择' value='{{sex}}' disabled='true'></input>
<input placeholder='请选择' value='{{sex_array[sex_index]}}' disabled='true'></input>
</picker>
<view class='iconfont icon-fanhui'></view>
</view>
... ... @@ -39,8 +39,8 @@
<text>出生日期</text>
</view>
<view class='list_input'>
<picker mode='date' bindchange='selectTime'>
<input type='text' placeholder='未选择' name='end_time' value='{{end_time}}' disabled='true'></input>
<picker mode='date' bindchange='setTime'>
<input type='text' placeholder='未选择' value='{{birthday}}' disabled='true'></input>
</picker>
<view class='iconfont icon-fanhui'></view>
</view>
... ... @@ -58,7 +58,6 @@
</view>
</view>
<view class='content_item'>
<view class='item_list'>
<view class='list_title'>
<text>身高</text>
... ...
// pages/index/message/message.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
state:1
status: 1,
page: 1
},
readState(e) {
var status = e.currentTarget.dataset.status
this.setData({
state: status
status: status
})
if(status!=3){
this.getData()
}else{
this.getData2()
}
},
getData() {
let url = '/home/index/checkNews'
let params = {
status: this.data.status,
page: this.data.page
}
let header = {
"XX-Token": wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res)
if (res.data.code == 20000) {
this.setData({
current_page: res.data.data.list.current_page,
list: res.data.data.list.current_page,
last_page: res.data.data.list.last_page,
per_page: res.data.data.list.per_page,
total: res.data.data.list.total
})
}
})
},
getData2() {
let url = '/home/index/checkFashion'
let params = {
page: this.data.page
}
let header = {
"XX-Token": wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res)
if (res.data.code == 20000) {
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getData()
this.getData2()
},
/**
... ...
<!--pages/index/message/message.wxml-->
<view class='banner_box'>
<view class="label {{state==1?'active':''}}" bindtap='readState' data-status='1'>评论消息</view>
<view class="label {{state==2?'active':''}}" bindtap='readState' data-status='2'>点赞消息</view>
<view class="label {{state==3?'active':''}}" bindtap='readState' data-status='3'>审核消息</view>
<view class="label {{status==1?'active':''}}" bindtap='readState' data-status='1'>评论消息</view>
<view class="label {{status==2?'active':''}}" bindtap='readState' data-status='2'>点赞消息</view>
<view class="label {{status ==3?'active':''}}" bindtap='readState' data-status='3'>审核消息</view>
</view>
<view class='content_box'>
<view class='item_list'>
<view class='list_left'>
<image class='head_img' src='/images/img3.png'></image>
<view>
<view class='user_name'>Rose | ローズ</view>
<block wx:if='{{status==1}}'>
<view class='item_list'>
<view class='list_left'>
<image class='head_img' src='/images/img3.png'></image>
<view>
<text>评论了你的</text>
<text class='list_hint'>今日打卡</text>
<view class='user_name'>Rose | ローズ</view>
<view>
<text>评论了你的</text>
<text class='list_hint'>今日打卡</text>
</view>
</view>
</view>
<view class='point'></view>
</view>
<view class='point'></view>
</view>
<view class='item_list'>
<view class='list_left'>
<view>
<view class='user_name' style='font-weight:normal;'>
<text>Rose | ローズ您好,您发布的今日打卡审核</text>
<text class='list_hint2'>未通过</text>
</block>
<block wx:if='{{status==2}}'>
<view class='item_list'>
<view class='list_left'>
<image class='head_img' src='/images/img3.png'></image>
<view>
<view class='user_name'>Rose | ローズ</view>
<view>
<text>评论了你的</text>
<text class='list_hint'>今日打卡</text>
</view>
</view>
</view>
<view class='point'></view>
</view>
</block>
<block wx:if='{{status==3}}'>
<view class='item_list'>
<view class='list_left'>
<view>
<view class='user_name' style='font-weight:normal;'>
<text>Rose | ローズ您好,您发布的今日打卡审核</text>
<text class='list_hint2'>未通过</text>
</view>
<view>原因:发布内容有歧义</view>
<view>2018-11-22 14:00</view>
</view>
<view>原因:发布内容有歧义</view>
<view>2018-11-22 14:00</view>
</view>
</view>
</view>
</block>
</view>
\ No newline at end of file
... ...
// pages/index/release/release.js
const app=getApp()
Page({
/**
* 页面的初始数据
*/
... ... @@ -23,13 +23,16 @@ Page({
relsese_state: false
}, ],
more_state:false,
images:['/images/img3.png']
images:[],
styles:[],
title:'',
text:'',
},
getText(e) {
setTitle(e) {
var content = e.detail.value;
this.setData({
content: content
title: content
})
var len = parseInt(content.length);
if (len > this.data.max) return;
... ... @@ -37,22 +40,44 @@ Page({
currentWordNumber: len //当前字数
});
},
textContent(e) {
setText(e) {
var content = e.detail.value
var len = content.length
if (len > this.data.max2) return;
this.setData({
number: len
number: len,
text:content
})
},
//分类
setClassify(e) {
const self = this;
const current = e.currentTarget.dataset.index;
self.setData({
current: current
});
var index=e.currentTarget.dataset.index
var classify=this.data.classify
classify[index].state=!(classify[index].state)
this.setData({
classify:classify
})
},
getStyle() {
let that = this;
let url = '/home/index/styles';
let param = {}
app.post(url, param).then((res) => {
if (res.data.code == 20000) {
var classify = res.data.data.list
for(var i=0;i<classify.length;i++){
classify[i].state=false
}
that.setData({
classify: classify,
})
}
})
},
//选择发布时间
selectTime(e) {
const self = this;
... ... @@ -61,6 +86,7 @@ Page({
currentTime: current
});
},
//选择时间
setTime(e) {
const index = e.currentTarget.dataset.index;
... ... @@ -70,16 +96,19 @@ Page({
release_time2: release_time2
})
},
showMask() {
this.setData({
relsese_state: true
})
},
cancleMask() {
this.setData({
relsese_state: false
})
},
//上传图片
choose(e) { //这里是选取图片的方法
let that = this;
... ... @@ -95,11 +124,10 @@ Page({
mask: true,
duration: 10000
})
let token = wx.getStorageSync('token');
let uploadImgCount = 0;
for (let i = 0, h = tempFilePaths.length; i < h; i++) {
wx.uploadFile({
url: 'https://www.magipocket.com/api/home/home/upload',
url: 'http://fashion.w.bronet.cn/user/upload/upload',
filePath: tempFilePaths[i],
name: 'file',
formData: {
... ... @@ -107,22 +135,21 @@ Page({
},
header: {
'content-type': 'application/x-www-form-urlencoded',
'XX-Token': token,
'XX-Token': wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp',
},
success: function(res) {
console.log(res)
uploadImgCount++;
let data = JSON.parse(res.data);
// console.log('data',data);
if (data.code == 20000) {
//服务器返回格式: { "Catalog": "testFolder", "FileName": "1.jpg", "Url": "https://test.com/1.jpg" }
let images = that.data.images;
images.push(data.msg);
images.push(data.data);
that.setData({
images: images
});
// console.log(images)
console.log(images)
//如果是最后一张,则隐藏等待中
if (uploadImgCount == tempFilePaths.length) {
wx.hideToast();
... ... @@ -151,6 +178,7 @@ Page({
}
});
},
// 删除图片
deleteImg(e) {
var imgs = this.data.images;
... ... @@ -170,21 +198,69 @@ Page({
urls: imgs
})
},
goEdit(){
goEdit(e){
var index=e.currentTarget.dataset.index
wx.navigateTo({
url: '/pages/index/brief/brief',
url: '/pages/index/brief/brief?index='+index,
})
},
showMore(){
this.setData({
more_state:!(this.data.more_state)
})
},
setOpen(e){
this.setData({
open:e.currentTarget.dataset.open
})
},
tempClassify(){
var classify = this.data.classify
var styles=[]
for (var i = 0; i < classify.length; i++) {
if (classify[i].state){
styles.push(classify[i].id)
}
}
this.setData({
styles:styles
})
},
submitInfo(){
this.tempClassify()
let url = '/home/index/fashion'
let params = {
list_id: this.data.list_id,
title: this.data.title,
text: this.data.text,
styles: this.data.styles,
open_time: this.data.open_time,
open: this.data.open,
img: this.data.img
}
let header = {
"XX-Token": wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res)
if (res.data.code == 20000) {
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function(options) {
this.getStyle()
},
/**
... ...
... ... @@ -2,12 +2,12 @@
<view class='banner_box'>
<view class='type_box' bindtap="showPicker">
<view>
<input placeholder='标题' bindinput='getText'></input>
<input placeholder='标题' value='{{title}}' bindinput='setTitle'></input>
</view>
<text class="currentWordNumber">{{currentWordNumber|0}}/{{max}}</text>
</view>
<view class='textarea_box'>
<textarea class='textarea' placeholder='同大家分享一下你的穿搭秘籍吧~' maxlength='{{max2}}' value='{{textareavalue}}' bindinput='textContent'>
<textarea class='textarea' placeholder='同大家分享一下你的穿搭秘籍吧~' maxlength='{{max2}}' value='{{text}}' bindinput='setText'>
<text class="number">{{number|0}}/{{max2}}</text>
</textarea>
</view>
... ... @@ -16,9 +16,9 @@
<view class='upload_img'>
<view class='icon_box'>
<view class='iconfont icon-jian' catchtap="deleteImg" data-index="{{index}}"></view>
<view class="edit_label" catchtap="goEdit">编辑</view>
<view class="edit_label" catchtap="goEdit" data-index="{{index}}">编辑</view>
</view>
<image src='{{image}}' data-index="{{index}}" mode="aspectFill" bindtap="previewImg"></image>
<image src='{{image.url}}' data-index="{{index}}" mode="aspectFill" bindtap="previewImg"></image>
</view>
</block>
<view class='upload_img' bindtap="choose">
... ... @@ -30,20 +30,21 @@
<view class='hint_label more_box'>
<text catchtap='showMore'>公开</text>
<view class='more_label_box' wx:if='{{more_state}}'>
<view class='more_item' bindtap='showPoster'>
<!-- <text class='iconfont icon-haibao more'></text> -->
<view class='more_item' bindtap='setOpen' data-open='1'>
<text>公开</text>
</view>
<view class='more_line'></view>
<view class='more_item' catchtap='complain'>
<!-- <text class='iconfont icon-jubao more'></text> -->
<view class='more_item' catchtap='setOpen' data-open='3'>
<text>仅自己可见</text>
</view>
<view class='more_line'></view>
<view class='more_item' catchtap='complain'>
<!-- <text class='iconfont icon-jubao more'></text> -->
<view class='more_item' catchtap='setOpen' data-open='2'>
<text>粉丝可见</text>
</view>
<view class='more_line'></view>
<view class='more_item' catchtap='setOpen' data-open='4'>
<text>草稿箱</text>
</view>
</view>
</view>
</view>
... ... @@ -53,7 +54,7 @@
<view class='tab_box'>
<scroll-view scroll-x>
<text class='classify_title'>风格</text>
<view class="tab_item {{current==index?'bgc-active':''}}" wx:for='{{classify}}' wx:key='index' data-index="{{index}}" bindtap="setClassify">11</view>
<view class="tab_item {{item.state?'bgc-active':''}}" wx:for='{{classify}}' wx:key='index' data-index="{{index}}" bindtap="setClassify">{{item.name}}</view>
</scroll-view>
</view>
<view class='bottom_box'>
... ...
// pages/index/search/search.js
const app=getApp()
Page({
/**
... ... @@ -7,8 +8,10 @@ Page({
data: {
searchHistory:['111','222'],
imgs: ['/images/img3.png', '/images/img3.png', '/images/img3.png'],
more_state:false
more_state:false,
list:[]
},
previewImg(e) {
const current = e.currentTarget.dataset.index;
var imgs = this.data.imgs;
... ... @@ -17,21 +20,59 @@ Page({
urls: imgs
})
},
showMore() {
this.setData({
more_state: !(this.data.more_state)
})
},
complain() {
wx.navigateTo({
url: '/pages/index/comment/comment',
})
},
getData() {
let url = '/home/index/history'
let params = { }
let header = {
"XX-Token": wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res)
if (res.data.code == 20000) {
this.setData({
list:res.data.data.list
})
}
})
},
clearHistory(){
let url = '/home/index/historyDelete'
let params = {}
let header = {
"XX-Token": wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res)
if (res.data.code == 20000) {
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getData()
},
/**
... ...
// pages/my/draft/draft.js
const app=getApp()
Page({
/**
* 页面的初始数据
*/
data: {
list:''
},
getData() {
let url = '/home/index/drafts'
let params = {}
let header = {
"XX-Token": wx.getStorageSync('token'),
'XX-Device-Type': 'wxapp'
}
app.post(url, params, header).then((res) => {
console.log(res)
if(res.data.code==20000){
this.setData({
list:res.data.data.list
})
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getData()
},
/**
... ...
... ... @@ -13,6 +13,7 @@ Page({
look: 0,
look_type: ''
},
cancleMask() {
this.setData({
mask_state: false
... ... @@ -23,26 +24,32 @@ Page({
url: '/pages/index/info/info',
})
},
showMore() {
this.setData({
more_state: !(this.data.more_state)
})
},
goBox() {
wx.navigateTo({
url: '/pages/my/draft/draft',
})
},
goList() {
goList(e) {
var status=e.currentTarget.dataset.status
wx.navigateTo({
url: '/pages/index/fans/fans',
url: '/pages/index/fans/fans?status=' + status,
})
},
goMessage(){
wx.navigateTo({
url: '/pages/index/message/message',
})
},
chargeTime(e) {
var current = e.currentTarget.dataset.current
var tab_current = this.data.tab_current
... ...
... ... @@ -18,11 +18,11 @@
<view class='user_name'>{{user_nickname}}</view>
<view class='user_brief'>{{signature}}</view>
<view class='banner_info' style='padding:0 50rpx;'>
<view bindtap='goList'>
<view bindtap='goList' data-status='2'>
<text class='' style='color:#999;'>粉丝</text>
<text class='user_num'>{{fans_num}}</text>
</view>
<view bindtap='goList'>
<view bindtap='goList' data-status='1'>
<text class='' style='color:#999;'>关注</text>
<text class='user_num'>{{host_num}}</text>
</view>
... ...