...
|
...
|
@@ -18,28 +18,28 @@ Page({ |
|
|
duration: 1000,
|
|
|
currentSwiper: 0,
|
|
|
//图文编辑大图片和小图片
|
|
|
edit_img:[
|
|
|
edit_img: [
|
|
|
'http://pi4orwnti.bkt.clouddn.com/editbig@2x.png',
|
|
|
'http://pi4orwnti.bkt.clouddn.com/editbig@2x.png',
|
|
|
'http://pi4orwnti.bkt.clouddn.com/editbig@2x.png',
|
|
|
],
|
|
|
status:1,
|
|
|
page:1,
|
|
|
num:5,
|
|
|
buildlist:[],
|
|
|
status: 1,
|
|
|
page: 1,
|
|
|
num: 5,
|
|
|
buildlist: [],
|
|
|
|
|
|
keyword:'',
|
|
|
archives_id:'',
|
|
|
keyword: '',
|
|
|
archives_id: '',
|
|
|
//是否收藏
|
|
|
if_collect:'',
|
|
|
if_collect: '',
|
|
|
//是否点赞
|
|
|
if_touch:'',
|
|
|
isfirst:true,
|
|
|
hospital_address_id:'',
|
|
|
if_touch: '',
|
|
|
isfirst: true,
|
|
|
hospital_address_id: '',
|
|
|
},
|
|
|
onLoad: function (options) {
|
|
|
onLoad: function(options) {
|
|
|
console.log(options)
|
|
|
let that=this;
|
|
|
let that = this;
|
|
|
that.getbanner();
|
|
|
|
|
|
that.setData({
|
...
|
...
|
@@ -57,17 +57,17 @@ Page({ |
|
|
},
|
|
|
|
|
|
viewImg(e) {
|
|
|
let that=this;
|
|
|
let that = this;
|
|
|
console.log(e)
|
|
|
let index = e.currentTarget.dataset.index;
|
|
|
let archives_id = that.data.archives_id;
|
|
|
let paridx = e.currentTarget.dataset.paridx
|
|
|
console.log(paridx)
|
|
|
console.log(that.data.buildlist)
|
|
|
let img=[];
|
|
|
for (var i=0;i<that.data.buildlist.length;i++){
|
|
|
let img = [];
|
|
|
for (var i = 0; i < that.data.buildlist.length; i++) {
|
|
|
|
|
|
if (i==paridx){
|
|
|
if (i == paridx) {
|
|
|
console.log(9090)
|
|
|
img = that.data.buildlist[i].content_imgs;
|
|
|
|
...
|
...
|
@@ -78,15 +78,15 @@ Page({ |
|
|
wx.previewImage({
|
|
|
current: img[index],
|
|
|
urls: img,
|
|
|
success: function (res) { },
|
|
|
fail: function (res) { },
|
|
|
complete: function (res) { },
|
|
|
success: function(res) {},
|
|
|
fail: function(res) {},
|
|
|
complete: function(res) {},
|
|
|
})
|
|
|
},
|
|
|
|
|
|
enter(e){
|
|
|
let that=this;
|
|
|
let url=e.currentTarget.dataset.url;
|
|
|
enter(e) {
|
|
|
let that = this;
|
|
|
let url = e.currentTarget.dataset.url;
|
|
|
console.log(e.currentTarget.dataset.id);
|
|
|
|
|
|
wx.navigateTo({
|
...
|
...
|
@@ -101,20 +101,20 @@ Page({ |
|
|
|
|
|
},
|
|
|
|
|
|
enterurl(){
|
|
|
enterurl() {
|
|
|
wx.navigateTo({
|
|
|
url: '../../processQuery/processQuery',
|
|
|
})
|
|
|
},
|
|
|
swiperChange: function (e) {
|
|
|
swiperChange: function(e) {
|
|
|
this.setData({
|
|
|
currentSwiper: e.detail.current
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//获取banner图
|
|
|
getbanner:function(){
|
|
|
let that=this;
|
|
|
getbanner: function() {
|
|
|
let that = this;
|
|
|
var url = '/api/portal/archives/getBanner';
|
|
|
var params = {
|
|
|
|
...
|
...
|
@@ -124,7 +124,7 @@ Page({ |
|
|
|
|
|
|
|
|
that.setData({
|
|
|
imgUrls:res[0].items
|
|
|
imgUrls: res[0].items
|
|
|
})
|
|
|
|
|
|
}).catch((err) => {
|
...
|
...
|
@@ -132,22 +132,24 @@ Page({ |
|
|
})
|
|
|
},
|
|
|
//搜索
|
|
|
search:function(e){
|
|
|
let that=this;
|
|
|
search: function(e) {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
keyword:e.detail.value
|
|
|
keyword: e.detail.value
|
|
|
})
|
|
|
|
|
|
if(e.detail.value==""||e.detail.value==null){
|
|
|
if (e.detail.value == "" || e.detail.value == null) {
|
|
|
that.searchlist()
|
|
|
}
|
|
|
},
|
|
|
searchlist:function(){
|
|
|
var that=this;
|
|
|
|
|
|
|
|
|
searchlist: function() {
|
|
|
var that = this;
|
|
|
// that.getlist()
|
|
|
that.setData({
|
|
|
page:1,
|
|
|
buildlist:[]
|
|
|
page: 1,
|
|
|
buildlist: []
|
|
|
})
|
|
|
|
|
|
|
...
|
...
|
@@ -221,55 +223,136 @@ Page({ |
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
|
|
|
finish(e) {
|
|
|
var that = this;
|
|
|
// that.getlist()
|
|
|
that.setData({
|
|
|
page: 1,
|
|
|
buildlist: []
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
var url = '/api/portal/archives/archivesList';
|
|
|
var params = {
|
|
|
token: wx.getStorageSync('token'),
|
|
|
page: that.data.page,
|
|
|
num: that.data.num,
|
|
|
status: that.data.status,
|
|
|
keyword: that.data.keyword,
|
|
|
hospital_address_id: that.data.hospital_address_id
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
|
|
|
console.log(res)
|
|
|
console.log(that.data.buildlist)
|
|
|
if (res == "") {
|
|
|
that.setData({
|
|
|
|
|
|
buildlist: []
|
|
|
|
|
|
|
|
|
})
|
|
|
} else {
|
|
|
that.setData({
|
|
|
|
|
|
buildlist: res
|
|
|
|
|
|
|
|
|
})
|
|
|
}
|
|
|
|
|
|
|
|
|
let newbuildlist = that.data.buildlist;
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < newbuildlist.length; i++) {
|
|
|
|
|
|
newbuildlist[i].showword = true
|
|
|
|
|
|
if (newbuildlist[i].content_text.length > 80) {
|
|
|
console.log(1)
|
|
|
newbuildlist[i].openword = true
|
|
|
newbuildlist[i].content_text = newbuildlist[i].content_text.substring(0, 80);
|
|
|
} else {
|
|
|
console.log(2)
|
|
|
newbuildlist[i].openword = false
|
|
|
}
|
|
|
|
|
|
if (newbuildlist[i].content_imgs == null) {
|
|
|
console.log(3)
|
|
|
newbuildlist[i].content_imgs = []
|
|
|
} else {
|
|
|
newbuildlist[i].content_imgs = newbuildlist[i].content_imgs.slice(0, 3);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
that.setData({
|
|
|
buildlist: that.data.buildlist.concat(newbuildlist)
|
|
|
})
|
|
|
console.log(that.data.buildlist)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
},
|
|
|
//最新 最热
|
|
|
new:function(){
|
|
|
new: function() {
|
|
|
this.setData({
|
|
|
page:1,
|
|
|
page: 1,
|
|
|
status: 1,
|
|
|
buildlist:[]
|
|
|
buildlist: []
|
|
|
})
|
|
|
this.getlist()
|
|
|
},
|
|
|
hot:function(){
|
|
|
hot: function() {
|
|
|
this.setData({
|
|
|
page: 1,
|
|
|
status: 2,
|
|
|
buildlist:[]
|
|
|
buildlist: []
|
|
|
})
|
|
|
this.getlist()
|
|
|
},
|
|
|
//获取列表
|
|
|
getlist(){
|
|
|
let that=this;
|
|
|
getlist() {
|
|
|
let that = this;
|
|
|
|
|
|
|
|
|
var url = '/api/portal/archives/archivesList';
|
|
|
var params = {
|
|
|
token: wx.getStorageSync('token'),
|
|
|
page:that.data.page,
|
|
|
num:that.data.num,
|
|
|
status:that.data.status,
|
|
|
keyword:that.data.keyword,
|
|
|
page: that.data.page,
|
|
|
num: that.data.num,
|
|
|
status: that.data.status,
|
|
|
keyword: that.data.keyword,
|
|
|
hospital_address_id: that.data.hospital_address_id
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
|
|
|
console.log(res)
|
|
|
console.log(that.data.buildlist)
|
|
|
if(res==""){
|
|
|
if (res == "") {
|
|
|
that.setData({
|
|
|
|
|
|
buildlist: that.data.buildlist
|
|
|
|
|
|
|
|
|
})
|
|
|
}else{
|
|
|
} else {
|
|
|
|
|
|
let newbuildlist = res;
|
|
|
console.log(newbuildlist)
|
|
|
|
|
|
for (var i = 0; i <newbuildlist.length; i++) {
|
|
|
for (var i = 0; i < newbuildlist.length; i++) {
|
|
|
|
|
|
newbuildlist[i].showword = true
|
|
|
|
...
|
...
|
@@ -277,15 +360,15 @@ Page({ |
|
|
console.log(1)
|
|
|
newbuildlist[i].openword = true
|
|
|
newbuildlist[i].content_text = newbuildlist[i].content_text.substring(0, 80);
|
|
|
}else{
|
|
|
} else {
|
|
|
console.log(2)
|
|
|
newbuildlist[i].openword = false
|
|
|
}
|
|
|
|
|
|
if (newbuildlist[i].content_imgs==null){
|
|
|
if (newbuildlist[i].content_imgs == null) {
|
|
|
console.log(3)
|
|
|
newbuildlist[i].content_imgs = []
|
|
|
} else{
|
|
|
} else {
|
|
|
newbuildlist[i].content_imgs = newbuildlist[i].content_imgs.slice(0, 3);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -321,34 +404,34 @@ Page({ |
|
|
|
|
|
|
|
|
//收藏
|
|
|
collect:function(e){
|
|
|
let that=this;
|
|
|
collect: function(e) {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
archives_id: e.currentTarget.dataset.id
|
|
|
})
|
|
|
var collect_id=that.data.archives_id;
|
|
|
var collect_id = that.data.archives_id;
|
|
|
|
|
|
var list=that.data.buildlist;
|
|
|
for(var i=0;i<list.length; i++){
|
|
|
if(collect_id==list[i].archives_id){
|
|
|
var collect=list[i].if_collect;
|
|
|
if(collect==0){
|
|
|
list[i].if_collect=1;
|
|
|
}else if(collect==1){
|
|
|
list[i].if_collect=0
|
|
|
var list = that.data.buildlist;
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
if (collect_id == list[i].archives_id) {
|
|
|
var collect = list[i].if_collect;
|
|
|
if (collect == 0) {
|
|
|
list[i].if_collect = 1;
|
|
|
} else if (collect == 1) {
|
|
|
list[i].if_collect = 0
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
that.setData({
|
|
|
buildlist:list
|
|
|
buildlist: list
|
|
|
})
|
|
|
|
|
|
//调取收藏的接口
|
|
|
var url = '/api/portal/archives/doCollect';
|
|
|
var params = {
|
|
|
token: wx.getStorageSync('token'),
|
|
|
archives_id:that.data.archives_id
|
|
|
archives_id: that.data.archives_id
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
...
|
...
|
@@ -360,36 +443,36 @@ Page({ |
|
|
|
|
|
},
|
|
|
//点赞
|
|
|
touchstar:function(e){
|
|
|
let that=this;
|
|
|
touchstar: function(e) {
|
|
|
let that = this;
|
|
|
that.setData({
|
|
|
archives_id: e.currentTarget.dataset.id
|
|
|
})
|
|
|
var collect_id=that.data.archives_id;
|
|
|
var collect_id = that.data.archives_id;
|
|
|
|
|
|
var list=that.data.buildlist;
|
|
|
for(var i=0;i<list.length; i++){
|
|
|
if(collect_id==list[i].archives_id){
|
|
|
var touchstar=list[i].if_touch;
|
|
|
if(touchstar==0){
|
|
|
list[i].if_touch=1;
|
|
|
list[i].touch_num = list[i].touch_num+1
|
|
|
}else if(touchstar==1){
|
|
|
list[i].if_touch=0;
|
|
|
list[i].touch_num = list[i].touch_num-1;
|
|
|
var list = that.data.buildlist;
|
|
|
for (var i = 0; i < list.length; i++) {
|
|
|
if (collect_id == list[i].archives_id) {
|
|
|
var touchstar = list[i].if_touch;
|
|
|
if (touchstar == 0) {
|
|
|
list[i].if_touch = 1;
|
|
|
list[i].touch_num = list[i].touch_num + 1
|
|
|
} else if (touchstar == 1) {
|
|
|
list[i].if_touch = 0;
|
|
|
list[i].touch_num = list[i].touch_num - 1;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
that.setData({
|
|
|
buildlist:list
|
|
|
buildlist: list
|
|
|
})
|
|
|
|
|
|
//调取点赞的接口
|
|
|
var url = '/api/portal/archives/doTouch';
|
|
|
var params = {
|
|
|
token: wx.getStorageSync('token'),
|
|
|
archives_id:that.data.archives_id
|
|
|
archives_id: that.data.archives_id
|
|
|
}
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
...
|
...
|
@@ -413,18 +496,18 @@ Page({ |
|
|
|
|
|
|
|
|
//展开收起
|
|
|
operaword(e){
|
|
|
operaword(e) {
|
|
|
let that = this;
|
|
|
|
|
|
let archives_id = e.currentTarget.dataset.archives_id;
|
|
|
console.log(archives_id)
|
|
|
let showword=e.currentTarget.dataset.showword;
|
|
|
let showword = e.currentTarget.dataset.showword;
|
|
|
console.log(showword)
|
|
|
if(showword==true){
|
|
|
if (showword == true) {
|
|
|
console.log(9090)
|
|
|
that.setData({
|
|
|
page:1,
|
|
|
num:50
|
|
|
page: 1,
|
|
|
num: 50
|
|
|
})
|
|
|
|
|
|
var url = '/api/portal/archives/archivesList';
|
...
|
...
|
@@ -445,7 +528,7 @@ Page({ |
|
|
|
|
|
for (var obj of newbuildlist) {
|
|
|
console.log(obj.archives_id);
|
|
|
obj.showword =true;
|
|
|
obj.showword = true;
|
|
|
|
|
|
if (obj.content_text.length > 80) {
|
|
|
obj.openword = true
|
...
|
...
|
@@ -462,9 +545,9 @@ Page({ |
|
|
console.log(obj.showword)
|
|
|
obj.showword = false;
|
|
|
obj.ccontent_text = obj.ccontent_text;
|
|
|
if (obj.content_imgs==null){
|
|
|
obj.content_imgs=[]
|
|
|
} else if (obj.content_imgs.length>3){
|
|
|
if (obj.content_imgs == null) {
|
|
|
obj.content_imgs = []
|
|
|
} else if (obj.content_imgs.length > 3) {
|
|
|
obj.content_imgs = obj.content_imgs.slice(0, 3);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -477,7 +560,7 @@ Page({ |
|
|
// }
|
|
|
|
|
|
|
|
|
}else{
|
|
|
} else {
|
|
|
obj.content_text = obj.content_text.substring(0, 80);
|
|
|
|
|
|
if (obj.content_imgs == null) {
|
...
|
...
|
@@ -510,7 +593,7 @@ Page({ |
|
|
}).catch((err) => {
|
|
|
|
|
|
})
|
|
|
}else{
|
|
|
} else {
|
|
|
|
|
|
let newbuildlist = that.data.buildlist;
|
|
|
console.log(newbuildlist)
|
...
|
...
|
@@ -557,14 +640,14 @@ Page({ |
|
|
/**
|
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
|
*/
|
|
|
onReady: function () {
|
|
|
onReady: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面显示
|
|
|
*/
|
|
|
onShow: function () {
|
|
|
onShow: function() {
|
|
|
// this.setData({
|
|
|
// buildlist:[],
|
|
|
// page:1
|
...
|
...
|
@@ -575,30 +658,30 @@ Page({ |
|
|
/**
|
|
|
* 生命周期函数--监听页面隐藏
|
|
|
*/
|
|
|
onHide: function () {
|
|
|
onHide: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 生命周期函数--监听页面卸载
|
|
|
*/
|
|
|
onUnload: function () {
|
|
|
onUnload: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
|
*/
|
|
|
onPullDownRefresh: function () {
|
|
|
onPullDownRefresh: function() {
|
|
|
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 页面上拉触底事件的处理函数
|
|
|
*/
|
|
|
onReachBottom: function () {
|
|
|
onReachBottom: function() {
|
|
|
console.log(6666)
|
|
|
let that=this;
|
|
|
let that = this;
|
|
|
that.data.page++;
|
|
|
that.getlist();
|
|
|
console.log(that.data.buildlist)
|
...
|
...
|
@@ -608,20 +691,20 @@ Page({ |
|
|
/**
|
|
|
* 用户点击右上角分享
|
|
|
*/
|
|
|
onShareAppMessage: function () {
|
|
|
onShareAppMessage: function() {
|
|
|
|
|
|
},
|
|
|
//建档成功,我要分享
|
|
|
attentionpublic:function(){
|
|
|
attentionpublic: function() {
|
|
|
wx.navigateTo({
|
|
|
url: '../meshare/meshare?hospital_address_id=' + this.data.hospital_address_id,
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
//建档笔记详情
|
|
|
buildtextdetail:function(e){
|
|
|
let that=this;
|
|
|
buildtextdetail: function(e) {
|
|
|
let that = this;
|
|
|
console.log(e)
|
|
|
var buildtetid=e.currentTarget.dataset.id;
|
|
|
var buildtetid = e.currentTarget.dataset.id;
|
|
|
wx.setStorageSync('buildtetid', buildtetid)
|
|
|
that.setData({
|
|
|
archives_id: e.currentTarget.dataset.id
|
...
|
...
|
@@ -629,16 +712,16 @@ Page({ |
|
|
wx.navigateTo({
|
|
|
url: '../buildtextdetail/buildtextdetail?buildid=' + buildtetid,
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
|
|
|
//医院详情
|
|
|
enterhostail(e){
|
|
|
//医院详情
|
|
|
enterhostail(e) {
|
|
|
wx.setStorageSync('hospitalid', e.currentTarget.dataset.hosid);
|
|
|
wx.navigateTo({
|
|
|
url: '../hometail/hometail',
|
|
|
})
|
|
|
},
|
|
|
attention:function(){
|
|
|
attention: function() {
|
|
|
wx.navigateTo({
|
|
|
url: '../attentionpublic/attentionpublic',
|
|
|
})
|
...
|
...
|
|