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

修改首页加载

parent 1a375c82
<script>
import {setAttatchParameter} from './plugin/utils.js'
export default {
import {
setAttatchParameter
} from './plugin/utils.js'
export default {
data() {
return {
basedata: {},
title: "",
};
},
onLaunch: function () {
onLaunch: function() {
console.log('App Launch')
this.$utils.setAttatchParameter(this)
this.init();
......@@ -19,38 +21,42 @@ export default {
// this.checkBindParentHandle(option.query)
// // #endif
},
onShow: function (option) {
console.log('App Show',option)
onShow: function(option) {
console.log('App Show', option)
this.$utils.VersionUpdate()
// #ifdef MP-DI
this.checkBindParentHandle(option.query)
// #endif
},
onHide: function () {
onHide: function() {
//console.log('App Hide')
},
methods: {
checkBindParentHandle(query){
if(query && query.direct_user_id){
if(uni.getStorageSync('mall_UserInfo')){
const {OpenId,Unoinid,Name} = uni.getStorageSync('mall_UserInfo')
if(OpenId && Unoinid) {
checkBindParentHandle(query) {
if (query && query.direct_user_id) {
if (uni.getStorageSync('mall_UserInfo')) {
const {
OpenId,
Unoinid,
Name
} = uni.getStorageSync('mall_UserInfo')
if (OpenId && Unoinid) {
const pid = parseInt(query.direct_user_id)
if(!isNaN(pid)) this.directUserLoginHandle(OpenId,Unoinid,pid,Name)
if (!isNaN(pid)) this.directUserLoginHandle(OpenId, Unoinid, pid, Name)
return
}
}
uni.setStorageSync('direct_user_id',query.direct_user_id)
uni.setStorageSync('direct_user_id', query.direct_user_id)
}
},
directUserLoginHandle(OpenId,Unoinid,Pid,MallName){
const parameters={
directUserLoginHandle(OpenId, Unoinid, Pid, MallName) {
const parameters = {
OpenId,
Unoinid,
Pid
}
this.apipost("HePingGuoLvLogin_post", parameters, r =>{
this.apipost("HePingGuoLvLogin_post", parameters, r => {
const u = r.data
const user = {
accountId: u.directCustomerId,
......@@ -58,7 +64,7 @@ export default {
customerInfoChildrenId: u.directCustomerId,
realNameAuthentication: 0,
account: "",
name:u.name,
name: u.name,
customerName: MallName,
photo: u.photo,
secretKey: "",
......@@ -68,17 +74,17 @@ export default {
createBy: u.pid,
EmLoginMobile: u.moblie,
contactNumber: u.moblie,
salesBaseInfo: u.erpBaseInfo?u.erpBaseInfo:u.salesBaseInfo,
pid:u.erpBaseInfo?u.erpBaseInfo.employeeId:u.pid,
salesBaseInfo: u.erpBaseInfo ? u.erpBaseInfo : u.salesBaseInfo,
pid: u.erpBaseInfo ? u.erpBaseInfo.employeeId : u.pid,
erpBaseInfo: u.erpBaseInfo,
count: 0,
isVip:u.isVip,
isVip: u.isVip,
customerType: 1, //直客,2-同行
directCustomerId: u.directCustomerId //直客Id
}
uni.setStorageSync('b2b_user', user)
this.user = user
uni.setStorageSync("lastLogin",new Date().getTime())
uni.setStorageSync("lastLogin", new Date().getTime())
this.$utils.setAttatchParameter(this)
})
},
......@@ -88,19 +94,22 @@ export default {
this.formatTabbar();
this.formatNavigation();
} else {
this.request2(
{
const parameter = {VipCusType:1}
// #ifdef MP-DI
parameter.VipCusType = 2
// #endif
this.request2({
url: "/api/Mall/GetHome",
data: {},
data: parameter,
},
(res) => {
uni.setStorageSync("basedata", res.data);
uni.setStorageSync('navs', res.data.navbar.navs??[])
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
if(res.data.mall.setting.mallStyle.pricecolor){
this.$uiConfig.pricecolor=res.data.mall.setting.mallStyle.pricecolor
this.$uiConfig.mainColor = res.data.mall.setting.mallStyle.main
this.$uiConfig.secondary = res.data.mall.setting.mallStyle.secondary
if (res.data.mall.setting.mallStyle.pricecolor) {
this.$uiConfig.pricecolor = res.data.mall.setting.mallStyle.pricecolor
}
this.formatTabbar();
this.formatNavigation();
......@@ -163,40 +172,48 @@ export default {
// });
},
},
};
};
</script>
<style lang="scss">
@import "uview-ui/index.scss";
@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"),
@import "uview-ui/index.scss";
@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");
font-display: swap;
}
@font-face {
font-family: "logo-font";src: url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/kznKMVuxE1tP.woff2") format("woff2"),
}
@font-face {
font-family: "logo-font";
src: url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/kznKMVuxE1tP.woff2") format("woff2"),
url("//at.alicdn.com/wf/webfont/MQHUV6e56ce5/ViySHjFRkPg9.woff") format("woff");
font-display: swap;
}
@font-face {
}
@font-face {
font-family: "DFPLiJinHeiW8-GB";
src: url("https://im.oytour.com/tripfont/cb76573b1580477fbea1ce0cc0d136e5.woff");
}
}
// @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 {
// @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}
}
image {
will-change: transform
}
</style>
\ No newline at end of file
......@@ -8,7 +8,8 @@
</view>
</image>
</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"
:style="[myPageData.home_pages.navs[active].templateBg]">
<view class="content" :style="{
'padding-bottom':(pageId==0?'calc(57px + env(safe-area-inset-bottom))':'0px'),
}">
......@@ -28,13 +29,14 @@
</view>
</view>
</view>
<u-tabs v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" name="name" :list="myPageData.home_pages.navs"
:is-scroll="true" :active-color="mainColor" :current="active" :bar-width="80" :font-size="32" :bold="false"
@change="changeHandler"></u-tabs>
<u-tabs v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" name="name"
:list="myPageData.home_pages.navs" :is-scroll="true" :active-color="mainColor" :current="active"
:bar-width="80" :font-size="32" :bold="false" @change="changeHandler"></u-tabs>
<template v-for="(item, i) in myPageData.home_pages.navs">
<view :key="i" v-if="active == i">
<template v-for="(d, di) in item.template.data">
<search v-if="d.id == 'search' && isNavPosition == 0" :style-str="d.data" :key="di"></search>
<search v-if="d.id == 'search' && isNavPosition == 0" :style-str="d.data" :key="di">
</search>
<swiper v-if="d.id == 'banner'" :swipers="d.data" :key="di"></swiper>
<empty v-if="d.id == 'empty'" :block="d.data" :key="di"></empty>
<rubik v-if="d.id == 'rubik'" :ad="d.data" :key="di"></rubik>
......@@ -49,12 +51,14 @@
<userorder v-if="d.id == 'user-order'" :uo="d.data" :key="di"></userorder>
<checkform v-if="d.id == 'form'" :forms="d.data" :key="di"></checkform>
<addialog v-if="d.id == 'modal' && d.data.opened" :ads="d.data" :key="di"></addialog>
<quicknav v-if="d.id == 'quick-nav' && d.data.navSwitch == 1" :navs="d.data" :key="di"></quicknav>
<quicknav v-if="d.id == 'quick-nav' && d.data.navSwitch == 1" :navs="d.data" :key="di">
</quicknav>
<shopinfo v-if="d.id == 'shop-info'" :ad="d.data" :key="di" ref="son"></shopinfo>
</template>
</view>
</template>
<coupon v-if="showCoupons" :coupon-message="couponMessage" :cform="ComeFrom" @goLook="()=>showCoupons = false" @closeBtn="()=>showCoupons = false"></coupon>
<coupon v-if="showCoupons" :coupon-message="couponMessage" :cform="ComeFrom"
@goLook="()=>showCoupons = false" @closeBtn="()=>showCoupons = false"></coupon>
<auth v-if="showAuth" @changeuserinfo="reloadUserinfo" @gbAuth="gbAuth"></auth>
<official-account></official-account>
</view>
......@@ -108,9 +112,9 @@
showStart: false,
startData: {},
ComeFrom: "",
safeTop:0,
isNavPosition:0,
scrollTop:0
safeTop: 0,
isNavPosition: 0,
scrollTop: 0
};
},
components: {
......@@ -158,7 +162,7 @@
const mu = uni.getStorageSync('mall_UserInfo')
const bu = uni.getStorageSync('b2b_user')
if(!mu || !bu) this.showAuth= true
if (!mu || !bu) this.showAuth = true
this.init()
uni.showNavigationBarLoading();
......@@ -190,7 +194,7 @@
return {
title: title,
query: "user_id=" + uid+this.$uiConfig.DIRECT_PARAMETER,
query: "user_id=" + uid + this.$uiConfig.DIRECT_PARAMETER,
imageUrl: "",
};
},
......@@ -204,7 +208,7 @@
return {
title: title,
path: "/pages/index/index?user_id=" + uid+this.$uiConfig.DIRECT_PARAMETER,
path: "/pages/index/index?user_id=" + uid + this.$uiConfig.DIRECT_PARAMETER,
imageUrl: "",
};
},
......@@ -277,15 +281,17 @@
},
goback() {
uni.redirectTo({
url:'/pages/index/index'
url: '/pages/index/index'
})
},
init() {
const parameter = {VipCusType:1,page_id: this.pageId}
// #ifdef MP-DI
parameter.VipCusType = 2
// #endif
this.request2({
url: "/api/Mall/GetHome",
data: {
page_id: this.pageId,
},
data: parameter,
},
(res) => {
this.myPageData = res.data;
......@@ -323,7 +329,9 @@
}
});
if (!y.templateBg) {
y.templateBg = { titleColor: "#000" };
y.templateBg = {
titleColor: "#000"
};
}
});
},
......@@ -337,7 +345,7 @@
gbAuth() {
this.showAuth = false;
},
handleScroll(val){
handleScroll(val) {
this.scrollTop = val.target.scrollTop
},
getjump(scene) {
......
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