作者 乔蒙蒙

个人中心对接接口

// pages/my/approve/approve.js
const app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
proData:{
company_id:'',
name:'',
mobile:'',
images:[]
proData: {
company_id: '',
name: '',
mobile: '',
images: [],
},
companyName:''
companyName: '',
seach: false,
keyword: "",
companyList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
},
btn_approve() {
wx.navigateTo({
url: '/pages/my/approveInfo/approveInfo',
// btn_approve() {
// wx.navigateTo({
// url: '/pages/my/approveInfo/approveInfo',
// })
// },
// 点击查询公司名称
companyFun: function() {
this.setData({
seach: true
})
},
// 搜索公司名称
seachFun: function() {
let url = '/api/Company/index', b = this;
if(b.data.keyword == "") {
wx.showToast({
title: '请输入要搜索的公司名称',
icon: "none",
duration: 1300
})
return false;
}else {
let params = {
keyword: b.data.keyword
}
app.post(url, params).then((res) => {
// console.log(res);
b.setData({
companyList: res.data
})
})
}
},
// 公司名称同步到data
keywordFun: function(e) {
this.setData({
keyword: e.detail.value.replace(/\s+/g, ''),
})
this.seachFun();
},
// 选择公司名称同步到页面
companySelect(e) {
this.setData({
companyName: e.currentTarget.dataset.name,
seach: false,
"proData.company_id": e.currentTarget.dataset.id
})
},
// 姓名同步到data
work(e) {
this.setData({
"proData.name": e.detail.value.replace(/\s+/g, ''),
})
},
// 联系电话同步到data
getPhone(e) {
this.setData({
"proData.mobile": e.detail.value.replace(/\s+/g, ''),
})
},
// 上传图片
selectCameraFun: function () {
let that = this;
wx.chooseImage({
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
// tempFilePath可以作为img标签的src属性显示图片
// console.log(res);
let successUp = 0; //成功个数
let failUp = 0; //失败个数
let i = 0; //第几个
let tempFilePaths = res.tempFilePaths //总文件
let length = res.tempFilePaths.length //总共个数
wx.showNavigationBarLoading()
wx.showLoading({
title: '上传中',
})
that.uploadAllfile(tempFilePaths, successUp, failUp, i, length);
},
fail: function (res) {
console.log(res);
},
})
},
// 上传图片至后台
uploadAllfile(filePaths, successUp, failUp, i, length) {
let that = this;
// console.log(filePaths)
// console.log(successUp)
// console.log(failUp)
// console.log(i)
// console.log(length)
let url = 'http://lqz.w.brotop.cn/api/common/upload';
let headers = {
"token": wx.getStorageSync("token"),
'content-type': 'multipart/form-data'
}
wx.uploadFile({
url: url, //仅为示例,非真实的接口地址
header: headers,
filePath: filePaths[i],
name: 'file',
formData: {
act: "Index_upload",
file: '',
filetype: 'image'
},
success: function (res) {
// console.log(res)
wx.hideNavigationBarLoading()
wx.hideLoading()
if (res.statusCode == 200) {
// console.log(res)
let dat = JSON.parse(res.data);
// console.log(dat);
that.setData({
"proData.images": that.data.proData.images.concat(dat.data.url)
})
// console.log(that.data.proData.images);
} else {
wx.showModal({
title: '提示',
content: res.msg,
showCancel: false
})
}
//do something 返回图片地址
},
fail: function (res) {
wx.hideNavigationBarLoading()
wx.hideLoading()
// console.log(res);
},
complete() {
i++;
let img = that.data.img
if (i == length) {
// console.log('总共' + successUp + '张上传成功,' + failUp + '张上传失败!');
}
else { //递归调用uploadDIY函数
that.uploadAllfile(filePaths, successUp, failUp, i, length);
}
}
})
},
// 删除图片重新上传
delFun: function (e) {
let that = this;
let imgUrlList = that.data.proData.images;
imgUrlList.splice(e.currentTarget.dataset.i, 1);
that.setData({
"proData.images": imgUrlList
})
},
// 上传认证
subFun() {
let b = this;
let url = "/api/user/setCertificationInfo";
// console.log(b.data.proData.images.length)
if(b.data.companyName == "" || b.data.proData.name == "" || b.data.proData.mobile == "" || b.data.proData.images.length == 0) {
wx.showToast({
title: '请输入必填项',
icon: "none",
duration: 1300
})
return false;
}else {
b.setData({
"proData.header": true
})
app.post(url, b.data.proData).then((res) => {
// console.log(res);
wx.redirectTo({
url: '../approveInfo/approveInfo',
})
})
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
<!--pages/my/approve/approve.wxml-->
<view class="content_box">
<view class="item_list">
<view class="item_list" bindtap='companyFun'>
<view class="list_title">公司名称</view>
<view class="list_content">
<view class='input_item'>{{'输入公司名称'}}</view>
<view class='input_item {{proData.company_id?"":"color_input"}}'>{{proData.company_id?companyName:'输入公司名称'}}</view>
</view>
</view>
<view class="item_list">
<view class="list_title">姓名</view>
<view class="list_content">
<input type="text" placeholder='请输入姓名' placeholder-class='pl_style' value="{{work}}" class="input_item" bindinput='work'></input>
<input type="text" placeholder='请输入姓名' placeholder-class='pl_style' value="{{proData.name}}" class="input_item" bindinput='work'></input>
</view>
</view>
<view class="item_list">
<view class="list_title">联系电话</view>
<view class="list_content">
<input type="number" placeholder='输入联系电话' placeholder-class='pl_style' value="{{mobile}}" class="input_item" bindinput='getPhone'></input>
<input type="number" placeholder='输入联系电话' placeholder-class='pl_style' value="{{proData.mobile}}" class="input_item" bindinput='getPhone'></input>
</view>
</view>
<view class="item_list" style=' align-items: flex-start;'>
<view class="list_title">营业执照</view>
<view class="list_content" >
<view class='add_btn img_box' wx:for="{{proData.images}}" wx:key=''>
<image src='item' mode='widthFix'></image>
<view class="list_content img_wrap">
<view class='add_btn img_box' wx:for="{{proData.images}}" wx:key='index'>
<image src='{{item}}'></image>
<image class='del' data-i="{{index}}" bindtap="delFun" src='../../../images/imgDel.png'></image>
</view>
<view class='add_btn'>
<view class='add_btn' bindtap='selectCameraFun'>
<text>+</text>
</view>
</view>
</view>
</view>
<view class='bottom_btn' bindtap='btn_approve'>认证</view>
<view class='bottom_btn' bindtap='subFun'>认证</view>
<!-- 公司搜索弹窗 -->
<view class='search_view'>
<view class='search_view' wx:if="{{seach}}">
<view class='search-top'>
<input placeholder='请输入公司名称' type='search' class='input_item'></input>
<view class='cancle_action'>取消</view>
<view class='search_box'>
<input placeholder='请输入公司名称' bindinput='keywordFun' type='search' class='input_item'></input>
<image src='../../../images/del.png'></image>
<view class='cancle_action' bindtap='seachFun'>搜索</view>
</view>
</view>
<view class='adress_list_container'>
<view class='adress_list' wx:for="{{companyList}}" wx:key="index" data-id="{{item.id}}" data-name='{{item.name}}' bindtap='companySelect'>
{{item.name}}
</view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -31,7 +31,7 @@
.list_content {
font-size: 30rpx;
color: #000;
min-width: 75%;
width: 75%;
}
.input_item {
... ... @@ -39,11 +39,22 @@
outline: none;
}
.color_input {
color: rgba(204, 204, 204, 1);
}
.area_item {
width: 80%;
height: 120rpx;
}
.img_wrap {
display: flex;
justify-content: flex-start;
align-items: flex-start;
flex-wrap: wrap;
}
.bottom_btn {
width: 352rpx;
height: 80rpx;
... ... @@ -68,6 +79,27 @@
line-height: 1;
position: relative;
color: rgb(236, 201, 201);
box-sizing: border-box;
}
.img_box {
/* position: relative; */
border: none;
margin:0 10px 20rpx 0;
}
.img_box:nth-child(3n) {
margin-right: 0;
}
.img_box image {
width: 100%;
height: 100%;
display: block;
}
.img_box .del {
position: absolute;
width: 40rpx;
height: 40rpx;
top: 10rpx;
right: 10rpx;
}
.search_view{
position: fixed;
... ... @@ -82,19 +114,30 @@
box-sizing: border-box;
}
.search-top{
height: 80rpx;
height: 120rpx;
width: 100%;
display: flex;
font-size: 26rpx;
padding: 20rpx;
background-color: #fff;
box-sizing: border-box;
border-radius: 5rpx;
}
.search_box {
width: 100%;
height: 100%;
border-radius: 15rpx;
display: flex;
justify-content: flex-start;
align-items: center;
background: #e6e6e6;
}
.input_item{
border: 1rpx solid #efefef;
/* border: 1rpx solid #efefef; */
flex: 1;
height: 100%;
border-radius: 10rpx;
padding-left: 10rpx;
padding-left: 20rpx;
}
.cancle_action{
width: 100rpx;
... ... @@ -103,3 +146,95 @@
color: #64A2E8;
justify-content: center;
}
.search-top image {
width: 32rpx;
height: 32rpx;
display: block;
}
/* 公司名称搜索结果 */
.adress_list_container {
margin-top: 20rpx;
flex: 1;
width: 100%;
background: #fff;
}
.adress_list {
width: 100%;
box-sizing: border-box;
padding: 20rpx;
font-size: 28rpx;
font-weight:400;
color: rgba(51,51,51,1);
/* display: flex;
align-items: flex-start;
justify-content: flex-start; */
border-bottom: 1px solid rgba(204, 204, 204, 0.3);
}
/* .adress_list_left {
width: 32rpx;
height: 32rpx;
margin-right: 15rpx;
}
.adress_list_left image {
display: block;
width: 100%;
height: 100%;
}
.adress_list_right {
flex: 1;
height: 100%;
}
.adress_list_right_top {
font-size: 28rpx;
font-weight:400;
color: rgba(51,51,51,1)
}
.adress_list_right_bottom {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 24rpx;
color: rgba(204,204,204,1);
} */
... ...
... ... @@ -14,6 +14,8 @@ Page({
onLoad: function (options) {
},
// 发表帖子
post_btn() {
wx.navigateTo({
... ... @@ -21,6 +23,13 @@ Page({
})
},
// 返回首页
goHome() {
wx.navigateBack({
delta: 5
})
},
/**
* 生命周期函数--监听页面初次渲染完成
... ...
... ... @@ -6,13 +6,28 @@ Page({
* 页面的初始数据
*/
data: {
followList: [],
page: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getFollowList();
},
// 获取帖子列表
getFollowList() {
let b = this, url = '/api/User/getMyFollowList', params = {
header: true,
page: b.data.page
};
a.post(url, params).then((res) => {
console.log(res);
b.setData({
followList: res.data
})
})
},
/**
... ... @@ -54,7 +69,11 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let that = this;
that.setData({
page: that.data.page + 1,
});
that.getFollowList();
},
/**
... ...
<!--pages/my/myAttention/myAttention.wxml-->
<view class='box'>
<view class='item_list' wx:for='{{[1,2]}}'>
<image src='/images/weirenzheng@2x.png'></image>
<view class='item_list' wx:for='{{followList}}' wx:key="index">
<image src='{{item.logo_image}}'></image>
<view class='list_right'>
<view>
<view class='user_name'>马晓上</view>
<view class='user_name'>{{item.name}}</view>
<view class='list_time'>
<text>今天</text>
<text>21:00</text>
{{item.create_time_text}}
<!-- <text>今天</text>
<text>21:00</text> -->
</view>
</view>
<view class='list_btn'>已关注</view>
... ...
const a = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
commentsList: [],
page: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
this.getCommentsList();
},
// 获取点赞列表
getCommentsList() {
let b = this,
url = '/api/User/getMyCommentList',
params = {
header: true,
page: b.data.page
};
a.post(url, params).then((res) => {
console.log(res);
b.setData({
commentsList: res.data
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
let that = this;
that.setData({
page: that.data.page + 1,
});
that.getCommentsList();
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
<view class='container'>
... ... @@ -10,20 +9,20 @@
<view class='mid'>
<!-- 条目 -->
<view class='mid_item'>
<view class='mid_item' wx:for="{{commentsList}}" wx:key="index">
<view class='mid_item_top'>
<view class='mid_item_top_left'>
<!-- 图片 -->
<view class='mid_item_top_left_pic'>
<image src='../../images/03_nav@2x.png'></image>
<image src='{{item.my_nickname}}'></image>
</view>
<!-- 文字 -->
<view class='mid_item_top_left_text color_blue'>
牧羊人
{{item.my_avatar}}
</view>
</view>
<view class='mid_item_top_right '>
15分钟前
{{item.create_time_text}}
</view>
</view>
<!-- 文字内容 -->
... ... @@ -38,28 +37,28 @@
<view class='mid_item_top_left'>
<!-- 图片 -->
<view class='mid_item_top_left_pic'>
<image src='../../images/03_nav@2x.png'></image>
<image src='{{item.avatar}}'></image>
</view>
<!-- 文字 -->
<view class='mid_item_top_left_text'>
金沃斯英语在线教育
{{item.nickname}}
<view class='icon_tm'>
<image src='../../images/guangfang@2x.png'></image>
</view>
</view>
</view>
<view class='mid_item_top_right'>
15分钟前
{{item.create_time_text}}
</view>
</view>
<!-- 文字内容 -->
<view class='mid_item_text'>
新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题!
{{item.content}}
</view>
<!-- 图片内容 -->
<view class='mid_pic_box'>
<view class='mid_pic_item'>
<image src='../../images/weirenzheng@3x.png'></image>
<view class='mid_pic_item' wx:for="{{item.images}}" wx:key="index">
<image src='{{item}}'></image>
</view>
</view>
... ... @@ -78,8 +77,8 @@
<view class='mid_item_like_right'>
<!-- 点赞 -->
<view class='mid_like '>
<image src='../../images/zan@3x.png'></image>
<view class='mid_like ' >
<image wx:if="{{item.is_like == 0}}" src='../../images/zan@3x.png'></image>
</view>
<!-- 数量 -->
<view class='mid_number '>
... ...
const a = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
noticeList: [],
page: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
this.getInformList();
},
// 获取点赞列表
getInformList() {
let b = this,
url = '/api/User/getNoticeList',
params = {
header: true,
page: b.data.page
};
a.post(url, params).then((res) => {
console.log(res);
b.setData({
noticeList: res.data
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
let that = this;
that.setData({
page: that.data.page + 1,
});
that.getInformList();
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
... ... @@ -110,7 +110,7 @@
<view class='mid'>
<!-- 条目 -->
<view class='mid_item'>
<view class='mid_item' wx:for="{{noticeList}}" wx:key="index">
<view class='mid_item_top'>
<view class='mid_item_top_left'>
<!-- 图片 -->
... ... @@ -120,10 +120,14 @@
<!-- 文字 -->
<view class='mid_item_top_left_text color_blue'>
牧羊人
<view class='mid_icon'>
<view class='mid_icon' wx:if="{{item.read_switch == 0}}">
未读
<!-- <image src='../../images/weidu@2x.png'></image> -->
</view>
<view class='mid_icon color_read' wx:if="{{item.read_switch == 1}}">
已读
<!-- <image src='../../images/weidu@2x.png'></image> -->
</view>
</view>
</view>
<view class='mid_item_top_right '>
... ... @@ -132,11 +136,11 @@
</view>
<!-- 大标题 -->
<view class='mid_item_title'>
交通优势突出停车难问题能否解决?
{{item.title}}
</view>
<!-- 文字内容 -->
<view class='mid_item_text'>
新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题!
{{item.content}}
</view>
... ...
const a = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
likeList: [],
page: 1
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
this.getLikeList();
},
// 获取点赞列表
getLikeList() {
let b = this, url = '/api/User/getMyLikeList', params = {
header: true,
page: b.data.page
};
a.post(url, params).then((res) => {
console.log(res);
b.setData({
likeList: res.data
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onReady: function() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
onShow: function() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
onHide: function() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onUnload: function() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
onPullDownRefresh: function() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onReachBottom: function() {
let that = this;
that.setData({
page: that.data.page + 1,
});
that.getLikeList();
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onShareAppMessage: function() {
}
})
\ No newline at end of file
... ...
... ... @@ -110,34 +110,33 @@
<view class='mid'>
<!-- 条目 -->
<view class='mid_item'>
<view class='mid_item' wx:for="{{likeList}}" wx:key="index">
<view class='mid_item_top'>
<view class='mid_item_top_left'>
<!-- 图片 -->
<view class='mid_item_top_left_pic'>
<image src='../../images/03_nav@2x.png'></image>
<image src='{{item.avatar}}'></image>
</view>
<!-- 文字 -->
<view class='mid_item_top_left_text'>
金沃斯英语在线教育
{{item.nickname}}
</view>
</view>
<view class='mid_item_top_right'>
15分钟前
{{item.create_time_text}}
</view>
</view>
<!-- 文字内容 -->
<view class='mid_item_text'>
新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题!
<view class='mid_item_text'>{{item.title}}
</view>
<!-- 图片内容 -->
<view class='mid_pic_box'>
<view class='mid_pic_box_p'>
<image src='../../images/weirenzheng@3x.png'></image>
<view class='mid_pic_box_p' wx:for="{{item.images}}" wx:key="index">
<image src='{{item}}'></image>
</view>
<view class='mid_pic_box_p'>
<!-- <view class='mid_pic_box_p'>
<image src='../../images/weirenzheng@3x.png'></image>
</view>
</view> -->
</view>
... ... @@ -173,73 +172,6 @@
</view>
<!-- 条目 -->
<view class='mid_item'>
<view class='mid_item_top'>
<view class='mid_item_top_left'>
<!-- 图片 -->
<view class='mid_item_top_left_pic'>
<image src='../../images/03_nav@2x.png'></image>
</view>
<!-- 文字 -->
<view class='mid_item_top_left_text'>
金沃斯英语在线教育
<view class='icon_tm'>
<image src='../../images/guangfang@2x.png'></image>
</view>
</view>
</view>
<view class='mid_item_top_right'>
15分钟前
</view>
</view>
<!-- 文字内容 -->
<view class='mid_item_text'>
新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题!
</view>
<!-- 图片内容 -->
<view class='mid_pic_box'>
<view class='mid_pic_item'>
<image src='../../images/weirenzheng@3x.png'></image>
</view>
</view>
<!-- 底部 -->
<view class='mid_item_like'>
<view class='mid_item_like_left'>
<!-- 删除 -->
</view>
<view class='mid_item_like_right'>
<!-- 点赞 -->
<view class='mid_like color_blue'>
<image src='../../images/thumb-up-button@3x.png'></image>
</view>
<!-- 数量 -->
<view class='mid_number '>
46
</view>
<!-- 点赞 -->
<view class='mid_like'>
<image src='../../images/pinglun_fill@3x.png'></image>
</view>
<!-- 数量 -->
<view class='mid_number'>
46
</view>
</view>
</view>
<!-- 回复框 -->
<!-- <view class='mid_item_bottom'>
<view><span class='color_blue'>宏中科技</span>:非常实用!!!</view>
<view><span class='color_blue'>宏中科技</span>:非常实用!!!</view>
<view><span class='color_blue'>查看更多>></span></view>
</view> -->
</view>
</view>
</view>
</view>
\ No newline at end of file
... ...