123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- // mycustomer/pages/morecase/morecase.js
- const app = getApp();
- var utils = require("../../../utils/http");
- const util = require("../../../utils/util");
- var pageNum = 1;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- bType: '',
- curId: "",
- shareId: "",
- shareType: "",
- shareImage: "",
- shareTitle: "",
- shareUrl: "",
- caseArray: [],
- datashow: false,
- wshareshow: false,
- showTask: true,
- imgUrl:app.globalData.imgUrl
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- pageNum = 1;
- wx.showLoading({
- title: '加载中...',
- })
- if (options.hid) {
- this.setData({
- curId: options.hid
- })
- this.getCaselist();
- }
- if (!!options.ty) {
- wx.hideShareMenu();
- this.setData({
- bType: options.ty
- })
- }
- },
- getCaselist() {
- var that = this;
- utils.$get({
- url: app.globalData.webUrl + 'api/building/material_case',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- housetype_id: that.data.curId,
- page: 1
- },
- success: function (res) {
- if (res.data.code == '0') {
- that.setData({
- caseArray: res.data.data.list,
- datashow: true
- })
- wx.hideLoading();
- }
- },
- })
- },
- jumpCaseView(e) {
- let cid = e.currentTarget.dataset.cid;
- wx.navigateTo({
- url: '/index/pages/casemsg/casemsg?cid=' + cid + '&ty=' + this.data.bType,
- })
- },
- openVRLink(e) {
- let type = e.currentTarget.dataset.type;
- if (type == 1) {
- let vrlink = this.data.casemsgobj.vr_case;
- wx.navigateTo({
- url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&cty=materialCase' + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&aid=' + this.data.casemsgobj.id,
- })
- } else {
- let vrlink = e.currentTarget.dataset.vrlink;
- let aid = e.currentTarget.dataset.id;
- wx.navigateTo({
- url: '/pages/other/other?type=565&vrlink=' + encodeURIComponent(vrlink) + '&cty=materialCase' + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype + '&aid=' + aid,
- })
- }
- },
- //案例分享
- bindShareCase(e) {
- let cid = e.currentTarget.dataset.cid;
- let title = e.currentTarget.dataset.title;
- let shareImage = e.currentTarget.dataset.img;
- this.setData({
- shareTitle: title,
- shareImage: shareImage,
- shareId: cid,
- shareType: "materialCase",
- wshareshow: true,
- shareUrl: "/share/pages/materialcase/materialcase"
- })
- },
- //生成海报
- setpostertap: function () {
- if (this.data.bType == 'b') {
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=' + this.data.shareType + '&aid=' + this.data.shareId + "&ty=b&listshare=",
- })
- } else {
- wx.navigateTo({
- url: '/index/pages/setposter/setposter?type=' + this.data.shareType + '&aid=' + this.data.shareId + "&listshare=",
- })
- }
- },
- //发朋友圈
- sendfriendtap() {
- this.sharelogtap();
- },
- //发朋友圈接口
- sharelogtap: function () {
- var that = this;
- utils.$post({
- url: app.globalData.webUrl + 'api/share/addlog',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- id: that.data.shareId,
- type: that.data.shareType
- },
- success: function (r) {
- }
- })
- },
- //复制链接
- shareurltap: function () {
- let that = this;
- wx.showLoading({
- title: '加载中...',
- })
- if (this.data.bType == 'b') {
- util.schemefun(that.data.shareUrl, 'uid=' + app.globalData.agentEmployeEid + '&cid=' + this.data.shareId + '&ctp=' + app.globalData.clientype + "&agid=" + app.globalData.brokeruserId, this.data.shareId, this.data.shareType, '');
- } else {
- if (this.data.shareType == 'housetype') {
- util.schemefun(that.data.shareUrl, 'u=' + app.globalData.personMsg.id + '&d=' + this.data.shareId + '&c=' + app.globalData.clientype, this.data.shareId, this.data.shareType, '');
- } else {
- util.schemefun(that.data.shareUrl, 'uid=' + app.globalData.personMsg.id + '&cid=' + this.data.shareId + '&ctp=' + app.globalData.clientype + '&empid=' + app.globalData.personMsg.binded.id, this.data.shareId, this.data.shareType, '');
- }
- }
- this.sharelogtap();
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- wx.showLoading({
- title: '加载中...',
- })
- this.getCaselist();
- setTimeout(() => {
- wx.stopPullDownRefresh();
- },1500)
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- pageNum = pageNum * 1 + 1;
- var that = this;
- utils.$get({
- url: app.globalData.webUrl + 'api/building/material_case',
- header: {
- 'Authorization': 'bearer ' + app.globalData.token
- },
- data: {
- housetype_id: that.data.curId,
- page: pageNum
- },
- success: function (res) {
- if (res.data.code == '0') {
- that.data.caseArray = that.data.caseArray.concat(res.data.data.list);
- that.setData({
- caseArray: that.data.caseArray,
- datashow: true
- })
- }
- },
- })
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- if (this.data.shareType == 'materialCase') {
- this.sharelogtap();
- return {
- title: this.data.shareTitle,
- imageUrl: this.data.shareImage,
- path: '/share/pages/materialcase/materialcase?cid=' + this.data.shareId + '&uid=' + app.globalData.personMsg.id + '&ctp=' + app.globalData.clientype
- }
- }
- }
- })
|