1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204 |
- const app = getApp(), utils = require("../../utils/http");
- const util = require("../../utils/util");
- let casepage = 1, articlepage = 1, videopage = 1, evidencepage = 1, page = 1,time = 0,timer = null,showflag=true;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- top: app.globalData.statusBarHeight,
- hgt: app.globalData.titleBarHeight,
- loginFlag: true,
- phoneflag: false,
- share_user_id: '0',
- topname: '',
- toparea: '',
- imgUrl: app.globalData.imgUrl,
- personobj: {},
- casetype: [],
- nowcasebtn: '',
- caselist: [],
- guidetext: '',
- videolist: [],
- mobilephone: '',
- alertflag: false,
- loginform: false,
- canIUseGetUserProfile: false,
- weboffer: [],
- articlelist: [],
- type: '1',
- leftcaselist: [],
- rightcaselist: [],
- leftarticlelist: [],
- rightarticlelist: [],
- leftvideolist: [],
- rightvideolist: [],
- evidencelist: [],
- leftevidencelist: [],
- rightevidencelist: [],
- shareobj: {},
- passflag: false,
- indextitle: '微官网',
- type: 'updatetime',//hot 最热, updatetime最新
- indexlist: [],
- unfutureflag: false,
- companyobj: {},
- nowstate: 0,
- datashow: false,
- linkType: '',
- paramsId: '',
- firstload: false,
- officeType: '',
- curId: '',
- prelook:'',
- timeline:app.globalData.timeline,
- jumpType: '',
- jumpId: "",
- jumpPage: "",
- buildingId: ""
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- var that = this;
- if(options.timeline=='share'){
- this.setData({
- prelook:'125',
- timeline:app.globalData.timeline
- })
- }
- if (!!options.state) {
- this.setData({
- nowstate: options.state
- })
- }
- time = 0;
- if (wx.getUserProfile) {
- this.setData({
- canIUseGetUserProfile: true
- })
- }
- that.setData({
- top: app.globalData.statusBarHeight,
- hgt: app.globalData.titleBarHeight,
- })
- if (!!options.clientype) {
- app.globalData.clientype = options.clientype;
- if (!!options.share_user_id) {
- that.setData({
- share_user_id: options.share_user_id
- })
- app.globalData.shareuserid = options.share_user_id;
- }
- if (options.office_type) {
- that.setData({
- officeType: options.office_type
- })
- }
- if (!!options.cid) {
- that.setData({
- curId: options.cid
- })
- }
- if (!!options.jump) {
- this.setData({
- jumpType: options.jump,
- jumpPage: options.page,
- jumpId: options.cid
- })
- }
- if (!!options.bid) {
- this.setData({
- buildingId: options.bid
- })
- }
- that.login();
- } else {
- if (!!options.scene) {
- let params = this.handleParams(decodeURIComponent(options.scene));
- if (!!params.cli) {
- app.globalData.clientype = params.cli;
- }
- if (!!params.t) {
- that.setData({
- linkType: params.t
- })
- }
- if (!!params.id) {
- that.setData({
- paramsId: params.id
- })
- }
- }
- if (!!options.share_user_id) {
- that.setData({
- share_user_id: options.share_user_id
- })
- app.globalData.shareuserid = options.share_user_id;
- }
- that.login();
- }
- },
- handleParams: function (params) {
- let data = {};
- let p = params.split('&');
- for (var i = 0; i < p.length; i++) {
- let p1 = p[i].split('=');
- data[p1[0]] = p1[1];
- }
- return data;
- },
- videodecoratetap: function (e) {
- // '/customer/pages/videodecorate/videodecorate'
- wx.navigateTo({
- url: '/customer/pages/designerlist/designerlist'
- })
- },
- toViewBuilding () {
- wx.navigateTo({
- url: '/share/pages/buildinglist/buildinglist?ctp=' + app.globalData.clientype + '&uid=' + app.globalData.shareuserid+'&type=3&index=1',
- })
- },
- prelookimgtap() {
- if (!app.globalData.sharepersonobj.qrcode) {
- wx.showToast({
- title: "当前专属客服的二维码为空!",
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- wx.previewImage({
- current: app.globalData.imgUrl + app.globalData.sharepersonobj.qrcode, // 当前显示图片的http链接
- urls: [app.globalData.imgUrl + app.globalData.sharepersonobj.qrcode]// 需要预览的图片http链接列表
- })
- },
- sharecompany: function () {
- const that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/content_belong_company',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- client_type: app.globalData.clientype,
- uid: app.globalData.shareuserid
- },
- success: function (res) {
- if (res.data.code == '0') {
- app.globalData.currentUserId=res.data.data.employee_id;
- }
- },
- complete(res) {
- wx.hideLoading()
- }
- })
- },
- login: function () {
- var that = this;
- wx.showLoading({
- title: '加载中...'
- });
- wx.login({
- success: function (data) {
- if (data.errMsg == 'login:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/code2sessionmini',
- data: {
- code: data.code,
- share: app.globalData.shareuserid,
- client_type:app.globalData.clientype
- },
- success: function (r) {
- if (r.data.code == '0') {
- app.globalData.companyobj = r.data.company_data;
- app.globalData.companyname = r.data.company_data.company_name;
- app.globalData.token = r.data.token;
- app.globalData.official_openid = r.data.official_openid;
- app.globalData.agentEmployeEid = r.data.agent_employee_id;
- app.globalData.vrString = r.data.str||"";
- that.setData({
- companyobj: r.data.company_data
- })
- if (!!r.data.company_data && r.data.company_data.client_type) {
- app.globalData.clientype = r.data.company_data.client_type;
- }
-
- if (!!r.data.share) {
- app.globalData.shareperson = r.data.share;
- app.globalData.sharename = r.data.share.name;
- app.globalData.sharepersonobj = r.data.share;
- that.setData({
- mobilephone: r.data.share.phone,
- shareobj: r.data.share,
- indextitle: r.data.share.name?r.data.share.name:r.data.share.nickname + '的微官网',
- share_user_id: r.data.share.id,
- })
- that.sharecompany();
- util.toolfun(6);
- } else {
- that.setData({
- indextitle: r.data.company + '微官网',
- })
- }
- that.getCurAgentName();
- that.indexfun();
- // phone有没有,有的话,不用授权,
- if (!!r.data.user.phone) {
- if(that.data.share_user_id){
- that.setData({
- share_user_id: r.data.user.id,
- })
- }
- if (!r.data.share){
- that.setData({
- indextitle: (!!r.data.user.binded?!r.data.user.binded.name?r.data.user.nickname+'的':r.data.user.binded.name+'的':'') + '微官网'
- })
- }
- if (!!r.data.user.binded && r.data.user.binded.state == '待审核') {
- that.setData({
- passflag: true
- })
- } else {
- that.setData({
- passflag: false
- })
- }
- app.globalData.personMsg = r.data.user;
- app.globalData.use_id = r.data.user.id;
- that.setData({
- personobj: r.data.user
- })
- that.setData({
- phoneflag: false
- })
- app.globalData.phone = true;//有手机号
- that.setData({
- firstload: true
- })
- if (!!r.data.user.binded && r.data.user.binded.state == '在职' && that.data.nowstate != 1) {
- app.globalData.currentUserId = r.data.user.binded.id;
- if (that.data.jumpType == 'app') {
- if (that.data.jumpPage == 'building') {
- wx.reLaunch({
- url: '/index/pages/progressdetail/progressdetail?cid=' + that.data.jumpId,
- })
- } else if (that.data.jumpPage == 'housetype') {
- wx.reLaunch({
- url: '/index/pages/housetype/housetype?cid=' + that.data.jumpId + '&buildId=' + that.data.buildingId,
- })
- } else if (that.data.jumpPage == 'materialcase') {
- wx.reLaunch({
- url: '/index/pages/casemsg/casemsg?cid=' + that.data.jumpId,
- })
- } else if (that.data.jumpPage == 'construct') {
- wx.reLaunch({
- url: '/customer/pages/sitemsg/sitemsg?cid=' + that.data.jumpId + '&type=2',
- })
- }
- } else if (that.data.officeType) {
- if (that.data.officeType == 'allocation') {
- wx.reLaunch({
- url: '/pages/customer/customer?type=1',
- })
- } else if (that.data.officeType == 'cread') {
- wx.reLaunch({
- url: '/mycustomer/pages/customermsg/customermsg?cid=' + that.data.curId,
- })
- } else if (that.data.officeType == 'clue_radar') {
- wx.reLaunch({
- url: '/mycustomer/pages/guestclues/guestclues',
- })
- } else if (that.data.officeType == 'share_c') {
- wx.reLaunch({
- url: '/pages/other/other?type=22',
- })
- }
- } else if (r.data.camp == 1) {
- wx.reLaunch({
- url: '/pages/other/other?type=32',
- })
- } else if (!!that.data.linkType && !!that.data.paramsId) {
- setTimeout(() => {
- wx.navigateTo({
- url: '/pages/other/other?type=11' + '&tid=' + that.data.paramsId
- })
- }, 1000)
- } else {
- wx.switchTab({
- url: '/pages/consoledesk/consoledesk',
- })
- }
- } else {
- if (r.data.isagent && !r.data.user.binded && that.data.nowstate != 1) {
- app.globalData.brokeruserId = r.data.isagent;
- wx.reLaunch({
- url: '/customer/pages/brokerindex/brokerindex',
- })
- }
- }
- wx.hideLoading();
- } else {
- wx.hideLoading();
- that.setData({
- loginFlag: false,
- phoneflag: true
- })
- app.globalData.phone = false;//没有手机号
- }
- }
- }
- })
- }
- }
- })
- },
- callcompanytap() {
- if (!app.globalData.companyobj.tel) {
- wx.showToast({
- title: '公司电话没有填写!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- wx.makePhoneCall({
- phoneNumber: app.globalData.companyobj.tel
- })
- },
- closetap: function () {
- this.setData({
- passflag: false,
- unfutureflag: false
- })
- },
- setitletap: function (e) {
- this.setData({
- type: e.currentTarget.dataset.type
- })
- if (e.currentTarget.dataset.type == 1) {
- this.caselistfun();
- } else if (e.currentTarget.dataset.type == 2) {
- this.articlelist();
- } else if (e.currentTarget.dataset.type == 3) {
- // this.videofun();
- } else if (e.currentTarget.dataset.type == 4) {
- this.evidencefun();
- }
- },
- evidencefun: function () {
- const that = this;
- evidencepage = 1;
- utils.$get({
- url: app.globalData.webUrl + 'client/evidencelist',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- uid: '',
- page: 1,
- cate: '',
- keyword: ''
- },
- success: function (res) {
- wx.stopPullDownRefresh();
- if (res.data.code == '0') {
- that.setData({
- evidencelist: res.data.data,
- leftevidencelist: [],
- rightevidencelist: [],
- })
- that.imgload();
- }
- }
- })
- },
- imgload: function () {
- var that = this;
- var leftlist = that.data.leftevidencelist;
- var rightlist = that.data.rightevidencelist;
- var indexlist = that.data.evidencelist;
- if (indexlist.length == 0) {
- return false;
- }
- if (leftlist.length == 0) {
- leftlist.push(indexlist[0]);
- indexlist.shift();
- that.setData({
- evidencelist: indexlist,
- leftevidencelist: leftlist,
- rightevidencelist: rightlist
- })
- } else {
- var leftheight, rightheight;
- const query = wx.createSelectorQuery()
- query.select('.leftcaselistbox').boundingClientRect();
- query.exec(function (res) {
- leftheight = res[0].height;
- const queryright = wx.createSelectorQuery()
- queryright.select('.rightcaselistbox').boundingClientRect();
- queryright.exec(function (rs) {
- leftlist = that.data.leftevidencelist;
- rightlist = that.data.rightevidencelist;
- indexlist = that.data.evidencelist;
- rightheight = rs[0].height;
- if (leftheight <= rightheight) {
- leftlist.push(indexlist[0]);
- indexlist.shift();
- } else {
- rightlist.push(indexlist[0]);
- indexlist.shift();
- }
- that.setData({
- evidencelist: indexlist,
- leftevidencelist: leftlist,
- rightevidencelist: rightlist
- })
- })
- })
- }
- },
- indextap: function () {
- wx.switchTab({
- url: '/pages/consoledesk/consoledesk',
- })
- },
- appointap: function () {
- wx.navigateTo({
- url: '/pages/appoint/appoint',
- })
- },
- housestyleBtn: function () {
- this.setData({
- unfutureflag: true
- })
- // wx.navigateTo({
- // url: "/pages/beforetest/beforetest?type=housestyle&share_user_id="+this.data.share_user_id
- // });
- },
- casetotap: function () {
- // '/customer/pages/decoratecase/decoratecase?share_user_id='+this.data.share_user_id,
- wx.navigateTo({
- url: '/customer/pages/site/site'
- })
- },
- findcustomertoolTap: function (e) {
- wx.navigateTo({
- url: '/pages/networktool/networktool?share_user_id=' + this.data.share_user_id,
- })
- },
- callphonetap: function () {
- wx.makePhoneCall({
- phoneNumber: this.data.shareobj.phone
- })
- },
- guidetotap: function () {
- wx.navigateTo({
- url: '/pages/decorateguide/decorateguide?share_user_id=' + this.data.share_user_id,
- })
- },
- casetap: function (e) {
- wx.navigateTo({
- url: '/pages/decorateguidemsg/decorateguidemsg?cid=' + e.currentTarget.dataset.cid,
- })
- },
- articletap: function (e) {
- wx.navigateTo({
- url: '/customer/pages/decoratecasemsg/decoratecasemsg?aid=' + e.currentTarget.dataset.cid
- })
- },
- figurepricetap: function () {
- wx.navigateTo({
- url: '/customer/pages/figureprice/figureprice?share_user_id=' + this.data.share_user_id,
- })
- },
- signtap: function () {
- wx.navigateTo({
- url: '/customer/pages/findesign/findesign?share_user_id=' + this.data.share_user_id,
- })
- },
- oldreform: function () {
- wx.navigateTo({
- url: '/customer/pages/reform/reform?share_user_id=' + this.data.share_user_id,
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function (options) {
- },
- onPlay: function () {
- },
- onPlayNav: function () {
- },
- onShow: function () {
- this.setData({
- top: app.globalData.statusBarHeight,
- hgt: app.globalData.titleBarHeight,
- timeline:app.globalData.timeline
- })
- if(app.globalData.shareuserid){
- timer = setInterval(function () {
- time = time * 1 + 1;
- }, 1000)
- }
- if(app.globalData.timeline==2){
- wx.hideLoading()
- }
- if(!showflag){
- this.caseimgload();
- }
- showflag=true;
- },
- hotap: function () {
- this.setData({
- type: "updatetime"
- })
- this.indexfun();
- },
- newtap: function () {
- this.setData({
- type: "hot"
- })
- this.indexfun();
- },
- indexfun: function () {
- const that = this;
- page = 1;
- that.setData({
- firstload: true
- })
- utils.$get({
- url: app.globalData.webUrl + 'client/index/recommend',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- page: 1,
- limit: 10,
- type: that.data.type,//hot 最热, updatetime最新
- },
- success: function (res) {
- that.setData({
- datashow: true
- })
- if (res.data.code == '0') {
- that.setData({
- indexlist: res.data.data,
- leftcaselist: [],
- rightcaselist: [],
- })
- }
- that.caseimgload();
- wx.hideLoading()
- }, fail() {
- wx.hideLoading()
- }
- })
- },
- getCurAgentName: function () {
- const that = this;
- utils.$get({
- url: app.globalData.webUrl + 'api/agents/get_agent_name',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {},
- success: function (res) {
- if (res.data.code == '0') {
- app.globalData.agentName = res.data.name;
- }
- }
- })
- },
- caseimgload: function () {
- var that = this;
- var leftcaselist = that.data.leftcaselist;
- var rightcaselist = that.data.rightcaselist;
- var indexlist = that.data.indexlist;
- if (indexlist.length == 0) {
- return false;
- }
- let casemsg = indexlist[0];
- if (!casemsg) {
- that.setData({
- indexlist: [],
- })
- return false;
- }
- if (leftcaselist.length == 0) {
- leftcaselist.push(casemsg);
- indexlist.shift();
- that.setData({
- indexlist: indexlist,
- leftcaselist: leftcaselist,
- rightcaselist: rightcaselist
- })
- } else {
- var leftheight, rightheight;
- const query = wx.createSelectorQuery()
- query.select('.leftcaselistbox').boundingClientRect();
- query.exec(function (res) {
- if (!res[0]) {
- return false;
- }
- leftheight = res[0].height;
- const queryright = wx.createSelectorQuery()
- queryright.select('.rightcaselistbox').boundingClientRect();
- queryright.exec(function (rs) {
- leftcaselist = that.data.leftcaselist;
- rightcaselist = that.data.rightcaselist;
- rightheight = rs[0].height;
- if (leftheight <= rightheight) {
- leftcaselist.push(casemsg);
- indexlist.shift();
- } else {
- rightcaselist.push(casemsg);
- indexlist.shift();
- }
- that.setData({
- indexlist: indexlist,
- leftcaselist: leftcaselist,
- rightcaselist: rightcaselist
- })
- })
- })
- }
- },
- videofun: function () {
- var that = this;
- videopage = 1;
- utils.$post({
- url: app.globalData.webUrl + 'client/video/list',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- type: '',
- page: 1,
- limit: "10",
- user_id: ''
- },
- success: function (res) {
- wx.hideLoading();
- if (res.data.code == '0') {
- that.setData({
- videolist: res.data.data,
- leftvideolist: [],
- rightvideolist: []
- })
- that.videoimgload();
- }
- }
- })
- },
- videoimgload: function () {
- var that = this;
- var leftvideolist = that.data.leftvideolist;
- var rightvideolist = that.data.rightvideolist;
- var videolist = that.data.videolist;
- if (videolist.length == 0) {
- return false;
- }
- let articlemsg = videolist[0];
- if (!articlemsg) {
- that.setData({
- videolist: [],
- })
- return false;
- }
- if (leftvideolist.length == 0) {
- leftvideolist.push(articlemsg);
- videolist.shift();
- that.setData({
- videolist: videolist,
- leftvideolist: leftvideolist,
- rightvideolist: rightvideolist
- })
- } else {
- var leftheight, rightheight;
- const query = wx.createSelectorQuery()
- query.select('.leftcaselistbox').boundingClientRect();
- query.exec(function (res) {
- leftheight = res[0].height;
- const queryright = wx.createSelectorQuery()
- queryright.select('.rightcaselistbox').boundingClientRect();
- queryright.exec(function (rs) {
- leftvideolist = that.data.leftvideolist;
- rightvideolist = that.data.rightvideolist;
- rightheight = rs[0].height;
- if (leftheight <= rightheight) {
- leftvideolist.push(articlemsg);
- videolist.shift();
- } else {
- rightvideolist.push(articlemsg);
- videolist.shift();
- }
- that.setData({
- videolist: videolist,
- leftvideolist: leftvideolist,
- rightvideolist: rightvideolist
- })
- })
- })
- }
- },
- guidetap: function (e) {
- this.setData({
- guidetext: e.currentTarget.dataset.type
- })
- this.caselistfun();
- },
- caselistfun: function () {
- var that = this;
- casepage = 1;
- utils.$get({
- url: app.globalData.webUrl + 'client/caselist',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- uid: '',
- page: 1,
- commu_id: '',// 小区id
- style_id: '',//风格id
- square_start: '',//面积开始值
- square_end: '',//面积结束值
- keyword: ''
- },
- success: function (res) {
- that.setData({
- datashow: true
- })
- if (res.data.code == '0') {
- that.setData({
- caselist: res.data.data,
- leftcaselist: [],
- rightcaselist: [],
- })
- }
- that.caseimgload();
- wx.hideLoading()
- }, fail() {
- wx.hideLoading()
- }
- })
- },
- articlelist: function () {
- var that = this;
- articlepage = 1;
- utils.$post({
- url: app.globalData.webUrl + 'client/article/list',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- type: "",
- label: '',
- page: 1,
- limit: "10",
- keyword: ''
- },
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- articlelist: res.data.data,
- leftarticlelist: [],
- rightarticlelist: [],
- })
- that.articleimgload();
- }
- }
- })
- },
- articleimgload: function () {
- var that = this;
- var leftarticlelist = that.data.leftarticlelist;
- var rightarticlelist = that.data.rightarticlelist;
- var articlelist = that.data.articlelist;
- if (articlelist.length == 0) {
- return false;
- }
- let articlemsg = articlelist[0];
- if (!articlemsg) {
- that.setData({
- articlelist: [],
- })
- return false;
- }
- if (leftarticlelist.length == 0) {
- leftarticlelist.push(articlemsg);
- articlelist.shift();
- that.setData({
- articlelist: articlelist,
- leftarticlelist: leftarticlelist,
- rightarticlelist: rightarticlelist
- })
- } else {
- var leftheight, rightheight;
- const query = wx.createSelectorQuery()
- query.select('.leftcaselistbox').boundingClientRect();
- query.exec(function (res) {
- leftheight = res[0].height;
- const queryright = wx.createSelectorQuery()
- queryright.select('.rightcaselistbox').boundingClientRect();
- queryright.exec(function (rs) {
- leftarticlelist = that.data.leftarticlelist;
- rightarticlelist = that.data.rightarticlelist;
- rightheight = rs[0].height;
- if (leftheight <= rightheight) {
- leftarticlelist.push(articlemsg);
- articlelist.shift();
- } else {
- rightarticlelist.push(articlemsg);
- articlelist.shift();
- }
- that.setData({
- articlelist: articlelist,
- leftarticlelist: leftarticlelist,
- rightarticlelist: rightarticlelist
- })
- })
- })
- }
- },
- videomsgtap: function (e) {
- wx.navigateTo({
- url: '/pages/networkvideo/networkvideo?vid=' + e.currentTarget.dataset.vid
- })
- },
- evitap: function (e) {
- wx.navigateTo({
- url: '/customer/pages/publicpraisemsg/publicpraisemsg?eid=' + e.currentTarget.dataset.cid
- })
- },
- publicpraisetap: function (e) {
- wx.navigateTo({
- url: '/customer/pages/publicpraise/publicpraise'
- })
- },
- submittap: function () {
- var that = this;
- if (that.data.loginform) {
- wx.showToast({
- title: '不能重复报名!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- if (!that.data.topname) {
- wx.showToast({
- title: '姓名不能为空!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- if (!that.data.toparea) {
- wx.showToast({
- title: '面积不能为空!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- this.applyinput();
- },
- getUserProfile: function () {
- var that = this;
- if (!that.data.topname) {
- wx.showToast({
- title: '姓名不能为空!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- if (!that.data.toparea) {
- wx.showToast({
- title: '面积不能为空!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- wx.getUserProfile({
- lang: 'zh_CN',
- desc: '为了更好的体验申请获取以下信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
- success: (res) => {
- if (res.errMsg == 'getUserProfile:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/setUserInfo',
- data: {
- encryptedData: res.encryptedData,
- iv: res.iv,
- rawData: res.rawData,
- signature: res.signature,
- },
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- success: function (r) {
- if (r.data.code == '0') {
- that.setData({
- loginFlag: false
- })
- app.globalData.userflag = false;//有个人信息
- wx.showToast({
- title: '点击立即计算获取报价',
- icon: 'none',
- duration: 2000
- })
- } else {
- that.setData({
- loginFlag: true
- })
- }
- }
- })
- } else {
- that.setData({
- loginFlag: true
- })
- }
- }
- })
- },
- getUserInfoTap: function (res) {
- var that = this;
- if (!that.data.topname) {
- wx.showToast({
- title: '姓名不能为空!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- if (!that.data.toparea) {
- wx.showToast({
- title: '面积不能为空!',
- icon: 'none',
- duration: 2000
- })
- return false;
- }
- if (res.detail.errMsg == 'getUserInfo:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/setUserInfo',
- data: {
- encryptedData: res.detail.encryptedData,
- iv: res.detail.iv,
- rawData: res.detail.rawData,
- signature: res.detail.signature,
- },
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- success: function (r) {
- if (r.data.code == '0') {
- that.setData({
- loginFlag: false,
- })
- app.globalData.userflag = false;//有个人信息
- wx.showToast({
- title: '点击立即计算获取报价',
- icon: 'none',
- duration: 2000
- })
- } else {
- that.setData({
- loginFlag: true
- })
- }
- }
- })
- } else {
- that.setData({
- loginFlag: true
- })
- }
- },
- getPhoneNumberTap: function (res) {
- var that = this;
- if (res.detail.errMsg == 'getPhoneNumber:ok') {
- utils.$post({
- url: app.globalData.webUrl + 'api/users/setUserMobile',
- data: {
- encryptedData: res.detail.encryptedData,
- iv: res.detail.iv
- },
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- success: function (r) {
- if (r.data.code == '0') {
- that.login();
- app.globalData.phone = true;
- app.globalData.personMsg.phone = r.data.mobile;
- that.applyinput();
- }
- }
- })
- }
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- showflag=false;
- if(app.globalData.shareuserid){
- if (timer) {
- clearInterval(timer)
- }
- this.setimetap();
- }
- },
- openVRLink(e) {
- let vrlink = e.currentTarget.dataset.vrlink;
- let id = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/other/other?type=vr&vrurl=' + escape(vrlink) + '&cty=materialCase' + '&uid=' + app.globalData.shareuserid + '&ctp=' + app.globalData.clientype + '&aid=' + id,
- })
- },
- setimetap(){
- const that = this;
- utils.$post({
- url: app.globalData.webUrl + 'client/index/visit_due_time',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: app.globalData.currentUserId,
- pipe_type: 'toolAll',
- time: time,
- },
- success: function (res) {
- }
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- if(app.globalData.shareuserid){
- this.setimetap();
- }
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- const that = this;
- if(app.globalData.timeline==2){
- return false;
- }
- page = 1;
- this.login();
- let time=setTimeout(function () {
- wx.stopPullDownRefresh()
- clearTimeout(time)
- }, 1000)
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- const that = this;
- page = page + 1;
- utils.$get({
- url: app.globalData.webUrl + 'client/index/recommend',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- page: page,
- limit: 10,
- type: that.data.type,//hot 最热, updatetime最新
- },
- success: function (res) {
- if (res.data.code == '0') {
- let arrflag = false, indexlist = that.data.indexlist;
- if (indexlist.length != 0) {
- arrflag = true;
- }
- indexlist = indexlist.concat(res.data.data)
- that.setData({
- indexlist: indexlist,
- })
- if (!arrflag) {
- that.caseimgload();
- }
- }
- wx.hideLoading()
- }, fail() {
- wx.hideLoading()
- }
- })
- },
- addsharetap: function (type) {
- let that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: '0',
- type: type,
- },
- success: function (r) {}
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- let real = '';
- wx.showShareMenu({
- withShareTicket: true,
- menus: ['shareAppMessage', 'shareTimeline']
- })
- if (!!app.globalData.personMsg.binded && !!app.globalData.personMsg.binded.name) {
- real = app.globalData.personMsg.binded.name + '的微官网'
- } else {
- real = this.data.indextitle;
- }
- this.addsharetap('weiwang');
- return {
- title: real,
- imageUrl: 'https://o.nczyzs.com/xcx/xcxweiw.jpg',
- path: '/pages/index/index?type=share&share_user_id=' + (this.data.share_user_id?this.data.share_user_id:app.globalData.personMsg.id) + '&clientype=' + app.globalData.clientype+"&state=1"
- }
- },
- onShareTimeline: function () {
- let real = '';
- if (!!app.globalData.personMsg.binded && !!app.globalData.personMsg.binded.name) {
- real = app.globalData.personMsg.binded.name + '的微官网'
- } else {
- real = this.data.indextitle;
- }
- this.addsharetap('weiwang');
- return {
- title: real,
- imageUrl: app.globalData.imgUrl +'xcx/xcxweiw.jpg',
- query: 'type=share&share_user_id=' + (this.data.share_user_id?this.data.share_user_id:app.globalData.personMsg.id) + '&clientype=' + app.globalData.clientype+"&state=1&timeline=share"
- }
- }
- })
|