123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- focus: false,
- // scrollTop: 100,
- menu: false, //菜单显示隐藏
- uploadImages: ["/image/smyz2.png","/image/smyz1.png"], //相册放大图集
- news:'',//input消息
- inputValue: null, //input 的 value
- messages:'',//接收消息数据
- photo:'', //相片
- },
- onLoad: function (options) {
- var that = this;
- },
- // 点击scroll-view 关闭底部菜单
- resetInputStatus: function() {
- var that = this;
- that.setData({
- menu: false, //关闭底部菜单
- })
- },
- // 底部菜单显示隐藏切换
- chatInputExtraClickEvent:function(){
- var that = this;
- that.setData({
- menu: !that.data.menu
- })
- },
- // 相册点击放大
- enlarge: function (e) {
- var that = this;
- // console.log(that.data.uploadImages)
- // console.log(e.currentTarget.dataset.src,)
- wx.previewImage({
- current: e.currentTarget.dataset.src, // 当前显示图片的http链接
- urls: that.data.uploadImages, // 需要预览的图片http链接列表
- })
- },
- // 发送消息事件
- Sendout: function (e) {
- var that = this;
- console.log(that.data.news);
- that.setData({
- menu: false, //隐藏底部菜单
- inputValue: '', //清空 input
- messages: that.data.news, //显示信息
- })
- console.log('发送');
-
- },
- //输入框
- Telephone: function (e) {
- var that = this;
- // console.log(e.detail.value);
- that.setData({
- news: e.detail.value, //获取输入文字
- })
- },
- // 上传图片
- chooseImageTap: function () {
- var that = this;
- wx.chooseImage({
- count: 1,
- sizeType: ['original', 'compressed'],
- sourceType: ['album', 'camera'],
- success(res) {
- console.log(res.tempFilePaths[0]);
- // tempFilePath可以作为img标签的src属性显示图片
- that.setData({
- photo: res.tempFilePaths[0],
- });
- }
- })
- },
-
- // 重发消息
- retransmission:function(){
- wx.showModal({
- content: '重发该消息?',
- success(res) {
- if (res.confirm) {
- console.log('用户点击确定')
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- }
-
- })
|