| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088 |
- <template>
- <view>
- <view :class="(about.greyTheme==1?'grayTheme':'')">
- <view class="bg">
- <image :src="about.INDEX_PIC"></image>
- </view>
- <view v-if="!recommendCard">
- <view class="top-title ddflex" :style="'height: '+ systems.navigationHeight + 'rpx;top:' + systems.ktxStatusHeight + 'rpx;'">
- <image :src="about.CONFIG_PROJECT_LOGO" mode="heightFix"></image>
- {{about.CONFIG_PROJECT_TITLE?about.CONFIG_PROJECT_TITLE:''}}
- </view>
- </view>
- <view class="service-person" :style="'top:' + systems.ktxStatusHeight + 'rpx;'" v-if="recommendCard">
- <view class="ddflex" @click="jumpUrl('/card/index/index?cardId='+recommendCard.id)">
- <image class="service-person-header"
- :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
- <view>
- <view class="service-person-name ddflex">
- <view>{{recommendCard.realName}}的微页</view>
- <image src="/static/images/rico2.png" class="rico"></image>
- </view>
- <view class="service-person-number">(工号:{{recommendCard.jobNumber}}) <text v-if="recommendCard&&userInfo.id!=recommendCard.userId">欢迎您来到我的微页</text></view>
- </view>
- </view>
- <view style="margin: 20rpx 30rpx 0;justify-content: space-between;" class="ddflex">
- <view>
- <view class="ddflex">
- <view class="service-person-tag">{{recommendCard.companyName}}</view>
- <view class="service-person-tag">{{recommendCard.jobName}}</view>
- </view>
- <view class="service-person-options ddflex">
- <view class="service-person-option ddflex">
- <image src="/static/pages/images/dz.png"></image>
- <view>{{recommendCard.favorableComment}}%</view>
- </view>
- <view class="service-person-option ddflex">
- <image src="/static/pages/images/cy.png"></image>
- <view>入司{{recommendCard.inDate?monthDayDiff(recommendCard.inDate):'1年'}}</view>
- </view>
- <view class="service-person-option ddflex">
- <image src="/static/pages/images/fw.png"></image>
- <view>为{{recommendCard.cntCust?recommendCard.cntCust:0}}人服务</view>
- </view>
- </view>
- </view>
- <view class="ddflex">
- <view class="service-person-phone" v-if="recommendCard.phone"
- @click="callPhone(recommendCard.phone)">
- <image src="../../static/pages/images/dh.png"></image>
- <view>电话</view>
- </view>
- <view class="service-person-phone" v-if="recommendCard.wechat" @click="isShowCodePop=true">
- <image src="../../static/pages/images/wx.png"></image>
- <view>微信</view>
- </view>
- </view>
- </view>
- </view>
- <view style="height: 610rpx;"></view>
- <view v-for="(item, index) in contact" :key="index">
- <!-- 弹窗广告 -->
- <view style="position: absolute;top:290rpx;left: 0;right: 0;">
- <banner v-if="item == 'ad' && bannerShow" :bannerList="bannerList" :url="site" :web="url"
- :config="about" :couponList="couponList" :officeList="officeList"
- :districtTemplate="districtTemplate"></banner>
- </view>
- <district v-if="item == 'king_kong_district' && districtShow" :url="site" :web="url"
- :districtTemplate="districtTemplate"></district>
-
- </view>
-
- <view class="index-box" style="margin-top: 10rpx;" v-if="hotActivityList.length>0">
- <view class="index-box-title">热门活动</view>
- <view class="ddflex" style="margin-top: 20rpx;">
- <view style="margin-right: 20rpx;">
- <image class="pic230" :src="hotActivityList[0].pic" @click="getUrlHot(hotActivityList[0])"></image>
- <image class="pic230" style="margin-top: 20rpx;" :src="hotActivityList[1].pic" @click="getUrlHot(hotActivityList[1])"></image>
- </view>
- <image class="pic480" :src="hotActivityList[2].pic" @click="getUrlHot(hotActivityList[2])"></image>
- </view>
- </view>
-
- <!-- 参与活动 -->
- <view class="index-box" style="margin-top: 50rpx;" v-if="matchList.length>0">
- <view class="index-box-title">更多活动</view>
- <view class="map-ac">
- <scroll-view scroll-x="true" class="map-acs">
- <view class="li" v-for="(item,index) in matchList" :key="index"
- @click="jumpUrl('/match/activityDetail/activityDetail?id='+item.id)">
- <view style="position: relative;border-radius: 20rpx;overflow: hidden;">
- <image :src="item.pic ? item.pic : '/static/images/def_zw1.png'" mode="aspectFill"></image>
- <view class="ac-type" v-if="item.categoryName">{{ item.categoryName }}</view>
- </view>
- <view class="ac-title tovers">{{ item.title }}</view>
- </view>
- </scroll-view>
- </view>
- </view>
-
- <!-- 投保案例 -->
- <view class="index-box" style="margin:0;padding: 30rpx;background-color: #f5f5f5;" v-if="tbalList.length>0">
- <view class="index-box-title">投保案例</view>
- <view>
- <view class="tbal-nav ddflex">
- <view :class="'tbal-nav-item '+(tbalIndex==index?'tbal-nav-item-active':'' )"
- v-for="item,index in tbalList" @click="changeTbalTab(index)" :key="index">
- <view>{{item.name}}</view>
- <view class="tbal-nav-label" v-if="index==0">20~30岁</view>
- <view class="tbal-nav-label" v-else-if="index==1">25-35岁</view>
- <view class="tbal-nav-label" v-else-if="index==2">30-50岁</view>
- <view class="tbal-nav-label" v-else-if="index==3">50-65岁</view>
- </view>
- </view>
-
- <block v-if="tbalContentList.length>0">
- <view class="tbal-item ddflex" v-for="it in tbalContentList"
- @click="jumpUrl('/topic/content/content?id='+it.id)">
- <!-- @click="jumpUrl('/topic/alContent/alContent?id='+it.id)" -->
- <image class="tbal-pic" :src="it.pic?it.pic:'/static/images/lj_img.png'" mode="aspectFill"></image>
- <view class="flex">
- <view class="tbal-title">{{it.title}}</view>
- <view class="ddflex">
- <view class="flex">
- <view class="tbal-price">
- {{it.fieldValues&&it.fieldValues.yearMoney?it.fieldValues.yearMoney:'0'}}
- </view>
- <view class="tbal-price-text">年缴费</view>
- </view>
- <view class="tbal-line"></view>
- <view class="flex">
- <view class="tbal-price">
- {{it.fieldValues&&it.fieldValues.allMoney?it.fieldValues.allMoney:'0'}}
- </view>
- <view class="tbal-price-text">总保额 </view>
- </view>
- </view>
- <view class="tbal-btn">去看看</view>
- </view>
- <view class="tbal-tag" v-if="it.fieldValues&&it.fieldValues.version">{{it.fieldValues.version}}
- </view>
- </view>
- </block>
- <view class="nodata" v-else style="padding-top: 0rpx;">
- <image :src="picUrlss+'empty_dd.png'"></image>
- <text>暂无数据</text>
- </view>
- </view>
- </view>
-
- <!-- 真实理赔故事 -->
- <view class="index-box" v-if="lpalList.length>0">
- <view class="index-box-title ddflex">
- <text class="fflex">真实理赔故事</text>
- <view class="fx-header-more ddflex"
- @click="jumpUrl('/topic/contentList/contentList?code='+lpalCode+'&title=理赔案例')">
- 更多
- <image src="/static/pages/images/more.png"></image>
- </view>
- </view>
- <view class="map-ac">
- <scroll-view scroll-x="true" class="map-acs ddflex" style="height: 430rpx;">
- <view class="lpgs-item" v-for="items,indexs in lpalList ">
- <image class="lpgs-icon" src="../../static/images/lpgs_icon.png"></image>
- <view :class="'lpgs-header '+(indexs%2==0?'':'lpgs-header-c')">
- <view>{{items.name}}</view>
- </view>
- <view class="lpgs-content" v-if="items.contentList&&items.contentList.length>0">
- <view class="lpgs-item-content ddflex" v-for="item,index in items.contentList" :key="index"
- @click="jumpUrl('/topic/content/content?id='+item.id)">
- <view class="flex" style="min-width: 0;">
- <view class="lpgs-item-content-title tovers">{{item.title}}</view>
- <view class="lpgs-item-content-look ddflex">
- <image src="/static/images/eyes.png"></image>
- <view>{{unitFormat(item.browse)}}</view>
- </view>
- </view>
- <image class="lpgs-item-content-pic"
- :src="item.pic?item.pic:'/static/images/lj_img.png'"></image>
- </view>
- </view>
- <view class="lpgs-content" v-else>
- <view class="nodata" style="padding-top: 40rpx;padding-bottom: 40rpx;">
- <image :src="picUrlss+'empty_dd.png'" style="margin: 0 auto 0rpx;width: 208rpx;height: 139rpx;" mode="aspectFill"></image>
- <text>暂无数据</text>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
-
- <!-- 发现 -->
- <view class="index-box" style="margin:0;padding: 30rpx;background-color: #f5f5f5;" v-if="fxList.length>0">
- <view class="map-ac">
- <scroll-view scroll-x="true" class="map-acs ddflex" style="height: 70rpx;">
- <view :class="'fx-nav '+(fxIndex==index?'fx-nav-active':'')" v-for="item,index in fxList"
- @click="changeFxTab(index)">{{item.name}}</view>
- </scroll-view>
- </view>
- <view class="fx-bar">
- <view class="fx-header ddflex">
- <view class="ddflex">
- <view class="fx-header-title">{{fxList[fxIndex].name}}</view>
- <view class="fx-header-more">{{unitFormat(fxList[fxIndex].shareCount?fxList[fxIndex].shareCount:0)}}人浏览</view>
- </view>
- <view class="fx-header-more ddflex"
- @click="jumpUrl('/topic/contentList/contentList?code='+fxList[fxIndex].code+'&title='+fxList[fxIndex].name)">
- 更多
- <image src="/static/pages/images/more.png"></image>
- </view>
- </view>
- <view v-if="fxContentList.length>0">
- <view class="fx-item ddflex" v-for="item in fxContentList"
- @click="jumpUrl('/topic/content/content?id='+item.id)">
- <view class="flex" style="min-width: 0;">
- <view class="fx-item-title tovers">{{item.title}}</view>
- <view class="ddflex" style="margin-top: 24rpx;">
- <view class="fx-item-time">{{formatTime(item.createDate)}}</view>
- <view class="fx-item-look ddflex">
- <image src="/static/images/eyes.png"></image>
- <view>{{unitFormat(item.browse)}}</view>
- </view>
- </view>
- </view>
- <image class="fx-item-pic" :src="item.pic?item.pic:'../../static/images/lj_img.png'"></image>
- </view>
- </view>
- <view class="nodata" v-else style="padding-top: 0rpx;padding-bottom: 40rpx;">
- <image :src="picUrlss+'empty_dd.png'" style="margin: 0 auto 0rpx;width: 208rpx;height: 139rpx;" mode="aspectFill"></image>
- <text>暂无数据</text>
- </view>
- </view>
- </view>
-
- <!-- <component v-for="(item,index) in contact" ></component> -->
- <!-- <ad></ad> -->
- <block v-if="contactShow">
- <view class="spinner">
- <view class="spinner-container container1">
- <view class="circle1"></view>
- <view class="circle2"></view>
- <view class="circle3"></view>
- <view class="circle4"></view>
- </view>
- <view class="spinner-container container2">
- <view class="circle1"></view>
- <view class="circle2"></view>
- <view class="circle3"></view>
- <view class="circle4"></view>
- </view>
- <view class="spinner-container container3">
- <view class="circle1"></view>
- <view class="circle2"></view>
- <view class="circle3"></view>
- <view class="circle4"></view>
- </view>
- </view>
- <view class="lond">加载中···</view>
- </block>
- <view class="foot-logo">
- <image src="/static/images/zgrs_logo.png"></image>
- </view>
- <!-- <footer-copyright v-if="logo"></footer-copyright> -->
- <!-- <contact-button img-url="/static/pages/images/kfico1_1.png" class-name="contact_index" button-text="客服"></contact-button> -->
- <!-- <view class="guide" @tap="hideGuide" v-if="first">
- <image src="/static/pages/images/guide.png" mode="widthFix"></image>
- </view> -->
- </view>
- <!-- <view class="placeholder-view" :style="'height:' + (bottomBlankHeight + 115) + 'rpx'"></view> -->
- <foot channel="home" :isUpdate="isUpdate"></foot>
- <view class="ceng2" v-if="isShowCodePop" @click="isShowCodePop = false" @touchmove.stop.prevent="moveHandle">
- </view>
- <view :class="'code-pop ' +(about.greyTheme==1?'grayTheme':'')" v-if="isShowCodePop">
- <view class="code-content" v-if="recommendCard.wechatCode">
- <image :src="recommendCard.wechatCode?recommendCard.wechatCode:'/static/images/wxCode.jpg'"
- show-menu-by-longpress="true"></image>
- <view style="text-align: center;font-size: 24rpx;color: #999;margin-bottom: 50rpx;">长按识别微信二维码</view>
- </view>
- <view class="code-text" v-else>
- <view>微信号</view>
- <view>{{recommendCard.wechat}}</view>
- </view>
- <view class="code-btn" @click="copy(recommendCard.wechat)">
- 复制微信号
- </view>
- </view>
- <msgNumber :bottom="recommendCard&&userInfo.id!=recommendCard.userId?'350rpx':'230rpx'"></msgNumber>
- <!-- <view class="chat-fixed" v-if="recommendCard">
- <view class="chat-box ddflex" @click="jumpSingleChatRoom()">
- <image :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
- <view class="chat-lyl">聊一聊</view>
- </view>
- </view> -->
- <view :class="'chat-fixed '+(chatShow?'chat-fixed-long':'')" v-if="recommendCard&&userInfo.id!=recommendCard.userId">
- <view class="chat-box ddflex" @click="jumpSingleChatRoom()">
- <image :src="recommendCard.avatar?recommendCard.avatar:'../../static/pages/images/userimg.png'"></image>
- <view v-if="chatShowText" class="fflex tover"
- style="font-size: 24rpx;color: #333333;margin-left: 20rpx;">您好,我是{{recommendCard.realName}},欢迎访问我的微页
- </view>
- <view :class="'chat-lyl '+(!chatShowText?'chat-lyl2':'')">聊一聊</view>
- </view>
- </view>
-
- <update-userinfo :update-info="isUpdateInfo" :update-mobile="isUpdateMobile" v-if="isShowUpdate"
- @closeUpdate="closeUpdate" @updateInfo="updateInfo" @updateMobile="updateMobile"></update-userinfo>
- </view>
- </template>
- <script>
- //index.js
- //获取应用实例
- const app = getApp();
- const req = require('../../utils/request.js');
- const api = require('../../utils/api.js');
- const utils = require('../../utils/util.js');
- const mes = require('../../utils/requestmessage.js');
- const route = require('../../utils/route');
- const QQMapWX = require("../../utils/qqmap.js");
- import foot from '../../components/nav-bar/index';
- import footerCopyright from '../../components/footer-copyright/footer-copyright';
- import banner from '../../template/banner/banner';
- import district from '../../template/king_kong_district/king_kong_district';
- import msgNumber from '../../components/msg-number/index.vue';
- export default {
- data() {
- return {
- picUrlss: req.public.picUrls,
- skinNotColor: req.public.skinNotColor,
- systems: {},
- header: req.header,
- bottomBlankHeight: app.globalData.isIPhoneX ? 68 : 0,
- bannerList: [],
- //产品分类列表
- page: 1,
- //产品列表
- merchant: {},
- activityGroup: {
- products: []
- },
- couponList: {}, //优惠券,
- isUpdate: false,
- // 是否更新消息
- first: true,
- //是否显示提示加入我的小程序
- isLayerAd: true,
- //广告
- homeTemplate: [],
- //首页栏目配置
- storeShow: true,
- templateType: {
- module_ad: 'ad',
- //广告
- module_type_district: 'type_district',
- //分类导航
- module_king_kong_district: 'king_kong_district', //金刚区
- },
- isNotice: false,
- joingroupList: {
- products: []
- },
- //拼团
- bargainList: {
- products: []
- },
- //砍价
- customersList: {
- products: []
- },
- //新客
- freshen: true,
- url: '',
- web: '',
- site: '',
- districtTemplate: {},
- contact: [],
- seckillList: {
- products: []
- },
- about: {},
- Is_Store_Price_Stock: '',
- guarantee: [],
- animationData: '',
- content: '',
- popAdList: {},
- iscouponAd: false,
- logo: false,
- top: Boolean,
- top_type: Boolean,
- switchStoreShow: Boolean,
- contactShow: true,
- districtShow: false,
- bannerShow: false,
- officeList: [], //互动
- hotActivityList: [], //热门活动
- matchList: [], //活动列表
- tbalList: [], //投保案例
- tbalIndex: 0, //投保案例tab
- tbalContentList: [],
- lpalList: [], //理赔案例
- fxList: [], //发现
- fxIndex: 0,
- fxContentList: [],
- recommendCard: '', //销售
- isShowCodePop: false,
- lpalCode: req.public.lpalCode,
- chatShow: true,
- chatShowText: true,
-
- userInfo:{},
-
- isShowUpdate: false, //是否显示更新信息弹窗
- isUpdateInfo: false, //更新用户信息
- isUpdateMobile: false, //绑定手机号
-
- firstLoad:true,//第一次加载页面
- };
- },
- components: {
- foot,
- footerCopyright,
- banner,
- district,
- msgNumber
- },
- props: {},
- onLoad: async function(options) {
- // console.log("扫码进去参数===" + JSON.stringify(options));
- // if (options.scene) {
- // // this.scene = options.scene || '1290926887903780865';
- // this.scene = options.scene;
- // await this.loadCodeParams();
- // }
- // wx.setNavigationBarColor({
- // frontColor: '#ffffff',
- // backgroundColor: req.public.titleTopBgColor,
- // })
- // this.getPopAd()
- this.query = options;
- // req.silenceLogin(options.userId, '');
- if (options.custom_params) {
- let obj = decodeURIComponent(opt.custom_params);
- obj = JSON.parse(obj);
- // console.log(obj)
- req.setStorage('pidCode', obj.userId);
- }
- if (options.isShare) {
- if (options.userId) {
- req.setStorage('pidCode', options.userId);
- }
- }
- setInterval(() => {
- this.setData({
- isNotice: true
- });
- }, 10000); // this.init();
- // QQMapWX.initMap();
- // req.getLocation(res => {
- // const to = {
- // latitude: res.latitude,
- // longitude: res.longitude
- // };
- // QQMapWX.reverseGeocoder(to, resp => {});
- // });
- },
- async onShow() {
- await req.silenceLogin(this.query.userId, '');
- let _ts = this;
-
- this.userInfo = req.getStorage('userInfo')
-
-
- if (!this.userInfo.mobile&&this.firstLoad==true) {
- this.isShowUpdate = true;
- this.isUpdateMobile = true;
- }
-
- this.firstLoad = false
-
- await this.getConfig().then(res => {});
- await this.getHomeTemplateConfig();
- uni.setNavigationBarColor({
- frontColor: this.skinNotColor ? '#000' : '#ffffff',
- backgroundColor: req.public.titleTopBgColor
- });
- _ts.setData({
- isUpdate: !_ts.isUpdate
- });
- this.getHotActivity()
- this.getMatchList()
- this.getTbal()
- this.getLpal()
- this.getFx()
- QQMapWX.initMap();
- req.getLocation(res => {
- const to = {
- latitude: res.latitude,
- longitude: res.longitude
- };
- QQMapWX.reverseGeocoder(to, resp => {});
- this.getRecommendCard(to)
- });
- // console.log('this.freshen=='+this.freshen)
- let first = req.getStorage('first');
- if (first !== false)
- _ts.setData({
- first: true
- });
- else
- _ts.setData({
- first: false
- });
- },
- onUnload() {
- // this.isShowTime = false;
- this.clearAllTimer(1);
- this.clearAllTimer(2);
- this.clearAllTimer(3);
- this.clearAllTimer(4);
- },
- onHide() {
- // this.isShowTime = false;
- this.clearAllTimer(1);
- this.clearAllTimer(2);
- this.clearAllTimer(3);
- this.clearAllTimer(4);
- },
- onShareAppMessage: function() {
- },
- onShareTimeline() {
- },
- onReachBottom() {},
- methods: {
- jumpSingleChatRoom() {
- if (this.recommendCard) {
- req.jumpSingleChatRoom(this.recommendCard.userId, this.recommendCard.avatar, this.recommendCard
- .realName);
- }
- },
- jumpUrl(url) {
- if (req.isLogins(false)) {
- uni.navigateTo({
- url: url
- })
- }
- },
- // 获取推荐销售
- getRecommendCard(loction) {
- let params = loction
- if(req.getStorage("shareId")){
- params.shareSaleNo = req.getStorage("shareId")
- }
- req.getRequest('/api/visiting/card/recommendCardInfo', params, res => {
- this.recommendCard = res
- console.log('获取推荐销售》》》》》', res);
- setTimeout(() => {
- this.chatShow = false
- setTimeout(() => {
- this.chatShowText = false
- }, 450)
- }, 2000)
- })
- },
- // 获取热门活动
- getHotActivity() {
- req.getRequest('/api/banner', {
- code: 'index_hot_activity'
- }, res => {
- this.hotActivityList = res?res:[]
- })
- },
- // 获取更多活动
- getMatchList() {
- req.getRequest('/api/match/list', {
- page: 1,
- limit: 10,
- shareSaleNo:req.getStorage("shareId")?req.getStorage("shareId"):null
- }, res => {
- this.matchList = res
- })
- },
- // 获取投保案例
- async getTbal() {
- this.tbalList = await this.getContentList(req.public.tbalCode)
- this.tbalContentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
- .code)
- this.$forceUpdate()
- },
- // 获取理赔案例
- async getLpal() {
- if(this.lpalList.length==0){
- this.lpalList = await this.getContentList(req.public.lpalCode)
- }else{
- // 防止页面onShow时内容闪动
- let lpal = await this.getContentList(req.public.lpalCode)
- for(let i=0;i<lpal.length;i++){
- let item = lpal[i]
- for(let j=0;j<this.lpalList.length;j++){
- let it = this.lpalList[i]
- if(it.id==item.id){
- item.contentList = it.contentList?it.contentList:[]
- }
- }
-
- }
- }
- this.lpalList.map(async item => {
- item.contentList = await this.getContentPageList(item.code)
- this.$forceUpdate()
- })
- },
- // 获取发现
- async getFx() {
- this.fxList = await this.getContentList('faxian')
- this.getFxContenteList(this.fxList[this.fxIndex].code)
- },
- // 获取文章栏目列表
- getContentList(code) {
- return new Promise((r, j) => {
- req.getRequest('/api/content/category/list', {
- parentCode: code
- }, res => {
- r(res ? res : [])
- })
- })
- },
- // 获取文章列表
- getContentPageList(code) {
- return new Promise((r, j) => {
- req.getRequest('/api/content/list', {
- code: code,
- page: 1,
- limit: 2,
- shareSaleNo : req.getStorage("shareId")?req.getStorage("shareId"):null
- }, res => {
- r(res ? res : [])
- })
- })
- },
- // 获取发现文章列表
- getFxContenteList(code) {
- return new Promise((r, j) => {
- req.getRequest('/api/content/list', {
- code: code,
- page: 1,
- limit: 10,
- shareSaleNo : req.getStorage("shareId")?req.getStorage("shareId"):null
- }, res => {
- this.fxContentList = res ? res : []
- r(res ? res : [])
- })
- })
- },
- // 投保案例tab切换
- async changeTbalTab(index) {
- if (this.tbalIndex == index) return false;
- this.tbalIndex = index
- this.tbalContentList = await this.getContentPageList(this.tbalList[this.tbalIndex]
- .code)
- this.$forceUpdate()
- },
- // 发现tab切换
- changeFxTab(index) {
- if (this.fxIndex == index) return false;
- this.fxIndex = index
- this.getFxContenteList(this.fxList[this.fxIndex].code)
- },
- async getRqeDatas() {
- console.log('getRqeDatas');
- let that = this; //多门店
- // 金刚区
- let district = that.homeTemplate.filter(it => it.module == that.templateType
- .module_king_kong_district);
- if (district && district.length > 0 && district[0].state == 0) {
- let data = district[0];
- data.content = JSON.parse(district[0].content);
- that.districtTemplate = data;
- if (data.contentId == 2) {
- that.districtShow = true;
- }
- console.log(that.districtTemplate, '=============');
- }
- //顶部banner
- let ad = that.homeTemplate.filter(it => it.module == that.templateType.module_ad);
- if (ad && ad.length > 0 && ad[0].state == 0) {
- if (that.freshen) {
- await that.getBannerList(ad[0].module, ad[0].contentId);
- }
- }
- that.logo = true;
- },
- //获取首页模板配置
- getHomeTemplateConfig() {
- let _ts = this;
- let page = 'index';
- //荣康模板配置、小店产品==门店产品
- // if (this.merchant && this.merchant.type == 5 || this.shopId && this.merchantId) page = 'shopIndex'
- req.getRequest(
- '/api/template/getTemplate', {
- page: page
- },
- data => {
- let arr = [];
- data.forEach(it => {
- arr.push(it.module);
- });
- this.setData({
- contact: [...new Set(arr)],
- contactShow: false
- });
- if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('store_options') != -1) {
- this.top = false;
- } else {
- this.top = true;
- }
- if (this.contact.indexOf('sou') != -1 && this.contact.indexOf('type_district') != -1) {
- this.top_type = false;
- } else {
- this.top_type = true;
- }
- console.log(this.contact.indexOf('sou') != -1, this.contact.indexOf('store_options') != -1,
- this.contact.indexOf('type_district') != -1, this.top);
- console.log(this.contact);
- this.setData({
- homeTemplate: data
- });
- this.getRqeDatas();
- }
- );
- },
- getConfig() {
- var _this = this;
- return new Promise((res, rej) => {
- req.g(
- '/api/other/config',
- data => {
- req.setStorage('configRes', JSON.stringify(data));
- this.about = data;
- if (!data.Index_Store_Confirm || data.Index_Store_Confirm == 0) {
- _this.setData({
- switchStoreShow: false,
- storeShow: false
- });
- } else {
- _this.setData({
- switchStoreShow: true
- });
- }
- // console.log(data.Index_Store_Confirm, "====", !data.Index_Store_Confirm, typeof(res
- // .Index_Store_Confirm))
- uni.setNavigationBarTitle({
- // title: res['CONFIG_PROJECT_TITLE'],
- title: data['CONFIG_PROJECT_TITLE']
- });
- // console.log(data.Is_Store_Price_Stock);
- if (data.Is_Store_Price_Stock) {
- this.Is_Store_Price_Stock = data.Is_Store_Price_Stock;
- }
- this.setData({
- Is_Store_Price_Stock: data.Is_Store_Price_Stock
- });
- if (data.b2c_service_guarantee && data.b2c_service_guarantee != null) {
- this.setData({
- guarantee: data.b2c_service_guarantee.split(';').filter(it => {
- return (it = it && it.trim());
- })
- });
- }
- req.setStorage('appName', data['CONFIG_PROJECT_TITLE']);
- req.setStorage('productDiy', data['Product_Foot-Diy']);
- res(data);
- },
- true
- );
- });
- },
- merchantFun() {
- app.globalData.openPage('pages/nearby/nearby');
- },
- saoma() {
- var _this = this; // 允许从相机和相册扫码
- uni.scanCode({
- success: res => {
- uni.navigateTo({
- url: '/' + res.path
- }); // this.scene = '1290926887903780865';
- this.loadCodeParams();
- }
- });
- },
- update(content) {
- var that = this;
- var animation = uni.createAnimation(); // 旧消息向上平移
- animation.translateY(-50).step({
- duration: 1000,
- timingFunction: 'ease-in'
- }); // 为了实现下一条新内容向上平移的效果,必须把内容很快平移到下方,并且不能被用户看见,这里其原理类似轮播图的思路。
- // 实现方法:动画时间设置为1ms,过渡效果设置为’动画第一帧就跳至结束状态直到结束‘
- animation
- .opacity(0)
- .translateY(50)
- .step({
- duration: 1000,
- timingFunction: 'step-start'
- }); // 新消息向上平移的同时恢复透明
- animation
- .opacity(1)
- .translateY(0)
- .step({
- duration: 1000,
- timingFunction: 'ease-out'
- });
- that.setData({
- animationData: animation.export()
- }); // 更新内容的延时必须大于第一步动画时间
- setTimeout(() => {
- that.setData({
- content: content
- });
- }, 500000);
- },
- loadCodeParams() {
- let _ts = this;
- return new Promise((resolve, reject) => {
- if (!_ts.scene) {
- resolve();
- return false;
- }
- req.getRequest(
- '/api/code/params', {
- scene: _ts.scene
- },
- data => {
- req.setStorage('pidCode', data.userId);
- resolve();
- }
- );
- });
- },
- getBannerList(module, contentId) {
- //banner图
- let that = this;
- return new Promise((resolve, reject) => {
- req.getRequest(
- '/api/banner', {
- groupId: contentId
- },
- data => {
- if (module == that.templateType.module_ad) {
- that.setData({
- bannerList: data,
- bannerShow: true
- });
- } else {
- that.setData({
- popAdList: data[0]
- });
- }
- resolve();
- }
- );
- })
- },
- clearAllTimer(type) {
- // console.log(this.activityGroup, this.joingroupList, this.bargainList, this.customersList);
- if (type == 1) {
- this.activityGroup.products.forEach(it => clearInterval(it.timer));
- this.activityGroup.products.forEach(it => clearInterval(it.times));
- } else if (type == 2) {
- this.joingroupList.products.forEach(it => clearInterval(it.timer));
- this.joingroupList.products.forEach(it => clearInterval(it.times));
- } else if (type == 3) {
- this.bargainList.products.forEach(it => clearInterval(it.timer));
- this.bargainList.products.forEach(it => clearInterval(it.times));
- } else if (type == 4) {
- this.customersList.products.forEach(it => clearInterval(it.timer));
- this.customersList.products.forEach(it => clearInterval(it.times));
- } else if (type == 5) {
- this.seckillList.products.forEach(it => clearInterval(it.timer));
- this.seckillList.products.forEach(it => clearInterval(it.times));
- }
- },
- hideGuide() {
- //关闭提示加入我的小程序
- this.setData({
- first: false
- });
- req.setStorage('first', false);
- },
- hideAd() {
- //关闭广告
- // if(this.data.first==false){
- this.setData({
- isLayerAd: false
- }); // }
- app.globalData.isLayerAd = false;
- },
- click(e) {
- // console.log(e)
- this.storeShow = e;
- },
- goUrl(event) {
- //跳转链接
- let url = event.currentTarget.dataset.url;
- app.globalData.openPage(url);
- },
- // 拨打电话
- callPhone(val) {
- if (!val) return false
- uni.makePhoneCall({
- phoneNumber: val
- });
- },
- copy(val) {
- this.isShowCodePop = false
- uni.setClipboardData({
- data: val,
- complete() {
- req.msg('复制成功')
- }
- })
- },
- unitFormat(data) {
- return req.unitConverter(data).text
- },
- formatTime(date) {
- date = new Date(date.replace(/-/g, '/'))
- return utils.formatTime(date).t3
- },
- monthDayDiff(date) {
- return utils.monthDayDiff(date)
- },
- // 热门活动
- getUrlHot(item) {
- console.log(item)
- var dt = item
- var url = "";
- var id = "";
- var acid = "";
-
- if (dt.content != "") {
- let conunt = dt.content.split("_");
- id = conunt[1];
- acid = conunt[0];
- }
-
- if (dt.type * 1 == 2 && dt.content != "") {
- url = "product/detail/detail?id=" + dt.content;
- } else if (dt.type * 1 == 3) {
- url = dt.content;
- console.log('url===',url)
- if(!url){
- req.msg('功能待接入')
- return false
- }
- if(url=='pages/index/index'||url=='pages/matchList/index'||url=='pages/interactive/index'||url=='pages/found/found'||url=='pages/user/user'){
- app.globalData.switchTab(url)
- return false
- }else{
- if(url.indexOf('http')!=-1){
- app.globalData.openPage('pages/web/web?url='+url);
- return false
- }
- }
- } else if (dt.type * 1 == 4) {
- url = "product/groupDetail/groupDetail?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 5) {
- url = "product/coupon/coupon";
- } else if (dt.type * 1 == 6) {
- url = "pages/live/live";
- } else if (dt.type * 1 == 7) {
- url = "product/groupList/groupList" + dt.merchant;
- } else if (dt.type * 1 == 9 && dt.content != "") {
- url = "product/list/list?id=" + dt.content + '&title=' + dt.title + this.web;
- } else if (dt.type * 1 == 10) {
- url = "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + dt.content;
- // console.log(
- // url); // url=`plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${dt.content}`
- } else if (dt.type * 1 == 11) {
- url = "activity/group/index/index" + dt.merchant;
- } else if (dt.type * 1 == 12) {
- url = "activity/seckill/seckill" + dt.merchant;
- } else if (dt.type * 1 == 13) {
- url = "activity/bargain/index/index" + dt.merchant;
- } else if (dt.type * 1 == 14) {
- url = "activity/newbornZone/newbornZone" + dt.merchant;
- } else if (dt.type * 1 == 15 && dt.content != "") {
- url = "activity/newbornDetails/newbornDetails?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 16 && dt.content != "") {
- url = "activity/seckillDetails/seckillDetails?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 17 && dt.content != "") {
- url = "activity/bargain/detail/detail?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 18 && dt.content != "") {
- url = "activity/group/detail/detail?acid=" + acid + "&id=" + id;
- }else if (dt.type * 1 == 19 && dt.content != "") {
- url = "topic/content/content?id=" + dt.content;
- } else {
- url = "";
- }
-
- if (dt.type * 1 == 6) app.globalData.switchTab(url);
- else app.globalData.openPage(url);
- this.hideAd();
- },
-
- closeUpdate() {
- this.isShowUpdate = false;
- },
- updateInfo(e) {
- this.isUpdateInfo = e;
- this.getMy();
- },
- updateMobile(e) {
- this.isUpdateMobile = e;
- },
- },
- mounted() {
- const systemInfo = uni.getSystemInfoSync();
- // px转换到rpx的比例
- let pxToRpxScale = 750 / systemInfo.windowWidth;
- let systems = {
- ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
- navigationHeight: 44 * pxToRpxScale // 导航栏的高度
- };
- systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
- this.systems = systems;
- }
- };
- </script>
- <style>
- @import './index.css';
- </style>
|