123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- const util = require('../../static/utils/util.js');
- const config = require('../../static/config.js');
- var app = getApp(); //获取应用实例
- import requestConfig from '../../static/lib/requestConfig';
- export default {
- data(){
- return {
- showConcernTips:false,
- haveAlreadyCollectThisProject: false,
- }
- },
- watch:{
- },
- methods:{
- catchTouchMove: function() {
- return false;
- },
- /**
- * 查询项目的状态
- */
- async collectProjectStatus(successBack, failBack) {
- let requestData = {
- customerId: app.globalData.single && app.globalData.single.id,
- houseId: this.houseId,
- };
- let checkCollectRes = await requestConfig('collectionStatus', requestData, true);
- if (checkCollectRes && checkCollectRes.success) {
- if (successBack) {
- successBack();
- }
- this.haveAlreadyCollectThisProject = true;
- } else {
- this.haveAlreadyCollectThisProject = false;
- if (failBack) {
- failBack();
- }
- }
- },
- /**
- * 收藏项目
- */
- async collectProject() {
- let requestData = {
- customerId: app.globalData.single && app.globalData.single.id,
- houseId: this.houseId,
- };
- let res = await requestConfig('houseCollection', requestData, true);
- if (res.success) {
- this.haveAlreadyCollectThisProject = true;
- this.updateShowConcernTips()
- }
- },
- updateShowConcernTips(){
- this.showConcernTips = true;
- setTimeout(() => {
- this.showConcernTips=false
- }, 2500);
- },
- /**
- * 关注项目
- */
- attendProject(e) {
- let type = e.currentTarget.dataset.jumptype;
- if (type == -1) {
- let param = {
- type: 'CLK', //埋点类型
- clkName: 'follow', //点击前往的页面名称
- clkId: 'clk_2cmina_241', //点击ID
- clkParams: {
- "houseId": this.houseId,
- }
- };
- util.trackRequest(param, app);
- this.collectProjectStatus(() => {
- let projectName = app.globalData.houseProject.projectName || '';
- let msg = "您已成功关注" + projectName + "项目";
- uni.showToast({
- title: msg,
- icon: "none",
- duration: 2000
- });
- }, () => {
- this.collectProject();
- });
- } else if (type == -2) {
- this.navigateFuc(e)
- }
- },
- }
- }
|