作者 xuyangjie

个人中心接口对接

// pages/20/20.js
const app = getApp()
Page({
/**
... ... @@ -34,11 +35,9 @@ Page({
hobby: '爱好:打球、看电影、玩游戏',
image: '../../img/99.png',
}
]
],
meData:{},//用户个人信息
schoolData:{},//学院信息
},
//分类
bindnav(e) {
... ... @@ -53,9 +52,27 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
meData:JSON.parse(options.meData)
})
this.SChool()
},
//获取学院简介
SChool(){
var that = this;
app.post("school/SChool", {school_id:this.data.meData.school_id}).then(res => {
if(res.code == 1){
that.setData({
schoolData:res.data
})
}
}).catch(err => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ... @@ -103,5 +120,12 @@ Page({
*/
onShareAppMessage: function () {
},
details(e){
console.log(e)
wx.navigateTo({
url: 'url',
})
}
})
\ No newline at end of file
... ...
<view class="top">
<image src="/img/img_colloge@2x.png"></image>
<image src="{{schoolData.image}}"></image>
</view>
<view class="nav">
<view class="nav-1">
<image src="/img/img_logo@2x.png"></image>
<image src="{{schoolData.avatar}}"></image>
</view>
<view class="anniu fs28" >当前分数·500</view>
<view class="anniu fs28" >当前分数·{{schoolData.number}}</view>
</view>
<!-- 分类 -->
<view class="butm-0 fs28">
... ... @@ -14,24 +14,28 @@
</view>
<!-- 学院简介 -->
<view class="text" wx:if="{{nav==1}}">
<rich-text nodes="{{content}}"></rich-text>
<rich-text nodes="{{schoolData.text}}"></rich-text>
</view>
<!-- 学院动态 -->
<view class="box-stu" wx:if="{{nav==2}}">
<view class="stu-1">
<view>与中英小学交流活动</view>
<text>2020-04-30</text>
</view>
<view class="stu-2">
<image src="/img/7.jpg"></image>
<view wx:if="{{nav==2}}">
<!-- bindtap="details" data-id="{{item.id}}" -->
<view class="box-stu" wx:for="{{schoolData.SchoolDynamic}}" wx:key='key' >
<view class="stu-1">
<view>{{item.title}}</view>
<text>{{item.createtime}}</text>
</view>
<view class="stu-2">
<image src="{{item.table_image}}"></image>
</view>
</view>
</view>
<!-- 学姐学长信息 -->
<view class="sister_wrap flex_between" wx:if="{{nav==3}}">
<view class="sister" wx:for="{{list}}" wx:key='key'>
<image src="{{item.image}}"></image>
<view class="sister" wx:for="{{schoolData.SchoolStudent}}" wx:key='key'>
<image src="{{item.avatar}}"></image>
<view class="name">{{item.name}}</view>
<view class="aihao">{{item.class}}</view>
<view class="aihao">{{item.hobby}}</view>
<view class="aihao">{{item.classroom}}</view>
<view class="aihao">{{item.con}}</view>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -13,6 +13,7 @@
top: -84rpx;
width: 168rpx;
height: 168rpx;
border-radius: 50%;
}
.anniu {
... ... @@ -27,7 +28,7 @@
.cy {
background: #FFC83D;
color: #000000;
color: #000000 !important;
font-weight: 600;
}
... ...
// pages/28/26.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
meData:{},//用户个人信息
clockData:{},//用户打卡信息
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
meData:JSON.parse(options.meData)
})
this.IndexMyData()
},
//获取用户打卡数据
IndexMyData(){
var that = this;
app.post("index/IndexMyData", {}).then(res => {
if(res.code == 1){
that.setData({
clockData:res.data
})
}
}).catch(err => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ...
<view class="tips">
<image src="/img/99.png"></image>
<image src="{{meData.avatar}}"></image>
</view>
<view class="top">
<view class="top-1">
<text>Harry 的阅读打卡</text>
<text>{{meData.nickname}} 的阅读打卡</text>
<view class="cent">
已连续打卡第
<text class="color">34</text>
<text class="color">{{clockData.clock_number}}</text>
天,共读过
<text class="color">47</text>
<text class="color">{{clockData.readbook}}</text>
本书
</view>
<view class="cent">我的阅读量<text class="color">633</text>词</view>
<view class="cent">我的阅读量<text class="color">{{clockData.readwords}}</text>词</view>
</view>
<image src="/img/02.png"></image>
</view>
\ No newline at end of file
... ...
... ... @@ -12,6 +12,7 @@
.tips image{
width: 144rpx;
height: 144rpx;
border-radius: 50%;
}
.top image{
width: 100%;
... ...
// pages/23/23.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
meData:{},//用户个人信息
shoppingPage:{
page:1,//商城列表页数
last_page:1,//最大页数
},
shoppingData:[],//兑换商城列表
mony: [{
mon: '234'
},
... ... @@ -26,9 +33,9 @@ Page({
})
},
// 兑换
duihuan() {
duihuan(e) {
wx.navigateTo({
url: '/pages/requre/requre',
url: '/pages/requre/requre?goods_data=' + JSON.stringify(e.currentTarget.dataset.id),
})
},
... ... @@ -36,9 +43,40 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
meData:JSON.parse(options.meData)
})
this.shopping()
},
//获取商城列表数据
shopping(){
var that = this;
if(this.data.shoppingPage.page > this.data.shoppingPage.last_page){
console.log('没有更多数据')
return
}
app.post("shopping/ScoreShoppingIndex", {page:this.data.shoppingPage.page}).then(res => {
if(res.code == 1){
var data = this.data.shoppingData;
res.data.Goods.data.forEach((val) => {
data.push(val)
})
var page = this.data.shoppingPage.page*1+1
that.setData({
shoppingData:data,
shoppingPage:{
page:page,
last_page:res.data.Goods.last_page
}
})
}
}).catch(err => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ... @@ -78,7 +116,7 @@ Page({
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.shopping()
},
/**
... ...
... ... @@ -3,20 +3,20 @@
</view>
<view class="nav">
<text>我的积分</text>
<view>500</view>
<view>{{meData.score}}</view>
</view>
<view class="moon">
<view class="mony" wx:for="{{mony}}" wx:key='key' >
<view class="mony" wx:for="{{shoppingData}}" wx:key='key' >
<view>
<image src="/img/01.png"></image>
<image src="{{item.image}}"></image>
</view>
<view class="mon-1">
<text>Apple/苹果 iPhone 11 512G 8G</text>
<text>{{item.title}}</text>
<view class="mon-2">
<view class="mon-4"><image src="/img/ic_jifen@2x.png"></image>
<view>378</view>
<view>{{item.number}}</view>
</view>
<view class="mon-3" bindtap="duihuan">兑换</view>
<view class="mon-3" bindtap="duihuan" data-id="{{item}}">兑换</view>
</view>
</view>
</view>
... ...
... ... @@ -4,4 +4,7 @@
<text>{{item.text}}</text>
<view>2021-05-21</view>
</view>
<view class="red_spot">
<text>1</text>
</view>
</view>
\ No newline at end of file
... ...
... ... @@ -3,6 +3,7 @@
padding: 20rpx 34rpx;
display: flex;
margin-top: 20rpx;
position: relative;
}
.mine image{
vertical-align: middle;
... ... @@ -23,4 +24,20 @@
line-height: 36rpx;
margin-top: 10rpx;
color:rgba(196,196,196,1);
}
.red_spot{
width: 28rpx;
height: 28rpx;
border-radius: 50%;
background-color: red;
display: flex;
justify-content: center;
align-items: center;
position: absolute;
left: 96rpx;
top: 20rpx;
}
.red_spot text{
color: #fff;
font-size: 20rpx;
}
\ No newline at end of file
... ...
... ... @@ -6,7 +6,7 @@ Page({
*/
data: {
nav: 1,
orderData:[],//积分列表
linet: [{
line: '分享微信',
go: '+10'
... ... @@ -34,7 +34,21 @@ Page({
onLoad: function (options) {
},
GetScore(){
var that = this;
app.post("my/GetScore", {}).then(res => {
if(res.code == 1){
that.setData({
orderData:res.data
})
}
}).catch(err => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ...
// pages/26/26.js
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
goods_data:'',//兑换的商品信息
},
//兑换商品事件
gotoday(){
wx.redirectTo({
url: '/pages/success/success',
app.post("shopping/ExchangeGoods", {goods_id:this.data.goods_data.goods_id}).then(res => {
if(res.code == 1){
wx.redirectTo({
url: '/pages/success/success',
})
}
}).catch(err => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
goods_data:JSON.parse(options.goods_data)
})
},
/**
... ...
<view class="part">
<view class="part-0">
<view>
<image src="/img/01.png"></image>
<image src="{{goods_data.image}}"></image>
</view>
<view class="part-1">
<view>定制1个抱枕套</view>
<view>{{goods_data.title}}</view>
<text>x1</text>
</view>
</view>
<view class="part-2">积分20</view>
<view class="part-2">积分{{goods_data.number}}</view>
</view>
<view class="anniu" bindtap="gotoday">20积分兑换</view>
\ No newline at end of file
<view class="anniu" bindtap="gotoday">{{goods_data.number}}积分兑换</view>
\ No newline at end of file
... ...
// pages/11/11.js
const app = getApp()
Page({
/**
... ... @@ -23,7 +24,8 @@ Page({
],
admin: "", // 账号
pwd: "", //密码
login: false
login: false,
meData:{}
},
onShow() {
let token = wx.getStorageSync('token')
... ... @@ -48,20 +50,20 @@ Page({
},
getmenu(e) {
let id = e.currentTarget.dataset.id
// console.log('11111',id)
var data = JSON.stringify(this.data.meData) // 个人信息转换成字符串
if (id == 1) {
wx.navigateTo({
url: '/pages/end/end',
url: '/pages/end/end?meData=' + data,
})
} else if (id == 2) {
wx.navigateTo({
url: '/pages/account/account',
url: '/pages/account/account?meData=' + data,
})
} else {
wx.navigateTo({
url: '/pages/integral/integral',
url: '/pages/integral/integral?meData=' + data,
})
}
... ... @@ -72,9 +74,25 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getMe()
},
//获取用户个人信息
getMe(){
var that = this;
app.post("my/My", {}).then(res => {
if(res.code == 1){
that.setData({
meData:res.data
})
}
}).catch(err => {
wx.showToast({
title: err.msg,
icon: 'none'
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
... ...
... ... @@ -3,8 +3,8 @@
</navigator>
<view class="top">
<view class="top-1">
<image src="/img/99.png"></image>
<view class="bigtitle">乐读爱学习</view>
<image src="{{meData.avatar}}"></image>
<view class="bigtitle">{{meData.nickname}}</view>
<text class="t3" bindtap="getmy">查看并编辑个人资料</text>
</view>
<view class="right">积分·500</view>
... ...
.logo {
text-align: right;
background: rgba(77, 76, 84, 1);
padding-top: 36rpx;
padding-right: 48rpx;
}
.logo image {
width: 56rpx;
height: 56rpx;
border-radius: 16rpx;
filter: grayscale(100%) brightness(600%);
}
.top {
... ... @@ -25,6 +28,7 @@
.top image {
width: 184rpx;
height: 184rpx;
border-radius: 50%;
}
.bigtitle {
... ... @@ -45,8 +49,10 @@
height: 72rpx;
text-align: center;
line-height: 72rpx;
background: #4d4c5c;
border-radius: 86rpx;
margin-top: -135rpx;
color: #fff;
background: #717171;
}
.contents {
... ...
... ... @@ -533,6 +533,24 @@
"pathName": "pages/partake/partake",
"query": "",
"scene": null
},
{
"name": "pages/end/end",
"pathName": "pages/end/end",
"query": "",
"scene": null
},
{
"name": "pages/sheet/sheet",
"pathName": "pages/sheet/sheet",
"query": "",
"scene": null
},
{
"name": "pages/requre/requre",
"pathName": "pages/requre/requre",
"query": "goods_data=%7B%22goods_id%22%3A3%2C%22image%22%3A%22http%3A%2F%2Fenglish.brofirst.cn%2Fuploads%2F20210715%2F8bb3479d5444f4c45de0ae8e449a2b9d.png%22%2C%22title%22%3A%22%E9%98%BF%E8%8B%A5%E6%8B%89%E9%A3%9E%E6%9C%BA%22%2C%22number%22%3A10%7D",
"scene": null
}
]
}
... ...