diff --git a/app.js b/app.js index 5c68452..6dea786 100644 --- a/app.js +++ b/app.js @@ -4,11 +4,52 @@ App({ var that = this; //获取设备信息 this.setMenuHeight() + this.autoUpdate() + }, + autoUpdate:function(){ + console.log(new Date()) + var self=this + // 获取小程序更新机制兼容 + if (wx.canIUse('getUpdateManager')) { + const updateManager = wx.getUpdateManager() + //1. 检查小程序是否有新版本发布 + updateManager.onCheckForUpdate(function (res) { + // 请求完新版本信息的回调 + if (res.hasUpdate) { + //2. 小程序有新版本,则静默下载新版本,做好更新准备 + updateManager.onUpdateReady(function () { + console.log(new Date()) + wx.showModal({ + title: '更新提示', + content: '新版本已经准备好,是否重启应用?', + success: function (res) { + if (res.confirm) { + //3. 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 + updateManager.applyUpdate() + } + } + }) + }) + updateManager.onUpdateFailed(function () { + // 新的版本下载失败 + wx.showModal({ + title: '已经有新版本了哟~', + content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~', + }) + }) + } + }) + } else { + // 如果希望用户在最新版本的客户端上体验您的小程序,可以这样子提示 + wx.showModal({ + title: '提示', + content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。' + }) + } }, onShow(e){ //隐藏系统tabbar wx.hideTabBar(); - var query = {}; if(e.query.q){ //通过扫码进来获取二维码上的参数并存入storage @@ -61,44 +102,26 @@ App({ tabbar: tabbar }); }, - getToken(){ - // console.log('getToken') - var tokentime = wx.getStorageSync('tokentime') || '';//过期时间 - var timestamp = Date.parse(new Date());// 当前时间 - var expiration = timestamp + 60000 * 60 * 12; //缓存12小时 - var token = wx.getStorageSync('token') || ''; - this.login(expiration); - }, - login(expiration){ - wx.login({ - success: res => { - // 发送 res.code 到后台换取 openId, sessionKey, unionId - // console.log('code:',res.code) - this.http('GET','wechat/auth',{code : res.code,spread:0,login_type:0}).then( - response =>{ - if(response.data.isSuccess){ - wx.setStorageSync('token', 'Bearer '+ response.data.data.token); - wx.setStorageSync('uid', response.data.data.userId); - wx.setStorageSync('tokentime', expiration); - } else{ - wx.showToast({ - title: response.data.msg, - icon : 'none' - }) - } - } - ) - } - }) - }, getInfo(){ this.http('get','userinfo').then((res)=>{ if(res.data.success){ + // console.log(res.data) wx.setStorageSync('userInfo',res.data.data) var pages = getCurrentPages().pop();//当前页面 if (pages.getUser){ pages.getUser(); } + } else{ + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateTo({ + url: '/pages/login/index', + }) + },2000) } }) }, @@ -120,10 +143,13 @@ App({ data: params || {}, //请求参数 success: res => { wx.hideLoading(); + console.log(res) //判断token是否过期 res.data.code == 40001 - if(!res.data.isSuccess && res.data.code == 40001){ - console.log('token过期') - that.getToken() + if(!res.data.success && res.data.status == 401){ + console.log('登陆失效') + wx.navigateTo({ + url: '/pages/login/index', + }) } resolve(res); //成功执行方法,参数值为res.data,直接将返回的数据传入 @@ -142,8 +168,8 @@ App({ ) }, globalData: { - // baseURL : 'http://192.168.0.114:8092/api/', - baseURL : 'https://www.cyjyyjy.com:8093/api/', + baseURL : 'http://192.168.0.114:8092/api/', + // baseURL : 'https://www.cyjyyjy.com:8093/api/', userInfo: null, navHeight : 0, navTopHeight: 0, @@ -155,18 +181,18 @@ App({ tabBar: { "backgroundColor": "#ffffff", "color": "#979795", - "selectedColor": "#1c1c1b", + "selectedColor": "#FF6F34", "list": [ { "pagePath": "/pages/index/index", - "iconPath": "icon/icon_home.png", - "selectedIconPath": "icon/icon_home_HL.png", + "iconPath": "icon/home.png", + "selectedIconPath": "icon/home-a.png", "text": "首页" }, { "pagePath": "/pages/demandHall/index", - "iconPath": "icon/icon_home.png", - "selectedIconPath": "icon/icon_home_HL.png", + "iconPath": "icon/tab2.png", + "selectedIconPath": "icon/tab2-a.png", "text": "供需大厅" }, { @@ -177,14 +203,14 @@ App({ }, { "pagePath": "/pages/life/index", - "iconPath": "icon/icon_mine.png", - "selectedIconPath": "icon/icon_mine_HL.png", - "text": "购物车" + "iconPath": "icon/tab3.png", + "selectedIconPath": "icon/tab3-a.png", + "text": "生活" }, { "pagePath": "/pages/user/index", - "iconPath": "icon/icon_mine.png", - "selectedIconPath": "icon/icon_mine_HL.png", + "iconPath": "icon/tab4.png", + "selectedIconPath": "icon/tab4-a.png", "text": "我的" } ] diff --git a/app.json b/app.json index d47029f..24761a1 100644 --- a/app.json +++ b/app.json @@ -1,23 +1,34 @@ { "pages":[ + "pages/index/index", "pages/user/index", + "pages/login/index", + "pages/webview/index", + "pages/demandHall/createProject/index", + "pages/demandHall/needsContact/index", + "pages/user/needsOrder/index", + "pages/user/resourcesOrder/index", + "pages/user/needsManage/index", + "pages/user/resourcesManage/index", + "pages/user/editNeeds/index", "pages/demandHall/needsDetail/index", "pages/demandHall/resourcesDetail/index", "pages/demandHall/companyDetail/index", + "pages/demandHall/resourcesContact/index", + "pages/demandHall/applyDetail/index", + "pages/demandHall/platform/index", "pages/demandHall/index", "pages/release/index", "pages/release/personAuth/index", "pages/release/companyAuth/index", "pages/release/perfectPersonInfo/index", "pages/release/perfectCompanyInfo/index", - "pages/index/index", + "pages/life/index", "pages/user/mine/index", - "pages/user/agreement/index", "pages/user/incomeDetail/index", "pages/user/profession/index", - "pages/user/completeData/index", "pages/user/personalData/index", "pages/user/industry/index" @@ -36,29 +47,34 @@ { "pagePath": "pages/index/index", "text": "首页", - "iconPath": "tabbarComponent/icon/icon_home.png", - "selectedIconPath": "tabbarComponent/icon/icon_home_HL.png" + "iconPath": "tabbarComponent/icon/home.png", + "selectedIconPath": "tabbarComponent/icon/home-a.png" }, { "pagePath": "pages/demandHall/index", "text": "供需大厅", - "iconPath": "tabbarComponent/icon/icon_home.png", - "selectedIconPath": "tabbarComponent/icon/icon_home_HL.png" + "iconPath": "tabbarComponent/icon/tab2.png", + "selectedIconPath": "tabbarComponent/icon/tab2-a.png" }, { "pagePath": "pages/life/index", "text": "生活", - "iconPath": "tabbarComponent/icon/icon_mine.png", - "selectedIconPath": "tabbarComponent/icon/icon_mine_HL.png" + "iconPath": "tabbarComponent/icon/tab3.png", + "selectedIconPath": "tabbarComponent/icon/tab3-a.png" }, { "pagePath": "pages/user/index", "text": "我的", - "iconPath": "tabbarComponent/icon/icon_mine.png", - "selectedIconPath": "tabbarComponent/icon/icon_mine_HL.png" + "iconPath": "tabbarComponent/icon/tab4.png", + "selectedIconPath": "tabbarComponent/icon/tab4-a.png" } ] }, "style": "v2", + "permission": { + "scope.userLocation": { + "desc": "你的位置信息将用于小程序位置接口的效果展示" + } + }, "sitemapLocation": "sitemap.json" } diff --git a/app.wxss b/app.wxss index fb453d8..d999bd8 100644 --- a/app.wxss +++ b/app.wxss @@ -9,7 +9,10 @@ label, navigator, image { -webkit-box-sizing: border-box; - box-sizing: border-box; + box-sizing: border-box; +} +image{ + /* border-radius: 8rpx; */ } /* layout */ .acea-row-nowrap { @@ -120,4 +123,29 @@ radio .wx-radio-input.wx-radio-input-checked::before { border: 2rpx solid #FF5100; transform: translate(-50%, -50%) scale(1); -webkit-transform: translate(-50%, -50%) scale(1); +} + +.no-list{ + display: flex; + flex-direction: column; + align-items: center; + font-size: 46rpx; + color: #D8D8D8; + font-weight: 500; + padding-top: 20%; +} +.no-list image{ + width: 536rpx; + height: 490rpx; +} +.no-list .to-btn{ + width: 458rpx; + height: 88rpx; + line-height: 88rpx; + text-align: center; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 44rpx; + font-size: 40rpx; + color: #fff; + margin-top: 160rpx; } \ No newline at end of file diff --git a/images/arrow-d.png b/images/arrow-d.png new file mode 100644 index 0000000..a9d6b9a Binary files /dev/null and b/images/arrow-d.png differ diff --git a/images/home/call.png b/images/home/call.png new file mode 100644 index 0000000..886a78d Binary files /dev/null and b/images/home/call.png differ diff --git a/images/home/progress.png b/images/home/progress.png new file mode 100644 index 0000000..6ee0036 Binary files /dev/null and b/images/home/progress.png differ diff --git a/images/home/组 221@2x.png b/images/home/组 221@2x.png deleted file mode 100755 index 870f221..0000000 Binary files a/images/home/组 221@2x.png and /dev/null differ diff --git a/images/home/组 668@2x.png b/images/home/组 668@2x.png deleted file mode 100755 index 52209e2..0000000 Binary files a/images/home/组 668@2x.png and /dev/null differ diff --git a/images/no-needs.png b/images/no-needs.png new file mode 100644 index 0000000..3e03570 Binary files /dev/null and b/images/no-needs.png differ diff --git a/images/no-order.png b/images/no-order.png new file mode 100644 index 0000000..e895b1c Binary files /dev/null and b/images/no-order.png differ diff --git a/images/user/header.png b/images/user/header.png index d7be5a2..6e756a3 100644 Binary files a/images/user/header.png and b/images/user/header.png differ diff --git a/pages/demandHall/applyDetail/index.js b/pages/demandHall/applyDetail/index.js new file mode 100644 index 0000000..3f3efbf --- /dev/null +++ b/pages/demandHall/applyDetail/index.js @@ -0,0 +1,140 @@ +// pages/demandHall/applyDetail/index.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + active: 0, + detail: [], + userList: [], + communicateId: '', + content: null + }, + itemClick(e){ + let i = e.currentTarget.dataset.i + let id = e.currentTarget.dataset.id + this.setData({ + active: i, + communicateId: id + }) + this.getApplyDetail(); + }, + getApplyDetail(){ + app.http('get','Communicate/getCommunicateInfo',{communicateId: this.data.communicateId}).then((res)=>{ + if(res.data.success){ + this.setData({ + content: res.data.data + }) + } + }) + }, + getUserList(){ + // console.log(this.data.detail) + app.http('get','Communicate/communicateHeadList',{resourceId: this.data.detail.resourceInfo.resourceId}).then((res)=>{ + if(res.data.success){ + this.setData({ + userList: res.data.data, + communicateId: res.data.data[0].communicateId + }) + this.getApplyDetail(); + } + }) + }, + toNeedDetail(e){ + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/pages/demandHall/needsDetail/index?id=' + id, + }) + }, + //查看立项书 + toCreateProject(){ + let content = this.data.content + wx.navigateTo({ + url: '/pages/demandHall/createProject/index?state=' + content.comminuteState+ '&id=' + content.communicateId, + }) + }, + // 立项 + createProject(){ + let id = this.data.communicateId + wx.showModal({ + title: "提示!", + content: '是否确认发起项目?', + success(res){ + if(res.confirm){ + wx.navigateTo({ + url: '/pages/demandHall/createProject/index?id='+ id, + }) + } + } + }) + }, + call(){ + console.log() + wx.makePhoneCall({ + phoneNumber: this.data.content.phone, + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let data = JSON.parse(decodeURIComponent(options.data)); + this.setData({ + detail: data + }) + // console.log(this.data.detail) + this.getUserList() + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/demandHall/applyDetail/index.json b/pages/demandHall/applyDetail/index.json new file mode 100644 index 0000000..725e908 --- /dev/null +++ b/pages/demandHall/applyDetail/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "申请详情", + "navigationBarBackgroundColor": "#FF5100", + "navigationBarTextStyle": "white" +} \ No newline at end of file diff --git a/pages/demandHall/applyDetail/index.wxml b/pages/demandHall/applyDetail/index.wxml new file mode 100644 index 0000000..e2d8f09 --- /dev/null +++ b/pages/demandHall/applyDetail/index.wxml @@ -0,0 +1,66 @@ + + + + + + + {{detail.resourceInfo.name}} + + 网站建设 + + {{detail.resourceInfo.content}} + + + + + + + + + + + + + + + + + {{content.name}} + + {{content.demandInfo.content}} + + + {{content.demandInfo.name}} + 详情 + + + 场地租赁 + + + 需求预算 {{content.demandInfo.budget}} + {{content.createTime}} + + + + + {{content.projectListDto.projectName}} + 详情 + + + 场地租赁 + + + {{content.projectListDto.partner}} + {{content.createTime}} + + + + + + + 发起项目 + 立即沟通 + 忽略 + 项目已取消 + + \ No newline at end of file diff --git a/pages/demandHall/applyDetail/index.wxss b/pages/demandHall/applyDetail/index.wxss new file mode 100644 index 0000000..48b927b --- /dev/null +++ b/pages/demandHall/applyDetail/index.wxss @@ -0,0 +1,173 @@ +/* pages/demandHall/applyDetail/index.wxss */ +page{ + width: 100%; + height: 100%; +} +.applyDetail-page{ + height: 100%; +} +.top-box{ + width: 100%; + padding: 40rpx 40rpx 62rpx; + background: linear-gradient(180deg, #FF5100 0%, #FFA782 100%); +} +.company-card-box { + width: 100%; + padding: 30rpx 12rpx; + background: #FFFFFF; + box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.16); + border-radius: 12rpx; +} +.info{ + width: 70%; +} +.company-logo{ + width: 154rpx; + height: 154rpx; + margin-right: 20rpx; +} +.company-name{ + font-size: 28rpx; + line-height: 56rpx; + font-weight: 500; + color: #1D1D1D; +} +.slogan{ + font-size: 24rpx; + line-height: 34rpx; + color: #666; + margin: 4rpx 0 12rpx; +} +.tags-box{ + margin: 6rpx 0 10rpx; +} +.tag-item{ + width: 112rpx; + height: 36rpx; + line-height: 34rpx; + text-align: center; + border: 1rpx solid #FFAA00; + color: #FFAA00; + border-radius: 4rpx; + margin-right: 8rpx; + font-size: 24rpx; +} +.content-box{ + width: 100%; + height: calc(100% - 490rpx); + overflow: hidden; +} +.content-l{ + width: 152rpx; + height: 100%; + padding-left: 22rpx; + background: #EEEEEE; + overflow: hidden; +} +.l-item{ + width: 100%; + height: 136rpx; + display: flex; + align-items: center; + justify-content: center; +} +.headerImg-box{ + border-radius: 50%; + overflow: hidden; + position: absolute; +} +.headerImg-box image{ + width: 92rpx; + height: 92rpx; +} +.l-item-a{ + background: #fff; + border-top-left-radius: 50px; + border-bottom-left-radius: 50px; +} +.content-r{ + width: calc(100% - 152rpx); + padding: 46rpx 30rpx; + font-size: 28rpx; +} +.apply-word{ + color: #666; + line-height: 44rpx; + margin-top: 24rpx; +} +.btn-box{ + width: 100%; + height: 160rpx; + padding-top: 24rpx; + position: absolute; + bottom: 0; +} +.btn-item{ + width: 190rpx; + height: 76rpx; + line-height: 76rpx; + text-align: center; + font-size: 32rpx; + color: #fff; + font-weight: 400; + background: #BFBFBF; + border-radius: 12rpx; + margin-right: 16rpx; +} +.bgO{ + background: linear-gradient(144deg, #FFA782 0%, #FF5100 100%); +} +.need-item{ + width: 100%; + padding: 10rpx 0; + background: #FFFFFF; + box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.16); + border-radius: 12rpx; + margin: 32rpx 0; +} + +.n-title-box{ + padding: 0 26rpx 10rpx; + font-size: 28rpx; + color: #1D1D1D; + margin: 16rpx 0 12rpx; + border-bottom: 2px solid #E2E2E2; +} +.word{ + width: 340rpx; + font-size: 28rpx; +} +.colO{ + color: #FF5100; + font-size: 500; +} +.n-tags{ + padding: 0 26rpx; + margin-bottom: 10rpx; +} +.n-tag-item{ + width: 112rpx; + height: 36rpx; + line-height: 34rpx; + text-align: center; + border: 1rpx solid #FFAA00; + color: #FFAA00; + border-radius: 4rpx; + margin-right: 8rpx; + font-size: 24rpx; +} +.bgG{ + border: 1rpx solid #3A9EFA; + color: #3A9EFA; +} +.bgR{ + border: 1rpx solid #FC9367; + color: #FC9367; +} +.price-box{ + color: #707070; + padding: 0 20rpx; +} +.desc{ + width: 370rpx; +} \ No newline at end of file diff --git a/pages/demandHall/companyDetail/index.js b/pages/demandHall/companyDetail/index.js index 25da07d..27e5956 100644 --- a/pages/demandHall/companyDetail/index.js +++ b/pages/demandHall/companyDetail/index.js @@ -1,11 +1,13 @@ // pages/demandHall/companyDetail/index.js +const app = getApp(); Page({ - /** * 页面的初始数据 */ data: { - tabActive: 3, + id: '', + detail: {}, + tabActive: 1, swiperImgUrls: [ '../../../images/home/item-bg.png', '../../../images/home/company-top-bg.png' @@ -23,13 +25,42 @@ Page({ swiperIndex: e.detail.current, }) }, + toNeedsDetail(e){ + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/pages/demandHall/needsDetail/index?id='+ id, + }) + }, + toResourcesDetail(e){ + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/pages/demandHall/resourcesDetail/index?id='+ id, + }) + }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + console.log(options) + this.setData({ + id: options.id + }) + this.getDetail() + }, + getDetail(){ + app.http('get','Enterprise/enterpriseInfo',{id:this.data.id}).then((res)=>{ + if(res.data.success){ + this.setData({ + detail: res.data.data + }) + } + }) + }, + toWebview(){ + wx.navigateTo({ + url: '/pages/webview/index?src='+ this.data.detail.enterpriseNet, + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/demandHall/companyDetail/index.wxml b/pages/demandHall/companyDetail/index.wxml index d0d5c54..92ff69d 100644 --- a/pages/demandHall/companyDetail/index.wxml +++ b/pages/demandHall/companyDetail/index.wxml @@ -1,14 +1,14 @@ - + - + - 楚牛科技 - 让全世界牛起来。 + {{detail.enterpriseName}} + {{detail.enterpriseTitle}} 网站建设 IT软件 @@ -18,23 +18,23 @@ - 武汉市CBD国际大厦A座 + {{detail.enterpriseAddress}} - 武汉市CBD国际大厦A座 + {{detail.enterpriseNet}} - 9466-9466 + {{detail.enterprisePhone}} 首页 - 资源 - 需求 + 资源({{detail.resourceList.length || 0}}) + 需求({{detail.demandList.length || 0}}) @@ -46,7 +46,7 @@ 企业名称 - 湖北楚牛科技有限公司 + {{detail.enterpriseName}} 所属类型 @@ -62,7 +62,7 @@ 经营范围 - 计算机系统服务;软件开发;游戏开发;会议会展服务;广告设计;设计服务;计算机软硬件及配件、电子产品设计。 + {{detail.businessNature}} @@ -71,7 +71,7 @@ 关于我们 - 湖北楚牛科技有限公司成立于2010年3月,核心团队成员均来自业内相关的顶尖公司。楚牛的愿景是让我们的技术和产品能与合作伙伴一起拥抱全球化!公司法定代表人为刘戴辉,注册资本为200万元人民币,统一社会信用代码为946946946694464T,企业地址位于湖北省武汉市江汉区东风路街道蚌塘街37号航线大厦2811号,所属行业为商务服务业,经营范围包含计算机系统服务;软件开发;游戏开发;会议会展服务;广告设计;设计服务;计算机软硬件及配件、电子产品设计。 + {{detail.resourceIntroduction}} @@ -81,7 +81,7 @@ - + @@ -89,12 +89,29 @@ - 更多信息请见官网> + 更多信息请见官网> - + + + + + {{item.title}} + 资金需求:{{item.capital}} + {{item.detailedDescription}} + + + + + 发布日期 {{item.resourceStartTime}} + {{item.enterpriseAddress}} + + 了解详情 + + + - + + + {{item.title}} + {{item.capital}} + + + 网站建设 + IT软件 + APP开发 + + {{item.detailedDescription}} + + {{item.resourceEndTime}}截止报名 + 了解详情 + + + diff --git a/pages/demandHall/companyDetail/index.wxss b/pages/demandHall/companyDetail/index.wxss index 15211b5..4115207 100644 --- a/pages/demandHall/companyDetail/index.wxss +++ b/pages/demandHall/companyDetail/index.wxss @@ -30,6 +30,7 @@ width: 150rpx; height: 150rpx; margin-right: 20rpx; + border-radius: 8rpx; } .name{ font-size: 32rpx; @@ -117,7 +118,7 @@ box-shadow: 0px -6px 20px rgba(0, 0, 0, 0.11); } .info-box,.about-box{ padding-bottom: 34rpx; - border-bottom: 2rpx solid #BFBFBF; + border-bottom: 2rpx solid #eee; } .title-box{ padding: 34rpx 40rpx; @@ -190,6 +191,7 @@ box-shadow: 0px -6px 20px rgba(0, 0, 0, 0.11); .resources-item{ width: 100%; background: #fff; + margin-bottom: 20rpx; } .item-top{ width: 100%; @@ -200,6 +202,7 @@ box-shadow: 0px -6px 20px rgba(0, 0, 0, 0.11); width: 196rpx; height: 196rpx; margin-right: 24rpx; + border-radius: 8rpx; } .info{ width: 370rpx; @@ -245,12 +248,13 @@ box-shadow: 0px -6px 20px rgba(0, 0, 0, 0.11); .company-list{ width: 100%; - background: #fff; } .company-item{ width: 100%; padding: 26rpx; + background: #fff; border-bottom: 2rpx solid #EEEEEE; + margin-bottom: 20rpx; } .company-item .title-box{ padding: 0; diff --git a/pages/demandHall/createProject/index.js b/pages/demandHall/createProject/index.js new file mode 100644 index 0000000..ce803fb --- /dev/null +++ b/pages/demandHall/createProject/index.js @@ -0,0 +1,254 @@ +// pages/demandHall/createProject/index.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + state: 0, //未申请 + communicateId: null, + projectId: null, + detail: [], + projectInfo: {}, + modeList: [], + modeActive: 1, + projectName: '', + resultContent: '' , + totalMoney: '', + stageResultsDtoList: [] + }, + inpChange(e){ + let t = e.currentTarget.dataset.t + let value = e.detail.value + if(t == 'n'){ + this.setData({ + projectName: value + }) + } else if(t == 't'){ + this.setData({ + totalMoney: value + }) + } else if(t == 'c'){ + this.setData({ + resultContent: value + }) + } + }, + modeClick(e){ + let id = e.currentTarget.dataset.id + let nums = e.currentTarget.dataset.nums + if(this.data.state != 0){ + return + } + this.setData({ + stageResultsDtoList: [] + }) + let p = this.data.stageResultsDtoList + for(var j = 0; j < nums; j++){ + p.push({name: j+1, money: '', content: '' }) + } + this.setData({ + modeActive: id, + stageResultsDtoList: p + }) + }, + changePrice(e){ + let idx = Number(e.currentTarget.dataset.i) + let stageResultsDtoList = this.data.stageResultsDtoList + stageResultsDtoList[idx].money = e.detail.value + this.setData({ + stageResultsDtoList + }) + }, + changeContent(e){ + let idx = Number(e.currentTarget.dataset.i) + let stageResultsDtoList = this.data.stageResultsDtoList + stageResultsDtoList[idx].content = e.detail.value + this.setData({ + stageResultsDtoList + }) + }, + submit(){ + let data = { + resourcesId: this.data.projectInfo.projectResource.resourceId, + projectName: this.data.projectName, + projectCode: this.data.projectInfo.projectCode, + cooperationModeId: this.data.modeActive, + resultContent: this.data.resultContent, + stageResultsDtoList: this.data.stageResultsDtoList, + totalMoney: this.data.totalMoney, + providerId: this.data.projectInfo.projectProvider.prividerId, + receiverId: this.data.projectInfo.projectReceiver.receiverId, + communicateId: this.data.communicateId + } + if(data.projectName == ''){ + wx.showToast({ + title: '请填写项目名称!', + icon: 'none' + }) + return + } else if(data.totalMoney == ''){ + wx.showToast({ + title: '请填写项目总金额!', + icon: 'none' + }) + return + } else if(data.resultContent == ''){ + wx.showToast({ + title: '请描述交付成果!', + icon: 'none' + }) + return + } + app.http('post','Project/create',data).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '操作成功!', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } + }) + // console.log(this.data.stageResultsDtoList) + }, + //获取合作模式 + getModeList(){ + app.http('get','CooperationMode/listCooperationMode').then((res)=>{ + if(res.data.success){ + this.setData({ + modeList: res.data.data + }) + } + }) + }, + //获取资源信息 + getProjectInfo(){ + console.log(this.data.communicateId) + app.http('get','Project/toCreateProject',{communicateId:this.data.communicateId}).then((res)=>{ + if(res.data.success){ + this.setData({ + projectInfo: res.data.data + }) + } + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options) + let id = options.id // 立项 + let state = options.state // 项目书状态,1已申请,2等待立项,3已成立 + this.setData({ + communicateId: id, + state: state || 0 + }) + this.getModeList() + + if(state == 0 ){ + this.getProjectInfo() + } else{ + this.getProjectDetail() + } + }, + //获取立项书详情 + getProjectDetail(){ + app.http('get','Communicate/getProjectInfo',{ communicateId: this.data.communicateId }).then((res)=>{ + if(res.data.success){ + let data = res.data.data + this.setData({ + projectName: data.projectName, + stageResultsDtoList: data.stageResultsDtoList, + modeActive: data.stageResultsDtoList.length, + resultContent: data.resultContent, + totalMoney: data.totalMoney, + ['projectInfo.projectResource']: data.projectResource, + ['projectInfo.projectProvider']: data.projectProvider, + ['projectInfo.projectReceiver']: data.projectReceiver, + }) + } + }) + }, + confirm(){ + let that = this; + wx.showModal({ + title: '提示!', + content:'是否确认立项?', + success(res){ + if(res.confirm){ + app.http('get','Communicate/aggreProject',{projectId: that.data.projectId}).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '操作成功!', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } + }) + } + } + }) + }, + call(e){ + wx.makePhoneCall({ + phoneNumber: e.currentTarget.dataset.phone, + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/demandHall/createProject/index.json b/pages/demandHall/createProject/index.json new file mode 100644 index 0000000..ffb174c --- /dev/null +++ b/pages/demandHall/createProject/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "发布项目" +} \ No newline at end of file diff --git a/pages/demandHall/createProject/index.wxml b/pages/demandHall/createProject/index.wxml new file mode 100644 index 0000000..208e14c --- /dev/null +++ b/pages/demandHall/createProject/index.wxml @@ -0,0 +1,111 @@ + + + + 资源信息 + + + + {{projectInfo.projectResource.name}} + + 网站建设 + + {{projectInfo.projectResource.content}} + + + + + 项目名称 + + + + {{projectName}} + + + 项目编号 {{projectInfo.projectCode}} + + + + 合作模式 + + {{item.name}} + + + + 合作规则-定金尾款模式 + {{modeList[modeActive - 1].content}} + + + + 交付成果 + + + 总金额 + + + + + + + + 阶段{{index+1}} + + + + + + + + + + + 项目发起方(供方) + + {{projectInfo.projectProvider.name}} + + 银行账户 + {{projectInfo.projectProvider.bankNum}} + + + 开户信息 + {{projectInfo.projectProvider.bankInfo}} + + + + + 合作方 + + + + {{projectInfo.projectReceiver.name}} + + + + + + 确认并发起 + 待确认 + + \ No newline at end of file diff --git a/pages/demandHall/createProject/index.wxss b/pages/demandHall/createProject/index.wxss new file mode 100644 index 0000000..b976be9 --- /dev/null +++ b/pages/demandHall/createProject/index.wxss @@ -0,0 +1,188 @@ +/* pages/demandHall/createProject/index.wxss */ +.createProject-page{ + width: 100%; + padding: 0 40rpx 180rpx; + font-size: 28rpx; +} +.company-card-box { + width: 100%; + padding: 30rpx 12rpx; + background: #FFFFFF; + border: 2px solid #EEEEEE; + border-radius: 12rpx; + margin-bottom: 32rpx; +} +.info{ + width: 70%; +} +.company-logo{ + width: 154rpx; + height: 154rpx; + margin-right: 20rpx; +} +.company-name{ + font-size: 28rpx; + line-height: 56rpx; + font-weight: 500; + color: #1D1D1D; +} +.slogan{ + font-size: 24rpx; + line-height: 34rpx; + color: #666; + margin: 4rpx 0 12rpx; +} +.tags-box{ + margin: 6rpx 0 10rpx; +} +.tag-item{ + width: 112rpx; + height: 36rpx; + line-height: 34rpx; + text-align: center; + border: 1rpx solid #FFAA00; + color: #FFAA00; + border-radius: 4rpx; + margin-right: 8rpx; + font-size: 24rpx; +} +.title{ + margin-bottom: 26rpx; + font-weight: 500; + line-height: 40rpx; + color: #1D1D1D; +} +.num,.mode-box{ + margin-left: 38rpx; +} +.project-name-box{ + margin-bottom: 32rpx; +} +.inp-box{ + width: 100%; + height: 60rpx; + padding: 10rpx 20rpx; + background: #eee; +} +.inp-box input{ + width: 100%; + height: 100%; +} +.mode-item{ + width: 122rpx; + height: 40rpx; + border: 1rpx solid #707070; + text-align: center; + line-height: 38rpx; + font-size: 24rpx; + color: #707070; + border-radius: 8rpx; + margin-right: 10rpx; +} +.mode-item:nth-last-child(1){ + margin-right: 0; +} +.mode-item-a{ + border-color: #FF6D31; + color: #FF6D31; +} +.mode-detail{ + width: 670rpx; + height: 176rpx; + background: #FFF5F0; + border: 2rpx solid #FF5100; + border-radius: 12rpx; + font-size: 24rpx; + color: #666; + padding: 24rpx 20rpx; +} +.m-tit{ + font-weight: 500; + line-height: 34rpx; + color: #707070; + margin-bottom: 20rpx; +} +.area-box{ + width: 100%; + /* height: 446rpx; */ + background: #eee; + border-radius: 8rpx; + padding:28rpx 22rpx; + font-size: 24rpx; +} +.area-box textarea{ + width: 100%; + height: 116rpx; + border-bottom: 2rpx solid #BFBFBF; + margin-top: 24rpx; +} +.progress-item{ + width: 100%; + height: 138rpx; + border-bottom: 2rpx solid #BFBFBF; + padding: 24rpx 0; +} +.p-title input{ + width: 115rpx; + margin-left: 14rpx; + text-align: center; + border-bottom: 2rpx solid #BFBFBF; +} +.desc{ + width: 100%; + margin-top: 20rpx; +} + +.item{ + color: #666; + margin-bottom: 26rpx; +} +.item-r{ + width: 538rpx; + height: 60rpx; + padding: 10rpx 20rpx; + background: #eee; +} +.faqifang-box{ + color: #1D1D1D; +} +.f-item{ + margin-top: 22rpx; +} +.f-item-label{ + color: #707070; + margin-right: 28rpx; +} + +.header-box image{ + width: 92rpx; + height: 92rpx; + margin-right: 24rpx; +} +.call image{ + width: 54rpx; + height: 54rpx; +} +.btn-box{ + width: 750rpx; + height: 160rpx; + background: #FFFFFF; + box-shadow: 0px -6px 12px rgba(0, 0, 0, 0.04); + padding-top: 24rpx; + padding-right: 40rpx; + position: fixed; + bottom: 0; + left: 0; + z-index: 99; +} +.submit-btn{ + width: 223rpx; + height: 76rpx; + background: linear-gradient(144deg, #FFA782 0%, #FF5100 100%); + border-radius: 38rpx; + text-align: center; + line-height: 76rpx; + font-size: 32rpx; + color: #fff; + font-weight: 500; +} \ No newline at end of file diff --git a/pages/demandHall/index.js b/pages/demandHall/index.js index 544cab3..a998f54 100644 --- a/pages/demandHall/index.js +++ b/pages/demandHall/index.js @@ -1,25 +1,38 @@ // pages/demandHall/index.js const app = getApp(); Page({ - /** * 页面的初始数据 */ data: { tabbar: {}, - active: 2, - tabActive: 2, - showScreenDialog: false + active: '1', // 1资源供应,2需求广场 + tabActive: '1', // 1资源列表,2企业列表 + list: [], + showScreenDialog: false, + companyList: [], + pagesize: 10, + page: 1, + loading: true, //是否加载更多 + cagetoryList: [] , // 分类列表 }, topTabClick(e){ this.setData({ - active: e.currentTarget.dataset.i + active: e.currentTarget.dataset.i, + loading: true, + pagesize: 10, + page: 1, + list: [] }) + this.getPageData() }, tabClick(e){ this.setData({ tabActive: e.currentTarget.dataset.i }) + if(e.currentTarget.dataset.i == 2){ + this.getCompanyList() + } }, showDialog(){ this.setData({ @@ -31,20 +44,87 @@ Page({ showScreenDialog: false }) }, + toResourceDetail(e){ + let id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: '/pages/demandHall/resourcesDetail/index?id='+id, + }) + }, + toCompanyDetail(e){ + let id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: '/pages/demandHall/companyDetail/index?id='+id, + }) + }, + toNeedsDetail(e){ + let id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: '/pages/demandHall/needsDetail/index?id='+id, + }) + }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - app.editTabbar(); + app.editTabbar() + this.getPageData() + this.getCagetoryList() + }, + getCagetoryList(){ + app.http('get','ResourcesCagetory/listResourcesCagetory').then((res)=>{ + if(res.data.success){ + this.setData({ + cagetoryList: res.data.data + }) + } + }) + }, + cagetoryClick(e){ + let item = e.currentTarget.dataset.item + let i = e.currentTarget.dataset.i + this.setData({ + cagetoryActive: i + }) + }, + getPageData(){ + if(this.data.loading){ + app.http('post','Resources/listResources',{ + resourceType: this.data.active, + page: this.data.page, + pagesize:this.data.pagesize + }).then((res)=>{ + if(res.data.success){ + if(res.data.data.content.length < this.data.pagesize){ + this.setData({ + loading: false + }) + } + this.setData({ + list: this.data.list.concat(res.data.data.content) + }) + } + }) + } + + }, + getCompanyList(){ + app.http('post','Enterprise/listEnterprise',{}).then((res)=>{ + if(res.data.success){ + this.setData({ + companyList: res.data.data.content + }) + } + }) }, - /** - * 生命周期函数--监听页面初次渲染完成 + * 页面上拉触底事件的处理函数 */ - onReady: function () { - + onReachBottom: function () { + this.setData({ + page: this.data.page + 1 + }) + this.getPageData() }, - /** * 生命周期函数--监听页面显示 */ @@ -70,15 +150,10 @@ Page({ * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { - + }, - /** - * 页面上拉触底事件的处理函数 - */ - onReachBottom: function () { - - }, + /** * 用户点击右上角分享 diff --git a/pages/demandHall/index.wxml b/pages/demandHall/index.wxml index e6b4f49..e426385 100644 --- a/pages/demandHall/index.wxml +++ b/pages/demandHall/index.wxml @@ -16,14 +16,30 @@ 企业列表 - IT软件 · 企业网站 + 筛选 - + + + + {{item.title}} + + 网站建设 + + {{item.detailedDescription}} + ¥{{item.capital}} + + {{item.enterpriseName}} + + + 了解详情 + + + + + + + {{item.enterpriseName}} + + 网站建设 + IT软件 + APP开发 + + {{item.enterpriseTitle}} + + + + + + + + + - - + - - + + - IT软件 · 企业网站 + + 筛选 - + + + {{item.title}} + {{item.capital}} + + + 网站建设 + IT软件 + APP开发 + + {{item.detailedDescription}} + + {{item.resourceEndTime}}截止报名 + 了解详情 + + + @@ -98,29 +154,29 @@ 所有服务 - IT软件 + {{item.cagetoryName}} - + + + 商家身份(所有商家均实名认证) diff --git a/pages/demandHall/index.wxss b/pages/demandHall/index.wxss index 5c39ef7..0537784 100644 --- a/pages/demandHall/index.wxss +++ b/pages/demandHall/index.wxss @@ -1,4 +1,7 @@ /* pages/demandHall/index.wxss */ +image{ + border-radius: 8rpx; +} .dmandhall-page{ padding-bottom: 130rpx; min-height: 100vh; @@ -174,9 +177,9 @@ margin: 24rpx 0 20rpx; } .anli-item image{ - width: 222rpx; + width: 220rpx; height: 136rpx; - margin-right: 0rpx; + margin-right: 8rpx; } .comment{ font-size: 20rpx; @@ -220,18 +223,17 @@ position:fixed; top: 0; left: 0; + z-index: 9999; } .screen-dialog-box{ width: 602rpx; height: 100%; - padding-bottom: 160rpx; + /* padding-bottom: 160rpx; */ overflow-y: scroll; background-color: #fff; position: absolute; top: 0; right: 0rpx; - /* transform: translateX(800rpx); */ - /* transition: all 1000ms ease; */ animation: move 200ms ease; } /* .move{ @@ -275,6 +277,11 @@ .screen-item .item:nth-child(3n){ margin-right: 0; } +.screen-item .item-active{ + border: 2rpx solid #FF6E33; + color: #FE7D26; + background: #FDEFE6; +} .across-line{ width: 44rpx; height: 2rpx; @@ -297,9 +304,12 @@ color: #393939; } .submit-box{ - width: 100%; + width: 602rpx; height: 100rpx; box-shadow: 2rpx 0px 12rpx rgba(0, 0, 0, 0.16); + position: fixed; + bottom: 0; + right: 0; } .submit-box .btn{ width: 50%; diff --git a/pages/demandHall/needsContact/index.js b/pages/demandHall/needsContact/index.js new file mode 100644 index 0000000..bcd0de8 --- /dev/null +++ b/pages/demandHall/needsContact/index.js @@ -0,0 +1,119 @@ +// pages/demandHall/contact/index.js +const app = getApp(); +Page({ + /** + * 页面的初始数据 + */ + data: { + active: null, + needsDetail: {}, + needsList: [], + content: '', + + }, + needItemClick(e){ + let id = e.currentTarget.dataset.id + this.setData({ + active: e.currentTarget.dataset.id + }) + }, + inpChange(e){ + console.log(e) + this.setData({content: e.detail.value}) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + // console.log(options) + let data = JSON.parse(decodeURIComponent(options.detail)); + this.setData({ + needsDetail: data + }) + console.log(this.data.needsDetail) + this.getList() + }, + getList(){ + app.http('post','Resources/listMyResourcesPublish',{ + resourceType: 2 + }).then((res)=>{ + if(res.data.success){ + res.data.data.content.length > 0 ? this.setData({active: res.data.data.content[0].id}) : this.setData({active: null}) + this.setData({ + needsList: res.data.data.content, + }) + } + }) + }, + submit(){ + if(this.data.content == '' && this.demandId == null){ + wx.showToast({ + title: '请填写您的申请内容!', + icon: 'none' + }) + return + } + let data = { + resourceId: this.data.active, + demandId: this.data.needsDetail.id, + content: this.data.content + } + + app.http('post','Communicate/create',data).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '提交成功!', + duration: 2000 + }) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/demandHall/needsContact/index.json b/pages/demandHall/needsContact/index.json new file mode 100644 index 0000000..7cb70cc --- /dev/null +++ b/pages/demandHall/needsContact/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "申请沟通" +} \ No newline at end of file diff --git a/pages/demandHall/needsContact/index.wxml b/pages/demandHall/needsContact/index.wxml new file mode 100644 index 0000000..cc1f4d1 --- /dev/null +++ b/pages/demandHall/needsContact/index.wxml @@ -0,0 +1,57 @@ + + + + + + + {{needsDetail.title}} + + + 场地租赁 + + 需求预算{{needsDetail.capital}} + + + + ! + 请明确您可提供的资源! + + + + + + 发送资源给企业(个人) + + + + + {{item.title}} + + 网站建设 + + {{item.enterprise.enterpriseName}} + + + + + + + + + 提交申请 + diff --git a/pages/demandHall/needsContact/index.wxss b/pages/demandHall/needsContact/index.wxss new file mode 100644 index 0000000..ae598a4 --- /dev/null +++ b/pages/demandHall/needsContact/index.wxss @@ -0,0 +1,175 @@ +/* pages/demandHall/contact/index.wxss */ +.contact-page{ + width: 100%; + min-height: 100vh; + padding: 40rpx; + background: #EFEFEF; +} +.company-card-box { + width: 100%; + height: 210rpx; + padding: 30rpx 12rpx; + background: #FFFFFF; + box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.16); + border-radius: 12rpx; +} +.info{ + width: 70%; +} +.company-logo{ + width: 150rpx; + height: 150rpx; + margin-right: 20rpx; +} +.company-name{ + font-size: 36rpx; + line-height: 56rpx; + font-weight: 500; + color: #1D1D1D; +} +.slogan{ + font-size: 24rpx; + line-height: 34rpx; + color: #666; + margin: 4rpx 0 12rpx; +} +.tags-box{ + margin: 6rpx 0 10rpx; +} +.tag-item{ + width: 112rpx; + height: 36rpx; + display: inline-block; + line-height: 36rpx; + text-align: center; + font-size: 20rpx; + background: linear-gradient(314deg, #FF5100 0%, #FF8800 100%); + color: #fff; + border-radius: 8rpx; + margin-right: 8rpx; +} +.tips{ + margin: 32rpx 0; + font-size: 24rpx; + color: #1D1D1D; +} +.t-icon{ + width: 28rpx; + height: 28rpx; + border-radius: 50%; + border: 1px solid #1D1D1D; + text-align: center; + line-height: 25rpx; + color: #1D1D1D; + font-size: 24rpx; + font-weight: bold; + margin-right: 10rpx; +} +.needs-list{ + width: 100%; +} +.need-item{ + width: 100%; + padding: 20rpx 0; + background: #FFFFFF; + box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.16); + border-radius: 12rpx; + margin-bottom: 32rpx; +} +.n-title{ + width: 100%; + padding: 18rpx 26rpx; + border-bottom: 2rpx solid #E2E2E2; + font-size: 24rpx; + color: #979797; + font-weight: 500; +} +.dot{ + width: 28rpx; + height: 28rpx; + border: 2rpx solid #979797; + border-radius: 50%; + margin-right: 6rpx; +} +.n-title-a .dot{ + position: relative; + border-color: #FF7E42; +} +.n-title-a .dot::before{ + content: ''; + display: inline-block; + width: 20rpx; + height: 20rpx; + border-radius: 50%; + border-color: #FF7E42; + background: #FF7E42; + position: absolute; + top: 2rpx; + left: 2rpx; +} +.n-title-a{ + color: #FF7E42; +} +.price{ + font-size: 28rpx; + color: #707070; + margin-top: 20rpx; +} +.n-title-box{ + /* padding: 0 26rpx; */ + font-size: 28rpx; + color: #1D1D1D; + margin: 16rpx 0 8rpx; +} +.colO{ + color: #FF5100; + font-size: 500; +} +.n-tags{ + /* padding: 0 26rpx; */ +} +.n-tag-item{ + width: 112rpx; + height: 36rpx; + line-height: 34rpx; + text-align: center; + border: 1rpx solid #FFAA00; + color: #FFAA00; + border-radius: 4rpx; + margin-right: 8rpx; + font-size: 24rpx; +} +.bgG{ + border: 1rpx solid #3A9EFA; + color: #3A9EFA; +} +.bgO{ + border: 1rpx solid #FC9367; + color: #FC9367; +} +.area-box{ + width: 100%; + height: 900rpx; + padding: 42rpx 24rpx; + background: #fff; + border-radius: 12rpx; +} +.area-box textarea{ + width: 100%; + height: 50%; +} +.submit-btn{ + width: 240rpx; + height: 88rpx; + line-height: 88rpx; + text-align: center; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 12rpx; + font-size: 32rpx; + color: #fff; + /* margin: 32rpx auto; */ + position: absolute; + bottom: 80rpx; + left: 50%; + margin-left: -120rpx; +} \ No newline at end of file diff --git a/pages/demandHall/needsDetail/index.js b/pages/demandHall/needsDetail/index.js index 2521cbc..f89a188 100644 --- a/pages/demandHall/needsDetail/index.js +++ b/pages/demandHall/needsDetail/index.js @@ -1,20 +1,45 @@ // pages/demandHall/needsDetail/index.js +const app = getApp(); Page({ /** * 页面的初始数据 */ data: { - isCompany: true + isCompany: true, + id: '', + detail: {}, }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.setData({ + id: options.id + }) + this.getDetail() + }, + toCompanyDetail(){ + wx.navigateTo({ + url: '/pages/demandHall/companyDetail/index?id=' + this.data.detail.enterprise.id, + }) + }, + getDetail(){ + app.http('get','Resources/resourceInfo',{id:this.data.id}).then((res)=>{ + if(res.data.success){ + this.setData({ + detail: res.data.data + }) + } + }) + }, + toNeedsContact(){ + let str = encodeURIComponent(JSON.stringify(this.data.detail)); + wx.navigateTo({ + url: '/pages/demandHall/needsContact/index?detail=' + str, + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/demandHall/needsDetail/index.wxml b/pages/demandHall/needsDetail/index.wxml index 11a12e7..85b79fc 100644 --- a/pages/demandHall/needsDetail/index.wxml +++ b/pages/demandHall/needsDetail/index.wxml @@ -1,11 +1,11 @@ - 10天20小时60分60秒后截止报名 + 需求标题: - 我需要举办大型会议的场地 + {{detail.title}} 需求类型: @@ -13,24 +13,24 @@ 需求预算: - 10000元 + {{detail.capital}} 需求描述: - 本人于十一期间(10.1-10.4)需要武汉周边能够举办百人大型会议的场地。需要酒水食品供应与住宿供应。 + {{detail.detailedDescription}} - + 发布公司 - + - 楚牛科技 + {{detail.enterprise.enterpriseName}} 网站建设 IT软件 @@ -39,37 +39,51 @@ - + 发布人 - + - 禅易家人 - - + {{detail.user.name}} + + - 广州·能量大使 + {{detail.user.address}}·{{detail.user.level}} - + 补充内容 + + + + + + + + - + - 立即报名 + 立即报名 diff --git a/pages/demandHall/needsDetail/index.wxss b/pages/demandHall/needsDetail/index.wxss index aad7754..64cd949 100644 --- a/pages/demandHall/needsDetail/index.wxss +++ b/pages/demandHall/needsDetail/index.wxss @@ -1,7 +1,10 @@ /* pages/demandHall/needsDetail/index.wxss */ +.needsDetail-box{ + padding-bottom: 190rpx; +} .top-box{ width: 100%; - padding: 0 40rpx 40rpx; + padding: 40rpx 40rpx; background: linear-gradient(180deg, #FF5100 0%, #FFA782 100%); } .count-down-box{ @@ -33,7 +36,13 @@ } .content-box{ width: 100%; - padding: 40rpx; + padding: 40rpx 0; +} +.company-info-box{ + padding: 0 40rpx; +} +.add-content-box{ + padding-left: 40rpx; } .tag{ width: 216rpx; @@ -72,6 +81,7 @@ width: 150rpx; height: 150rpx; margin-right: 20rpx; + border-radius: 8rpx; } .name{ font-size: 32rpx; @@ -140,4 +150,49 @@ border-radius: 12rpx; font-size: 32rpx; color: #fff; +} + +.scroll-view_H{ + white-space: nowrap; + width: 100%; + margin-top: 28rpx; +} +.scroll-view_H view{ + display: inline-block; + width: 216rpx; + height: 216rpx; + margin-right: 10rpx; +} +.scroll-view_H view image{ + width: 100%; + height: 100%; + border-radius: 8rpx; +} + +.swiper-block { + height: 300rpx; + width: 100%; +} +.swiper-item { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + overflow: unset; +} +.slide-image { + height: 250rpx; + width: 520rpx; + border-radius: 9rpx; + margin: 0rpx 30rpx; + z-index: 1; +} +.active { + /* transform: scale(1.14); + transition: all 0.2s ease-in 0s; + z-index: 20; */ +} + +.answer-box{ + padding: 0 40rpx; } \ No newline at end of file diff --git a/pages/demandHall/platform/index.js b/pages/demandHall/platform/index.js new file mode 100644 index 0000000..19ef40b --- /dev/null +++ b/pages/demandHall/platform/index.js @@ -0,0 +1,99 @@ +// pages/demandHall/platform/index.js +const util = require('../../../utils/util.js') +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + projectId: '', + content: '', + imgPaths: [], + }, + contentChange(e){ + this.setData({ + content: e.detail.value + }) + }, + upImgs(){ + util.chooseImages2(img => { + let imgs = this.data.form.imgPaths + imgs.push(img) + this.setData({ + imgPaths: imgs + }) + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + projectCode: options.code + }) + }, + submit(){ + let data = { + projectCode: this.data.projectCode, + content: this.data.content, + imgPaths: this.data.imgPaths + } + app.http('post','Project/applyPlatform',data).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '提交成功!', + duration: 2000 + }) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/demandHall/platform/index.json b/pages/demandHall/platform/index.json new file mode 100644 index 0000000..27b4605 --- /dev/null +++ b/pages/demandHall/platform/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "平台介入" +} \ No newline at end of file diff --git a/pages/demandHall/platform/index.wxml b/pages/demandHall/platform/index.wxml new file mode 100644 index 0000000..a657df4 --- /dev/null +++ b/pages/demandHall/platform/index.wxml @@ -0,0 +1,10 @@ + + + + + + + + + 提交 + diff --git a/pages/demandHall/platform/index.wxss b/pages/demandHall/platform/index.wxss new file mode 100644 index 0000000..e568055 --- /dev/null +++ b/pages/demandHall/platform/index.wxss @@ -0,0 +1,36 @@ +/* pages/demandHall/platform/index.wxss */ +.page{ + width: 100%; + height: 100vh; + background: #EFEFEF; + padding: 40rpx; +} +.area-box{ + width: 100%; + background: #fff; + padding: 32rpx; + font-size: 32rpx; + border-radius: 12rpx; +} +.area-box textarea{ + width: 100%; + height: 300rpx; + color: #707070; + font-size: 28rpx; +} +.area-box image{ + width: 152rpx; + height: 152rpx; + margin-right: 12rpx; +} +.submit{ + width: 223rpx; + height: 76rpx; + background: linear-gradient(144deg, #FFA782 0%, #FF5100 100%); + border-radius: 38rpx; + font-size: 32rpx; + color: #fff; + line-height: 76rpx; + text-align: center; + margin: 90rpx auto; +} \ No newline at end of file diff --git a/pages/demandHall/resourcesContact/index.js b/pages/demandHall/resourcesContact/index.js new file mode 100644 index 0000000..092d722 --- /dev/null +++ b/pages/demandHall/resourcesContact/index.js @@ -0,0 +1,126 @@ +// pages/demandHall/contact/index.js +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + active: null, + resourcesDetail: {}, + resourcesList: [], + content: '', + + }, + needItemClick(e){ + let id = e.currentTarget.dataset.id + console.log(id) + this.setData({ + active: e.currentTarget.dataset.id + }) + }, + inpChange(e){ + console.log(e) + this.setData({content: e.detail.value}) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options) + let data = JSON.parse(decodeURIComponent(options.detail)); + this.setData({ + resourcesDetail: data + }) + console.log(this.data.resourcesDetail) + this.getList() + }, + getList(){ + app.http('post','Resources/listMyResourcesPublish',{ + resourceType: 1 + }).then((res)=>{ + if(res.data.success){ + res.data.data.content.length > 0 ? this.setData({active: res.data.data.content[0].id}) : this.setData({active: null}) + this.setData({ + resourcesList: res.data.data.content, + }) + } + }) + }, + submit(){ + if(this.data.content == '' && this.data.active == null){ + wx.showToast({ + title: '请填写您的申请内容!', + icon: 'none' + }) + return + } + let data = { + resourceId: this.data.resourcesDetail.id, + demandId: this.data.active, + content: this.data.content + } + + app.http('post','Communicate/create',data).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '提交成功!', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/demandHall/resourcesContact/index.json b/pages/demandHall/resourcesContact/index.json new file mode 100644 index 0000000..7cb70cc --- /dev/null +++ b/pages/demandHall/resourcesContact/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "申请沟通" +} \ No newline at end of file diff --git a/pages/demandHall/resourcesContact/index.wxml b/pages/demandHall/resourcesContact/index.wxml new file mode 100644 index 0000000..d9c9574 --- /dev/null +++ b/pages/demandHall/resourcesContact/index.wxml @@ -0,0 +1,49 @@ + + + + + + {{resourcesDetail.title}} + + 网站建设 + + {{resourcesDetail.enterprise.enterpriseName}} + + + + ! + 请明确您的需求! + + + + + + 发送需求给企业(个人) + + + 我需要公司官网设计-网红餐饮网红餐饮 + 发布中 + + + 场地租赁 + + + + + + + + 提交申请 + diff --git a/pages/demandHall/resourcesContact/index.wxss b/pages/demandHall/resourcesContact/index.wxss new file mode 100644 index 0000000..350fb4a --- /dev/null +++ b/pages/demandHall/resourcesContact/index.wxss @@ -0,0 +1,171 @@ +/* pages/demandHall/contact/index.wxss */ +.contact-page{ + width: 100%; + min-height: 100vh; + padding: 40rpx; + background: #EFEFEF; +} +.company-card-box { + width: 100%; + height: 210rpx; + padding: 30rpx 12rpx; + background: #FFFFFF; + box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.16); + border-radius: 12rpx; +} +.info{ + width: 70%; +} +.company-logo{ + width: 150rpx; + height: 150rpx; + margin-right: 20rpx; +} +.company-name{ + font-size: 36rpx; + line-height: 56rpx; + font-weight: 500; + color: #1D1D1D; +} +.slogan{ + font-size: 24rpx; + line-height: 34rpx; + color: #666; + margin: 4rpx 0 12rpx; +} +.tags-box{ + margin: 6rpx 0 10rpx; +} +.tag-item{ + width: 112rpx; + height: 36rpx; + display: inline-block; + line-height: 36rpx; + text-align: center; + font-size: 20rpx; + background: linear-gradient(314deg, #FF5100 0%, #FF8800 100%); + color: #fff; + border-radius: 8rpx; + margin-right: 8rpx; +} +.tips{ + margin: 32rpx 0; + font-size: 24rpx; + color: #1D1D1D; +} +.t-icon{ + width: 28rpx; + height: 28rpx; + border-radius: 50%; + border: 1px solid #1D1D1D; + text-align: center; + line-height: 25rpx; + color: #1D1D1D; + font-size: 24rpx; + font-weight: bold; + margin-right: 10rpx; +} +.needs-list{ + width: 100%; +} +.need-item{ + width: 100%; + padding: 20rpx 0; + background: #FFFFFF; + box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.16); + border-radius: 12rpx; + margin-bottom: 32rpx; +} +.n-title{ + width: 100%; + padding: 18rpx 26rpx; + border-bottom: 2rpx solid #E2E2E2; + font-size: 24rpx; + color: #979797; + font-weight: 500; +} +.dot{ + width: 28rpx; + height: 28rpx; + border: 2rpx solid #979797; + border-radius: 50%; + margin-right: 6rpx; +} +.n-title-a .dot{ + position: relative; + border-color: #FF7E42; +} +.n-title-a .dot::before{ + content: ''; + display: inline-block; + width: 20rpx; + height: 20rpx; + border-radius: 50%; + border-color: #FF7E42; + background: #FF7E42; + position: absolute; + top: 2rpx; + left: 2rpx; +} +.n-title-a{ + color: #FF7E42; +} + +.n-title-box{ + padding: 0 26rpx; + font-size: 28rpx; + color: #1D1D1D; + margin: 16rpx 0 8rpx; +} +.colO{ + color: #FF5100; + font-size: 500; +} +.n-tags{ + padding: 0 26rpx; +} +.n-tag-item{ + width: 112rpx; + height: 36rpx; + line-height: 34rpx; + text-align: center; + border: 1rpx solid #FFAA00; + color: #FFAA00; + border-radius: 4rpx; + margin-right: 8rpx; + font-size: 24rpx; +} +.bgG{ + border: 1rpx solid #3A9EFA; + color: #3A9EFA; +} +.bgO{ + border: 1rpx solid #FC9367; + color: #FC9367; +} +.area-box{ + width: 100%; + height: 900rpx; + padding: 42rpx 24rpx; + background: #fff; + border-radius: 12rpx; +} +.area-box textarea{ + width: 100%; + height: 50%; +} +.submit-btn{ + width: 240rpx; + height: 88rpx; + line-height: 88rpx; + text-align: center; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 12rpx; + font-size: 32rpx; + color: #fff; + /* margin: 32rpx auto; */ + position: absolute; + bottom: 80rpx; + left: 50%; + margin-left: -120rpx; +} \ No newline at end of file diff --git a/pages/demandHall/resourcesDetail/index.js b/pages/demandHall/resourcesDetail/index.js index 2583f29..9cc51aa 100644 --- a/pages/demandHall/resourcesDetail/index.js +++ b/pages/demandHall/resourcesDetail/index.js @@ -1,20 +1,52 @@ // pages/demandHall/resourcesDetail/index.js +const app = getApp(); Page({ /** * 页面的初始数据 */ data: { - + id: '', + detail: {}, + swiperIndex: 0 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.setData({ + id: options.id + }) + this.getDetail() + }, + toCompanyDetail(){ + wx.navigateTo({ + url: '/pages/demandHall/companyDetail/index?id=' + this.data.detail.enterprise.id, + }) + }, + getDetail(){ + app.http('get','Resources/resourceInfo',{id:this.data.id}).then((res)=>{ + if(res.data.success){ + this.setData({ + detail: res.data.data + }) + } + }) + }, + // 立即沟通 + toResourcesContact(e){ + let str = encodeURIComponent(JSON.stringify(this.data.detail)); + wx.navigateTo({ + url: '/pages/demandHall/resourcesContact/index?detail=' + str, + }) + }, + swiperChange(e) { + const that = this; + that.setData({ + swiperIndex: e.detail.current, + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/demandHall/resourcesDetail/index.wxml b/pages/demandHall/resourcesDetail/index.wxml index 7dc2376..d53e334 100644 --- a/pages/demandHall/resourcesDetail/index.wxml +++ b/pages/demandHall/resourcesDetail/index.wxml @@ -1,10 +1,10 @@ - + - 教育类学校官网网站建设 + {{detail.title}} IT开发·网站建设 @@ -13,26 +13,26 @@ 标题 - 教育类学校官网网站建设 + {{detail.title}} 资金需求 - 100万~150万 + {{detail.capital}} 发布信息 - - + + - 楚牛科技 + {{detail.enterprise.enterpriseName}} 网站建设 IT软件 - 让全世界全世界牛起全世界牛起全世界牛起牛起来。 + {{detail.enterprise.enterpriseTitle}} @@ -40,14 +40,23 @@ 详细描述 - 湖北楚牛科技有限公司成立于2010年3月,核心团队成员均来自业内相关的顶尖公司。楚牛的愿景是让我们的技术和产品能与合作伙伴一起拥抱全球化!\n\n\n本项目仅为有网站建设需求的中小学教育机构、幼儿课外培训辅导机构提供服务,对网站业务人群存在要求。本公司也提供其他业务,请另咨询客服。 + {{detail.detailedDescription}} 补充内容 + + + + + + + + + - 立即沟通 + 立即沟通 diff --git a/pages/demandHall/resourcesDetail/index.wxss b/pages/demandHall/resourcesDetail/index.wxss index 2733756..4b51ae7 100644 --- a/pages/demandHall/resourcesDetail/index.wxss +++ b/pages/demandHall/resourcesDetail/index.wxss @@ -87,8 +87,12 @@ width: 150rpx; height: 150rpx; margin-right: 20rpx; + border-radius: 8rpx; +} +.info{ + width: 70%; } -.name{ +.company-name{ font-size: 32rpx; line-height: 44rpx; } @@ -124,4 +128,29 @@ font-size: 28rpx; color: #707070; line-height: 40rpx; +} + +.swiper-block { + height: 300rpx; + width: 100%; +} + +.swiper-item { + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + overflow: unset; +} +.slide-image { + height: 250rpx; + width: 520rpx; + border-radius: 9rpx; + margin: 0rpx 30rpx; + z-index: 1; +} +.active { + transform: scale(1.14); + transition: all 0.2s ease-in 0s; + z-index: 20; } \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 2999a77..e5eae1d 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -1,7 +1,8 @@ // index.js // 获取应用实例 const app = getApp() - +var QQMapWX = require('../../utils/qqmap-wx-jssdk.min.js'); +var qqmapsdk; Page({ data: { tabbar: {}, @@ -21,10 +22,19 @@ Page({ menuHeight: app.globalData.menuHeight, navHeight: app.globalData.navHeight, menuTop: app.globalData.menuTop, - active: 2 + active: 1, + demandList: [], + resourcesList: [], + province: '', + city: '', }, onLoad() { - app.editTabbar(); + app.editTabbar() + this.getCagetoryList() + qqmapsdk = new QQMapWX({ + key: 'UVEBZ-M3VRS-CO4OH-6F5QZ-X7FB7-SVFOX' //这里自己的key秘钥进行填充 + }); + this.getLocation() }, tabClick(e){ this.setData({ @@ -36,4 +46,78 @@ Page({ url: '/pages/demandHall/index', }) }, + getCagetoryList(){ + app.http('get','index').then((res)=>{ + if(res.data.success){ + this.setData({ + demandList: res.data.data.demandList, + resourcesList: res.data.data.resourcesDtos, + cagetoryList: res.data.data.cagetoryDtos + }) + } + }) + }, + toResourcesDetail(e){ + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/pages/demandHall/resourcesDetail/index?id='+id, + }) + }, + toCompanyDetail(e){ + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/pages/demandHall/companyDetail/index?id='+id, + }) + }, + toNeedDetail(e){ + let id = e.currentTarget.dataset.id + wx.navigateTo({ + url: '/pages/demandHall/needsDetail/index?id='+id, + }) + }, + getLocation(){ + let vm = this; + wx.getLocation({ + type: 'wgs84', + success: function (res) { + // console.log(JSON.stringify(res)) + var latitude = res.latitude + var longitude = res.longitude + var speed = res.speed + var accuracy = res.accuracy; + vm.getLocal(latitude, longitude) + }, + fail: function (res) { + console.log('fail' + JSON.stringify(res)) + } + }) + }, + // 获取当前地理位置 + getLocal: function (latitude, longitude) { + let vm = this; + qqmapsdk.reverseGeocoder({ + location: { + latitude: latitude, + longitude: longitude + }, + success: function (res) { + // console.log(JSON.stringify(res)); + let province = res.result.ad_info.province + let city = res.result.ad_info.city + vm.setData({ + province: province, + city: city, + latitude: latitude, + longitude: longitude + }) + // console.log(city) + }, + fail: function (res) { + console.log(res); + }, + complete: function (res) { + // console.log(res); + } + }); + }, }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index d0c52eb..457f330 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -6,7 +6,7 @@ - 定位 + {{city}} @@ -104,7 +104,31 @@ 金牌投资人 - + + + {{item.title}} + IT软件·网站建设 + {{item.detailedDescription}} + 了解详情 + + + + + {{item.enterpriseName}} + 成为奋斗者的家园 + + 网站建设 + 网站建设 + 网站建设 + + + + + 进入企业 + + + + - + + + {{item.title}} + {{item.detailedDescription}} + + 网站建设 + 网站建设 + 网站建设 + + {{item.capital}} + + + diff --git a/pages/index/index.wxss b/pages/index/index.wxss index a645204..34ecf8e 100644 --- a/pages/index/index.wxss +++ b/pages/index/index.wxss @@ -1,6 +1,6 @@ .home-page{ - padding-bottom: 130rpx; + padding-bottom: 190rpx; } .page-top-box{ width: 100%; @@ -62,8 +62,8 @@ font-size: 24rpx; } .menu-item{ - width: 98rpx; - margin-right:16rpx; + width: 20%; + /* margin-right:16rpx; */ margin-bottom: 34rpx; } .menu-item:nth-child(5n){ @@ -269,18 +269,23 @@ box-shadow: 0px 6rpx 12rpx rgba(190, 190, 190, 0.3); border-radius: 12rpx; padding: 28rpx 20rpx 18rpx; + margin-bottom: 32rpx; } .item-top{ padding-bottom: 24rpx; position: relative; } +.item-top .buy-btn{ + right: 0; +} .project-name{ width: 400rpx; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; - font-size: 28rpx; - line-height: 40rpx; + font-size: 32rpx; + font-weight: 500; + line-height: 58rpx; color: #1D1D1D; } .tags-box2{ @@ -303,11 +308,11 @@ font-size: 24rpx; line-height: 34rpx; color: #666666; + margin-top: 8rpx; } .company-box{ padding-top: 12rpx; position: relative; - border-top: 2rpx solid #ECECEC; } .company-box image{ diff --git a/pages/login/index.js b/pages/login/index.js new file mode 100644 index 0000000..0837d67 --- /dev/null +++ b/pages/login/index.js @@ -0,0 +1,172 @@ +// pages/login/index.js +const app = getApp() +Page({ + /** + * 页面的初始数据 + */ + data: { + login: false, + canIUseGetUserProfilefalse: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + let userInfo = wx.getStorageSync('userInfo') + if(userInfo.phone && userInfo.phone != ''){ + this.setData({ + login: true + }) + } + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + this.setData({ + code: res.code + }) + } + }) + }, + setUserInfo(){ + + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (response) => { + wx.showLoading({ + title: '登陆中...', + }) + let data = { + code: this.data.code, + iv: response.iv, + encryptedData:response.encryptedData, + spread: 0, + login_type: 0 + } + app.http('POST','wxapp/auth',data).then( + result =>{ + if(result.data.success){ + wx.hideLoading() + wx.setStorageSync('token', 'Bearer '+ result.data.data.token) + wx.setStorageSync('userInfo', result.data.data.user) + wx.showToast({ + title: '授权成功!', + duration: 1500 + }) + if(!result.data.data.user.phone){ + this.setData({ + login: true + }) + } else{ + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },1500) + } + + } else{ + wx.showToast({ + title: result.data.msg, + icon : 'none' + }) + } + } + ) + } + }) + }, + getPhoneNumber(e) { + if(e.detail.errMsg == 'getPhoneNumber:ok'){ + app.http('post','wxapp/binding', + {encryptedData: e.detail.encryptedData, + iv: e.detail.iv + }).then((res)=>{ + if(res.data.success){ + app.getInfo(); + wx.showToast({ + title: res.data.msg, + duration: 1500 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },1500) + } else{ + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } + }) + } + }, + back(){ + wx.navigateBack({ + delta: 1, + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/login/index.json b/pages/login/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/login/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/login/index.wxml b/pages/login/index.wxml new file mode 100644 index 0000000..38fe82a --- /dev/null +++ b/pages/login/index.wxml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/pages/login/index.wxss b/pages/login/index.wxss new file mode 100644 index 0000000..30e9028 --- /dev/null +++ b/pages/login/index.wxss @@ -0,0 +1,46 @@ +/* pages/login/index.wxss */ +.authorization { + height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + box-sizing: border-box; + padding-top: 190rpx; +} + +.user-avatar { + width: 192rpx; + height: 192rpx; + border-radius: 50%; + overflow: hidden; +} +.user-name{ + margin: 40rpx 0; +} +.login-notice{ + font-size: 28rpx; + font-weight: 500; + line-height: 40rpx; + color: #000; + padding-bottom: 90rpx; +} + +.authorization .wx-btn { + width: 640rpx !important; + height: 86rpx!important; + background: linear-gradient(144deg, #FFA782 0%, #FF5100 100%) !important; + border-radius: 60rpx!important; + text-align: center!important; + line-height: 86rpx!important; + margin-bottom: 36rpx!important; + display: flex!important; + align-items: center!important; + justify-content: center!important; + color: #fff; + font-weight: 500 !important; +} +.authorization .btn{ + background: #fff !important; + border: 4rpx solid #FFA782; + color: #FFA782 !important; +} \ No newline at end of file diff --git a/pages/release/companyAuth/index.js b/pages/release/companyAuth/index.js index 80dead8..124100b 100644 --- a/pages/release/companyAuth/index.js +++ b/pages/release/companyAuth/index.js @@ -1,13 +1,30 @@ // pages/release/companyAuth/index.js +const util = require('../../../utils/util.js') +const app = getApp() Page({ - /** * 页面的初始数据 */ data: { - isLegal: 0, - form: { scale: '请选择'}, - scaleArr: [] + form: { + isLegalPerson: 0, //是否为企业法人 + authorizationPath: '', // 授权书图片 + enterpriseName: '', //企业名称 + creditCode: '', //信用代码 + enterpriseScale: '请选择', //企业规模 + businessLicense: '', //营业执照照片 + bankAccount: '', //银行账号 + bankName: '', // 开户银行 + bankBranch: '', // 开户网点 + legalPersonName: '', //法人姓名 + legalPhone: '', //法人手机号 + legalPersonIdcard: '', // 法人身份证 + idcardPicFront: '',// 法人身份证正面照 + idcardPicBehind: '',// 法人身份证背面照 + idcardPicHold: '',// 法人手持身份证 + + }, + scaleArr: ['0-25','25-99','99-200','200-500','500及以上'] }, /** @@ -16,12 +33,211 @@ Page({ onLoad: function (options) { }, - radioClick(e){ + checkBank(e){ console.log(e.detail.value) + app.http('get','EnterpriseAuthentication/getBankName',{bankAccount: e.detail.value}).then((res)=>{ + if(res.data.success){ + this.setData({ + ['form.bankName']: res.data.data + }) + } + }) + }, + inpChange(e){ + let type = e.currentTarget.dataset.type + let value = e.detail.value + switch (type){ + case 'enterpriseName': + this.setData({ + ['form.enterpriseName']: value + }) + break; + case 'creditCode': + this.setData({ + ['form.creditCode']: value + }) + break; + case 'bankAccount': + this.setData({ + ['form.bankAccount']: value + }) + break; + case 'bankName': + this.setData({ + ['form.bankName']: value + }) + break; + case 'bankBranch': + this.setData({ + ['form.bankBranch']: value + }) + break; + case 'name': + this.setData({ + ['form.legalPersonName']: value + }) + break; + case 'phone': + this.setData({ + ['form.legalPhone']: value + }) + break; + case 'idcard': + this.setData({ + ['form.legalPersonIdcard']: value + }) + break; + } + }, + upCard(e){ + let type = e.currentTarget.dataset.type; + util.chooseImages(img => { + if(type == 'f'){ + this.setData({ + ['form.idcardPicFront']: img + }) + } else if(type == 'b'){ + this.setData({ + ['form.idcardPicBehind']: img + }) + } else if(type == 'h'){ + this.setData({ + ['form.idcardPicHold']: img + }) + } else if(type == 'ap'){ + this.setData({ + ['form.authorizationPath']: img + }) + } else if(type == 'bl'){ + this.setData({ + ['form.businessLicense']: img + }) + } + }) + }, + bindPickerChange(e){ this.setData({ - isLegal: e.detail.value + ['form.enterpriseScale']: this.data.scaleArr[e.detail.value] }) }, + radioClick(e){ + this.setData({ + ['form.isLegalPerson']: e.detail.value + }) + }, + prevImg(e){ + // let url = e.currentTarget.dataset.url; + // wx.previewImage({ + // urls: [url], + // }) + }, + submit(){ + let form = this.data.form + if(form.isLegalPerson == 0 && form.authorizationPath == ''){ + wx.showToast({ + title: '请上传授权书!', + icon: 'none' + }) + return + } else if(form.enterpriseName == ''){ + wx.showToast({ + title: '请填写企业名称', + icon: 'none' + }) + return + } else if(form.creditCode == ''){ + wx.showToast({ + title: '请填写信用代码', + icon: 'none' + }) + return + } else if(form.enterpriseScale == '请选择'){ + wx.showToast({ + title: '请选择企业规模', + icon: 'none' + }) + return + } else if(form.businessLicense == ''){ + wx.showToast({ + title: '请上传营业执照', + icon: 'none' + }) + return + } else if(form.bankAccount == ''){ + wx.showToast({ + title: '请输入银行账号', + icon: 'none' + }) + return + } else if(form.bankName == ''){ + wx.showToast({ + title: '请输入银行名称', + icon: 'none' + }) + return + } else if(form.bankName == ''){ + wx.showToast({ + title: '请输入开户网点', + icon: 'none' + }) + return + } else if(form.legalPersonName == ''){ + wx.showToast({ + title: '请填写姓名', + icon: 'none' + }) + return + } else if(form.legalPhone == ''){ + wx.showToast({ + title: '请填写手机号', + icon: 'none' + }) + return + } else if(form.legalPersonIdcard == ''){ + wx.showToast({ + title: '请填写身份证号', + icon: 'none' + }) + return + } else if(form.idcardPicFront == ''){ + wx.showToast({ + title: '请上传身份证正面照', + icon: 'none' + }) + return + } else if(form.idcardPicBehind == ''){ + wx.showToast({ + title: '请上传身份证反面面照', + icon: 'none' + }) + return + } else if(form.idcardPicHold == ''){ + wx.showToast({ + title: '请上传手持身份证照', + icon: 'none' + }) + return + } else{ + app.http('post','EnterpriseAuthentication/createAuthenticInfoTwo',this.data.form).then((res)=>{ + if(res.data.success){ + wx.showModal({ + title: '提示!', + content: '提交成功!请等待审核', + success(res) { + wx.switchTab({ + url: '/pages/index/index', + }) + } + }) + } else{ + wx.showToast({ + title: res.data.msg, + icon: 'none' + }) + } + }) + } + }, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/release/companyAuth/index.wxml b/pages/release/companyAuth/index.wxml index 186ea7a..64066c3 100644 --- a/pages/release/companyAuth/index.wxml +++ b/pages/release/companyAuth/index.wxml @@ -5,18 +5,19 @@ 申请人是否为企业法人 - + 非法人申请需上传加盖公章的申请授权书 - - + + + @@ -32,13 +33,13 @@ 企业名称 - + 信用代码 - + @@ -50,15 +51,16 @@ 企业规模 - - {{form.scale}} + + {{form.enterpriseScale}} 营业执照 - + + @@ -68,21 +70,19 @@ 银行账号 - + 开户银行 - - {{form.scale}} - + 开户网点 - + @@ -92,38 +92,41 @@ 姓名 - + 手机号 - + 身份证号 - + 身份证 - + + - + + - + + - 保存并提交 + 保存并提交 diff --git a/pages/release/index.js b/pages/release/index.js index 63b5f94..3f296b3 100644 --- a/pages/release/index.js +++ b/pages/release/index.js @@ -1,32 +1,134 @@ // pages/release/index.js +const app = getApp(); + Page({ /** * 页面的初始数据 */ data: { - + userInfo: {}, + authStatus: 0, + authType: null, + completeState: null + }, + back(){ + wx.switchTab({ + url: '/pages/index/index', + }) + }, + toPersonlAuth(){ + if(this.data.authStatus == 0){ + wx.navigateTo({ + url: '/pages/release/personAuth/index', + }) + } else if(this.data.authStatus == 1){ + wx.showToast({ + title: '认证申请审核中,请等待!', + icon: 'none' + }) + } + }, + toCompanyAuth(){ + if(this.data.authStatus == 0){ + wx.navigateTo({ + url: '/pages/release/companyAuth/index', + }) + } else if(this.data.authStatus == 1){ + wx.showToast({ + title: '认证申请审核中,请等待!', + icon: 'none' + }) + } }, - /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + }, - - /** - * 生命周期函数--监听页面初次渲染完成 - */ - onReady: function () { - + isAuthentication(){ + app.http('get','user/isAuthentication').then((res)=>{ + console.log(res) + if(res.data.success){ + this.setData({ + authStatus: res.data.data.authenticationState, + authType: res.data.data.authorizationType, + completeState: res.data.data.completeState + }) + } + }) + }, + toResources(){ + let that = this; + if(this.data.authStatus == 2 && this.data.authType == 1 && this.data.completeState == true){ + wx.navigateTo({ + url: '/pages/user/editNeeds/index?type=1', + }) + } else if(this.data.authStatus == 2 && this.data.authType == 1 && this.data.completeState == false){ + wx.showModal({ + title: '提示!', + content: '您还未完善企业信息,点击确定去完善吧~', + success(res){ + if(res.confirm){ + wx.navigateTo({ + url: '/pages/release/perfectCompanyInfo/index?status=' + that.data.authStatus, + }) + } + + } + }) + } else if(this.data.authStatus == 3 && this.data.authType == 1 && this.data.completeState == false){ + wx.showModal({ + title: '提示!', + content: '您提交的企业信息未通过审核,点击确定去修改吧~', + success(res){ + wx.navigateTo({ + url: '/pages/release/perfectCompanyInfo/index?status=' + that.data.authStatus, + }) + } + }) + } + }, + toNeeds(){ + if(this.data.authStatus == 2 && (this.data.authType == 2 || this.data.authType == 1) && this.data.completeState == true){ + wx.navigateTo({ + url: '/pages/user/editNeeds/index?type=2', + }) + } else if((this.data.authStatus == 2 || this.data.authStatus == 3) && this.data.authType == 2 && this.data.completeState == false){ + wx.showModal({ + title: '提示!', + content: '您还未完善个人信息,点击确定去完善吧~', + success(res){ + wx.navigateTo({ + url: '/pages/release/perfectPersonInfo/index', + }) + } + }) + } else if((this.data.authStatus == 2 || this.data.authStatus == 3) && this.data.authType == 1 && this.data.completeState == false){ + wx.showModal({ + title: '提示!', + content: '您还未完善企业信息,点击确定去完善吧~', + success(res){ + wx.navigateTo({ + url: '/pages/release/perfectCompanyInfo/index', + }) + } + }) + } }, - /** * 生命周期函数--监听页面显示 */ onShow: function () { - + let userInfo = wx.getStorageSync('userInfo') + if(userInfo.phone && userInfo.phone != ''){ + this.isAuthentication(); + } else{ + wx.navigateTo({ + url: '/pages/login/index', + }) + } }, /** diff --git a/pages/release/index.wxml b/pages/release/index.wxml index 479a67d..c4886dc 100644 --- a/pages/release/index.wxml +++ b/pages/release/index.wxml @@ -1,8 +1,8 @@ - 企业认证 - 个人认证 + 企业认证 + 个人认证 @@ -16,13 +16,15 @@ - - + + 我能提供... + - - + + 我有需求... + - + diff --git a/pages/release/index.wxss b/pages/release/index.wxss index dd93da3..b621917 100644 --- a/pages/release/index.wxss +++ b/pages/release/index.wxss @@ -51,13 +51,34 @@ padding: 0 36rpx; margin-top: 28rpx; } +.btn{ + width: 320rpx; + height: 378rpx; + position: relative; +} .btn-box image{ width: 320rpx; height: 378rpx; + position: absolute; + left: 0; + top: 0; } .btn-box .default{ filter: grayscale(1); } +.btn .tip{ + color: #9C9C9C; + font-weight: 500; + font-size: 32rpx; + position: relative; + left: 0; + top: 70rpx; + text-align: center; + z-index: 3; +} +.btn .auth{ + color: #1D1D1D; +} .close { text-align: center; } diff --git a/pages/release/perfectCompanyInfo/index.js b/pages/release/perfectCompanyInfo/index.js index 8779562..e0d45e9 100644 --- a/pages/release/perfectCompanyInfo/index.js +++ b/pages/release/perfectCompanyInfo/index.js @@ -1,20 +1,160 @@ // pages/release/perfectCompanyInfo/index.js +const util = require('../../../utils/util.js') +const app = getApp() +import WxValidate from '../../../utils/WxValidate.js' Page({ /** * 页面的初始数据 */ data: { - + form: { + enterpriseType: 1, + enterpriseAddress: '', + latitude: '', + longitude: '', + enterpriseLogo: '', + enterpriseTitle: '', + enterpriseLabel: '', + enterpriseNet: '', + enterprisePhone: '', + aboutUs: '', + imgPaths:[], + } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.initValidate()//验证规则函数 + }, + initValidate(){ + const rules = { + enterpriseAddress: { + required: true, + }, + enterpriseLogo: { + required: true, + }, + enterpriseTitle: { + required: true, + }, + businessNature: { + required: true, + }, + enterpriseNet: { + required: true, + }, + enterprisePhone:{ + required:true, + } + } + const messages = { + enterpriseAddress: { + required: '请选择或填写地址', + }, + enterpriseLogo: { + required: '请上传企业Logo', + }, + enterpriseTitle: { + required: '请填写企业slogan', + }, + businessNature: { + required: '请填写企业经营范围', + }, + enterpriseNet: { + required: '请填写企业网站', + }, + enterprisePhone:{ + required: '请填写客服电话', + } + } + this.WxValidate = new WxValidate(rules, messages) + }, + showMap(){ + let that = this; + wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function(res) { + wx.chooseLocation({ + latitude: res.latitude, + longitude: res.longitude, + scale: 28, + success: (result)=>{ + that.setData({ + ['form.enterpriseAddress']: result.address, + ['form.latitude']: result.latitude, + ['form.longitude']: result.longitude, + }) + } + }) + } + }) + }, + uploadImg(e){ + let type = e.currentTarget.dataset.type; + util.chooseImages(img => { + if(type == 'logo'){ + this.setData({ + ['form.enterpriseLogo']: img + }) + } + }); + }, + upImgs(){ + util.chooseImages2(img => { + let imgs = this.data.form.imgPaths + imgs.push(img) + this.setData({ + ['form.imgPaths']: imgs + }) + }); + }, + submit(e){ + let that = this; + console.log(e.detail.value) + wx.showModal({ + title: '提示!', + content: '是否确认提交?', + success(res){ + if(res.confirm){ + const params = e.detail.value + params.enterpriseType = 1 + params.latitude = that.data.form.latitude + params.longitude = that.data.form.longitude + params.enterpriseLogo = that.data.form.enterpriseLogo + params.imgPaths = that.data.form.imgPaths + if (!that.WxValidate.checkForm(params)) { + const error = that.WxValidate.errorList[0] + that.showModal(error) + return false + } + app.http('post','Enterprise/completeEnterprise',params).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '提交成功', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } + }) + } else{ + console.log('已取消') + } + } + }) + }, + showModal(error) { + wx.showModal({ + content: error.msg, + showCancel: false, + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/release/perfectCompanyInfo/index.wxml b/pages/release/perfectCompanyInfo/index.wxml index eac4673..1f0d558 100644 --- a/pages/release/perfectCompanyInfo/index.wxml +++ b/pages/release/perfectCompanyInfo/index.wxml @@ -2,13 +2,15 @@ 企业简介 +
企业地址* - 去选择地址 + + - + @@ -16,7 +18,8 @@ 企业logo* - + + @@ -24,7 +27,23 @@ 企业slogan* - + + + + + + 企业经营范围* + + + + + + + + 企业网站* + + + @@ -32,7 +51,7 @@ 客服电话* - + @@ -40,7 +59,7 @@ 关于我们 - + @@ -48,9 +67,14 @@ 公司展示 - + + + + +
- 保存并提交 + +
diff --git a/pages/release/perfectCompanyInfo/index.wxss b/pages/release/perfectCompanyInfo/index.wxss index cb839bb..123e29c 100644 --- a/pages/release/perfectCompanyInfo/index.wxss +++ b/pages/release/perfectCompanyInfo/index.wxss @@ -24,6 +24,15 @@ .form-item{ margin-top: 22rpx; } +.chose{ + padding: 0 !important; + margin: 0 !important; + width: auto !important; + background: #fff; + font-size: 26rpx; + color: #666; + font-weight: normal; +} .red{ color: #FF0000; } @@ -48,6 +57,7 @@ .upload-box image{ width: 120rpx; height: 120rpx; + margin-right: 20rpx; } .textarea-box{ width: 100%; @@ -63,13 +73,14 @@ line-height: 40rpx; } .submit-btn{ - width: 670rpx; - height: 76rpx; + width: 670rpx !important; + height: 76rpx !important; background: linear-gradient(144deg, #FFA782 0%, #FF5100 100%); border-radius: 38rpx; color: #fff; - font-size: 28rpx; - line-height: 76rpx; + font-size: 28rpx !important; + line-height: 76rpx !important; text-align: center; - margin:40rpx auto; + margin:40rpx auto !important; + padding: 0 !important; } \ No newline at end of file diff --git a/pages/release/perfectPersonInfo/index.js b/pages/release/perfectPersonInfo/index.js index 2cde96d..225d0ad 100644 --- a/pages/release/perfectPersonInfo/index.js +++ b/pages/release/perfectPersonInfo/index.js @@ -1,20 +1,142 @@ // pages/release/perfectPersonInfo/index.js +const util = require('../../../utils/util.js') +const app = getApp() +import WxValidate from '../../../utils/WxValidate.js' Page({ - /** * 页面的初始数据 */ data: { - + form: { + enterpriseType: 2, + enterpriseScale: '', + businessNature: '', + establishmentTime: '', + enterpriseAddress: '', + latitude: '', + longitude: '', + enterprisePhone: '', + imgPaths: [], + } + }, + showMap(){ + let that = this; + wx.getLocation({ + type: 'gcj02', //返回可以用于wx.openLocation的经纬度 + success: function(res) { + wx.chooseLocation({ + latitude: res.latitude, + longitude: res.longitude, + scale: 28, + success: (result)=>{ + console.log(result) + that.setData({ + ['form.enterpriseAddress']: result.address, + ['form.latitude']: result.latitude, + ['form.longitude']: result.longitude, + }) + } + }) + } + }) + }, + timeChange(e){ + this.setData({ + ['form.establishmentTime']: e.detail.value + }) }, - /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + this.initValidate()//验证规则函数 + }, + initValidate(){ + const rules = { + enterpriseScale: { + required: true, + }, + industryId: { + required: true, + }, + establishmentTime: { + required: true, + }, + enterpriseAddress: { + required: true, + }, + enterprisePhone:{ + required:true, + } + } + const messages = { + enterpriseAddress: { + required: '请选择或填写地址', + }, + enterpriseScale: { + required: '请填写团队规模', + }, + industryId: { + required: '请填写承接类型', + }, + establishmentTime: { + required: '请选择组建时间', + }, + enterprisePhone:{ + required: '请填写客服电话', + } + } + this.WxValidate = new WxValidate(rules, messages) + }, + upImgs(){ + util.chooseImages2(img => { + let imgs = this.data.form.imgPaths + imgs.push(img) + this.setData({ + ['form.imgPaths']: imgs + }) + }); + }, + submit(e){ + let that = this; + wx.showModal({ + title: '提示!', + content: '是否确认提交?', + success(res){ + if(res.confirm){ + const params = e.detail.value + params.enterpriseType = 2 + params.imgPaths = that.data.form.imgPaths + if (!that.WxValidate.checkForm(params)) { + const error = that.WxValidate.errorList[0] + that.showModal(error) + return false + } + app.http('post','Enterprise/completeEnterprise',params).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '提交成功', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } + }) + } else{ + console.log('已取消') + } + } + }) + }, + showModal(error) { + wx.showModal({ + content: error.msg, + showCancel: false, + }) }, - /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/release/perfectPersonInfo/index.wxml b/pages/release/perfectPersonInfo/index.wxml index c64d6f6..6892b13 100644 --- a/pages/release/perfectPersonInfo/index.wxml +++ b/pages/release/perfectPersonInfo/index.wxml @@ -2,62 +2,68 @@ 个人(团队)简介 - - - 团队规模* - - - +
+ + + 团队规模* + + + + - - - 主要承接类型* - - - + + 主要承接类型* + + + + - - - 承接时间* - - - + + 组建时间* + + + {{form.establishmentTime || '请选择'}} + + + + - - - - 办公地址* - 去选择地址 - - - - - - - - 客服电话* - - - - - - - - 关于我们 + + + 办公地址* + 去选择地址 + + + + - - + + + 客服电话* + + + + - - - - 团队展示 + + + 关于我们 + + + + - - + + + 团队展示 + + + + + - + + - 保存并提交 diff --git a/pages/release/perfectPersonInfo/index.wxss b/pages/release/perfectPersonInfo/index.wxss index 644291d..529cc13 100644 --- a/pages/release/perfectPersonInfo/index.wxss +++ b/pages/release/perfectPersonInfo/index.wxss @@ -14,7 +14,7 @@ margin-top: 20rpx; } .introduction-item input{ - width: 100rpx; + /* width: 100rpx; */ text-align: right; } @@ -40,6 +40,10 @@ font-size: 28rpx; color: #666666; } +.picker{ + font-size: 28rpx; + color: #666666; +} .form-item{ margin-top: 22rpx; } @@ -67,6 +71,7 @@ .upload-box image{ width: 120rpx; height: 120rpx; + margin-right: 20rpx; } .textarea-box{ width: 100%; @@ -82,13 +87,14 @@ line-height: 40rpx; } .submit-btn{ - width: 670rpx; - height: 76rpx; + width: 670rpx !important; + height: 76rpx !important; background: linear-gradient(144deg, #FFA782 0%, #FF5100 100%); border-radius: 38rpx; color: #fff; - font-size: 28rpx; - line-height: 76rpx; + font-size: 28rpx !important; + line-height: 76rpx !important; text-align: center; - margin:40rpx auto; + margin:40rpx auto !important; + padding: 0 !important; } \ No newline at end of file diff --git a/pages/release/personAuth/index.js b/pages/release/personAuth/index.js index c20dbab..5f216d2 100644 --- a/pages/release/personAuth/index.js +++ b/pages/release/personAuth/index.js @@ -1,11 +1,20 @@ // pages/release/personAuth/index.js +const util = require('../../../utils/util.js') +const app = getApp() Page({ /** * 页面的初始数据 */ data: { - + form: { + legalPersonName: '', + legalPhone: '', + legalPersonIdcard: '', + idcardPicFront: '', + idcardPicBehind: '', + idcardPicHold: '' + } }, /** @@ -14,7 +23,100 @@ Page({ onLoad: function (options) { }, - + inpChange(e){ + let type = e.currentTarget.dataset.type + let value = e.detail.value + if(type == 'name'){ + this.setData({ + ['form.legalPersonName']: value + }) + } else if(type == 'phone'){ + this.setData({ + ['form.legalPhone']: value + }) + } else if(type == 'idcard'){ + this.setData({ + ['form.legalPersonIdcard']: value + }) + } + }, + upCard(e){ + let type = e.currentTarget.dataset.type; + util.chooseImages(img => { + if(type == 'f'){ + this.setData({ + ['form.idcardPicFront']: img + }) + } else if(type == 'b'){ + this.setData({ + ['form.idcardPicBehind']: img + }) + } else{ + this.setData({ + ['form.idcardPicHold']: img + }) + } + }); + }, + submit(){ + let form = this.data.form; + if(form.legalPersonName == ''){ + wx.showToast({ + title: '请填写姓名', + icon: 'none' + }) + return + } else if(form.legalPhone == ''){ + wx.showToast({ + title: '请填写手机号', + icon: 'none' + }) + return + } else if(form.legalPersonIdcard == ''){ + wx.showToast({ + title: '请填写身份证号', + icon: 'none' + }) + return + } else if(form.idcardPicFront == ''){ + wx.showToast({ + title: '请上传身份证正面照', + icon: 'none' + }) + return + } else if(form.idcardPicBehind == ''){ + wx.showToast({ + title: '请上传身份证反面面照', + icon: 'none' + }) + return + } else if(form.idcardPicHold == ''){ + wx.showToast({ + title: '请上传手持身份证照', + icon: 'none' + }) + return + } else{ + app.http('post','EnterpriseAuthentication/createAuthenticInfoOne',this.data.form).then((res)=>{ + if(res.data.success){ + wx.showModal({ + title: '提示!', + content: '提交成功!请等待审核', + success(res) { + wx.switchTab({ + url: '/pages/index/index', + }) + } + }) + } else{ + wx.showToast({ + title: res.data.msg, + icon: 'none' + }) + } + }) + } + }, /** * 生命周期函数--监听页面初次渲染完成 */ diff --git a/pages/release/personAuth/index.wxml b/pages/release/personAuth/index.wxml index 9bf9cdb..3db1f07 100644 --- a/pages/release/personAuth/index.wxml +++ b/pages/release/personAuth/index.wxml @@ -4,38 +4,41 @@ 姓名 - + 手机号 - + 身份证号 - + 身份证 - + + - + + - + + - 保存并提交 + 保存并提交 diff --git a/pages/user/agreement/index.js b/pages/user/agreement/index.js index 5c6d96a..620629d 100644 --- a/pages/user/agreement/index.js +++ b/pages/user/agreement/index.js @@ -39,13 +39,11 @@ Page({ }) } }).then(()=>{ - console.log(pages.length) - console.log(pages[0].route) if(pages[pages.length - 2]){ if(this.data.userInfo.isRecharge && pages[pages.length - 2].route !== 'pages/user/index'){ setTimeout(()=>{ wx.reLaunch({ - url: '/pages/user/index', + url: '/pages/user/mine/index', }) },3000) } @@ -54,7 +52,7 @@ Page({ if(this.data.userInfo.isRecharge == 1){ setTimeout(()=>{ wx.reLaunch({ - url: '/pages/user/index', + url: '/pages/user/mine/index', }) },3000) } @@ -63,7 +61,7 @@ Page({ if(this.data.userInfo.isRecharge){ setTimeout(()=>{ wx.reLaunch({ - url: '/pages/user/index', + url: '/pages/user/mine/index', }) },2000) } diff --git a/pages/user/agreement/index.wxml b/pages/user/agreement/index.wxml index a0d766c..f5a7ebe 100644 --- a/pages/user/agreement/index.wxml +++ b/pages/user/agreement/index.wxml @@ -1,21 +1,22 @@ - - - + + + + + + + + + + + + + + + 请使用1.4.4及以上版本基础库 + + - - - - - - - - - - 请使用1.4.4及以上版本基础库 - - - diff --git a/pages/user/editNeeds/index.js b/pages/user/editNeeds/index.js new file mode 100644 index 0000000..ff0cf9a --- /dev/null +++ b/pages/user/editNeeds/index.js @@ -0,0 +1,220 @@ +// pages/user/editNeeds/index.js +const util = require('../../../utils/util.js') +const app = getApp() +import WxValidate from '../../../utils/WxValidate.js' +Page({ + /** + * 页面的初始数据 + */ + data: { + form: { + resourceType: 0, + title: '', + detailedDescription: '', + resourceImgs: [], + capital:'', + resourceStartTime:'', + resourceEndTime: '', + }, + typeArr:['供应' , '需求'], + active: 1 + }, + tabClick(e){ + let i = e.currentTarget.dataset.i; + if(i == 2){ + this.setData({ + ['form.capital']: '价格可议' + }) + } + this.setData({ + active: e.currentTarget.dataset.i + }) + }, + startTimeChange(e){ + this.setData({ + ['form.resourceStartTime']: e.detail.value + }) + }, + endTimeChange(e){ + this.setData({ + ['form.resourceEndTime']: e.detail.value + }) + }, + bindPickerChange(e){ + this.setData({ + ['form.resourceType']: this.data.typeArr[e.detail.value] + }) + }, + upImgs(){ + util.chooseImages2(img => { + let imgs = this.data.form.imgPaths + imgs.push(img) + this.setData({ + ['form.resourceImgs']: imgs + }) + }); + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + console.log(options) + if(options.id){ + this.getDetail() + } + if(options.type){ + this.setData({ + ['form.resourceType']: Number(options.type) - 1 + }) + } + this.initValidate()//验证规则函数 + }, + // 重新发布,获取提交数据 + getDetail(){ + + }, + initValidate(){ + const rules = { + title: { + required: true, + }, + resourceCagetoryId: { + required: true, + }, + detailedDescription: { + required: true, + }, + resourceStartTime:{ + required:true, + }, + resourceEndTime:{ + required:true, + } + } + const messages = { + title: { + required: '请填写标题', + }, + resourceCagetoryId: { + required: '请填写需求类型', + }, + detailedDescription: { + required: '请填写内容', + }, + resourceEndTime:{ + required: '请设置展示开始时间', + }, + resourceEndTime:{ + required: '请设置展示结束时间', + } + } + this.WxValidate = new WxValidate(rules, messages) + }, + upImgs(){ + util.chooseImages2(img => { + let imgs = this.data.form.resourceImgs + imgs.push(img) + this.setData({ + ['form.resourceImgs']: imgs + }) + }); + }, + submit(e){ + let that = this + let type = e.currentTarget.dataset.type + wx.showModal({ + title: '提示!', + content: '是否确认提交?', + success(res){ + if(res.confirm){ + const params = e.detail.value + params.resourceType = that.data.form.resourceType + 1 + params.resourceImgs = that.data.form.resourceImgs + params.capital = that.data.form.capital + params.resourceAuditState = type + if (!that.WxValidate.checkForm(params)) { + const error = that.WxValidate.errorList[0] + that.showModal(error) + return false + } + app.http('post','Resources/create',params).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '提交成功', + duration: 2000 + }) + setTimeout(()=>{ + wx.navigateBack({ + delta: 1, + }) + },2000) + } else{ + wx.showToast({ + title: '请求失败', + duration: 2000, + icon: 'none' + }) + } + }) + } else{ + console.log('已取消') + } + } + }) + }, + showModal(error) { + wx.showModal({ + content: error.msg, + showCancel: false, + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/user/editNeeds/index.json b/pages/user/editNeeds/index.json new file mode 100644 index 0000000..cea84f9 --- /dev/null +++ b/pages/user/editNeeds/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "供应/需求编辑" +} \ No newline at end of file diff --git a/pages/user/editNeeds/index.wxml b/pages/user/editNeeds/index.wxml new file mode 100644 index 0000000..3e8f55a --- /dev/null +++ b/pages/user/editNeeds/index.wxml @@ -0,0 +1,77 @@ + + + +
+ + 我是供应/需求 + + + {{typeArr[form.resourceType]}} + + + + + 供应/需求标题* + + + + + + 供应/需求类型* + + + + + 供应/需求内容* + 看看别人怎么写> + + + + + + + 补充内容/添加图片 + + + + + + + + 供应/需求预算* + + 明确预算 + 价格可议 + + + + + + + + + + 展示时间 + + + + + {{form.resourceStartTime || '请选择'}} + + + + + + + {{form.resourceEndTime || '请选择'}} + + + + + + + +
+
+ +
diff --git a/pages/user/editNeeds/index.wxss b/pages/user/editNeeds/index.wxss new file mode 100644 index 0000000..59329fb --- /dev/null +++ b/pages/user/editNeeds/index.wxss @@ -0,0 +1,105 @@ +/* pages/user/editNeeds/index.wxss */ +.form-box{ + width: 100%; + padding: 32rpx 38rpx; + font-size: 28rpx; + color:#666666; +} +.form-item{ + margin-bottom: 60rpx; +} +.pick-box{ + color: #666; +} +.red{ + color: #FF0000; +} +.colO{ + color: #FF6D31; + font-size: 24rpx; +} +.inp-box{ + width: 100%; + padding: 10rpx 22rpx; + background: #eee; + color: #666; + margin-top: 36rpx; +} +.inp-box input{ + width: 90%; + height: 100%; +} +.area-box{ + width: 100%; + height: 290rpx; + padding: 24rpx 22rpx; + background: #eee; + color: #666; + margin-top: 36rpx; +} +.area-box textarea{ + width: 100%; + height: 100%; +} +.upload-box{ + width: 100%; + height: 140rpx; + margin-top: 26rpx; +} +.upload-box image{ + width: 140rpx; + height: 140rpx; + margin-right: 12rpx; +} + +.tab-item{ + width: 122rpx; + height: 40rpx; + text-align: center; + line-height: 40rpx; + border: 1px solid #707070; + border-radius: 8rpx; + color: #666; + font-size: 22rpx; + margin-left: 20rpx; +} +.tab-a{ + background: linear-gradient(341deg, #FF5100 0%, #FFA782 100%); + color: #fff; + border: none; +} +.time-box{ + margin-top: 24rpx; +} +.timepick-box{ + width: 308rpx; + height: 60rpx; + background: #eee; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 20rpx; +} +.timepick-box picker{ + width: 100%; +} +.timepick-box image{ + width: 14rpx; + height: 24rpx; + transform: rotate(90deg); +} +.m14{ + margin: 0 14rpx; +} +.submit-btn{ + width: 670rpx !important; + height: 76rpx !important; + background: linear-gradient(144deg, #FFA782 0%, #FF5100 100%); + border-radius: 38rpx; + color: #fff; + font-size: 28rpx !important; + line-height: 76rpx !important; + text-align: center; + margin:40rpx auto 20rpx !important; + padding: 0 !important; +} \ No newline at end of file diff --git a/pages/user/index.js b/pages/user/index.js index 17e71c7..add65a8 100644 --- a/pages/user/index.js +++ b/pages/user/index.js @@ -7,6 +7,7 @@ Page({ */ data: { tabbar: {}, + userInfo: {}, CustomBar: app.globalData.CustomBar, menuHeight: app.globalData.menuHeight, navHeight: app.globalData.navHeight, @@ -19,7 +20,52 @@ Page({ onLoad: function (options) { app.editTabbar(); }, - + getUser(){ + let userInfo = wx.getStorageSync('userInfo'); + this.setData({ + userInfo + }) + console.log(this.data.userInfo) + }, + // 跳转首席体验官 + toMine(){ + if(this.data.isRecharge){ + wx.navigateTo({ + url: '/pages/user/mine/index' + }) + } else{ + wx.navigateTo({ + url: '/pages/user/agreement/index' + }) + } + + }, + //跳转资源订单 + toResourcesOrder(){ + wx.navigateTo({ + url: '/pages/user/resourcesOrder/index' + }) + }, + //跳转需求订单 + toNeedsOrder(){ + wx.navigateTo({ + url: '/pages/user/needsOrder/index' + }) + }, + //跳转需求管理 + toNeedsManage(e){ + let type = e.currentTarget.dataset.type + wx.navigateTo({ + url: '/pages/user/needsManage/index?type=' + type, + }) + }, + //跳转资源管理 + toResourcesManage(e){ + let type = e.currentTarget.dataset.type + wx.navigateTo({ + url: '/pages/user/resourcesManage/index?type=' + type, + }) + }, /** * 生命周期函数--监听页面初次渲染完成 */ @@ -31,7 +77,7 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function () { - + app.getInfo(); }, /** diff --git a/pages/user/index.wxml b/pages/user/index.wxml index defb220..a984e82 100644 --- a/pages/user/index.wxml +++ b/pages/user/index.wxml @@ -2,8 +2,8 @@ 禅意云生态 - - + + 企业中心 @@ -11,30 +11,32 @@ - + - 刘海柱 + + {{userInfo.nickname || '微信用户'}} - - + {{userInfo.levelName || '普通会员'}} + + - - 20 + + 0 资源订单 - 203 + 0 我的审核 - - 2 + + 0 需求订单 - + @@ -44,30 +46,30 @@ 需求管理 - + - + 发布中 - + 审核中 - + 草稿箱 - + 已结束 - + 发布需求 @@ -78,19 +80,19 @@ 资源管理 - + 发布中 - + 审核中 - + 草稿箱 - + 已结束 diff --git a/pages/user/index.wxss b/pages/user/index.wxss index 7b7de75..7f4d046 100644 --- a/pages/user/index.wxss +++ b/pages/user/index.wxss @@ -58,6 +58,16 @@ font-size: 36rpx; line-height: 50rpx; } +.level{ + padding: 2rpx 20rpx; + font-size: 24rpx; + background: #FEC313; + text-align: center; + border-radius: 25px; +} +.img-tags { + margin-top: 14rpx; +} .userInfo-r image{ width: 132rpx; height: 48rpx; diff --git a/pages/user/needsManage/index.js b/pages/user/needsManage/index.js new file mode 100644 index 0000000..52f053b --- /dev/null +++ b/pages/user/needsManage/index.js @@ -0,0 +1,145 @@ +// pages/user/NeedsManage/index.js +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + tabActive: 1, + list: [], + resourceType: 2, + resourceState: null, + resourceAuditState: null, + }, + tabClick(e){ + let i = e.currentTarget.dataset.i + this.setParams(i) + }, + setParams(i){ + if(i == 1){ + this.setData({ + tabActive: i, + resourceState: 1, + resourceAuditState: [2], + }) + } else if(i == 2){ + this.setData({ + tabActive: i, + resourceState: 0, + resourceAuditState: [1], + }) + } else if(i == 3){ + this.setData({ + tabActive: i, + resourceState: 0, + resourceAuditState: [0,3], + }) + } else if(i == 4){ + this.setData({ + tabActive: i, + resourceState: 2, + resourceAuditState: [], + }) + } + this.getList() + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + tabActive: options.type + }) + this.setParams(options.type) + }, + toRelease(){ + wx.navigateTo({ + url: '/pages/release/index', + }) + }, + getList(){ + app.http('post','Resources/listMyResources',{ + resourceType: this.data.resourceType, + resourceState: this.data.resourceState, + resourceAuditState : this.data.resourceAuditState + }).then((res)=>{ + if(res.data.success){ + this.setData({ + list: res.data.data.content + }) + } + }) + }, + // 下架 + xiajiaClick(e){ + let id = e.currentTarget.dataset.id; + console.log(id) + }, + // 撤回 + withdrawClick(e){ + let id = e.currentTarget.dataset.id; + console.log(id) + }, + // 编辑 + editClick(e){ + let id = e.currentTarget.dataset.id; + console.log(id) + wx.navigateTo({ + url: '/pages/user/editNeeds/index?id=' + id, + }) + }, + // 删除 + delClick(e){ + let id = e.currentTarget.dataset.id; + console.log(id) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/user/needsManage/index.json b/pages/user/needsManage/index.json new file mode 100644 index 0000000..2ef25bc --- /dev/null +++ b/pages/user/needsManage/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "需求管理" +} \ No newline at end of file diff --git a/pages/user/needsManage/index.wxml b/pages/user/needsManage/index.wxml new file mode 100644 index 0000000..7896395 --- /dev/null +++ b/pages/user/needsManage/index.wxml @@ -0,0 +1,74 @@ + + + + 发布中 + 审核中 + 草稿箱 + 已结束 + + + + + 暂无需求 + 去发布吧 + + + + + {{item.title}} + + 公司起名 + LOGO + + + + 发布中 + 审核中 + 编辑未完成 + 项目已圆满结束 + 展示至{{item.resourceEndTime}} + + + 需求预算{{item.capital}} + {{item.detailedDescription}} + + {{item.resourceStartTime}}申请 + + 下架需求 + 撤回审核 + 编辑发布 + 删除需求 + + + + + + \ No newline at end of file diff --git a/pages/user/needsManage/index.wxss b/pages/user/needsManage/index.wxss new file mode 100644 index 0000000..bd42230 --- /dev/null +++ b/pages/user/needsManage/index.wxss @@ -0,0 +1,116 @@ +/* pages/user/NeedsManage/index.wxss */ +.manage-page{ + width: 100%; + min-height: 100vh; + background: #EEEEEE; +} +.tabs-box{ + width: 100%; + padding: 18rpx 58rpx; + background: #fff; +} +.tab{ + text-align: center; + font-size: 28rpx; + color: #707070; + position: relative; +} +.tab::after{ + display: block; + content: ''; + width: 100%; + height: 8rpx; + border-radius: 8rpx; + background: #FF6D31; + position: absolute; + bottom: -22rpx; + left: 50%; + margin-left: -41rpx; + opacity: 0; + transform: scaleX(0); + transition: all .2s cubic-bezier(.18,.89,.17,.88),opacity .15s ease; +} +.tab-a::after{ + opacity: 1; + transform: scaleX(1); +} +.list{ + width: 100%; + padding: 32rpx 40rpx; +} +.list-item{ + width: 100%; + padding: 20rpx 20rpx 32rpx; + background: #fff; + border-radius: 12rpx; + margin-bottom: 20rpx; +} + +.n-title{ + font-size: 28rpx; + color: #1D1D1D; + font-weight: 500; + margin-bottom: 18rpx; +} +.tag-item{ + width: 114rpx; + height: 36rpx; + line-height: 34rpx; + text-align: center; + color: #FC9367; + border: 1rpx solid #FC9367; + background: #fff; + border-radius: 4rpx; + font-size: 24rpx; + margin-right: 8rpx; +} +.colG{ + color: #3A9EFA; + border-color: #3A9EFA; +} +.top-r{ + color: #FF5100; + font-size: 20rpx; + font-weight: 600; + line-height: 40rpx; +} +.status{ + font-size: 30rpx; +} +.fz28{ + color:#707070; + line-height: 40rpx; + margin: 18rpx 0 10rpx; +} +.colR{ + color: #FF5100; +} +.desc{ + font-size: 24rpx; + line-height: 34rpx; + color: #333; +} +.time{ + font-size: 24rpx; + color: #707070; +} +.btn-box{ + font-size: 30rpx; + font-weight: 500; + line-height: 40px; + color: #FF5100; +} +.btn{ + font-size: 28rpx; + width: 150rpx; + height: 56rpx; + line-height: 56rpx; + text-align: center; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 12rpx; + color: #fff; + margin-left: 16rpx; +} +.default{ + background: linear-gradient(134deg, #BFBFBF 0%, #BFBFBF 100%); +} \ No newline at end of file diff --git a/pages/user/needsOrder/index.js b/pages/user/needsOrder/index.js new file mode 100644 index 0000000..d8b83da --- /dev/null +++ b/pages/user/needsOrder/index.js @@ -0,0 +1,240 @@ +// pages/user/needsOrder/index.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + tabActive: 1, + list: [] + }, + toDemandHall(){ + wx.switchTab({ + url: '/pages/demandHall/index', + }) + }, + tabClick(e){ + let i = e.currentTarget.dataset.i + this.setData({ + tabActive: i + }) + if(i == 1){ + this.getCommunicates() + } else{ + this.getProjectList() + } + }, + // 获取 沟通中 + getCommunicates(){ + app.http('get','Communicate/demandCommunicates').then((res)=>{ + if(res.data.success){ + if(res.data.data.length > 0){ + res.data.data.map((item)=>{ + item.open = false + }) + res.data.data[0].open = true + } + console.log(res.data.data) + this.setData({ + list: res.data.data + }) + } + }) + }, + //点击展开 + openClick(e){ + let idx = e.currentTarget.dataset.idx + console.log(idx) + let list = this.data.list + list[idx].open = !list[idx].open + this.setData({ + list: list + }) + }, + //获取进行中、已结束列表 + getProjectList(){ + app.http('get','Project/listProject',{projectState: this.data.tabActive -1, projectType: 2}).then((res)=>{ + if(res.data.success){ + res.data.data.map((item)=>{ + item.stageResultsDtoList.map((stage)=>{ + if(stage.state == 1){ + item.showBtn = true + } + }) + }) + this.setData({ + list: res.data.data + }) + } + }) + }, + //同意开启下一阶段 + agreenOpen(e){ + let item = e.currentTarget.dataset.item + console.log(item) + const stage = item.stageResultsDtoList.filter((item)=>{ + return item.state == 1 + }) + wx.showModal({ + title: '提示!', + content: '是否同意开启下阶段?', + success(res){ + if(res.confirm){ + app.http('get','Project/startNextStage',{stageResultId: stage[0].id}).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '操作成功!', + duration: 2000 + }) + this.getProjectList() + } + }) + } + } + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getCommunicates() + }, + // 平台介入 + toPlatform(e){ + let code = e.currentTarget.dataset.item.projectCode + wx.navigateTo({ + url: '/pages/demandHall/platform/index?code=' + code, + }) + }, + // 取消沟通 + cancelCommunicate(e){ + let info = e.currentTarget.dataset.info + console.log(info) + let that = this; + wx.showModal({ + title: '提示!', + content:'是否取消沟通?', + success(res){ + if(res.confirm){ + app.http('get','Communicate/cancelCommunicates',{communicateId: info.communicateId}).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '操作成功!', + duration: 1500 + }) + setTimeout(()=>{ + that.getCommunicates() + },1500) + } + }) + } + } + }) + }, + //查看立项书 + toCreateProject(e){ + let item = e.currentTarget.dataset.item + wx.navigateTo({ + url: '/pages/demandHall/createProject/index?state=' + item.comminuteState+ '&id=' + item.communicateId, + }) + }, + confirm(e){ + let item = e.currentTarget.dataset.item + let communicateId = e.currentTarget.dataset.id + let that = this; + wx.showModal({ + title: '提示!', + content:'是否确认立项?', + success(res){ + if(res.confirm){ + app.http('post','Communicate/aggreProject',{ + communicateId: communicateId, + partnerInfos: item.info + }).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '操作成功!', + duration: 2000 + }) + that.getCommunicates() + } + }) + } + } + }) + }, + cancelProject(e){ + let item = e.currentTarget.dataset.item + let communicateId = e.currentTarget.dataset.id + let that = this; + wx.showModal({ + title: '提示!', + content:'是否确认取消立项?', + success(res){ + if(res.confirm){ + app.http('post','Communicate/cancelProject',{ + communicateId: communicateId, + partnerInfos: item.partnerInfos + }).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '操作成功!', + duration: 2000 + }) + that.getCommunicates() + } + }) + } + } + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/user/needsOrder/index.json b/pages/user/needsOrder/index.json new file mode 100644 index 0000000..72dd29d --- /dev/null +++ b/pages/user/needsOrder/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "需求订单" +} \ No newline at end of file diff --git a/pages/user/needsOrder/index.wxml b/pages/user/needsOrder/index.wxml new file mode 100644 index 0000000..adb3671 --- /dev/null +++ b/pages/user/needsOrder/index.wxml @@ -0,0 +1,108 @@ + + + + 沟通中 + 进行中 + 已结束 + + + + + 暂无订单 + 去需求广场 + + + + + {{item.resourceInfo.name}} + + + 需求预算 {{item.resourceInfo.budget}} + {{item.resourceInfo.content}} + + + + {{!item.open ? '展开' : '收起'}} + + + + + + + + + + 合作方: + {{info.name}} + + 已申请 + 等待立项 + 项目成立中 + 已取消立项 + + 定金尾款 + + + + {{info.createTime}}项目开启 + + 取消沟通 + 查看立项书 + 确认立项 + 取消立项 + + + + + + + + + 项目编号 {{item.projectCode}} + + {{tabActive == 1 ? '沟通中' : tabActive == 2 ? '进行中' : '已结束'}} + 平台介入中 + + + + + {{item.resourcesDto.title || item.projectResource.name}} + 定金尾款 + {{item.resourcesDto.detailedDescription}} + + + 项目名称: + {{item.projectName}} + + + 合作方: + {{item.partner}} + + + + + + + + + {{progress.name}} ¥{{progress.money}} + + 未开始 + 申请开启 + 进行中 + 已结束 + + + + {{item.examineTime}}项目开启 + 项目已圆满结束 + + 同意开启 + 平台介入 + 同意交付 + + + + + + diff --git a/pages/user/needsOrder/index.wxss b/pages/user/needsOrder/index.wxss new file mode 100644 index 0000000..0cb09da --- /dev/null +++ b/pages/user/needsOrder/index.wxss @@ -0,0 +1,67 @@ +/* pages/user/needsOrder/index.wxss */ +@import '../resourcesOrder/index.wxss'; + +.needs-info-box{ + border: none !important; + margin-bottom: 0 !important; +} +.info2{ + width: calc(100% - 120rpx); +} +.info-item image{ + width: 90rpx; + height: 90rpx; + margin-right: 24rpx; +} +.info-item{ + font-size: 24rpx; + border-top: 2rpx solid #F0F0F0; + padding: 20rpx 0; +} +.projectinfo-box{ + font-size: 20rpx; + margin: 2rpx 0; +} +.tag-item{ + transform: scale(0.8); + margin: 0; +} + +.needs-info-box{ + /* padding-bottom: 22rpx; */ + border-bottom: 2rpx solid #F0F0F0; + margin-bottom: 22rpx; +} +.n-title{ + color: #1D1D1D; + font-size: 32rpx; + line-height: 44rpx; +} +.n-price{ + color: #707070; + font-size: 28rpx; + margin: 8rpx 0; +} +.n-desc{ + font-size: 24rpx; + line-height: 34rpx; + color: #333333; +} +.btn-box{ + margin-top: 10rpx; +} +.btn-item { + font-size: 24rpx; + width: 130rpx; + height: 50rpx; + line-height: 50rpx; + text-align: center; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 12rpx; + color: #fff; + margin-left: 8rpx; +} +.status { + min-width: 150rpx; + text-align: right; +} \ No newline at end of file diff --git a/pages/user/resourcesManage/index.js b/pages/user/resourcesManage/index.js new file mode 100644 index 0000000..79ca825 --- /dev/null +++ b/pages/user/resourcesManage/index.js @@ -0,0 +1,143 @@ +// pages/user/NeedsManage/index.js +const app = getApp(); +Page({ + + /** + * 页面的初始数据 + */ + data: { + tabActive: 1, + list: [], + resourceType: 1, + resourceState: null, + resourceAuditState: null, + }, + toRelease(){ + wx.navigateTo({ + url: '/pages/release/index', + }) + }, + tabClick(e){ + let i = e.currentTarget.dataset.i + this.setParams(i) + }, + setParams(i){ + if(i == 1){ + this.setData({ + tabActive: i, + resourceState: 1, + resourceAuditState: [2], + }) + } else if(i == 2){ + this.setData({ + tabActive: i, + resourceState: 0, + resourceAuditState: [1], + }) + } else if(i == 3){ + this.setData({ + tabActive: i, + resourceState: 0, + resourceAuditState: [0,3], + }) + } else if(i == 4){ + this.setData({ + tabActive: i, + resourceState: 2, + resourceAuditState: [], + }) + } + this.getList() + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + tabActive: options.type + }) + this.setParams(options.type) + + }, + getList(){ + app.http('post','Resources/listMyResources',{ + resourceType: this.data.resourceType, + resourceState: this.data.resourceState, + resourceAuditState : this.data.resourceAuditState + }).then((res)=>{ + if(res.data.success){ + this.setData({ + list: res.data.data.content + }) + } + }) + }, + // 下架 + xiajiaClick(e){ + let id = e.currentTarget.dataset.id; + console.log(id) + }, + // 撤回 + withdrawClick(e){ + let id = e.currentTarget.dataset.id; + }, + // 编辑 + editClick(e){ + let id = e.currentTarget.dataset.id; + wx.navigateTo({ + url: '/pages/user/editNeeds/index?id=' + id, + }) + }, + // 删除 + delClick(e){ + let id = e.currentTarget.dataset.id; + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/user/resourcesManage/index.json b/pages/user/resourcesManage/index.json new file mode 100644 index 0000000..1a1b914 --- /dev/null +++ b/pages/user/resourcesManage/index.json @@ -0,0 +1,5 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "资源管理" + +} \ No newline at end of file diff --git a/pages/user/resourcesManage/index.wxml b/pages/user/resourcesManage/index.wxml new file mode 100644 index 0000000..f1e839d --- /dev/null +++ b/pages/user/resourcesManage/index.wxml @@ -0,0 +1,70 @@ + + + + 发布中 + 审核中 + 草稿箱 + 已结束 + + + + + 暂无资源 + 去发布吧 + + + + 项目编号 17262626272727 + {{tabActive == 2 ? '等待审核' : '未编辑完成'}} + + + + + {{item.title}} + {{item.detailedDescription}} + + + 项目合作数量(6) + + 成交金额 50000元 + 赚取 50000元 + {{item.createTime}}申请 + + 下架资源 + 撤回审核 + 编辑发布 + 删除项目 + 项目已圆满结束 + + + + + + + + diff --git a/pages/user/resourcesManage/index.wxss b/pages/user/resourcesManage/index.wxss new file mode 100644 index 0000000..5ac980d --- /dev/null +++ b/pages/user/resourcesManage/index.wxss @@ -0,0 +1,113 @@ +/* pages/user/resourcesManage/index.wxss */ +.manage-page{ + width: 100%; + min-height: 100vh; + background: #EEEEEE; +} +.tabs-box{ + width: 100%; + padding: 18rpx 58rpx; + background: #fff; +} +.tab{ + text-align: center; + font-size: 28rpx; + color: #707070; + position: relative; +} +.tab::after{ + display: block; + content: ''; + width: 100%; + height: 8rpx; + border-radius: 8rpx; + background: #FF6D31; + position: absolute; + bottom: -22rpx; + left: 50%; + opacity: 0; + transform: translateX(-50%) scaleX(0); + transition: all .2s cubic-bezier(.18,.89,.17,.88),opacity .15s ease; +} +.tab-a::after{ + opacity: 1; + left: 0; + transform: translateX(0%) scaleX(1); +} +.list{ + width: 100%; + padding: 32rpx 40rpx; +} +.list-item{ + width: 100%; + padding: 20rpx 20rpx 32rpx; + background: #fff; + border-radius: 12rpx; + margin-bottom: 20rpx; +} +.number{ + margin-bottom: 24rpx; + color: #666666; + font-size: 28rpx; +} +.status{ + font-weight: 500; + font-size: 28rpx; + color: #FF5100; +} +.info-box image{ + width: 154rpx; + height: 154rpx; + border-radius: 8rpx; + margin-right: 12rpx; +} +.info{ + width: 450rpx; + font-size: 28rpx; +} +.i-title{ + font-weight: 500; + line-height: 40rpx; + color: #1D1D1D; +} +.i-desc{ + font-size: 24rpx; + font-weight: 400; + line-height: 34rpx; + color: #666666; + min-height: 112rpx; +} +.time{ + color: #A7A7A7; + font-size: 24rpx; +} +.colO{ + font-size: 28rpx; + margin: 24rpx 0 4rpx; + color: #FF5100; +} +.btn-box{ + font-size: 30rpx; + font-weight: 500; + line-height: 40px; + color: #FF5100; +} +.btn{ + font-size: 28rpx; + width: 150rpx; + height: 56rpx; + line-height: 56rpx; + text-align: center; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 12rpx; + color: #fff; + margin-left: 16rpx; +} +.default{ + background: linear-gradient(134deg, #BFBFBF 0%, #BFBFBF 100%); +} +.text{ + font-size: 28rpx; + color: #666; +} + diff --git a/pages/user/resourcesOrder/index.js b/pages/user/resourcesOrder/index.js new file mode 100644 index 0000000..b7986a6 --- /dev/null +++ b/pages/user/resourcesOrder/index.js @@ -0,0 +1,180 @@ +// pages/user/resourcesOrder/index.js +const app = getApp() +Page({ + + /** + * 页面的初始数据 + */ + data: { + tabActive: 1, + list: [] + }, + toDemandHall(){ + wx.switchTab({ + url: '/pages/demandHall/index', + }) + }, + tabClick(e){ + let i = e.currentTarget.dataset.i + this.setData({ + tabActive: i + }) + if(i == 1){ + this.getCommunicates() + } else{ + this.getProjectList() + } + }, + // 获取 沟通中 + getCommunicates(){ + app.http('get','Communicate/resourceCommunicates').then((res)=>{ + if(res.data.success){ + if(res.data.data.length > 0){ + res.data.data.map((item)=>{ + item.open = false + }) + res.data.data[0].open = true + } + this.setData({ + list: res.data.data + }) + } + }) + }, + //获取进行中、已结束列表 + getProjectList(){ + app.http('get','Project/listProject',{projectState: this.data.tabActive -1, projectType: 1}).then((res)=>{ + if(res.data.success){ + res.data.data.map((item)=>{ + item.stageResultsDtoList.map((stage)=>{ + if(stage.state == 1){ + item.showBtn = true + } + }) + }) + this.setData({ + list: res.data.data + }) + } + }) + }, + // 开启下一阶段 + openNextProgress(e){ + let item = e.currentTarget.dataset.item + console.log(item) + wx.showModal({ + title: '提示!', + content: '是否申请开启下阶段?', + success(res){ + if(res.confirm){ + app.http('get','Project/applyNextStage',{projectCode: item.projectCode}).then((res)=>{ + if(res.data.success){ + wx.showToast({ + title: '操作成功!', + duration: 2000 + }) + } + }) + } + } + }) + + }, + //点击展开 + openClick(e){ + let idx = e.currentTarget.dataset.idx + console.log(idx) + let list = this.data.list + list[idx].open = !list[idx].open + this.setData({ + list: list + }) + }, + // 跳转申请详情 + toApplyDetail(e){ + let data = encodeURIComponent(JSON.stringify(e.currentTarget.dataset.item)); + wx.navigateTo({ + url: '/pages/demandHall/applyDetail/index?data=' + data, + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.getCommunicates() + }, + // 拨打电话 + call(e){ + console.log(e.currentTarget.dataset.item) + }, + // 立项 + createProject(e){ + let id = e.currentTarget.dataset.id + wx.showModal({ + title: "提示!", + content: '是否确认立项?', + success(res){ + if(res.confirm){ + wx.navigateTo({ + url: '/pages/demandHall/createProject/index?id='+ id, + }) + } + } + }) + }, + // 平台介入 + toPlatform(e){ + let code = e.currentTarget.dataset.item.projectCode + wx.navigateTo({ + url: '/pages/demandHall/platform/index?code=' + code, + }) + }, + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/user/resourcesOrder/index.json b/pages/user/resourcesOrder/index.json new file mode 100644 index 0000000..46fb35f --- /dev/null +++ b/pages/user/resourcesOrder/index.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "资源订单" +} \ No newline at end of file diff --git a/pages/user/resourcesOrder/index.wxml b/pages/user/resourcesOrder/index.wxml new file mode 100644 index 0000000..ef5ba88 --- /dev/null +++ b/pages/user/resourcesOrder/index.wxml @@ -0,0 +1,170 @@ + + + + 沟通中 + 进行中 + 已结束 + + + + + 暂无订单 + 去需求广场 + + + + + 项目编号 {{item.projectCode}} + {{tabActive == 1 ? '沟通中' : tabActive == 2 ? '进行中' : '已结束'}} + 平台介入中 + + + + + + {{item.resourceInfo.name || item.projectResource.name}} + 定金尾款 + {{item.resourceInfo.content}} + + + 项目名称: + {{item.projectName}} + + + 合作方: + {{item.partner}} + + + + + + + {{!item.open ? '展开' : '收起'}} + + + + + + + + {{c.name}} + + + {{c.content}} + + + 立项 + + + + + + + + {{progress.name}} ¥{{progress.money}} + + 未开始 + 申请开启 + 进行中 + 已结束 + + + + + {{item.examineTime}}项目开启 + 项目已圆满结束 + + 开启下阶段 + 平台介入 + 申请交付 + + + + + + diff --git a/pages/user/resourcesOrder/index.wxss b/pages/user/resourcesOrder/index.wxss new file mode 100644 index 0000000..e4c8065 --- /dev/null +++ b/pages/user/resourcesOrder/index.wxss @@ -0,0 +1,235 @@ +/* pages/user/resourcesOrder/index.wxss */ +.order-page{ + width: 100%; + min-height: 100vh; + background: #EEEEEE; +} +.tabs-box{ + width: 100%; + padding: 18rpx 72rpx; + background: #fff; +} +.tab{ + text-align: center; + font-size: 28rpx; + color: #707070; + position: relative; +} +.tab::after{ + display: block; + content: ''; + width: 100%; + height: 8rpx; + border-radius: 8rpx; + background: #FF6D31; + position: absolute; + bottom: -22rpx; + left: 50%; + opacity: 0; + transform: translateX(-50%) scaleX(0); + transition: all .2s cubic-bezier(.18,.89,.17,.88),opacity .15s ease; +} +.tab-a::after{ + opacity: 1; + left: 0; + transform: translateX(0%) scaleX(1); +} +.list{ + width: 100%; + padding: 32rpx 40rpx; +} +.no-order{ + text-align: center; + line-height: 50rpx; + font-size: 28rpx; + color: #666666; +} +.item{ + width: 100%; + padding: 20rpx 20rpx 32rpx; + background: #fff; + border-radius: 12rpx; + margin-bottom: 20rpx; +} +.number{ + margin-bottom: 24rpx; + color: #666666; + font-size: 28rpx; +} +.status{ + font-weight: 500; + font-size: 28rpx; + color: #FF5100; +} +.info-box image{ + width: 154rpx; + height: 154rpx; + border-radius: 8rpx; + margin-right: 12rpx; +} +.info{ + width: 450rpx; + font-size: 28rpx; +} +.i-title{ + font-weight: 500; + line-height: 40rpx; + color: #1D1D1D; +} +.i-desc{ + font-size: 24rpx; + font-weight: 400; + line-height: 34rpx; + color: #666666; +} +.projectinfo-box{ + font-size: 24rpx; + color: #1D1D1D; +} +.p-label{ + color: #666666; +} +.time{ + color: #A7A7A7; + font-size: 24rpx; +} +.colO{ + font-size: 28rpx; + margin: 24rpx 0 4rpx; + color: #FF5100; +} + +.tag-item{ + width: 114rpx; + height: 36rpx; + line-height: 34rpx; + text-align: center; + color: #FF5100; + border: 1rpx solid #FF5100; + background: #fff; + border-radius: 4rpx; + font-size: 24rpx; + margin: 12rpx 0; +} +.open-btn{ + color: #FF5100; + font-weight: 500; + font-size: 28rpx; + margin: 20rpx 0; +} +.arrow-down{ + width: 25rpx; + height: 14rpx; + margin-left: 12rpx; +} +.arrow-up{ + + transform: rotate(180deg); +} + +.concat-list{ + height: 0rpx; + padding-bottom: 0rpx; + margin-bottom: 0rpx; + overflow:hidden; + transition: height 200ms ease; +} +.list-open{ + height: 500rpx; + padding-bottom: 28rpx; + margin-bottom: 12rpx; + overflow-y: scroll; + transition: height 300ms ease; +} +.concat-item{ + width: 100%; + height: 154rpx; + border-top: 2px solid #EEEEEE; +} +.logo{ + width: 92rpx; + height: 92rpx; +} +.call{ + width: 54rpx; + height: 54rpx; +} +.name-box{ + width: 360rpx; + font-size: 28rpx; +} +.concat-status{ + font-size: 24rpx; + display: inline-block; + margin-left: 2rpx; + color: #FF5100; +} +.name{ + width: 100%; + font-weight: 500; + line-height: 40rpx; + color: #1D1D1D; +} +.company-name{ + width: 78%; +} +.desc{ + font-size: 20rpx; + color: #707070; + margin-top: 16rpx; +} +.create-btn{ + width: 92rpx; + height: 56rpx; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 12rpx; + text-align: center; + line-height: 56rpx; + color: #fff; + +} +.progress-box{ + margin-top: 32rpx; + padding-top: 32rpx; + border-top: 1px solid #EEEEEE; +} +.progress-item{ + width: 100%; + height: 54rpx; + background: #f8f8f8; + padding: 0rpx 20rpx; + font-size: 26rpx; + font-weight: 500; + margin-bottom: 16rpx; +} +.progress-item image{ + width: 24rpx; + height: 24rpx; + margin-right: 8rpx; +} +.colorO{ + color: #FF8350; +} + +.btn-box{ + margin-top: 20rpx; + color: #FF5100; +} +.btn-item{ + font-size: 28rpx; + width: 162rpx; + height: 56rpx; + line-height: 56rpx; + text-align: center; + background: linear-gradient(134deg, #FFA782 0%, #FF6D31 100%); + border-radius: 12rpx; + color: #fff; + margin-left: 16rpx; +} +.default{ + background: linear-gradient(134deg, #BFBFBF 0%, #BFBFBF 100%); +} +.btn-box .start-time{ + font-size: 22rpx; + color: #1D1D1D; +} \ No newline at end of file diff --git a/pages/webview/index.js b/pages/webview/index.js new file mode 100644 index 0000000..afc9fa9 --- /dev/null +++ b/pages/webview/index.js @@ -0,0 +1,68 @@ +// pages/webview/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + src: '' + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + src: `https://${options.src}` + }) + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/pages/webview/index.json b/pages/webview/index.json new file mode 100644 index 0000000..8835af0 --- /dev/null +++ b/pages/webview/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/webview/index.wxml b/pages/webview/index.wxml new file mode 100644 index 0000000..4102408 --- /dev/null +++ b/pages/webview/index.wxml @@ -0,0 +1,2 @@ + + diff --git a/pages/webview/index.wxss b/pages/webview/index.wxss new file mode 100644 index 0000000..5e3b696 --- /dev/null +++ b/pages/webview/index.wxss @@ -0,0 +1 @@ +/* pages/webview/index.wxss */ \ No newline at end of file diff --git a/project.config.json b/project.config.json index df036f9..ea400ec 100644 --- a/project.config.json +++ b/project.config.json @@ -30,7 +30,6 @@ "outputPath": "" }, "enableEngineNative": false, - "bundle": false, "useIsolateContext": true, "useCompilerModule": true, "userConfirmedUseCompilerModuleSwitch": false, @@ -40,7 +39,7 @@ "minifyWXSS": true }, "compileType": "miniprogram", - "libVersion": "2.17.0", + "libVersion": "2.19.1", "appid": "wx5348e39dcbbefe1e", "projectname": "zhaoshangMiniApp", "debugOptions": { diff --git a/project.private.config.json b/project.private.config.json index 1859cc4..ab36da8 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -53,6 +53,102 @@ "pathName": "pages/user/index", "query": "", "scene": null + }, + { + "name": "pages/demandHall/contact/index", + "pathName": "pages/demandHall/contact/index", + "query": "", + "scene": null + }, + { + "name": "pages/release/personAuth/index", + "pathName": "pages/release/personAuth/index", + "query": "", + "scene": null + }, + { + "name": "pages/release/companyAuth/index", + "pathName": "pages/release/companyAuth/index", + "query": "", + "scene": null + }, + { + "name": "pages/release/perfectCompanyInfo/index", + "pathName": "pages/release/perfectCompanyInfo/index", + "query": "", + "scene": null + }, + { + "name": "pages/release/perfectPersonInfo/index", + "pathName": "pages/release/perfectPersonInfo/index", + "query": "", + "scene": null + }, + { + "name": "pages/user/editNeeds/index", + "pathName": "pages/user/editNeeds/index", + "query": "", + "scene": null + }, + { + "name": "pages/demandHall/index", + "pathName": "pages/demandHall/index", + "query": "", + "scene": null + }, + { + "name": "pages/demandHall/resourcesDetail/index", + "pathName": "pages/demandHall/resourcesDetail/index", + "query": "id=1", + "scene": null + }, + { + "name": "pages/demandHall/needsDetail/index", + "pathName": "pages/demandHall/needsDetail/index", + "query": "id=2", + "scene": null + }, + { + "name": "pages/demandHall/needsDetail/index", + "pathName": "pages/demandHall/needsDetail/index", + "query": "id=9", + "scene": null + }, + { + "name": "pages/demandHall/createProject/index", + "pathName": "pages/demandHall/createProject/index", + "query": "item=%257B%2522resourcesDto%2522%253A%257B%2522id%2522%253A1%252C%2522resourceType%2522%253A1%252C%2522createUserId%2522%253A823%252C%2522title%2522%253A%2522%25E5%2590%2584%25E7%25A7%258D%25E7%25B1%25BB%25E5%259E%258B%25E7%25BD%2591%25E7%25AB%2599%25E3%2580%2581%25E5%25B0%258F%25E7%25A8%258B%25E5%25BA%258F%25E5%25BC%2580%25E5%258F%2591%2522%252C%2522resourceCagetoryId%2522%253A2%252C%2522capital%2522%253A%252230000%2522%252C%2522detailedDescription%2522%253A%2522%25E5%2590%2584%25E7%25A7%258D%25E7%25B1%25BB%25E5%259E%258B%25E7%25BD%2591%25E7%25AB%2599%25EF%25BC%258C%25E5%2590%2584%25E5%25B9%25B3%25E5%258F%25B0%25E5%25B0%258F%25E7%25A8%258B%25E5%25BA%258F%25E5%25BC%2580%25E5%258F%2591%25EF%25BC%258C%25E6%2595%2588%25E7%258E%2587%25E5%25BF%25AB%25EF%25BC%258C%25E5%258A%259F%25E8%2583%25BD%25E5%2585%25A8%25EF%25BC%258C%25E6%2580%25A7%25E4%25BB%25B7%25E6%25AF%2594%25E9%25AB%2598%2522%252C%2522createTime%2522%253A%25222021-08-31%252013%253A47%253A21%2522%252C%2522updateTime%2522%253Anull%252C%2522isDel%2522%253A0%252C%2522resourceStartTime%2522%253A%25222021-08-31%2522%252C%2522resourceEndTime%2522%253A%25222022-08-31%2522%252C%2522resourceAuditState%2522%253A2%252C%2522resourceState%2522%253A1%252C%2522resourceImgs%2522%253Anull%252C%2522enterpriseName%2522%253Anull%252C%2522enterpriseAddress%2522%253Anull%252C%2522enterprise%2522%253Anull%252C%2522questionsDtos%2522%253Anull%252C%2522user%2522%253Anull%257D%252C%2522communicateDtoList%2522%253A%255B%257B%2522id%2522%253A2%252C%2522type%2522%253Anull%252C%2522resourceId%2522%253A1%252C%2522demandId%2522%253A2%252C%2522content%2522%253Anull%252C%2522initiatorId%2522%253A823%252C%2522createTime%2522%253A%25222021-09-01%252015%253A44%253A33%2522%252C%2522updateTime%2522%253Anull%252C%2522isDel%2522%253A%25220%2522%257D%252C%257B%2522id%2522%253A7%252C%2522type%2522%253Anull%252C%2522resourceId%2522%253A1%252C%2522demandId%2522%253Anull%252C%2522content%2522%253A%2522%25E6%2588%2591%25E6%2583%25B3%25E5%25BC%2580%25E5%258F%2591%25E4%25B8%2580%25E6%25AC%25BE%25E5%25B0%258F%25E7%25A8%258B%25E5%25BA%258F%25EF%25BC%258C%2520%25E5%25B8%258C%25E6%259C%259B%25E8%2583%25BD%25E5%25A4%259F%25E5%25B0%25BD%25E5%25BF%25AB%25E4%25B8%258E%25E6%2582%25A8%25E6%25B2%259F%25E9%2580%259A%2522%252C%2522initiatorId%2522%253A823%252C%2522createTime%2522%253A%25222021-09-02%252010%253A13%253A57%2522%252C%2522updateTime%2522%253Anull%252C%2522isDel%2522%253A%25220%2522%257D%255D%252C%2522open%2522%253Atrue%257D", + "scene": null + }, + { + "name": "pages/demandHall/createProject/index", + "pathName": "pages/demandHall/createProject/index", + "query": "id=7", + "scene": null + }, + { + "name": "pages/user/needsOrder/index", + "pathName": "pages/user/needsOrder/index", + "query": "", + "scene": null + }, + { + "name": "pages/demandHall/applyDetail/index", + "pathName": "pages/demandHall/applyDetail/index", + "query": "data=%257B%2522resourceInfo%2522%253A%257B%2522resourceId%2522%253A12%252C%2522name%2522%253Anull%252C%2522content%2522%253A%2522%25E8%258C%2583%25E5%25BE%25B7%25E8%2590%25A8%25E8%258C%2583%25E5%25BE%25B7%25E8%2590%25A8%25E5%258F%2591%25E7%2594%259F%25E8%258C%2583%25E5%25BE%25B7%25E8%2590%25A8%25E8%258C%2583%25E5%25BE%25B7%25E8%2590%25A8%2522%252C%2522logo%2522%253Anull%252C%2522budget%2522%253Anull%257D%252C%2522partnerInfos%2522%253A%255B%257B%2522communicateId%2522%253A12%252C%2522comminuteState%2522%253A1%252C%2522createTime%2522%253A%25222021-09-07%2522%252C%2522name%2522%253A%2522%25E6%25A5%259A%25E8%25B1%25A1%25E7%25A7%2591%25E6%258A%2580%25E6%259C%2589%25E9%2599%2590%25E5%2585%25AC%25E5%258F%25B8%2522%252C%2522title%2522%253A%2522%25E6%259B%25B4%25E5%25BF%25AB%25EF%25BC%258C%25E6%259B%25B4%25E9%25AB%2598%25EF%25BC%258C%25E6%259B%25B4%25E5%25BC%25BA%2522%252C%2522logo%2522%253A%2522https%253A%252F%252Fqiniu.upload.gznl.top%252Fbc961e15-5030-4580-a273-1cdafe883520.png%2522%252C%2522phone%2522%253A%252207220324234%2522%257D%255D%252C%2522open%2522%253Atrue%257D", + "scene": null + }, + { + "name": "pages/index/index", + "pathName": "pages/index/index", + "query": "", + "scene": null + }, + { + "name": "pages/index/index", + "pathName": "pages/index/index", + "query": "", + "scene": null } ] } diff --git a/tabbarComponent/icon/组 1051@2x.png b/tabbarComponent/icon/home.png similarity index 100% rename from tabbarComponent/icon/组 1051@2x.png rename to tabbarComponent/icon/home.png diff --git a/tabbarComponent/icon/icon_release.png b/tabbarComponent/icon/icon_release.png index 198d950..52209e2 100644 Binary files a/tabbarComponent/icon/icon_release.png and b/tabbarComponent/icon/icon_release.png differ diff --git a/tabbarComponent/icon/icon_release2.png b/tabbarComponent/icon/icon_release2.png new file mode 100644 index 0000000..198d950 Binary files /dev/null and b/tabbarComponent/icon/icon_release2.png differ diff --git a/tabbarComponent/icon/组 1048@2x.png b/tabbarComponent/icon/tab2-a.png similarity index 100% rename from tabbarComponent/icon/组 1048@2x.png rename to tabbarComponent/icon/tab2-a.png diff --git a/images/home/组 227@2x.png b/tabbarComponent/icon/tab2.png old mode 100755 new mode 100644 similarity index 100% rename from images/home/组 227@2x.png rename to tabbarComponent/icon/tab2.png diff --git a/tabbarComponent/icon/组 1049@2x.png b/tabbarComponent/icon/tab3-a.png similarity index 100% rename from tabbarComponent/icon/组 1049@2x.png rename to tabbarComponent/icon/tab3-a.png diff --git a/images/home/组 226@2x.png b/tabbarComponent/icon/tab3.png old mode 100755 new mode 100644 similarity index 100% rename from images/home/组 226@2x.png rename to tabbarComponent/icon/tab3.png diff --git a/tabbarComponent/icon/组 1050@2x.png b/tabbarComponent/icon/tab4-a.png similarity index 100% rename from tabbarComponent/icon/组 1050@2x.png rename to tabbarComponent/icon/tab4-a.png diff --git a/images/home/组 229@2x.png b/tabbarComponent/icon/tab4.png old mode 100755 new mode 100644 similarity index 100% rename from images/home/组 229@2x.png rename to tabbarComponent/icon/tab4.png diff --git a/tabbarComponent/icon/组 226@2x.png b/tabbarComponent/icon/组 226@2x.png deleted file mode 100755 index fbebe0a..0000000 Binary files a/tabbarComponent/icon/组 226@2x.png and /dev/null differ diff --git a/tabbarComponent/icon/组 227@2x.png b/tabbarComponent/icon/组 227@2x.png deleted file mode 100755 index 6209035..0000000 Binary files a/tabbarComponent/icon/组 227@2x.png and /dev/null differ diff --git a/tabbarComponent/icon/组 229@2x.png b/tabbarComponent/icon/组 229@2x.png deleted file mode 100755 index d2c003e..0000000 Binary files a/tabbarComponent/icon/组 229@2x.png and /dev/null differ diff --git a/tabbarComponent/icon/组 668@2x.png b/tabbarComponent/icon/组 668@2x.png deleted file mode 100755 index 52209e2..0000000 Binary files a/tabbarComponent/icon/组 668@2x.png and /dev/null differ diff --git a/tabbarComponent/tabbar.js b/tabbarComponent/tabbar.js index acabe49..1f9dc21 100644 --- a/tabbarComponent/tabbar.js +++ b/tabbarComponent/tabbar.js @@ -14,14 +14,14 @@ Component({ "list": [ { "pagePath": "/pages/index/index", - "iconPath": "icon/icon_home.png", - "selectedIconPath": "icon/icon_home_HL.png", + "iconPath": "icon/home.png", + "selectedIconPath": "icon/home-a.png", "text": "首页" }, { "pagePath": "/pages/demandHall/index", - "iconPath": "icon/icon_home.png", - "selectedIconPath": "icon/icon_home_HL.png", + "iconPath": "icon/tab2.png", + "selectedIconPath": "icon/tab2-a.png", "text": "供需大厅" }, { @@ -32,14 +32,14 @@ Component({ }, { "pagePath": "/pages/life/index", - "iconPath": "icon/icon_mine.png", - "selectedIconPath": "icon/icon_mine_HL.png", - "text": "购物车" + "iconPath": "icon/tab3.png", + "selectedIconPath": "icon/tab3-a.png", + "text": "生活" }, { "pagePath": "/pages/user/index", - "iconPath": "icon/icon_mine.png", - "selectedIconPath": "icon/icon_mine_HL.png", + "iconPath": "icon/tab4.png", + "selectedIconPath": "icon/tab4-a.png", "text": "我的" } ] diff --git a/tabbarComponent/tabbar.wxss b/tabbarComponent/tabbar.wxss index ba9c04b..5bd1b86 100644 --- a/tabbarComponent/tabbar.wxss +++ b/tabbarComponent/tabbar.wxss @@ -12,6 +12,7 @@ } .tabbar_box.iphoneX-height{ padding-bottom: 66rpx; + height: 170rpx; } .middle-wrapper{ position: absolute; diff --git a/utils/WxValidate.js b/utils/WxValidate.js new file mode 100644 index 0000000..63b5b96 --- /dev/null +++ b/utils/WxValidate.js @@ -0,0 +1,418 @@ +/** + * 表单验证 + * + * @param {Object} rules 验证字段的规则 + * @param {Object} messages 验证字段的提示信息 + * + */ +class WxValidate { + constructor(rules = {}, messages = {}) { + Object.assign(this, { + data: {}, + rules, + messages, + }) + this.__init() + } + + /** + * __init + */ + __init() { + this.__initMethods() + this.__initDefaults() + this.__initData() + } + + /** + * 初始化数据 + */ + __initData() { + this.form = {} + this.errorList = [] + } + + /** + * 初始化默认提示信息 + */ + __initDefaults() { + this.defaults = { + messages: { + required: '这是必填字段。', + email: '请输入有效的电子邮件地址。', + tel: '请输入11位的手机号码。', + url: '请输入有效的网址。', + date: '请输入有效的日期。', + dateISO: '请输入有效的日期(ISO),例如:2009-06-23,1998/01/22。', + number: '请输入有效的数字。', + digits: '只能输入数字。', + idcard: '请输入18位的有效身份证。', + equalTo: this.formatTpl('输入值必须和 {0} 相同。'), + contains: this.formatTpl('输入值必须包含 {0}。'), + minlength: this.formatTpl('最少要输入 {0} 个字符。'), + maxlength: this.formatTpl('最多可以输入 {0} 个字符。'), + rangelength: this.formatTpl('请输入长度在 {0} 到 {1} 之间的字符。'), + min: this.formatTpl('请输入不小于 {0} 的数值。'), + max: this.formatTpl('请输入不大于 {0} 的数值。'), + range: this.formatTpl('请输入范围在 {0} 到 {1} 之间的数值。'), + } + } + } + + /** + * 初始化默认验证方法 + */ + __initMethods() { + const that = this + that.methods = { + /** + * 验证必填元素 + */ + required(value, param) { + if (!that.depend(param)) { + return 'dependency-mismatch' + } else if (typeof value === 'number') { + value = value.toString() + } else if (typeof value === 'boolean') { + return !0 + } + + return value.length > 0 + }, + /** + * 验证电子邮箱格式 + */ + email(value) { + return that.optional(value) || /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(value) + }, + /** + * 验证手机格式 + */ + tel(value) { + return that.optional(value) || /^1[34578]\d{9}$/.test(value) + }, + /** + * 验证URL格式 + */ + url(value) { + return that.optional(value) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(value) + }, + /** + * 验证日期格式 + */ + date(value) { + return that.optional(value) || !/Invalid|NaN/.test(new Date(value).toString()) + }, + /** + * 验证ISO类型的日期格式 + */ + dateISO(value) { + return that.optional(value) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(value) + }, + /** + * 验证十进制数字 + */ + number(value) { + return that.optional(value) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(value) + }, + /** + * 验证整数 + */ + digits(value) { + return that.optional(value) || /^\d+$/.test(value) + }, + /** + * 验证身份证号码 + */ + idcard(value) { + return that.optional(value) || /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X)$/.test(value) + }, + /** + * 验证两个输入框的内容是否相同 + */ + equalTo(value, param) { + return that.optional(value) || value === that.data[param] + }, + /** + * 验证是否包含某个值 + */ + contains(value, param) { + return that.optional(value) || value.indexOf(param) >= 0 + }, + /** + * 验证最小长度 + */ + minlength(value, param) { + return that.optional(value) || value.length >= param + }, + /** + * 验证最大长度 + */ + maxlength(value, param) { + return that.optional(value) || value.length <= param + }, + /** + * 验证一个长度范围[min, max] + */ + rangelength(value, param) { + return that.optional(value) || (value.length >= param[0] && value.length <= param[1]) + }, + /** + * 验证最小值 + */ + min(value, param) { + return that.optional(value) || value >= param + }, + /** + * 验证最大值 + */ + max(value, param) { + return that.optional(value) || value <= param + }, + /** + * 验证一个值范围[min, max] + */ + range(value, param) { + return that.optional(value) || (value >= param[0] && value <= param[1]) + }, + } + } + + /** + * 添加自定义验证方法 + * @param {String} name 方法名 + * @param {Function} method 函数体,接收两个参数(value, param),value表示元素的值,param表示参数 + * @param {String} message 提示信息 + */ + addMethod(name, method, message) { + this.methods[name] = method + this.defaults.messages[name] = message !== undefined ? message : this.defaults.messages[name] + } + + /** + * 判断验证方法是否存在 + */ + isValidMethod(value) { + let methods = [] + for (let method in this.methods) { + if (method && typeof this.methods[method] === 'function') { + methods.push(method) + } + } + return methods.indexOf(value) !== -1 + } + + /** + * 格式化提示信息模板 + */ + formatTpl(source, params) { + const that = this + if (arguments.length === 1) { + return function() { + let args = Array.from(arguments) + args.unshift(source) + return that.formatTpl.apply(this, args) + } + } + if (params === undefined) { + return source + } + if (arguments.length > 2 && params.constructor !== Array) { + params = Array.from(arguments).slice(1) + } + if (params.constructor !== Array) { + params = [params] + } + params.forEach(function(n, i) { + source = source.replace(new RegExp("\\{" + i + "\\}", "g"), function() { + return n + }) + }) + return source + } + + /** + * 判断规则依赖是否存在 + */ + depend(param) { + switch (typeof param) { + case 'boolean': + param = param + break + case 'string': + param = !!param.length + break + case 'function': + param = param() + default: + param = !0 + } + return param + } + + /** + * 判断输入值是否为空 + */ + optional(value) { + return !this.methods.required(value) && 'dependency-mismatch' + } + + /** + * 获取自定义字段的提示信息 + * @param {String} param 字段名 + * @param {Object} rule 规则 + */ + customMessage(param, rule) { + const params = this.messages[param] + const isObject = typeof params === 'object' + if (params && isObject) return params[rule.method] + } + + /** + * 获取某个指定字段的提示信息 + * @param {String} param 字段名 + * @param {Object} rule 规则 + */ + defaultMessage(param, rule) { + let message = this.customMessage(param, rule) || this.defaults.messages[rule.method] + let type = typeof message + + if (type === 'undefined') { + message = `Warning: No message defined for ${rule.method}.` + } else if (type === 'function') { + message = message.call(this, rule.parameters) + } + + return message + } + + /** + * 缓存错误信息 + * @param {String} param 字段名 + * @param {Object} rule 规则 + * @param {String} value 元素的值 + */ + formatTplAndAdd(param, rule, value) { + let msg = this.defaultMessage(param, rule) + + this.errorList.push({ + param: param, + msg: msg, + value: value, + }) + } + + /** + * 验证某个指定字段的规则 + * @param {String} param 字段名 + * @param {Object} rules 规则 + * @param {Object} data 需要验证的数据对象 + */ + checkParam(param, rules, data) { + + // 缓存数据对象 + this.data = data + + // 缓存字段对应的值 + const value = data[param] !== null && data[param] !== undefined ? data[param] : '' + + // 遍历某个指定字段的所有规则,依次验证规则,否则缓存错误信息 + for (let method in rules) { + + // 判断验证方法是否存在 + if (this.isValidMethod(method)) { + + // 缓存规则的属性及值 + const rule = { + method: method, + parameters: rules[method] + } + + // 调用验证方法 + const result = this.methods[method](value, rule.parameters) + + // 若result返回值为dependency-mismatch,则说明该字段的值为空或非必填字段 + if (result === 'dependency-mismatch') { + continue + } + + this.setValue(param, method, result, value) + + // 判断是否通过验证,否则缓存错误信息,跳出循环 + if (!result) { + this.formatTplAndAdd(param, rule, value) + break + } + } + } + } + + /** + * 设置字段的默认验证值 + * @param {String} param 字段名 + */ + setView(param) { + this.form[param] = { + $name: param, + $valid: true, + $invalid: false, + $error: {}, + $success: {}, + $viewValue: ``, + } + } + + /** + * 设置字段的验证值 + * @param {String} param 字段名 + * @param {String} method 字段的方法 + * @param {Boolean} result 是否通过验证 + * @param {String} value 字段的值 + */ + setValue(param, method, result, value) { + const params = this.form[param] + params.$valid = result + params.$invalid = !result + params.$error[method] = !result + params.$success[method] = result + params.$viewValue = value + } + + /** + * 验证所有字段的规则,返回验证是否通过 + * @param {Object} data 需要验证数据对象 + */ + checkForm(data) { + this.__initData() + + for (let param in this.rules) { + this.setView(param) + this.checkParam(param, this.rules[param], data) + } + + return this.valid() + } + + /** + * 返回验证是否通过 + */ + valid() { + return this.size() === 0 + } + + /** + * 返回错误信息的个数 + */ + size() { + return this.errorList.length + } + + /** + * 返回所有错误信息 + */ + validationErrors() { + return this.errorList + } +} + +export default WxValidate \ No newline at end of file diff --git a/utils/checkLogin.js b/utils/checkLogin.js new file mode 100644 index 0000000..496ab47 --- /dev/null +++ b/utils/checkLogin.js @@ -0,0 +1,11 @@ +function isLogin(){ + if(wx.getStorageSync('token')){ + return true + } else{ + return false + } +} + +module.exports = { + isLogin +} \ No newline at end of file diff --git a/utils/qqmap-wx-jssdk.min.js b/utils/qqmap-wx-jssdk.min.js new file mode 100644 index 0000000..8fa1477 --- /dev/null +++ b/utils/qqmap-wx-jssdk.min.js @@ -0,0 +1 @@ +var ERROR_CONF = { KEY_ERR: 311, KEY_ERR_MSG: 'key格式错误', PARAM_ERR: 310, PARAM_ERR_MSG: '请求参数信息有误', SYSTEM_ERR: 600, SYSTEM_ERR_MSG: '系统错误', WX_ERR_CODE: 1000, WX_OK_CODE: 200 }; var BASE_URL = 'https://apis.map.qq.com/ws/'; var URL_SEARCH = BASE_URL + 'place/v1/search'; var URL_SUGGESTION = BASE_URL + 'place/v1/suggestion'; var URL_GET_GEOCODER = BASE_URL + 'geocoder/v1/'; var URL_CITY_LIST = BASE_URL + 'district/v1/list'; var URL_AREA_LIST = BASE_URL + 'district/v1/getchildren'; var URL_DISTANCE = BASE_URL + 'distance/v1/'; var URL_DIRECTION = BASE_URL + 'direction/v1/'; var MODE = { driving: 'driving', transit: 'transit' }; var EARTH_RADIUS = 6378136.49; var Utils = { safeAdd(x, y) { var lsw = (x & 0xffff) + (y & 0xffff); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xffff) }, bitRotateLeft(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)) }, md5cmn(q, a, b, x, s, t) { return this.safeAdd(this.bitRotateLeft(this.safeAdd(this.safeAdd(a, q), this.safeAdd(x, t)), s), b) }, md5ff(a, b, c, d, x, s, t) { return this.md5cmn((b & c) | (~b & d), a, b, x, s, t) }, md5gg(a, b, c, d, x, s, t) { return this.md5cmn((b & d) | (c & ~d), a, b, x, s, t) }, md5hh(a, b, c, d, x, s, t) { return this.md5cmn(b ^ c ^ d, a, b, x, s, t) }, md5ii(a, b, c, d, x, s, t) { return this.md5cmn(c ^ (b | ~d), a, b, x, s, t) }, binlMD5(x, len) { x[len >> 5] |= 0x80 << (len % 32); x[((len + 64) >>> 9 << 4) + 14] = len; var i; var olda; var oldb; var oldc; var oldd; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for (i = 0; i < x.length; i += 16) { olda = a; oldb = b; oldc = c; oldd = d; a = this.md5ff(a, b, c, d, x[i], 7, -680876936); d = this.md5ff(d, a, b, c, x[i + 1], 12, -389564586); c = this.md5ff(c, d, a, b, x[i + 2], 17, 606105819); b = this.md5ff(b, c, d, a, x[i + 3], 22, -1044525330); a = this.md5ff(a, b, c, d, x[i + 4], 7, -176418897); d = this.md5ff(d, a, b, c, x[i + 5], 12, 1200080426); c = this.md5ff(c, d, a, b, x[i + 6], 17, -1473231341); b = this.md5ff(b, c, d, a, x[i + 7], 22, -45705983); a = this.md5ff(a, b, c, d, x[i + 8], 7, 1770035416); d = this.md5ff(d, a, b, c, x[i + 9], 12, -1958414417); c = this.md5ff(c, d, a, b, x[i + 10], 17, -42063); b = this.md5ff(b, c, d, a, x[i + 11], 22, -1990404162); a = this.md5ff(a, b, c, d, x[i + 12], 7, 1804603682); d = this.md5ff(d, a, b, c, x[i + 13], 12, -40341101); c = this.md5ff(c, d, a, b, x[i + 14], 17, -1502002290); b = this.md5ff(b, c, d, a, x[i + 15], 22, 1236535329); a = this.md5gg(a, b, c, d, x[i + 1], 5, -165796510); d = this.md5gg(d, a, b, c, x[i + 6], 9, -1069501632); c = this.md5gg(c, d, a, b, x[i + 11], 14, 643717713); b = this.md5gg(b, c, d, a, x[i], 20, -373897302); a = this.md5gg(a, b, c, d, x[i + 5], 5, -701558691); d = this.md5gg(d, a, b, c, x[i + 10], 9, 38016083); c = this.md5gg(c, d, a, b, x[i + 15], 14, -660478335); b = this.md5gg(b, c, d, a, x[i + 4], 20, -405537848); a = this.md5gg(a, b, c, d, x[i + 9], 5, 568446438); d = this.md5gg(d, a, b, c, x[i + 14], 9, -1019803690); c = this.md5gg(c, d, a, b, x[i + 3], 14, -187363961); b = this.md5gg(b, c, d, a, x[i + 8], 20, 1163531501); a = this.md5gg(a, b, c, d, x[i + 13], 5, -1444681467); d = this.md5gg(d, a, b, c, x[i + 2], 9, -51403784); c = this.md5gg(c, d, a, b, x[i + 7], 14, 1735328473); b = this.md5gg(b, c, d, a, x[i + 12], 20, -1926607734); a = this.md5hh(a, b, c, d, x[i + 5], 4, -378558); d = this.md5hh(d, a, b, c, x[i + 8], 11, -2022574463); c = this.md5hh(c, d, a, b, x[i + 11], 16, 1839030562); b = this.md5hh(b, c, d, a, x[i + 14], 23, -35309556); a = this.md5hh(a, b, c, d, x[i + 1], 4, -1530992060); d = this.md5hh(d, a, b, c, x[i + 4], 11, 1272893353); c = this.md5hh(c, d, a, b, x[i + 7], 16, -155497632); b = this.md5hh(b, c, d, a, x[i + 10], 23, -1094730640); a = this.md5hh(a, b, c, d, x[i + 13], 4, 681279174); d = this.md5hh(d, a, b, c, x[i], 11, -358537222); c = this.md5hh(c, d, a, b, x[i + 3], 16, -722521979); b = this.md5hh(b, c, d, a, x[i + 6], 23, 76029189); a = this.md5hh(a, b, c, d, x[i + 9], 4, -640364487); d = this.md5hh(d, a, b, c, x[i + 12], 11, -421815835); c = this.md5hh(c, d, a, b, x[i + 15], 16, 530742520); b = this.md5hh(b, c, d, a, x[i + 2], 23, -995338651); a = this.md5ii(a, b, c, d, x[i], 6, -198630844); d = this.md5ii(d, a, b, c, x[i + 7], 10, 1126891415); c = this.md5ii(c, d, a, b, x[i + 14], 15, -1416354905); b = this.md5ii(b, c, d, a, x[i + 5], 21, -57434055); a = this.md5ii(a, b, c, d, x[i + 12], 6, 1700485571); d = this.md5ii(d, a, b, c, x[i + 3], 10, -1894986606); c = this.md5ii(c, d, a, b, x[i + 10], 15, -1051523); b = this.md5ii(b, c, d, a, x[i + 1], 21, -2054922799); a = this.md5ii(a, b, c, d, x[i + 8], 6, 1873313359); d = this.md5ii(d, a, b, c, x[i + 15], 10, -30611744); c = this.md5ii(c, d, a, b, x[i + 6], 15, -1560198380); b = this.md5ii(b, c, d, a, x[i + 13], 21, 1309151649); a = this.md5ii(a, b, c, d, x[i + 4], 6, -145523070); d = this.md5ii(d, a, b, c, x[i + 11], 10, -1120210379); c = this.md5ii(c, d, a, b, x[i + 2], 15, 718787259); b = this.md5ii(b, c, d, a, x[i + 9], 21, -343485551); a = this.safeAdd(a, olda); b = this.safeAdd(b, oldb); c = this.safeAdd(c, oldc); d = this.safeAdd(d, oldd) } return [a, b, c, d] }, binl2rstr(input) { var i; var output = ''; var length32 = input.length * 32; for (i = 0; i < length32; i += 8) { output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 0xff) } return output }, rstr2binl(input) { var i; var output = []; output[(input.length >> 2) - 1] = undefined; for (i = 0; i < output.length; i += 1) { output[i] = 0 } var length8 = input.length * 8; for (i = 0; i < length8; i += 8) { output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << (i % 32) } return output }, rstrMD5(s) { return this.binl2rstr(this.binlMD5(this.rstr2binl(s), s.length * 8)) }, rstrHMACMD5(key, data) { var i; var bkey = this.rstr2binl(key); var ipad = []; var opad = []; var hash; ipad[15] = opad[15] = undefined; if (bkey.length > 16) { bkey = this.binlMD5(bkey, key.length * 8) } for (i = 0; i < 16; i += 1) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5c5c5c5c } hash = this.binlMD5(ipad.concat(this.rstr2binl(data)), 512 + data.length * 8); return this.binl2rstr(this.binlMD5(opad.concat(hash), 512 + 128)) }, rstr2hex(input) { var hexTab = '0123456789abcdef'; var output = ''; var x; var i; for (i = 0; i < input.length; i += 1) { x = input.charCodeAt(i); output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f) } return output }, str2rstrUTF8(input) { return unescape(encodeURIComponent(input)) }, rawMD5(s) { return this.rstrMD5(this.str2rstrUTF8(s)) }, hexMD5(s) { return this.rstr2hex(this.rawMD5(s)) }, rawHMACMD5(k, d) { return this.rstrHMACMD5(this.str2rstrUTF8(k), str2rstrUTF8(d)) }, hexHMACMD5(k, d) { return this.rstr2hex(this.rawHMACMD5(k, d)) }, md5(string, key, raw) { if (!key) { if (!raw) { return this.hexMD5(string) } return this.rawMD5(string) } if (!raw) { return this.hexHMACMD5(key, string) } return this.rawHMACMD5(key, string) }, getSig(requestParam, sk, feature, mode) { var sig = null; var requestArr = []; Object.keys(requestParam).sort().forEach(function (key) { requestArr.push(key + '=' + requestParam[key]) }); if (feature == 'search') { sig = '/ws/place/v1/search?' + requestArr.join('&') + sk } if (feature == 'suggest') { sig = '/ws/place/v1/suggestion?' + requestArr.join('&') + sk } if (feature == 'reverseGeocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'geocoder') { sig = '/ws/geocoder/v1/?' + requestArr.join('&') + sk } if (feature == 'getCityList') { sig = '/ws/district/v1/list?' + requestArr.join('&') + sk } if (feature == 'getDistrictByCityId') { sig = '/ws/district/v1/getchildren?' + requestArr.join('&') + sk } if (feature == 'calculateDistance') { sig = '/ws/distance/v1/?' + requestArr.join('&') + sk } if (feature == 'direction') { sig = '/ws/direction/v1/' + mode + '?' + requestArr.join('&') + sk } sig = this.md5(sig); return sig }, location2query(data) { if (typeof data == 'string') { return data } var query = ''; for (var i = 0; i < data.length; i++) { var d = data[i]; if (!!query) { query += ';' } if (d.location) { query = query + d.location.lat + ',' + d.location.lng } if (d.latitude && d.longitude) { query = query + d.latitude + ',' + d.longitude } } return query }, rad(d) { return d * Math.PI / 180.0 }, getEndLocation(location) { var to = location.split(';'); var endLocation = []; for (var i = 0; i < to.length; i++) { endLocation.push({ lat: parseFloat(to[i].split(',')[0]), lng: parseFloat(to[i].split(',')[1]) }) } return endLocation }, getDistance(latFrom, lngFrom, latTo, lngTo) { var radLatFrom = this.rad(latFrom); var radLatTo = this.rad(latTo); var a = radLatFrom - radLatTo; var b = this.rad(lngFrom) - this.rad(lngTo); var distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLatFrom) * Math.cos(radLatTo) * Math.pow(Math.sin(b / 2), 2))); distance = distance * EARTH_RADIUS; distance = Math.round(distance * 10000) / 10000; return parseFloat(distance.toFixed(0)) }, getWXLocation(success, fail, complete) { wx.getLocation({ type: 'gcj02', success: success, fail: fail, complete: complete }) }, getLocationParam(location) { if (typeof location == 'string') { var locationArr = location.split(','); if (locationArr.length === 2) { location = { latitude: location.split(',')[0], longitude: location.split(',')[1] } } else { location = {} } } return location }, polyfillParam(param) { param.success = param.success || function () { }; param.fail = param.fail || function () { }; param.complete = param.complete || function () { } }, checkParamKeyEmpty(param, key) { if (!param[key]) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + key + '参数格式有误'); param.fail(errconf); param.complete(errconf); return true } return false }, checkKeyword(param) { return !this.checkParamKeyEmpty(param, 'keyword') }, checkLocation(param) { var location = this.getLocationParam(param.location); if (!location || !location.latitude || !location.longitude) { var errconf = this.buildErrorConfig(ERROR_CONF.PARAM_ERR, ERROR_CONF.PARAM_ERR_MSG + ' location参数格式有误'); param.fail(errconf); param.complete(errconf); return false } return true }, buildErrorConfig(errCode, errMsg) { return { status: errCode, message: errMsg } }, handleData(param, data, feature) { if (feature == 'search') { var searchResult = data.data; var searchSimplify = []; for (var i = 0; i < searchResult.length; i++) { searchSimplify.push({ id: searchResult[i].id || null, title: searchResult[i].title || null, latitude: searchResult[i].location && searchResult[i].location.lat || null, longitude: searchResult[i].location && searchResult[i].location.lng || null, address: searchResult[i].address || null, category: searchResult[i].category || null, tel: searchResult[i].tel || null, adcode: searchResult[i].ad_info && searchResult[i].ad_info.adcode || null, city: searchResult[i].ad_info && searchResult[i].ad_info.city || null, district: searchResult[i].ad_info && searchResult[i].ad_info.district || null, province: searchResult[i].ad_info && searchResult[i].ad_info.province || null }) } param.success(data, { searchResult: searchResult, searchSimplify: searchSimplify }) } else if (feature == 'suggest') { var suggestResult = data.data; var suggestSimplify = []; for (var i = 0; i < suggestResult.length; i++) { suggestSimplify.push({ adcode: suggestResult[i].adcode || null, address: suggestResult[i].address || null, category: suggestResult[i].category || null, city: suggestResult[i].city || null, district: suggestResult[i].district || null, id: suggestResult[i].id || null, latitude: suggestResult[i].location && suggestResult[i].location.lat || null, longitude: suggestResult[i].location && suggestResult[i].location.lng || null, province: suggestResult[i].province || null, title: suggestResult[i].title || null, type: suggestResult[i].type || null }) } param.success(data, { suggestResult: suggestResult, suggestSimplify: suggestSimplify }) } else if (feature == 'reverseGeocoder') { var reverseGeocoderResult = data.result; var reverseGeocoderSimplify = { address: reverseGeocoderResult.address || null, latitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lat || null, longitude: reverseGeocoderResult.location && reverseGeocoderResult.location.lng || null, adcode: reverseGeocoderResult.ad_info && reverseGeocoderResult.ad_info.adcode || null, city: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.city || null, district: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.district || null, nation: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.nation || null, province: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.province || null, street: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street || null, street_number: reverseGeocoderResult.address_component && reverseGeocoderResult.address_component.street_number || null, recommend: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.recommend || null, rough: reverseGeocoderResult.formatted_addresses && reverseGeocoderResult.formatted_addresses.rough || null }; if (reverseGeocoderResult.pois) { var pois = reverseGeocoderResult.pois; var poisSimplify = []; for (var i = 0; i < pois.length; i++) { poisSimplify.push({ id: pois[i].id || null, title: pois[i].title || null, latitude: pois[i].location && pois[i].location.lat || null, longitude: pois[i].location && pois[i].location.lng || null, address: pois[i].address || null, category: pois[i].category || null, adcode: pois[i].ad_info && pois[i].ad_info.adcode || null, city: pois[i].ad_info && pois[i].ad_info.city || null, district: pois[i].ad_info && pois[i].ad_info.district || null, province: pois[i].ad_info && pois[i].ad_info.province || null }) } param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify, pois: pois, poisSimplify: poisSimplify }) } else { param.success(data, { reverseGeocoderResult: reverseGeocoderResult, reverseGeocoderSimplify: reverseGeocoderSimplify }) } } else if (feature == 'geocoder') { var geocoderResult = data.result; var geocoderSimplify = { title: geocoderResult.title || null, latitude: geocoderResult.location && geocoderResult.location.lat || null, longitude: geocoderResult.location && geocoderResult.location.lng || null, adcode: geocoderResult.ad_info && geocoderResult.ad_info.adcode || null, province: geocoderResult.address_components && geocoderResult.address_components.province || null, city: geocoderResult.address_components && geocoderResult.address_components.city || null, district: geocoderResult.address_components && geocoderResult.address_components.district || null, street: geocoderResult.address_components && geocoderResult.address_components.street || null, street_number: geocoderResult.address_components && geocoderResult.address_components.street_number || null, level: geocoderResult.level || null }; param.success(data, { geocoderResult: geocoderResult, geocoderSimplify: geocoderSimplify }) } else if (feature == 'getCityList') { var provinceResult = data.result[0]; var cityResult = data.result[1]; var districtResult = data.result[2]; param.success(data, { provinceResult: provinceResult, cityResult: cityResult, districtResult: districtResult }) } else if (feature == 'getDistrictByCityId') { var districtByCity = data.result[0]; param.success(data, districtByCity) } else if (feature == 'calculateDistance') { var calculateDistanceResult = data.result.elements; var distance = []; for (var i = 0; i < calculateDistanceResult.length; i++) { distance.push(calculateDistanceResult[i].distance) } param.success(data, { calculateDistanceResult: calculateDistanceResult, distance: distance }) } else if (feature == 'direction') { var direction = data.result.routes; param.success(data, direction) } else { param.success(data) } }, buildWxRequestConfig(param, options, feature) { var that = this; options.header = { "content-type": "application/json" }; options.method = 'GET'; options.success = function (res) { var data = res.data; if (data.status === 0) { that.handleData(param, data, feature) } else { param.fail(data) } }; options.fail = function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; options.complete = function (res) { var statusCode = +res.statusCode; switch (statusCode) { case ERROR_CONF.WX_ERR_CODE: { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)); break } case ERROR_CONF.WX_OK_CODE: { var data = res.data; if (data.status === 0) { param.complete(data) } else { param.complete(that.buildErrorConfig(data.status, data.message)) } break } default: { param.complete(that.buildErrorConfig(ERROR_CONF.SYSTEM_ERR, ERROR_CONF.SYSTEM_ERR_MSG)) } } }; return options }, locationProcess(param, locationsuccess, locationfail, locationcomplete) { var that = this; locationfail = locationfail || function (res) { res.statusCode = ERROR_CONF.WX_ERR_CODE; param.fail(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) }; locationcomplete = locationcomplete || function (res) { if (res.statusCode == ERROR_CONF.WX_ERR_CODE) { param.complete(that.buildErrorConfig(ERROR_CONF.WX_ERR_CODE, res.errMsg)) } }; if (!param.location) { that.getWXLocation(locationsuccess, locationfail, locationcomplete) } else if (that.checkLocation(param)) { var location = Utils.getLocationParam(param.location); locationsuccess(location) } } }; class QQMapWX { constructor(options) { if (!options.key) { throw Error('key值不能为空') } this.key = options.key }; search(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, orderby: options.orderby || '_distance', page_size: options.page_size || 10, page_index: options.page_index || 1, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } var distance = options.distance || "1000"; var auto_extend = options.auto_extend || 1; var region = null; var rectangle = null; if (options.region) { region = options.region } if (options.rectangle) { rectangle = options.rectangle } var locationsuccess = function (result) { if (region && !rectangle) { requestParam.boundary = "region(" + region + "," + auto_extend + "," + result.latitude + "," + result.longitude + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else if (rectangle && !region) { requestParam.boundary = "rectangle(" + rectangle + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } else { requestParam.boundary = "nearby(" + result.latitude + "," + result.longitude + "," + distance + "," + auto_extend + ")"; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'search') } } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SEARCH, data: requestParam }, 'search')) }; Utils.locationProcess(options, locationsuccess) }; getSuggestion(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (!Utils.checkKeyword(options)) { return } var requestParam = { keyword: options.keyword, region: options.region || '全国', region_fix: options.region_fix || 0, policy: options.policy || 0, page_size: options.page_size || 10, page_index: options.page_index || 1, get_subpois: options.get_subpois || 0, output: 'json', key: that.key }; if (options.address_format) { requestParam.address_format = options.address_format } if (options.filter) { requestParam.filter = options.filter } if (options.location) { var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) }; Utils.locationProcess(options, locationsuccess) } else { if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'suggest') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_SUGGESTION, data: requestParam }, "suggest")) } }; reverseGeocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { coord_type: options.coord_type || 5, get_poi: options.get_poi || 0, output: 'json', key: that.key }; if (options.poi_options) { requestParam.poi_options = options.poi_options } var locationsuccess = function (result) { requestParam.location = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'reverseGeocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'reverseGeocoder')) }; Utils.locationProcess(options, locationsuccess) }; geocoder(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'address')) { return } var requestParam = { address: options.address, output: 'json', key: that.key }; if (options.region) { requestParam.region = options.region } if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'geocoder') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_GET_GEOCODER, data: requestParam }, 'geocoder')) }; getCityList(options) { var that = this; options = options || {}; Utils.polyfillParam(options); var requestParam = { output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getCityList') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_CITY_LIST, data: requestParam }, 'getCityList')) }; getDistrictByCityId(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'id')) { return } var requestParam = { id: options.id || '', output: 'json', key: that.key }; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'getDistrictByCityId') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_AREA_LIST, data: requestParam }, 'getDistrictByCityId')) }; calculateDistance(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { mode: options.mode || 'walking', to: Utils.location2query(options.to), output: 'json', key: that.key }; if (options.from) { options.location = options.from } if (requestParam.mode == 'straight') { var locationsuccess = function (result) { var locationTo = Utils.getEndLocation(requestParam.to); var data = { message: "query ok", result: { elements: [] }, status: 0 }; for (var i = 0; i < locationTo.length; i++) { data.result.elements.push({ distance: Utils.getDistance(result.latitude, result.longitude, locationTo[i].lat, locationTo[i].lng), duration: 0, from: { lat: result.latitude, lng: result.longitude }, to: { lat: locationTo[i].lat, lng: locationTo[i].lng } }) } var calculateResult = data.result.elements; var distanceResult = []; for (var i = 0; i < calculateResult.length; i++) { distanceResult.push(calculateResult[i].distance) } return options.success(data, { calculateResult: calculateResult, distanceResult: distanceResult }) }; Utils.locationProcess(options, locationsuccess) } else { var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'calculateDistance') } wx.request(Utils.buildWxRequestConfig(options, { url: URL_DISTANCE, data: requestParam }, 'calculateDistance')) }; Utils.locationProcess(options, locationsuccess) } }; direction(options) { var that = this; options = options || {}; Utils.polyfillParam(options); if (Utils.checkParamKeyEmpty(options, 'to')) { return } var requestParam = { output: 'json', key: that.key }; if (typeof options.to == 'string') { requestParam.to = options.to } else { requestParam.to = options.to.latitude + ',' + options.to.longitude } var SET_URL_DIRECTION = null; options.mode = options.mode || MODE.driving; SET_URL_DIRECTION = URL_DIRECTION + options.mode; if (options.from) { options.location = options.from } if (options.mode == MODE.driving) { if (options.from_poi) { requestParam.from_poi = options.from_poi } if (options.heading) { requestParam.heading = options.heading } if (options.speed) { requestParam.speed = options.speed } if (options.accuracy) { requestParam.accuracy = options.accuracy } if (options.road_type) { requestParam.road_type = options.road_type } if (options.to_poi) { requestParam.to_poi = options.to_poi } if (options.from_track) { requestParam.from_track = options.from_track } if (options.waypoints) { requestParam.waypoints = options.waypoints } if (options.policy) { requestParam.policy = options.policy } if (options.plate_number) { requestParam.plate_number = options.plate_number } } if (options.mode == MODE.transit) { if (options.departure_time) { requestParam.departure_time = options.departure_time } if (options.policy) { requestParam.policy = options.policy } } var locationsuccess = function (result) { requestParam.from = result.latitude + ',' + result.longitude; if (options.sig) { requestParam.sig = Utils.getSig(requestParam, options.sig, 'direction', options.mode) } wx.request(Utils.buildWxRequestConfig(options, { url: SET_URL_DIRECTION, data: requestParam }, 'direction')) }; Utils.locationProcess(options, locationsuccess) } }; module.exports = QQMapWX; \ No newline at end of file diff --git a/utils/util.js b/utils/util.js index 764bc2c..11c9e5f 100644 --- a/utils/util.js +++ b/utils/util.js @@ -1,3 +1,4 @@ +const app = getApp() const formatTime = date => { const year = date.getFullYear() const month = date.getMonth() + 1 @@ -14,6 +15,106 @@ const formatNumber = n => { return n[1] ? n : `0${n}` } +function chooseImages(callback) { + wx.chooseImage({ + count: 1, + sourceType: ['album', 'camera'], + success: res => { + const tempFilePaths = res.tempFilePaths; + for(let i = 0;i < tempFilePaths.length; i++) { + wx.getImageInfo({ + src: tempFilePaths[i], + success: image => { + wx.showLoading({ title: '图片上传中', mask: true }) + wx.uploadFile({ + url: `${app.globalData.baseURL}api/upload`, + file: image, + filePath: image.path, + header: { + Authorization: wx.getStorageSync('token'), + }, + name: 'file', + success: res => { + if (callback) { + callback(JSON.parse(res.data).link) + } + }, + fail: err => { + wx.showToast({ + title: '上传图片失败', + icon: 'none', + duration: 2000, + }) + }, + complete: res => { + wx.hideLoading() + }, + }) + }, + fail: err => { + wx.showToast({ + title: '获取图片信息失败', + icon: 'none', + duration: 2000, + }) + }, + }) + } + } + }) +} + +function chooseImages2(callback) { + wx.chooseImage({ + count: 3, + sourceType: ['album', 'camera'], + success: res => { + const tempFilePaths = res.tempFilePaths; + for(let i = 0;i < tempFilePaths.length; i++) { + wx.getImageInfo({ + src: tempFilePaths[i], + success: image => { + wx.showLoading({ title: '图片上传中', mask: true }) + wx.uploadFile({ + url: `${app.globalData.baseURL}api/upload`, + file: image, + filePath: image.path, + header: { + Authorization: wx.getStorageSync('token'), + }, + name: 'file', + success: res => { + if (callback) { + callback(JSON.parse(res.data).link) + } + }, + fail: err => { + wx.showToast({ + title: '上传图片失败', + icon: 'none', + duration: 2000, + }) + }, + complete: res => { + wx.hideLoading() + }, + }) + }, + fail: err => { + wx.showToast({ + title: '获取图片信息失败', + icon: 'none', + duration: 2000, + }) + }, + }) + } + } + }) +} + module.exports = { - formatTime + formatTime, + chooseImages, + chooseImages2 }