Commit d6b7145b by jscat

nyx weapp: bug fix

1. 参考weui-textarea的计数方式来统计字符数
2. 添加图片时候,每一次都是重新添加(add),而不是追加(append)
parent 11ae17c8
// pages/member/activity-post/activity-post.js // pages/member/activity-post/activity-post.js
...@@ -171,9 +171,10 @@ Page({ ...@@ -171,9 +171,10 @@ Page({
//先设置支付按钮不可点击 //先设置支付按钮不可点击
var canClick = false; var canClick = false;
var photoArray = []
_this.setData({ _this.setData({
photoArray: [], photoArray,
canClick: canClick canClick
}) })
console.log("===this is addPhoto"); console.log("===this is addPhoto");
...@@ -302,6 +303,7 @@ Page({ ...@@ -302,6 +303,7 @@ Page({
var _this = this; var _this = this;
var tempFilePaths = res.tempFilePaths; var tempFilePaths = res.tempFilePaths;
var index = 0; var index = 0;
_this.setData({photoArray:[]})
_this.editPic(tempFilePaths, index, canvasId) _this.editPic(tempFilePaths, index, canvasId)
} }
......
// pages/member/activity-post/activity-submit/activity-submit.js // pages/member/activity-post/activity-submit/activity-submit.js
...@@ -25,6 +25,8 @@ Page({ ...@@ -25,6 +25,8 @@ Page({
//当textarea获取焦点时自适应高度,失去焦点时不自适应高度 //当textarea获取焦点时自适应高度,失去焦点时不自适应高度
//自适应高度时,style中的height无效 //自适应高度时,style中的height无效
auto_height:true, auto_height:true,
//weui-textarea最多字数 (根据自己需求改变)
max: 2000,
/* /*
//members //members
...@@ -161,7 +163,8 @@ Page({ ...@@ -161,7 +163,8 @@ Page({
if(app.globalData.postData.startDatetime != "") if(app.globalData.postData.startDatetime != "")
{ {
content = app.globalData.postData.photoContent; //获取content content = app.globalData.postData.photoContent; //获取content
contentLength = app.gblen(content) //contentLength = app.gblen(content)
contentLength = parseInt(content.length)
} }
_this.setData({ content, contentLength }) _this.setData({ content, contentLength })
...@@ -660,7 +663,9 @@ Page({ ...@@ -660,7 +663,9 @@ Page({
// //
app.globalData.postData.photoContent = e.detail.value app.globalData.postData.photoContent = e.detail.value
var content = e.detail.value var content = e.detail.value
var contentLength = app.gblen(content) //var contentLength = app.gblen(content)
//这种计数方式与weui-textarea的maxlength计数方式不一致
var contentLength = parseInt(content.length)
_this.setData({ content, contentLength }) _this.setData({ content, contentLength })
}, },
// 为member添加口号 // 为member添加口号
......
<view class="page-body"> <view class="page-body">
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<view class="weui-cells weui-cells_after-title"> <view class="weui-cells weui-cells_after-title">
<view class="weui-cell"> <view class="weui-cell">
<view class="weui-cell__bd"> <view class="weui-cell__bd">
<textarea auto-height="{{auto_height}}" bindblur='areablur' bindfocus='areafocus' class="weui-textarea" bindinput='bindKeyInput' name="inputContent" placeholder="请输入活动内容" style="height: 3.3em" value="{{content}}"/> <textarea auto-height="{{auto_height}}" bindblur='areablur' bindfocus='areafocus' class="weui-textarea" bindinput='bindKeyInput' name="inputContent" placeholder="请输入活动内容" style="height: 3.3em" value="{{content}}" maxlength="{{max}}"/>
<view class="weui-textarea-counter">{{contentLength}}/2000</view> <view class="weui-textarea-counter">{{contentLength}}/{{max}}</view>
</view> </view>
</view> </view>
</view> </view>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论