You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
477 lines
12 KiB
JavaScript
477 lines
12 KiB
JavaScript
// pages/myAgent/index.js
|
|
const app = getApp();
|
|
import dateUtil from "../../utils/dateUtil";
|
|
Page({
|
|
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
roleOf41:false,
|
|
roleOf132:false,
|
|
managerRoleClassify:false,
|
|
chaShowed:false,
|
|
idNull:0,
|
|
isTrigger:false,
|
|
pageBean: {},
|
|
inputShowed: false,
|
|
inputVal: "搜索职位名称",
|
|
recordList: [],
|
|
currIndex: '0',
|
|
phoneDialog:false,
|
|
underReviewNum: "0",
|
|
searchParam: { pageNum: 1, pageSize:20, keys: ''},
|
|
searchParamYFB: { pageNum: 1, pageSize:20, del: 0, keys: '', noticeState: 40,type:3},
|
|
hasReadAll: true,
|
|
isLoading: true,
|
|
hasMoreData: false,
|
|
navlist:10
|
|
},
|
|
|
|
changeactive: function (e) {
|
|
var that = this;
|
|
|
|
that.setData({
|
|
recordList:[],
|
|
idNull:0
|
|
})
|
|
console.log(this.data.idNull);
|
|
|
|
this.data.searchParam.pageNum = 1;
|
|
this.setData({
|
|
navlist: e.mark.ind,
|
|
searchParam: this.data.searchParam,
|
|
// ["searchParam.noticeState"]: e.mark.ind,
|
|
});
|
|
if(e.mark.ind == 10){
|
|
this.getList();
|
|
}else{
|
|
this.getListYFB();
|
|
}
|
|
},
|
|
|
|
changeMenu(e) {
|
|
var that = this;
|
|
wx.showLoading({
|
|
title: '加载中...',
|
|
});
|
|
|
|
that.data.searchParam.pageNum = 1;
|
|
that.data.searchParam.searchTag = e.currentTarget.dataset.id;
|
|
this.setData({
|
|
currIndex: e.currentTarget.dataset.id,
|
|
// idNull:"scId"
|
|
})
|
|
console.log(this.data.idNull);
|
|
|
|
|
|
this.getList();
|
|
},
|
|
|
|
showInput: function () {
|
|
this.setData({
|
|
inputShowed: true,
|
|
chaShowed:false
|
|
});
|
|
},
|
|
hideInput: function () {
|
|
this.setData({
|
|
inputVal: "",
|
|
inputShowed: false
|
|
});
|
|
},
|
|
clearInput: function () {
|
|
console.log(123);
|
|
this.setData({
|
|
chaShowed:false,
|
|
inputVal: "搜索职位名称"
|
|
});
|
|
this.data.recordList = [];
|
|
if(this.data.navlist == 10){
|
|
this.data.searchParam.keys = '';
|
|
this.data.searchParam.pageNum = 1;
|
|
this.getList();
|
|
}else{
|
|
this.data.searchParamYFB.keys = '';
|
|
this.data.searchParamYFB.pageNum = 1;
|
|
this.getListYFB();
|
|
}
|
|
},
|
|
// inputTyping: function(e) {
|
|
// this.setData({
|
|
// inputVal: e.detail.value,
|
|
// });
|
|
// console.log(this.data.inputVal);
|
|
// if (this.data.inputVal == '') {
|
|
// this.data.recordList = [];
|
|
// this.data.searchParam.pageNum = 1;
|
|
// this.data.searchParam.keys = "";
|
|
// this.getList();
|
|
// }
|
|
// },
|
|
searchKey: function (e) {
|
|
console.log(this.data.inputVal);
|
|
this.data.recordList = [];
|
|
if(this.data.navlist == 10){
|
|
this.data.searchParam.keys = this.data.inputVal;
|
|
this.data.searchParam.pageNum = 1;
|
|
this.getList();
|
|
}else{
|
|
this.data.searchParamYFB.keys = this.data.inputVal;
|
|
this.data.searchParamYFB.pageNum = 1;
|
|
this.getListYFB();
|
|
}
|
|
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad: function (options) {
|
|
//this.getLocation();
|
|
var that = this;
|
|
|
|
if(app.isNotEmptyCheck(options.status)){
|
|
console.log(options.status);
|
|
that.setData({
|
|
["searchParam.noticeState"]: options.status,
|
|
navlist:options.status
|
|
});
|
|
|
|
console.log(that.data.navlist);
|
|
|
|
|
|
}
|
|
|
|
// console.log(options.type)
|
|
// that.data.searchParam.channelId = 28;
|
|
that.setData({
|
|
searchParam: that.data.searchParam,
|
|
roleOf41: app.globalData.roleOf41,
|
|
roleOf132: app.globalData.roleOf132,
|
|
managerRoleClassify:app.globalData.managerRoleClassify
|
|
});
|
|
},
|
|
goDetail:function(e){
|
|
var that = this;
|
|
var content = e.currentTarget.dataset.content;
|
|
var yifabu = e.currentTarget.dataset.yifabu;
|
|
var id = e.currentTarget.dataset.id;
|
|
wx.navigateTo({
|
|
// url: '/pages/editAgent/index?agencyId=' + id,
|
|
// url:'/pages/agentDetail/index?agencyId=' + id
|
|
url:'/pages/announceAutoDetail/index?workOrderId=' + content +'&yifabu='+yifabu +'&id='+id
|
|
})
|
|
},
|
|
onScrollToLower:function(){
|
|
if(this.data.navlist == 10){
|
|
this.data.searchParam.pageNum = this.data.searchParam.pageNum + 1;
|
|
this.getList();
|
|
}else{
|
|
this.data.searchParamYFB.pageNum = this.data.searchParamYFB.pageNum + 1;
|
|
this.getListYFB();
|
|
}
|
|
|
|
},
|
|
onScrollRefresh(){
|
|
if(this.data.navlist == 10){
|
|
this.data.recordList = [];
|
|
this.data.searchParam.pageNum = 1;
|
|
this.getList();
|
|
}else{
|
|
this.data.recordList = [];
|
|
this.data.searchParamYFB.pageNum = 1;
|
|
this.getListYFB();
|
|
}
|
|
},
|
|
goSearch(){
|
|
wx.navigateTo({
|
|
url: '../search/index?from=announceAuto',
|
|
})
|
|
},
|
|
getListYFB: function () {
|
|
var that = this;
|
|
wx.showLoading({
|
|
title: "加载中",
|
|
});
|
|
that.setData({
|
|
isLoading: true
|
|
});
|
|
that.data.searchParamYFB.keys = that.data.inputVal == '搜索职位名称' ? '' : that.data.inputVal;
|
|
wx.request({
|
|
url: app.globalData.ip + '/cms/notice/list',
|
|
data: that.data.searchParamYFB,
|
|
header: app.globalData.header,
|
|
method: "GET",
|
|
success: function (res) {
|
|
console.log(res.data);
|
|
if (res.data.status == 200) {
|
|
that.setData({
|
|
isLoading: false,
|
|
// underReviewNum: res.data.data.checking
|
|
});
|
|
res.data.data.pageBean.recordList.forEach(item => {
|
|
item['updateTimeStr'] = dateUtil.timeShowXXX(item.updateTime);
|
|
item['jobName'] = item.title;
|
|
item['jobDesp2'] = item.content
|
|
item['jobDesp'] = item.content.replace(/\*\*\*\*\*/g,"");
|
|
});
|
|
if (res.data.data.pageBean.recordList != null && res.data.data.pageBean.recordList.length > 0 && that.data.navlist == 40 ) {
|
|
res.data.data.pageBean.recordList.forEach(item => {
|
|
if(app.isEmptyCheck(item.updateTime)){
|
|
item['updateTimeStr'] = '-年-月-日'
|
|
}else{
|
|
item['updateTimeStr'] = dateUtil.timeShowXXX(item.updateTime);
|
|
}
|
|
});
|
|
}else if(res.data.data.pageBean.recordList != null && res.data.data.pageBean.recordList.length > 0 && that.data.navlist == 30) {
|
|
res.data.data.pageBean.recordList.forEach(item => {
|
|
if(app.isEmptyCheck(item.updateTime)){
|
|
item['updateTimeStr'] = '-年-月-日'
|
|
}else{
|
|
item['updateTimeStr'] = dateUtil.timeAfter(item.robotTime);
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
if (res.data.data.pageBean.recordList != null && res.data.data.pageBean.recordList.length < 20) {
|
|
var recordListTemp = res.data.data.pageBean.recordList;
|
|
that.data.recordList = that.data.recordList.concat(recordListTemp);
|
|
|
|
that.setData({
|
|
hasMoreData: false
|
|
});
|
|
} else {
|
|
var recordListTemp = res.data.data.pageBean.recordList;
|
|
that.data.recordList = that.data.recordList.concat(recordListTemp);
|
|
|
|
|
|
that.setData({
|
|
hasMoreData: true
|
|
});
|
|
}
|
|
|
|
that.setData({
|
|
recordList: that.data.recordList,
|
|
isLoading: false,
|
|
isTrigger:false,
|
|
});
|
|
if (res.data.data.pageBean.recordList != null && res.data.data.pageBean.recordList.length < 20) {
|
|
that.setData({
|
|
hasMoreData: false
|
|
});
|
|
} else {
|
|
that.setData({
|
|
hasMoreData: true
|
|
});
|
|
}
|
|
wx.hideLoading();
|
|
} else {
|
|
app.showTips(that, res.data.msg);
|
|
wx.hideLoading();
|
|
}
|
|
|
|
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
})
|
|
},
|
|
getList: function () {
|
|
var that = this;
|
|
wx.showLoading({
|
|
title: "加载中",
|
|
});
|
|
that.setData({
|
|
isLoading: true
|
|
});
|
|
that.data.searchParam.keys = that.data.inputVal == '搜索职位名称' ? '' : that.data.inputVal;
|
|
wx.request({
|
|
url: app.globalData.ip + '/store/job/findPublicNoticeList',
|
|
data: that.data.searchParam,
|
|
header: app.globalData.header,
|
|
method: "GET",
|
|
success: function (res) {
|
|
console.log(res.data);
|
|
if (res.data.status == 200) {
|
|
that.setData({
|
|
isLoading: false,
|
|
});
|
|
res.data.data.list.forEach(item => {
|
|
item['updateTimeStr'] = dateUtil.timeShowXXX(item.updateTime);
|
|
item['jobDesp2'] = item.jobDesp
|
|
item['jobDesp'] = item.jobDesp.replace(/\*\*\*\*\*/g,"");
|
|
});
|
|
|
|
if (res.data.data.list != null && res.data.data.list.length < 20) {
|
|
var recordListTemp = res.data.data.list;
|
|
that.data.recordList = that.data.recordList.concat(recordListTemp);
|
|
|
|
that.setData({
|
|
hasMoreData: false
|
|
});
|
|
} else {
|
|
var recordListTemp = res.data.data.list;
|
|
that.data.recordList = that.data.recordList.concat(recordListTemp);
|
|
|
|
|
|
that.setData({
|
|
hasMoreData: true
|
|
});
|
|
}
|
|
|
|
that.setData({
|
|
recordList: that.data.recordList,
|
|
isLoading: false,
|
|
isTrigger:false,
|
|
});
|
|
if (res.data.data.list != null && res.data.data.list.length < 20) {
|
|
that.setData({
|
|
hasMoreData: false
|
|
});
|
|
} else {
|
|
that.setData({
|
|
hasMoreData: true
|
|
});
|
|
}
|
|
wx.hideLoading();
|
|
} else {
|
|
app.showTips(that, res.data.msg);
|
|
wx.hideLoading();
|
|
}
|
|
|
|
|
|
},
|
|
fail: function (res) {
|
|
console.log(res);
|
|
}
|
|
})
|
|
},
|
|
close: function () {
|
|
this.setData({
|
|
phoneDialog:false,
|
|
})
|
|
},
|
|
makePhone:function(e){
|
|
var that = this;
|
|
|
|
console.log(e);
|
|
that.setData({
|
|
phoneDialog:true,
|
|
phone:e.currentTarget.dataset.phone
|
|
})
|
|
|
|
// wx.makePhoneCall({
|
|
// phoneNumber: e.currentTarget.dataset.phone
|
|
// });
|
|
},
|
|
makePhoneCall:function(e){
|
|
var that = this;
|
|
wx.makePhoneCall({
|
|
phoneNumber: that.data.phone
|
|
});
|
|
},
|
|
bindCode:function(e){
|
|
console.log(e)
|
|
wx.navigateToMiniProgram({
|
|
appId: 'wxb1f7c694803f6f00', //appid
|
|
path: '/pages/scanQrcode/index?agencyUserId=' + e.currentTarget.dataset.userid,//path
|
|
extraData: { //参数
|
|
agencyUserId: e.currentTarget.dataset.userid
|
|
},
|
|
envVersion: 'release', //develop 开发版 trial 体验版 release 正式版
|
|
success(res) {
|
|
console.log('成功')
|
|
// 打开成功
|
|
}
|
|
})
|
|
|
|
},
|
|
tounderReview() {
|
|
// console.log(new Date().getTime());
|
|
|
|
wx.setStorageSync('state1Time',new Date().getTime());
|
|
wx.setStorageSync('state1',0);
|
|
wx.navigateTo({
|
|
url: "/pages/myProject/index?state=3",
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面初次渲染完成
|
|
*/
|
|
onReady: function () {
|
|
|
|
},
|
|
setCopy(e){
|
|
var that = this;
|
|
wx.setClipboardData({
|
|
data: e.currentTarget.dataset.content,
|
|
success (res) {
|
|
wx.getClipboardData({
|
|
success (res) {
|
|
console.log(res.data) // data
|
|
wx.showToast({
|
|
title: '内容已复制',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
|
|
}
|
|
})
|
|
}
|
|
})
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow: function () {
|
|
var that = this;
|
|
that.setData({
|
|
recordList:[],
|
|
underReviewNum:wx.getStorageSync('state1')
|
|
})
|
|
// console.log(wx.getStorageSync('state1'))
|
|
that.setData({
|
|
isLoading: false,
|
|
// underReviewNum: res.data.data.checking
|
|
});
|
|
this.getList();
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面隐藏
|
|
*/
|
|
onHide: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面卸载
|
|
*/
|
|
onUnload: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
|
*/
|
|
onPullDownRefresh: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 页面上拉触底事件的处理函数
|
|
*/
|
|
onReachBottom: function () {
|
|
|
|
},
|
|
|
|
/**
|
|
* 用户点击右上角分享
|
|
*/
|
|
onShareAppMessage: function () {
|
|
|
|
}
|
|
}) |