Commit adb321e8 by 赵雅纹

Merge branch 'feature-zyw-sc' into 'dev_7.1.0'

Feature zyw sc

See merge request !87
parents c6a5e140 da7453b8
...@@ -33,6 +33,8 @@ wxService.page({ ...@@ -33,6 +33,8 @@ wxService.page({
if(options && options.id){ if(options && options.id){
this.setData({ this.setData({
'params.id': options.id 'params.id': options.id
},() => {
this.getInitInfo()
}) })
} }
}, },
...@@ -41,9 +43,7 @@ wxService.page({ ...@@ -41,9 +43,7 @@ wxService.page({
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
*/ */
onShow: function () { onShow: function () {
if (this.data.params.id) { console.log('onshow')
this.getInitInfo()
}
}, },
// 获取编辑详情 // 获取编辑详情
...@@ -67,6 +67,7 @@ wxService.page({ ...@@ -67,6 +67,7 @@ wxService.page({
for (var i in data.sspList){ for (var i in data.sspList){
this.data.pics.push(app.globalData.imageUrl + data.sspList[i].url) this.data.pics.push(app.globalData.imageUrl + data.sspList[i].url)
} }
this.setData({ this.setData({
pics: this.data.pics pics: this.data.pics
}) })
...@@ -118,21 +119,23 @@ wxService.page({ ...@@ -118,21 +119,23 @@ wxService.page({
}, },
chooseImg(){ chooseImg(){
let that = this; let that = this;
let pics = this.data.pics; let pics = this.data.pics ;
wx.chooseImage({ wx.chooseImage({
count: 5 - pics.length, // 最多可以选择的图片5张, count: 5 - pics.length, // 最多可以选择的图片5张,
sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有 sizeType: ['original', 'compressed'], // original 原图,compressed 压缩图,默认二者都有
sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
success: function (res) { success: function (res) {
var imgsrc = res.tempFilePaths; var imgsrcs = res.tempFilePaths;
pics = pics.concat(imgsrc); imgsrcs.forEach(src => {
pics.push(src);
});
that.setData({ that.setData({
pics: pics pics: pics
}); });
console.log(that.data.pics) // console.log(',..............',that.data.pics)
that.moreImgUpload({ that.moreImgUpload({
url: 'http://buyer.devapi.bigaka.net/merchant/upload/pic',//这里是你图片上传的接口 url: 'http://buyer.devapi.bigaka.net/merchant/upload/pic',//这里是你图片上传的接口
path: that.data.pics//这里是选取的图片的地址数组 path: imgsrcs//这里是选取的图片的地址数组
}); });
}, },
fail: function () { fail: function () {
...@@ -177,28 +180,30 @@ wxService.page({ ...@@ -177,28 +180,30 @@ wxService.page({
}, },
name: 'imgs',//这里根据自己的实际情况改 name: 'imgs',//这里根据自己的实际情况改
formData: null,//这里是上传图片时一起上传的数据 formData: null,//这里是上传图片时一起上传的数据
success: (resp) => { success: (res) => {
if (res.statusCode == 200){
var imgdata = JSON.parse(res.data);
var img = imgdata.data[0];
success++;//图片上传成功,图片上传成功的变量+1 success++;//图片上传成功,图片上传成功的变量+1
this.data.params.sspList.push({
cover: 0,
url: img.url
});
that.setData({
'params.sspList': this.data.params.sspList
})
console.log('\\\\\\\\\\\\', that.data.params.sspList)
}
}, },
fail: (res) => { fail: (res) => {
fail++;//图片上传失败,图片上传失败的变量+1 fail++;//图片上传失败,图片上传失败的变量+1
}, },
complete: (res) => { complete: (res) => {
i++; i++;
var imgdata = JSON.parse(res.data);
var img = imgdata.data[0];
var sspList = []
sspList.push({
cover:0,
url:img.url
});
if (i == data.path.length) { //当图片传完时,停止调用 if (i == data.path.length) { //当图片传完时,停止调用
that.setData({
'params.sspList': sspList
})
console.log('=====', that.data.params.sspList)
}else {//若图片还没有传完,则继续调用函数 }else {//若图片还没有传完,则继续调用函数
console.log(i); console.log('00000',i);
data.i = i; data.i = i;
data.success = success; data.success = success;
data.fail = fail; data.fail = fail;
...@@ -210,6 +215,11 @@ wxService.page({ ...@@ -210,6 +215,11 @@ wxService.page({
// 发布笔记 // 发布笔记
formSubmit(e){ formSubmit(e){
console.log(e)
this.setData({
'params.headline': e.detail.value.headline,
'params.article': e.detail.value.article
})
wxService.post(`/merchant/contentMobileTerminal/contentSave`, this.data.params).then(res => { wxService.post(`/merchant/contentMobileTerminal/contentSave`, this.data.params).then(res => {
const { result, data } = res.data const { result, data } = res.data
if (result == 0) { if (result == 0) {
......
<!--subPackage/page/pages/grassCommunity/grassCommunity.wxml--> <!--subPackage/page/pages/grassCommunity/grassCommunity.wxml-->
<!-- <form bindsubmit="formSubmit"> --> <form bindsubmit="formSubmit">
<view class="grass-community border_box"> <view class="grass-community border_box">
<view class="page-upload-img"> <view class="page-upload-img">
<view class="flex-wrp"> <view class="flex-wrp">
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
<view class="upload-tip">*只支持.jpg格式图片/ .mp4格式视频,最长60s</view> <view class="upload-tip">*只支持.jpg格式图片/ .mp4格式视频,最长60s</view>
<view class="title-border"> <view class="title-border">
<input placeholder="添加标题" name="headline" auto-focus value="{{params.headline}}" /> <input placeholder="添加标题" name="headline" value="{{params.headline}}" />
</view> </view>
<view class="title-border"> <view class="title-border">
<input placeholder="这一刻想说什么..." name="article" auto-focus value="{{params.article}}" /> <input placeholder="这一刻想说什么..." name="article" value="{{params.article}}" />
</view> </view>
<view class="related-goods" bindtap="handleRelatedGoods">关联商品</view> <view class="related-goods" bindtap="handleRelatedGoods">关联商品</view>
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<grass-item pro-goods="{{proGoods}}"/> <grass-item pro-goods="{{proGoods}}"/>
</view> </view>
</view> </view>
<button class="post-notes fixed-bottom0" bindtap="formSubmit">发布笔记</button> <button class="post-notes fixed-bottom0" form-type="submit">发布笔记</button>
<!-- </form> --> </form>
<select-related-goods show="{{showSelectRelatedGoods}}" bind:_selectGoods="_selectGoods" pro-goods="{{proGoods}}"/> <select-related-goods show="{{showSelectRelatedGoods}}" bind:_selectGoods="_selectGoods" pro-goods="{{proGoods}}"/>
/* subPackage/page/pages/grassCommunity/grassCommunity.wxss */ /* subPackage/page/pages/grassCommunity/grassCommunity.wxss */
@import './../../../../base/base.wxss'; @import './../../../../base/base.wxss';
page{
padding-bottom: 100rpx;
}
.grass-community{ .grass-community{
padding: 30rpx; padding: 30rpx;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment