From c41b852aaf2f145d4c419217fb521ef2284eed7a Mon Sep 17 00:00:00 2001 From: zhangjing Date: Mon, 31 Jul 2023 17:27:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E9=AA=8C=E5=AE=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/interfaces/recruit.js | 15 +- api/request.js | 4 +- app.js | 16 +- app.json | 3 +- pages/index-老版/assess/assess.js | 1 + pages/index/assess/assess.js | 1 + pages/recruit/index.js | 8 +- pages/recruit/index.wxml | 35 +- pages/recruit/index.wxss | 53 ++- pages/recruit/poster/poster.js | 301 ++++++++++++++ pages/recruit/poster/poster.json | 3 + pages/recruit/poster/poster.wxml | 59 +++ pages/recruit/poster/poster.wxss | 199 ++++++++++ pages/recruit/referto 三联动/referto三联动.js | 159 ++++++++ .../recruit/referto 三联动/referto三联动.json | 4 + .../recruit/referto 三联动/referto三联动.wxml | 84 ++++ .../recruit/referto 三联动/referto三联动.wxss | 375 ++++++++++++++++++ pages/recruit/referto/referto.js | 124 ++++-- pages/recruit/referto/referto.wxml | 49 ++- pages/recruit/refertoEdit/refertoEdit.js | 129 +++++- pages/recruit/refertoEdit/refertoEdit.wxml | 46 ++- pages/recruit/signWrite/signWrite.wxml | 4 +- pages/site/add/add.js | 1 + pages/user/setup/setup.js | 2 +- project.config.json | 2 +- project.private.config.json | 15 +- 26 files changed, 1568 insertions(+), 124 deletions(-) create mode 100644 pages/recruit/poster/poster.js create mode 100644 pages/recruit/poster/poster.json create mode 100644 pages/recruit/poster/poster.wxml create mode 100644 pages/recruit/poster/poster.wxss create mode 100644 pages/recruit/referto 三联动/referto三联动.js create mode 100644 pages/recruit/referto 三联动/referto三联动.json create mode 100644 pages/recruit/referto 三联动/referto三联动.wxml create mode 100644 pages/recruit/referto 三联动/referto三联动.wxss diff --git a/api/interfaces/recruit.js b/api/interfaces/recruit.js index d8a68bb..c9e3811 100644 --- a/api/interfaces/recruit.js +++ b/api/interfaces/recruit.js @@ -147,6 +147,17 @@ const orderDi = (exchange_id) => req({ url : "experiences/exchanges/" + exchange_id + "/track" }) +// 获取城市海报 +const posters = (data) => req({ + url : "experiences/areas/share_codes", + data: data +}) + +// 所有省市区数据 +const regionList = (data) => req({ + url : "experiences/regions", + data: data +}) export default ({ index, @@ -172,5 +183,7 @@ export default ({ orderList, orderDet, orderSign, - orderDi + orderDi, + posters, + regionList }) \ No newline at end of file diff --git a/api/request.js b/api/request.js index 72fcf21..950802d 100644 --- a/api/request.js +++ b/api/request.js @@ -12,8 +12,8 @@ import {updToken} from './updateToken' // wx6bd4fcc040bfa025 水感应 正式appid // wx9ae0c63d0c58caeb 测试appid 三猿 // wx3056ec23196eaf02 水感应 测试 -const api = "https://api.shui.shuiganying.com/api/" // 正式环境 -// const api = "https://shuitest.shuiganying.com/api/" // 测试环境 +// const api = "https://api.shui.shuiganying.com/api/" // 正式环境 +const api = "https://shuitest.shuiganying.com/api/" // 测试环境 const header = { "Accept" : "application/json" } diff --git a/app.js b/app.js index 73ec06c..1c53703 100644 --- a/app.js +++ b/app.js @@ -5,7 +5,14 @@ import api from "api/index" App({ - onLaunch(options) { + onLaunch(e) { + let { scene } = e + + // 检查入口场景值 + if(scene === 1011 || scene === 1047 || scene === 1124 || scene === 1089 || scene === 1038){ + this.globalData.isOfficial = true + } + // 检查用户登录状态 const token = wx.getStorageSync("token") if(token){ @@ -39,9 +46,7 @@ App({ // 获取系统信息 wx.getSystemInfo({ success: res=>{ - this.globalData = { - barHeight: res.statusBarHeight - } + this.globalData.barHeight = res.statusBarHeight } }) @@ -66,6 +71,7 @@ App({ barHeight : '', inviteText : '', // 邀请好友临时存储 isExperience: '', // 体验官身份 - experienceAreaId: '' // 体验官区域 + experienceAreaId: '', // 体验官区域 + isOfficial : false, // 关注公众号 } }) \ No newline at end of file diff --git a/app.json b/app.json index 55e3f5a..07b9c86 100644 --- a/app.json +++ b/app.json @@ -42,7 +42,8 @@ "pages/recruit/exchange/exchange", "pages/water/waterOrder/waterOrder", "pages/water/details/details", - "pages/water/logistic/logistic" + "pages/water/logistic/logistic", + "pages/recruit/poster/poster" ], "window": { "backgroundTextStyle": "light", diff --git a/pages/index-老版/assess/assess.js b/pages/index-老版/assess/assess.js index 90468cd..e4f8d98 100644 --- a/pages/index-老版/assess/assess.js +++ b/pages/index-老版/assess/assess.js @@ -86,6 +86,7 @@ Page({ uploadPhoto() { wx.chooseMedia({ count : 1, + mediaType: ['image'], sourceType: ['camera'], camera : 'front', success : path => { diff --git a/pages/index/assess/assess.js b/pages/index/assess/assess.js index f198450..9cdb1e4 100644 --- a/pages/index/assess/assess.js +++ b/pages/index/assess/assess.js @@ -112,6 +112,7 @@ Page({ uploadPhoto() { wx.chooseMedia({ count : 1, + mediaType: ['image'], sourceType: ['camera'], camera : 'front', success : path => { diff --git a/pages/recruit/index.js b/pages/recruit/index.js index f2435c7..f2e9b0b 100644 --- a/pages/recruit/index.js +++ b/pages/recruit/index.js @@ -1,10 +1,16 @@ -// pages/recruit/index.js + /* + * 手太欠 + * 愿这世界都如故事里一样 美好而动人~ + */ + Page({ /** * 页面的初始数据 */ data: { userLogin : false, + barHeight : getApp().globalData.barHeight, // 状态栏高度 + isOfficial : getApp().globalData.isOfficial, //公众号-场景值 recruitData : '', type : 'flowPath', //flowPath 参与流程 clockIn 打卡 diff --git a/pages/recruit/index.wxml b/pages/recruit/index.wxml index 44cc416..280cea7 100644 --- a/pages/recruit/index.wxml +++ b/pages/recruit/index.wxml @@ -414,15 +414,34 @@ + + + + + + + 分享体验官 + + + + 关注公众号 + + + + - + + + + + 关注公众号 - + 请关注”水感应“公众号以便收到活动通知 - 请截图保存二维码识别关注 + 请长按识别二维码关注公众号 @@ -473,12 +492,4 @@ - - - - - - - 关注公众号 - - \ No newline at end of file + \ No newline at end of file diff --git a/pages/recruit/index.wxss b/pages/recruit/index.wxss index 803dad7..1f7bf83 100644 --- a/pages/recruit/index.wxss +++ b/pages/recruit/index.wxss @@ -287,13 +287,36 @@ display: block; } +.followOfficial { + position: relative; + left: 50%; + top: 50%; + width: 600rpx; + margin-left: -300rpx; + margin-top: -300rpx; + border-radius: 20rpx; + overflow: hidden; + background-color: #ffffff; + text-align: center; + padding: 80rpx 20rpx 20rpx; + box-sizing: border-box; + height: 260rpx; +} + +.followOfficial-close { + position: absolute; + bottom: 0; + left: 0; + width: 40rpx; +} + .followText { position: absolute; left: 50%; top: 50%; - width: 500rpx; - margin-left: -250rpx; - margin-top: -260rpx; + width: 600rpx; + margin-left: -300rpx; + margin-top: -300rpx; border-radius: 20rpx; overflow: hidden; background-color: #ffffff; @@ -919,18 +942,36 @@ /* 关注漂浮窗 */ .floating { + width: 100%; position: fixed; - right: -4rpx; bottom: 10%; + right: 0; z-index: 9; - padding: 20rpx 15rpx; + text-align: right; + width: 70rpx; +} + +.followFloat { text-align: center; - border-radius: 20rpx 0 0 20rpx; width: 40rpx; + padding: 20rpx 15rpx; color: #c6501e; font-weight: 600; background-image: linear-gradient(to top, #feddc7, #feddc7); border: 4rpx solid #ffffff; + border-radius: 20rpx 0 0 20rpx; +} + +.shareFloat { + margin-bottom: 30rpx; + text-align: center; + width: 40rpx; + padding: 20rpx 15rpx; + color: #000000; + font-weight: 600; + background-image: linear-gradient(to top, #ffcf3b, #ffcf3b); + border: 4rpx solid #ffa749; + border-radius: 20rpx 0 0 20rpx; } .floating-img { diff --git a/pages/recruit/poster/poster.js b/pages/recruit/poster/poster.js new file mode 100644 index 0000000..a163f3e --- /dev/null +++ b/pages/recruit/poster/poster.js @@ -0,0 +1,301 @@ +Page({ + + /** + * 页面的初始数据 + */ + data: { + shareSee: false, // 分享弹出 + inviteCode: '', // 二维码 + currentBgIndex: 0, // 轮播图数量 + styleShow: false, // 是否展示图片查看并选择 + + styleType:'', // 二维码 切换 还是背景图 + qrcodes:[], // 城市二维码数组 + currentCodeIndex:0,// + + //海报 + loading : true, + codeType : 'city', + posterDatas : {}, // 定位 + posterDatasLists: [],// 海报数据返回 + + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad() { + wx.showLoading({ + title: '请求中...', + }) + }, + // 切换城市 + changeCity(){ + this.setData({ + styleType:'qcode', + styleShow:true + }) + }, + // 轮播图滚动 + swiperChange(e) { + let index = e.detail.current + if(this.data.codeType == 'city'){ + wx.setNavigationBarTitle({ + title: `城市体验官(${this.data.posterDatasLists[index].name})`, + }) + this.setData({ + inviteCode:this.data.posterDatasLists[index].code + }) + } + this.setData({ + posterDatas: this.data.posterDatasLists[index], + currentBgIndex: index + }) + this.initCanvas() + }, + // 选择上面图切换轮播 + selectBgIndex(e) { + let index = e.currentTarget.dataset.index + if (index != this.data.currentBgIndex) { + this.setData({ + currentBgIndex: index + }) + } + }, + // 切换上面二维码图片 + selectCodeIndex(e) { + let index = e.currentTarget.dataset.index + let qrcodes = this.data.qrcodes + + if (index != this.data.currentCodeIndex) { + this.setData({ + currentCodeIndex: index, + inviteCode: qrcodes[index].code + }) + wx.setNavigationBarTitle({ + title: `城市体验官(${qrcodes[index].name})`, + }) + } + + }, + // 展示或者隐藏样式 + changeStyle() { + this.setData({ + styleShow: !this.data.styleShow, + styleType:'' + }) + }, + onShow() { + this.ShareInfo(); + }, + //生成海报初始化 + initCanvas() { + var that = this; + var posterDatas = that.data.posterDatas + const query = wx.createSelectorQuery() + query.select('#firstCanvas').fields({ + node: true, + size: true + }, + function (res) { + const canvas = res.node + const ctx = canvas.getContext('2d') + const dpr = wx.getSystemInfoSync().pixelRatio + canvas.width = posterDatas.width * dpr + canvas.height = posterDatas.height * dpr + ctx.scale(dpr, dpr) + posterDatas.canvas = canvas + posterDatas.ctx = ctx + posterDatas.dpr = dpr + //存储 + that.setData({ + posterDatas + }) + }).exec() + wx.hideLoading() + }, + + /** + * 小程序码 + */ + ShareInfo() { + wx.$api.recruit.posters({ + size: 200, + path: '/pages/recruit/index' + }).then(res2 => { + this.setData({ + loading: false, + qrcodes:res2.data.qrcodes, + inviteCode: res2.data.qrcodes[0].code, + }) + wx.setNavigationBarTitle({ + title: `城市体验官(${res2.data.qrcodes[0].name})`, + }) + wx.getSystemInfo({ + success: (res) => { + let windowWidth = res.windowWidth // 当前设备宽 + let windowHeight = res.windowHeight // 当前设备高 + this.setData({ + windowWidth: windowWidth, + windowHeight: windowHeight + }) + let lists = [] // + let posters = res2.data.qrcodes + posters.map(item => { + item.position.newx = windowWidth / item.width * item.position.x.toFixed(2) + item.position.newy = windowHeight / item.height * item.position.y.toFixed(2) + item.position.newSize = windowWidth / item.width * item.position.size.toFixed(2) + item.show = true, // 显示隐藏海报弹窗 + item.success = false, // 是否成功生成过海报 + item.canvas = null, // 画布的节点 + item.ctx = null, // 画布的上下文 + item.dpr = 1, // 设备的像素比 + lists.push(item) + }) + this.setData({ + posterDatasLists: lists, + posterDatas: lists[0] + }) + // 数据处理完,初始化 canvas + this.initCanvas() + } + }) + }).catch(err => {}) + }, + + //海报生成 //画布 生成 海报[海报] + saveImg() { + var that = this; + var posterDatas = that.data.posterDatas + var canvas = posterDatas.canvas + var ctx = posterDatas.ctx + + wx.showLoading({ + title: '海报生成中', + mask: true + }); + + //二维码 + var codeImg = new Promise(function (resolve, reject) { + const photo = canvas.createImage(); + photo.src = that.data.inviteCode; + photo.onload = (e) => { + resolve(photo); + } + }); + + //背景素材 + var backImg = new Promise(function (resolve, reject) { + const photo = canvas.createImage(); + photo.src = posterDatas.cover; + photo.onload = (e) => { + resolve(photo); + } + }); + Promise.all([codeImg, backImg]).then(res => { + + // 绘制背景 + ctx.drawImage(res[1], 0, 0, posterDatas.width, posterDatas.height); + + // 绘制[二维码-白色背景] + ctx.fillStyle = "white"; + ctx.fillRect(posterDatas.position.x + 10, posterDatas.position.y + 10, posterDatas.position.size, posterDatas.position.size); + ctx.fillRect(posterDatas.position.x + 10, posterDatas.position.y + 10, posterDatas.position.size, posterDatas.position.size); + + // 绘制[二维码] + ctx.drawImage(res[0], posterDatas.position.x + 10, posterDatas.position.y + 10, posterDatas.position.size, posterDatas.position.size); + + // 关闭loading + wx.hideLoading(); + //显示海报 + posterDatas.success = true; + + that.setData({ + posterDatas + }) + + this.onDownloadImges(); + + }).catch(err => {}) + }, + + //下载图片[海报] + onDownloadImges() { + wx.showLoading({ + title: '保存中', + mask: true + }); + var that = this; + var posterDatas = that.data.posterDatas; + if (!posterDatas.pic) { + that.onCanvasBuildImges(); + return; + } + //可写成函数调用 这里不做解释 + wx.saveImageToPhotosAlbum({ + filePath: posterDatas.pic, + success(res) { + wx.hideLoading(); + wx.showToast({ + icon: 'none', + title: '已保存到相册,快去分享吧', + }) + that.setData({ + posterDatas, + shareSee: !that.data.shareSee, + styleShow: false + }) + }, + fail() { + wx.hideLoading(); + wx.showToast({ + icon: 'none', + title: '进入设置页,开启“保存到相册”', + }) + that.setData({ + posterDatas, + styleShow: false + }) + return; + } + }) + }, + + //画布 转 图片[海报] + onCanvasBuildImges() { + var that = this; + var posterDatas = that.data.posterDatas; + wx.canvasToTempFilePath({ + canvas: posterDatas.canvas, + width: posterDatas.width, + height: posterDatas.height, + destWidth: posterDatas.width * 3, + destHeight: posterDatas.height * 3, + success: res => { + posterDatas["pic"] = res.tempFilePath; + that.setData({ + posterDatas + }) + that.onDownloadImges(); + }, + fail() { + wx.hideLoading(); + wx.showToast({ + icon: 'none', + title: 'sorry 保存失败,请稍后再试.', + }) + return; + } + }); + }, + + /** + * 分享弹出 + */ + shareTap() { + this.setData({ + shareSee: !this.data.shareSee + }) + } +}) \ No newline at end of file diff --git a/pages/recruit/poster/poster.json b/pages/recruit/poster/poster.json new file mode 100644 index 0000000..3928faa --- /dev/null +++ b/pages/recruit/poster/poster.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/pages/recruit/poster/poster.wxml b/pages/recruit/poster/poster.wxml new file mode 100644 index 0000000..2cec4ae --- /dev/null +++ b/pages/recruit/poster/poster.wxml @@ -0,0 +1,59 @@ + + {{codeType == 'city' && !styleShow ?'切换城市':styleShow ?'关闭切换':'切换背景'}} + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + + + + 分 享 + + + + + + + + + + + + + + + + + 保存二维码 + + + 取消 + + + + + 数据加载中... + \ No newline at end of file diff --git a/pages/recruit/poster/poster.wxss b/pages/recruit/poster/poster.wxss new file mode 100644 index 0000000..2a3e665 --- /dev/null +++ b/pages/recruit/poster/poster.wxss @@ -0,0 +1,199 @@ +.code { + width: 100vw; + height: 100vh; + position: relative; +} + +.code-back { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; +} + +.code-cont { + position: absolute; + z-index: 9; + text-align: center; +} + +.code-img{ + margin: 0 auto 20rpx; + overflow: hidden; + /* width: 260rpx; + height: 260rpx; */ + /* border: 4rpx solid #144592; */ + padding: 10rpx; + box-sizing: border-box; +} +.code-img image{ + background-color: #ffffff; + /* border: 4rpx solid #144592; */ + /* border-radius: 50%; */ +} + +.code-img image { + width: 100%; +} + +.code-text { + color: #144592; + font-size: 28rpx; + font-weight: 600; +} + +.code-share { + position: absolute; + z-index: 10; + left: 0; + bottom: 13%; + background: linear-gradient(to right, rgb(1, 66, 104), rgba(5, 81, 126, 1)); + width: 50rpx; + text-align: center; + border-radius: 0 26rpx 26rpx 0; + padding: 30rpx 15rpx 30rpx 12rpx; + box-shadow: 0 0 6rpx 6rpx rgba(0, 0, 0, .2); +} +.code-share-city{ + bottom: 26% !important; +} + +.code-share-name { + writing-mode:vertical-rl; + font-size: 30rpx; + padding-left: 4rpx; + color: #fff; + letter-spacing: 1px; +} + +.code-share image { + width: 36rpx; + height: 36rpx; + margin-bottom: 5rpx; +} + +.sharePop { + position: fixed; + width: 100%; + z-index: 99; + left: 0; + bottom: 0; + background-color: #0a1930; + display: none; +} + +.sharePop.active { + display: block; +} + +.shareCont-label image { + width: 60rpx; + height: 60rpx; + display: block; + margin: 0 auto 10rpx; +} + +.shareCancel { + border-top: 2rpx solid #0e2c58; + color: #ffffff; + width: 100%; + text-align: center; + line-height: 100rpx; +} + +.shareCont{ + display: flex; + padding: 30rpx 0; +} + +.shareCont-label { + color: #ffffff; + flex: 2; + text-align: center; + font-size: 28rpx; +} + +.codeShare-button { + background-color: transparent; + padding: 0; + font-weight: normal; +} + +/* canvas */ +.canvasImg { + position: absolute; + left: -100000%; + height: 800px; + width: 375px; +} + +/* 轮播图 */ +.swiper{ + width: 100vw; + height: 100vh; + position: relative; +} +.swiper-item{ + height: 100vh; +} + +/* 切换背景图 */ +.changeBg{ + width: 100%; + background-color: #fff; + overflow-x: scroll; + display: flex; + box-sizing: border-box; + padding: 30rpx 20rpx; + box-sizing: border-box; +} +.changeBgItem{ + padding: 20rpx 20rpx 20rpx 10rpx; + white-space:nowrap; + flex-direction: column; + display: flex; + align-items: center; + justify-content: center; + box-sizing: border-box; +} + +.changeBgItem-qcode span{ + color: #144592; + margin-top: 20rpx; +} +.changeBgItem .changeCover{ + width: 160rpx; + height: 250rpx; + position: relative; + padding: 10rpx; + box-sizing: border-box; + border: solid 1rpx #0e2c5801; + box-shadow: 0 0 2rpx 2rpx rgba(0, 0, 0, .1); + border-radius: 10rpx; +} +.changeBgItem .changeCoverCode{ + height: 160rpx; +} +.selected{ + border: solid 2rpx #0e2c5830 !important; + box-shadow: 0 0 4rpx 4rpx rgba(5, 81, 126, 0.445) !important; +} +.changeBgFixed{ + position: fixed; + z-index: 10; + right: 30rpx; + top: 0; + background: linear-gradient(to right, rgba(5, 81, 126, 0.8), rgba(5, 81, 126, 0.6)); + width: 50rpx; + text-align: center; + border-radius: 0 0 26rpx 26rpx ; + padding: 30rpx 15rpx 30rpx 12rpx; + box-shadow: 0 0 6rpx 6rpx rgba(0, 0, 0, .2); + color: #fff; +} + +.pages-load { + z-index: 1000000; + background-color: #f9f9f9; +} \ No newline at end of file diff --git a/pages/recruit/referto 三联动/referto三联动.js b/pages/recruit/referto 三联动/referto三联动.js new file mode 100644 index 0000000..bdc2443 --- /dev/null +++ b/pages/recruit/referto 三联动/referto三联动.js @@ -0,0 +1,159 @@ +// pages/recruit/referto/referto.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + notice : '', //地区提示 + areaData : '', //地区数据 + paySuccess : false, + experienceId: '', + typesArr : [], + typesIndex : 0, + refertoStatus: false, + checkStatus : false, + region : [], + regionsVal: "", + + // 市级选择 + cityArr : [], + cityId : 0, + cityIndex : 0, + + // 区域选择 + regiArr : [], + regiId : 0, + regiIndex : 0 + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad(options) { + this.setData({ + experienceId: options.id + }) + // 获取申请前置接口 + this.recruitInfo(options.id); + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() {}, + + // 省市区三联动 + bindRegionChange (e) { + console.log(e) + let { value, postcode } = e.detail + this.setData({ + regions : value, + regionsVal: value[0] + "-" + value[1] + "-" + value[2] + }) + }, + + /** + * 申请前置接口 + */ + recruitInfo(id) { + wx.$api.recruit.Enroll(id, { + experience_area_id: getApp().globalData.experienceAreaId + }).then(res => { + console.log(res) + // let areas = [ + // { + // city: "请选择城市", + // city_id: null, + // experience_area_id: null, + // surplus: null + // } + // ] + this.setData({ + areaData : res.data.areas, + notice : res.data.experience_notice, + typesArr : [{experience_type_id: null, name: "请选择体验内容"}, ...res.data.types], + // cityArr : [...areas, ...res.data.areas], + paySuccess : false + }) + + // 获取区级列表 + // this.regilist(res.data.areas[this.data.cityIndex].city_id) + }).catch(err => {}) + }, + + /** + * 体验内容筛选 + */ + tasteDrop(e) { + let newIndex = e.detail.value + this.setData({ + typesIndex : newIndex + }) + }, + + /** + * 提交表单 + */ + siteform(e) { + let value = e.detail.value + let errMsg = '' + // let newRegions= this.data.regions.join('') + if(this.data.regionsVal === '') { + errMsg = "请选择省市区" + } + if(this.data.typesArr[this.data.typesIndex].experience_type_id === null) errMsg = "请选择体验内容" + if(errMsg != ''){ + wx.showToast({ + title: errMsg, + icon : 'none' + }) + return + } + let data = { + name : value.name, + address : value.address, + region_names : this.data.regions, + experience_id : this.data.experienceId, + experience_area_id : this.data.areaData.experience_area_id, + experience_type_id : this.data.typesArr[this.data.typesIndex].experience_type_id, + invite : getApp().globalData.inviteText + } + this.setData({ + disabled: true + }) + wx.$api.recruit.recruitAdd(data).then(res => { + this.setData({ + checkStatus: true, + disabled: false + }) + }).catch(() =>{ + this.setData({ + disabled: false + }) + }) + }, + + /** + * 关闭弹框,跳转首页 + */ + refertoTap() { + this.setData({ + refertoStatus: false + }) + wx.switchTab({ + url: '/pages/recruit/index' + }) + }, + + /** + * 申请体验官成功后,弹出 + */ + checkTap() { + this.setData({ + refertoStatus: true, + checkStatus: false + }) + } +}) \ No newline at end of file diff --git a/pages/recruit/referto 三联动/referto三联动.json b/pages/recruit/referto 三联动/referto三联动.json new file mode 100644 index 0000000..df83253 --- /dev/null +++ b/pages/recruit/referto 三联动/referto三联动.json @@ -0,0 +1,4 @@ +{ + "usingComponents": {}, + "navigationBarTitleText": "申请体验官" +} \ No newline at end of file diff --git a/pages/recruit/referto 三联动/referto三联动.wxml b/pages/recruit/referto 三联动/referto三联动.wxml new file mode 100644 index 0000000..f77147b --- /dev/null +++ b/pages/recruit/referto 三联动/referto三联动.wxml @@ -0,0 +1,84 @@ + + + + + + + + + 活动报名 + activity + + + 温馨提示: + {{notice}} + +
+ + + + + {{ typesArr[typesIndex].name }} + + {{ typesArr[typesIndex].remark }} + + + + + + + + + + + + + + + + + {{ regionsVal || '选择省市区' }} + + + + + + + + + + + + 改地区剩余名额为{{areaData.surplus}},不可申请 + +
+ +
+
+
+ + + + + + + + + + + + + + + + 恭喜您,申请成功 + 水漾肌肤天然滋润,足量使用,效果更佳! + 知道了 + + + \ No newline at end of file diff --git a/pages/recruit/referto 三联动/referto三联动.wxss b/pages/recruit/referto 三联动/referto三联动.wxss new file mode 100644 index 0000000..6d3a874 --- /dev/null +++ b/pages/recruit/referto 三联动/referto三联动.wxss @@ -0,0 +1,375 @@ +page { + background-image: linear-gradient(to top, #6fbaf0, #6fbaf0); + padding-bottom: 50rpx; +} + +.referto-img { + width: 100%; +} + +.referto-cont { + padding: 0 30rpx; + box-sizing: border-box; +} + +.referto-blue { + background-color: #0e55ad; + border-radius: 20rpx; + position: relative; + top: -20rpx; + z-index: 9; +} + +.referto-blue::after, +.referto-blue::before { + position: absolute; + content: ''; + background-color: rgba(14, 85, 173, .2); + left: 20rpx; + border-radius: 20rpx 20rpx 0 0; +} +.referto-blue::after { + z-index: -2; + width: calc(100% - 40rpx); + left: 20rpx; + top: -20rpx; + height: 20rpx; +} +.referto-blue::before { + z-index: -1; + width: calc(100% - 80rpx); + left: 40rpx; + top: -40rpx; + height: 40rpx; +} + +.referto-drop { + padding: 30rpx; + box-sizing: border-box; + position: relative; +} + +.referto-drop image { + width: 40rpx; + position: absolute; + right: 30rpx; +} + +.referto-drop text { + display: inline-block; + width: 20rpx; + height: 20rpx; + border-radius: 50%; + background-color: #ffaf59; + margin-right: 20rpx; +} + +.referto-drop text:nth-child(2) { + background-color: #7fe2ff; +} + +.referto-drop text:nth-child(3) { + background-color: #ffffff; +} + +.referto-white { + background: white; + border-radius: 20rpx; + padding: 30rpx; + position: relative; +} + + +.referto-back { + position: absolute; + bottom: 0; + right: 0; + width: 50%; +} + +.referto-title { + margin-bottom: 30rpx; + display: flex; +} + +.referto-title-name { + flex: 1; + display: inline-block; +} + +.referto-title-name text { + background-color: #1e6dce; + padding: 0 30rpx; + line-height: 68rpx; + font-size: 34rpx; + border-radius: 20rpx 0 20rpx 0; + color: #fff; + display: inline-block; +} + +.referto-title-tips { + text-transform: uppercase; + font-size: 44rpx; + line-height: 68rpx; + color: #eef6ff; +} + +.site-form { + display: block; +} + +.site-input { + position: relative; + line-height: 90rpx; + margin-bottom: 30rpx; +} + +.site-input label text { + color: #ee291b; +} + +.picker-text { + color: #ee291b; + font-size: 26rpx; + margin-top: 20rpx; +} + +.picker-remark picker { + position: relative; + width: 100%; + background-color: #f9fcff; + padding: 30rpx 80rpx 30rpx 30rpx; + box-sizing: border-box; + margin-top: 30rpx; +} + +.picker-remark image { + width: 44rpx; + height: 44rpx; + position: absolute; + right: 20rpx; + top: calc(50% - 22rpx); +} + + +.site-input input, +.site-input picker { + width: 100%; + height: 90rpx; + background-color: #f9fcff; + padding: 0 30rpx; + box-sizing: border-box; +} + +.site-input image { + width: 44rpx; + height: 44rpx; + position: absolute; + right: 20rpx; + top: calc(50% + 22rpx); +} + +.site-btn { + padding: 20rpx 30rpx; + margin: 60rpx 0; + text-align: center; + position: relative; + z-index: 2; +} + +.site-btn button[size="mini"], +.site-btn text { + display: inline-block; + background: #1e6dce; + border-radius: 80rpx; + height: 88rpx; + line-height: 88rpx; + font-size: 30rpx; + color: white; + padding: 0 80rpx; +} + +.site-btn.active text { + background: #b4b4b4; +} + +.site-btn button[disabled] { + background: #7789ff !important; + color: #fff !important; +} + +.site-switch { + font-size: 32rpx; + margin: 30rpx; + display: flex; + line-height: 40rpx; +} + +.site-switch text { + flex: 1; +} + +.site-switch-active { + color: #797979; +} + +.site-input textarea { + background-color: #f9fcff; + padding: 30rpx; + width: 100%; + box-sizing: border-box; + min-height: 40rpx; +} + +.refertoEject { + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .6); + z-index: 1000; + display: none; +} + +.refertoEject.active { + display: block; +} + +.refertoCont { + -webkit-box-orient: vertical; + -webkit-box-pack: center; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 10000; + padding: 0 10%; + box-sizing: border-box; + text-align: center; + display: none; +} + +.refertoCont.active { + display: -webkit-box; +} + +.refertoCont-name { + width: 100%; + /* background-image: linear-gradient(to bottom, #ffb70a, #ff7e1c); + color: #fff; */ + display: inline-block; + margin-bottom: 50rpx; + /* padding: 0 60rpx; */ + /* border: 4rpx solid #ffffff; */ + line-height: 80rpx; + /* border-radius: 90rpx; */ + /* font-size: 34rpx; */ +} + +.refertoCont-name image, +.refertoCont-img { + width: 100%; +} + +.refertoCont-close { + width: 68rpx; + display: block; + margin: 0 auto; +} + +/* 申请成功弹出 */ +.checkEject { + position: fixed; + width: 100vw; + height: 100vh; + left: 0; + top: 0; + background-color: rgba(0, 0, 0, .6); + z-index: 1000; + display: none; +} + +.checkEject.active { + display: block; +} + +.checkCont { + -webkit-box-orient: vertical; + -webkit-box-pack: center; + position: fixed; + left: 0; + right: 0; + top: 0; + bottom: 0; + z-index: 10000; + box-sizing: border-box; + text-align: center; + display: none; +} + +.checkCont.active { + display: -webkit-box; +} + +.checkCont-img, +.checkCont-name { + position: absolute; + width: 80%; + left: 10%; + top: 30%; +} + +.checkCont-name { + z-index: 9; + padding: 120rpx 140rpx; + box-sizing: border-box; +} + +.checkCont-name image { + width: 70%; +} + +.checkCont-text { + margin-top: 20rpx; +} + +.checkCont-text-title { + font-weight: 600; + font-size: 34rpx; +} + +.checkCont-text-tips { + color: #666666; + line-height: 44rpx; + margin: 25rpx 0; +} + +.checkCont-text-go { + background-color: #ff4751; + color: #fff; + border-radius: 80rpx; + line-height: 74rpx; +} + + +.referto-tips-name { + font-weight: 600; + margin-bottom: 10rpx; + line-height: 44rpx; + display: flex; +} + +.referto-tips-name image { + width: 30rpx; + margin: 8rpx 10rpx 0 0; +} + +.referto-tips { + font-size: 28rpx; + line-height: 40rpx; + text-align: justify; + margin-bottom: 40rpx; + color: #db0000; +} \ No newline at end of file diff --git a/pages/recruit/referto/referto.js b/pages/recruit/referto/referto.js index bc6a652..0962771 100644 --- a/pages/recruit/referto/referto.js +++ b/pages/recruit/referto/referto.js @@ -6,22 +6,28 @@ Page({ */ data: { notice : '', //地区提示 + areaData : '', //地区数据 paySuccess : false, experienceId: '', typesArr : [], typesIndex : 0, refertoStatus: false, checkStatus : false, + + // 省份选择 + areasArr : [], + areaId : 0, + areaIndex : 0, // 市级选择 cityArr : [], cityId : 0, cityIndex : 0, - + // 区域选择 regiArr : [], regiId : 0, - regiIndex : 0 + regiIndex : 0, }, /** @@ -33,47 +39,77 @@ Page({ }) // 获取申请前置接口 this.recruitInfo(options.id); + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow() { + // 获取省市区列表 + this.createInfo(); }, /** - * 生命周期函数--监听页面显示 + * 省市区列表 */ - onShow() { }, + createInfo() { + wx.$api.site.create().then(res => { + let areas = res.data, + areaIndex = this.data.areaIndex - /** - * 申请前置接口 - */ - recruitInfo(id) { - wx.$api.recruit.Enroll(id, { - experience_area_id: getApp().globalData.experienceAreaId - }).then(res => { - let areas = [ - { - city: "请选择城市", - city_id: null, - experience_area_id: null, - surplus: null - } - ] this.setData({ - notice : res.data.experience_notice, - typesArr : [{experience_type_id: null, name: "请选择体验内容"}, ...res.data.types], - cityArr : [...areas, ...res.data.areas], - paySuccess : false - }) + areasArr : areas, + areaId : areas[areaIndex].id, - // 获取区级列表 - this.regilist(res.data.areas[this.data.cityIndex].city_id) + }) + this.citylist(areas[areaIndex].id) }).catch(err => {}) }, - + + /** + * 所在省份-下拉 + */ + areasChange(e) { + let area = this.data.areasArr, + index = e.detail.value, + atcode = area[index].id + if (index != this.data.areaIndex) { + this.setData({ + areaIndex : index, + areaId : atcode + }) + // 获取市级列表 + this.citylist(atcode) + } + }, + + /** + * 市级列表 + */ + citylist(cityId) { + wx.$api.site.create({ + parent_id: cityId + }).then(res=>{ + let cityArr = res.data + this.setData({ + cityId : cityArr[0].id, + cityIndex : 0, + cityArr : cityArr + }) + + // 获取区级列表 + this.regilist(cityArr[0].id) + }) + }, + /** * 市级下拉筛选 */ cityDrop(e) { let city = this.data.cityArr, index = e.detail.value, - citycode = city[index].city_id + citycode = city[index].id if (index != this.data.cityIndex) { this.setData({ cityIndex : index, @@ -84,7 +120,7 @@ Page({ this.regilist(citycode) } }, - + /** * 区列表 */ @@ -93,8 +129,8 @@ Page({ parent_id: areaId }).then(res=>{ this.setData({ - regiArr : [{id: null, name: "请选择区域", parent_id: null}, ...res.data], - regiId : null, + regiArr : res.data, + regiId : res.data[0].id, regiIndex : 0 }) }) @@ -111,6 +147,22 @@ Page({ }) }, + /** + * 申请前置接口 + */ + recruitInfo(id) { + wx.$api.recruit.Enroll(id, { + experience_area_id: getApp().globalData.experienceAreaId + }).then(res => { + this.setData({ + areaData : res.data.areas, + notice : res.data.experience_notice, + typesArr : [{experience_type_id: null, name: "请选择体验内容"}, ...res.data.types], + paySuccess : false + }) + }).catch(err => {}) + }, + /** * 体验内容筛选 */ @@ -127,10 +179,7 @@ Page({ siteform(e) { let value = e.detail.value let errMsg = '' - // if(this.data.regiId === null) errMsg = "请选择区域" - if(this.data.cityId === null || this.data.cityArr[this.data.cityIndex].experience_area_id === null) errMsg = "请选择城市" if(this.data.typesArr[this.data.typesIndex].experience_type_id === null) errMsg = "请选择体验内容" - if(errMsg != ''){ wx.showToast({ title: errMsg, @@ -138,16 +187,19 @@ Page({ }) return } + let data = { name : value.name, address : value.address, + province_id : this.data.areaId, city_id : this.data.cityId, - // district_id : this.data.regiId, + district_id : this.data.regiId, experience_id : this.data.experienceId, - experience_area_id : this.data.cityArr[this.data.cityIndex].experience_area_id, + experience_area_id : this.data.areaData.experience_area_id, experience_type_id : this.data.typesArr[this.data.typesIndex].experience_type_id, invite : getApp().globalData.inviteText } + console.log(data) this.setData({ disabled: true }) diff --git a/pages/recruit/referto/referto.wxml b/pages/recruit/referto/referto.wxml index 74590fb..55ea5f8 100644 --- a/pages/recruit/referto/referto.wxml +++ b/pages/recruit/referto/referto.wxml @@ -29,32 +29,43 @@ - - - - {{ cityArr[cityIndex].city }} - - - + + + + + + {{ areasArr[areaIndex].name }} + + + + + + + + + {{ cityArr[cityIndex].name }} + + + + + + + + + {{ regiArr[regiIndex].name }} + + + + - - - + - 剩余名额为0,不可申请 + 改地区剩余名额为{{areaData.surplus}},不可申请 diff --git a/pages/recruit/refertoEdit/refertoEdit.js b/pages/recruit/refertoEdit/refertoEdit.js index a6a0143..b714366 100644 --- a/pages/recruit/refertoEdit/refertoEdit.js +++ b/pages/recruit/refertoEdit/refertoEdit.js @@ -12,16 +12,21 @@ Page({ typesIndex : 0, refertoStatus: false, checkStatus : false, - - // 市级选择 - cityArr : [], + + //省份选择 + areas : [], + areaId : '', + areaIndex : 0, + + //市级选择 + cityList : [], cityId : 0, cityIndex : 0, - // 区域选择 - regiArr : [], + //区域选择 + regiList : [], regiId : 0, - regiIndex : 0 + regiIndex : 0, }, /** @@ -45,32 +50,124 @@ Page({ */ eitInfo(id) { wx.$api.recruit.Edit(id).then(res => { - let typeValue = res.data.types.findIndex(val=> val.experience_type_id == res.data.enroll.experience_type.experience_type_id), - cityValue = res.data.areas.findIndex(val=> val.city_id == res.data.enroll.experience_area.city_id) + console.log(res) + let typeValue = res.data.types.findIndex(val=> val.experience_type_id == res.data.enroll.experience_type.experience_type_id) + let areasValue = res.data.provinces.findIndex(val=> val.name == res.data.province.name), + cityValue = res.data.cities.findIndex(val=> val.name == res.data.city.name), + regiValue = res.data.districts.findIndex(val=> val.name == res.data.district.name) this.setData({ - enrollData: res.data.enroll, - typesIndex: typeValue, - cityIndex : cityValue, - typesArr : res.data.types, - cityArr : res.data.areas, + enrollData : res.data.enroll, + typesIndex : typeValue, + typesArr : res.data.types, + areas : res.data.provinces, + cityList : res.data.cities, + regiList : res.data.districts, + areaIndex : areasValue, + cityIndex : cityValue, + regiIndex : regiValue, + areaId : res.data.province.region_id, + cityId : res.data.city.region_id, + regiId : res.data.district.region_id, }) }).catch(err => {}) }, + /** + * 省市区列表 + */ + createInfo() { + wx.$api.site.create().then(res => { + let areas = res.data, + areaIndex = this.data.areaIndex + this.setData({ + areas : areas, + areaId : areas[areaIndex].id, + }) + + this.citylist(areas[areaIndex].id) + }).catch(err => {}) + }, + + /** + * 所在省份-下拉 + */ + areasChange(e) { + let area = this.data.areas, + index = e.detail.value, + atcode = area[index].id + if (index != this.data.areaIndex) { + this.setData({ + areaIndex : index, + areaId : atcode + }) + // 获取市级列表 + this.citylist(atcode) + } + }, + + /** + * 市级列表 + */ + citylist(cityId) { + wx.$api.site.create({ + parent_id: cityId + }).then(res=>{ + let cityArr = res.data + this.setData({ + cityId : cityArr[0].id, + cityIndex : 0, + cityList : cityArr + }) + + // 获取区级列表 + this.regilist(cityArr[0].id) + }) + }, + /** * 市级下拉筛选 */ cityDrop(e) { - let city = this.data.cityArr, + let city = this.data.cityList, index = e.detail.value, - citycode = city[index].city_id + citycode = city[index].id if (index != this.data.cityIndex) { this.setData({ cityIndex : index, - cityId : citycode + cityId : citycode }) + + // 获取区列表 + this.regilist(citycode) } }, + + /** + * 区列表 + */ + regilist(areaId) { + wx.$api.site.create({ + parent_id: areaId + }).then(res=>{ + this.setData({ + regiList : res.data, + regiId : res.data[0].id, + regiIndex : 0 + }) + }) + }, + + /** + * 区下拉筛选 + */ + regiDrop(e) { + let newIndex = e.detail.value + this.setData({ + regiIndex : newIndex, + regiId : this.data.regiList[newIndex].id + }) + }, + /** * 体验内容筛选 diff --git a/pages/recruit/refertoEdit/refertoEdit.wxml b/pages/recruit/refertoEdit/refertoEdit.wxml index f85248a..6cf12af 100644 --- a/pages/recruit/refertoEdit/refertoEdit.wxml +++ b/pages/recruit/refertoEdit/refertoEdit.wxml @@ -9,9 +9,11 @@ 活动报名 activity - - 温馨提示: - {{notice}} + + + 温馨提示: + + {{enrollData.experience.experience_notice}}
@@ -29,27 +31,37 @@ - - - - {{ cityArr[cityIndex].city }} - - - - + + + + + + {{ cityList[cityIndex].name }} + + + + + + + + + {{ regiList[regiIndex].name }} + + + + - + @@ -66,7 +78,7 @@ - + 修改成功,等待审核 水漾肌肤天然滋润,足量使用,效果更佳! 知道了 diff --git a/pages/recruit/signWrite/signWrite.wxml b/pages/recruit/signWrite/signWrite.wxml index 701f181..5c8f8f1 100644 --- a/pages/recruit/signWrite/signWrite.wxml +++ b/pages/recruit/signWrite/signWrite.wxml @@ -24,8 +24,8 @@ - #产品建议# - + #产品评价# + diff --git a/pages/site/add/add.js b/pages/site/add/add.js index b26ec86..2b999aa 100644 --- a/pages/site/add/add.js +++ b/pages/site/add/add.js @@ -59,6 +59,7 @@ Page({ this.setData({ areasArr : areas, areaId : areas[areaIndex].id, + }) this.citylist(areas[areaIndex].id) }).catch(err => {}) diff --git a/pages/user/setup/setup.js b/pages/user/setup/setup.js index 387d3f8..3a7235d 100644 --- a/pages/user/setup/setup.js +++ b/pages/user/setup/setup.js @@ -70,7 +70,7 @@ Page({ if(type == 'avatar') { wx.chooseMedia({ count : 1, - mediaType: 'image', + mediaType: ['image'], success : path => { // 上传图片 wx.$api.file.uploadImg(path.tempFiles[0].tempFilePath, {}).then(res=>{ diff --git a/project.config.json b/project.config.json index bfdbf9f..ea72c51 100644 --- a/project.config.json +++ b/project.config.json @@ -45,7 +45,7 @@ }, "compileType": "miniprogram", "libVersion": "2.17.0", - "appid": "wx6bd4fcc040bfa025", + "appid": "wx9ae0c63d0c58caeb", "projectname": "miniprogram-92", "condition": {}, "editorSetting": { diff --git a/project.private.config.json b/project.private.config.json index 62d1d80..a5a7470 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -10,14 +10,14 @@ "list": [ { "name": "", - "pathName": "pages/recruit/signWrite/signWrite", + "pathName": "pages/recruit/poster/poster", "query": "", "launchMode": "default", "scene": null }, { "name": "", - "pathName": "pages/recruit/referto/referto", + "pathName": "pages/recruit/index", "query": "", "launchMode": "default", "scene": null @@ -87,10 +87,17 @@ }, { "name": "", - "pathName": "pages/recruit/dailyList/dailyList", + "pathName": "pages/recruit/index", "query": "", "launchMode": "default", - "scene": null + "scene": 1001 + }, + { + "name": "", + "pathName": "pages/recruit/index", + "query": "", + "launchMode": "default", + "scene": 1011 } ] }