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

修改首页加载

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