Commit f0be7037 authored by 罗超's avatar 罗超

修改了部分样式

parent 51c316fb
...@@ -167,7 +167,8 @@ export default { ...@@ -167,7 +167,8 @@ export default {
this.navs = uni.getStorageSync("basedata") this.navs = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").navbar.navs ? uni.getStorageSync("basedata").navbar.navs
: []; : [];
},2000) this.activeHandler();
},3000)
} }
this.activeHandler(); this.activeHandler();
...@@ -175,9 +176,17 @@ export default { ...@@ -175,9 +176,17 @@ export default {
methods: { methods: {
activeHandler() { activeHandler() {
let t = getCurrentPages(); let t = getCurrentPages();
this.crtPath = "/" + t[t.length - 1].route; let query=t[t.length - 1].__displayReporter.query
let queryString=''
for(var k in query){
queryString+=`&${k}=${query[k]}`
}
if(queryString!=''){
queryString="?"+queryString.substring(1,queryString.length)
}
this.crtPath = "/" + t[t.length - 1].route+queryString;
this.navs.forEach((x, i) => { this.navs.forEach((x, i) => {
if (x.url.split("?")[0] == this.crtPath) { if (x.url == this.crtPath) {
this.active = i; this.active = i;
} }
}); });
......
<template> <template>
<view class="content" v-if="myPageData.home_pages" :style="{ 'padding-bottom': showtabs==ture? '100rpx':0 }"> <view v-if="myPageData.home_pages" :style="[myPageData.home_pages.navs[active].templateBg]">
<view
class="content"
:style="{ 'padding-bottom': showtabs==ture? '100rpx':0,paddingTop:pagePaddingBottom }"
>
<view
class="index-title"
:style="[myPageData.home_pages.navs[active].templateBg,titleStyle,{color:myPageData.home_pages.navs[active].templateBg?myPageData.home_pages.navs[active].templateBg.titleColor:''}]"
>
<text>{{pageTitleStr}}</text>
<view class="back-arrow" v-if="showBack" @click="goback">
<u-icon name="arrow-left" size="44"></u-icon>
</view>
</view>
<u-tabs <u-tabs
v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1" v-if="myPageData.home_pages && myPageData.home_pages.navs.length > 1"
name="name" name="name"
...@@ -13,7 +26,7 @@ ...@@ -13,7 +26,7 @@
@change="changeHandler" @change="changeHandler"
></u-tabs> ></u-tabs>
<template v-for="(item, i) in myPageData.home_pages.navs"> <template v-for="(item, i) in myPageData.home_pages.navs">
<view :style="item.templateBg" :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'" :style-str="d.data" :key="di"></search> <search v-if="d.id == 'search'" :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>
...@@ -23,46 +36,18 @@ ...@@ -23,46 +36,18 @@
<notice v-if="d.id == 'notice'" :notice="d.data" :key="di"></notice> <notice v-if="d.id == 'notice'" :notice="d.data" :key="di"></notice>
<gridnav v-if="d.id == 'nav'" :navs="d.data" :key="di"></gridnav> <gridnav v-if="d.id == 'nav'" :navs="d.data" :key="di"></gridnav>
<pagetitle v-if="d.id == 'link'" :ts="d.data" :key="di"></pagetitle> <pagetitle v-if="d.id == 'link'" :ts="d.data" :key="di"></pagetitle>
<videopage <videopage v-if="d.id == 'video'" :video="d.data" :key="di"></videopage>
v-if="d.id == 'video'" <copyright v-if="d.id == 'copyright'" :cop="d.data" :key="di"></copyright>
:video="d.data" <checkin v-if="d.id == 'check-in'" :check="d.data" :key="di"></checkin>
:key="di"
></videopage>
<copyright
v-if="d.id == 'copyright'"
:cop="d.data"
:key="di"
></copyright>
<checkin
v-if="d.id == 'check-in'"
:check="d.data"
:key="di"
></checkin>
<userbox v-if="d.id == 'user-info'" :ts="d.data" :key="di"></userbox> <userbox v-if="d.id == 'user-info'" :ts="d.data" :key="di"></userbox>
<view v-if="d.id == 'image-text'" class="imageText" :key="di"> <view v-if="d.id == 'image-text'" class="imageText" :key="di">
<view v-html="d.data.content"></view> <view v-html="d.data.content"></view>
</view> </view>
<userorder <userorder v-if="d.id == 'user-order'" :uo="d.data" :key="di"></userorder>
v-if="d.id == 'user-order'"
:uo="d.data"
:key="di"
></userorder>
<mapi v-if="d.id == 'map'" :mapi="d.data" :key="di"></mapi> <mapi v-if="d.id == 'map'" :mapi="d.data" :key="di"></mapi>
<checkform <checkform v-if="d.id == 'form'" :forms="d.data" :key="di"></checkform>
v-if="d.id == 'form'" <addialog v-if="d.id == 'modal' && d.data.opened" :ads="d.data" :key="di"></addialog>
:forms="d.data" <quicknav v-if="d.id == 'quick-nav' && d.data.navSwitch == 1" :navs="d.data" :key="di"></quicknav>
: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>
</template> </template>
</view> </view>
</template> </template>
...@@ -70,13 +55,17 @@ ...@@ -70,13 +55,17 @@
<tabbar></tabbar> <tabbar></tabbar>
</view> </view>
<view class="tips_t" v-if="add_show==1&& JSON.stringify(setting) != '{}' " :style="{ <view
class="tips_t"
v-if="add_show==1&& JSON.stringify(setting) != '{}' "
:style="{
'border-radius':setting.add_app_bg_radius+'rpx', 'border-radius':setting.add_app_bg_radius+'rpx',
'opacity':setting.add_app_bg_transparency/100 'opacity':setting.add_app_bg_transparency/100
}"> }"
>
<u-icon name="cross" color="#fff" @click="close"></u-icon> <u-icon name="cross" color="#fff" @click="close"></u-icon>
<view style="width: 1px;height: 20px;margin:0 10px;background: #fff;"></view> <view style="width: 1px;height: 20px;margin:0 10px;background: #fff;"></view>
<Text style='color: #fff;'>{{setting.add_app_text}}</Text> <Text style="color: #fff;">{{setting.add_app_text}}</Text>
<view class="triangle-up"></view> <view class="triangle-up"></view>
</view> </view>
<coupon <coupon
...@@ -86,6 +75,7 @@ ...@@ -86,6 +75,7 @@
@closeBtn="closeBtn" @closeBtn="closeBtn"
></coupon> ></coupon>
</view> </view>
</view>
</template> </template>
<script> <script>
...@@ -112,17 +102,21 @@ export default { ...@@ -112,17 +102,21 @@ export default {
data() { data() {
return { return {
title: "Hello", title: "Hello",
myPageData:{}, myPageData: {},
indexPageData: {}, indexPageData: {},
mainColor: "", mainColor: "",
active: 0, active: 0,
contentHeight: 0, contentHeight: 0,
pageId:0, pageId: 0,
setting:{}, setting: {},
add_show:1, add_show: 1,
showtabs:true, showtabs: true,
showCoupons:false, showCoupons: false,
couponMessage:'', couponMessage: "",
pageTitleStr: "",
titleStyle: "",
pagePaddingBottom: "0px",
showBack: false,
}; };
}, },
components: { components: {
...@@ -144,102 +138,150 @@ export default { ...@@ -144,102 +138,150 @@ export default {
checkform, checkform,
addialog, addialog,
quicknav, quicknav,
coupon coupon,
}, },
onLoad(options) { onLoad(options) {
console.log(options,'option'); console.log(options, "option");
let that = this;
uni.getSystemInfo({
success(res) {
that.titleStyle = {
height: "45px",
paddingTop: `${res.statusBarHeight}px`,
};
that.pagePaddingBottom = 45 + res.statusBarHeight + "px";
},
});
let c = this.$uiConfig.is_bang ? 78 : 50; let c = this.$uiConfig.is_bang ? 78 : 50;
this.contentHeight = this.$utils.calcContentHeight(c); this.contentHeight = this.$utils.calcContentHeight(c);
if(options&&options.page_id){ if (options && options.page_id) {
this.pageId=options.page_id this.pageId = options.page_id;
this.showtabs=false this.showtabs = false;
this.contentHeight = this.$utils.calcContentHeight(); this.contentHeight = this.$utils.calcContentHeight();
} }
if(options && options.custom_params){ if (options && options.custom_params) {
let custom_params = JSON.parse(decodeURIComponent(options.custom_params)) let custom_params = JSON.parse(decodeURIComponent(options.custom_params));
console.log(custom_params) console.log(custom_params);
if(custom_params.user_id){ if (custom_params.user_id) {
uni.setStorageSync("pid", { pid: custom_params.user_id}); uni.setStorageSync("pid", { pid: custom_params.user_id });
} }
} }
if(options&&options.user_id){ if (options && options.user_id) {
uni.setStorageSync("pid", {pid:options.user_id}); uni.setStorageSync("pid", { pid: options.user_id });
} }
if(options&&options.scene){//兼容之前小程序的调转 if (options && options.scene) {
this.getjump(options.scene) //兼容之前小程序的调转
this.getjump(options.scene);
} }
wx.showShareMenu({ wx.showShareMenu({
withShareTicket:true, withShareTicket: true,
menus:['shareAppMessage','shareTimeline'] menus: ["shareAppMessage", "shareTimeline"],
}) });
this.init(); this.init();
let set = uni.getStorageSync("basedata")? uni.getStorageSync("basedata").mall.setting:{}; let set = uni.getStorageSync("basedata")
if(!uni.getStorageSync("add_top_app")){ ? uni.getStorageSync("basedata").mall.setting
uni.setStorageSync("add_top_app", {add_top_app_show:1}); : {};
if (!uni.getStorageSync("add_top_app")) {
uni.setStorageSync("add_top_app", { add_top_app_show: 1 });
} }
this.add_show = uni.getStorageSync("add_top_app")?uni.getStorageSync("add_top_app").add_top_app_show:1; this.add_show = uni.getStorageSync("add_top_app")
this.setting =set; ? uni.getStorageSync("add_top_app").add_top_app_show
: 1;
this.setting = set;
// console.log(this.setting) // console.log(this.setting)
console.log(uni.getStorageSync("basedata")) console.log(uni.getStorageSync("basedata"));
this.isShowBack();
uni.showNavigationBarLoading(); uni.showNavigationBarLoading();
}, },
onShareTimeline(){ onShareTimeline() {
setTimeout(()=>{ setTimeout(() => {
console.log('分享调用') console.log("分享调用");
this.getReceive() this.getReceive();
},2500) }, 2500);
let uid=uni.getStorageSync('mall_UserInfo') ?uni.getStorageSync('mall_UserInfo').UserId:0; let uid = uni.getStorageSync("mall_UserInfo")
console.log(uid) ? uni.getStorageSync("mall_UserInfo").UserId
return{ : 0;
title: '', console.log(uid);
return {
title: "",
query: "user_id=" + uid, query: "user_id=" + uid,
imageUrl: '' imageUrl: "",
} };
}, },
onShareAppMessage(res) { onShareAppMessage(res) {
setTimeout(()=>{ setTimeout(() => {
console.log('分享调用') console.log("分享调用");
this.getReceive() this.getReceive();
},2500) }, 2500);
let uid=uni.getStorageSync('mall_UserInfo') ?uni.getStorageSync('mall_UserInfo').UserId:0 let uid = uni.getStorageSync("mall_UserInfo")
? uni.getStorageSync("mall_UserInfo").UserId
: 0;
return { return {
title:this.setting.share_title?this.setting.share_title:uni.getStorageSync("basedata").mall.name, title: this.setting.share_title
? this.setting.share_title
: uni.getStorageSync("basedata").mall.name,
path: "/pages/index/index?user_id=" + uid, path: "/pages/index/index?user_id=" + uid,
imageUrl: this.setting.share_pic?this.setting.share_pic:'', imageUrl: this.setting.share_pic ? this.setting.share_pic : "",
}; };
}, },
onShow() { onShow() {
setTimeout(() => { setTimeout(() => {
uni.hideNavigationBarLoading(); uni.hideNavigationBarLoading();
}, 500); }, 500);
this.mainColor = this.$uiConfig.mainColor; this.mainColor = this.$uiConfig.mainColor;
this.init() this.init();
}, },
methods: { methods: {
getjump(scene){ goback() {
uni.navigateBack({
let a= 'YZnsGuRojCKBkb1siP3VwkhkPFvh-D' //测试数据 delta: 1,
});
},
isShowBack() {
let navs = uni.getStorageSync("basedata")
? uni.getStorageSync("basedata").navbar.navs
: [];
if (navs) {
let t = getCurrentPages();
let query = t[t.length - 1].__displayReporter.query;
let queryString = "";
for (var k in query) {
queryString += `&${k}=${query[k]}`;
}
if (queryString != "") {
queryString = "?" + queryString.substring(1, queryString.length);
}
this.crtPath = "/" + t[t.length - 1].route + queryString;
let isExsit = false;
navs.forEach((x, i) => {
if (x.url == this.crtPath) {
isExsit = true;
}
});
this.showBack = !isExsit;
}
},
getjump(scene) {
let a = "YZnsGuRojCKBkb1siP3VwkhkPFvh-D"; //测试数据
this.request( this.request(
{ {
url: "", url: "",
data: { data: {
r: "api/default/qr-code-parameter", r: "api/default/qr-code-parameter",
token: scene, token: scene,
}
}, },
res => { },
console.log(res.data.detail.path) (res) => {
uni.setStorageSync("pid", {pid:res.data.detail.user_id?res.data.detail.user_id:0}); //存储上级的id console.log(res.data.detail.path);
let objurl= this.ObjectToUrl(res.data.detail.data) uni.setStorageSync("pid", {
pid: res.data.detail.user_id ? res.data.detail.user_id : 0,
}); //存储上级的id
let objurl = this.ObjectToUrl(res.data.detail.data);
uni.navigateTo({ uni.navigateTo({
url:'/'+res.data.detail.path+'?'+objurl, url: "/" + res.data.detail.path + "?" + objurl,
}); });
} }
); );
...@@ -253,74 +295,97 @@ export default { ...@@ -253,74 +295,97 @@ export default {
init() { init() {
this.request2( this.request2(
{ {
url: '/api/Mall/GetHome', url: "/api/Mall/GetHome",
data: { data: {
page_id:this.pageId page_id: this.pageId,
}, },
}, },
(res) => { (res) => {
this.indexPageData = res.data.home_pages.navs[0].template.data; this.indexPageData = res.data.home_pages.navs[0].template.data;
this.myPageData=res.data; this.myPageData = res.data;
uni.setStorageSync("basedata", res.data); uni.setStorageSync("basedata", res.data);
if (res.data.home_pages.title != "") { if (res.data.home_pages.title != "") {
if(this.pageId==0){ if (this.pageId == 0) {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: res.data.home_pages.title, title: res.data.home_pages.title,
}); });
}else{ this.pageTitleStr = res.data.home_pages.title;
} else {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: res.data.home_pages.navs[0].name, title: res.data.home_pages.navs[0].name,
}); });
this.pageTitleStr = res.data.home_pages.navs[0].name;
} }
uni.setNavigationBarColor({ // uni.setNavigationBarColor({
//字体颜色 // //字体颜色
frontColor:res.data.navbar.top_text_color, // frontColor: res.data.navbar.top_text_color,
//背景颜色 // //背景颜色
backgroundColor:res.data.navbar.top_background_color // backgroundColor: res.data.navbar.top_background_color,
}); // });
this.titleStyle.color = res.data.navbar.top_text_color;
this.titleStyle.backgroundColor =
res.data.navbar.top_background_color;
this.isShowBack();
} }
this.formatBg(); this.formatBg();
}, },
(error)=>{ (error) => {}
}
); );
}, },
close(){ close() {
this.add_show =2; this.add_show = 2;
uni.setStorageSync("add_top_app", {add_top_app_show:2}); uni.setStorageSync("add_top_app", { add_top_app_show: 2 });
}, },
changeHandler(i) { changeHandler(i) {
this.active = i; this.active = i;
}, },
formatBg() { formatBg() {
this.myPageData.home_pages.navs.forEach((y) => { this.myPageData.home_pages.navs.forEach((y) => {
y.template.data.forEach((x) => { y.template.data.forEach((x) => {
if (x.id == "background") { if (x.id == "background") {
let t = ""; let t = "";
y.templateBg = {};
if (x.data.showImg) { if (x.data.showImg) {
y.templateBg += `background-color:${x.data.backgroundColor};`; y.templateBg.backgroundColor = x.data.backgroundColor;
y.templateBg = `background-image:url('${backgroundPicUrl}');`; y.templateBg.backgroundImage = `url('${x.data.backgroundPicUrl}')`;
y.templateBg += `background-position:${x.data.positionText};`; y.templateBg.backgroundPosition = x.data.positionText;
y.templateBg += `background-repeat:${x.data.repeatText};`; y.templateBg.backgroundRepeat = x.data.repeatText ?? "no-repeat";
y.templateBg += `background-size:${x.data.backgroundWidth}% ${x.data.backgroundHeight}%;`; y.templateBg.backgroundSize = `${
x.data.backgroundWidth == 0
? "auto"
: x.data.backgroundWidth + "%"
} ${
x.data.backgroundHeight == 0
? "auto"
: x.data.backgroundHeight + "%"
}`;
} else { } else {
y.templateBg = `background:#${x.data.backgroundColor};`; y.templateBg.background = x.data.backgroundColor;
y.templateBg.titleColor = "#000 !important";
} }
if(this.myPageData.home_pages.navs.length>1){ if (this.myPageData.home_pages.navs.length > 1) {
y.templateBg += y.templateBg.overflowY = "auto";
"overflow-y:auto;height:" + this.contentHeight + "px;"; y.templateBg.height = this.contentHeight + "px";
}else{ } else {
y.templateBg += y.templateBg.overflowY = "auto";
"overflow-y:auto;height:" + (this.contentHeight+40) + "px;"; y.templateBg.height = this.contentHeight + 40 + "px";
}
if (x.data.titleColor) {
y.templateBg.titleColor = x.data.titleColor + " !important";
} }
// y.templateBg +="padding-bottom:"+(this.$uiConfig.is_bang ? '88px' : '60px')+";box-sizing: border-box;"; // y.templateBg +="padding-bottom:"+(this.$uiConfig.is_bang ? '88px' : '60px')+";box-sizing: border-box;";
} }
}); });
if(!y.templateBg){
y.templateBg={titleColor:"#000"};
}
}); });
}, },
getReceive(){//分享进入调取领券接口 getReceive() {
//分享进入调取领券接口
// 1-分享,2-购买并付款 // 1-分享,2-购买并付款
this.request2( this.request2(
{ {
...@@ -330,21 +395,20 @@ export default { ...@@ -330,21 +395,20 @@ export default {
}, },
}, },
(res) => { (res) => {
console.log(res,'res') console.log(res, "res");
if(res.couponResultCode ==1){ if (res.couponResultCode == 1) {
this.couponMessage = res.couponMessage this.couponMessage = res.couponMessage;
this.showCoupons = true; this.showCoupons = true;
} }
} }
); );
}, },
goLook(){ goLook() {
this.showCoupons = false;
},
closeBtn() {
this.showCoupons = false; this.showCoupons = false;
}, },
closeBtn(){
this.showCoupons = false
}
}, },
}; };
</script> </script>
...@@ -355,11 +419,10 @@ export default { ...@@ -355,11 +419,10 @@ export default {
flex-direction: column; flex-direction: column;
/* align-items: center; /* align-items: center;
justify-content: center; */ justify-content: center; */
} }
.content .tips_t{ .content .tips_t {
position: fixed; position: fixed;
top:8px; top: 8px;
right: 6px; right: 6px;
height: 36px; height: 36px;
background: #000000; background: #000000;
...@@ -368,9 +431,8 @@ export default { ...@@ -368,9 +431,8 @@ export default {
align-items: center; align-items: center;
padding: 0 10px; padding: 0 10px;
font-size: 12px; font-size: 12px;
} }
.triangle-up{ .triangle-up {
width: 0; width: 0;
height: 0; height: 0;
border-left: 10px solid transparent; border-left: 10px solid transparent;
...@@ -378,7 +440,24 @@ export default { ...@@ -378,7 +440,24 @@ export default {
border-bottom: 12px solid black; border-bottom: 12px solid black;
position: fixed; position: fixed;
right: 65px; right: 65px;
top:0px top: 0px;
}
.index-title {
line-height: 45px !important;
font-size: 16px;
text-align: center;
position: fixed;
left: 0;
top: 0;
width: 100%;
color: #fff;
box-sizing: content-box;
z-index: 5;
}
.back-arrow {
position: absolute;
left: 5px;
bottom: 12.5px;
} }
/* .logo { /* .logo {
height: 200rpx; height: 200rpx;
......
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