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. 6
      pages/topics/activity/index.wxss
  12. 33
      pages/topics/index.js
  13. 203
      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;
display: flex;
flex-direction: row;
padding: 10px 20rpx;
padding: 20rpx 20rpx;
}
.cell-left {
flex:1;

2
models/topic.js

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

1
pages/resource/detail/index.wxss

@ -85,6 +85,7 @@ page{
.resource-activity-lists .list-title{
font-size: 32rpx;
color: #4f4f4f;
padding-left: 20rpx;
}
.section_line {
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
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) {
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-->
<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;
display: flex;
flex-direction: row;
padding: 60rpx 28rpx 40rpx 34rpx;
padding: 60rpx 20rpx 40rpx 20rpx;
align-items: center;
}
.del {

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

203
pages/topics/reportDemand/index.js

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

Loading…
Cancel
Save