初始化项目

This commit is contained in:
itgaojian 2024-02-22 10:58:38 +08:00
commit 7a2c996039
4872 changed files with 467449 additions and 0 deletions

1
xz_angren/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/project.config.json

73
xz_angren/app.js Normal file
View File

@ -0,0 +1,73 @@
//app.js
var restAjax = require('utils/restAjax.js');
var dialog = require('utils/dialog.js');
var utils = require('utils/util.js');
// + 'https://www.xzszwhy.cn/usercenter'
App({
loginUrl: restAjax.baseUrl,
usercenterUrl: restAjax.baseUrl,
newsUrl: restAjax.baseUrl,
newsContentUrl: restAjax.url,
libraryUrl: restAjax.baseUrl,
venueUrl: restAjax.baseUrl,
activityUrl: restAjax.baseUrl,
volunteerUrl: restAjax.baseUrl,
activityUrl: restAjax.baseUrl,
volunteerUrl: restAjax.baseUrl,
liveUrl: restAjax.url + 'live',
liveRecordUrl: restAjax.baseUrl,
socialUrl: restAjax.baseUrl,
areaCode: '540226000000',
areaName: '昂仁县',
areaId: '641622',
appKey:'wx5cc200792f3b7761',
shopUrl: restAjax.url + "xzshop",
bigDataUrl: restAjax.url + "module",
restAjax: restAjax,
shopImgUrl: restAjax.url + "xzshop/route/file/download/true/",
imgUrl: restAjax.baseUrl + "/route/file/download/true/",
liveImgUrl: restAjax.url + "live/route/file/download/true/",
dialog: dialog,
utils: utils,
wssUrl: restAjax.wssUrl,
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
}
})
// 获取用户信息
wx.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
wx.getUserInfo({
success: res => {
// 可以将 res 发送给后台解码出 unionId
this.globalData.userInfo = res.userInfo
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
// 所以此处加入 callback 以防止这种情况
if (this.userInfoReadyCallback) {
this.userInfoReadyCallback(res)
}
}
})
}
}
})
},
globalData: {
userInfo: null,
curLat: -1,
curLng: -1,
carList: [],
isPublic: false,//是否关注了公众号
}
})

120
xz_angren/app.json Normal file
View File

@ -0,0 +1,120 @@
{
"pages": [
"pages/index/index",
"pages/travel/travel",
"pages/resource/resource",
"pages/template/template",
"pages/train/train",
"pages/cultureMap/cultureMap",
"pages/order/order",
"pages/venue/venue",
"pages/center/center",
"pages/myFriendCircle/myFriendCircle",
"pages/friendCircle/friendCircle",
"pages/orderDetail/orderDetail",
"pages/broadcastList/broadcastList",
"pages/myVenueOrder/myVenueOrder",
"pages/broadcast/broadcast",
"pages/activityDialog/activityDialog",
"pages/teamDetail/teamDetail",
"pages/volunteerRegister/volunteerRegister",
"pages/volunteer/volunteer",
"pages/heritage/heritage",
"pages/broadcastDetail/broadcastDetail",
"pages/venueDetail/venueDetail",
"pages/book/book",
"pages/register/register",
"pages/commonQrCode/commonQrCode",
"pages/newVolunteerActivity/newVolunteerActivity",
"pages/newTeam/newTeam",
"pages/volunteerTeam/volunteerTeam",
"pages/cultureDetail/cultureDetail",
"pages/activitySign/activitySign",
"pages/activityDetail/activityDetail",
"pages/activity/activity",
"pages/newsDetail/newsDetail",
"pages/newsList/newsList",
"pages/myActivity/myActivity",
"pages/myVolunteerTeam/myVolunteerTeam",
"pages/myVolunteerActivity/myVolunteerActivity",
"pages/serviceActivityDetail/serviceActivityDetail",
"pages/shop/shopcategory"
],
"subPackages": [
{
"root": "subpages/",
"pages": [
"goodslist/goodslist",
"goodsdetail/goodsdetail",
"goodscar/goodscar",
"goodsaddress/goodsaddress",
"goodsorder/goodsorder",
"addshopaddress/addshopaddress",
"editshopaddress/editshopaddress",
"orderconfirm/orderconfirm",
"addresschoose/addresschoose",
"webcontentview/webcontent",
"search/commonSearch",
"liverecord/liverecord"
]
}
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#9F1512",
"navigationBarTitleText": "昂仁县公共文化数字云",
"navigationBarTextStyle": "white"
},
"tabBar": {
"color": "#BBBBBB",
"borderStyle": "black",
"selectedColor": "#000000",
"list": [
{
"pagePath": "pages/index/index",
"iconPath": "images/index.png",
"text": "首页",
"selectedIconPath": "images/index-on.png"
},
{
"pagePath": "pages/activity/activity",
"iconPath": "images/activity.png",
"text": "活动",
"selectedIconPath": "images/activity-on.png"
},
{
"pagePath": "pages/venue/venue",
"iconPath": "images/venue.png",
"text": "场馆",
"selectedIconPath": "images/venue-on.png"
},
{
"pagePath": "pages/shop/shopcategory",
"iconPath": "images/culture.png",
"text": "商城",
"selectedIconPath": "images/culture-on.png"
},
{
"pagePath": "pages/center/center",
"iconPath": "images/center.png",
"text": "我的",
"selectedIconPath": "images/center-on.png"
}
]
},
"usingComponents": {
"page-loading": "/components/loading/pageloading",
"page-empty": "/components/empty/empty",
"loading-more": "/components/loadmore/loading-more"
},
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于您当前所在位置"
}
},
"requiredPrivateInfos": [
"getLocation"
],
"style": "v2",
"sitemapLocation": "sitemap.json"
}

188
xz_angren/app.wxss Normal file
View File

@ -0,0 +1,188 @@
/**app.wxss**/
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
padding: 200rpx 0;
box-sizing: border-box;
}
radio-group text {
font-size: 25rpx;
}
radio .wx-radio-input {
border-radius: 50%;
width: 24rpx;
border: 2rpx solid #5e5e5f;
height: 24rpx;
}
radio .wx-radio-input.wx-radio-input-checked {
border: none;
background: #07c160;
}
radio .wx-radio-input.wx-radio-input-checked::before {
border-radius: 50%;
/* 圆角 */
width: 28rpx;
/* 选中后对勾大小,不要超过背景的尺寸 */
height: 28rpx;
/* 选中后对勾大小,不要超过背景的尺寸 */
line-height: 28rpx;
text-align: center;
font-size: 20rpx;
/* 对勾大小 30rpx */
color: #fff;
/* 对勾颜色 白色 */
background: #07c160;
transform: translate(-50%, -50%) scale(1);
}
checkbox-group text {
font-size: 25rpx;
}
checkbox .wx-checkbox-input {
width: 24rpx;
border: 2rpx solid #5e5e5f;
height: 24rpx;
margin-left: 5rpx;
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
border: none;
background: #07c160;
}
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
/* 圆角 */
width: 28rpx;
/* 选中后对勾大小,不要超过背景的尺寸 */
height: 28rpx;
/* 选中后对勾大小,不要超过背景的尺寸 */
line-height: 28rpx;
text-align: center;
font-size: 20rpx;
margin-left: 5rpx;
/* 对勾大小 30rpx */
color: #fff;
/* 对勾颜色 白色 */
background: #07c160;
transform: translate(-50%, -50%) scale(1);
}
.text-clamp1 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 1;
}
.text-clamp2 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
.text-clamp3 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
.text-clamp4 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 4;
}
.text-clamp5 {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 5;
}
.flex {
display: -webkit-box;
display: -webkit-flex;
display: flex;
}
.flex-center {
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: center;
justify-content: center;
-webkit-align-items: center;
-webkit-justify-content: center;
}
.flex-alignStart {
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: flex-start;
-webkit-align-items: flex-start;
}
.flex-alignCenter {
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: center;
-webkit-align-items: center;
}
.flex-alignEnd {
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: flex-end;
-webkit-align-items: flex-end;
}
.flex-between {
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: space-between;
-webkit-justify-content: space-between;
}
.flex-around {
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: space-around;
-webkit-justify-content: space-around;
}
.flex-middle {
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: center;
-webkit-justify-content: center;
}
.flex-end {
display: -webkit-box;
display: -webkit-flex;
display: flex;
justify-content: flex-end;
-webkit-justify-content: flex-end;
}

View File

@ -0,0 +1,23 @@
// components/empty/empty.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,5 @@
<!--components/empty/empty.wxml-->
<view class="data-empty">
<image src="/images/ic_empty_data.png" mode="scaleToFill"></image>
<text class="hint">暂无数据</text>
</view>

View File

@ -0,0 +1,24 @@
/* components/empty/empty.wxss */
.data-empty {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
align-self: center;
position: fixed;
top: 50%;
left: 50%;
transform: translateX(-50%)translateY(-50%);
}
.data-empty image {
width: 180rpx;
height: 120rpx;
}
.data-empty .hint {
margin-top: 30rpx;
font-size: 32rpx;
}

View File

