From fbc5d6ee218597bddf605c9c31baee9845e8e3dc Mon Sep 17 00:00:00 2001 From: slj Date: Tue, 23 Nov 2021 10:29:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9D=A5=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/cell/index.wxss | 2 +- models/topic.js | 2 +- pages/resource/detail/index.wxss | 1 + .../activity/activity Registration/index.js | 169 --------------- .../activity/activity Registration/index.wxml | 27 --- pages/topics/activity/activitySign/index.js | 108 +++++++++- .../index.json | 0 pages/topics/activity/activitySign/index.wxml | 27 ++- .../index.wxss | 0 pages/topics/activity/cell/index.wxss | 2 +- pages/topics/activity/index.wxss | 6 +- pages/topics/index.js | 33 ++- pages/topics/reportDemand/index.js | 203 ++++++++++-------- pages/topics/reportDemand/index.wxml | 2 +- 14 files changed, 265 insertions(+), 317 deletions(-) delete mode 100644 pages/topics/activity/activity Registration/index.js delete mode 100644 pages/topics/activity/activity Registration/index.wxml rename pages/topics/activity/{activity Registration => activitySign}/index.json (100%) rename pages/topics/activity/{activity Registration => activitySign}/index.wxss (100%) diff --git a/components/cell/index.wxss b/components/cell/index.wxss index 9415de3..44062f5 100644 --- a/components/cell/index.wxss +++ b/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; diff --git a/models/topic.js b/models/topic.js index 960be69..7f5ce6d 100644 --- a/models/topic.js +++ b/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, diff --git a/pages/resource/detail/index.wxss b/pages/resource/detail/index.wxss index 0300796..5171f0a 100644 --- a/pages/resource/detail/index.wxss +++ b/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; diff --git a/pages/topics/activity/activity Registration/index.js b/pages/topics/activity/activity Registration/index.js deleted file mode 100644 index 21965f4..0000000 --- a/pages/topics/activity/activity Registration/index.js +++ /dev/null @@ -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 () { - - } -}) \ No newline at end of file diff --git a/pages/topics/activity/activity Registration/index.wxml b/pages/topics/activity/activity Registration/index.wxml deleted file mode 100644 index 2190660..0000000 --- a/pages/topics/activity/activity Registration/index.wxml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - 姓名 - - - - - - 工作单位 - - - - - - 联系电话 - - - - - - - \ No newline at end of file diff --git a/pages/topics/activity/activitySign/index.js b/pages/topics/activity/activitySign/index.js index 90b4a8c..9ae121d 100644 --- a/pages/topics/activity/activitySign/index.js +++ b/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' + }) + } + }) }, /** diff --git a/pages/topics/activity/activity Registration/index.json b/pages/topics/activity/activitySign/index.json similarity index 100% rename from pages/topics/activity/activity Registration/index.json rename to pages/topics/activity/activitySign/index.json diff --git a/pages/topics/activity/activitySign/index.wxml b/pages/topics/activity/activitySign/index.wxml index 6a84cb7..2190660 100644 --- a/pages/topics/activity/activitySign/index.wxml +++ b/pages/topics/activity/activitySign/index.wxml @@ -1,2 +1,27 @@ -pages/topics/activity/activitySign/index.wxml + + + + 姓名 + + + + + + 工作单位 + + + + + + 联系电话 + + + + + + + \ No newline at end of file diff --git a/pages/topics/activity/activity Registration/index.wxss b/pages/topics/activity/activitySign/index.wxss similarity index 100% rename from pages/topics/activity/activity Registration/index.wxss rename to pages/topics/activity/activitySign/index.wxss diff --git a/pages/topics/activity/cell/index.wxss b/pages/topics/activity/cell/index.wxss index 92eea87..242f16a 100644 --- a/pages/topics/activity/cell/index.wxss +++ b/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 { diff --git a/pages/topics/activity/index.wxss b/pages/topics/activity/index.wxss index d184c96..7338c05 100644 --- a/pages/topics/activity/index.wxss +++ b/pages/topics/activity/index.wxss @@ -1 +1,5 @@ -/* pages/topics/activity/index.wxss */ \ No newline at end of file +/* pages/topics/activity/index.wxss */ +.container{ + padding: 0 30rpx; + box-sizing: border-box; +} \ No newline at end of file diff --git a/pages/topics/index.js b/pages/topics/index.js index db697da..8f1f1af 100644 --- a/pages/topics/index.js +++ b/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 }) } + }) }, diff --git a/pages/topics/reportDemand/index.js b/pages/topics/reportDemand/index.js index d03b9d2..ed861fa 100644 --- a/pages/topics/reportDemand/index.js +++ b/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 + }) + }, }) \ No newline at end of file diff --git a/pages/topics/reportDemand/index.wxml b/pages/topics/reportDemand/index.wxml index aadd100..f4643c9 100644 --- a/pages/topics/reportDemand/index.wxml +++ b/pages/topics/reportDemand/index.wxml @@ -28,7 +28,7 @@ 姓名 + placeholder-style='text-align:right;color:#ACACAE;' value="{{username}}"/>