朋友圈列表,首页

This commit is contained in:
wenc000 2020-07-04 13:03:39 +08:00
parent 0bac46e527
commit 03a2cd035f
11 changed files with 152 additions and 78 deletions

1
app.js
View File

@ -12,6 +12,7 @@ App({
volunteerUrl: 'http://192.168.0.111:8888/volunteer', volunteerUrl: 'http://192.168.0.111:8888/volunteer',
liveUrl: 'http://192.168.0.113:8084/live', liveUrl: 'http://192.168.0.113:8084/live',
liveRecordUrl: 'http://192.168.0.113:8085', liveRecordUrl: 'http://192.168.0.113:8085',
socialUrl: 'http://192.168.0.113:7002/social',
restAjax: restAjax, restAjax: restAjax,
dialog: dialog, dialog: dialog,
onLaunch: function () { onLaunch: function () {

View File

@ -13,7 +13,8 @@ Page({
autoplay: true, autoplay: true,
current: 0 current: 0
}, },
library: null library: null,
libraryPersonList: []
}, },
prevImg: function () { prevImg: function () {
var swiper = this.data.swiper; var swiper = this.data.swiper;
@ -24,7 +25,6 @@ Page({
}) })
}, },
nextImg: function() { nextImg: function() {
console.log(2);
var swiper = this.data.swiper; var swiper = this.data.swiper;
var current = swiper.current; var current = swiper.current;
swiper.current = current < (swiper.imgUrl.length - 1) ? current + 1 : 0; swiper.current = current < (swiper.imgUrl.length - 1) ? current + 1 : 0;
@ -44,7 +44,7 @@ Page({
self.setData({ self.setData({
library: data, library: data,
'swiper.imgUrl': imageArray 'swiper.imgUrl': imageArray
}) });
}, function(code, data) { }, function(code, data) {
app.dialog.msg(data.msg); app.dialog.msg(data.msg);
}, function() { }, function() {
@ -52,11 +52,25 @@ Page({
wx.hideLoading(); wx.hideLoading();
}) })
}, },
doGetLibraryPerson: function(libraryId) {
var self = this;
app.restAjax.get(app.restAjax.path('{libraryUrl}/app/intangiblelibraryperson/listintangiblelibrarypersonrelease', [self.data.libraryUrl]), {
id: libraryId
}, null, function(code, data) {
self.setData({
libraryPersonList: data
})
}, function(code, data) {
app.dialog.msg(data.msg);
});
},
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.doGetLibrary(options.libraryId); var libraryId = options.libraryId
this.doGetLibrary(libraryId);
this.doGetLibraryPerson(libraryId)
}, },
/** /**

View File

@ -65,30 +65,32 @@
</view> </view>
<view class="part"> <view class="part">
<view class="part-title">相关传承人</view> <view class="part-title">相关传承人</view>
<view class="library-person" wx:for="{{libraryPersonList}}" wx:for-item="item" wx:for-index="index" wx:key="libraryPersonList">
<view class="row"> <view class="row">
<view class="info"> <view class="info">
<text>编  号:</text> <text>编  号:</text>
{{library.libraryNumber}} {{item.libraryPersonNumber}}
</view> </view>
<view class="info"> <view class="info">
<text>姓  名:</text> <text>姓  名:</text>
{{library.libraryAuthor}} {{item.libraryPersonName}}
</view> </view>
</view> </view>
<view class="row"> <view class="row">
<view class="info"> <view class="info">
<text>性  别:</text> <text>性  别:</text>
{{item.libraryPersonSex == 1 ? '' : '女'}}
</view> </view>
<view class="info"> <view class="info">
<text>出生日期:</text> <text>出生日期:</text>
1989年5月23日 {{item.libraryPersonBirthday }}
</view> </view>
</view> </view>
<view class="row"> <view class="row">
<view class="info"> <view class="info">
<text>民  族:</text> <text>民  族:</text>
藏族 {{item.libraryPersonNationDictionaryName}}
</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -44,7 +44,6 @@
right: 0; right: 0;
border-radius:31rpx 31rpx 0px 0px; border-radius:31rpx 31rpx 0px 0px;
background: #fff; background: #fff;
margin-bottom: 120rpx;
} }
.culture-title{ .culture-title{
padding: 30rpx; padding: 30rpx;
@ -109,3 +108,9 @@
font-size: 30rpx; font-size: 30rpx;
color: #fff; color: #fff;
} }
.library-person {
border-bottom: 1px solid #FBFBFB;
}
.library-person:last-child {
border-bottom: none;
}

View File

@ -1,18 +1,63 @@
// pages/friendCircle/friendCircle.js // pages/friendCircle/friendCircle.js
var app = getApp();
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
usercenterUrl: app.usercenterUrl,
socialUrl: app.socialUrl,
momentsList: [],
currentPage: 1,
rows: 20
},
doGetMomentsList: function(page) {
var self = this;
app.dialog.loading('正在加载');
app.restAjax.get(app.restAjax.path('{socialUrl}/app/moments/listpagemomentsofpublicrelease', [self.data.socialUrl]), {
page: page,
rows: self.data.rows
}, null, function(code, data) {
if(data.rows.length == 0) {
app.dialog.msg('暂无数据');
return;
}
for(var i = 0, item; item = data.rows[i++];) {
if(item.type === 'photo') {
var photos = item.photos.split(',');
var photoArray = [];
for(var j = 0, jItem; jItem = photos[j++];) {
if(jItem.length != 0) {
photoArray.push(jItem);
}
}
item.photoArray = photoArray;
}
}
var momentsArray;
if(page <= 1) {
momentsArray = data.rows;
} else {
momentsArray = self.data.news.newsList;
momentsArray = momentsArray.concat(data.rows);
}
self.setData({
currentPage: page,
momentsList: momentsArray
})
}, function(code, data) {
app.dialog.msg(data.msg);
}, function() {
wx.stopPullDownRefresh();
wx.hideLoading();
});
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.doGetMomentsList(1);
}, },
/** /**
@ -47,14 +92,14 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh: function () { onPullDownRefresh: function () {
this.doGetMomentsList(1);
}, },
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
this.doGetMomentsList(this.data.currentPage + 1);
}, },
/** /**

View File

@ -1,3 +1,6 @@
{ {
"usingComponents": {} "usingComponents": {},
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark",
"onReachBottomDistance": 50
} }

View File

@ -1,59 +1,51 @@
<view class="friend-circle"> <view class="friend-circle" wx:for="{{momentsList}}" wx:for-item="item" wx:for-index="index" wx:key="momentsList">
<view class="friend-circle-box"> <view class="friend-circle-box" wx:if="{{item.type === 'text'}}">
<view class="avatar"> <view class="avatar">
<image src="../../images/avatar.png"></image> <image src="{{usercenterUrl}}/app/user/downloadavatar/{{item.creator}}"></image>
</view> </view>
<view class="content"> <view class="content">
<view class="name">张三</view> <view class="name">{{item.creatorName}}</view>
<view class="text">内容内容内容内容内容</view> <view class="text">{{item.content}}</view>
<view class="date">2020-01-01 00:00:00</view> <view class="date">{{item.gmtCreate}}</view>
</view> </view>
</view> </view>
<view class="friend-circle-box"> <view class="friend-circle-box" wx:if="{{item.type === 'photo' && item.photoArray.length === 1}}">
<view class="avatar"> <view class="avatar">
<image src="../../images/avatar.png"></image> <image src="{{usercenterUrl}}/app/user/downloadavatar/{{item.creator}}"></image>
</view> </view>
<view class="content"> <view class="content">
<view class="name">张三</view> <view class="name">{{item.creatorName}}</view>
<view class="text">内容内容内容内容内容</view> <view class="text">{{item.content}}</view>
<view class="photo-one"> <view class="photo-one">
<image src="../../images/center-bg.png"></image> <image src="{{socialUrl}}/route/file/downloadfile/true/{{item.photoArray[0]}}"></image>
</view> </view>
<view class="date">2020-01-01 00:00:00</view> <view class="date">{{item.gmtCreate}}</view>
</view> </view>
</view> </view>
<view class="friend-circle-box"> <view class="friend-circle-box" wx:if="{{item.type === 'photo' && item.photoArray.length > 1}}">
<view class="avatar"> <view class="avatar">
<image src="../../images/avatar.png"></image> <image src="{{usercenterUrl}}/app/user/downloadavatar/{{item.creator}}"></image>
</view> </view>
<view class="content"> <view class="content">
<view class="name">张三</view> <view class="name">{{item.creatorName}}</view>
<view class="text">内容内容内容内容内容</view> <view class="text">{{item.content}}</view>
<view class="photo-more"> <view class="photo-more">
<image src="../../images/center-bg.png"></image> <image src="{{socialUrl}}/route/file/downloadfile/true/{{photo}}" wx:for="{{item.photoArray}}" wx:for-item="photo" wx:for-index="photoIndex" wx:key="photoArray"></image>
<image src="../../images/center-bg.png"></image>
<image src="../../images/center-bg.png"></image>
<image src="../../images/center-bg.png"></image>
<image src="../../images/center-bg.png"></image>
<image src="../../images/center-bg.png"></image>
<image src="../../images/center-bg.png"></image>
<image src="../../images/center-bg.png"></image>
<image src="../../images/center-bg.png"></image>
</view> </view>
<view class="date">2020-01-01 00:00:00</view> <view class="date">{{item.gmtCreate}}</view>
</view> </view>
</view> </view>
<view class="friend-circle-box"> <view class="friend-circle-box" wx:if="{{item.type === 'video'}}">
<view class="avatar"> <view class="avatar">
<image src="../../images/avatar.png"></image> <image src="{{usercenterUrl}}/app/user/downloadavatar/{{item.creator}}"></image>
</view> </view>
<view class="content"> <view class="content">
<view class="name">张三</view> <view class="name">{{item.creatorName}}</view>
<view class="text">内容内容内容内容内容</view> <view class="text">{{item.content}}</view>
<view class="video"> <view class="video">
<video src="http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400"></video> <video src="{{socialUrl}}/route/file/downloadfile/true/{{item.video}}"></video>
</view> </view>
<view class="date">2020-01-01 00:00:00</view> <view class="date">{{item.gmtCreate}}</view>
</view> </view>
</view> </view>
</view> </view>

View File

@ -1,19 +1,23 @@
.friend-circle{ .friend-circle{
padding: 30rpx; padding: 15rpx 30rpx;
border-bottom: 1px solid #DEDEDE;
}
.friend-circle:last-child {
border-bottom: none;
} }
.friend-circle-box{ .friend-circle-box{
margin-bottom: 20rpx;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
border-bottom: 1px solid #DEDEDE;
padding-bottom: 10rpx; padding-bottom: 10rpx;
} }
.avatar{ .avatar{
width: 8%; width: 8%;
} }
.avatar image{ .avatar image{
width: 100%; width: 100%;
height: 50rpx; height: 50rpx;
border-radius: 50rpx;
} }
.content{ .content{
width: 90%; width: 90%;
@ -32,7 +36,7 @@
color: #949494; color: #949494;
} }
.photo-one image{ .photo-one image{
width: 80%; width: 100%;
} }
.photo-more image{ .photo-more image{
width: 32%; width: 32%;
@ -44,5 +48,5 @@
margin-right: 0; margin-right: 0;
} }
.video video{ .video video{
width: 80%; width: 100%;
} }

View File

@ -15,6 +15,16 @@ Page({
url: '../cultureDetail/cultureDetail?libraryId='+ event.currentTarget.dataset.libraryId, url: '../cultureDetail/cultureDetail?libraryId='+ event.currentTarget.dataset.libraryId,
}) })
}, },
goLive: function() {
wx.navigateTo({
url: '../broadcast/broadcast',
})
},
goFriendCircle: function() {
wx.navigateTo({
url: '../friendCircle/friendCircle',
})
},
doGetLibraryList: function(page) { doGetLibraryList: function(page) {
var self = this; var self = this;
app.dialog.loading('正在加载'); app.dialog.loading('正在加载');

View File

@ -3,11 +3,11 @@
<image src="../../images/select-tab.png"></image> <image src="../../images/select-tab.png"></image>
<view class="select-title">非物质文化遗产数据库</view> <view class="select-title">非物质文化遗产数据库</view>
</view> </view>
<view class="select-box"> <view class="select-box" bindtap="goLive">
<image src="../../images/select-tab.png"></image> <image src="../../images/select-tab.png"></image>
<view class="select-title">文化直播</view> <view class="select-title">文化直播</view>
</view> </view>
<view class="select-box"> <view class="select-box" bindtap="goFriendCircle">
<image src="../../images/select-tab.png"></image> <image src="../../images/select-tab.png"></image>
<view class="select-title">文化分享</view> <view class="select-title">文化分享</view>
</view> </view>

View File

@ -7,7 +7,7 @@ Page({
randomName: '', randomName: '',
showPhone: true, showPhone: true,
gotCode: false, gotCode: false,
restTime: 10, restTime: 120,
timer: '', timer: '',
indicatorDots: true, indicatorDots: true,
autoplay: true, autoplay: true,
@ -212,7 +212,6 @@ Page({
}) })
self.data.timer = setInterval(function () { self.data.timer = setInterval(function () {
var cur = self.data.restTime - 1 var cur = self.data.restTime - 1
console.log(cur)
if (cur == 0) { if (cur == 0) {
clearInterval(self.data.timer) clearInterval(self.data.timer)
self.setData({ self.setData({
@ -228,7 +227,6 @@ Page({
} }
}, },
function (code, data) { function (code, data) {
console.log(data)
wx.showToast({ wx.showToast({
title: data.msg, title: data.msg,
icon: 'none', icon: 'none',
@ -247,7 +245,7 @@ Page({
token: self.data.token token: self.data.token
} }
}, function (code, data) { }, function (code, data) {
console.log(data) wx.showTabBar();
wx.setStorageSync('token', data.data); wx.setStorageSync('token', data.data);
wx.setStorageSync('isRandomUsername', 0) wx.setStorageSync('isRandomUsername', 0)
clearInterval(self.data.timer) clearInterval(self.data.timer)
@ -255,7 +253,7 @@ Page({
showPhone: false, showPhone: false,
restTime: 120 restTime: 120
}) })
self.getUserInfo() self.getUserInfo();
}, function (code, data) { }, function (code, data) {
console.log(data) console.log(data)
}) })