diff --git a/app.js b/app.js
index 4fa4578..7040ee7 100644
--- a/app.js
+++ b/app.js
@@ -6,16 +6,19 @@ App({
loginUrl: restAjax.baseUrl,
usercenterUrl: restAjax.baseUrl,
newsUrl: restAjax.baseUrl,
- newsContentUrl: 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.baseUrl,
+ liveUrl: restAjax.ulr+'live/',
liveRecordUrl: restAjax.baseUrl,
socialUrl: restAjax.baseUrl,
+ areaCode: '540200000000',
+ areaName: '日喀则市',
+ areaId: '640675',
shopUrl: restAjax.url + "xzshop",
restAjax: restAjax,
shopImgUrl: restAjax.url + "xzshop/route/file/download/true/",
diff --git a/app.json b/app.json
index 95d4ea4..11696fb 100644
--- a/app.json
+++ b/app.json
@@ -40,20 +40,23 @@
"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"
- ]
- }],
+ "subPackages": [
+ {
+ "root": "subpages/",
+ "pages": [
+ "goodslist/goodslist",
+ "goodsdetail/goodsdetail",
+ "goodscar/goodscar",
+ "goodsaddress/goodsaddress",
+ "goodsorder/goodsorder",
+ "addshopaddress/addshopaddress",
+ "editshopaddress/editshopaddress",
+ "orderconfirm/orderconfirm",
+ "addresschoose/addresschoose",
+ "webcontentview/webcontent"
+ ]
+ }
+ ],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#9F1512",
@@ -64,7 +67,8 @@
"color": "#BBBBBB",
"borderStyle": "black",
"selectedColor": "#000000",
- "list": [{
+ "list": [
+ {
"pagePath": "pages/index/index",
"iconPath": "images/index.png",
"text": "首页",
diff --git a/pages/index/index.js b/pages/index/index.js
index 3379fa0..732bb01 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -30,7 +30,9 @@ Page({
liveList: []
},
usercenterUrl: app.usercenterUrl,
- isConfirm: false
+ isConfirm: false,
+ mainFuncList: [],
+ mainNewTab: [],
},
doLogin: function () {
var self = this;
@@ -60,6 +62,63 @@ Page({
}
})
},
+ //获取首页功能
+ 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/list/areaplate/release/{areaCode}', [_self.data.news.newsUrl, 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: 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', [self.data.news.newsUrl]), {
@@ -110,20 +169,20 @@ Page({
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);
- });
- },
+ // 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]), {
@@ -137,11 +196,33 @@ Page({
app.dialog.msg(data.msg);
});
},
+
goNewsDetail: function (event) {
wx.navigateTo({
url: '../newsDetail/newsDetail?templateRecordUrl=' + event.currentTarget.dataset.templateRecordUrl,
})
},
+ 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,
@@ -240,58 +321,11 @@ Page({
})
self.doLogin();
self.doGetBanner();
- self.doGetNewsList();
self.doGetLiveList();
self.doGetVenueList();
self.doGetActivityList();
+ self.getMainFunc();
+ self.getMainNewsTab();
},
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
})
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 1cd2470..3703d90 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -1,167 +1,157 @@
-
-
-
-
-
+
+
+
+
+
-
-
- 展览展示
-
-
-
- 文化动态
-
-
-
- 志愿者服务
-
-
-
- 精彩活动
-
-
-
- 场馆导航
-
-
-
- 非遗文化
-
-
-
- 直播点播
-
-
-
- 在线培训
-
-
-
- 文化旅游
-
-
-
- 数图资源
-
+
+
+
+ {{item.directoriesName}}
+
+
+
+
+ 志愿者服务
+
+
+
+ 精彩活动
+
+
+
+ 场馆导航
+
+
+
+ 非遗文化
+
+
+
+ 直播点播
+
-
-
-
- 精彩推荐
-
+
+
+
+ 精彩推荐
+
+
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
- 文化动态
-
-
-
-
-
- {{item.newsContentTitle}}
-
-
-
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
-
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
+
+
+
+
+
+ {{it.directoriesName}}
+
+
-
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
-
-
-
-
- {{item.newsContentTitle}}
-
-
-
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
- {{item.newsContentTitle}}
-
-
-
-
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
-
+
+
+
+ {{item.newsContentTitle}}
+
+
+
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+
+
+
+
+ {{item.newsContentTitle}}
+
+
+
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+ {{item.newsContentTitle}}
+
+
+
+
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+
+
+
-
-
-
- 直播专区
-
+
+
+
+ 直播专区
+
+
-
-
-
-
- {{item.livePlanName}}
- 直播中
- 已结束
- 未开始
- 直播中
- 错误
+
+
+
+ {{item.livePlanName}}
+ 直播中
+ 已结束
+ 未开始
+ 直播中
+ 错误
+
-
\ No newline at end of file
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 3c1f6b8..c85766b 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -1,264 +1,315 @@
-.swiper-box, .swiper-img, swiper{
- width: 100%;
- height: 330rpx;
+.swiper-box,
+.swiper-img,
+swiper {
+ width: 100%;
+ height: 330rpx;
}
-.tab{
- padding: 30rpx;
- display: flex;
- border-bottom: 5px solid #FBFBFB;
- flex-wrap: nowrap;
- overflow-x: scroll;
+
+.tab {
+ padding: 30rpx;
+ display: flex;
+ border-bottom: 5px solid #FBFBFB;
+ flex-wrap: nowrap;
+ overflow-x: scroll;
}
-.tab-box{
- flex-shrink: 0;
- text-align: center;
- width: 25%;
+
+.tab-box {
+ flex-shrink: 0;
+ text-align: center;
+ width: 25%;
}
-.tab-box image{
- width: 65rpx;
- height: 65rpx;
+
+.tab-box image {
+ width: 65rpx;
+ height: 65rpx;
}
-.tab-title{
- font-size: 28rpx;
+
+.tab-title {
+ font-size: 28rpx;
}
-.recommend{
- padding: 30rpx;
- border-bottom: 5px solid #FBFBFB;
+
+.recommend {
+ padding: 30rpx;
+ border-bottom: 5px solid #FBFBFB;
}
-.recommend-container{
- width: 100%;
- display: flex;
- overflow-x: auto;
+
+.recommend-container {
+ width: 100%;
+ display: flex;
+ overflow-x: auto;
}
-.recommend-box{
- flex-shrink: 0;
- width: 220rpx;
- height: 130rpx;
- border-radius: 10rpx;
- overflow: hidden;
- position: relative;
- margin-right: 30rpx;
+
+.recommend-box {
+ flex-shrink: 0;
+ width: 220rpx;
+ height: 130rpx;
+ border-radius: 10rpx;
+ overflow: hidden;
+ position: relative;
+ margin-right: 30rpx;
}
-.recommend-box image{
- width: 100%;
- height: 100%;
+
+.recommend-box image {
+ width: 100%;
+ height: 100%;
}
-.public-title{
- text-align: center;
+
+.public-title {
+ text-align: center;
+ padding: 10rpx 0rpx;
}
-.title-text{
- display: inline-block;
- font-size: 32rpx;
- color: #9F1512;
- padding: 0 20rpx 0;
- position: relative;
- margin-bottom: 15rpx;
+
+.title-text {
+ display: inline-block;
+ font-size: 32rpx;
+ color: #9F1512;
+ padding: 0 20rpx 0;
+ position: relative;
+ margin-bottom: 15rpx;
}
-.title-text image{
- position: absolute;
- top: 0;
- width: 15rpx;
- height: 100%;
+
+.title-text image {
+ position: absolute;
+ top: 0;
+ width: 15rpx;
+ height: 100%;
}
-.selected-l{
- left: 0;
+
+.selected-l {
+ left: 0;
}
-.selected-r{
- right: 0;
+
+.selected-r {
+ right: 0;
}
-.news{
- padding: 30rpx;
- border-bottom: 5px solid #FBFBFB;
+
+.news {
+ padding: 30rpx;
+ border-bottom: 5px solid #FBFBFB;
}
-.news-box{
- padding: 30rpx 0;
- border-bottom: 1px solid #EBEBEB;
- display: flex;
- flex-direction: column;
+
+.news-box {
+ padding: 30rpx 0;
+ border-bottom: 1px solid #EBEBEB;
+ display: flex;
+ flex-direction: column;
}
-.news-title{
- color: #242424;
- font-size: 30rpx;
- font-weight: bold;
+
+.news-title {
+ color: #242424;
+ font-size: 30rpx;
+ font-weight: bold;
}
-.news-info{
- color: #949494;
- margin-top: 15rpx;
- font-size: 24rpx;
+
+.news-info {
+ color: #949494;
+ margin-top: 15rpx;
+ font-size: 24rpx;
}
-.news-info text{
- margin-right: 20rpx;
+
+.news-info text {
+ margin-right: 20rpx;
}
-.news-big-pic, .news-small-pic{
- margin-top: 10rpx;
+
+.news-big-pic,
+.news-small-pic {
+ margin-top: 10rpx;
}
-.news-big-pic image{
- width: 100%;
- height: 380rpx;
+
+.news-big-pic image {
+ width: 100%;
+ height: 380rpx;
}
-.news-small-pic image{
- width: 30%;
- height: 150rpx;
- margin-right: 20rpx;
+
+.news-small-pic image {
+ width: 30%;
+ height: 150rpx;
+ margin-right: 20rpx;
}
-.transverse-news{
- flex-direction: row;
- justify-content: space-between;
+
+.transverse-news {
+ flex-direction: row;
+ justify-content: space-between;
}
-.news-row-img{
- width: 30%;
- height: 150rpx;
+
+.news-row-img {
+ width: 30%;
+ height: 150rpx;
}
-.news-row-img image{
- width: 100%;
- height: 100%;
+
+.news-row-img image {
+ width: 100%;
+ height: 100%;
}
-.news-row-info{
- width: 68%;
+
+.news-row-info {
+ width: 68%;
}
-.broadcast{
- margin-top: 15rpx;
- padding: 0 30rpx;
+
+.broadcast {
+ margin-top: 15rpx;
+ padding: 0 30rpx;
}
-.broadcast-container{
- display: flex;
- justify-content: space-between;
- flex-wrap: wrap;
+
+.broadcast-container {
+ display: flex;
+ justify-content: space-between;
+ flex-wrap: wrap;
}
-.broadcast-box{
- flex-shrink: 0;
- width: 49%;
- border-radius: 10rpx;
- overflow: hidden;
- height: 185rpx;
- margin-bottom: 15rpx;
- position: relative;
+
+.broadcast-box {
+ flex-shrink: 0;
+ width: 49%;
+ border-radius: 10rpx;
+ overflow: hidden;
+ height: 185rpx;
+ margin-bottom: 15rpx;
+ position: relative;
}
-.broadcast-box image{
- width: 100%;
- height: 100%;
+
+.broadcast-box image {
+ width: 100%;
+ height: 100%;
}
-.broadcast-text{
- position: absolute;
- left: 0;
- right: 0;
- bottom: 0;
- padding: 5rpx 10rpx;
- font-size: 26rpx;
- background: rgba(0,0,0,0.6);
- color: #fff;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
+
+.broadcast-text {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ padding: 5rpx 10rpx;
+ font-size: 26rpx;
+ background: rgba(0, 0, 0, 0.6);
+ color: #fff;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
}
-.broadcast-status{
- position: absolute;
- top: 10rpx;
- right: 10rpx;
- padding: 5rpx;
- background: #9F1512;
- color: #fff;
- font-size: 26rpx;
- border-radius: 10rpx;
+
+.broadcast-status {
+ position: absolute;
+ top: 10rpx;
+ right: 10rpx;
+ padding: 5rpx;
+ background: #9F1512;
+ color: #fff;
+ font-size: 26rpx;
+ border-radius: 10rpx;
}
-.set-phone{
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- bottom: 0;
- background: rgba(0, 0, 0, .6);
- z-index: 100;
+
+.set-phone {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, .6);
+ z-index: 100;
}
-.set-phone-box{
- width: 96%;
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- background: #fff;
- border-radius: 10rpx;
- padding: 30rpx;
- box-sizing: border-box;
+
+.set-phone-box {
+ width: 96%;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ background: #fff;
+ border-radius: 10rpx;
+ padding: 30rpx;
+ box-sizing: border-box;
}
-.tips{
- font-size: 28rpx;
- color: #000;
+
+.tips {
+ font-size: 28rpx;
+ color: #000;
}
-.phone-input{
- margin: 25rpx 0;
+
+.phone-input {
+ margin: 25rpx 0;
}
-.code-input{
- display: flex;
- justify-content: space-between;
- margin-bottom: 25rpx;
+
+.code-input {
+ display: flex;
+ justify-content: space-between;
+ margin-bottom: 25rpx;
}
-.code-input input{
- width: 70%;
- height: 55rpx;
- border: 1px solid #dedede;
- border-radius: 10rpx;
- padding: 0 10rpx;
- box-sizing: border-box;
- font-size: 28rpx;
+
+.code-input input {
+ width: 70%;
+ height: 55rpx;
+ border: 1px solid #dedede;
+ border-radius: 10rpx;
+ padding: 0 10rpx;
+ box-sizing: border-box;
+ font-size: 28rpx;
}
-.phone-input input{
- width: 100%;
- height: 55rpx;
- border: 1px solid #dedede;
- border-radius: 10rpx;
- padding: 0 10rpx;
- box-sizing: border-box;
- font-size: 28rpx;
+
+.phone-input input {
+ width: 100%;
+ height: 55rpx;
+ border: 1px solid #dedede;
+ border-radius: 10rpx;
+ padding: 0 10rpx;
+ box-sizing: border-box;
+ font-size: 28rpx;
}
-.get-code, .got-code{
- font-size: 28rpx;
- background: rgba(159,21,18,.1);
- color: #9F1512;
- width: 28%;
- line-height: 55rpx;
- text-align: center;
- border-radius: 10rpx;
+
+.get-code,
+.got-code {
+ font-size: 28rpx;
+ background: rgba(159, 21, 18, .1);
+ color: #9F1512;
+ width: 28%;
+ line-height: 55rpx;
+ text-align: center;
+ border-radius: 10rpx;
}
-.got-code{
- background: #fff;
- color: #4a4d52;
- border: 1px solid #eaeaea;
+
+.got-code {
+ background: #fff;
+ color: #4a4d52;
+ border: 1px solid #eaeaea;
}
-.set-phone-btn-box{
- display: flex;
- justify-content: space-between;
+
+.set-phone-btn-box {
+ display: flex;
+ justify-content: space-between;
}
-.set-phone-btn{
- width: 100%;
- height: 65rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 28rpx;
- color: #fff;
- background: #9F1512;
- border-radius: 10rpx;
+
+.set-phone-btn {
+ width: 100%;
+ height: 65rpx;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 28rpx;
+ color: #fff;
+ background: #9F1512;
+ border-radius: 10rpx;
}
-.voice-box{
- padding-right: 30px;
- position: relative;
+
+.voice-box {
+ padding-right: 30px;
+ position: relative;
}
-.voice-box iamge{
- position: absolute;
- top: 0;
- right: 0;
- width:25rpx;
- height: 25rpx;
+
+.voice-box iamge {
+ position: absolute;
+ top: 0;
+ right: 0;
+ width: 25rpx;
+ height: 25rpx;
}
-.news-big-pic{
- position: relative;
+
+.news-big-pic {
+ position: relative;
}
-.news-big-pic image.play-btn{
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 80rpx;
- height: 80rpx;
+
+.news-big-pic image.play-btn {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 80rpx;
+ height: 80rpx;
}
\ No newline at end of file
diff --git a/pages/newsList/newsList.js b/pages/newsList/newsList.js
index c4f025c..7d23239 100644
--- a/pages/newsList/newsList.js
+++ b/pages/newsList/newsList.js
@@ -1,183 +1,134 @@
// pages/newsList/newsList.js
var app = getApp();
Page({
- /**
- * 页面的初始数据
- */
- data: {
- news: {
- newsUrl: app.newsUrl,
- newsDictionaries: [],
- newsList: [],
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ news: {
+ newsUrl: app.newsUrl,
+ newsDictionaries: [],
+ newsList: [],
+ },
+ dirId: '', //tab Id
+ currentNewsDictionariesId: '',
+ currentPage: 1,
+ rows: 10,
+ areaId: app.areaCode,
+ defaultAreaId: app.areaCode
},
- directoriesParentId: 'f497904b-7727-4832-891c-604c36ae4167',
- currentNewsDictionariesId: '',
- currentPage: 1,
- rows: 10,
- areaId: ''
- },
- doGetNewsDictionariesList: function() {
- var self = this;
- app.dialog.loading('正在加载');
- app.restAjax.get(app.restAjax.path('{newsUrl}/app/newsdirectories/listnewsdirectoriesrelease', [self.data.news.newsUrl]), {
- directoriesParentId: self.data.directoriesParentId,
- }, null, function(code, data) {
- self.setData({
- 'news.newsDictionaries': data
- })
- self.doGetNewsList(1);
- }, function(code, data) {
- app.dialog.msg(data.msg);
- }, function() {});
- },
- doClickDictionaries: function(event) {
- var self = this;
- console.log(event.currentTarget.dataset.newsDirectoriesId)
- self.setData({
- currentNewsDictionariesId: event.currentTarget.dataset.newsDirectoriesId
- });
- self.doGetNewsList(1);
- },
- doClearCurrentNewsDictionariesId: function() {
- var self = this;
- self.setData({
- currentNewsDictionariesId: ''
- });
- self.doGetNewsList(1);
- },
- doGetNewsList: function(page, lv) {
- var self = this;
- app.dialog.loading('正在加载');
- console.log(self.data.currentNewsDictionariesId)
- var info = {
- newsDirectoriesParentId: self.data.directoriesParentId,
- newsDirectoriesId: self.data.currentNewsDictionariesId ? self.data.currentNewsDictionariesId : '',
- page: page,
- rows: self.data.rows
- }
- if (lv) {
- lv = 'area' + lv
- info[lv] = self.data.areaId
- }
- app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease', [self.data.news.newsUrl]), info, null, function(code, data) {
- var newsArray;
- if(page <= 1) {
- newsArray = data.rows;
- } else {
- newsArray = self.data.news.newsList;
- newsArray = newsArray.concat(data.rows);
- }
- self.setData({
- currentPage: page,
- 'news.newsList': newsArray
- })
- console.log(self.data.news.newsList)
- if(data.rows.length == 0) {
- app.dialog.msg('暂无数据');
- return;
- }
- }, function(code, data) {
- app.dialog.msg(data.msg);
- }, function() {
- wx.stopPullDownRefresh();
- wx.hideLoading();
- });
- },
- goNewsDetail: function (event) {
- wx.navigateTo({
- url: '../newsDetail/newsDetail?templateRecordUrl='+ event.currentTarget.dataset.templateRecordUrl,
- })
- },
- getAreaList: function () {
- var self = this;
- app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/area/listallbyparentidrelease/640675', []),
- self.data.pages, null, function (code, data) {
- if (code == '200') {
- self.setData({
- areaList: data
- })
+ doGetNewsDictionariesList: function () {
+ var self = this;
+ app.dialog.loading('正在加载');
+ app.restAjax.get(app.restAjax.path('{newsUrl}/app/newsdirectories/listsub/areaauth/release/{newsDirectoriesId}/{areaCode}', [self.data.news.newsUrl, self.data.dirId, app.areaCode]),
+ null,
+ null,
+ function (code, data) {
+ self.setData({
+ 'news.newsDictionaries': data,
+ currentNewsDictionariesId: self.data.dirId
+ })
+ self.doGetNewsList(1);
+ },
+ function (code, data) {
+ app.dialog.msg(data.msg);
+ },
+ function () {});
+ },
+ doClickDictionaries: function (event) {
+ var self = this;
+ console.log(event.currentTarget.dataset.newsDirectoriesId)
+ self.setData({
+ currentNewsDictionariesId: event.currentTarget.dataset.newsDirectoriesId
+ });
+ self.doGetNewsList(1);
+ },
+ //全部类型
+ doClearCurrentNewsDictionariesId: function () {
+ var self = this;
+ self.setData({
+ currentNewsDictionariesId: self.data.dirId
+ });
+ self.doGetNewsList(1);
+ },
+ doGetNewsList: function (page, lv) {
+ var self = this;
+ app.dialog.loading('正在加载');
+ var info = {
+ newsDirectoriesId: self.data.currentNewsDictionariesId,
+ page: page,
+ rows: self.data.rows
}
- }
- )
- },
- changeArea: function (e) {
- app.dialog.loading('正在加载');
- var lv = parseInt(e.currentTarget.dataset.level) + 1
- this.setData({
- areaId: e.currentTarget.dataset.area
- })
- this.doGetNewsList(1, lv)
- },
- loadAll: function () {
- this.setData({
- areaId: ''
- })
- this.doGetNewsList(1)
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- var self = this;
- if(options.type == 1) {
- self.setData({
- directoriesParentId: 'f497904b-7727-4832-891c-604c36ae4167'
- });
- } else {
- self.setData({
- directoriesParentId: 'f1d5d313-f728-4dda-9843-1116d97e17b0'
- });
- }
- self.doGetNewsDictionariesList();
- self.getAreaList();
- },
+ var tempAreaCode = app.areaCode;
+ if (lv) {
+ tempAreaCode = self.data.areaId;
+ }
+ app.restAjax.get(app.restAjax.path('{newsUrl}/app/newscontent/listpagenewscontentrelease/{areaCode}', [self.data.news.newsUrl, tempAreaCode]), info, null, function (code, data) {
+ var newsArray;
+ if (page <= 1) {
+ newsArray = data.rows;
+ } else {
+ newsArray = self.data.news.newsList;
+ newsArray = newsArray.concat(data.rows);
+ }
+ self.setData({
+ currentPage: page,
+ 'news.newsList': newsArray
+ })
+ console.log(self.data.news.newsList)
+ if (data.rows.length == 0) {
+ app.dialog.msg('暂无数据');
+ return;
+ }
+ }, function (code, data) {
+ app.dialog.msg(data.msg);
+ }, function () {
+ wx.stopPullDownRefresh();
+ wx.hideLoading();
+ });
+ },
+ goNewsDetail: function (event) {
+ wx.navigateTo({
+ url: '../newsDetail/newsDetail?templateRecordUrl=' + event.currentTarget.dataset.templateRecordUrl,
+ })
+ },
+ getAreaList: function () {
+ var self = this;
+ app.restAjax.get(app.restAjax.path(app.usercenterUrl + '/app/area/listallbyparentidrelease/640675', []),
+ self.data.pages, null,
+ function (code, data) {
+ if (code == '200') {
+ self.setData({
+ areaList: data
+ })
+ }
+ }
+ )
+ },
+ changeArea: function (e) {
+ app.dialog.loading('正在加载');
+ var lv = parseInt(e.currentTarget.dataset.level) + 1
+ this.setData({
+ areaId: e.currentTarget.dataset.area
+ })
+ this.doGetNewsList(1, lv)
+ },
+ loadAll: function () {
+ this.setData({
+ areaId: app.areaCode
+ })
+ this.doGetNewsList(1)
+ },
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ var self = this;
+ self.setData({
+ dirId: options.id
+ })
+ self.doGetNewsDictionariesList();
+ self.getAreaList();
+ },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.doGetNewsList(1);
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- this.doGetNewsList(this.data.currentPage + 1);
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
- }
})
\ No newline at end of file
diff --git a/pages/newsList/newsList.wxml b/pages/newsList/newsList.wxml
index a8c8f75..ec3c82b 100644
--- a/pages/newsList/newsList.wxml
+++ b/pages/newsList/newsList.wxml
@@ -1,100 +1,101 @@
-
-
-
- 全部
-
+
+
+
+ 全部
+
+
+
+
+ {{item.directoriesName}}
+
+
-
-
- {{item.directoriesName}}
-
+
+
+
+ 全部
+
+
+
+
+ {{item.areaName}}
+
+
-
-
-
-
- 全部
-
-
-
-
- {{item.areaName}}
-
-
-
+
-
-
- {{item.newsContentTitle}}
-
-
-
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
-
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
+
+
+ {{item.newsContentTitle}}
+
+
+
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
-
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
+
+
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+
+
+
+
+ {{item.newsContentTitle}}
+
+
+
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+ {{item.newsContentTitle}}
+
+
+
+
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
+
+ {{item.newsContentTitle}}
+
+ 来源:{{item.newsContentResource}}
+ {{item.newsContentPublishTime}}
+
+
-
-
-
-
-
- {{item.newsContentTitle}}
-
-
-
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
- {{item.newsContentTitle}}
-
-
-
-
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
- {{item.newsContentTitle}}
-
- 来源:{{item.newsContentResource}}
- {{item.newsContentPublishTime}}
-
-
-
-
\ No newline at end of file
diff --git a/pages/newsList/newsList.wxss b/pages/newsList/newsList.wxss
index b27cd4d..ec98aec 100644
--- a/pages/newsList/newsList.wxss
+++ b/pages/newsList/newsList.wxss
@@ -1,163 +1,223 @@
-.top-tab{
- position: fixed;
- top: 0;
- left: 0;
- right: 0;
- background: #fff;
- overflow-x: auto;
- z-index: 100;
+.top-tab {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ background: #fff;
+ overflow-x: hidden;
+ z-index: 100;
+ box-shadow: 10rpx 10rpx 15rpx #f0f0f0;
}
-.type{
- display: flex;
+
+.type {
+ display: flex;
+ overflow-x: auto;
+ /* 隐藏滚动条 */
+ scrollbar-width: none;
+ /* firefox */
+ -ms-overflow-style: none;
+ /* IE 10+ */
+ margin-left: 20rpx;
}
-.tab-box{
- display: inline-flex;
- justify-content: center;
- align-items: center;
- width: 30%;
- position: relative;
- height: 90rpx;
- font-size: 30rpx;
- color: #242424;
- flex-shrink: 0;
+
+.tab-box {
+ display: flex;
+ flex-direction: row;
+ justify-content: space-between;
+ align-items: center;
+ width: 25%;
+ position: relative;
+ height: 90rpx;
+ font-size: 30rpx;
+ color: #242424;
+ flex-shrink: 0;
}
-.tab-box.active{
- color: #9F1512;
+
+.tab-box.active {
+ color: #9F1512;
}
-.tab-box image{
- position: absolute;
- width: 15rpx;
- height: 40rpx;
- top: 50%;
- margin-top: -20rpx;
- display: none;
+
+.tab-box image {
+ width: 20rpx;
+ height: 40rpx;
+ /* position: absolute;
+ width: 15rpx;
+ height: 40rpx;
+ top: 50%;
+ margin-top: -20rpx;
+ display: none; */
}
-.tab-box.active image{
- display: block;
+
+.tab-box .txt {
+ padding: 0rpx 10rpx;
+ width: 100%;
+ text-align: center;
}
-.tab-box image.selected-l{
- left: 20rpx;
+
+.tab-box.active image {
+ display: block;
}
-.tab-box image.selected-r{
- right: 20rpx;
+
+.tab-box image.selected-l {
+ left: 20rpx;
}
-.area{
- z-index: 100;
- overflow-x: auto;
- white-space: nowrap;
- position: fixed;
- top: 90rpx;
- left: 0;
- right: 0;
- border-bottom: 1px solid #DDD;
- background: #fff;
+
+.tab-box image.selected-r {
+ right: 20rpx;
}
-.area-box{
- display: inline-flex;
- width: 30%;
- height: 90rpx;
- /* line-height: 90rpx;
+
+.area {
+ display: flex;
+ /* z-index: 100;
+ overflow-x: auto;
+ white-space: nowrap;
+ position: fixed;
+ top: 90rpx;
+ left: 0;
+ right: 0;
+ border-bottom: 1px solid #DDD;
+ background: #fff; */
+}
+
+.area-box {
+ /* display: flex;
+ width: fit-content;
+ flex-direction: row;
+ height: 90rpx; */
+ /* line-height: 90rpx;
text-align: center; */
- align-items: center;
- justify-content: center;
- padding: 0 20px;
- box-sizing: border-box;
- position: relative;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
- font-size: 30rpx;
+ /* align-items: center;
+ justify-content: center;
+ padding: 0 20px;
+ box-sizing: border-box;
+ position: relative;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-size: 30rpx; */
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ align-items: center;
+ width: 30%;
+ position: relative;
+ height: 90rpx;
+ font-size: 30rpx;
+ color: #242424;
+ flex-shrink: 0;
}
-.area-box.active{
- color: #9F1512;
+
+.area-box.active {
+ color: #9F1512;
}
-.area-box image{
- position: absolute;
- width: 15rpx;
- height: 40rpx;
- top: 50%;
- margin-top: -20rpx;
- display: none;
+
+.area-box image {
+ position: absolute;
+ width: 15rpx;
+ height: 40rpx;
+ top: 50%;
+ margin-top: -20rpx;
+ display: none;
}
-.area-box.active image{
- display: block;
+
+.area-box.active image {
+ display: block;
}
-.area-box image.selected-l{
- left: 20rpx;
+
+.area-box image.selected-l {
+ left: 20rpx;
}
-.area-box image.selected-r{
- right: 20rpx;
+
+.area-box image.selected-r {
+ right: 20rpx;
}
-.news{
- padding: 30rpx;
- border-bottom: 5px solid #FBFBFB;
- margin-top: 180rpx;
+
+.news {
+ padding: 30rpx;
+ border-bottom: 5px solid #FBFBFB;
+ margin-top: 180rpx;
}
-.news-box{
- padding: 30rpx 0;
- border-bottom: 1px solid #EBEBEB;
- display: flex;
- flex-direction: column;
+
+.news-box {
+ padding: 30rpx 0;
+ border-bottom: 1px solid #EBEBEB;
+ display: flex;
+ flex-direction: column;
}
-.news-title{
- color: #242424;
- font-size: 30rpx;
- font-weight: bold;
+
+.news-title {
+ color: #242424;
+ font-size: 30rpx;
+ font-weight: bold;
}
-.news-info{
- color: #949494;
- margin-top: 15rpx;
- font-size: 24rpx;
+
+.news-info {
+ color: #949494;
+ margin-top: 15rpx;
+ font-size: 24rpx;
}
-.news-info text{
- margin-right: 20rpx;
+
+.news-info text {
+ margin-right: 20rpx;
}
-.voice-box{
- padding-right: 30px;
- position: relative;
+
+.voice-box {
+ padding-right: 30px;
+ position: relative;
}
-.voice-box iamge{
- position: absolute;
- top: 0;
- right: 0;
- width:25rpx;
- height: 25rpx;
+
+.voice-box iamge {
+ position: absolute;
+ top: 0;
+ right: 0;
+ width: 25rpx;
+ height: 25rpx;
}
-.news-big-pic, .news-small-pic{
- margin-top: 10rpx;
+
+.news-big-pic,
+.news-small-pic {
+ margin-top: 10rpx;
}
-.news-big-pic{
- position: relative;
+
+.news-big-pic {
+ position: relative;
}
-.news-big-pic image{
- width: 100%;
- height: 380rpx;
+
+.news-big-pic image {
+ width: 100%;
+ height: 380rpx;
}
-.news-big-pic image.play-btn{
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- width: 80rpx;
- height: 80rpx;
+
+.news-big-pic image.play-btn {
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ width: 80rpx;
+ height: 80rpx;
}
-.news-small-pic image{
- width: 30%;
- height: 150rpx;
- margin-right: 20rpx;
+
+.news-small-pic image {
+ width: 30%;
+ height: 150rpx;
+ margin-right: 20rpx;
}
-.transverse-news{
- flex-direction: row;
- justify-content: space-between;
+
+.transverse-news {
+ flex-direction: row;
+ justify-content: space-between;
}
-.news-row-img{
- width: 30%;
- height: 150rpx;
+
+.news-row-img {
+ width: 30%;
+ height: 150rpx;
}
-.news-row-img image{
- width: 100%;
- height: 100%;
+
+.news-row-img image {
+ width: 100%;
+ height: 100%;
}
-.news-row-info{
- width: 68%;
+
+.news-row-info {
+ width: 68%;
}
\ No newline at end of file
diff --git a/subpages/webcontentview/webcontent.js b/subpages/webcontentview/webcontent.js
new file mode 100644
index 0000000..c0704dc
--- /dev/null
+++ b/subpages/webcontentview/webcontent.js
@@ -0,0 +1,19 @@
+// subpages/webcontentview/webcontent.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ webUrl: ""
+ },
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ this.setData({
+ webUrl: options.url
+ })
+ },
+})
\ No newline at end of file
diff --git a/subpages/webcontentview/webcontent.json b/subpages/webcontentview/webcontent.json
new file mode 100644
index 0000000..3928faa
--- /dev/null
+++ b/subpages/webcontentview/webcontent.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/subpages/webcontentview/webcontent.wxml b/subpages/webcontentview/webcontent.wxml
new file mode 100644
index 0000000..7bb428d
--- /dev/null
+++ b/subpages/webcontentview/webcontent.wxml
@@ -0,0 +1,2 @@
+
+
diff --git a/subpages/webcontentview/webcontent.wxss b/subpages/webcontentview/webcontent.wxss
new file mode 100644
index 0000000..9c1fc6e
--- /dev/null
+++ b/subpages/webcontentview/webcontent.wxss
@@ -0,0 +1 @@
+/* subpages/webcontentview/webcontent.wxss */
\ No newline at end of file
diff --git a/utils/restAjax.js b/utils/restAjax.js
index 80afdde..ca38cbb 100644
--- a/utils/restAjax.js
+++ b/utils/restAjax.js
@@ -1,8 +1,8 @@
var methods = {
- POST_METHOD: 'POST',
- DELETE_METHOD: 'DELETE',
- PUT_METHOD: 'PUT',
- GET_METHOD: 'GET'
+ POST_METHOD: 'POST',
+ DELETE_METHOD: 'DELETE',
+ PUT_METHOD: 'PUT',
+ GET_METHOD: 'GET'
};
/**
@@ -15,7 +15,7 @@ var methods = {
* @param completeCallback
*/
function postJson(url, dataObj, args, successCallback, errorCallback, completeCallback) {
- doAjax(url, methods.POST_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
+ doAjax(url, methods.POST_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
@@ -28,7 +28,7 @@ function postJson(url, dataObj, args, successCallback, errorCallback, completeCa
* @param completeCallback
*/
function deleteForm(url, dataObj, args, successCallback, errorCallback, completeCallback) {
- doAjax(url, methods.DELETE_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
+ doAjax(url, methods.DELETE_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
@@ -41,7 +41,7 @@ function deleteForm(url, dataObj, args, successCallback, errorCallback, complete
* @param completeCallback
*/
function putJson(url, dataObj, args, successCallback, errorCallback, completeCallback) {
- doAjax(url, methods.PUT_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
+ doAjax(url, methods.PUT_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
@@ -54,7 +54,7 @@ function putJson(url, dataObj, args, successCallback, errorCallback, completeCal
* @param completeCallback
*/
function getForm(url, dataObj, args, successCallback, errorCallback, completeCallback) {
- doAjax(url, methods.GET_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
+ doAjax(url, methods.GET_METHOD, dataObj, args, successCallback, errorCallback, completeCallback);
}
/**
@@ -68,34 +68,34 @@ function getForm(url, dataObj, args, successCallback, errorCallback, completeCal
* @param completeCallback
*/
function doAjax(url, method, dataObj, args, successCallback, errorCallback, completeCallback) {
- var headers = {};
- if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) {
- headers = args.headers;
- }
- wx.request({
- url: url,
- method: method,
- data: dataObj,
- header: headers,
- dataType: 'json',
- success: function (response) {
- if (response.statusCode == 200) {
- successCallback(response.statusCode, response.data, args);
- } else {
- if (errorCallback && typeof (errorCallback) == 'function') {
- errorCallback(response.statusCode, response.data);
- }
- }
- },
- fail: function (response) {
- console.log(response);
- },
- complete: function () {
- if (completeCallback && typeof (completeCallback) == 'function') {
- completeCallback();
- }
+ var headers = {};
+ if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) {
+ headers = args.headers;
}
- })
+ wx.request({
+ url: url,
+ method: method,
+ data: dataObj,
+ header: headers,
+ dataType: 'json',
+ success: function (response) {
+ if (response.statusCode == 200) {
+ successCallback(response.statusCode, response.data, args);
+ } else {
+ if (errorCallback && typeof (errorCallback) == 'function') {
+ errorCallback(response.statusCode, response.data);
+ }
+ }
+ },
+ fail: function (response) {
+ console.log(response);
+ },
+ complete: function () {
+ if (completeCallback && typeof (completeCallback) == 'function') {
+ completeCallback();
+ }
+ }
+ })
}
/**
@@ -104,18 +104,18 @@ function doAjax(url, method, dataObj, args, successCallback, errorCallback, comp
* @returns {boolean}
*/
function pathArgsHasSameValue(pathArgArray) {
- var tempArgIndex = 0;
- var tempArgs = pathArgArray[tempArgIndex];
- for (var i = (tempArgIndex + 1), item; item = pathArgArray[i]; i++) {
- if (tempArgs == item) {
- throw new Error('参数' + item + '有重复值!!!');
+ var tempArgIndex = 0;
+ var tempArgs = pathArgArray[tempArgIndex];
+ for (var i = (tempArgIndex + 1), item; item = pathArgArray[i]; i++) {
+ if (tempArgs == item) {
+ throw new Error('参数' + item + '有重复值!!!');
+ }
+ if (i == pathArgArray.length - 1) {
+ tempArgs = pathArgArray[++tempArgIndex];
+ i = tempArgIndex;
+ continue;
+ }
}
- if (i == pathArgArray.length - 1) {
- tempArgs = pathArgArray[++tempArgIndex];
- i = tempArgIndex;
- continue;
- }
- }
}
/**
@@ -123,22 +123,22 @@ function pathArgsHasSameValue(pathArgArray) {
* @param url
*/
function getParamsArg(url) {
- var params = url.split('?')[1];
- var paramsObj = {};
- if (typeof (params) == 'undefined' || params == null) {
+ var params = url.split('?')[1];
+ var paramsObj = {};
+ if (typeof (params) == 'undefined' || params == null) {
+ return paramsObj;
+ }
+ var paramsKVs = params.split('&');
+ for (var i = 0, item = null; item = paramsKVs[i++];) {
+ var kvs = item.split('=');
+ if (kvs.length == 1) {
+ paramsObj[kvs[0]] = null;
+ }
+ if (kvs.length == 2) {
+ paramsObj[kvs[0]] = decodeURI(kvs[1]);
+ }
+ }
return paramsObj;
- }
- var paramsKVs = params.split('&');
- for (var i = 0, item = null; item = paramsKVs[i++];) {
- var kvs = item.split('=');
- if (kvs.length == 1) {
- paramsObj[kvs[0]] = null;
- }
- if (kvs.length == 2) {
- paramsObj[kvs[0]] = decodeURI(kvs[1]);
- }
- }
- return paramsObj;
}
/**
@@ -148,22 +148,22 @@ function getParamsArg(url) {
* @returns {*}
*/
function buildPath(basePath, pathArgs) {
- var path = basePath;
- if (!basePath || !(typeof (basePath) == 'string')) {
- throw new Error('basePath必须为字符串!!!');
- }
- if (!pathArgs || !Array.isArray(pathArgs)) {
- throw new Error('pathArgs必须为数组!!!');
- }
- var pathArgArray = basePath.match(/\{\w+\}/g);
- if (!pathArgArray) {
+ var path = basePath;
+ if (!basePath || !(typeof (basePath) == 'string')) {
+ throw new Error('basePath必须为字符串!!!');
+ }
+ if (!pathArgs || !Array.isArray(pathArgs)) {
+ throw new Error('pathArgs必须为数组!!!');
+ }
+ var pathArgArray = basePath.match(/\{\w+\}/g);
+ if (!pathArgArray) {
+ return path;
+ }
+ pathArgsHasSameValue(pathArgArray);
+ for (var i = 0, item; item = pathArgArray[i]; i++) {
+ path = path.replace(item, pathArgs[i]);
+ }
return path;
- }
- pathArgsHasSameValue(pathArgArray);
- for (var i = 0, item; item = pathArgArray[i]; i++) {
- path = path.replace(item, pathArgs[i]);
- }
- return path;
}
/**
@@ -177,33 +177,33 @@ function buildPath(basePath, pathArgs) {
* @param completeCallback
*/
function postFile(url, path, name, args, successCallback, errorCallback, completeCallback) {
- var headers = {};
- if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) {
- headers = args.headers;
- }
- wx.uploadFile({
- filePath: path,
- name: name,
- url: url,
- header: headers,
- success: function (response) {
- if (response.statusCode == 200) {
- successCallback(response.statusCode, response.data, args);
- } else {
- if (errorCallback && typeof (errorCallback) == 'function') {
- errorCallback(response.statusCode, response.data);
- }
- }
- },
- fail: function (response) {
- console.log(response);
- },
- complete: function () {
- if (completeCallback && typeof (completeCallback) == 'function') {
- completeCallback();
- }
+ var headers = {};
+ if (args != null && typeof (args.headers) != 'undefined' && args.headers != null) {
+ headers = args.headers;
}
- })
+ wx.uploadFile({
+ filePath: path,
+ name: name,
+ url: url,
+ header: headers,
+ success: function (response) {
+ if (response.statusCode == 200) {
+ successCallback(response.statusCode, response.data, args);
+ } else {
+ if (errorCallback && typeof (errorCallback) == 'function') {
+ errorCallback(response.statusCode, response.data);
+ }
+ }
+ },
+ fail: function (response) {
+ console.log(response);
+ },
+ complete: function () {
+ if (completeCallback && typeof (completeCallback) == 'function') {
+ completeCallback();
+ }
+ }
+ })
};
/**
@@ -212,9 +212,9 @@ function postFile(url, path, name, args, successCallback, errorCallback, complet
* @returns {string}
*/
function escape(html) {
- return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
- .replace(//g, '>')
- .replace(/'/g, ''').replace(/"/g, '"');
+ return String(html || '').replace(/&(?!#?[a-zA-Z0-9]+;)/g, '&')
+ .replace(//g, '>')
+ .replace(/'/g, ''').replace(/"/g, '"');
}
module.exports.post = postJson;
@@ -225,5 +225,7 @@ module.exports.params = getParamsArg;
module.exports.path = buildPath;
module.exports.escape = escape;
module.exports.file = postFile;
-module.exports.baseUrl='http://v3.xzszwhy.cn/xzszwhy';
-module.exports.url="http://v3.xzszwhy.cn/"
\ No newline at end of file
+// module.exports.baseUrl='http://v3.xzszwhy.cn/xzszwhy';
+// module.exports.url="http://v3.xzszwhy.cn/";
+module.exports.baseUrl = 'http://192.168.0.120:8081/xzszwhy';
+module.exports.url = "http://192.168.0.120:8081/";
\ No newline at end of file