Commit ace48180 by jscat

nyx weapp: 页面更新

1. 新增活动类型字段
parent ce96e91b
//app.js //app.js
...@@ -67,6 +67,7 @@ App({ ...@@ -67,6 +67,7 @@ App({
photoTitle: "", photoTitle: "",
photoContent: "", photoContent: "",
photoProduct: [], photoProduct: [],
photoCbs: [],
startDatetime: "", startDatetime: "",
endDatetime: "", endDatetime: "",
......
{ {
{ {
"pages": [ "pages": [
"pages/activity/activity", "pages/activity/activity",
"pages/community/community", "pages/community/community",
"pages/fair/fair", "pages/fair/fair",
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"list": [ "list": [
{ {
"pagePath": "pages/activity/activity", "pagePath": "pages/activity/activity",
"text": "活动", "text": "饮事",
"iconPath": "./icon/my/activity.png", "iconPath": "./icon/my/activity.png",
"selectedIconPath": "./icon/my/activity.png" "selectedIconPath": "./icon/my/activity.png"
}, },
......
// pages/activity/activity.js // pages/activity/activity.js
...@@ -57,18 +57,22 @@ Page({ ...@@ -57,18 +57,22 @@ Page({
//二维码信息 //二维码信息
qRCodeMsg: "", qRCodeMsg: "",
//活动类型
activityType: "00-饮事",
}, },
switchCategory(e) { switchCategory(e) {
var _this = this; var _this = this;
var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0 var curIndex = e.currentTarget.dataset.index ? e.currentTarget.dataset.index : 0
var strCity = _this.__data__.city var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
var activityType = _this.__data__.activityType
this.setData({ this.setData({
curIndex: curIndex, curIndex: curIndex,
}) })
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
}, },
// 搜索点击事件 // 搜索点击事件
entrySearch(e) { entrySearch(e) {
...@@ -189,12 +193,13 @@ Page({ ...@@ -189,12 +193,13 @@ Page({
var strCity = _this.__data__.city var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
var activityType = _this.__data__.activityType
this.setData({ this.setData({
curIndex: curIndex, curIndex: curIndex,
}); });
app.globalData.switchId = "" app.globalData.switchId = ""
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
} }
...@@ -291,6 +296,8 @@ Page({ ...@@ -291,6 +296,8 @@ Page({
var strCity = _this.__data__.city var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
var activityType = _this.__data__.activityType
var isHideLoadMore = _this.__data__.isHideLoadMore; var isHideLoadMore = _this.__data__.isHideLoadMore;
var pageIndex = _this.__data__.pageIndex; var pageIndex = _this.__data__.pageIndex;
...@@ -301,7 +308,7 @@ Page({ ...@@ -301,7 +308,7 @@ Page({
console.log('加载更多') console.log('加载更多')
setTimeout(() => { setTimeout(() => {
_this.getActivities(1, pageIndex, 4, strCity, strCategory, strSearch); _this.getActivities(1, pageIndex, 4, strCity, activityType, strCategory, strSearch);
}, 1000) }, 1000)
} }
else { else {
...@@ -328,12 +335,13 @@ Page({ ...@@ -328,12 +335,13 @@ Page({
2. tab, tag=strSearch 2. tab, tag=strSearch
3. 新增的search tab, '搜索'tab的时候,需要转换为搜索的关键词(_this.__data__.strSearch) 3. 新增的search tab, '搜索'tab的时候,需要转换为搜索的关键词(_this.__data__.strSearch)
*/ */
getActivities: function (scrollType, pageNum, pageCount, strCity, strCategory, strSearch) { getActivities: function (scrollType, pageNum, pageCount, strCity, activityType, strCategory, strSearch) {
var _this = this; var _this = this;
// 如果是"推荐"和"搜索",需要单独处理 // 如果是"推荐"和"搜索",需要单独处理
// '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch) // '搜索'tab的时候, 需要转换为搜索的关键词(_this.__data__.strSearch)
var query_url = '&title=' + strSearch + '&orderType=' + strCategory + '&city=' + strCity var query_url = '&title=' + strSearch + '&orderType=' + strCategory + '&city=' + strCity
+ '&activityType=' + activityType
var strUrl = config.activity_query_url + "?pageCount=" + pageCount var strUrl = config.activity_query_url + "?pageCount=" + pageCount
+ "&pageNum=" + pageNum + query_url + "&pageNum=" + pageNum + query_url
...@@ -438,6 +446,7 @@ Page({ ...@@ -438,6 +446,7 @@ Page({
var curIndex = _this.__data__.curIndex var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var activityType = _this.__data__.activityType
var strSearch = "" var strSearch = ""
this.setData({ this.setData({
...@@ -445,7 +454,7 @@ Page({ ...@@ -445,7 +454,7 @@ Page({
inputShowed: false, inputShowed: false,
}); });
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
}, },
// * 删除输入字符串 // * 删除输入字符串
...@@ -462,8 +471,9 @@ Page({ ...@@ -462,8 +471,9 @@ Page({
var curIndex = _this.__data__.curIndex var curIndex = _this.__data__.curIndex
var strCity = _this.__data__.city var strCity = _this.__data__.city
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var activityType = _this.__data__.activityType
console.log("===input search text_" + strSearch) console.log("===input search text_" + strSearch)
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); _this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
_this.setData({ _this.setData({
strSearch: strSearch, strSearch: strSearch,
...@@ -597,7 +607,8 @@ Page({ ...@@ -597,7 +607,8 @@ Page({
var curIndex = _this.__data__.curIndex var curIndex = _this.__data__.curIndex
var strCategory = _this.__data__.category[curIndex].order var strCategory = _this.__data__.category[curIndex].order
var strSearch = _this.__data__.strSearch var strSearch = _this.__data__.strSearch
_this.getActivities(0, 1, 4, strCity, strCategory, strSearch); var activityType = _this.__data__.activityType
_this.getActivities(0, 1, 4, strCity, activityType, strCategory, strSearch);
}, },
......
// pages/member/activity-post/activity-edit/activity-edit.js // pages/member/activity-post/activity-edit/activity-edit.js
...@@ -19,6 +19,12 @@ Page({ ...@@ -19,6 +19,12 @@ Page({
attributeArray: ['活动类别', '价格', '库存'], attributeArray: ['活动类别', '价格', '库存'],
cbs: [
{name: '', type:'00-饮事', value:'饮事', holder:'饮事活动', checked: false},
{name: '', type:'01-集市', value:'集市', holder:'是否集市?', checked: false},
{name: '', type:'02-园区', value:'园区', holder:'是否园区?', checked: false},
],
}, },
...@@ -128,13 +134,53 @@ Page({ ...@@ -128,13 +134,53 @@ Page({
// 输入该组图片的标签 // 输入该组图片的标签
bindKeyTag(e) { bindKeyTag(e) {
var _this = this; var _this = this;
_this.setData({
inputTag: e.detail.value var cbs = _this.data.cbs
})
//全局赋值 //js的e.currentTarget.id 对应wxml的 id="tab0"
app.globalData.postData.photoTag = e.detail.value //js的e.currentTarget.dataSet.id 对应wxml的 data-id="tab0"
var values = parseInt(e.currentTarget.id)
cbs[values].name = e.detail.value
this.setData({ cbs })
app.globalData.postData.photoCbs = cbs;
}, },
//点击checkbox
radioTap: function(e){
var _this = this
var cbs = _this.data.cbs
//js的e.currentTarget.id 对应wxml的 id="tab0"
//js的e.currentTarget.dataSet.id 对应wxml的 data-id="tab0"
var values = parseInt(e.currentTarget.id)
cbs[values].checked = cbs[values].checked == true ? false : true
cbs[values].holder = cbs[values].checked==true?cbs[values].value+'名称?':'是否'+cbs[values].value+'?'
this.setData({ cbs })
app.globalData.postData.photoCbs = cbs;
},
//点击input
inputTap: function(e){
var _this = this
var cbs = _this.data.cbs
//js的e.currentTarget.id 对应wxml的 id="tab0"
//js的e.currentTarget.dataSet.id 对应wxml的 data-id="tab0"
var values = parseInt(e.currentTarget.id)
cbs[values].checked = cbs[values].checked == true ? false : true
cbs[values].holder = cbs[values].checked==true?cbs[values].value+'名称?':'是否'+cbs[values].value+'?'
this.setData({ cbs })
app.globalData.postData.photoCbs = cbs;
},
bindKeyText(e){ bindKeyText(e){
var _this = this; var _this = this;
//js的e.currentTarget.id 对应wxml的 id="0" //js的e.currentTarget.id 对应wxml的 id="0"
......
<!-- /page/post/edit/edit 添加分类的特点,以及自定义特点 --> <!-- /page/post/edit/edit 添加分类的特点,以及自定义特点 -->
...@@ -13,14 +13,35 @@ ...@@ -13,14 +13,35 @@
</view> </view>
</view> </view>
<!-- <view class="weui-cells__title">#添加亮点</view> <view class="weui-cells__title">#添加活动类型</view>
<view class="weui-cells weui-cells_after-title"> <view class="weui-cells weui-cells_after-title" style="font-size:30rpx;">
<view class="weui-cell "> <view style="display:flex; flex-direction: row;">
<view class="weui-cell__bd"> <label class="weui-cell" style="padding-right:6px;">
<input class="weui-input" bindinput="bindKeyTag" placeholder="请输入亮点" /> <view class="weui-cell__hd">
</view> <checkbox value="0" id="0" checked="{{cbs[0].checked}}" bindtap="radioTap"/>
</view> </view>
</view> --> <view class="weui-cell__bd {{cbs[0].checked==false?'.check-box-off':''}}" style="width:120rpx" id="0" bindtap="inputTap">
饮事活动
</view>
</label>
<label class="weui-cell" style="padding-left:6px;padding-right:6px;">
<view class="weui-cell__hd">
<checkbox value="1" id="1" checked="{{cbs[1].checked}}" bindtap="radioTap"/>
</view>
<view class="weui-cell__bd {{cbs[1].checked==false?'.check-box-off':''}}">
<input class="weui-input" id="1" bindtap="inputTap" bindinput="bindKeyTag" placeholder="{{cbs[1].holder}}" value="{{cbs[1].name}}"/>
</view>
</label>
<label class="weui-cell" style="padding-left:6px;padding-right:6px;">
<view class="weui-cell__hd">
<checkbox value="2" id="2" checked="{{cbs[2].checked}}" bindtap="radioTap"/>
</view>
<view class="weui-cell__bd {{cbs[2].checked==false?'.check-box-off':''}}">
<input class="weui-input" id="2" bindtap="inputTap" bindinput="bindKeyTag" placeholder="{{cbs[2].holder}}" value="{{cbs[2].name}}"/>
</view>
</label>
</view>
</view>
<view style="display:flex; flex-direction: row;"> <view style="display:flex; flex-direction: row;">
<view class="section" style="background: #fff;margin-top:32rpx;padding:32rpx;width:55%"> <view class="section" style="background: #fff;margin-top:32rpx;padding:32rpx;width:55%">
......
page{ page{
...@@ -91,4 +91,8 @@ page{ ...@@ -91,4 +91,8 @@ page{
color: rgba(55, 134, 244, 1); color: rgba(55, 134, 244, 1);
width: 100%; width: 100%;
word-break: normal; word-break: normal;
} }
\ No newline at end of file
.check-box-off {
color:rgba(0,0,0,0.6);
}
// pages/member/activity-post/activity-submit/activity-submit.js // pages/member/activity-post/activity-submit/activity-submit.js
...@@ -332,7 +332,7 @@ Page({ ...@@ -332,7 +332,7 @@ Page({
}, },
success: res => { success: res => {
if (res.statusCode == 200) { if (res.statusCode == 200) {
console.log("=== oss getToken 返回值_", res.data) console.log("=== oss getToken_" + dir +"_ done", res.data)
var dict = { var dict = {
accessid: res.data.data.accessid, accessid: res.data.data.accessid,
policy: res.data.data.policy, policy: res.data.data.policy,
...@@ -388,7 +388,7 @@ Page({ ...@@ -388,7 +388,7 @@ Page({
}, },
//上传照片(阿里云) //上传照片(阿里云)
uploadAli: function (tag, title, content, photoArr, product, startDatetime, endDatetime) { uploadAli: function (tag, title, content, photoArr, product, activityType, fairName, communityName,startDatetime, endDatetime) {
var _this = this; var _this = this;
console.log("===uploadAli_data_tag: ",tag) console.log("===uploadAli_data_tag: ",tag)
console.log("===uploadAli_data_title: ",title) console.log("===uploadAli_data_title: ",title)
...@@ -447,7 +447,10 @@ Page({ ...@@ -447,7 +447,10 @@ Page({
} }
var callback_param = { var callback_param = {
'callbackUrl': strUrl, 'callbackUrl': strUrl,
'callbackBody': 'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}&tag=' + encodeURI(encodeURI(tag)) + '&title=' + encodeURI(encodeURI(title)) + '&content=' + encodeURI(encodeURI(content)) + '&image=' + image + '&userId=' + user_id + '&memberId=' + member_id + '&addressId=' + address_id + encodeURI (encodeURI(strParam)) + '&startDatetime=' + startDatetime + '&endDatetime=' + endDatetime, 'callbackBody': 'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}&tag=' + encodeURI(encodeURI(tag)) + '&title=' + encodeURI(encodeURI(title)) + '&content=' + encodeURI(encodeURI(content)) + '&image=' + image + '&userId=' + user_id + '&memberId=' + member_id + '&addressId=' + address_id + encodeURI (encodeURI(strParam)) + '&startDatetime=' + startDatetime + '&endDatetime=' + endDatetime
+ '&activityType=' + encodeURI(encodeURI(activityType))
+ '&fairName=' + encodeURI(encodeURI(fairName))
+ '&communityName=' + encodeURI(encodeURI(communityName)),
'callbackBodyType': "application/x-www-form-urlencoded", 'callbackBodyType': "application/x-www-form-urlencoded",
} }
var base64_callback_body = base64.encode(JSON.stringify(callback_param)); var base64_callback_body = base64.encode(JSON.stringify(callback_param));
...@@ -490,8 +493,23 @@ Page({ ...@@ -490,8 +493,23 @@ Page({
var photoArr = app.globalData.postData.photoArray; var photoArr = app.globalData.postData.photoArray;
var tag = app.globalData.postData.photoTag var tag = app.globalData.postData.photoTag
var product = app.globalData.postData.photoProduct var product = app.globalData.postData.photoProduct
var cbs = app.globalData.postData.photoCbs
var startDatetime = app.globalData.postData.startDatetime var startDatetime = app.globalData.postData.startDatetime
var endDatetime = app.globalData.postData.endDatetime var endDatetime = app.globalData.postData.endDatetime
var list = []
var activityType = ""
var fairName = ""
var communityName = ""
for(var i=0; i<cbs.length; i++)
{
if(cbs[i].checked == true )
{
list.push(cbs[i].type)
}
}
activityType = list.join("::")
fairName = cbs[1].checked == true ? cbs[1].name : ""
communityName = cbs[2].checked == true ? cbs[2].name : ""
//时间戳 //时间戳
var expire = this.data.oss['userToken'].expire; var expire = this.data.oss['userToken'].expire;
...@@ -507,13 +525,13 @@ Page({ ...@@ -507,13 +525,13 @@ Page({
promise_oss.then( promise_oss.then(
function (value) { function (value) {
console.log("===enter promise_oss user_token then_pass") console.log("===enter promise_oss user_token then_pass")
_this.uploadAli(tag, title, content, photoArr, product, startDatetime, endDatetime) _this.uploadAli(tag, title, content, photoArr, product, activityType, fairName, communityName, startDatetime, endDatetime)
}); });
} }
else else
{ {
_this.uploadAli(tag, title, content, photoArr, product, startDatetime, endDatetime) _this.uploadAli(tag, title, content, photoArr, product, activityType, fairName, communityName,startDatetime, endDatetime)
} }
}, },
...@@ -529,6 +547,7 @@ Page({ ...@@ -529,6 +547,7 @@ Page({
photoTitle: "", photoTitle: "",
photoContent: "", photoContent: "",
photoProduct: [], photoProduct: [],
photoCbs: [],
startDatetime: "", startDatetime: "",
endDatetime: "", endDatetime: "",
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论