完成公众号
This commit is contained in:
parent
859d40a127
commit
fb920b2ff8
125
app.js
125
app.js
@ -4,67 +4,70 @@ 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: '540200000000',
|
||||
areaName: '日喀则市',
|
||||
areaId: '640675',
|
||||
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,
|
||||
onLaunch: function () {
|
||||
// 展示本地存储能力
|
||||
var logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
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: '540200000000',
|
||||
areaName: '日喀则市',
|
||||
areaId: '640675',
|
||||
appId: 'wxa5c5246b283713de',
|
||||
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
|
||||
// 登录
|
||||
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: []
|
||||
}
|
||||
// 由于 getUserInfo 是网络请求,可能会在 Page.onLoad 之后才返回
|
||||
// 所以此处加入 callback 以防止这种情况
|
||||
if (this.userInfoReadyCallback) {
|
||||
this.userInfoReadyCallback(res)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
globalData: {
|
||||
userInfo: null,
|
||||
curLat: -1,
|
||||
curLng: -1,
|
||||
carList: [],
|
||||
isPublic: false,//是否关注了公众号
|
||||
}
|
||||
})
|
3
app.json
3
app.json
@ -38,7 +38,8 @@
|
||||
"pages/myVolunteerTeam/myVolunteerTeam",
|
||||
"pages/myVolunteerActivity/myVolunteerActivity",
|
||||
"pages/serviceActivityDetail/serviceActivityDetail",
|
||||
"pages/shop/shopcategory"
|
||||
"pages/shop/shopcategory",
|
||||
"pages/commonQrCode/commonQrCode"
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
|
BIN
images/app_logo.png
Normal file
BIN
images/app_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
@ -64,7 +64,7 @@ Page({
|
||||
// 上传
|
||||
uploadAvatar: function (avatarId) {
|
||||
var self = this
|
||||
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/updateuseravatar', [app.usercenterUrl]), {
|
||||
app.restAjax.put(app.restAjax.path('{usercenterUrl}/app/user/update-avatar', [app.usercenterUrl]), {
|
||||
avatar: avatarId
|
||||
}, {
|
||||
headers: {
|
||||
@ -246,6 +246,11 @@ Page({
|
||||
})
|
||||
self.getUserInfo()
|
||||
app.dialog.msg('绑定成功');
|
||||
},function(code,error){
|
||||
self.setData({
|
||||
isLoading: false
|
||||
})
|
||||
app.dialog.msg(error.msg)
|
||||
})
|
||||
} else {
|
||||
self.setData({
|
||||
|
@ -3,7 +3,7 @@
|
||||
</view>
|
||||
<view class="page-container">
|
||||
<view class="person">
|
||||
<view class="user-avatar" bindtap="changeAvatar" wx:if="{{userInfo.avatar}}">
|
||||
<view class="user-avatar" bindtap="changeAvatar" >
|
||||
<image src="{{usercenterUrl}}{{sourcePath}}{{userInfo.avatar}}"></image>
|
||||
</view>
|
||||
<view class="user-name">{{userInfo.name}}</view>
|
||||
|
98
pages/commonQrCode/commonQrCode.js
Normal file
98
pages/commonQrCode/commonQrCode.js
Normal file
@ -0,0 +1,98 @@
|
||||
// subpages/commonQrCode.js
|
||||
const app = getApp();
|
||||
var socket = null;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
title: '日喀则市公共数字文化云',
|
||||
desc: '开展新闻资讯、场馆导航、场馆预定、活动预约、艺术普及、在线培训、电子图书、文化点单、直播活动等。',
|
||||
hint: '扫描或长按识别上面二维码进行关注公众号',
|
||||
imgSrc: '',
|
||||
userId: '',
|
||||
urls: app.wssUrl,
|
||||
userName: '码',
|
||||
hideloading: false,
|
||||
},
|
||||
onLoad(options) {
|
||||
console.log(options)
|
||||
wx.setNavigationBarTitle({
|
||||
title: '公众号关注',
|
||||
});
|
||||
wx.setNavigationBarColor({
|
||||
backgroundColor: '#ededed',
|
||||
frontColor: '#000000',
|
||||
})
|
||||
var userId = "";
|
||||
if (options && JSON.stringify(options) !== '{}') {
|
||||
var keys = Object.keys(options)
|
||||
var values = keys[0].split("=");
|
||||
userId = values[1];
|
||||
this.setData({
|
||||
userId: userId
|
||||
})
|
||||
} else {
|
||||
userId = app.globalData.userInfo.userId;
|
||||
this.setData({
|
||||
userId: userId
|
||||
})
|
||||
this.startWebSocket();
|
||||
}
|
||||
this.getCodeImg(userId);
|
||||
},
|
||||
startWebSocket() {
|
||||
var _self = this;
|
||||
socket = wx.connectSocket({
|
||||
url: _self.data.urls + '/app/wxeventrelease/' + _self.data.userId,
|
||||
success(res) {
|
||||
console.log(res)
|
||||
}
|
||||
});
|
||||
socket.onMessage(function (e) {
|
||||
console.log(e)
|
||||
if (e.data) {
|
||||
var data = JSON.parse(e.data);
|
||||
_self.prePage(data.attention)
|
||||
}
|
||||
});
|
||||
},
|
||||
prePage(e) {
|
||||
console.log(e)
|
||||
app.globalData.isPublic = e
|
||||
var pages = getCurrentPages();
|
||||
var prePage = pages[pages.length - 2]
|
||||
prePage.setData({
|
||||
isPublic: e
|
||||
});
|
||||
wx.navigateBack()
|
||||
},
|
||||
onUnload() {
|
||||
if (socket != null) {
|
||||
socket.close({
|
||||
code: 1000
|
||||
});
|
||||
}
|
||||
},
|
||||
getCodeImg(id) {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/wxopen/qrcoderelease/{userId}', [app.usercenterUrl, id]), {}, {
|
||||
|
||||
}, function (code, data) {
|
||||
_self.setData({
|
||||
imgSrc: data,
|
||||
hideloading: true
|
||||
})
|
||||
|
||||
}, function (code, data) {
|
||||
_self.setData({
|
||||
hideloading: true
|
||||
})
|
||||
app.dialog.msg(data.msg);
|
||||
})
|
||||
},
|
||||
onShow() {
|
||||
|
||||
},
|
||||
})
|
3
pages/commonQrCode/commonQrCode.json
Normal file
3
pages/commonQrCode/commonQrCode.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
15
pages/commonQrCode/commonQrCode.wxml
Normal file
15
pages/commonQrCode/commonQrCode.wxml
Normal file
@ -0,0 +1,15 @@
|
||||
<view class="page" wx:if="{{hideloading}}">
|
||||
<view class="box">
|
||||
<view class="title-box">
|
||||
<image class="title-icon" src="/images/app_logo.png" mode="scaleToFill"></image>
|
||||
<view class="title-content">
|
||||
<view class="title-txt">{{title}}</view>
|
||||
<view class="title-des">{{desc}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<image class="img" src="{{imgSrc}}" mode="scaleToFill" show-menu-by-longpress="{{true}}"></image>
|
||||
<view class="hint">{{hint}}</view>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<page-loading wx:else></page-loading>
|
80
pages/commonQrCode/commonQrCode.wxss
Normal file
80
pages/commonQrCode/commonQrCode.wxss
Normal file
@ -0,0 +1,80 @@
|
||||
/* subpages/commonQrCode.wxss */
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: #ededed;
|
||||
}
|
||||
|
||||
.page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
/* justify-content: center; */
|
||||
}
|
||||
|
||||
.box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 200rpx;
|
||||
width: 80%;
|
||||
background-color: white;
|
||||
border-radius: 20rpx;
|
||||
height: auto;
|
||||
padding: 20rpx;
|
||||
box-shadow: 3rpx 3rpx 30rpx #e7e7e7;
|
||||
}
|
||||
|
||||
.title-box {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title-icon {
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
}
|
||||
|
||||
.title-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
width: 75%;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.title-txt {
|
||||
font-size: 35rpx;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.title-des {
|
||||
font-size: 20rpx;
|
||||
color: #6b6b6b;
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
overflow: hidden;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.img {
|
||||
margin-top: 20rpx;
|
||||
width: 500rpx;
|
||||
height: 500rpx;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin-top: 20rpx;
|
||||
font-size: 24rpx;
|
||||
color: #858585;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
@ -1,382 +1,410 @@
|
||||
var app = getApp();
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
randomName: true,
|
||||
showPhone: true,
|
||||
gotCode: false,
|
||||
restTime: 120,
|
||||
timer: '',
|
||||
indicatorDots: true,
|
||||
autoplay: true,
|
||||
token: '',
|
||||
news: {
|
||||
newsUrl: app.newsUrl,
|
||||
bannerList: [],
|
||||
newsList: []
|
||||
},
|
||||
venue: {
|
||||
venueUrl: app.venueUrl,
|
||||
venueList: []
|
||||
},
|
||||
activity: {
|
||||
activityUrl: app.activityUrl,
|
||||
activityList: []
|
||||
},
|
||||
live: {
|
||||
liveUrl: app.liveUrl,
|
||||
liveList: []
|
||||
},
|
||||
usercenterUrl: app.usercenterUrl,
|
||||
bigDataUrl: app.bigDataUrl,
|
||||
isConfirm: false,
|
||||
mainFuncList: [],
|
||||
mainNewTab: [],
|
||||
isHide: true
|
||||
},
|
||||
doLogin: function () {
|
||||
var self = this;
|
||||
wx.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
wx.setStorageSync('token', 'REQ5NW5IZTZjS2ZyQU9QQmFKZ1FIRmVhbjNFZmV4dEx3emdob2g5UjVXaForWGdpOHFIRWgyTWRIelJFWkhNS28wN1hUV2Uwb0FKSUEra2wzYVhXdnI4aG9odkxLd3ZFUGkrTTQwQTkzdyt3cnN3NkY4OE9aaGw0aUJPTUNSaENKbGxTdm8xR3Z5WTJBV0NDcWRpbEd3OW0zUzA3US8xMmUyaTU2a0N4YmN5d1FjTXd6aTZIZkhhdmpsSDlqYSt0OUJVUHRSbTJqSVd6eHlYc1M5WTlkK015MVR2R083T3crU2wrdVFmVGk4N3NHWmZNY1A3SGNNbm8xMDFMTy9tcTN2K0NuQTZJbk9YZGJqK3drQkxlMXNUVjZZNkZyRE9LMGdYdUQzSE9lbDQ9');
|
||||
app.restAjax.post(app.restAjax.path('{url}/wechat-miniapp/sign/default', [app.loginUrl]), {
|
||||
jsCode: res.code
|
||||
}, null, function (code, data) {
|
||||
console.log(data)
|
||||
var tokenArray = data.data.split('_');
|
||||
var token = tokenArray[0];
|
||||
var isRandomUsername = tokenArray[1];
|
||||
self.setData({
|
||||
token: token
|
||||
})
|
||||
wx.setStorageSync('token', token);
|
||||
wx.setStorageSync('isRandomUsername', isRandomUsername)
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
} else {
|
||||
console.log(res)
|
||||
app.dialog.msg('登录失败!' + res.errMsg);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
//获取首页功能
|
||||
getMainFunc() {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newsdirectories/list/areamenu/release/{areaCode}', [_self.data.news.newsUrl, app.areaCode]),
|
||||
null,
|
||||
null,
|
||||
function (code, data) {
|
||||
console.log(data)
|
||||
_self.setData({
|
||||
mainFuncList: data
|
||||
})
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
//获取首页新闻动态
|
||||
getMainNewsTab() {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newsdirectories/listsub/areaauth/release/{newsDirectoriesId}/{areaCode}', [_self.data.news.newsUrl, '0', app.areaCode]),
|
||||
null,
|
||||
null,
|
||||
function (code, data) {
|
||||
if (data && data.length > 0) {
|
||||
_self.setData({
|
||||
mainNewTab: data
|
||||
})
|
||||
data.forEach(el => {
|
||||
_self.doGetNewsList(el.newsDirectoriesId);
|
||||
});
|
||||
}
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
//获取新闻
|
||||
doGetNewsList(id) {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease/{areaCode}', [_self.data.news.newsUrl, app.areaCode]), {
|
||||
newsDirectoriesId: "",
|
||||
newsDirectoriesParentId: id,
|
||||
page: 1,
|
||||
rows: 5
|
||||
}, null, function (code, data) {
|
||||
_self.data.mainNewTab.forEach(el => {
|
||||
if (el.newsDirectoriesId == id) {
|
||||
el.newsList = data.rows
|
||||
}
|
||||
});
|
||||
_self.setData({
|
||||
mainNewTab: _self.data.mainNewTab
|
||||
})
|
||||
}, function (code, data) {
|
||||
console.log(data)
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
doGetBanner: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease/{areaCode}', [self.data.news.newsUrl, app.areaCode]), {
|
||||
newsDirectoriesId: 'eab0ca3c-d35d-4c02-9397-ace2bdd10fc1',
|
||||
page: 1,
|
||||
rows: 5
|
||||
}, null, function (code, data) {
|
||||
self.setData({
|
||||
'news.bannerList': data.rows
|
||||
})
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
doGetVenueList: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesinfo/listpagevenuesinforelease/{areaCode}', [self.data.venue.venueUrl, app.areaCode]), {
|
||||
page: 1,
|
||||
rows: 3,
|
||||
latitude: app.globalData.curLat,
|
||||
longitude: app.globalData.curLng,
|
||||
orderKey: "",
|
||||
}, null, function (code, data) {
|
||||
for (var i = 0, item; item = data.rows[i++];) {
|
||||
item.venuePanoramaArray = item.venuePanorama.split(',');
|
||||
}
|
||||
self.setData({
|
||||
'venue.venueList': data.rows
|
||||
});
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
//加载活动图片错误
|
||||
loadImgErr(e) {
|
||||
console.log(e)
|
||||
var index = e.currentTarget.dataset.index
|
||||
this.data.activity.activityList[index].activityImageArray.unshift("03c2ea0d-87ad-43db-bba0-ae6b4f827dba")
|
||||
this.setData({
|
||||
activity: this.data.activity
|
||||
})
|
||||
},
|
||||
//加载轮播图错误
|
||||
loadBannerErr(e) {
|
||||
var index = e.currentTarget.dataset.index
|
||||
this.data.news.bannerList[index].newsContentCoverList.unshift('03c2ea0d-87ad-43db-bba0-ae6b4f827dba')
|
||||
this.setData({
|
||||
news: this.data.news
|
||||
})
|
||||
},
|
||||
doGetActivityList: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{activityUrl}/app/activitylibrary/listpageactivitylibraryfornetrelease/{areaCode}', [self.data.activity.activityUrl, app.areaCode]), {
|
||||
page: 1,
|
||||
rows: 3
|
||||
}, null, function (code, data) {
|
||||
console.log(data);
|
||||
for (var i = 0, item; item = data.rows[i++];) {
|
||||
item.activityImageArray = item.activityImage.split(',');
|
||||
}
|
||||
self.setData({
|
||||
'activity.activityList': data.rows
|
||||
});
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
// doGetNewsList: function () {
|
||||
// var self = this;
|
||||
// app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease', [self.data.news.newsUrl]), {
|
||||
// newsDirectoriesParentId: 'f497904b-7727-4832-891c-604c36ae4167',
|
||||
// page: 1,
|
||||
// rows: 5
|
||||
// }, null, function (code, data) {
|
||||
// self.setData({
|
||||
// 'news.newsList': data.rows
|
||||
// })
|
||||
// }, function (code, data) {
|
||||
// app.dialog.msg(data.msg);
|
||||
// });
|
||||
// },
|
||||
doGetLiveList: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liveplan/listpageliveplanrelease', [self.data.live.liveUrl]), {
|
||||
page: 1,
|
||||
rows: 4
|
||||
}, null, function (code, data) {
|
||||
self.setData({
|
||||
'live.liveList': data.rows
|
||||
})
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
randomName: true,
|
||||
showPhone: true,
|
||||
gotCode: false,
|
||||
restTime: 120,
|
||||
timer: '',
|
||||
indicatorDots: true,
|
||||
autoplay: true,
|
||||
token: '',
|
||||
news: {
|
||||
newsUrl: app.newsUrl,
|
||||
bannerList: [],
|
||||
newsList: []
|
||||
},
|
||||
venue: {
|
||||
venueUrl: app.venueUrl,
|
||||
venueList: []
|
||||
},
|
||||
activity: {
|
||||
activityUrl: app.activityUrl,
|
||||
activityList: []
|
||||
},
|
||||
live: {
|
||||
liveUrl: app.liveUrl,
|
||||
liveList: []
|
||||
},
|
||||
usercenterUrl: app.usercenterUrl,
|
||||
bigDataUrl: app.bigDataUrl,
|
||||
isConfirm: false,
|
||||
mainFuncList: [],
|
||||
mainNewTab: [],
|
||||
isHide: true
|
||||
},
|
||||
doLogin: function () {
|
||||
var self = this;
|
||||
wx.login({
|
||||
success(res) {
|
||||
if (res.code) {
|
||||
app.restAjax.post(app.restAjax.path('{url}/wechat-miniapp/sign/default-multi', [app.loginUrl]), {
|
||||
jsCode: res.code,
|
||||
appKey: app.appId
|
||||
}, null, function (code, data) {
|
||||
console.log(data)
|
||||
var tokenArray = data.data.split('_');
|
||||
var token = tokenArray[0];
|
||||
var isRandomUsername = tokenArray[1];
|
||||
self.setData({
|
||||
token: token
|
||||
})
|
||||
wx.setStorageSync('token', token);
|
||||
wx.setStorageSync('isRandomUsername', isRandomUsername)
|
||||
//获取UserID
|
||||
self.getUserInfo();
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
} else {
|
||||
console.log(res)
|
||||
app.dialog.msg('登录失败!' + res.errMsg);
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
// getUserInfo(){
|
||||
// var _self= this;
|
||||
// // app/wxopen/qrcoderelease/{userId}
|
||||
// app.restAjax.get(app.restAjax.path('{newsUrl}/app/user/get-app-user'),[_self.data.news.newsUrl]),
|
||||
// null,
|
||||
// null,
|
||||
// function(code,data){
|
||||
// console.log(data)
|
||||
// },
|
||||
// function(code,error){
|
||||
// app.dialog.msg(error.msg);
|
||||
// }
|
||||
// },
|
||||
//获取首页功能
|
||||
getMainFunc() {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newsdirectories/list/areamenu/release/{areaCode}', [_self.data.news.newsUrl, app.areaCode]),
|
||||
null,
|
||||
null,
|
||||
function (code, data) {
|
||||
console.log(data)
|
||||
_self.setData({
|
||||
mainFuncList: data
|
||||
})
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
//获取首页新闻动态
|
||||
getMainNewsTab() {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newsdirectories/listsub/areaauth/release/{newsDirectoriesId}/{areaCode}', [_self.data.news.newsUrl, '0', app.areaCode]),
|
||||
null,
|
||||
null,
|
||||
function (code, data) {
|
||||
if (data && data.length > 0) {
|
||||
_self.setData({
|
||||
mainNewTab: data
|
||||
})
|
||||
data.forEach(el => {
|
||||
_self.doGetNewsList(el.newsDirectoriesId);
|
||||
});
|
||||
}
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
//获取新闻
|
||||
doGetNewsList(id) {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease/{areaCode}', [_self.data.news.newsUrl, app.areaCode]), {
|
||||
newsDirectoriesId: "",
|
||||
newsDirectoriesParentId: id,
|
||||
page: 1,
|
||||
rows: 5
|
||||
}, null, function (code, data) {
|
||||
_self.data.mainNewTab.forEach(el => {
|
||||
if (el.newsDirectoriesId == id) {
|
||||
el.newsList = data.rows
|
||||
}
|
||||
});
|
||||
_self.setData({
|
||||
mainNewTab: _self.data.mainNewTab
|
||||
})
|
||||
}, function (code, data) {
|
||||
console.log(data)
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
doGetBanner: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease/{areaCode}', [self.data.news.newsUrl, app.areaCode]), {
|
||||
newsDirectoriesId: 'eab0ca3c-d35d-4c02-9397-ace2bdd10fc1',
|
||||
page: 1,
|
||||
rows: 5
|
||||
}, null, function (code, data) {
|
||||
self.setData({
|
||||
'news.bannerList': data.rows
|
||||
})
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
doGetVenueList: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{venueUrl}/app/venuesinfo/listpagevenuesinforelease/{areaCode}', [self.data.venue.venueUrl, app.areaCode]), {
|
||||
page: 1,
|
||||
rows: 3,
|
||||
latitude: app.globalData.curLat,
|
||||
longitude: app.globalData.curLng,
|
||||
orderKey: "",
|
||||
}, null, function (code, data) {
|
||||
for (var i = 0, item; item = data.rows[i++];) {
|
||||
item.venuePanoramaArray = item.venuePanorama.split(',');
|
||||
}
|
||||
self.setData({
|
||||
'venue.venueList': data.rows
|
||||
});
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
//加载活动图片错误
|
||||
loadImgErr(e) {
|
||||
console.log(e)
|
||||
var index = e.currentTarget.dataset.index
|
||||
this.data.activity.activityList[index].activityImageArray.unshift("03c2ea0d-87ad-43db-bba0-ae6b4f827dba")
|
||||
this.setData({
|
||||
activity: this.data.activity
|
||||
})
|
||||
},
|
||||
//加载轮播图错误
|
||||
loadBannerErr(e) {
|
||||
var index = e.currentTarget.dataset.index
|
||||
this.data.news.bannerList[index].newsContentCoverList.unshift('03c2ea0d-87ad-43db-bba0-ae6b4f827dba')
|
||||
this.setData({
|
||||
news: this.data.news
|
||||
})
|
||||
},
|
||||
doGetActivityList: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{activityUrl}/app/activitylibrary/listpageactivitylibraryfornetrelease/{areaCode}', [self.data.activity.activityUrl, app.areaCode]), {
|
||||
page: 1,
|
||||
rows: 3
|
||||
}, null, function (code, data) {
|
||||
console.log(data);
|
||||
for (var i = 0, item; item = data.rows[i++];) {
|
||||
item.activityImageArray = item.activityImage.split(',');
|
||||
}
|
||||
self.setData({
|
||||
'activity.activityList': data.rows
|
||||
});
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
// doGetNewsList: function () {
|
||||
// var self = this;
|
||||
// app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease', [self.data.news.newsUrl]), {
|
||||
// newsDirectoriesParentId: 'f497904b-7727-4832-891c-604c36ae4167',
|
||||
// page: 1,
|
||||
// rows: 5
|
||||
// }, null, function (code, data) {
|
||||
// self.setData({
|
||||
// 'news.newsList': data.rows
|
||||
// })
|
||||
// }, function (code, data) {
|
||||
// app.dialog.msg(data.msg);
|
||||
// });
|
||||
// },
|
||||
doGetLiveList: function () {
|
||||
var self = this;
|
||||
app.restAjax.get(app.restAjax.path('{liveUrl}/app/liveplan/listpageliveplanrelease', [self.data.live.liveUrl]), {
|
||||
page: 1,
|
||||
rows: 4
|
||||
}, null, function (code, data) {
|
||||
self.setData({
|
||||
'live.liveList': data.rows
|
||||
})
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
});
|
||||
},
|
||||
|
||||
goNewsDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../newsDetail/newsDetail?id=' + event.currentTarget.dataset.item.newsContentId
|
||||
})
|
||||
},
|
||||
openNewsDetail(e) {
|
||||
console.log(e.currentTarget.dataset.item)
|
||||
//判断是跳转到列表 详情 webview
|
||||
var item = e.currentTarget.dataset.item;
|
||||
if (item.directoriesView == '0') {
|
||||
//跳转webview
|
||||
wx.navigateTo({
|
||||
url: '/subpages/webcontentview/webcontent?url=' + item.directoriesTarget2,
|
||||
})
|
||||
} else if (item.directoriesView == '1') {
|
||||
//跳转列表
|
||||
wx.navigateTo({
|
||||
url: '/pages/newsList/newsList?id=' + item.newsDirectoriesId,
|
||||
})
|
||||
} else {
|
||||
//跳转无二级页面
|
||||
wx.navigateTo({
|
||||
url: '/pages/newsList/newsList?id=' + item.newsDirectoriesId,
|
||||
})
|
||||
}
|
||||
},
|
||||
goNewsList: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../newsList/newsList?type=' + event.currentTarget.dataset.type,
|
||||
})
|
||||
},
|
||||
goVolunteer: function () {
|
||||
wx.navigateTo({
|
||||
url: '../volunteer/volunteer',
|
||||
})
|
||||
},
|
||||
goBroadcast: function () {
|
||||
wx.navigateTo({
|
||||
url: '../broadcast/broadcast',
|
||||
})
|
||||
},
|
||||
goVenue: function () {
|
||||
wx.switchTab({
|
||||
url: '../venue/venue',
|
||||
})
|
||||
},
|
||||
goVenueDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../venueDetail/venueDetail?venuesInfoId=' + event.currentTarget.dataset.venuesInfoId,
|
||||
})
|
||||
},
|
||||
goBroadcastDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../broadcastDetail/broadcastDetail?livePlanId=' + event.currentTarget.dataset.livePlanId,
|
||||
})
|
||||
},
|
||||
goActivity: function () {
|
||||
wx.switchTab({
|
||||
url: '../activity/activity',
|
||||
})
|
||||
},
|
||||
goActivityDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../activityDetail/activityDetail?id=' + event.currentTarget.dataset.activityLibraryId
|
||||
})
|
||||
},
|
||||
goHeritage: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/heritage/heritage',
|
||||
})
|
||||
},
|
||||
goCultureDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../cultureDetail/cultureDetail?libraryId=' + event.currentTarget.dataset.libraryId,
|
||||
})
|
||||
},
|
||||
// 获取用户信息
|
||||
getUserInfo: function () {
|
||||
var self = this
|
||||
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/user/getappuser', [app.usercenterUrl]), {}, {
|
||||
headers: {
|
||||
token: self.data.token
|
||||
}
|
||||
}, function (code, data) {
|
||||
self.setData({
|
||||
userInfo: data
|
||||
})
|
||||
self.doSaveLoginInfo(data.userId)
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
})
|
||||
},
|
||||
doSaveLoginInfo(id) {
|
||||
var params = "小程序USER" + id;
|
||||
var info = {
|
||||
requestUrl: params
|
||||
}
|
||||
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/contentcensusrelease/log', [app.bigDataUrl]), info, {
|
||||
goNewsDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../newsDetail/newsDetail?id=' + event.currentTarget.dataset.item.newsContentId
|
||||
})
|
||||
},
|
||||
openNewsDetail(e) {
|
||||
console.log(e.currentTarget.dataset.item)
|
||||
//判断是跳转到列表 详情 webview
|
||||
var item = e.currentTarget.dataset.item;
|
||||
if (item.directoriesView == '0') {
|
||||
//跳转webview
|
||||
wx.navigateTo({
|
||||
url: '/subpages/webcontentview/webcontent?url=' + item.directoriesTarget2,
|
||||
})
|
||||
} else if (item.directoriesView == '1') {
|
||||
//跳转列表
|
||||
wx.navigateTo({
|
||||
url: '/pages/newsList/newsList?id=' + item.newsDirectoriesId,
|
||||
})
|
||||
} else {
|
||||
//跳转无二级页面
|
||||
wx.navigateTo({
|
||||
url: '/pages/newsList/newsList?id=' + item.newsDirectoriesId,
|
||||
})
|
||||
}
|
||||
},
|
||||
goNewsList: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../newsList/newsList?type=' + event.currentTarget.dataset.type,
|
||||
})
|
||||
},
|
||||
goVolunteer: function () {
|
||||
wx.navigateTo({
|
||||
url: '../volunteer/volunteer',
|
||||
})
|
||||
},
|
||||
goBroadcast: function () {
|
||||
wx.navigateTo({
|
||||
url: '../broadcast/broadcast',
|
||||
})
|
||||
},
|
||||
goVenue: function () {
|
||||
wx.switchTab({
|
||||
url: '../venue/venue',
|
||||
})
|
||||
},
|
||||
goVenueDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../venueDetail/venueDetail?venuesInfoId=' + event.currentTarget.dataset.venuesInfoId,
|
||||
})
|
||||
},
|
||||
goBroadcastDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../broadcastDetail/broadcastDetail?livePlanId=' + event.currentTarget.dataset.livePlanId,
|
||||
})
|
||||
},
|
||||
goActivity: function () {
|
||||
wx.switchTab({
|
||||
url: '../activity/activity',
|
||||
})
|
||||
},
|
||||
goActivityDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../activityDetail/activityDetail?id=' + event.currentTarget.dataset.activityLibraryId
|
||||
})
|
||||
},
|
||||
goHeritage: function () {
|
||||
wx.navigateTo({
|
||||
url: '/pages/heritage/heritage',
|
||||
})
|
||||
},
|
||||
goCultureDetail: function (event) {
|
||||
wx.navigateTo({
|
||||
url: '../cultureDetail/cultureDetail?libraryId=' + event.currentTarget.dataset.libraryId,
|
||||
})
|
||||
},
|
||||
// 获取用户信息
|
||||
getUserInfo: function () {
|
||||
var self = this
|
||||
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/user/get-app-user', [app.usercenterUrl]), {}, {
|
||||
headers: {
|
||||
token: self.data.token
|
||||
}
|
||||
}, function (code, data) {
|
||||
console.log(data);
|
||||
app.globalData.userInfo = data;
|
||||
self.setData({
|
||||
userInfo: data
|
||||
});
|
||||
self.doSaveLoginInfo(data.userId);
|
||||
self.getIsPublic();
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
})
|
||||
},
|
||||
//是否关注公众号
|
||||
getIsPublic() {
|
||||
var _self = this;
|
||||
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/wxopen/attentionrelease/{userId}', [app.usercenterUrl, _self.data.userInfo.userId]), {}, {
|
||||
}, function (code, data) {
|
||||
app.globalData.isPublic = data
|
||||
}, function (code, data) {
|
||||
app.dialog.msg(data.msg)
|
||||
})
|
||||
},
|
||||
doSaveLoginInfo(id) {
|
||||
var params = "小程序USER" + id;
|
||||
var info = {
|
||||
requestUrl: params
|
||||
}
|
||||
app.restAjax.get(app.restAjax.path('{usercenterUrl}/app/contentcensusrelease/log', [app.bigDataUrl]), info, {
|
||||
|
||||
}, function (code, data) {
|
||||
}, function (code, data) {
|
||||
|
||||
}, function (code, data) {
|
||||
})
|
||||
},
|
||||
goTrain: function () {
|
||||
wx.navigateTo({
|
||||
url: '../train/train',
|
||||
})
|
||||
},
|
||||
goTravel: function () {
|
||||
wx.navigateTo({
|
||||
url: '../travel/travel',
|
||||
})
|
||||
},
|
||||
goResource: function () {
|
||||
wx.navigateTo({
|
||||
url: '../resource/resource',
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
var self = this;
|
||||
wx.getLocation({
|
||||
type: 'gcj02',
|
||||
success(res) {
|
||||
// const latitude = res.latitude
|
||||
// const longitude = res.longitude
|
||||
// const speed = res.speed
|
||||
// const accuracy = res.accuracy
|
||||
app.globalData.curLng = res.longitude
|
||||
app.globalData.curLat = res.latitude
|
||||
}
|
||||
})
|
||||
self.doLogin();
|
||||
self.doGetBanner();
|
||||
self.doGetLiveList();
|
||||
self.doGetVenueList();
|
||||
self.doGetActivityList();
|
||||
self.getMainFunc();
|
||||
self.getMainNewsTab();
|
||||
},
|
||||
onPageScroll(e) {
|
||||
var _self = this;
|
||||
if (e.scrollTop <= 96) {
|
||||
//显示
|
||||
_self.setData({
|
||||
isHide: true
|
||||
})
|
||||
} else {
|
||||
//隐藏
|
||||
_self.setData({
|
||||
isHide: false
|
||||
})
|
||||
}
|
||||
},
|
||||
openSearch() {
|
||||
wx.navigateTo({
|
||||
url: '/subpages/search/commonSearch',
|
||||
})
|
||||
}
|
||||
}, function (code, data) {
|
||||
})
|
||||
},
|
||||
goTrain: function () {
|
||||
wx.navigateTo({
|
||||
url: '../train/train',
|
||||
})
|
||||
},
|
||||
goTravel: function () {
|
||||
wx.navigateTo({
|
||||
url: '../travel/travel',
|
||||
})
|
||||
},
|
||||
goResource: function () {
|
||||
wx.navigateTo({
|
||||
url: '../resource/resource',
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
var self = this;
|
||||
wx.getLocation({
|
||||
type: 'gcj02',
|
||||
success(res) {
|
||||
// const latitude = res.latitude
|
||||
// const longitude = res.longitude
|
||||
// const speed = res.speed
|
||||
// const accuracy = res.accuracy
|
||||
app.globalData.curLng = res.longitude
|
||||
app.globalData.curLat = res.latitude
|
||||
}
|
||||
})
|
||||
self.doLogin();
|
||||
self.doGetBanner();
|
||||
self.doGetLiveList();
|
||||
self.doGetVenueList();
|
||||
self.doGetActivityList();
|
||||
self.getMainFunc();
|
||||
self.getMainNewsTab();
|
||||
},
|
||||
onPageScroll(e) {
|
||||
var _self = this;
|
||||
if (e.scrollTop <= 96) {
|
||||
//显示
|
||||
_self.setData({
|
||||
isHide: true
|
||||
})
|
||||
} else {
|
||||
//隐藏
|
||||
_self.setData({
|
||||
isHide: false
|
||||
})
|
||||
}
|
||||
},
|
||||
openSearch() {
|
||||
wx.navigateTo({
|
||||
url: '/subpages/search/commonSearch',
|
||||
})
|
||||
}
|
||||
})
|
@ -5,35 +5,37 @@
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
|
||||
<view class="tab">
|
||||
<block wx:for="{{mainFuncList}}" wx:key="index">
|
||||
<view class="tab-box" bindtap="openNewsDetail" data-item="{{item}}">
|
||||
<image src="{{item.directoriesPhoto==''? '../../images/tab6.png':news.newsUrl+'/route/file/download/true/'+item.directoriesPhoto}}"></image>
|
||||
<view class="tab-title">{{item.directoriesName}}</view>
|
||||
<scroll-view scroll-x="true">
|
||||
<view class="tab">
|
||||
<block wx:for="{{mainFuncList}}" wx:key="index">
|
||||
<view class="tab-box" bindtap="openNewsDetail" data-item="{{item}}">
|
||||
<image src="{{item.directoriesPhoto==''? '../../images/tab6.png':news.newsUrl+'/route/file/download/true/'+item.directoriesPhoto}}"></image>
|
||||
<view class="tab-title">{{item.directoriesName}}</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="tab-box" bindtap="goVolunteer">
|
||||
<image src="../../images/tab1.png"></image>
|
||||
<view class="tab-title">志愿者服务</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goActivity">
|
||||
<image src="../../images/tab2.png"></image>
|
||||
<view class="tab-title">精彩活动</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goVenue">
|
||||
<image src="../../images/tab3.png"></image>
|
||||
<view class="tab-title">场馆导航</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goHeritage">
|
||||
<image src="../../images/tab4.png"></image>
|
||||
<view class="tab-title">非遗文化</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goBroadcast">
|
||||
<image src="../../images/tab5.png"></image>
|
||||
<view class="tab-title">直播点播</view>
|
||||
</view>
|
||||
</block>
|
||||
<view class="tab-box" bindtap="goVolunteer">
|
||||
<image src="../../images/tab1.png"></image>
|
||||
<view class="tab-title">志愿者服务</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goActivity">
|
||||
<image src="../../images/tab2.png"></image>
|
||||
<view class="tab-title">精彩活动</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goVenue">
|
||||
<image src="../../images/tab3.png"></image>
|
||||
<view class="tab-title">场馆导航</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goHeritage">
|
||||
<image src="../../images/tab4.png"></image>
|
||||
<view class="tab-title">非遗文化</view>
|
||||
</view>
|
||||
<view class="tab-box" bindtap="goBroadcast">
|
||||
<image src="../../images/tab5.png"></image>
|
||||
<view class="tab-title">直播点播</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
<view class="line-thick"></view>
|
||||
<view class="recommend">
|
||||
<view class="public-title">
|
||||
<view class="title-text">
|
||||
@ -42,20 +44,22 @@
|
||||
<image src="../../images/selected-r.png" class="selected-r"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="line"></view>
|
||||
<view class="recommend-container">
|
||||
<view class="recommend-box" wx:for="{{venue.venueList}}" bindtap="goVenueDetail" data-venues-info-Id="{{item.venuesInfoId}}" wx:for-index="index" wx:for-item="item" wx:key="venueList">
|
||||
<view class="recommend-status">场馆导航</view>
|
||||
<view class="recommend-name">{{item.venueName}}</view>
|
||||
<image src="{{venue.venueUrl}}/route/file/download/true/{{item.venuePanoramaArray[0]}}"></image>
|
||||
<scroll-view scroll-x="true" style="margin-top: 10rpx;">
|
||||
<view class="recommend-container">
|
||||
<view class="recommend-box" wx:for="{{venue.venueList}}" bindtap="goVenueDetail" data-venues-info-Id="{{item.venuesInfoId}}" wx:for-index="index" wx:for-item="item" wx:key="venueList">
|
||||
<view class="recommend-status">场馆导航</view>
|
||||
<view class="recommend-name">{{item.venueName}}</view>
|
||||
<image src="{{venue.venueUrl}}/route/file/download/true/{{item.venuePanoramaArray[0]}}"></image>
|
||||
</view>
|
||||
<view class="recommend-box" wx:for="{{activity.activityList}}" bindtap="goActivityDetail" data-activity-library-id="{{item.activityLibraryId}}" wx:for-index="index" wx:for-item="item" wx:key="activityList">
|
||||
<view class="recommend-status">精彩活动</view>
|
||||
<view class="recommend-name">{{item.activityTitle}}</view>
|
||||
<image src="{{activity.activityUrl}}/route/file/download/true/{{item.activityImageArray[0]}}" data-index="{{index}}" binderror="loadImgErr"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="recommend-box" wx:for="{{activity.activityList}}" bindtap="goActivityDetail" data-activity-library-id="{{item.activityLibraryId}}" wx:for-index="index" wx:for-item="item" wx:key="activityList">
|
||||
<view class="recommend-status">精彩活动</view>
|
||||
<view class="recommend-name">{{item.activityTitle}}</view>
|
||||
<image src="{{activity.activityUrl}}/route/file/download/true/{{item.activityImageArray[0]}}" data-index="{{index}}" binderror="loadImgErr"></image>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
<view class="line-thick"></view>
|
||||
<view class="news" wx:if="{{mainNewTab.length>0}}">
|
||||
<block wx:for="{{mainNewTab}}" wx:key="i" wx:for-item="it" wx:for-index="i">
|
||||
<view class="public-title">
|
||||
|
@ -34,9 +34,18 @@ swiper {
|
||||
.tab {
|
||||
padding: 30rpx;
|
||||
display: flex;
|
||||
border-bottom: 5px solid #FBFBFB;
|
||||
flex-wrap: nowrap;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
|
||||
.tab-arrow {
|
||||
font-size: 28rpx;
|
||||
background: #242424;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
position: absolute;
|
||||
right: 0rpx;
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.tab-box {
|
||||
@ -56,14 +65,11 @@ swiper {
|
||||
|
||||
.recommend {
|
||||
padding: 0rpx 30rpx 30rpx 30rpx;
|
||||
border-bottom: 5px solid #FBFBFB;
|
||||
}
|
||||
|
||||
.recommend-container {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.line {
|
||||
@ -72,6 +78,12 @@ swiper {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.line-thick {
|
||||
width: 100%;
|
||||
height: 10rpx;
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
.recommend-box {
|
||||
flex-shrink: 0;
|
||||
width: 220rpx;
|
||||
|
@ -3,243 +3,282 @@ var app = getApp();
|
||||
var audioContentx = null;
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
newsId: '',
|
||||
newsBean: null,
|
||||
imgUrl: app.imgUrl,
|
||||
pageHeight: 500,
|
||||
currentVideoUrl: '',
|
||||
currentDesc: '',
|
||||
currentVideoIndex: 0,
|
||||
sliderValue: 0,
|
||||
currentTime: 0,
|
||||
duration: 0,
|
||||
currentAudioIndex: 0,
|
||||
currentAudioDesc: '',
|
||||
canPlay: false,
|
||||
isPlaying: false,
|
||||
totalValue: 0,
|
||||
},
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
newsId: '',
|
||||
newsBean: null,
|
||||
imgUrl: app.imgUrl,
|
||||
pageHeight: 500,
|
||||
currentVideoUrl: '',
|
||||
currentDesc: '',
|
||||
currentVideoIndex: 0,
|
||||
sliderValue: 0,
|
||||
currentTime: 0,
|
||||
duration: 0,
|
||||
currentAudioIndex: 0,
|
||||
currentAudioDesc: '',
|
||||
canPlay: false,
|
||||
isPlaying: false,
|
||||
totalValue: 0,
|
||||
isPublicCode: false,
|
||||
isPublic: false
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
newsId: options.id,
|
||||
pageHeight: wx.getSystemInfoSync().windowHeight
|
||||
})
|
||||
this.getNewsDetail();
|
||||
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) {
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
this.setData({
|
||||
newsId: options.id,
|
||||
pageHeight: wx.getSystemInfoSync().windowHeight,
|
||||
isPublic: app.globalData.isPublic
|
||||
})
|
||||
|
||||
}, function (code, err) {
|
||||
this.saveBigdata(options.id);
|
||||
},
|
||||
onShow() {
|
||||
if (this.data.isPublic) {
|
||||
this.setData({
|
||||
isPublicCode: false
|
||||
})
|
||||
}
|
||||
this.setData({
|
||||
newsBean: null
|
||||
})
|
||||
this.getNewsDetail();
|
||||
},
|
||||
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) {
|
||||
|
||||
})
|
||||
},
|
||||
getNewsDetail() {
|
||||
var _self = this;
|
||||
// app.dialog.loading('正在加载');
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/getnewscontentbyidrelease/{id}', [app.newsUrl, _self.data.newsId]), null, null,
|
||||
function (code, data) {
|
||||
_self.setData({
|
||||
newsBean: data
|
||||
})
|
||||
//视频
|
||||
if (_self.data.newsBean.newsContentType == '4') {
|
||||
_self.setData({
|
||||
currentVideoUrl: _self.data.imgUrl + _self.data.newsBean.fileList[0].contentFileFileId,
|
||||
currentDesc: _self.data.newsBean.fileList[0].contentFileText
|
||||
})
|
||||
}
|
||||
//音频
|
||||
if (_self.data.newsBean.newsContentType == '3') {
|
||||
_self.setData({
|
||||
currentAudioUrl: _self.data.imgUrl + _self.data.newsBean.fileList[0].contentFileFileId,
|
||||
currentAudioDesc: _self.data.newsBean.fileList[0].contentFileText,
|
||||
})
|
||||
_self.initAudio()
|
||||
}
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
},
|
||||
function () {
|
||||
wx.stopPullDownRefresh();
|
||||
// wx.hideLoading();
|
||||
});
|
||||
},
|
||||
setVideoUrl(e) {
|
||||
var _self = this;
|
||||
var item = e.currentTarget.dataset.item
|
||||
var index = e.currentTarget.dataset.index
|
||||
this.setData({
|
||||
currentVideoUrl: _self.data.imgUrl + item.contentFileFileId,
|
||||
currentDesc: item.contentFileText,
|
||||
currentVideoIndex: index
|
||||
})
|
||||
},
|
||||
//初始化音频播放器
|
||||
initAudio() {
|
||||
var _self = this;
|
||||
audioContentx = wx.createInnerAudioContext();
|
||||
}, function (code, err) {
|
||||
|
||||
audioContentx.src = _self.data.currentAudioUrl;
|
||||
// 准备好歌曲流,可以播放
|
||||
audioContentx.onCanplay(() => {
|
||||
_self.setData({
|
||||
canPlay: true,
|
||||
duration: audioContentx.duration * 1000
|
||||
})
|
||||
console.log(audioContentx.duration)
|
||||
})
|
||||
},
|
||||
getNewsDetail() {
|
||||
var _self = this;
|
||||
// app.dialog.loading('正在加载');
|
||||
app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/getnewscontentbyidrelease/{id}', [app.newsUrl, _self.data.newsId]), null, null,
|
||||
function (code, data) {
|
||||
_self.setData({
|
||||
newsBean: data
|
||||
})
|
||||
//视频
|
||||
if (_self.data.newsBean.newsContentType == '4') {
|
||||
_self.setData({
|
||||
currentVideoUrl: _self.data.imgUrl + _self.data.newsBean.fileList[0].contentFileFileId,
|
||||
currentDesc: _self.data.newsBean.fileList[0].contentFileText
|
||||
})
|
||||
}
|
||||
//音频
|
||||
if (_self.data.newsBean.newsContentType == '3') {
|
||||
_self.setData({
|
||||
currentAudioUrl: _self.data.imgUrl + _self.data.newsBean.fileList[0].contentFileFileId,
|
||||
currentAudioDesc: _self.data.newsBean.fileList[0].contentFileText,
|
||||
})
|
||||
_self.initAudio()
|
||||
}
|
||||
//判断是否需要关注公众号
|
||||
if (data.newsViewAuth && data.newsViewAuth.indexOf('2')) {
|
||||
//需要关注
|
||||
//判断是否已经关注
|
||||
if (!_self.data.isPublic) {
|
||||
_self.setData({
|
||||
isPublicCode: true
|
||||
})
|
||||
}
|
||||
} else {
|
||||
//无需关注
|
||||
_self.setData({
|
||||
isPublicCode: false
|
||||
})
|
||||
}
|
||||
},
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
},
|
||||
function () {
|
||||
wx.stopPullDownRefresh();
|
||||
// wx.hideLoading();
|
||||
});
|
||||
},
|
||||
|
||||
})
|
||||
audioContentx.onTimeUpdate(function () {
|
||||
const currentTime = audioContentx.currentTime * 1000
|
||||
_self.setData({
|
||||
duration: audioContentx.duration * 1000,
|
||||
currentTime: currentTime,
|
||||
sliderValue: audioContentx.currentTime,
|
||||
totalValue: audioContentx.duration
|
||||
})
|
||||
setVideoUrl(e) {
|
||||
var _self = this;
|
||||
var item = e.currentTarget.dataset.item
|
||||
var index = e.currentTarget.dataset.index
|
||||
this.setData({
|
||||
currentVideoUrl: _self.data.imgUrl + item.contentFileFileId,
|
||||
currentDesc: item.contentFileText,
|
||||
currentVideoIndex: index
|
||||
})
|
||||
},
|
||||
//初始化音频播放器
|
||||
initAudio() {
|
||||
var _self = this;
|
||||
audioContentx = wx.createInnerAudioContext();
|
||||
|
||||
});
|
||||
audioContentx.onStop(() => {
|
||||
_self.setData({
|
||||
isPlaying: false,
|
||||
sliderValue: 0,
|
||||
})
|
||||
});
|
||||
audioContentx.onEnded(() => {
|
||||
_self.setData({
|
||||
isPlaying: false,
|
||||
sliderValue: 0,
|
||||
})
|
||||
});
|
||||
audioContentx.onPlay(() => {
|
||||
_self.setData({
|
||||
isPlaying: true,
|
||||
})
|
||||
});
|
||||
audioContentx.onError((res) => {
|
||||
console.log(res.errMsg)
|
||||
console.log(res.errCode)
|
||||
})
|
||||
audioContentx.src = _self.data.currentAudioUrl;
|
||||
// 准备好歌曲流,可以播放
|
||||
audioContentx.onCanplay(() => {
|
||||
_self.setData({
|
||||
canPlay: true,
|
||||
duration: audioContentx.duration * 1000
|
||||
})
|
||||
console.log(audioContentx.duration)
|
||||
|
||||
},
|
||||
playAudio() {
|
||||
if (audioContentx && audioContentx.paused) {
|
||||
audioContentx.stop();
|
||||
audioContentx.play();
|
||||
this.setData({
|
||||
isPlaying: true
|
||||
})
|
||||
} else {
|
||||
audioContentx.pause();
|
||||
this.setData({
|
||||
isPlaying: false
|
||||
})
|
||||
}
|
||||
},
|
||||
//下一个音频
|
||||
nextAudio() {
|
||||
var _self = this;
|
||||
var index = _self.data.currentAudioIndex + 1
|
||||
if (index >= _self.data.newsBean.fileList.length) {
|
||||
index = _self.data.newsBean.fileList.length - 1
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
} else {
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
}
|
||||
},
|
||||
setAudioUrl(e) {
|
||||
var _self = this;
|
||||
var item = e.currentTarget.dataset.item
|
||||
var index = e.currentTarget.dataset.index
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId;
|
||||
audioContentx.play()
|
||||
this.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0
|
||||
})
|
||||
}
|
||||
},
|
||||
//上一个音频
|
||||
preAudio() {
|
||||
var _self = this;
|
||||
var index = _self.data.currentAudioIndex - 1
|
||||
if (index <= 0) {
|
||||
index = 0
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
} else {
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
}
|
||||
},
|
||||
//slider进度调整
|
||||
handleSliderChange(event) {
|
||||
this.setData({
|
||||
currentTime: event.detail.value * 1000
|
||||
})
|
||||
audioContentx.pause()
|
||||
audioContentx.seek(event.detail.value)
|
||||
audioContentx.play()
|
||||
},
|
||||
onUnload() {
|
||||
if (audioContentx) {
|
||||
audioContentx.stop();
|
||||
audioContentx.destroy();
|
||||
}
|
||||
}
|
||||
})
|
||||
audioContentx.onTimeUpdate(function () {
|
||||
const currentTime = audioContentx.currentTime * 1000
|
||||
_self.setData({
|
||||
duration: audioContentx.duration * 1000,
|
||||
currentTime: currentTime,
|
||||
sliderValue: audioContentx.currentTime,
|
||||
totalValue: audioContentx.duration
|
||||
})
|
||||
|
||||
});
|
||||
audioContentx.onStop(() => {
|
||||
_self.setData({
|
||||
isPlaying: false,
|
||||
sliderValue: 0,
|
||||
})
|
||||
});
|
||||
audioContentx.onEnded(() => {
|
||||
_self.setData({
|
||||
isPlaying: false,
|
||||
sliderValue: 0,
|
||||
})
|
||||
});
|
||||
audioContentx.onPlay(() => {
|
||||
_self.setData({
|
||||
isPlaying: true,
|
||||
})
|
||||
});
|
||||
audioContentx.onError((res) => {
|
||||
console.log(res.errMsg)
|
||||
console.log(res.errCode)
|
||||
})
|
||||
|
||||
},
|
||||
move() {
|
||||
|
||||
},
|
||||
|
||||
goAttention() {
|
||||
wx.navigateTo({
|
||||
url: '/pages/commonQrCode/commonQrCode',
|
||||
})
|
||||
},
|
||||
playAudio() {
|
||||
if (audioContentx && audioContentx.paused) {
|
||||
audioContentx.stop();
|
||||
audioContentx.play();
|
||||
this.setData({
|
||||
isPlaying: true
|
||||
})
|
||||
} else {
|
||||
audioContentx.pause();
|
||||
this.setData({
|
||||
isPlaying: false
|
||||
})
|
||||
}
|
||||
},
|
||||
//下一个音频
|
||||
nextAudio() {
|
||||
var _self = this;
|
||||
var index = _self.data.currentAudioIndex + 1
|
||||
if (index >= _self.data.newsBean.fileList.length) {
|
||||
index = _self.data.newsBean.fileList.length - 1
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
} else {
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
}
|
||||
},
|
||||
setAudioUrl(e) {
|
||||
var _self = this;
|
||||
var item = e.currentTarget.dataset.item
|
||||
var index = e.currentTarget.dataset.index
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId;
|
||||
audioContentx.play()
|
||||
this.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0
|
||||
})
|
||||
}
|
||||
},
|
||||
//上一个音频
|
||||
preAudio() {
|
||||
var _self = this;
|
||||
var index = _self.data.currentAudioIndex - 1
|
||||
if (index <= 0) {
|
||||
index = 0
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
} else {
|
||||
var item = _self.data.newsBean.fileList[index]
|
||||
_self.setData({
|
||||
currentAudioIndex: index,
|
||||
sliderValue: 0,
|
||||
currentAudioDesc: item.contentFileText
|
||||
})
|
||||
if (audioContentx) {
|
||||
audioContentx.stop()
|
||||
audioContentx.src = _self.data.imgUrl + item.contentFileFileId
|
||||
audioContentx.play()
|
||||
}
|
||||
}
|
||||
},
|
||||
//slider进度调整
|
||||
handleSliderChange(event) {
|
||||
this.setData({
|
||||
currentTime: event.detail.value * 1000
|
||||
})
|
||||
audioContentx.pause()
|
||||
audioContentx.seek(event.detail.value)
|
||||
audioContentx.play()
|
||||
},
|
||||
onUnload() {
|
||||
if (audioContentx) {
|
||||
audioContentx.stop();
|
||||
audioContentx.destroy();
|
||||
}
|
||||
}
|
||||
})
|
@ -1,84 +1,89 @@
|
||||
<wxs src="/utils/utils.wxs" module="format"></wxs>
|
||||
<!-- 是否需要关注公众号 -->
|
||||
<view wx:if="{{isPublicCode}}" class="page-mask" catch:touchmove="move">
|
||||
<view class="mask-hint">关注公众号即可阅读</view>
|
||||
<view class="mask-btn" bind:tap="goAttention">去关注</view>
|
||||
</view>
|
||||
<view wx:if="{{newsBean}}">
|
||||
<!-- newsContentType 1 文章 2图片 3音频 4视频 5PDF 6链接 -->
|
||||
<!-- 文章 -->
|
||||
<view wx:if="{{newsBean.newsContentType=='1'}}">
|
||||
<view class="news-title">{{newsBean.newsContentTitle}}</view>
|
||||
<view class="news-attr-box">
|
||||
<view class="news-attr">新闻来源:{{newsBean.newsContentResource}}</view>
|
||||
<view class="news-attr">发布时间:{{newsBean.newsContentPublishTime}}</view>
|
||||
</view>
|
||||
<view class="news-content">
|
||||
<rich-text nodes="{{newsBean.newsContentContent}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 图片 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='2'}}">
|
||||
<view class="img-box" style="height: {{pageHeight}}px;">
|
||||
<swiper autoplay="true" interval="10000" style="width: 100%;height: {{pageHeight}}px;">
|
||||
<swiper-item class="swiper-item" wx:for="{{newsBean.fileList}}" wx:for-item="item" wx:key="index">
|
||||
<image style="width: 100%;height: 500rpx;" src="{{imgUrl+item.contentFileFileId}}" mode="aspectFit"></image>
|
||||
<view class="item-txt">
|
||||
<custom-content content="{{item.contentFileText}}" maxline="2" position="right" foldable="true"></custom-content>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 音频 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='3'}}">
|
||||
<view class="audio-box">
|
||||
<view class="audio-img">
|
||||
<image class="img-bg" src="/images/ic_audio_bg.png" mode="scaleToFill"></image>
|
||||
<image class="img-loading" wx:if="{{!canPlay}}" src="/images/loading-small.gif" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<view class="progress">
|
||||
<view class="current">{{format.formatDuration(currentTime)}}</view>
|
||||
<slider class="slider" block-size="{{16}}" value="{{sliderValue}}" bindchange="handleSliderChange" max="{{totalValue}}"></slider>
|
||||
<view class="duration">{{format.formatDuration(duration)}}</view>
|
||||
</view>
|
||||
<view class="option">
|
||||
<image class="btn btn-prev" src="/images/play_prev.png" bindtap="preAudio"> </image>
|
||||
<image class="btn btn-pause" src="{{isPlaying?'/images/play_pause.png':'/images/play_resume.png'}}" bindtap="playAudio"> </image>
|
||||
<image class="btn btn-next" src="/images/play_next.png" bindtap="nextAudio"> </image>
|
||||
</view>
|
||||
<view class="category-title">目录</view>
|
||||
<view class="video-category">
|
||||
<view class="category-item {{index==currentAudioIndex? 'category-item-sel':''}}" wx:for="{{newsBean.fileList}}" wx:for-item="item" wx:key="index" bindtap="setAudioUrl" data-index="{{index}}" data-item="{{item}}">
|
||||
<view>{{index+1}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex desc-box">
|
||||
<view>|</view>
|
||||
<view style="margin-left: 10rpx;color: #242424;">详情</view>
|
||||
</view>
|
||||
<view class="desc">{{currentAudioDesc}}</view>
|
||||
</view>
|
||||
<!-- 视频 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='4'}}">
|
||||
<view class="video-box">
|
||||
<video src="{{currentVideoUrl}}"></video>
|
||||
<view class="category-title">目录</view>
|
||||
<view class="video-category">
|
||||
<view class="category-item {{index==currentVideoIndex? 'category-item-sel':''}}" wx:for="{{newsBean.fileList}}" wx:for-item="item" wx:key="index" bindtap="setVideoUrl" data-index="{{index}}" data-item="{{item}}">
|
||||
<view>{{index+1}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex desc-box">
|
||||
<view>|</view>
|
||||
<view style="margin-left: 10rpx;color: #242424;">详情</view>
|
||||
</view>
|
||||
<view class="desc">{{currentDesc}}</view>
|
||||
</view>
|
||||
<!-- PDF -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='5'}}">
|
||||
<web-view src="{{newsBean.newsContentLink}}"></web-view>
|
||||
</view>
|
||||
<!-- 链接 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='6'}}">
|
||||
<web-view src="{{newsBean.newsContentContent}}"></web-view>
|
||||
</view>
|
||||
<!-- newsContentType 1 文章 2图片 3音频 4视频 5PDF 6链接 -->
|
||||
<!-- 文章 -->
|
||||
<view wx:if="{{newsBean.newsContentType=='1'}}">
|
||||
<view class="news-title">{{newsBean.newsContentTitle}}</view>
|
||||
<view class="news-attr-box">
|
||||
<view class="news-attr">新闻来源:{{newsBean.newsContentResource}}</view>
|
||||
<view class="news-attr">发布时间:{{newsBean.newsContentPublishTime}}</view>
|
||||
</view>
|
||||
<view class="news-content">
|
||||
<rich-text nodes="{{newsBean.newsContentContent}}"></rich-text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 图片 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='2'}}">
|
||||
<view class="img-box" style="height: {{pageHeight}}px;">
|
||||
<swiper autoplay="true" interval="10000" style="width: 100%;height: {{pageHeight}}px;">
|
||||
<swiper-item class="swiper-item" wx:for="{{newsBean.fileList}}" wx:for-item="item" wx:key="index">
|
||||
<image style="width: 100%;height: 500rpx;" src="{{imgUrl+item.contentFileFileId}}" mode="aspectFit"></image>
|
||||
<view class="item-txt">
|
||||
<custom-content content="{{item.contentFileText}}" maxline="2" position="right" foldable="true"></custom-content>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 音频 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='3'}}">
|
||||
<view class="audio-box">
|
||||
<view class="audio-img">
|
||||
<image class="img-bg" src="/images/ic_audio_bg.png" mode="scaleToFill"></image>
|
||||
<image class="img-loading" wx:if="{{!canPlay}}" src="/images/loading-small.gif" mode="scaleToFill"></image>
|
||||
</view>
|
||||
<view class="progress">
|
||||
<view class="current">{{format.formatDuration(currentTime)}}</view>
|
||||
<slider class="slider" block-size="{{16}}" value="{{sliderValue}}" bindchange="handleSliderChange" max="{{totalValue}}"></slider>
|
||||
<view class="duration">{{format.formatDuration(duration)}}</view>
|
||||
</view>
|
||||
<view class="option">
|
||||
<image class="btn btn-prev" src="/images/play_prev.png" bindtap="preAudio"> </image>
|
||||
<image class="btn btn-pause" src="{{isPlaying?'/images/play_pause.png':'/images/play_resume.png'}}" bindtap="playAudio"> </image>
|
||||
<image class="btn btn-next" src="/images/play_next.png" bindtap="nextAudio"> </image>
|
||||
</view>
|
||||
<view class="category-title">目录</view>
|
||||
<view class="video-category">
|
||||
<view class="category-item {{index==currentAudioIndex? 'category-item-sel':''}}" wx:for="{{newsBean.fileList}}" wx:for-item="item" wx:key="index" bindtap="setAudioUrl" data-index="{{index}}" data-item="{{item}}">
|
||||
<view>{{index+1}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex desc-box">
|
||||
<view>|</view>
|
||||
<view style="margin-left: 10rpx;color: #242424;">详情</view>
|
||||
</view>
|
||||
<view class="desc">{{currentAudioDesc}}</view>
|
||||
</view>
|
||||
<!-- 视频 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='4'}}">
|
||||
<view class="video-box">
|
||||
<video src="{{currentVideoUrl}}"></video>
|
||||
<view class="category-title">目录</view>
|
||||
<view class="video-category">
|
||||
<view class="category-item {{index==currentVideoIndex? 'category-item-sel':''}}" wx:for="{{newsBean.fileList}}" wx:for-item="item" wx:key="index" bindtap="setVideoUrl" data-index="{{index}}" data-item="{{item}}">
|
||||
<view>{{index+1}}</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex desc-box">
|
||||
<view>|</view>
|
||||
<view style="margin-left: 10rpx;color: #242424;">详情</view>
|
||||
</view>
|
||||
<view class="desc">{{currentDesc}}</view>
|
||||
</view>
|
||||
<!-- PDF -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='5'}}">
|
||||
<web-view src="{{newsBean.newsContentLink}}"></web-view>
|
||||
</view>
|
||||
<!-- 链接 -->
|
||||
<view wx:elif="{{newsBean.newsContentType=='6'}}">
|
||||
<web-view src="{{newsBean.newsContentContent}}"></web-view>
|
||||
</view>
|
||||
</view>
|
||||
<page-loading wx:else></page-loading>
|
@ -1,201 +1,238 @@
|
||||
/* page{
|
||||
background: #d2e0f6;
|
||||
} */
|
||||
page {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.news-title {
|
||||
padding: 20rpx 30rpx;
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
color: #242424;
|
||||
text-align: center;
|
||||
padding: 20rpx 30rpx;
|
||||
font-size: 34rpx;
|
||||
font-weight: bold;
|
||||
color: #242424;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.news-attr-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.news-attr {
|
||||
font-size: 24rpx;
|
||||
color: #949494;
|
||||
font-size: 24rpx;
|
||||
color: #949494;
|
||||
}
|
||||
|
||||
.news-attr:nth-of-type(n+2) {
|
||||
margin-left: 20rpx;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
|
||||
.news-content {
|
||||
padding: 20rpx 20rpx;
|
||||
font-size: 34rpx;
|
||||
color: #242424;
|
||||
padding: 20rpx 20rpx;
|
||||
font-size: 34rpx;
|
||||
color: #242424;
|
||||
}
|
||||
|
||||
.img-box {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: black;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: black;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
transform: translate(0%, 0px) translateZ(0px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
transform: translate(0%, 0px) translateZ(0px);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-txt {
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
bottom: 0rpx;
|
||||
position: absolute;
|
||||
color: white;
|
||||
font-size: 24rpx;
|
||||
bottom: 0rpx;
|
||||
}
|
||||
|
||||
.video-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
background: #242424;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
background: #242424;
|
||||
}
|
||||
|
||||
.video-box video {
|
||||
width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.video-category {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
padding-bottom: 30rpx;
|
||||
margin: 20rpx;
|
||||
flex-wrap: wrap;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start;
|
||||
padding-bottom: 30rpx;
|
||||
margin: 20rpx;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.category-title {
|
||||
font-size: 34rpx;
|
||||
color: white;
|
||||
align-self: center;
|
||||
margin-top: 20rpx;
|
||||
font-size: 34rpx;
|
||||
color: white;
|
||||
align-self: center;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.category-item {
|
||||
font-size: 30rpx;
|
||||
color: white;
|
||||
border: 1rpx solid #949494;
|
||||
padding: 20rpx;
|
||||
margin: 5rpx;
|
||||
font-size: 30rpx;
|
||||
color: white;
|
||||
border: 1rpx solid #949494;
|
||||
padding: 20rpx;
|
||||
margin: 5rpx;
|
||||
}
|
||||
|
||||
.category-item-sel {
|
||||
border: 1rpx solid #f30000;
|
||||
color: #f30000;
|
||||
background: #97979741;
|
||||
border: 1rpx solid #f30000;
|
||||
color: #f30000;
|
||||
background: #97979741;
|
||||
}
|
||||
|
||||
.desc-box {
|
||||
color: #f30000;
|
||||
margin-top: 40rpx;
|
||||
padding-left: 20rpx;
|
||||
color: #f30000;
|
||||
margin-top: 40rpx;
|
||||
padding-left: 20rpx;
|
||||
}
|
||||
|
||||
|
||||
.desc {
|
||||
font-size: 28rpx;
|
||||
color: #242424;
|
||||
padding: 30rpx 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: #242424;
|
||||
padding: 30rpx 40rpx;
|
||||
}
|
||||
|
||||
.audio-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
background: black;
|
||||
color: white;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
background: black;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.audio-img {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
}
|
||||
|
||||
.img-bg {
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
width: 100%;
|
||||
height: 400rpx;
|
||||
}
|
||||
|
||||
.img-loading {
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
position: absolute;
|
||||
top: calc(50%-50rpx);
|
||||
left: calc(50%-50rpx);
|
||||
width: 200rpx;
|
||||
height: 200rpx;
|
||||
position: absolute;
|
||||
top: calc(50%-50rpx);
|
||||
left: calc(50%-50rpx);
|
||||
}
|
||||
|
||||
.progress {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.slider {
|
||||
margin: 10rpx;
|
||||
width: 50%;
|
||||
margin: 10rpx;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.option {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 20rpx;
|
||||
width: 70%;
|
||||
align-self: center;
|
||||
margin-top: 20rpx;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding-bottom: 20rpx;
|
||||
width: 70%;
|
||||
align-self: center;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.btn-mode,
|
||||
.btn-music {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.btn-prev,
|
||||
.btn-next {
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
width: 70rpx;
|
||||
height: 70rpx;
|
||||
}
|
||||
|
||||
.btn-pause {
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
width: 140rpx;
|
||||
height: 140rpx;
|
||||
}
|
||||
|
||||
.current {
|
||||
font-size: 28rpx;
|
||||
margin-right: 30rpx;
|
||||
font-size: 28rpx;
|
||||
margin-right: 30rpx;
|
||||
}
|
||||
|
||||
.duration {
|
||||
font-size: 28rpx;
|
||||
margin-left: 30rpx;
|
||||
font-size: 28rpx;
|
||||
margin-left: 30rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
width: 64rpx;
|
||||
height: 64rpx;
|
||||
}
|
||||
|
||||
.page-mask {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: rgba(0, 0, 0, 0.6);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 99999999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
backdrop-filter: blur(10rpx);
|
||||
}
|
||||
|
||||
.mask-btn {
|
||||
background-color: #4CAF50;
|
||||
border: none;
|
||||
color: white;
|
||||
padding: 10rpx 80rpx;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
display: inline-block;
|
||||
font-size: 26rpx;
|
||||
margin-top: 30rpx;
|
||||
border-radius: 10rpx;
|
||||
}
|
||||
|
||||
.mask-hint {
|
||||
font-size: 40rpx;
|
||||
color: #ffffff;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
}
|
@ -34,7 +34,7 @@ Page({
|
||||
function (code, data) {
|
||||
app.dialog.msg(data.msg);
|
||||
},
|
||||
function () {});
|
||||
function () { });
|
||||
},
|
||||
doClickDictionaries: function (event) {
|
||||
var self = this;
|
||||
@ -73,7 +73,6 @@ Page({
|
||||
currentPage: page,
|
||||
'news.newsList': newsArray
|
||||
})
|
||||
console.log(self.data.news.newsList)
|
||||
if (data.rows.length == 0) {
|
||||
app.dialog.msg('暂无数据');
|
||||
return;
|
||||
@ -137,5 +136,11 @@ Page({
|
||||
self.doGetNewsDictionariesList();
|
||||
self.getAreaList();
|
||||
},
|
||||
onReachBottom() {
|
||||
this.setData({
|
||||
currentPage: this.data.currentPage + 1
|
||||
})
|
||||
this.doGetNewsList(this.data.currentPage)
|
||||
}
|
||||
|
||||
})
|
@ -229,6 +229,7 @@ module.exports.file = postFile;
|
||||
// module.exports.url="http://v3.xzszwhy.cn/";
|
||||
module.exports.baseUrl = 'https://www.xzszwhy.cn/xzszwhy';
|
||||
module.exports.url = "https://www.xzszwhy.cn/";
|
||||
module.exports.wssUrl="wss://www.xzszwhy.cn/xzszwhy";
|
||||
|
||||
// module.exports.baseUrl = 'http://192.168.0.120:8081/xzszwhy';
|
||||
// module.exports.url = "http://192.168.0.120:8081/";
|
Loading…
Reference in New Issue
Block a user