Browse Source

来活动

master
slj 4 years ago
parent
commit
fbc5d6ee21
  1. 2
      components/cell/index.wxss
  2. 2
      models/topic.js
  3. 1
      pages/resource/detail/index.wxss
  4. 169
      pages/topics/activity/activity Registration/index.js
  5. 27
      pages/topics/activity/activity Registration/index.wxml
  6. 108
      pages/topics/activity/activitySign/index.js
  7. 0
      pages/topics/activity/activitySign/index.json
  8. 27
      pages/topics/activity/activitySign/index.wxml
  9. 0
      pages/topics/activity/activitySign/index.wxss
  10. 2
      pages/topics/activity/cell/index.wxss
  11. 4
      pages/topics/activity/index.wxss
  12. 33
      pages/topics/index.js
  13. 181
      pages/topics/reportDemand/index.js
  14. 2
      pages/topics/reportDemand/index.wxml

2
components/cell/index.wxss

@ -4,7 +4,7 @@
border-bottom: 1px solid #E7E7E7; border-bottom: 1px solid #E7E7E7;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 10px 20rpx; padding: 20rpx 20rpx;
} }
.cell-left { .cell-left {
flex:1; flex:1;

2
models/topic.js

@ -338,7 +338,7 @@ class TopicModel extends HTTP {
getActivityList(source, page, success) { getActivityList(source, page, success) {
let params = { let params = {
url: TopicBaseUrl.activity_list_url, url: TopicBaseUrl.activity_list_url,
method: Method.POST, method: Method.GET,
data: { data: {
source:source, source:source,
pageNo:page, pageNo:page,

1
pages/resource/detail/index.wxss

@ -85,6 +85,7 @@ page{
.resource-activity-lists .list-title{ .resource-activity-lists .list-title{
font-size: 32rpx; font-size: 32rpx;
color: #4f4f4f; color: #4f4f4f;
padding-left: 20rpx;
} }
.section_line { .section_line {
padding: 0; padding: 0;

169
pages/topics/activity/activity Registration/index.js

@ -1,169 +0,0 @@
// pages/topics/activity/activitySign/index.js
import {
store
} from '../../../../utils/store.js'
import {
TopicModel
} from '../../../../models/topic.js'
let topicModel = new TopicModel()
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
aId: '',
username: '',
company: '',
phone: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
this.setData({
aId: options.activityId
})
this.initFormData()
// console.log(this.data.aId)
},
initFormData() {
let {
nickName,
phone
} = store.readUserInfo()
this.setData({
username: nickName,
phone: phone
})
},
changeCompany: function (e) {
var company = e.detail.value;
this.setData({
company: company
})
},
changeUsername: function (e) {
var username = e.detail.value;
this.setData({
username: username
})
},
changePhone: function (e) {
let isPhoneFlag = this.isPhone(e.detail.value)
if (!isPhoneFlag) {
wx.showToast({
title: '请输入正确格式的手机号',
icon: 'none',
duration: 2000,
})
return;
}
this.setData({
phone: e.detail.value
})
},
isPhone(value) {
if (!/^1(3|4|5|7|8)\d{9}$/.test(value)) {
return false
} else {
return true
}
},
submit() {
var th = this;
if (this.data.username === '') {
wx.showModal({
title: '提示',
content: '请输入姓名',
showCancel: false
})
return
}
if (this.data.phone === '') {
wx.showModal({
title: '提示',
content: '请输入联系电话',
showCancel: false
})
return
}
this.onlineSignApi()
},
//在线报名
onlineSignApi() {
topicModel.onlineSign(this.data.aId, res => {
if (res.code == 200) {
console.log(res.code);
wx.showModal({
title: res.message,
showCancel: false, //是否显示取消按钮
confirmText: "确定", //默认是“确定”
success: function (res) {
app.globalData.currentTab = "5"
wx.switchTab({
url: '../../../topics/index'
})
},
})
}
if (res.code != 200) {
wx.showToast({
title: res.message,
icon: 'none'
})
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

27
pages/topics/activity/activity Registration/index.wxml

@ -1,27 +0,0 @@
<!--pages/topics/activity/activitySign/index.wxml-->
<view class="container">
<view class="select-view">
<view class="select-con">
<text>姓名</text>
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changeUsername' placeholder="请输入姓名"
placeholder-style='text-align:right;color:#ACACAE;' value="{{username}}"/>
</view>
</view>
<view class="select-view">
<view class="select-con">
<text>工作单位</text>
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changeCompany' placeholder="请输入工作单位"
placeholder-style='text-align:right;color:#ACACAE;' value="{{company}}"/>
</view>
</view>
<view class="select-view">
<view class="select-con">
<text>联系电话</text>
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changePhone' placeholder="请输入联系电话"
placeholder-style='text-align:right;color:#ACACAE;' value="{{phone}}"/>
</view>
</view>
</view>
<view class="btnView">
<e-ibutton title="提交" bind:onTap="submit" />
</view>

108
pages/topics/activity/activitySign/index.js

@ -1,18 +1,120 @@
// pages/topics/activity/activitySign/index.js // pages/topics/activity/activitySign/index.js
import {
store
} from '../../../../utils/store.js'
import {
TopicModel
} from '../../../../models/topic.js'
let topicModel = new TopicModel()
const app = getApp()
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
aId: '',
username: '',
company: '',
phone: ''
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
aId: options.activityId
})
this.initFormData()
// console.log(this.data.aId)
},
initFormData() {
let {
nickName,
phone
} = store.readUserInfo()
this.setData({
username: nickName,
phone: phone
})
},
changeCompany: function (e) {
var company = e.detail.value;
this.setData({
company: company
})
},
changeUsername: function (e) {
var username = e.detail.value;
this.setData({
username: username
})
},
changePhone: function (e) {
let isPhoneFlag = this.isPhone(e.detail.value)
if (!isPhoneFlag) {
wx.showToast({
title: '请输入正确格式的手机号',
icon: 'none',
duration: 2000,
})
return;
}
this.setData({
phone: e.detail.value
})
},
isPhone(value) {
if (!/^1(3|4|5|7|8)\d{9}$/.test(value)) {
return false
} else {
return true
}
},
submit() {
var th = this;
if (this.data.username === '') {
wx.showModal({
title: '提示',
content: '请输入姓名',
showCancel: false
})
return
}
if (this.data.phone === '') {
wx.showModal({
title: '提示',
content: '请输入联系电话',
showCancel: false
})
return
}
this.onlineSignApi()
},
//在线报名
onlineSignApi() {
topicModel.onlineSign(this.data.aId, res => {
if (res.code == 200) {
console.log(res.code);
wx.showModal({
title: res.message,
showCancel: false, //是否显示取消按钮
confirmText: "确定", //默认是“确定”
success: function (res) {
app.globalData.currentTab = "5"
wx.switchTab({
url: '../../../topics/index'
})
},
})
}
if (res.code != 200) {
wx.showToast({
title: res.message,
icon: 'none'
})
}
})
}, },
/** /**

0
pages/topics/activity/activity Registration/index.json → pages/topics/activity/activitySign/index.json

27
pages/topics/activity/activitySign/index.wxml

@ -1,2 +1,27 @@
<!--pages/topics/activity/activitySign/index.wxml--> <!--pages/topics/activity/activitySign/index.wxml-->
<text>pages/topics/activity/activitySign/index.wxml</text> <view class="container">
<view class="select-view">
<view class="select-con">
<text>姓名</text>
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changeUsername' placeholder="请输入姓名"
placeholder-style='text-align:right;color:#ACACAE;' value="{{username}}"/>
</view>
</view>
<view class="select-view">
<view class="select-con">
<text>工作单位</text>
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changeCompany' placeholder="请输入工作单位"
placeholder-style='text-align:right;color:#ACACAE;' value="{{company}}"/>
</view>
</view>
<view class="select-view">
<view class="select-con">
<text>联系电话</text>
<input style="margin-right:20px;text-align: right;" type="text" bindinput='changePhone' placeholder="请输入联系电话"
placeholder-style='text-align:right;color:#ACACAE;' value="{{phone}}"/>
</view>
</view>
</view>
<view class="btnView">
<e-ibutton title="提交" bind:onTap="submit" />
</view>

0
pages/topics/activity/activity Registration/index.wxss → pages/topics/activity/activitySign/index.wxss

2
pages/topics/activity/cell/index.wxss

@ -124,7 +124,7 @@ image{
margin-left: -120px; margin-left: -120px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
padding: 60rpx 28rpx 40rpx 34rpx; padding: 60rpx 20rpx 40rpx 20rpx;
align-items: center; align-items: center;
} }
.del { .del {

4
pages/topics/activity/index.wxss

@ -1 +1,5 @@
/* pages/topics/activity/index.wxss */ /* pages/topics/activity/index.wxss */
.container{
padding: 0 30rpx;
box-sizing: border-box;
}

33
pages/topics/index.js

@ -38,7 +38,7 @@ Page({
height: app.globalData.windowHeight - 44, height: app.globalData.windowHeight - 44,
flag: 0, flag: 0,
//来活动 //来活动
activityList:[] activityList: []
}, },
/** /**
@ -56,7 +56,7 @@ Page({
//文章关联链接跳转 显示 报需求 还是来活动 tab //文章关联链接跳转 显示 报需求 还是来活动 tab
let curTab = app.globalData.currentTab let curTab = app.globalData.currentTab
if (curTab) { if (curTab) {
console.log("currentTab:" + curTab) // console.log("currentTab:" + curTab)
this.setData({ this.setData({
active: curTab, active: curTab,
tab: curTab tab: curTab
@ -70,9 +70,7 @@ Page({
topicList: [], topicList: [],
goodIdeaList: [], goodIdeaList: [],
centerList: [], centerList: [],
oceanList: [], activityList: [],
spaceList: [],
activityList:[],
page: 1, page: 1,
next: true next: true
}) })
@ -168,9 +166,7 @@ Page({
tab: tab, tab: tab,
topicList: [], topicList: [],
centerList: [], centerList: [],
oceanList: [], activityList: [],
spaceList: [],
activityList:[],
}) })
this.getData(tab); this.getData(tab);
@ -181,7 +177,6 @@ Page({
switch (tab) { switch (tab) {
case "3": case "3":
return this.fetchCenterList() return this.fetchCenterList()
// return this.fetchTopicList();
case "5": case "5":
return this.fetchActivityList(); return this.fetchActivityList();
default: default:
@ -287,21 +282,22 @@ Page({
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom: function () { onReachBottom: function () {
console.log('---触底了---')
var next = this.data.next; var next = this.data.next;
var tab = this.data.tab; var tab = this.data.tab;
var page = this.data.page; var page = this.data.page;
if (!next) { if (!next) {
return; return;
} }
this.setData({ this.setData({
page: page + 1 page: page + 1
}) })
switch (tab) { switch (tab) {
case "3": case "3":
return this.fetchCenterList(); this.fetchCenterList()
// return this.fetchTopicList(); return;
case "5":
return this.fetchActivityList();
default: default:
return; return;
} }
@ -325,8 +321,6 @@ Page({
case 0: case 0:
return that.fetchTopicList() return that.fetchTopicList()
case 1: case 1:
// return that.fetchGoodIdeaList()
//GoodIdea修改为center
return that.fetchCenterList() return that.fetchCenterList()
} }
} }
@ -377,9 +371,9 @@ Page({
var th = this; var th = this;
var page = th.data.page; var page = th.data.page;
var list = th.data.activityList; var list = th.data.activityList;
let source='' let source = ''
topicModel.getActivityList(source,page, res => { topicModel.getActivityList(source, page, res => {
console.log('活动列表') console.log('活动列表---')
console.log(res) console.log(res)
if (res.result.records.length == 0 && page == 1) { if (res.result.records.length == 0 && page == 1) {
wx.showToast({ wx.showToast({
@ -395,7 +389,7 @@ Page({
title: item.title, title: item.title,
activityImg: item.titlePic, activityImg: item.titlePic,
time: item.createTime, time: item.createTime,
commentNum:item.commentNum, commentNum: item.commentNum,
dataIndex: index + ((page - 1) * 10), dataIndex: index + ((page - 1) * 10),
isTouchMove: false, isTouchMove: false,
}) })
@ -412,6 +406,7 @@ Page({
page: page - 1 page: page - 1
}) })
} }
}) })
}, },

181
pages/topics/reportDemand/index.js

@ -1,7 +1,13 @@
// pages/topics/reportDemand/index.js // pages/topics/reportDemand/index.js
import { config } from '../../../config.js' import {
import { store } from '../../../utils/store.js' config
import { TopicModel } from '../../../models/topic.js' } from '../../../config.js'
import {
store
} from '../../../utils/store.js'
import {
TopicModel
} from '../../../models/topic.js'
let topicModel = new TopicModel() let topicModel = new TopicModel()
Page({ Page({
@ -10,26 +16,26 @@ Page({
*/ */
data: { data: {
//类型 //类型
type:'', type: '',
messageTitle:"", messageTitle: "",
messageDetail:"", messageDetail: "",
messageTemp:"", messageTemp: "",
files: [], files: [],
// 所在街道 // 所在街道
streets: [], streets: [],
streetsIndex: 0, streetsIndex: 0,
typeList:[], typeList: [],
typeListIndex:0, typeListIndex: 0,
//接口街道的数据 //接口街道的数据
results:[], results: [],
list:[], list: [],
//选择后获取的街道的I, //选择后获取的街道的I,
streetID:'', streetID: '',
typeCode:'', typeCode: '',
textareaValue:'', textareaValue: '',
error:'', error: '',
company:'', company: '',
username:'' username: ''
}, },
/** /**
@ -39,6 +45,7 @@ Page({
this.setData({ this.setData({
uplaodFile: this.uplaodFile.bind(this) uplaodFile: this.uplaodFile.bind(this)
}) })
this.initFormData()
this.getStreetList() this.getStreetList()
this.getWhistleTypeList() this.getWhistleTypeList()
}, },
@ -90,16 +97,16 @@ Page({
onShareAppMessage: function () { onShareAppMessage: function () {
}, },
getStreetList(){ getStreetList() {
topicModel.getStreetList(res=>{ topicModel.getStreetList(res => {
var resultss = res.result var resultss = res.result
var streett = [] var streett = []
resultss.forEach((value,index)=>{ resultss.forEach((value, index) => {
streett[index] = value.departName streett[index] = value.departName
}) })
//把streett添加第一项设为空 //把streett添加第一项设为空
streett.unshift('') streett.unshift('')
console.log('街道-->',streett) console.log('街道-->', streett)
this.setData({ this.setData({
streets: streett streets: streett
@ -111,11 +118,11 @@ Page({
console.log(this.data.results) console.log(this.data.results)
}) })
}, },
getWhistleTypeList(){ getWhistleTypeList() {
topicModel.getWhistleTypeList(res=>{ topicModel.getWhistleTypeList(res => {
var result = res.result var result = res.result
var typeList = [] var typeList = []
result.forEach((value,index)=>{ result.forEach((value, index) => {
typeList[index] = value.typeName typeList[index] = value.typeName
}) })
//把streett添加第一项设为空 //把streett添加第一项设为空
@ -129,32 +136,32 @@ Page({
}) })
}) })
}, },
bindPickerStreetsChange: function(e) { bindPickerStreetsChange: function (e) {
this.setData({ this.setData({
streetsIndex: e.detail.value, streetsIndex: e.detail.value,
}) })
if(e.detail.value == '0'){ if (e.detail.value == '0') {
this.setData({ this.setData({
streetID: '' streetID: ''
}) })
}else{ } else {
this.setData({ this.setData({
streetID: this.data.results[this.data.streetsIndex-1].id streetID: this.data.results[this.data.streetsIndex - 1].id
}) })
} }
}, },
bindPickerTypeChange:function(e){ bindPickerTypeChange: function (e) {
this.setData({ this.setData({
typeListIndex: e.detail.value, typeListIndex: e.detail.value,
}) })
if(e.detail.value == '0'){ if (e.detail.value == '0') {
this.setData({ this.setData({
typeCode: '' typeCode: ''
}) })
}else{ } else {
this.setData({ this.setData({
typeCode: this.data.list[this.data.typeListIndex-1].typeCode typeCode: this.data.list[this.data.typeListIndex - 1].typeCode
}) })
} }
@ -170,7 +177,7 @@ Page({
messageDetail: e.detail.value, messageDetail: e.detail.value,
}) })
console.log(e.detail.value.length) console.log(e.detail.value.length)
if(e.detail.value.length >= 200){ if (e.detail.value.length >= 200) {
// wx.showToast({ // wx.showToast({
// title: '超过字数', // title: '超过字数',
// duration: 2000, // duration: 2000,
@ -188,7 +195,7 @@ Page({
console.log(token) console.log(token)
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
files.tempFilePaths.forEach(item => { files.tempFilePaths.forEach(item => {
console.log('item',item) console.log('item', item)
wx.uploadFile({ wx.uploadFile({
url: config.api_url + "/api/common/upload", url: config.api_url + "/api/common/upload",
filePath: item, filePath: item,
@ -224,116 +231,116 @@ Page({
}, },
submit() { submit() {
var th =this; var th = this;
if (this.data.messageDetail.length >200){ if (this.data.messageDetail.length > 200) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '问题超过字数,请重新输入', content: '问题超过字数,请重新输入',
showCancel:false, showCancel: false,
}) })
return return
} }
if (this.data.messageDetail === ''){ if (this.data.messageDetail === '') {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '请输入正文内容', content: '请输入正文内容',
showCancel:false showCancel: false
}) })
return return
} }
if (this.data.username === ''){ if (this.data.username === '') {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '请输入姓名', content: '请输入姓名',
showCancel:false showCancel: false
}) })
return return
} }
if (this.data.username.length >15){ if (this.data.username.length > 15) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '姓名长度不能超过15', content: '姓名长度不能超过15',
showCancel:false, showCancel: false,
}) })
return return
} }
if (this.data.company === ''){ if (this.data.company === '') {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '请输入工作单位', content: '请输入工作单位',
showCancel:false showCancel: false
}) })
return return
} }
if (this.data.company.length >15){ if (this.data.company.length > 15) {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '工作单位长度不能超过15', content: '工作单位长度不能超过15',
showCancel:false, showCancel: false,
}) })
return return
} }
//判断是否选择街道 //判断是否选择街道
if (this.data.streetID === ''){ if (this.data.streetID === '') {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '请输入街道', content: '请输入街道',
showCancel:false showCancel: false
}) })
return return
} }
if (this.data.typeCode === ''){ if (this.data.typeCode === '') {
wx.showModal({ wx.showModal({
title: '提示', title: '提示',
content: '请选择需求类型', content: '请选择需求类型',
showCancel:false showCancel: false
}) })
return return
} }
if(this.data.type == 'resource'){ if (this.data.type == 'resource') {
var questionType = 0; var questionType = 0;
}else{ } else {
var questionType = 2; var questionType = 2;
} }
var data = { var data = {
content:this.data.messageDetail, content: this.data.messageDetail,
picList:this.data.files, picList: this.data.files,
departId:this.data.streetID, departId: this.data.streetID,
typeCode:this.data.typeCode, typeCode: this.data.typeCode,
questionType:questionType, questionType: questionType,
id:this.properties.tpId, id: this.properties.tpId,
workplace:this.data.company, workplace: this.data.company,
name:this.data.username name: this.data.username
} }
topicModel.addTalents(data,res=>{ topicModel.addTalents(data, res => {
const id = res.result; const id = res.result;
if(res.code === 200){ if (res.code === 200) {
this.setData({ this.setData({
messageDetail: '', messageDetail: '',
streetID:'', streetID: '',
typeCode:'', typeCode: '',
files:[], files: [],
},()=>{ }, () => {
wx.showModal({ wx.showModal({
title: '提交成功', title: '提交成功',
content: '问题已收到!', content: '问题已收到!',
cancelText:'知道了', cancelText: '知道了',
confirmText:'查看进度', confirmText: '查看进度',
success (res) { success(res) {
if (res.confirm) { if (res.confirm) {
wx.redirectTo({ wx.redirectTo({
url: '/pages/user/myWhistle/whistleDetail/index?id='+id, url: '/pages/user/myWhistle/whistleDetail/index?id=' + id,
}) })
}else if (res.cancel) { // 点击知道了 } else if (res.cancel) { // 点击知道了
if(th.properties.type == ''){ if (th.properties.type == '') {
setTimeout(function(){ setTimeout(function () {
th.setData({ th.setData({
textareaValue:'' textareaValue: ''
}) })
}, 500); }, 500);
}else{ } else {
console.log(1212); console.log(1212);
wx.navigateBack({ wx.navigateBack({
delta: 1 delta: 1
@ -347,19 +354,29 @@ Page({
}) })
this.setData({ this.setData({
streetsIndex: 0, streetsIndex: 0,
typeListIndex:0, typeListIndex: 0,
}) })
}, },
company:function(e){ company: function (e) {
var company = e.detail.value; var company = e.detail.value;
this.setData({ this.setData({
company:company company: company
}) })
}, },
username:function(e){ username: function (e) {
var username = e.detail.value; var username = e.detail.value;
this.setData({ this.setData({
username:username username: username
}) })
} },
initFormData() {
let {
nickName,
phone
} = store.readUserInfo()
this.setData({
username: nickName,
phone: phone
})
},
}) })

2
pages/topics/reportDemand/index.wxml

@ -28,7 +28,7 @@
<view class="select-con"> <view class="select-con">
<text>姓名</text> <text>姓名</text>
<input style="margin-right:20px;text-align: right;" type="text" bindinput='username' placeholder="请输入姓名" <input style="margin-right:20px;text-align: right;" type="text" bindinput='username' placeholder="请输入姓名"
placeholder-style='text-align:right;color:#ACACAE;' /> placeholder-style='text-align:right;color:#ACACAE;' value="{{username}}"/>
</view> </view>
</view> </view>
<view class="select-view"> <view class="select-view">

Loading…
Cancel
Save