Commit 68e43cf7 authored by 罗超's avatar 罗超

修改首页加载

parent 1a375c82
<script> <script>
import {setAttatchParameter} from './plugin/utils.js' import {
export default { setAttatchParameter
data() { } from './plugin/utils.js'
return { export default {
basedata: {}, data() {
title: "", return {
}; basedata: {},
}, title: "",
onLaunch: function () { };
console.log('App Launch') },
this.$utils.setAttatchParameter(this) onLaunch: function() {
this.init(); console.log('App Launch')
this.formatPlat(); this.$utils.setAttatchParameter(this)
}, this.init();
onLoad(option) { this.formatPlat();
// console.log('App OnLoad',option) },
// // #ifdef MP-DI onLoad(option) {
// this.checkBindParentHandle(option.query) // console.log('App OnLoad',option)
// // #endif // // #ifdef MP-DI
}, // this.checkBindParentHandle(option.query)
onShow: function (option) { // // #endif
console.log('App Show',option) },
this.$utils.VersionUpdate() onShow: function(option) {
// #ifdef MP-DI console.log('App Show', option)
this.checkBindParentHandle(option.query) this.$utils.VersionUpdate()
// #endif // #ifdef MP-DI
}, this.checkBindParentHandle(option.query)
onHide: function () { // #endif
//console.log('App Hide') },
}, onHide: function() {
methods: { //console.log('App Hide')
checkBindParentHandle(query){ },
if(query && query.direct_user_id){ methods: {
if(uni.getStorageSync('mall_UserInfo')){ checkBindParentHandle(query) {
const {OpenId,Unoinid,Name} = uni.getStorageSync('mall_UserInfo') if (query && query.direct_user_id) {
if(OpenId && Unoinid) { if (uni.getStorageSync('mall_UserInfo')) {
const pid = parseInt(query.direct_user_id) const {
if(!isNaN(pid)) this.directUserLoginHandle(OpenId,Unoinid,pid,Name) OpenId,
return Unoinid,
} Name
} } = uni.getStorageSync('mall_UserInfo')
if (OpenId && Unoinid) {
uni.setStorageSync('direct_user_id',query.direct_user_id) const pid = parseInt(query.direct_user_id)
} if (!isNaN(pid)) this.directUserLoginHandle(OpenId, Unoinid, pid, Name)
}, return
directUserLoginHandle(OpenId,Unoinid,Pid,MallName){ }
const parameters={ }
OpenId,
Unoinid, uni.setStorageSync('direct_user_id', query.direct_user_id)
Pid }
} },
this.apipost("HePingGuoLvLogin_post", parameters, r =>{ directUserLoginHandle(OpenId, Unoinid, Pid, MallName) {
const u = r.data const parameters = {
const user = { OpenId,
accountId: u.directCustomerId, Unoinid,
customerId: u.directCustomerId, Pid
customerInfoChildrenId: u.directCustomerId, }
realNameAuthentication: 0, this.apipost("HePingGuoLvLogin_post", parameters, r => {
account: "", const u = r.data
name:u.name, const user = {
customerName: MallName, accountId: u.directCustomerId,
photo: u.photo, customerId: u.directCustomerId,
secretKey: "", customerInfoChildrenId: u.directCustomerId,
token: u.token, realNameAuthentication: 0,
groupId: 0, account: "",
isMember: 0, name: u.name,
createBy: u.pid, customerName: MallName,
EmLoginMobile: u.moblie, photo: u.photo,
contactNumber: u.moblie, secretKey: "",
salesBaseInfo: u.erpBaseInfo?u.erpBaseInfo:u.salesBaseInfo, token: u.token,
pid:u.erpBaseInfo?u.erpBaseInfo.employeeId:u.pid, groupId: 0,
erpBaseInfo: u.erpBaseInfo, isMember: 0,
count: 0, createBy: u.pid,
isVip:u.isVip, EmLoginMobile: u.moblie,
customerType: 1, //直客,2-同行 contactNumber: u.moblie,
directCustomerId: u.directCustomerId //直客Id salesBaseInfo: u.erpBaseInfo ? u.erpBaseInfo : u.salesBaseInfo,
} pid: u.erpBaseInfo ? u.erpBaseInfo.employeeId : u.pid,
uni.setStorageSync('b2b_user', user) erpBaseInfo: u.erpBaseInfo,
this.user = user count: 0,
uni.setStorageSync("lastLogin",new Date().getTime()) isVip: u.isVip,
this.$utils.setAttatchParameter(this) customerType: 1, //直客,2-同行
}) directCustomerId: u.directCustomerId //直客Id
}, }
init() { uni.setStorageSync('b2b_user', user)
if (uni.getStorageSync("basedata")) { this.user = user
this.basedata = uni.getStorageSync("basedata"); uni.setStorageSync("lastLogin", new Date().getTime())
this.formatTabbar(); this.$utils.setAttatchParameter(this)
this.formatNavigation(); })
} else { },
this.request2( init() {
{ if (uni.getStorageSync("basedata")) {
url: "/api/Mall/GetHome", this.basedata = uni.getStorageSync("basedata");
data: {}, this.formatTabbar();
}, this.formatNavigation();
(res) => { } else {
uni.setStorageSync("basedata", res.data); const parameter = {VipCusType:1}
uni.setStorageSync('navs', res.data.navbar.navs??[]) // #ifdef MP-DI
this.basedata = res.data; parameter.VipCusType = 2
this.$uiConfig.mainColor=res.data.mall.setting.mallStyle.main // #endif
this.$uiConfig.secondary=res.data.mall.setting.mallStyle.secondary this.request2({
if(res.data.mall.setting.mallStyle.pricecolor){ url: "/api/Mall/GetHome",
this.$uiConfig.pricecolor=res.data.mall.setting.mallStyle.pricecolor data: parameter,
} },
this.formatTabbar(); (res) => {
this.formatNavigation(); uni.setStorageSync("basedata", res.data);
} uni.setStorageSync('navs', res.data.navbar.navs ?? [])
); this.basedata = res.data;
} this.$uiConfig.mainColor = res.data.mall.setting.mallStyle.main
}, this.$uiConfig.secondary = res.data.mall.setting.mallStyle.secondary
formatPlat() { if (res.data.mall.setting.mallStyle.pricecolor) {
let modelmes = uni.getSystemInfoSync().model; this.$uiConfig.pricecolor = res.data.mall.setting.mallStyle.pricecolor
let tempMoble = Boolean; }
if ( this.formatTabbar();
modelmes.indexOf("iPhone X") >= 0 || this.formatNavigation();
modelmes.indexOf("iPhone XR") >= 0 || }
modelmes.indexOf("iPhone XS") >= 0 || );
modelmes.indexOf("iPhone 12") >= 0 || }
modelmes.indexOf("iPhone 11") >= 0 || },
modelmes.indexOf("iPhone11") >= 0 || formatPlat() {
modelmes.indexOf("iPhone12") >= 0 || let modelmes = uni.getSystemInfoSync().model;
modelmes.indexOf("iPhoneXR") >= 0 || let tempMoble = Boolean;
modelmes.indexOf("iPhoneX") >= 0 if (
) { modelmes.indexOf("iPhone X") >= 0 ||
tempMoble = true; modelmes.indexOf("iPhone XR") >= 0 ||
} else { modelmes.indexOf("iPhone XS") >= 0 ||
tempMoble = false; modelmes.indexOf("iPhone 12") >= 0 ||
} modelmes.indexOf("iPhone 11") >= 0 ||
this.$uiConfig.is_bang = tempMoble; modelmes.indexOf("iPhone11") >= 0 ||
}, modelmes.indexOf("iPhone12") >= 0 ||
formatNavigation() { modelmes.indexOf("iPhoneXR") >= 0 ||
uni.setNavigationBarColor({ modelmes.indexOf("iPhoneX") >= 0
frontColor: this.$uiConfig.topstyle.textColor, ) {
backgroundColor: this.$uiConfig.topstyle.background, tempMoble = true;
animation: { } else {
duration: 400, tempMoble = false;
timingFunc: "easeIn", }
}, this.$uiConfig.is_bang = tempMoble;
}); },
// uni.setNavigationBarTitle({ formatNavigation() {
// title: this.basedata.mall.name, uni.setNavigationBarColor({
// }); frontColor: this.$uiConfig.topstyle.textColor,
}, backgroundColor: this.$uiConfig.topstyle.background,
formatTabbar() { animation: {
let navs = this.basedata.navbar.navs; duration: 400,
this.$uiConfig.topstyle.background = this.basedata.navbar.top_background_color; timingFunc: "easeIn",
this.$uiConfig.topstyle.textColor = this.basedata.navbar.top_text_color; },
});
// uni.setTabBarStyle({ // uni.setNavigationBarTitle({
// color: navs[0].color, // title: this.basedata.mall.name,
// selectedColor: navs[0].active_color, // });
// backgroundColor: this.basedata.navbar.bottom_background_color, },
// borderStyle: "#ccc", formatTabbar() {
// }); let navs = this.basedata.navbar.navs;
this.$uiConfig.topstyle.background = this.basedata.navbar.top_background_color;
// navs.forEach((x,i) => { this.$uiConfig.topstyle.textColor = this.basedata.navbar.top_text_color;
// uni.setTabBarItem({
// index: i, // uni.setTabBarStyle({
// text: x.text, // color: navs[0].color,
// iconPath: x.icon, // selectedColor: navs[0].active_color,
// selectedIconPath: x.active_icon, // backgroundColor: this.basedata.navbar.bottom_background_color,
// }); // borderStyle: "#ccc",
// }); // });
},
}, // navs.forEach((x,i) => {
}; // uni.setTabBarItem({
</script> // index: i,
// text: x.text,
<style lang="scss"> // iconPath: x.icon,
@import "uview-ui/index.scss"; // selectedIconPath: x.active_icon,
@import url("./asset/font/iconfont.css"); // });
@import url('asset/font/tffont.css'); // });
/* 0123456789首页订单我的暂无图片第天 */ },
@font-face { },
font-family: "nav-font";src: url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/uWqIjWPWlbHR.woff2") format("woff2"), };
url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/uBscuKyX34mb.woff") format("woff"); </script>
font-display: swap;
} <style lang="scss">
@font-face { @import "uview-ui/index.scss";
font-family: "logo-font";src: url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/kznKMVuxE1tP.woff2") format("woff2"), @import url("./asset/font/iconfont.css");
url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/ViySHjFRkPg9.woff") format("woff"); @import url('asset/font/tffont.css');
font-display: swap;
} /* 0123456789首页订单我的暂无图片第天 */
@font-face { @font-face {
font-family: "DFPLiJinHeiW8-GB"; font-family: "nav-font";
src: url("https://im.oytour.com/tripfont/cb76573b1580477fbea1ce0cc0d136e5.woff"); src: url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/uWqIjWPWlbHR.woff2") format("woff2"),
} url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/uBscuKyX34mb.woff") format("woff");
font-display: swap;
// @font-face { }
// font-family: "oswald";
// src: url("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf"); @font-face {
// } font-family: "logo-font";
// html, src: url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/kznKMVuxE1tP.woff2") format("woff2"),
// body { url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/ViySHjFRkPg9.woff") format("woff");
// font-family: "oswald" !important; font-display: swap;
// } }
swiper {
height: unset; @font-face {
font-family: "DFPLiJinHeiW8-GB";
} src: url("https://im.oytour.com/tripfont/cb76573b1580477fbea1ce0cc0d136e5.woff");
image{will-change: transform} }
</style>
// @font-face {
// font-family: "oswald";
// src: url("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf");
// }
// html,
// body {
// font-family: "oswald" !important;
// }
swiper {
height: unset;
}
image {
will-change: transform
}
</style>
\ No newline at end of file
<template> <template>
<view style="height: 100vh;"> <view style="height: 100vh;">
<scroll-view :bounces="false" scroll-y="true" style="height: 100vh;" @scroll="handleScroll"> <scroll-view :bounces="false" scroll-y="true" style="height: 100vh;" @scroll="handleScroll">
<view v-if="showStart == true" style="width: 100vw; height: 100vh"> <view v-if="showStart == true" style="width: 100vw; height: 100vh">
<image :src="startData.PicUrl" mode="aspectFit" style="width: 100%; height: 100%; position: relative"> <image :src="startData.PicUrl" mode="aspectFit" style="width: 100%; height: 100%; position: relative">
<view class="Startbtn" :style="{ top: pagePaddingBottom }" @click="startb"> <view class="Startbtn" :style="{ top: pagePaddingBottom }" @click="startb">
跳过 跳过
</view> </view>
</image> </image>
</view> </view>
<view v-if="myPageData.home_pages" class="safe-top" v-show="showStart == false" :style="[myPageData.home_pages.navs[active].templateBg]"> <view v-if="myPageData.home_pages" class="safe-top" v-show="showStart == false"
<view class="content" :style="{ :style="[myPageData.home_pages.navs[active].templateBg]">
'padding-bottom':(pageId==0?'calc(57px + env(safe-area-inset-bottom))':'0px'), <view class="content" :style="{
}"> 'padding-bottom':(pageId==0?'calc(57px + env(safe-area-inset-bottom))':'0px'),
<view :style="{opacity:`${pageId!=0?100:(scrollTop-20)}%`}"> }">
<view class="index-title" :class="{ MainTopLeft: pageTitleStr.length > 10 }" :style="[ <view :style="{opacity:`${pageId!=0?100:(scrollTop-20)}%`}">
myPageData.home_pages.navs[active].templateBg, <view class="index-title" :class="{ MainTopLeft: pageTitleStr.length > 10 }" :style="[
titleStyle, myPageData.home_pages.navs[active].templateBg,
{ titleStyle,
color: myPageData.home_pages.navs[active].templateBg {
? myPageData.home_pages.navs[active].templateBg.titleColor color: myPageData.home_pages.navs[active].templateBg
: '', ? myPageData.home_pages.navs[active].templateBg.titleColor
}]"> : '',
<text v-if="isNavPosition == 0">{{ pageTitleStr }}</text> }]">
<view v-if="pageId!=0" class="back-arrow row items-center" @click="goback"> <text v-if="isNavPosition == 0">{{ pageTitleStr }}</text>
<u-icon name="home_1" custom-prefix="tffont" color="#111" size="38" <view v-if="pageId!=0" class="back-arrow row items-center" @click="goback">
style="font-weight: bolder;"></u-icon> <u-icon name="home_1" custom-prefix="tffont" color="#111" size="38"
</view> style="font-weight: bolder;"></u-icon>
</view> </view>
</view> </view>
<u-tabs v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" name="name" :list="myPageData.home_pages.navs" </view>
:is-scroll="true" :active-color="mainColor" :current="active" :bar-width="80" :font-size="32" :bold="false" <u-tabs v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" name="name"
@change="changeHandler"></u-tabs> :list="myPageData.home_pages.navs" :is-scroll="true" :active-color="mainColor" :current="active"
<template v-for="(item, i) in myPageData.home_pages.navs"> :bar-width="80" :font-size="32" :bold="false" @change="changeHandler"></u-tabs>
<view :key="i" v-if="active == i"> <template v-for="(item, i) in myPageData.home_pages.navs">
<template v-for="(d, di) in item.template.data"> <view :key="i" v-if="active == i">
<search v-if="d.id == 'search' && isNavPosition == 0" :style-str="d.data" :key="di"></search> <template v-for="(d, di) in item.template.data">
<swiper v-if="d.id == 'banner'" :swipers="d.data" :key="di"></swiper> <search v-if="d.id == 'search' && isNavPosition == 0" :style-str="d.data" :key="di">
<empty v-if="d.id == 'empty'" :block="d.data" :key="di"></empty> </search>
<rubik v-if="d.id == 'rubik'" :ad="d.data" :key="di"></rubik> <swiper v-if="d.id == 'banner'" :swipers="d.data" :key="di"></swiper>
<goods v-if="d.id == 'goods'" :goods="d.data" :key="di"></goods> <empty v-if="d.id == 'empty'" :block="d.data" :key="di"></empty>
<notice v-if="d.id == 'notice'" :notice="d.data" :key="di"></notice> <rubik v-if="d.id == 'rubik'" :ad="d.data" :key="di"></rubik>
<gridnav v-if="d.id == 'nav'" :navs="d.data" :key="di"></gridnav> <goods v-if="d.id == 'goods'" :goods="d.data" :key="di"></goods>
<pagetitle v-if="d.id == 'link'" :ts="d.data" :key="di"></pagetitle> <notice v-if="d.id == 'notice'" :notice="d.data" :key="di"></notice>
<videopage v-if="d.id == 'video'" :video="d.data" :key="di"></videopage> <gridnav v-if="d.id == 'nav'" :navs="d.data" :key="di"></gridnav>
<copyright v-if="d.id == 'copyright'" :cop="d.data" :key="di"></copyright> <pagetitle v-if="d.id == 'link'" :ts="d.data" :key="di"></pagetitle>
<checkin v-if="d.id == 'check-in'" :check="d.data" :key="di"></checkin> <videopage v-if="d.id == 'video'" :video="d.data" :key="di"></videopage>
<userbox v-if="d.id == 'user-info'" :ts="d.data" :key="di"></userbox> <copyright v-if="d.id == 'copyright'" :cop="d.data" :key="di"></copyright>
<userorder v-if="d.id == 'user-order'" :uo="d.data" :key="di"></userorder> <checkin v-if="d.id == 'check-in'" :check="d.data" :key="di"></checkin>
<checkform v-if="d.id == 'form'" :forms="d.data" :key="di"></checkform> <userbox v-if="d.id == 'user-info'" :ts="d.data" :key="di"></userbox>
<addialog v-if="d.id == 'modal' && d.data.opened" :ads="d.data" :key="di"></addialog> <userorder v-if="d.id == 'user-order'" :uo="d.data" :key="di"></userorder>
<quicknav v-if="d.id == 'quick-nav' && d.data.navSwitch == 1" :navs="d.data" :key="di"></quicknav> <checkform v-if="d.id == 'form'" :forms="d.data" :key="di"></checkform>
<shopinfo v-if="d.id == 'shop-info'" :ad="d.data" :key="di" ref="son"></shopinfo> <addialog v-if="d.id == 'modal' && d.data.opened" :ads="d.data" :key="di"></addialog>
</template> <quicknav v-if="d.id == 'quick-nav' && d.data.navSwitch == 1" :navs="d.data" :key="di">
</view> </quicknav>
</template> <shopinfo v-if="d.id == 'shop-info'" :ad="d.data" :key="di" ref="son"></shopinfo>
<coupon v-if="showCoupons" :coupon-message="couponMessage" :cform="ComeFrom" @goLook="()=>showCoupons = false" @closeBtn="()=>showCoupons = false"></coupon> </template>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth> </view>
<official-account></official-account> </template>
</view> <coupon v-if="showCoupons" :coupon-message="couponMessage" :cform="ComeFrom"
</view> @goLook="()=>showCoupons = false" @closeBtn="()=>showCoupons = false"></coupon>
</scroll-view> <auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
<view v-if="showtabs"> <official-account></official-account>
<tabbar></tabbar> </view>
</view> </view>
</view> </scroll-view>
</template> <view v-if="showtabs">
<tabbar></tabbar>
<script> </view>
import tabbar from "@/components/tabbar/index"; </view>
import search from "@/components/search/index"; </template>
import swiper from "@/components/swiper/index";
import empty from "@/components/empty/index"; <script>
import rubik from "@/components/rubik/index"; import tabbar from "@/components/tabbar/index";
import goods from "@/components/goods/index"; import search from "@/components/search/index";
import notice from "@/components/notice/index"; import swiper from "@/components/swiper/index";
import gridnav from "@/components/gridnav/index"; import empty from "@/components/empty/index";
import pagetitle from "@/components/pagetitle/index"; import rubik from "@/components/rubik/index";
import videopage from "@/components/videopage/index"; import goods from "@/components/goods/index";
import copyright from "@/components/copyright/index"; import notice from "@/components/notice/index";
import checkin from "@/components/checkin/index"; import gridnav from "@/components/gridnav/index";
import userbox from "@/components/userbox/index"; import pagetitle from "@/components/pagetitle/index";
import userorder from "@/components/userorder/index"; import videopage from "@/components/videopage/index";
import checkform from "@/components/checkform/index"; import copyright from "@/components/copyright/index";
import addialog from "@/components/addialog/index"; import checkin from "@/components/checkin/index";
import quicknav from "@/components/quicknav/index"; import userbox from "@/components/userbox/index";
import coupon from "@/components/coupons/coupons"; import userorder from "@/components/userorder/index";
import shopinfo from "@/components/shopinfo/shopinfo"; import checkform from "@/components/checkform/index";
import auth from "@/components/auth/index.vue"; import addialog from "@/components/addialog/index";
import quicknav from "@/components/quicknav/index";
const innerAudioContext = uni.createInnerAudioContext(); import coupon from "@/components/coupons/coupons";
export default { import shopinfo from "@/components/shopinfo/shopinfo";
data() { import auth from "@/components/auth/index.vue";
return {
myPageData: {}, const innerAudioContext = uni.createInnerAudioContext();
mainColor: "", export default {
active: 0, data() {
pageId: 0, return {
setting: {}, myPageData: {},
showtabs: true, mainColor: "",
showCoupons: false, active: 0,
couponMessage: "", pageId: 0,
pageTitleStr: "", setting: {},
titleStyle: "", showtabs: true,
pagePaddingBottom: "0px", showCoupons: false,
showAuth: false, couponMessage: "",
u: {}, pageTitleStr: "",
showStart: false, titleStyle: "",
startData: {}, pagePaddingBottom: "0px",
ComeFrom: "", showAuth: false,
safeTop:0, u: {},
isNavPosition:0, showStart: false,
scrollTop:0 startData: {},
}; ComeFrom: "",
}, safeTop: 0,
components: { isNavPosition: 0,
tabbar, scrollTop: 0
search, };
swiper, },
empty, components: {
rubik, tabbar,
goods, search,
notice, swiper,
gridnav, empty,
pagetitle, rubik,
videopage, goods,
copyright, notice,
checkin, gridnav,
userbox, pagetitle,
userorder, videopage,
checkform, copyright,
addialog, checkin,
quicknav, userbox,
coupon, userorder,
shopinfo, checkform,
auth addialog,
}, quicknav,
onLoad(options) { coupon,
let that = this; shopinfo,
let c = this.$uiConfig.is_bang ? 78 : 50; auth
this.contentHeight = this.$utils.calcContentHeight(c); },
if (options && options.page_id) { onLoad(options) {
this.pageId = options.page_id; let that = this;
let queryString = ""; let c = this.$uiConfig.is_bang ? 78 : 50;
for (var k in options) { this.contentHeight = this.$utils.calcContentHeight(c);
queryString += `&${k}=${options[k]}`; if (options && options.page_id) {
} this.pageId = options.page_id;
if (queryString != "") { let queryString = "";
queryString = for (var k in options) {
"/pages/index/index?" + queryString.substring(1, queryString.length); queryString += `&${k}=${options[k]}`;
} }
if (options && options.scene) { if (queryString != "") {
//兼容之前小程序的调转 queryString =
this.getjump(options.scene); "/pages/index/index?" + queryString.substring(1, queryString.length);
} }
if (options && options.scene) {
} //兼容之前小程序的调转
const mu = uni.getStorageSync('mall_UserInfo') this.getjump(options.scene);
const bu = uni.getStorageSync('b2b_user') }
if(!mu || !bu) this.showAuth= true }
const mu = uni.getStorageSync('mall_UserInfo')
this.init() const bu = uni.getStorageSync('b2b_user')
uni.showNavigationBarLoading();
if (uni.getStorageSync('coupons')) { if (!mu || !bu) this.showAuth = true
this.showCoupons = true;
this.couponMessage = uni.getStorageSync('coupons'); this.init()
} uni.showNavigationBarLoading();
}, if (uni.getStorageSync('coupons')) {
mounted() { this.showCoupons = true;
const that = this this.couponMessage = uni.getStorageSync('coupons');
uni.getSystemInfo({ }
success(res) { },
that.titleStyle = { mounted() {
height: "45px", const that = this
paddingTop: `${res.statusBarHeight}px`, uni.getSystemInfo({
}; success(res) {
that.safeTop = res.statusBarHeight that.titleStyle = {
} height: "45px",
}); paddingTop: `${res.statusBarHeight}px`,
}, };
// #ifdef MP-WEIXIN that.safeTop = res.statusBarHeight
onShareTimeline() { }
let uid = uni.getStorageSync("mall_UserInfo") ? });
uni.getStorageSync("mall_UserInfo").UserId : },
0; // #ifdef MP-WEIXIN
let title = this.setting.share_title ? onShareTimeline() {
this.setting.share_title : let uid = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("basedata").mall.name; uni.getStorageSync("mall_UserInfo").UserId :
0;
return { let title = this.setting.share_title ?
title: title, this.setting.share_title :
query: "user_id=" + uid+this.$uiConfig.DIRECT_PARAMETER, uni.getStorageSync("basedata").mall.name;
imageUrl: "",
}; return {
}, title: title,
onShareAppMessage(res) { query: "user_id=" + uid + this.$uiConfig.DIRECT_PARAMETER,
let uid = uni.getStorageSync("mall_UserInfo") ? imageUrl: "",
uni.getStorageSync("mall_UserInfo").UserId : };
0; },
let title = this.setting.share_title ? onShareAppMessage(res) {
this.setting.share_title : let uid = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("basedata").mall.name; uni.getStorageSync("mall_UserInfo").UserId :
0;
return { let title = this.setting.share_title ?
title: title, this.setting.share_title :
path: "/pages/index/index?user_id=" + uid+this.$uiConfig.DIRECT_PARAMETER, uni.getStorageSync("basedata").mall.name;
imageUrl: "",
}; return {
}, title: title,
// #endif path: "/pages/index/index?user_id=" + uid + this.$uiConfig.DIRECT_PARAMETER,
onShow() { imageUrl: "",
setTimeout(() => { };
uni.hideNavigationBarLoading(); },
}, 500); // #endif
this.mainColor = this.$uiConfig.mainColor; onShow() {
this.$utils.VersionUpdate() setTimeout(() => {
}, uni.hideNavigationBarLoading();
}, 500);
methods: { this.mainColor = this.$uiConfig.mainColor;
startb() { this.$utils.VersionUpdate()
this.showStart = false; },
if (innerAudioContext != undefined) {
innerAudioContext.stop(); methods: {
} startb() {
}, this.showStart = false;
getunilogin(res) { if (innerAudioContext != undefined) {
let that = this; innerAudioContext.stop();
uni.login({ }
provider: "weixin", },
success: (info) => { getunilogin(res) {
let obj = { let that = this;
Name: res.userInfo.nickName, uni.login({
Photo: res.userInfo.avatarUrl, provider: "weixin",
code: info.code, success: (info) => {
}; let obj = {
that.getCode(obj); Name: res.userInfo.nickName,
} Photo: res.userInfo.avatarUrl,
}); code: info.code,
}, };
getCode(obj) { that.getCode(obj);
var that = this; }
that.request2({ });
url: "/api/mall/GetWeChatOpenId", },
data: { getCode(obj) {
Code: obj.code, var that = this;
}, that.request2({
}, url: "/api/mall/GetWeChatOpenId",
(res) => { data: {
if (res.resultCode == 1) { Code: obj.code,
obj.OpenId = res.data; },
that.getLogin(obj); },
} (res) => {
} if (res.resultCode == 1) {
); obj.OpenId = res.data;
}, that.getLogin(obj);
getLogin(obj) { }
var that = this; }
that.request2({ );
url: "/api/AppletLogin/Login", },
data: { getLogin(obj) {
Source: 1, var that = this;
OpenId: obj.OpenId, that.request2({
Name: obj.Name, url: "/api/AppletLogin/Login",
Photo: obj.Photo, data: {
Moblie: "", Source: 1,
}, OpenId: obj.OpenId,
}, Name: obj.Name,
(res) => { Photo: obj.Photo,
if (res.resultCode == 1) { Moblie: "",
uni.setStorageSync("mall_UserInfo", res.data); },
that.u = res.data; },
that.init(); (res) => {
} if (res.resultCode == 1) {
} uni.setStorageSync("mall_UserInfo", res.data);
); that.u = res.data;
}, that.init();
goback() { }
uni.redirectTo({ }
url:'/pages/index/index' );
}) },
}, goback() {
uni.redirectTo({
url: '/pages/index/index'
})
},
init() { init() {
this.request2({ const parameter = {VipCusType:1,page_id: this.pageId}
url: "/api/Mall/GetHome", // #ifdef MP-DI
data: { parameter.VipCusType = 2
page_id: this.pageId, // #endif
}, this.request2({
}, url: "/api/Mall/GetHome",
(res) => { data: parameter,
this.myPageData = res.data; },
uni.setStorageSync("basedata", res.data); (res) => {
if (res.data && res.data.mall && res.data.mall.setting) { this.myPageData = res.data;
this.setting = res.data.mall.setting; uni.setStorageSync("basedata", res.data);
} if (res.data && res.data.mall && res.data.mall.setting) {
this.formatBg(); this.setting = res.data.mall.setting;
if (this.pageId == 0) { }
this.pageTitleStr = res.data.home_pages.title; this.formatBg();
} else { if (this.pageId == 0) {
this.pageTitleStr = res.data.home_pages.navs[0].name; this.pageTitleStr = res.data.home_pages.title;
} } else {
} this.pageTitleStr = res.data.home_pages.navs[0].name;
); }
}, }
formatBg() { );
this.myPageData.home_pages.navs.forEach((y) => { },
y.template.data.forEach((x) => { formatBg() {
if (x.id == "background") { this.myPageData.home_pages.navs.forEach((y) => {
y.templateBg = {}; y.template.data.forEach((x) => {
if (x.data.showImg) { if (x.id == "background") {
y.templateBg.backgroundColor = x.data.backgroundColor; y.templateBg = {};
y.templateBg.backgroundImage = `url('${x.data.backgroundPicUrl}')`; if (x.data.showImg) {
y.templateBg.backgroundPosition = x.data.positionText; y.templateBg.backgroundColor = x.data.backgroundColor;
y.templateBg.backgroundRepeat = "no-repeat"; y.templateBg.backgroundImage = `url('${x.data.backgroundPicUrl}')`;
y.templateBg.backgroundSize = "auto auto"; y.templateBg.backgroundPosition = x.data.positionText;
} else { y.templateBg.backgroundRepeat = "no-repeat";
y.templateBg.background = x.data.backgroundColor; y.templateBg.backgroundSize = "auto auto";
y.templateBg.titleColor = "#000 !important"; } else {
} y.templateBg.background = x.data.backgroundColor;
y.templateBg.overflowY = "auto"; y.templateBg.titleColor = "#000 !important";
y.templateBg.height = this.contentHeight + "px"; }
y.templateBg.paddingTop = `${this.safeTop}px` y.templateBg.overflowY = "auto";
} y.templateBg.height = this.contentHeight + "px";
}); y.templateBg.paddingTop = `${this.safeTop}px`
if (!y.templateBg) { }
y.templateBg = { titleColor: "#000" }; });
} if (!y.templateBg) {
}); y.templateBg = {
}, titleColor: "#000"
changeHandler(i) { };
this.active = i; }
}, });
reloadUserinfo() { },
this.u = uni.getStorageSync("mall_UserInfo"); changeHandler(i) {
this.init(); this.active = i;
}, },
gbAuth() { reloadUserinfo() {
this.showAuth = false; this.u = uni.getStorageSync("mall_UserInfo");
}, this.init();
handleScroll(val){ },
this.scrollTop = val.target.scrollTop gbAuth() {
}, this.showAuth = false;
getjump(scene) { },
let a = "YZnsGuRojCKBkb1siP3VwkhkPFvh-D"; //测试数据 handleScroll(val) {
this.request({ this.scrollTop = val.target.scrollTop
url: "", },
data: { getjump(scene) {
r: "api/default/qr-code-parameter", let a = "YZnsGuRojCKBkb1siP3VwkhkPFvh-D"; //测试数据
token: scene, this.request({
}, url: "",
}, data: {
(res) => { r: "api/default/qr-code-parameter",
uni.setStorageSync("pid", { token: scene,
pid: res.data.detail.user_id ? res.data.detail.user_id : 0, },
}); //存储上级的id },
let objurl = this.ObjectToUrl(res.data.detail.data); (res) => {
uni.navigateTo({ uni.setStorageSync("pid", {
url: "/" + res.data.detail.path + "?" + objurl, pid: res.data.detail.user_id ? res.data.detail.user_id : 0,
}); }); //存储上级的id
} let objurl = this.ObjectToUrl(res.data.detail.data);
); uni.navigateTo({
}, url: "/" + res.data.detail.path + "?" + objurl,
ObjectToUrl(e, t) { });
var n = ""; }
for (var i in e) );
n += "&" + i + "=" + (t ? encodeURIComponent(e[i]) : e[i]); },
return n.substr(1); ObjectToUrl(e, t) {
}, var n = "";
}, for (var i in e)
}; n += "&" + i + "=" + (t ? encodeURIComponent(e[i]) : e[i]);
</script> return n.substr(1);
},
<style> },
.content { };
display: flex; </script>
flex-direction: column;
width: 100%; <style>
overflow-x: hidden; .content {
} display: flex;
flex-direction: column;
.index-title { width: 100%;
line-height: 45px !important; overflow-x: hidden;
font-size: 16px; }
text-align: center;
position: fixed; .index-title {
left: 0; line-height: 45px !important;
top: 0; font-size: 16px;
width: 100%; text-align: center;
color: #fff; position: fixed;
box-sizing: content-box; left: 0;
z-index: 999999; top: 0;
background-color: #FFF; width: 100%;
} color: #fff;
box-sizing: content-box;
.back-arrow { z-index: 999999;
position: absolute; background-color: #FFF;
left: 5px; }
bottom: 10px;
width: 60rpx; .back-arrow {
height: 60rpx; position: absolute;
border-radius: 60rpx; left: 5px;
display: flex; bottom: 10px;
align-items: center; width: 60rpx;
justify-content: center; height: 60rpx;
} border-radius: 60rpx;
display: flex;
.Startbtn { align-items: center;
position: absolute; justify-content: center;
top: 10px; }
right: 15px;
width: 50px; .Startbtn {
height: 20px; position: absolute;
background: rgba(45, 45, 45, 0.5); top: 10px;
border-radius: 4px; right: 15px;
display: flex; width: 50px;
align-items: center; height: 20px;
justify-content: center; background: rgba(45, 45, 45, 0.5);
color: #fff; border-radius: 4px;
} display: flex;
align-items: center;
.MainTopLeft { justify-content: center;
text-align: left !important; color: #fff;
padding-left: 10px; }
}
.MainTopLeft {
.safe-top { text-align: left !important;
height: unset !important; padding-left: 10px;
padding-bottom: 0rpx !important; }
}
.safe-top {
height: unset !important;
padding-bottom: 0rpx !important;
}
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment