| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- <template>
- <view>
- <view class="top" :style="'height:'+systems.barHeight+'rpx;'">
- <view :class="'top-bg'+(isFixed?' top-bg-fix':'')"></view>
- <view class="top-c" :style="'height:'+systems.navigationHeight+'rpx;margin-top:'+systems.ktxStatusHeight+'rpx;'">
- <image :src="picUrlss+'lvluo/home_logo.png'" class="logo"></image>
- </view>
- </view>
- <view class="banner">
- <image :src="picUrlss+'lvluo/home_top_img.png'"></image>
- </view>
- <block v-if="faList.length>0">
- <!-- <view class="tit">应用方案</view> -->
- <view class="fa-list ddflex">
- <view class="li ddflex" v-for="(item,index) in faList" :key="index" @click="jumpUrl(item,1)">
- <view>{{item.title}}</view>
- <image :src="item.pic"></image>
- </view>
- </view>
- </block>
- <simple-phone v-if="isShowPhonePop" @closePop="closePop"></simple-phone>
- </view>
- </template>
- <script>
- const app = getApp();
- const req = require('../../utils/request.js');
- var timer; //定时器状态
- // let WebIM = (wx.WebIM = require("../../hxChatSDK/utils/WebIM")["default"]);
- export default {
- data() {
- return {
- picUrlss: req.public.picUrls,
- systems: {},
- pxToRpxScale: 0,
- isFixed: false,
- faList: [],
- caseList: [],
- config: '',
-
- isShowPhonePop: false
- };
- },
- onLoad: async function(options) {
- req.removeStorage('AUTH_TOKEN');
- req.removeStorage('appId');
- req.removeStorage('userInfo');
- await req.setStorage('appId',req.env.NODE_ENV == 'prd' ? 'ZQKmmjlYyTRmssC' : 'ZQ4KaYIMHTypO0T');
- await this.getFaList();
- await this.getConfig();
- if(options.userId) req.setStorage('pidCode',options.userId);
- let sceneId = req.getStorage('scene');
- await req.silenceLogin(options.userId,'',sceneId == 1065 ? 14 : '');
- let phone = req.getStorage('userInfo').mobile;
- if(sceneId == 1065){
- if(!phone && this.config.is_show_scheme_pop == 1) this.getPhonePop();//通过scheme进入
- }
- // await this.getCaseList();
- },
- onShow() {
- },
- onShareAppMessage: function() {
- return {
- title: this.getShareTitle(),
- path: this.getSharePath()
- };
- },
- onShareTimeline() {
- return {
- title: this.getShareTitle(),
- query: this.getSharePath()
- };
- },
- methods: {
- getPhonePop(){
- this.isShowPhonePop = true;
- },
- closePop(){
- this.isShowPhonePop = false;
- },
- getConfig(){
- return new Promise((resolve,reject)=>{
- req.getRequest('/api/config',{},data=>{
- this.config = data;
- resolve();
- })
- })
- },
- getFaList(){
- uni.showLoading();
- return new Promise((resolve,reject)=>{
- req.getRequest('/api/content/list',{code: 'yyfa'},data=>{
- this.faList = data;
- uni.hideLoading();
- resolve();
- })
- })
- },
- getCaseList(){
- return new Promise((resolve,reject)=>{
- req.getRequest('/api/content/list',{code: 'yyal'},data=>{
- this.caseList = data;
- uni.hideLoading();
- resolve();
- })
- })
- },
- getSharePath() {
- let path = '/pages/home/index?isShare=' + true;
- if (req.getStorage('userInfo')) {
- path += '&userId=' + req.getStorage('userInfo').id;
- }
- if (req.getStorage('MERCHANT') && req.getStorage('MERCHANT').id != null) {
- path += '&merchantId=' + req.getStorage('MERCHANT').id;
-
- if (req.getStorage('smallShop') && req.getStorage('MERCHANT').id != null) {
- path += '&shopId=' + req.getStorage('smallShop').id;
- }
- }
- return path;
- },
- getShareTitle() {
- let title = '';
- if (this.merchant && this.merchant.title && this.merchant.title != '默认门店') {
- title = this.merchant.title;
- } else {
- title = this.config.CONFIG_PROJECT_TITLE;
- }
- return (req.excludeSpecial(req.getStorage('userInfo').nickName) ? req.excludeSpecial(req.getStorage('userInfo').nickName) : '') + '为你推荐' + title;
- },
- jumpUrl(item,type){
- if(type == 1){
- if(item.brief !== req.getStorage('appId')){
- req.removeStorage('appId');
- req.removeStorage('userInfo');
- req.removeStorage('configRes');
- req.removeStorage('defaultMerchant');
- req.removeStorage('MERCHANT');
- req.removeStorage('loctionAddressMap');
- req.setStorage('appId',item.brief);
- }
- req.removeStorage('imToken')
- uni.removeStorageSync('myUsername')
- uni.showLoading({
- title: '正在加载配置'
- })
- req.getRequest('/api/config',{},data=>{
- console.log("切换案例",data)
- req.setStorage('configRes',JSON.stringify(data));
- app.globalData.upColor(true)
- // this.onClosed()
- setTimeout(res=>{
- uni.hideLoading();
- app.globalData.reLaunchTo('pages/index/index');
- },2000)
- })
- }else{
- uni.navigateToMiniProgram({
- appId: item.brief,
- path: item.fieldValues.homepage?item.fieldValues.homepage:'pages/index/index',
- envVersion: req.env.NODE_ENV == 'product' ? 'release' : 'trial'
- });
- }
- },
- // onClosed() {
- // // uni.showToast({
- // // title: "退出登录",
- // // icon: "none",
- // // duration: 2000,
- // // });
- // console.log('>>>>>>>>>>>IM被退出登录>>>>>>>>>>>>>>>>>')
- // // uni.redirectTo({
- // // url: "../login/login",
- // // });
- // app.globalData.conn.closed = true;
- // WebIM.conn.close();
- // },
- },
- beforeMount() {
- const systemInfo = uni.getSystemInfoSync();
- // px转换到rpx的比例
- let pxToRpxScale = 750 / systemInfo.windowWidth;
- this.pxToRpxScale = pxToRpxScale;
- let systems = {
- ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
- navigationHeight: 44 * pxToRpxScale, // 导航栏的高度
- };
- systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
- this.systems = systems;
- },
- onPageScroll(e) {
- if(e.scrollTop > this.systems.barHeight/this.pxToRpxScale){
- this.isFixed = true;
- }else{
- this.isFixed = false;
- }
- },
- };
- </script>
- <style>
- @import './index.css';
- </style>
|