123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- // pages/articlDetail/articlDetail.js
- import {
- imgUrl
- } from "../api/request"
- import {
- info
- } from "../api/index-api2"
- const IMGPATH = "https://www.cqna.gov.cn/data/mini/hlw/forward?url="
- // const imageCdn = 'https://tdesign.gtimg.com/site/swiper';
- // const swiperList = [];
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- imgUrl: imgUrl,
- chnlid: "",
- docid: "",
- data: {},
- current: 0,
- autoplay: true,
- duration: 500,
- interval: 5000,
- paginationPosition: 'bottom-right',
- swiperList:[],
- navigation: { type: 'fraction' },
- imgShow:true
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- wx.showLoading({
- title: '页面加载中',
- })
- this.setData({
- chnlid: options.CHNLID,
- docid: options.DOCID
- })
- this.initPage();
- },
- initPage() {
- info(this.data.chnlid, this.data.docid).then(res => {
- // console.log(res);
- let swiperLists = [];
- if (res.result) {
- let imgs = res.data.DOCATTACHPICFIELD;
- if(imgs.length<=0&&res.data.THUMBFILES!=null&&res.data.THUMBFILES!=""){
- let imgName = res.data.THUMBFILES.split(',');
- // /webpic/W0202210/W020221019/W020221019788334970636.jpg
- for (const imgOne of imgName) {
- let one = "/webpic"
- let two = "/"+imgOne.slice(0,8)
- // console.log(two);
- let three = "/"+imgOne.slice(0,10)+"/"
- // console.log(three);
- swiperLists.push(IMGPATH+one+two+three+imgOne)
- }
-
- }else{
- for (const img of imgs) {
- if(img.APPFILEURL!=null&&img.APPFILEURL!=''){
- swiperLists.push(IMGPATH+img.APPFILEURL);
- }
- }
- }
-
- // console.log(swiperLists);
- if(swiperLists.length<=0){
- this.setData({
- imgShow:false
- })
- }
- this.setData({
- data: res.data,
- swiperList: swiperLists
- })
-
- // wx.setNavigationBarTitle({
- // title: res.data.DOCTITLE
- // })
- wx.hideLoading();
- }
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage(res) {
- return {
- title: this.data.data.DOCTITLE
- };
- },
- onShareTimeline() {
- return {
- title: this.data.data.DOCTITLE
- };
- }
- })
|