@ -0,0 +1,80 @@
// components/expandabletext/expandabletext.js
/**
* 长文本内容展开与收起
* @param {String} content 长文本内容
* @param {Number} maxline 最多展示行数[只允许 1-5 的正整数]
* @param {String} position 展开收起按钮位置[可选值为 left right]
* @param {Boolean} foldable 点击长文本是否展开收起
*/
Component({
options: {
addGlobalClass: true
},
/**
* 组件的属性列表
*/
properties: {
content: {
type: String,
observer(val) {
console.log(val)
if (this.data.onReady) {
setTimeout(() => this.checkFold(), 10)
}
}
},
maxline: {
type: Number,
value: 1,
observer(value) {
if (!(/^[1-5]$/).test(value)) {
throw new Error(`Maxline field value can only be digits (1-5), Error value: ${value}`)
} else if (this.data.onReady) {
setTimeout(() => this.checkFold(), 10)
}
}
},
position: {
type: String,
value: "left"
},
foldable: {
type: Boolean,
value: true
}
},
/**
* 组件的初始数据
*/
data: {
onFold: false,
showFold: false,
onReady: false
},
lifetimes: {
ready() {
this.checkFold()
this.data.onReady = true
}
},
/**
* 组件的方法列表
*/
methods: {
checkFold() {
const query = wx.createSelectorQuery().in(this);
query.selectAll(".showArea, .hideArea").boundingClientRect(res => {
this.setData({
showFold: res[0].height < res[1].height
})
}).exec()
},
handleFold() {
this.setData({
onFold: !this.data.onFold
})
}
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,7 @@
<view class="content">
<view class="contentInner showArea {{!onFold ? 'text-clamp' + maxline : ''}}" bindtap="{{foldable ? 'handleFold' : ''}}">{{content || "示例文本"}}</view>
<view class="contentInner hideArea">{{content || "示例文本"}}</view>
<view class="foldInner {{position === 'right' ? 'flex-end' : 'flex'}}" wx:if="{{showFold}}">
<text class="fold" catchtap="handleFold">{{onFold ? "收起" : "展开"}}</text>
</view>
</view>

View File

@ -0,0 +1,34 @@
.content {
width: 690rpx;
padding: 0 30rpx;
border-top: 20rpx solid transparent;
border-bottom: 20rpx solid transparent;
margin-bottom: 20rpx;
}
.contentInner {
width: 690rpx;
color: #ffffff;
font-size: 30rpx;
line-height: 1.35;
text-align: justify;
}
.hideArea {
display: -webkit-box;
overflow: hidden;
position: fixed;
top: 100vh;
left: -100vw;
}
.foldInner {
width: 690rpx;
padding-top: 10rpx;
}
.foldInner .fold {
color: #eb0000;
font-size: 32rpx;
cursor: pointer;
}

View File

@ -0,0 +1,23 @@
// components/loading/pageloading.js
Component({
/**
* 组件的属性列表
*/
properties: {
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,5 @@
<!--components/loading/pageloading.wxml-->
<view class="page-loading-box">
<image src="/images/loading-small.gif" mode="scaleToFill"></image>
<view class="text">加载中...</view>
</view>

View File

@ -0,0 +1,24 @@
/* components/loading/pageloading.wxss */
.page-loading-box {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
/* background: rgba(255, 255, 255, 1); */
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 99;
}
.page-loading-box image {
width: 128rpx;
height: 128rpx;
}
.page-loading-box .text {
margin-top: 20rpx;
font-size: 28rpx;
}

View File

@ -0,0 +1,30 @@
// components/loadmore/loading-more.js
Component({
/**
* 组件的属性列表
*/
properties: {
isShowloading: true,
loadingTxt: "加载中..."
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
},
observers: {
'isShowloading,loadingTxt': function (ss, sss) {
console.log(ss)
console.log(sss)
}
}
})

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,5 @@
<!--components/loadmore/loading-more.wxml-->
<view class="loading-box">
<image src="/images/loading.gif" wx:if="{{isShowloading}}"></image>
<view class="loading-content">{{loadingTxt}}</view>
</view>

View File

@ -0,0 +1,20 @@
/* components/loadmore/loading-more.wxss */
.loading-box {
width: 100%;
height: 80rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
font-size: 35rpx;
}
.loading-box image {
width: 40rpx;
height: 40rpx;
}
.loading-content {
margin-left: 20rpx;
}

BIN
xz_angren/images/activity-on.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

BIN
xz_angren/images/activity.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 B

BIN
xz_angren/images/address.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
xz_angren/images/avatar.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 530 B

BIN
xz_angren/images/big-news.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
xz_angren/images/center-bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
xz_angren/images/center-on.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

BIN
xz_angren/images/center.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

BIN
xz_angren/images/collect.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 B

BIN
xz_angren/images/collected.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

BIN
xz_angren/images/culture-on.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

BIN
xz_angren/images/culture.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

BIN
xz_angren/images/delete-photo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

BIN
xz_angren/images/delete.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 284 B

BIN
xz_angren/images/friend.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

BIN
xz_angren/images/good.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 B

BIN
xz_angren/images/ic_audio_bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 921 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

BIN
xz_angren/images/index-on.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

BIN
xz_angren/images/index.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 399 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

BIN
xz_angren/images/login-bg.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

BIN
xz_angren/images/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
xz_angren/images/marker_red.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 713 B

BIN
xz_angren/images/my-collect.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

BIN
xz_angren/images/my-comment.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

BIN
xz_angren/images/my-sign.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

BIN
xz_angren/images/new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

BIN
xz_angren/images/next.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

BIN
xz_angren/images/order.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

BIN
xz_angren/images/people.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
xz_angren/images/person.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

BIN
xz_angren/images/play.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 507 B

BIN
xz_angren/images/play_next.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

BIN
xz_angren/images/play_pause.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 737 B

BIN
xz_angren/images/play_prev.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 573 B

BIN
xz_angren/images/play_resume.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

BIN
xz_angren/images/prev.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
xz_angren/images/select-tab.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
xz_angren/images/selected-l.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

BIN
xz_angren/images/selected-r.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

BIN
xz_angren/images/setting.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

BIN
xz_angren/images/share.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

BIN
xz_angren/images/tab1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
xz_angren/images/tab2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
xz_angren/images/tab3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
xz_angren/images/tab4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
xz_angren/images/tab5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
xz_angren/images/tab6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

BIN
xz_angren/images/tab7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
xz_angren/images/team.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
xz_angren/images/time.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
xz_angren/images/venue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

BIN
xz_angren/images/venue1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
xz_angren/images/venue2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
xz_angren/images/venue3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
xz_angren/images/view.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

452
xz_angren/libs/bmap-wx.js Normal file
View File

@ -0,0 +1,452 @@
/**
* @file 微信小程序JSAPI
* @author 崔健 cuijian03@baidu.com 2017.01.10
* @update 邓淑芳 623996689@qq.com 2019.07.03
*/
/**
* 百度地图微信小程序API类
*
* @class
*/
class BMapWX {
/**
* 百度地图微信小程序API类
*
* @constructor
*/
constructor(param) {
this.ak = param["ak"];
}
/**
* 使用微信接口进行定位
*
* @param {string} type 坐标类型
* @param {Function} success 成功执行
* @param {Function} fail 失败执行
* @param {Function} complete 完成后执行
*/
getWXLocation(type, success, fail, complete) {
type = type || 'gcj02',
success = success || function () { };
fail = fail || function () { };
complete = complete || function () { };
wx.getLocation({
type: type,
success: success,
fail: fail,
complete: complete
});
}
/**
* POI周边检索
*
* @param {Object} param 检索配置
* 参数对象结构可以参考
* http://lbsyun.baidu.com/index.php?title=webapi/guide/webservice-placeapi
*/
search(param) {
var that = this;
param = param || {};
let searchparam = {
query: param["query"] || '生活服务$美食&酒店',
scope: param["scope"] || 1,
filter: param["filter"] || '',
coord_type: param["coord_type"] || 2,
page_size: param["page_size"] || 10,
page_num: param["page_num"] || 0,
output: param["output"] || 'json',
ak: that.ak,
sn: param["sn"] || '',
timestamp: param["timestamp"] || '',
radius: param["radius"] || 2000,
ret_coordtype: 'gcj02ll'
};
let otherparam = {
iconPath: param["iconPath"],
iconTapPath: param["iconTapPath"],
width: param["width"],
height: param["height"],
alpha: param["alpha"] || 1,
success: param["success"] || function () { },
fail: param["fail"] || function () { }
};
let type = 'gcj02';
let locationsuccess = function (result) {
searchparam["location"] = result["latitude"] + ',' + result["longitude"];
wx.request({
url: 'https://api.map.baidu.com/place/v2/search',
data: searchparam,
header: {
"content-type": "application/json"
},
method: 'GET',
success(data) {
let res = data["data"];
if (res["status"] === 0) {
let poiArr = res["results"];
// outputRes 包含两个对象,
// originalData为百度接口返回的原始数据
// wxMarkerData为小程序规范的marker格式
let outputRes = {};
outputRes["originalData"] = res;
outputRes["wxMarkerData"] = [];
for (let i = 0; i < poiArr.length; i++) {
outputRes["wxMarkerData"][i] = {
id: i,
latitude: poiArr[i]["location"]["lat"],
longitude: poiArr[i]["location"]["lng"],
title: poiArr[i]["name"],
iconPath: otherparam["iconPath"],
iconTapPath: otherparam["iconTapPath"],
address: poiArr[i]["address"],
telephone: poiArr[i]["telephone"],
alpha: otherparam["alpha"],
width: otherparam["width"],
height: otherparam["height"]
}
}
otherparam.success(outputRes);
} else {
otherparam.fail({
errMsg: res["message"],
statusCode: res["status"]
});
}
},
fail(data) {
otherparam.fail(data);
}
});
}
let locationfail = function (result) {
otherparam.fail(result);
};
let locationcomplete = function (result) {
};
if (!param["location"]) {
that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
} else {
let longitude = param.location.split(',')[1];
let latitude = param.location.split(',')[0];
let errMsg = 'input location';
let res = {
errMsg: errMsg,
latitude: latitude,
longitude: longitude
};
locationsuccess(res);
}
}
/**
* sug模糊检索
*
* @param {Object} param 检索配置
* 参数对象结构可以参考
* http://lbsyun.baidu.com/index.php?title=webapi/place-suggestion-api
*/
suggestion(param) {
var that = this;
param = param || {};
let suggestionparam = {
query: param["query"] || '',
region: param["region"] || '全国',
city_limit: param["city_limit"] || false,
output: param["output"] || 'json',
ak: that.ak,
sn: param["sn"] || '',
timestamp: param["timestamp"] || '',
ret_coordtype: 'gcj02ll'
};
let otherparam = {
success: param["success"] || function () { },
fail: param["fail"] || function () { }
};
wx.request({
url: 'https://api.map.baidu.com/place/v2/suggestion',
data: suggestionparam,
header: {
"content-type": "application/json"
},
method: 'GET',
success(data) {
let res = data["data"];
if (res["status"] === 0) {
otherparam.success(res);
} else {
otherparam.fail({
errMsg: res["message"],
statusCode: res["status"]
});
}
},
fail(data) {
otherparam.fail(data);
}
});
}
/**
* rgc检索逆地理编码经纬度->地点描述
*
* @param {Object} param 检索配置
* 参数对象结构可以参考
* https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding-abroad
*
*/
regeocoding (param) {
var that = this;
param = param || {};
let regeocodingparam = {
coordtype: param["coordtype"] || 'gcj02ll',
ret_coordtype: 'gcj02ll',
radius: param["radius"] || 1000,
ak: that.ak,
sn: param["sn"] || '',
output: param["output"] || 'json',
callback: param["callback"] || function () { },
extensions_poi: param["extensions_poi"] || 1,
extensions_road: param["extensions_road"] || false,
extensions_town: param["extensions_town"] || false,
language: param["language"] || 'zh-CN',
language_auto: param["language_auto"] || 0
};
let otherparam = {
iconPath: param["iconPath"],
iconTapPath: param["iconTapPath"],
width: param["width"],
height: param["height"],
alpha: param["alpha"] || 1,
success: param["success"] || function () { },
fail: param["fail"] || function () { }
};
let type = 'gcj02';
let locationsuccess = function (result) {
regeocodingparam["location"] = result["latitude"] + ',' + result["longitude"];
wx.request({
url: 'https://api.map.baidu.com/reverse_geocoding/v3',
data: regeocodingparam,
header: {
"content-type": "application/json"
},
method: 'GET',
success(data) {
let res = data["data"];
if (res["status"] === 0) {
let poiObj = res["result"];
// outputRes 包含两个对象:
// originalData为百度接口返回的原始数据
// wxMarkerData为小程序规范的marker格式
let outputRes = {};
outputRes["originalData"] = res;
outputRes["wxMarkerData"] = [];
outputRes["wxMarkerData"][0] = {
id: 0,
latitude: result["latitude"],
longitude: result["longitude"],
address: poiObj["formatted_address"],
iconPath: otherparam["iconPath"],
iconTapPath: otherparam["iconTapPath"],
desc: poiObj["sematic_description"],
business: poiObj["business"],
alpha: otherparam["alpha"],
width: otherparam["width"],
height: otherparam["height"]
}
otherparam.success(outputRes);
} else {
otherparam.fail({
errMsg: res["message"],
statusCode: res["status"]
});
}
},
fail(data) {
otherparam.fail(data);
}
});
};
let locationfail = function (result) {
otherparam.fail(result);
}
let locationcomplete = function (result) {
};
if (!param["location"]) {
that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
} else {
let longitude = param.location.split(',')[1];
let latitude = param.location.split(',')[0];
let errMsg = 'input location';
let res = {
errMsg: errMsg,
latitude: latitude,
longitude: longitude
};
locationsuccess(res);
}
}
/**
* gc检索地理编码地点->经纬度
*
* @param {Object} param 检索配置
* 参数对象结构可以参考
* https://lbs.baidu.com/index.php?title=webapi/guide/webservice-geocoding
*
*/
geocoding(param) {
var that = this;
param = param || {};
let geocodingparam = {
address: param["address"] || '',
city: param["city"] || '',
ret_coordtype: param["coordtype"] || 'gcj02ll',
ak: that.ak,
sn: param["sn"] || '',
output: param["output"] || 'json',
callback: param["callback"] || function () { }
};
let otherparam = {
iconPath: param["iconPath"],
iconTapPath: param["iconTapPath"],
width: param["width"],
height: param["height"],
alpha: param["alpha"] || 1,
success: param["success"] || function () { },
fail: param["fail"] || function () { }
};
if (param["address"]) {
wx.request({
url: 'https://api.map.baidu.com/geocoding/v3',
data: geocodingparam,
header: {
"content-type": "application/json"
},
method: 'GET',
success(data) {
let res = data["data"];
if (res["status"] === 0){
let poiObj = res["result"];
// outputRes 包含两个对象:
// originalData为百度接口返回的原始数据
// wxMarkerData为小程序规范的marker格式
let outputRes = res;
outputRes["originalData"] = res;
outputRes["wxMarkerData"] = [];
outputRes["wxMarkerData"][0] = {
id: 0,
latitude: poiObj["location"]["lat"],
longitude: poiObj["location"]["lng"],
iconPath: otherparam["iconPath"],
iconTapPath: otherparam["iconTapPath"],
alpha: otherparam["alpha"],
width: otherparam["width"],
height: otherparam["height"]
}
otherparam.success(outputRes);
} else {
otherparam.fail({
errMsg: res["message"],
statusCode: res["status"]
});
}
},
fail(data) {
otherparam.fail(data);
}
});
} else {
let errMsg = 'input address!';
let res = {
errMsg: errMsg
};
otherparam.fail(res);
}
}
/**
* 天气检索
*
* @param {Object} param 检索配置
*/
weather(param) {
var that = this;
param = param || {};
let weatherparam = {
coord_type: param["coord_type"] || 'gcj02',
output: param["output"] || 'json',
ak: that.ak,
sn: param["sn"] || '',
timestamp: param["timestamp"] || ''
};
let otherparam = {
success: param["success"] || function () { },
fail: param["fail"] || function () { }
};
let type = 'gcj02';
let locationsuccess = function (result) {
weatherparam["location"] = result["longitude"] + ',' + result["latitude"];
wx.request({
url: 'https://api.map.baidu.com/telematics/v3/weather',
data: weatherparam,
header: {
"content-type": "application/json"
},
method: 'GET',
success(data) {
let res = data["data"];
if (res["error"] === 0 && res["status"] === 'success') {
let weatherArr = res["results"];
// outputRes 包含两个对象,
// originalData为百度接口返回的原始数据
// wxMarkerData为小程序规范的marker格式
let outputRes = {};
outputRes["originalData"] = res;
outputRes["currentWeather"] = [];
outputRes["currentWeather"][0] = {
currentCity: weatherArr[0]["currentCity"],
pm25: weatherArr[0]["pm25"],
date: weatherArr[0]["weather_data"][0]["date"],
temperature: weatherArr[0]["weather_data"][0]["temperature"],
weatherDesc: weatherArr[0]["weather_data"][0]["weather"],
wind: weatherArr[0]["weather_data"][0]["wind"]
};
otherparam.success(outputRes);
} else {
otherparam.fail({
errMsg: res["message"],
statusCode: res["status"]
});
}
},
fail(data) {
otherparam.fail(data);
}
});
}
let locationfail = function (result) {
otherparam.fail(result);
}
let locationcomplete = function (result) {
}
if (!param["location"]) {
that.getWXLocation(type, locationsuccess, locationfail, locationcomplete);
} else {
let longitude = param.location.split(',')[0];
let latitude = param.location.split(',')[1];
let errMsg = 'input location';
let res = {
errMsg: errMsg,
latitude: latitude,
longitude: longitude
};
locationsuccess(res);
}
}
}
module.exports.BMapWX = BMapWX;

View File

@ -0,0 +1,174 @@
// pages/activity/activity.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
dataList: [],
areaList: [],
typeList: [],
pages: {
page: 1,
rows: 5,
activityType: ''
}
},
//获取活动分类
getActivityTypeList() {
var _self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dictionaryself/listdictionarybyparentidrelease/e36ad682-c6b4-44fe-a05c-889a5ff7c284', []),
null, null,
function (code, data) {
_self.setData({
typeList: data,
'pages.activityType': data[0].dataId
})
_self.getActivityList()
},
function (err) {
}
);
},
getAreaList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/dictionaryself/listdictionarybyparentidrelease/e36ad682-c6b4-44fe-a05c-889a5ff7c284', []),
self.data.pages, null,
function (code, data) {
if (code == '200') {
self.setData({
areaList: data,
})
}
}
)
},
changeArea: function (e) {
app.dialog.loading('正在加载');
console.log(e)
this.setData({
'pages.activityType': e.currentTarget.dataset.dataid
})
this.getActivityList()
},
loadAll: function () {
this.setData({
'pages.county': ''
})
this.getActivityList()
},
goDetail: function (e) {
var id = e.currentTarget.dataset.id;
wx.navigateTo({
url: '../activityDetail/activityDetail?id=' + id
})
},
getActivityList: function () {
var self = this;
app.restAjax.get(app.restAjax.path(app.activityUrl + '/app/activitylibrary/listpageactivitylibraryfornetrelease/{areaCode}', [app.areaCode]),
self.data.pages, null,
function (code, data) {
console.log(code + "===" + data)
if ('200' == code) {
for (var item of data.rows) {
if ('' != item.activityImage) {
item.activityImage = app.activityUrl + '/route/file/download/true/' + item.activityImage;
}
}
if (1 === self.data.pages.page) {
self.setData({
dataList: data.rows,
})
} else {
if (data.rows.length == 0) {
self.setData({
[`pages.page`]: self.data.pages.page - 1
})
app.dialog.msg('暂无更多')
return false;
}
self.setData({
dataList: data.rows.concat(self.data.dataList),
})
}
}
},
function () {
},
function () {
wx.hideNavigationBarLoading(); //完成停止加载图标
wx.stopPullDownRefresh();
wx.hideLoading();
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getActivityTypeList()
// this.getActivityList();
// this.getAreaList()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// 在标题栏中显示加载图标
wx.showNavigationBarLoading();
var self = this;
self.setData({
[`pages.page`]: 1,
dataList: []
})
this.getActivityList();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,5 @@
{
"usingComponents": {},
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}

View File

@ -0,0 +1,23 @@
<view class="area">
<!-- <view class="area-box {{'' == pages.county?'active': ''}}" bindtap="loadAll">全部</view> -->
<view class="area-box {{item.dataId == pages.activityType? 'active' : ''}}" wx:for="{{typeList}}" wx:key="index" data-dataId="{{item.dataId}}" bindtap="changeArea">{{item.dataName}}</view>
</view>
<view class="activity">
<view class="activity-box" bindtap="goDetail" data-id="{{item.activityLibraryId}}" wx:for="{{dataList}}" wx:key="index">
<view class="activity-img">
<image src="{{item.activityImage}}"></image>
</view>
<view class="activity-info">
<view class="title">
<view class="activity-title">{{item.activityTitle}}</view>
<view class="sign" wx:if="{{item.activityState == '3'}}">报名中</view>
<view class="sign" wx:if="{{item.activityState == '4'}}">报名人数已满</view>
<view class="sign" wx:if="{{item.activityState == '5'}}">停止报名</view>
<view class="sign" wx:if="{{item.activityState == '6'}}">进行中</view>
<view class="sign" wx:if="{{item.activityState == '7'}}">直接进入</view>
<view class="sign" wx:if="{{item.activityState == '99'}}">已结束</view>
</view>
<view class="date">{{item.activityStartTime}}至{{item.activityEndTime}}</view>
</view>
</view>
</view>

View File

@ -0,0 +1,105 @@
.activity {
padding: 20rpx 30rpx 0;
margin-top: 80rpx;
}
.activity-box {
margin-bottom: 20rpx;
box-shadow: 0px 0px 17rpx 0px rgba(0, 0, 0, 0.1);
border-radius: 10rpx;
overflow: hidden;
}
.activity-img {
height: 320rpx;
position: relative;
}
.activity-img image {
width: 100%;
height: 100%;
}
.corner {
position: absolute;
top: 20rpx;
right: 20rpx;
display: flex;
color: #fff;
}
.corner view {
padding: 0 10rpx;
background: rgba(0, 0, 0, 0.6);
line-height: 40rpx;
vertical-align: middle;
display: flex;
align-items: center;
border-radius: 5rpx;
}
.view-count {
margin-right: 20rpx;
}
.view-count image {
width: 40rpx;
height: 40rpx;
}
.activity-info {
padding: 15rpx 20rpx;
}
.title {
display: flex;
justify-content: space-between;
}
.activity-title {
width: 70%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
font-size: 32rpx;
color: #242424;
line-height: 40rpx;
}
.sign {
background: rgba(159, 21, 18, .1);
color: #9F1512;
border-radius: 10rpx;
padding: 0 20rpx;
line-height: 40rpx;
font-size: 28rpx;
}
.date {
margin-top: 10rpx;
font-size: 24rpx;
color: #242424;
}
.area {
position: fixed;
top: 0;
left: 0;
right: 0;
height: 80rpx;
white-space: nowrap;
overflow-x: auto;
box-shadow: 10rpx 10rpx 5rpx #f2f2f2;
}
.area-box {
display: inline-block;
width: 25%;
line-height: 80rpx;
text-align: center;
font-size: 30rpx;
}
.area-box.active {
color: #9F1512;
}

View File

@ -0,0 +1,144 @@
// pages/activityDetail/activityDetail.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
activityUrl: app.activityUrl,
dataMap: {},
token: ''
},
getToken: function () {
var self = this;
return new Promise(resolve => {
wx.getStorage({
key: 'token',
success(res) {
self.setData({
token: res.data
})
return resolve();
}
})
})
},
goSign: function (e) {
var activityId = e.currentTarget.dataset.id;
wx.navigateTo({
url: '../activitySign/activitySign?id=' + activityId
})
},
cancel: function (e) {
var activityId = e.currentTarget.dataset.id;
app.restAjax.get(app.restAjax.path(app.activityUrl + '/app/activityuserapply/cancelapply/' + activityId, []),
{}, {
headers: {
token: self.data.token
}
}, function (code, data) {
if ('200' == code) {
wx.navigateTo({
url: '../activityDetail/activityDetail?id=' + activityId
})
}
}, function () {
}, function () {
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var self = this;
this.getToken().then(result => {
var url;
var id = options.id;
if (!self.data.token) {
url = '/app/activitylibrary/getactivitylibrarybyidrelease/' + id;
self.setData({
token: null
})
} else {
url = '/app/activitylibrary/getactivitylibrarybyid/' + id
self.getToken()
}
app.restAjax.get(app.restAjax.path(app.activityUrl + url, []), {}, {
headers: {
token: self.data.token
}
}, function (code, data) {
data.activityImageArray = data.activityImage.split(',');
self.setData({
dataMap: data
})
}, function (code, data) {
app.dialog.msg(data.msg);
});
})
this.saveBigdata(options.id);
},
saveBigdata(id) {
var params = "小程序" + id + "活动";
var info = {
requestUrl: params
}
app.restAjax.get(app.restAjax.path(app.bigDataUrl + '/app/contentcensusrelease/log', []), info, null,
function (code, data) {
}, function (code, err) {
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@ -0,0 +1,53 @@
<view class="activity-img">
<swiper indicator-dots="false" autoplay="true" >
<swiper-item class="swiper-item" wx:for="{{dataMap.activityImageArray}}" wx:for-index="idx" wx:for-item="item" wx:key="activityImageArray">
<image src="{{activityUrl}}/route/file/download/true/{{item}}"></image>
</swiper-item>
</swiper>
</view>
<view class="activity-detail">
<view class="activity-title">{{dataMap.activityTitle}}</view>
<view class="activity-info">
<view class="activity-text">
<image src="../../images/people.png"></image>
<text>活动人数:</text>
{{dataMap.activityUserNum }}
</view>
<view class="activity-text">
<image src="../../images/time.png"></image>
<text>活动时间:</text>
{{dataMap.activityStartTime}}至{{dataMap.activityEndTime}}
</view>
<view class="activity-text">
<image src="../../images/people.png"></image>
<text>活动地址:</text>
{{dataMap.activityAddress }}
</view>
</view>
<view class="activity-container">
<view class="part">
<view class="part-title">活动详情</view>
<rich-text class="part-content" nodes="{{dataMap.activityDetails}}"></rich-text>
</view>
<view class="part">
<view class="part-title">活动单位</view>
<view class="part-content">
<view class="part-info">
<text>主办单位:</text>{{dataMap.activitySponsor}}
</view>
<view class="part-info">
<text>承办单位:</text>{{dataMap.activityOrganizer}}
</view>
<view class="part-info">
<text>协办单位:</text>{{dataMap.activityCoOrganizer}}
</view>
</view>
</view>
</view>
</view>
<view class="sign-box" bindtap="goSign" data-id="{{dataMap.activityLibraryId}}" wx-if="{{dataMap.activityState == '3'}}">
<view class="sign-btn">报名</view>
</view>
<!-- <view class="sign-box" bindtap="cancel" data-id="{{dataMap.activityLibraryId}}" wx-if="{{dataMap.activityState != '6' && dataMap.activityState != '7' && dataMap.activityState != '99' && dataMap.isEnroll != ''}}">
<view class="sign-btn">取消报名</view>
</view> -->

View File

@ -0,0 +1,91 @@
.activity-img, .activity-img image{
width: 100%;
height: 480rpx;
}
swiper {
height: 100%;
}
.activity-detail{
position: absolute;
left: 0;
right: 0;
top: 430rpx;
background: #fff;
border-radius:30rpx 30rpx 0px 0px;
overflow: hidden;
padding-bottom: 120rpx;
}
.activity-title, .activity-info{
padding: 30rpx;
font-size: 32rpx;
color: #242424;
border-bottom: 5px solid #FBFBFB;
}
.activity-text{
line-height: 35rpx;
font-size: 28rpx;
margin-bottom: 15rpx;
}
.activity-text:last-child{
margin-bottom: 0;
}
.activity-info image{
width: 35rpx;
height: 35rpx;
margin-right: 10rpx;
vertical-align: middle;
margin-top: -5rpx;
}
.activity-text text{
color: #BBBBBB;
}
.activity-container{
padding: 30rpx;
}
.part{
margin-bottom: 30rpx;
}
.part:last-child{
margin-bottom: 0;
}
.part-title{
border-left: 3px solid #9F1512;
color: #242424;
padding-left: 10rpx;
font-size: 30rpx;
margin-bottom: 10rpx;
}
.part-content{
font-size: 28rpx;
line-height: 40rpx;
}
.part-info{
line-height: 50rpx;
color: #242424;
font-size: 28rpx;
}
.part-info text{
color: #BBBBBB;
}
.sign-box{
position: fixed;
bottom: 0;
left: 0;
right: 0;
box-shadow:0px 0px 17px 0px rgba(0,0,0,0.1);
height: 120rpx;
padding: 20rpx 30rpx;
box-sizing: border-box;
background: #fff;
}
.sign-btn{
width: 100%;
height: 100%;
background: #9F1512;
border-radius: 10rpx;
display: flex;
justify-content: center;
align-items: center;
font-size: 30rpx;
color: #fff;
}

View File

@ -0,0 +1,156 @@
// pages/activityDialog/activityDialog.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
token: '',
serviceId: '',
pages: {
page: 1,
rows: 5
},
dataList: {},
status: ''
},
getToken: function() {
var self = this;
return new Promise(resolve =>{
wx.getStorage({
key: 'token',
success(res) {
self.setData({
token: res.data
})
return resolve();
}
})
})
},
getActivityHis: function() {
var self = this;
app.restAjax.get(app.restAjax.path(app.volunteerUrl + '/app/teamactivityhis/listpageteamactivityhis?serviceId=' + self.data.serviceId, []),
self.data.pages, {
headers: {
token: self.data.token
}
}, function(code, data) {
if('200' == code) {
var photos = [];
for(var item of data.rows) {
if('' != item.photo) {
item.photo = app.volunteerUrl + '/route/file/download/true/' + item.photo;
}
if('' != item.photos) {
var photoArr = item.photos.split(",");
for(var i=0; i<photoArr.length; i++) {
photoArr[i] = app.volunteerUrl + '/route/file/download/true/' + photoArr[i];
}
item.photos = photoArr
}
if('' != item.videos) {
var videoArr = item.videos.split(",");
for(var i=0; i<videoArr.length; i++) {
videoArr[i] = app.volunteerUrl + '/route/file/download/true/' + videoArr[i];
}
item.videos = videoArr
}
}
if(1 === self.data.pages.page) {
self.setData({
dataList: data.rows
})
console.log(self.data.dataList)
}else {
if(data.rows.length == 0) {
self.setData({
[`pages.page`] : self.data.pages.page - 1
})
app.dialog.msg('暂无更多')
return false;
}
self.setData({
dataList: data.rows.concat(self.data.dataList)
})
}
}
}, function() {
}, function() {
wx.hideNavigationBarLoading(); //完成停止加载图标
wx.stopPullDownRefresh();
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var self = this;
self.setData({
serviceId: options.serviceId,
status: options.status
})
this.getToken().then(result => {
this.getActivityHis()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// 在标题栏中显示加载图标
wx.showNavigationBarLoading();
var self = this;
self.setData({
[`pages.page`] : self.data.pages.page + 1
})
console.log(self.data.pages)
this.getActivityHis();
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

View File

@ -0,0 +1,5 @@
{
"usingComponents": {},
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}

View File

@ -0,0 +1,24 @@
<view class="dialog">
<view class="dialog-box" wx:if="{{dataList < 1}}">
暂无评论
</view>
<view class="dialog-box" wx:for="{{dataList}}">
<view class="avatar">
<image wx:if="{{item.photo}}" src="{{item.photo}}"></image>
<image wx:else src="../../images/avatar.png"></image>
</view>
<view class="user-info">
<view class="name">{{item.volunteerName}}</view>
<view class="content">{{item.content}}</view>
<view class="content" wx:if="{{item.photos}}">
<image wx:for="{{item.photos}}" wx:for-item="subItem" src="{{subItem}}"></image>
</view>
<view class="content" wx:if="{{item.videos}}">
<video wx:for="{{item.videos}}" wx:for-item="subItem" src="{{subItem}}"></video>
</view>
<view class="public-time">
<view class="time">{{item.uploadTime}}</view>
</view>
</view>
</view>
</view>

Some files were not shown because too many files have changed in this diff Show More