From c84726aa0c571d7eae3b817c395900478819dbd5 Mon Sep 17 00:00:00 2001 From: lp <3422924002@qq.com> Date: Fri, 12 Jul 2024 09:48:28 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E7=89=B9=E5=B2=97=E6=95=99?= =?UTF-8?q?=E5=B8=88=E6=95=99=E6=9D=90=E6=9F=A5=E8=AF=A2+=E8=BF=9B?= =?UTF-8?q?=E9=9D=A2=E5=88=86=E6=95=B0=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- miniprogram/app.json | 2 +- miniprogram/pages/sydw/lnbmrs/index.wxml | 3 +- miniprogram/pages/sydw/tgjsjccx/index.js | 456 +++++++++++++++++++++ miniprogram/pages/sydw/tgjsjccx/index.json | 6 + miniprogram/pages/sydw/tgjsjccx/index.wxml | 47 +++ miniprogram/pages/sydw/tgjsjccx/index.wxss | 145 +++++++ 6 files changed, 656 insertions(+), 3 deletions(-) create mode 100644 miniprogram/pages/sydw/tgjsjccx/index.js create mode 100644 miniprogram/pages/sydw/tgjsjccx/index.json create mode 100644 miniprogram/pages/sydw/tgjsjccx/index.wxml create mode 100644 miniprogram/pages/sydw/tgjsjccx/index.wxss diff --git a/miniprogram/app.json b/miniprogram/app.json index ecac1f6..f4a2bfa 100644 --- a/miniprogram/app.json +++ b/miniprogram/app.json @@ -17,7 +17,7 @@ "pages/subscribe/2023/sydw/bs/index", "pages/sydw/lnbmrs/index", "pages/sydw/tgjsmb/index", - + "pages/sydw/tgjsjccx/index", "pages/sydw/lngwjzb-jls/index", "pages/sydw/lngwjzb-jlsjs/index", "pages/sydw/2023/subscribe/index", diff --git a/miniprogram/pages/sydw/lnbmrs/index.wxml b/miniprogram/pages/sydw/lnbmrs/index.wxml index c3630ab..50a7595 100644 --- a/miniprogram/pages/sydw/lnbmrs/index.wxml +++ b/miniprogram/pages/sydw/lnbmrs/index.wxml @@ -1,12 +1,11 @@ - {{title}} + {{title}} - diff --git a/miniprogram/pages/sydw/tgjsjccx/index.js b/miniprogram/pages/sydw/tgjsjccx/index.js new file mode 100644 index 0000000..76044d6 --- /dev/null +++ b/miniprogram/pages/sydw/tgjsjccx/index.js @@ -0,0 +1,456 @@ +// pages/wdxt/lnfs-cc/index.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + title: "", // 活动名称 + imageUrl: "", // 背景图 + shareImages: "", // 分享图 + CRMEFSID: "", // CRM 活动表单 ID + CRMRemark: "", // CRM 注释 + actid: "", //zg99id + backgroundColor: "", + + dwList: [], + dwValue: '', + + gwList: [], + gwValue: '', + + // 列表展示配置 + listTitle: [], // 标题 + listContent: [], // 内容 + + suffix: {}, // 后缀 + suffixStr: "", // 后缀 字符串 + + phone: "", // 用户手机号码 + openid: "", //openid + + result: [], + count: 0, + page: 1 + }, + // 监听筛选条件切换(做出选择以后,报考职位发生变化) + m_select_touch(e) { + var _this = this + switch (e.detail.type) { + case "dw": //单位 + _this.setData({ + dwValue: e.detail.text, + gwList: [], + + }) + + // zg99二级联动 + wx.request({ + url: "https://zg99.offcn.com/index/chaxun/getlevel?actid=" + _this.data.actid, //路径 + data: { + level: '2', + grfiled: 'item01', + grtext: e.detail.text, + sstime: new Date().valueOf() + }, //二级联动,上级联动字段名,上级联动参数值 + success(res) { + let response = JSON.parse(res.data.substring(1, res.data.length - 1)); //去头尾(),转为json对象 + // 现将之前内容清空 + const gwList = [] + + + // 将数据添加到已清空的列表中 + for (var i = 0; i < response.lists.length; i++) { + + gwList.push(response.lists[i].item02) + } + _this.setData({ + gwList + }) + + + }, + fail: err => { //获取失败后提示 + wx.hideLoading() // 隐藏 loading + getApp().methods.handleError({ + err: err, + title: "出错啦", + content: '查询失败', + reLaunch: true + }) + } + }) + break + + case "gw": //岗位 + _this.setData({ + gwValue: e.detail.text + }) + + } + this.setData({ + result: [], + count: 0, + page: 1 + }) + }, + + // 手动检查 SSO 登录状态 + SSOCheckManual: function () { + getApp().methods.SSOCheckManual({ + crmEventFormSID: this.data.CRMEFSID, + suffix: { + suffix: this.data.suffix, + suffixStr: this.data.suffixStr + }, + remark: this.data.CRMRemark, + callback: ({ + phone, + openid + }) => { + this.setData({ + phone, + openid + }); + } + }); + }, + //查询 + search() { + let _this = this //作用域 + if (!_this.data.dwValue) { + wx.showToast({ + title: '请输入单位名称', + icon: 'error' + }) + return + } + + wx.showLoading({ + title: '查询中...', + mask: true + }) + wx.request({ + url: "https://zg99.offcn.com/index/chaxun/getfzinfo?actid=" + _this.data.actid, + data: { + item01: this.data.dwValue, + item02: this.data.gwValue, + tabnum: 2, + limits: 200, + page: this.data.page, + sstime: new Date().valueOf() + }, + success(res) { + console.log(res); + wx.hideLoading() // 隐藏 loading + try { + let list = JSON.parse(res.data.substring(1, res.data.length - 1)) //去头尾(),转为json对象 + console.log("list:", list) + if (list.status !== 1) { //如果status不等于1,弹出错误提示 + wx.showToast({ + title: list.msg, + icon: 'none' + }) + return + } + if (list.lists.length <= 0) { //如果内容长度小于等于0,弹出无数据提示 + wx.showToast({ + title: '没有查询到职位', + icon: 'none' + }) + return + } + + const result = []; + if (list.lists) { + list.lists.forEach(valueList => { + let same = false; + result.forEach(valueResult => { + if (valueList.item03 == valueResult.item03) { + same = true; + } + }); + if (!same) { + result.push(valueList); + } + }) + } + result.forEach(valueResult => { + if (valueResult.item07 == 0) { + valueResult.item07 = '暂无'; + } + }); + + //数据导入data.result + _this.setData({ + result: _this.data.result.concat(result), //不替换原数据添加新数据 + page: (_this.data.result.concat(list.lists).length / 200) + 1, //计算分页页数 + count: result.length //总数量录入data + }) + } catch (err) { //捕获错误并报错 + getApp().methods.handleError({ + err, + title: "出错啦", + content: '查询失败', + reLaunch: true + }) + } + }, + fail: err => { //获取失败后提示 + wx.hideLoading() // 隐藏 loading + getApp().methods.handleError({ + err: err, + title: "出错啦", + content: '查询失败', + reLaunch: true + }) + } + }) + }, + showmore: function (event) { + this.setData({ + showIndex: event.currentTarget.dataset.index + }) + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + //console.log(options); + + if (!options.actid) { + getApp().methods.handleError({ + err: null, + title: "出错啦", + content: '缺少活动id', + reLaunch: true + }); + return + } + const _this = this; + wx.showLoading({ + title: '加载中' + }); + + getApp().methods.getSuffix(options).then(res => { + this.setData(res); + // 获取活动配置 + wx.request({ + url: "https://zg99.offcn.com/index/chaxun/getfylist", + data: { + actid: options.actid, + tabnum: "100", + sstime: new Date().valueOf() + }, + success(res) { + try { + let response = JSON.parse(res.data.substring(1, res.data.length - 1)); //去头尾(),转为json对象 + if (response.status !== 1) { + // 如果status不等于1,弹出错误提示 + getApp().methods.handleError({ + err: null, + title: "出错啦", + content: response.msg, + reLaunch: true + }); + return + } + if (response.lists.length <= 0) { + // 如果内容长度小于等于0,弹出无数据提示 + getApp().methods.handleError({ + err: null, + title: "出错啦", + content: '没有查询到活动配置', + reLaunch: true + }); + return + } + // 保存活动配置 + _this.setData({ + actid: options.actid, + CRMEFSID: response.lists[0].CRMEFSID, + imageUrl: response.lists[0].imageUrl, + title: response.lists[0].title, + shareImages: response.lists[0].shareImages, + backgroundColor: response.lists[0].backgroundColor, + CRMRemark: `报名人数,${response.lists[0].title}`, + listTitle: response.lists[0].listTitle.split(',').map(item=>{return {name: item.split('|')[0], itemName: item.split('|')[1]}}), + listContent: response.lists[0].listContent.split(',').map(item=>{return {name: item.split('|')[0], itemName: item.split('|')[1]}}) + }) + // 获取一级联动数据 + wx.request({ + url: "https://zg99.offcn.com/index/chaxun/getlevel", + data: { + actid: _this.data.actid, + level: "1", + grfiled: '', + grtext: '', + sstime: new Date().valueOf() + }, + success(res) { + try { + let list = JSON.parse(res.data.substring(1, res.data.length - 1)); //去头尾(),转为json对象 + // console.log(list) + if (list.status !== 1) { + //如果status不等于1,弹出错误提示 + wx.showToast({ + title: list.msg, + icon: 'none' + }); + return + } + if (list.lists.length <= 0) { + //如果内容长度小于等于0,弹出无数据提示 + wx.showToast({ + title: '没有查询到数据', + icon: 'none' + }); + return + } + // 录入问题,不用提前清空,因为只进行一次获取 + const dwList = []; + for (var i = 0; i < list.lists.length; i++) { + dwList.push(list.lists[i].item01) + + } + _this.setData({ + dwList + }) + // 判断是否是单页模式 + if (wx.getLaunchOptionsSync().scene !== 1154) { + // 不是单页模式,进行登陆操作 + // 获取登陆状态 + getApp().methods.SSOCheck({ + crmEventFormSID: _this.data.CRMEFSID, + suffix: { + suffix: _this.data.suffix, + suffixStr: _this.data.suffixStr + }, + remark: _this.data.CRMRemark, + callback: ({ + phone, + openid + }) => _this.setData({ + phone, + openid + }), + }); + wx.hideLoading(); // 隐藏 loading + } else { + wx.hideLoading(); // 隐藏 loading + } + } catch (err) { //捕获错误并报错 + wx.hideLoading(); // 隐藏 loading + getApp().methods.handleError({ + err, + title: "出错啦", + content: '查询失败', + reLaunch: true + }); + } + }, + fail: err => { //获取失败后提示 + wx.hideLoading(); // 隐藏 loading + getApp().methods.handleError({ + err: err, + title: "出错啦", + content: '查询失败', + reLaunch: true + }); + } + }); + } catch (err) { //捕获错误并报错 + wx.hideLoading(); // 隐藏 loading + getApp().methods.handleError({ + err, + title: "出错啦", + content: '查询失败', + reLaunch: true + }); + } + }, + fail: err => { //获取失败后提示 + wx.hideLoading(); // 隐藏 loading + getApp().methods.handleError({ + err: err, + title: "出错啦", + content: '查询失败', + reLaunch: true + }); + } + }); + }).catch(err => { + wx.hideLoading(); // 隐藏 loading + getApp().methods.handleError({ + err: err, + title: "出错啦", + content: '获取后缀失败', + reLaunch: true + }); + }); + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + if (this.data.dwValue !== "" && this.data.gwValue !== "" && this.data.result.length < this.data.count) { + this.search(); + } + }, + + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + return { + title: this.data.title, + imageUrl: this.data.shareImages, + } + }, + + /** + * 用户点击右上角分享 分享到朋友圈 + */ + onShareTimeline: function () { + return { + title: this.data.title, + } + } +}) \ No newline at end of file diff --git a/miniprogram/pages/sydw/tgjsjccx/index.json b/miniprogram/pages/sydw/tgjsjccx/index.json new file mode 100644 index 0000000..5d68aeb --- /dev/null +++ b/miniprogram/pages/sydw/tgjsjccx/index.json @@ -0,0 +1,6 @@ +{ + "usingComponents": { + "select-search": "/components/select/select-search", + "select": "/components/select/select" + } +} \ No newline at end of file diff --git a/miniprogram/pages/sydw/tgjsjccx/index.wxml b/miniprogram/pages/sydw/tgjsjccx/index.wxml new file mode 100644 index 0000000..5c09e17 --- /dev/null +++ b/miniprogram/pages/sydw/tgjsjccx/index.wxml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + {{item[listTitle[0].itemName]}} + + + + + {{item[item1.itemName]}} + + + + + + + + + 下拉页面可刷新数据 + {{suffixStr}} + + + + \ No newline at end of file diff --git a/miniprogram/pages/sydw/tgjsjccx/index.wxss b/miniprogram/pages/sydw/tgjsjccx/index.wxss new file mode 100644 index 0000000..6398d3a --- /dev/null +++ b/miniprogram/pages/sydw/tgjsjccx/index.wxss @@ -0,0 +1,145 @@ + + +.container { + margin-top: -700rpx; +} +.tit{ + text-align: center; + position: absolute; + top: 200rpx; + left:120rpx ; + width: 500rpx; + height: 100rpx; + line-height: 90rpx; + border-radius: 60rpx; + border: 1rpx solid #fff; + color: #fff; + font-size:40rpx; + font-weight: bold; + +} +.select_wrap { + width:680rpx; + background: #e6bd74; + /* height: 1060rpx; */ + border-radius: 15rpx; + margin: 0 auto; + padding-top: 60rpx; + position: relative; + /* z-index: 1; */ + /* box-shadow: 2px 2px 10px #d4d4d4; */ + margin-bottom: 60rpx; + overflow: hidden; +} + +.offcn_item { + width: 550rpx; + height: 90rpx; + margin: 0 auto 40rpx; +} + +.search_btn { + background-color: #7c101f; + color: #fff; +} + +.result_item { + width: 680rpx; + margin: 0 auto; + border-radius: 20rpx; + background: #fff; + border-radius: 15rpx; + -moz-box-shadow: 0rpx 0rpx 7rpx #d6d7d3; + -webkit-box-shadow: 0rpx 0rpx 7rpx #d6d7d3; + box-shadow: 0rpx 0rpx 7rpx #d6d7d3; + padding: 30rpx; + position: relative; + margin-bottom: 30rpx; +} + +.result_code { + display: block; + font-size: 40rpx; + font-weight: bold; + color: #3b444e; + line-height: 100rpx; + text-align: center; +} + + +.result_detail { + display: block; + font-size: 40rpx; + /* color: #999999; */ + line-height: 49rpx; + background: #f4f8f9; + padding: 20rpx; + border-radius: 10rpx; + text-align: center; + color: #f10; +} + +.item_group { + width: 100%; + padding-top: 20rpx; +} + +.item-group-wrap { + max-height: 0; + transition: all 1s; + overflow: hidden; +} + +.item-group-wrap.active { + max-height: 3000rpx; + transition: all 1s; + overflow: hidden; +} + +.item_line { + justify-content: flex-start; + margin-bottom: 14rpx; + flex-direction: row; + flex-wrap: wrap; + font-size: 36rpx; + line-height: 60rpx; +} + +.item_line label { + color: #c30014; + display: inline-block; + margin-right: 10rpx; + /* 文本两端对齐 */ + text-align-last: justify; + width: 300rpx; +} + +.jiantou { + width: 90%; + position: absolute; + bottom: 0; + display: flex; + align-items: center; + justify-content: center; +} + +.jiantou image { + display: block; + width: 70rpx; + height: 70rpx; + transform: rotate(180deg); +} + +.jiantou image.active { + transition: all 0.2s; + transform: rotate(0); +} + +.item_group .item_line text { + color: #46504f; + display: inline-block; +} + +.resultWrap { + padding-bottom: 100rpx; +}