12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172 |
- 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;
- 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: [],
- shareflag: true,
- articlelist: [],
- type: '1',
- leftcaselist: [],
- rightcaselist: [],
- leftarticlelist: [],
- rightarticlelist: [],
- leftvideolist: [],
- rightvideolist: [],
- evidencelist: [],
- leftevidencelist: [],
- rightevidencelist: [],
- shareobj: {},
- passflag: false,
- indextitle: '微官网',
- type: 'updatetime',//hot 最热, updatetime最新
- indexlist: [],
- unfutureflag: false,
- companyobj: {},
- footflag: false,
- nowstate: 0,
- datashow: false,
- linkType: '',
- paramsId: '',
- firstload: false,
- officeType: '',
- curId: '',
- prelook:'',
- timeline:app.globalData.timeline
- },
- /**
- * 生命周期函数--监听页面加载
- */
- 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.type) {
- that.setData({
- shareflag: false
- })
- }
- if (options.office_type) {
- that.setData({
- officeType: options.office_type
- })
- }
- if (!!options.cid) {
- that.setData({
- curId: options.cid
- })
- }
- 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;
- }
- if (!!options.type) {
- that.setData({
- shareflag: false
- })
- }
- 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',
- })
- },
- 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/code2session',
- 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;
- 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.indexfun();
- if (r.data.user != null && (!!r.data.user.headimgurl && r.data.user.headimgurl != "" || !!r.data.user.nickname && r.data.user.nickname != "" && r.data.user.nickname != '游客')) {
- 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
- })
- }
- if (!r.data.share && (!r.data.user.binded || (!!r.data.user.binded && r.data.user.binded.state != '在职'))) {
- that.setData({
- footflag: true,
- })
- } else {
- that.setData({
- footflag: false,
- })
- }
- 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.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 (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/broker/broker',
- })
- }
- }
- app.globalData.personMsg = r.data.user;
- app.globalData.use_id = r.data.user.id;
- app.globalData.userflag = true;//有个人信息
- that.setData({
- loginFlag: true,
- personobj: r.data.user
- })
- if (!r.data.user.phone) {
- that.setData({
- phoneflag: true
- })
- wx.hideLoading();
- app.globalData.phone = false;//没有手机号
- } else {
- that.setData({
- phoneflag: false
- })
- app.globalData.phone = true;//有手机号
- }
- that.setData({
- firstload: true
- })
- } else {
- that.setData({
- footflag: true,
- loginFlag: 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()
- }
- },
- 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()
- }
- })
- },
- 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) {
- return false;
- }
- leftheight = res[0].height;
- const queryright = wx.createSelectorQuery()
- queryright.select('.rightcaselistbox').boundingClientRect();
- queryright.exec(function (rs) {
- if (!rs) {
- return false;
- }
- 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 () {
- 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"
- }
- }
- })
|