const util = require( '../../utils/util.js' );
Page( {
data: {
// text:"这是一个页面"
data: [],
databody: null,
comments : [], // 评论
winHeight: 0, // 设备高度
// 弹窗
modalHidden: true,
modalValue: null,
/**
* 分享配置
*/
shareShow: 'none',
shareOpacity: {},
shareBottom: {},
},
onLoad: function( options ) {
// 页面初始化 options 为页面跳转所带来的参数
var that = this
var id = options.id;
// 请求内容数据
util.AJAX( "news/" + id, function( res ) {
var arr = res.data;
var body = arr.body;
body = body.match( /<p>.*?<\/p>/g );
var ss = [];
for( var i = 0, len = body.length; i < len;i++ ) {
ss[ i ] = /<img.*?>/.test( body[ i ] );
if( ss[ i ] ) {
body[ i ] = body[ i ].match( /(http:|https:).*?\.(jpg|jpeg|gif|png)/ );
} else {
body[ i ] = body[ i ].replace( /<p>/g, '' )
.replace( /<\/p>/g, '' )
.replace( /<strong>/g, '' )
.replace( /<\/strong>/g, '' )
.replace( /<a.*?\/a>/g, '' )
.replace( / /g, ' ' )
.replace( /“/g, '"' )
.replace( /”/g, '"' );
}
}
// 重新写入数据
that.setData( {
data: arr,
databody: body
});
});
// 请求评论
util.AJAX( "story/" + id + "/short-comments", function( res ) {
var arr = res.data.comments;
for ( var i = 0, len = arr.length; i < len; i++ ){
arr[i]['times'] = util.getTime( arr[i].time );
}
// 重新写入数据
that.setData( {
comments: arr
});
});
/**
* 获取系统信息
*/
wx.getSystemInfo( {
success: function( res ) {
that.setData( {
winWidth: res.windowWidth,
winHeight: res.windowHeight
});
}
});
},
/**
* 显示分享
*/
showShare: function( e ) {
// 创建动画
var animation = wx.createAnimation( {
duration: 100,
timingFunction: "ease",
})
this.animation = animation;
var that = this;
that.setData( {
shareShow: "block",
});
setTimeout( function() {
that.animation.bottom( 0 ).step();
that.setData( {
shareBottom: animation.export()
});
}.bind( this ), 400 );
// 遮罩层
setTimeout( function() {
that.animation.opacity( 0.3 ).step();
that.setData( {
shareOpacity: animation.export()
});
}.bind( this ), 400 );
},
/**
* 关闭分享
*/
shareClose: function() {
// 创建动画
var animation = wx.createAnimation( {
duration: 0,
timingFunction: "ease"
})
this.animation = animation;
var that = this;
setTimeout( function() {
that.animation.bottom( -210 ).step();
that.setData( {
shareBottom: animation.export()
});
}.bind( this ), 500 );
setTimeout( function() {
that.animation.opacity( 0 ).step();
that.setData( {
shareOpacity: animation.export()
});
}.bind( this ), 500 );
setTimeout( function() {
that.setData( {
shareShow: "none",
});
}.bind( this ), 1500 );
},
/**
* 点击分享图标弹出层
*/
modalTap: function( e ) {
var that = this;
that.setData( {
modalHidden: false,
modalValue: e.target.dataset.share
})
},
/**
* 关闭弹出层
*/
modalChange: function( e ) {
var that = this;
that.setData( {
modalHidden: true
})
},
onReady: function() {
// 页面渲染完成
// 修改页面标题
wx.setNavigationBarTitle( {
title: this.data.data.title
})
},
onShow: function() {
// 页面显示
},
onHide: function() {
// 页面隐藏
},
onUnload: function() {
// 页面关闭
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
微信小程序,作为腾讯旗下的轻量级应用平台,凭借其独特的优势和特点,已经深入渗透到人们的生活中。以下是微信小程序的一些关键优势和特点,以及我们为您准备的资源介绍: 优势与特点: 即用即走,无需安装:用户只需在微信内搜索或扫码即可使用,无需下载安装,节省手机存储空间,也降低了用户的使用门槛。 跨平台兼容性:微信小程序可在多种操作系统和设备上运行,无需考虑不同平台的适配问题,为开发者提供了统一的开发环境。 丰富的API接口:微信提供了丰富的API接口,使得开发者能够轻松实现各种功能,如微信支付、用户授权、消息推送等。 强大的社交属性:微信小程序与微信生态紧密结合,可以充分利用微信的社交属性,实现用户裂变和增长。 低成本开发:相较于传统App,微信小程序的开发成本更低,周期更短,降低了企业的开发门槛和成本。 资源介绍: “微信小程序-项目源码-原生开发框架-含效果截图示例”这份资源,不仅包含了完整的微信小程序项目源码,而且基于原生开发框架,确保了代码的健壮性和可扩展性。源码中涵盖了微信小程序的基础架构、页面布局、功能实现等各个方面,通过详细的注释和说明,让您能够快速上手并掌握微信小程序的开发技巧。 同时,我们还提供了丰富的效果截图示例,让您能够直观地了解项目的最终效果,更好地评估项目的实用性和商业价值。无论您是前端开发者、小程序爱好者,还是希望拓展业务的企业,这份资源都将为您带来极大的帮助和启示。快来查看吧,开启您的小程序开发之旅!
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![TXT](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![txt](https://img-home.csdnimg.cn/images/20210720083642.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/SVG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
共 38 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/196b0ad537b04e688a2a9ae3fce83c0a_black_cat7.jpg!1)
DTcode7
- 粉丝: 1w+
- 资源: 4767
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- Java项目-基于SSM+Vue的后勤管理系统的设计与实现(源码+数据库脚本+部署视频+代码讲解视频+全套软件)
- Quectel-EC2x&EG2x&EG9x&EM05-Series-QCFG-AT-Commands-Manual-V1.0
- 人工智能基于深度学习的农作物病虫害识别&防治系统项目(源码&教程)
- 数学建模企业退休职工养老金制度的改革(2)-PaperWord论文检测报告-20240626.zip
- Calculation.zip
- Java项目-基于SSM+Vue的视频点播系统的设计与实现(源码+数据库脚本+部署视频+代码讲解视频+全套软件)
- Python人工智能基于深度学习YOLOv7的农作物病虫害识别项目&防治系统(源码&教程)
- halcon算法总结下载
- 基于C语言的文件操作代码.zip
- Python基于YOLOv7的农作物病虫害识别项目&防治系统(源码&教程)
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)