新增获取状态栏的高德、设置导航栏的高度、调整公共域名、新增导航栏跟随swiper列表滑动自动居中

master
吃肉的饺子 2022-02-13 21:38:30 +08:00
parent 280ad76434
commit 6bd4f39510
13 changed files with 460 additions and 477 deletions

71
App.vue
View File

@ -6,46 +6,47 @@
globalData:{
// domainName:'https://hengmei.scdxtc.cn/api/',
domainName:'https://hm.hmzfyy.cn/api/',
appletName:'佩丽商城'//
},
// show
onLaunch: function() {
toolAll.tools.clearClog();//
//
toolAll.tools.clearClog();
//
this.statusBarH();
//
toolAll.tools.isVedio();
//
// toolAll.tools.zhuColorT();
uni.request({
url: `${this.globalData.domainName}index/mini-program-setting`,
method: 'GET',
data: '',
header: {
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
},
success: res => {
// console.log('===>',res);
if (res.statusCode == 200) {
if (res.data.code == 0) {
uni.setStorageSync('publicColor', res.data.data.mainColor) //#3875F6 #2E8B57
// uni.setStorageSync('publicColor', '#2E8B57') //#3875F6 #2E8B57
}
}
}
})
// uni.request({
// url: `${this.globalData.domainName}index/mini-program-setting`,
// method: 'GET',
// data: '',
// header: {
// 'Content-Type': 'application/json; charset=UTF-8',
// 'Authorization': 'Bearer '+uni.getStorageSync('token') || ''
// },
// success: res => {
// // console.log('===>',res);
// if (res.statusCode == 200) {
// if (res.data.code == 0) {
// uni.setStorageSync('publicColor', res.data.data.mainColor) //#3875F6 #2E8B57
// // uni.setStorageSync('publicColor', '#2E8B57') //#3875F6 #2E8B57
// }
// }
// }
// })
},
onShow: function() {
// uni.clearStorageSync()
if(uni.getStorageSync('token')!='') {
//
toolAll.tools.daoTime();
toolAll.tools.networkStatus();//
toolAll.tools.updaX();//
}
setTimeout(()=>{
toolAll.tools.overdue();//
},3000)
toolAll.tools.isVedio();
toolAll.tools.checkQuan();
//
toolAll.tools.networkStatus();
},
onHide: function() {
toolAll.tools.closeTimer();//
//
toolAll.tools.closeTimer();
uni.removeStorageSync('isQuan');
uni.removeStorageSync('quanImg');
uni.removeStorageSync('quanId');
@ -57,7 +58,17 @@
<style>
/*每个页面公共css */
/* 阿里巴巴矢量图标库 start */
@import url("./commons/icon-font.css");
/* 阿里巴巴矢量图标库 end */
/* 项目主体样式 start */
@import url("./commons/hengmei.css");
/* 项目主体样式 end */
/* 动画样式 start */
@import url("./commons/animate.min.css");
/* 动画样式 end */
page {background-color: rgba(244, 244, 244, 1);}
</style>

View File

@ -1,6 +1,7 @@
/* 首页 */
.status-box{position: fixed;top: 0;left: 0;right: 0;z-index: 10;}
.status-nav{width: 100%;position: relative;padding: 30rpx 0;display: flex;align-items: center;}
.status-nav{width: 100%;position: relative;display: flex;align-items: center;}
/* .status-nav{width: 100%;position: relative;padding: 30rpx 0;display: flex;align-items: center;} */
.tab-title{font-size: 36rpx;font-weight: bold;color: #333333;width: 100%;}
.tcenter{text-align: center;}
.input-box{width: 100%;}

23
commons/icon-font.css Normal file
View File

@ -0,0 +1,23 @@
@font-face {
font-family: "iconfont"; /* Project id 3180711 */
src: url('https://at.alicdn.com/t/font_3180711_ngoezww1u8.woff2?t=1644748713104') format('woff2'),
url('https://at.alicdn.com/t/font_3180711_ngoezww1u8.woff?t=1644748713104') format('woff'),
url('https://at.alicdn.com/t/font_3180711_ngoezww1u8.ttf?t=1644748713104') format('truetype');
}
.icon {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-return:before {
content: "\e600";
}
.icon-next:before {
content: "\e60e";
}

View File

@ -0,0 +1,20 @@
<template>
<view>
</view>
</template>
<script>
export default {
name:"loading",
data() {
return {
};
}
}
</script>
<style>
</style>

View File

@ -1,19 +1,26 @@
<template>
<view class="status-box statusHNH">
<!-- 网络电量栏 start -->
<view :style="{height:statusBarHeight+'px',background:backgroudColor}"></view>
<view :style="{height: statusBarHeight+'px',background: backgroudColor}"></view>
<!-- 网络电量栏 end -->
<!-- 头部状态栏 start -->
<view class="status-nav" :style="{background:backgroudColor}">
<view class="status-nav"
:style="{background: backgroudColor,height: navBarHeight+'rpx'}">
<!-- 返回键 -->
<view @tap="backEvent" v-if="statusBack" style="height: 33rpx;width: 80rpx;flex-shrink: 0;position: absolute;">
<image v-if="backColor==0" class="tab-back" src="/static/public/backBlackm.png"></image>
<image v-if="backColor==1" class="tab-back" src="/static/public/videoBack.png"></image>
<view class="return-box" @tap="backEv" v-if="ifReturn"
:style="{height: navBarHeight+'rpx'}">
<i class="icon icon-return"
:style="{color: returnColor}"></i>
</view>
<!-- 标题 -->
<!-- <view v-if="statusTitle" :class="statusBack ? 'tcenter' : 'tleft'" class="tab-title" :style="{color:tabcolor}">{{titleVal}}</view> -->
<view v-if="statusTitle" class="tab-title tcenter" :style="{color:tabcolor}">{{titleVal}}</view>
<view v-else class="tab-title tcenter" :style="{color:tabcolor}"> </view>
<view class="tab-title" :class="['','clips1','clips2'][clipNumber]" v-if="ifTitle"
:style="{
color: titleColor,
textAlign: ifCenter ? 'center' : 'left',
padding: ifCenter ? '0px' : '0px 38px'}">
<text>{{navBarTitle}}</text>
</view>
</view>
<!-- 头部状态栏 end -->
</view>
@ -23,75 +30,102 @@
export default {
name:'status-nav',
props:{
statusTitle:{//
type:Boolean,
default:false
},
statusBack:{//
//
backgroudColor:{
type:String,
default:'#FFFFFF'
},
//
navBarHeight: {
type:Number,
default:110
},
//
ifReturn:{
type:Boolean,
default:true
},
backgroudColor:{//
type:String,
default:'#FFFFFF'
},
tabcolor:{//
//
returnColor: {
type:String,
default:'#000'
},
//
ifTitle:{
type:Boolean,
default:false
},
//
navBarTitle: {
type:String,
default:'佩丽商城'
},
//
clipNumber: {
type:Number,
default:1
},
//
titleColor:{
type:String,
default:'#333333'
},
titleVal:{//
type:String,
default:'恒美植发'
},
whereCome:{//
type:Number,
default:0
},
backColor:{//
type:Number,
default:0
//
ifCenter: {
type:Boolean,
default: false
}
},
data(){
return {
statusBarHeight: uni.getStorageSync('statusBar'),
}
},
mounted() {
// +
const query = wx.createSelectorQuery().in(this)
query.select('.statusHNH').boundingClientRect((rect) => {
// console.log('+',rect.height);
uni.setStorageSync('statusHNH',rect.height)
}).exec()
}).exec();
this.log(getApp().globalData.appletName,'status-nav组件打印');
//
let pages = getCurrentPages();
let route = pages[pages.length - 1].route;
this.log(route,'status-nav组件打印当前页面路径')
},
data() {
return {
statusBarHeight:uni.getSystemInfoSync().statusBarHeight,//
};
},
methods:{
backEvent(){//
if(this.whereCome==0 && uni.getStorageSync('firstTime')==''){
uni.reLaunch({
url:'/pages/tabbar/pagehome/pagehome'
})
} else if(this.whereCome==1){
uni.reLaunch({
url:'/pages/tabbar/pagehome/pagehome'
})
} else if(this.whereCome==2){
uni.reLaunch({
url:'/pages/tabbar/my/my'
})
} else {
uni.navigateBack({delta:1})
}
//
backEv(){
this.log('返回事件')
}
}
}
</script>
<style scoped>
.status-box{position: fixed;top: 0;left: 0;right: 0;z-index: 10;}
.status-nav{width: 100%;position: relative;padding: 30rpx 0;display: flex;align-items: center;}
.tab-back{width: 33rpx;height: 33rpx;flex-shrink: 0;position: absolute;left: 20rpx;}
.tab-title{font-size: 36rpx;font-weight: bold;color: #333333;width: 100%;}
.tcenter{text-align: center;}
.tleft{margin-left: 40rpx;}
.clips1{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 1;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
.clips2{display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 2;overflow: hidden;text-overflow: ellipsis;word-wrap: break-word;word-break:break-all;}
.status-box{
position: fixed;top: 0;left: 0;right: 0;z-index: 10;
}
.status-nav{
width: 100%;
position: relative;
display: flex;
align-items: center;
}
.return-box {
display: flex;justify-content: center;align-items: center;flex-shrink: 0;
position: absolute;
padding: 0rpx 10rpx;
}
.return-box i {font-size: 56rpx;}
.tab-title{
width: 100%;
font-size: 36rpx;font-weight: bold;
padding: 0rpx;
}
.tab-title text{display: block;margin-top: -4rpx;}
</style>

View File

@ -0,0 +1,169 @@
<template>
<view class="tabBlock" v-if="list.length > 0">
<scroll-view scroll-x="true" scroll-with-animation :scroll-left="tabsScrollLeft" @scroll="scroll">
<view class="tab" id="tab_list">
<!-- 循环体 -->
<view v-for="(item, index) in list" :key="index"
:class="['tab__item', {'tab__item--active': currentIndex === index}]"
:style="{color: (currentIndex === index ? `${itemColor}`: '')}" id="tab_item"
@click="select(item, index)">
<view class="tab__item-title">
<!-- 标题 -->
<slot name="title" :title="item.title"></slot>
</view>
<!-- 标题 -->
<view v-if="!showTitleSlot" class="tab__item-title">
{{item.title}}
</view>
</view>
</view>
<!-- 下划线 -->
<view class="tab__line"
:style="{background: lineColor, width: lineStyle.width, transform: lineStyle.transform,transitionDuration: lineStyle.transitionDuration}">
</view>
</scroll-view>
</view>
</template>
<script>
export default {
props: {
value: [Number, String],
list: { //
type: Array,
default: () => {
return []
}
},
itemColor: String, // tab
lineColor: String, // 线
lineAnimated: { // 线
type: Boolean,
default: true
}
},
data() {
return {
currentIndex: 0,
lineStyle: {},
scrollLeft: 0,
tabsScrollLeft: 0,
duration: 0.3
}
},
computed: {
showTitleSlot() {
return this.$scopedSlots.title
}
},
watch: {
list() {
this.setTabList()
},
value() {
this.currentIndex = this.value
this.setTabList()
}
},
mounted() {
this.currentIndex = this.value
this.setTabList()
if (!this.lineAnimated) {
this.duration = 0
}
console.log(this.$scopedSlots)
},
methods: {
select(item, index) {
this.$emit('input', index)
},
setTabList() {
this.$nextTick(() => {
if (this.list.length > 0) {
this.setLine()
this.scrollIntoView()
}
})
},
setLine() {
let lineWidth = 0,
lineLeft = 0
this.getElementData(`#tab_item`, (data) => {
let el = data[this.currentIndex]
this.$emit('tabheight',el.height)
lineWidth = el.width / 2
// lineLeft = el.width * (this.currentIndex + 0.5) // item
lineLeft = el.width / 2 + (-data[0].left) + el.left
this.lineStyle = {
width: `${lineWidth}px`,
transform: `translateX(${lineLeft}px) translateX(-50%)`,
transitionDuration: `${this.duration}s`
};
})
},
scrollIntoView() { // item
let lineLeft = 0;
this.getElementData('#tab_list', (data) => {
let list = data[0]
this.getElementData(`#tab_item`, (data) => {
let el = data[this.currentIndex]
// lineLeft = el.width * (this.currentIndex + 0.5) - list.width / 2 - this.scrollLeft
lineLeft = el.width / 2 + (-list.left) + el.left - list.width / 2 - this.scrollLeft
this.tabsScrollLeft = this.scrollLeft + lineLeft
})
})
},
getElementData(el, callback) {
uni.createSelectorQuery().in(this).selectAll(el).boundingClientRect().exec((data) => {
callback(data[0]);
});
},
scroll(e) {
this.scrollLeft = e.detail.scrollLeft;
}
}
}
</script>
<style lang="scss">
.tabBlock {
position: relative;
background: #fff;
.tab {
position: relative;
display: flex;
font-size: 28rpx;
padding-bottom: 15rpx;
white-space: nowrap;
&__item {
flex: 1;
// width: 30%;
text-align: center;
line-height: 90rpx;
color: $uni-text-color;
&--active {
color: $uni-color-primary;
}
&-title {
margin: 0 40rpx;
}
}
}
.tab__line {
display: block;
height: 6rpx;
position: absolute;
bottom: 20rpx;
left: 0;
z-index: 1;
border-radius: 3rpx;
position: relative;
background: $uni-color-primary;
}
}
</style>

View File

@ -91,17 +91,4 @@ export function checkSwip(){//查询主题色
export function checkBanner(data){//查询主题色
return requst.post('common/slides',data)
}
export function checkQuan(){//查询优惠券
return requst.post('user/home-coupon').then(res=>{
if(res.code==0){
if(res.data.has_coupon==1){
uni.setStorageSync('isQuan',true);
uni.setStorageSync('quanImg','https://oss.hmzfyy.cn' + res.data.home_coupon.cover);
uni.setStorageSync('quanId',res.data.home_coupon.id);
} else {
uni.setStorageSync('isQuan',false);
}
}
})
}

View File

@ -78,7 +78,8 @@ const request = (method, url, options) => {
}
return new Promise((resolve, reject) => {
uni.request({
url: `${getApp().globalData.domainName}${url}`,
// url: `${getApp().globalData.domainName}${url}`,
url: `${uni.getStorageSync('hostapi')}${url}`,
method: methods,
data: dataObj(url, options),
header: headers,
@ -108,11 +109,13 @@ const request = (method, url, options) => {
// 上传文件 封装请求
const uploadFile = (url, options) => {
this.log(1)
let tempData = options || {}
uni.showLoading({title: "上传中..."})
return new Promise((resolve, reject) => {
uni.uploadFile({
url: `${getApp().globalData.domainName}${url}`,
// url: `${getApp().globalData.domainName}${url}`,
url: `${uni.getStorageSync('hostapi')}${url}`,
filePath: tempData.file,
name: 'image',
fileType:'image',

View File

@ -1,4 +1,4 @@
import {buriedPoint,reportBuriedPoint,zhuColor,checkQuan} from './publicAPI.js';
import {buriedPoint,reportBuriedPoint,zhuColor} from './publicAPI.js';
const tools = {
timer:'',
timerNot:'',
@ -40,10 +40,6 @@ const tools = {
zhuColorT(){//调用主色调
zhuColor()
},
// 查券
checkQuan(){
checkQuan();
},
networkStatus(){//检查网络状态
uni.getNetworkType({
success: function (res) {
@ -51,7 +47,12 @@ const tools = {
if(res.networkType=='none'){
uni.setStorageSync('isNet',false)
} else {
uni.setStorageSync('isNet',true)
uni.setStorageSync('isNet',true);
// 微信小程序原生API性能优化
// #ifdef MP-WEIXIN
// 连网下,检测小程序是否有更新
tools.updaX();
// #endif
}
}
});
@ -272,6 +273,7 @@ const tools = {
}
},
loginEv(){//执行登录事件
getApp().log('tools.js第275行打印')
let that = this;
uni.login({
provider: 'weixin',
@ -333,6 +335,7 @@ const tools = {
this.overdue()
}
},
// 文本复制
clickCopy(data){
uni.setClipboardData({
data: data,
@ -382,6 +385,7 @@ const tools = {
return newTime;
},
isVedio(){//是否显示视频内容
getApp().log(8)
uni.request({
url: `${getApp().globalData.domainName}index/base-config`,
method: 'get',
@ -397,7 +401,6 @@ const tools = {
} else {
uni.setStorageSync('isVedio',true);
}
console.log(uni.getStorageSync('isVedio'));
}
}
})

54
main.js
View File

@ -38,7 +38,59 @@ Vue.prototype.$http = 'https://oss.hmzfyy.cn';
Vue.prototype.$hostapi = 'https://hengmei.scdxtc.cn/api/';
const {log} = console;
Vue.prototype.$log = log
Vue.prototype.log = log;
// 动态获取手机电量栏,并设置状态栏高度
Vue.prototype.statusBarH = function(){
uni.getSystemInfo({
success: (e) => {
// 定义电量栏
let statusBar = 0;
// 定义状态栏
let customBar = 0;
// #ifdef APP-PLUS
// app时执行
// 设置电量栏高度
Vue.prototype.statusBar = e.statusBarHeight;
// 设置状态栏高度
Vue.prototype.customBar = e.statusBarHeight + 45;
// #endif
// 网页
// #ifdef H5
statusBar = 0
customBar = e.statusBarHeight + 45
// #endif
// 小程序
// #ifdef MP
statusBar = e.statusBarHeight
customBar = e.statusBarHeight + 45
if (e.platform === 'android') {
this.$store.commit('SET_SYSTEM_IOSANDROID', false)
customBar = e.statusBarHeight + 50
}
// #endif
// 微信小程序
// #ifdef MP-WEIXIN
statusBar = e.statusBarHeight;
// @ts-ignore
const custom = wx.getMenuButtonBoundingClientRect()
customBar = custom.bottom + custom.top - e.statusBarHeight;
// #endif
// 这里你可以自己决定存放方式建议放在store中因为store是实时变化的
uni.setStorageSync('statusBar',statusBar);
uni.setStorageSync('customBar',customBar);
// 全局配置域名
uni.setStorageSync('hostapi',`https://hengmei.scdxtc.cn/api/`);
}
})
}

View File

@ -11,9 +11,6 @@
"style" :{
"navigationBarTextStyle":"black" //
}
},{
"path" : "pages/tabbar/my/my",
"style" :{}
},
{
"path" : "pages/tabbar/shop/shop",

View File

@ -1,350 +0,0 @@
<template>
<view>
<!-- 状态栏 -->
<navigator open-type="navigateBack"/>
<status-nav :backgroudColor="publicColor" :tabcolor="publicColor" :statusTitle="true" :statusBack="false"></status-nav>
<view class="mar-zy32 posir pad-x260" :style="{paddingTop:statusHNH+'px'}">
<view class="bacf radius20 posir gao" style="box-shadow: 0px 16rpx 30rpx rgba(141, 141, 141, 0.26);">
<view class="posia" :style="{top:`-${gaoh*0.4}px`,height:gaoh+'px',background:publicColor}" style="left: -32rpx;right: -32rpx;z-index: -1;"></view>
<view class="disjbac">
<view class="disac">
<!-- 头像 -->
<image class="mar-sx30" :src="userInfo.headimgurl || ''" style="width:120rpx;height: 120rpx;border-radius: 100%;margin-left: 15rpx;z-index: 1;" mode="aspectFill"></image>
<view class="mar-z30">
<!-- 昵称 -->
<view class="fon36 bold">{{userInfo.nickname || ''}}</view>
<view class="disac mar-s10" v-if="userInfo.mobile!==''">
<image src="/static/public/phone.png" style="width: 14rpx;height: 20rpx;" mode=""></image>
<!-- 手机号 -->
<view class="fon24 col3 mar-z10">{{userInfo.mobile}}</view>
</view>
</view>
</view>
<view class="mar-y25 disac">
<!-- 二维码 -->
<image @tap="isQrcode=true" src="/static/public/eqr.png" style="width: 43rpx;height: 43rpx;z-index: 1;" mode=""></image>
<!-- 前进键 -->
<view @tap="goNodifyData" style="width: 50rpx;position: relative;z-index: 1;justify-content: flex-end;" class="disac">
<image class="" src="/static/public/nextM.png" style="width: 35rpx;height: 35rpx;z-index: 1;" mode="aspectFill"></image>
</view>
</view>
</view>
<view class="disja posir" style="z-index: 1;">
<view @tap="choosesjf(indext)" class="disac fc flexs" style="width: 33%;" v-for="(itemt,indext) in tongList" :key="indext">
<view class="fon28 bold mar-sx20 clips1">{{itemt.num}}<text v-if="indext==2"></text></view>
<view class="fon28 mar-x25">{{itemt.title}}</view>
</view>
</view>
<image class="posia" style="top: 0;left: 0;right: 0;bottom: 0;width: 100%;height: 100%;z-index: 0;" src="/static/public/mybt.png" mode=""></image>
</view>
<!-- 员工功能 v-if="userInfo.is_staff && yuanList.length!=0" -->
<view v-if="userInfo.is_staff==1" class="bacf radius20 mar-s20 pad20">
<view class="mar-x30 fon28 bold col3">员工功能</view>
<view class="disac yuan-box">
<view @tap="chooseYitem(indexy)" style="width: 33%;display: flex;justify-content: center;align-items: center;position: relative;" v-for="(itemy,indexy) in yuanList" :key="indexy">
<view class="disac fc">
<image :src="itemy.src" style="width: 54rpx;height: 54rpx;" mode="aspectFill"></image>
<view class="fon28 mar-s20 mar-x10">{{itemy.title}}</view>
</view>
<view v-if="indexy<(yuanList.length-1)" style="height: 58rpx;border: 2rpx solid #E6E6E6;position: absolute;right: 0;"></view>
</view>
</view>
</view>
<!-- 广告 -->
<image @tap="goPage" class="width100 radius20 mar-sx20" :src="guangImg" style="height: 160rpx;" mode="aspectFill"></image>
<!-- 功能列表 -->
<view class="bacf radius20 pad-zy30">
<view @tap="chooseItem(indexl)" class="disjbac pad-sx30 borbot" v-for="(iteml,indexl) in toolsList" :key="indexl">
<view class="icon-box disac">
<image class="mar-y20" :src="iteml.src" mode=""></image>
<view class="fon26">{{iteml.title}}</view>
</view>
<view class="disac">
<view v-if="iteml.num!='' && iteml.num!=0" style="width: 40rpx;height: 40rpx;border-radius: 100%;background-color: #F96969;font-size: 18rpx;text-align: center;line-height: 40rpx;color: #FFFFFF;">{{iteml.num}}</view>
<image class="mar-z10" src="/static/public/nexth.png" style="width: 18rpx;height: 18rpx;" mode=""></image>
</view>
</view>
</view>
</view>
<!-- 我的二维码弹框 -->
<view v-if="isQrcode" class="posAll disjcac">
<view>
<view class="bacf radius20" style="margin: 0 130rpx;">
<view class="fon28 col3 tc pad-s40">我的二维码</view>
<image :src="myqr" style="width: 325rpx;height: 325rpx;margin: 30rpx 86rpx 68rpx 86rpx;" mode="aspectFill"></image>
</view>
<view class="disjcac">
<image @tap="isQrcode=false" class="mar-s50" src="/static/public/qrcodec.png" style="width: 96rpx;height: 96rpx;border-radius: 100%;" mode="aspectFill"></image>
</view>
</view>
</view>
<!-- 底部tab -->
<foot-tab :titleList="titleList" :imgList="imgList" :newcurrent='4'></foot-tab>
<!-- 弹框授权 -->
<empower :vision="vision" @cancleEv="cancleEv"></empower>
<view v-if="isQian" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%,-50%);">
<view style="padding: 20rpx 40rpx;background-color: rgba(0,0,0,.6);color: #FFFFFF;border-radius: 6rpx;">签到成功</view>
</view>
</view>
</template>
<script>
import {base64ToPath} from '@/jsFile/base64-src.js';
import empower from '@/components/empower.vue';
import {checkBanner} from '@/jsFile/publicAPI.js';
export default {
components:{empower},
data() {
return {
vision:false,
statusHNH:uni.getStorageSync('statusHNH'),
publicColor:uni.getStorageSync('publicColor'),
tongList:[
{num:'0',title:'文章收藏'},
{num:'0',title:'积分'},
{num:'0',title:'我的分享'}
],
yuanList:[], //'customer-list','footmarks','scan'
zanCyuanList:[
{src:'/static/public/keh.png',title:'客户列表',rule:'customer-list'},
{src:'/static/public/zu.png',title:'用户足迹',rule:'footmarks'},
{src:'/static/public/scan.png',title:'扫码签到',rule:'scan'},
],
toolsList:[
{src:'/static/public/zyuy.png',title:'自助预约',num:''},
{src:'/static/public/hb.png',title:'个人海报',num:''},
{src:'/static/public/wsc.png',title:'文章收藏',num:''},
{src:'/static/public/fx.png',title:'分享中心',num:''},
{src:'/static/public/message.png',title:'消息通知',num:''},
{src:'/static/public/ts.png',title:'投诉与建议',num:''},
{src:'/static/public/aboutus.png',title:'关于我们',num:''},
],
isQrcode:false,//
userInfo:{},//
gaoh:uni.getStorageSync('gao'),
myqr:'/static/public/qrcode.png',
is_worker:'',//0 1
is_doctor:'',//01
is_servicer:'',//01
is_staff:'',//01
titleList:[],
imgList:[],
isQian:false,
bannerList:[],
guangImg:'',
isAuth:'',
guanggao:''
}
},
onUnload: function() {
//
let pages = getCurrentPages();
// console.log('pages:',pages);
},
onShow() {
uni.removeStorageSync('uinfo')//
this.$toolAll.tools.isLogin()
this.checkInfo()
uni.removeStorageSync('shareAll')//
this.$requst.post('index/mini-program-setting').then(res=>{
// log('',res);
if(res.code==0){
if(res.data.length!=0){
if(res.data.footBar.length!=0){//
res.data.footBar.forEach(item=>{
let newName = item.name
let newObj = {
iconPath:this.$http + item.icon[0],
selectedIconPath:this.$http + item.icon[1],
}
if(item.key=="home"){
this.imgList[0] = newObj
this.titleList[0] = newName
}
if(item.key=="category"){
this.imgList[1] = newObj
this.titleList[1] = newName
}
if(item.key=="service"){
this.imgList[2] = newObj
this.titleList[2] = newName
}
if(item.key=="shop"){
this.imgList[3] = newObj
this.titleList[3] = newName
}
if(item.key=="my"){
this.imgList[4] = newObj
this.titleList[4] = newName
}
})
uni.setStorageSync('footTitle',this.titleList)
uni.setStorageSync('footimg',this.imgList)
this.titleList = uni.getStorageSync('footTitle')
this.imgList = uni.getStorageSync('footimg')
}
}
}
},error=>{})
},
onLoad() {
if(uni.getStorageSync('gao')==''){
const query = wx.createSelectorQuery()
query.select('.gao').boundingClientRect((rect) => {
uni.setStorageSync('gao',rect.height)
this.gaoh = rect.height
}).exec()
}
this.checkSwi()
this.checkGM()
},
methods: {
goPage(){
uni.navigateTo({
url:this.guanggao
})
},
checkSwi(){
checkBanner({position:'personal-center-banner'}).then(res=>{
// console.log('res',res);
if(res.code==0){
if(res.data.length!=0){
this.guangImg = this.$http + res.data[0].src
this.guanggao = res.data[0].url
// res.data.forEach(item=>{
// let isVideo = false
// if(item.type!='img') isVideo = true
// let banObj = {
// imgSrc:this.$http + item.src,
// url:item.url,
// isVideo:isVideo,
// poster:this.$http + item.src,
// }
// this.bannerList.push(banObj)
// })
}
}
})
},
cancleEv(e){
if(e==0) this.vision = false
},
checkGM(){//
this.$requst.post('user/personal-qr').then(res=>{
// console.log('',res);
if(res.code==0){
base64ToPath(res.data.qr).then(path => {
this.myqr = path
uni.setStorageSync('imgSrc',path)
}).catch(error => {})
}
},error=>{})
},
checkInfo(){
this.$requst.post('user/info').then(res=>{
// console.log('',res);
if(res.code==0 && res.data.length!=0) {
this.userInfo = res.data;
this.tongList[1].num = res.data.score//
this.tongList[0].num = res.data.collects//
this.tongList[2].num = res.data.share_users.total//
this.toolsList[4].num = res.data.unread_messages//
this.is_worker = res.data.is_worker//0 1
this.is_doctor = res.data.is_doctor//01
this.is_servicer = res.data.is_servicer//01
this.is_staff = res.data.is_staff//01
if(res.data.is_staff==1){
if(this.toolsList.length!=8){
this.toolsList.push({src:'/static/public/aboutus.png',title:'客服二维码',num:''})
}
}
uni.setStorageSync('shareAll',res.data)
if(res.data.rules.length!=0){
let result = this.zanCyuanList.filter(item => res.data.rules.some(itemt => itemt===item.rule))
this.yuanList = result
uni.setStorageSync('rules',res.data.rules)
} else this.yuanList = []
}
},error=>{})
},
chooseItem(index){//
// console.log('',this.toolsList[index].title);
let newUrl = ''
if(index==0) newUrl = '/pagesA/makeAnPppointment/makeAnPppointment'
if(index==1) newUrl = '/pagesB/personalPoster/personalPoster'
if(index==2) newUrl = '/pagesB/myCollection/myCollection'
if(index==3) newUrl = '/pagesB/sharingCenter/sharingCenter'
if(index==4) newUrl = '/pagesB/messagecenter/messagecenter'
if(index==5) newUrl = '/pagesA/suggestions/suggestions'
if(index==6) newUrl = '/pagesB/aboutUs/aboutUs'
if(index==7) newUrl = '/pagesB/customer/customer'
uni.navigateTo({
url:newUrl
})
},
chooseYitem(index){//
// console.log('',this.yuanList[index].title);
switch (index){
case 0:
uni.navigateTo({
url:'/pagesB/customerList/customerList'
})
break;
case 1:
uni.navigateTo({
url:'/pagesB/userFootprint/userFootprint'
})
break;
case 2:
wx.scanCode({ //
complete: (res) => {}, //
fail: (res) => {}, //
onlyFromCamera: false, //,
scanType: ['qrCode'], // scanType :
success: (rt) => { //
let uc = JSON.parse(rt.result).user_coding
this.$requst.post('user/sign-in',{user_coding:uc}).then(res=>{
// console.log('',res);
if(res.code==0){
this.isQian = true
setTimeout(()=>{
this.isQian = false
},2000)
}
},error=>{})
}
})
break;
}
},
choosesjf(index){//
// console.log('',this.tongList[index].title);
switch (index){
case 0:
uni.navigateTo({//
url:'/pagesB/myCollection/myCollection'
})
break;
case 1:
break;
case 2:
uni.navigateTo({//
url:'/pagesB/mysharer/mysharer'
})
break;
}
},
goNodifyData(){//
uni.setStorageSync('uinfo',this.userInfo)
uni.navigateTo({
url:'/pagesA/nodifyData/nodifyData'
})
},
}
}
</script>
<style>
</style>

View File

@ -1,12 +1,21 @@
<template>
<view>
<!-- 状态栏 -->
<view class="status-box statusHNH">
<view :style="{height:statusBarHeight+'px',background:publicColor}"></view>
<view class="status-nav" :style="{background:publicColor}">
<!-- 标题 -->
<view class="tab-title tcenter" style="color: #FFFFFF;">首页</view>
</view>
<status-nav
:ifTitle="true"
:ifReturn="true"></status-nav>
<view :style="{paddingTop: statusBarHeight+110+'rpx'}">
<view style="position: sticky;z-index: 10;" :style="{top: statusBarHeight+110+'rpx'}">
<swiper-tab id="tab" :list="type" v-model="active" @input="clickTab" itemColor="#ff0000" lineColor="#ff0000">
<!-- 自定义tabs样式 -->
<!-- <view slot="title">其其</view> -->
</swiper-tab>
</view>
<swiper class="swiper-page" :style="{height:swiperHeight-(statusBarHeight+110)+'px'}" :current="current" @change="swiperChange">
<swiper-item v-for="item in type">
<view class="swiper-item">{{item.title}}</view>
</swiper-item>
</swiper>
</view>
<!-- 底部tab -->
<foot-tab :titleList="titleList" :imgList="imgList"></foot-tab>
@ -14,7 +23,7 @@
</template>
<script>
const {log} = console;
import swiperTab from '@/components/swiper-tab/swiper-tab.vue'
import swiperPu from '@/components/swiper-pu.vue';
import wfallsFlow from '@/components/wfalls-flow'
import {collectionEV,cancleCollectionEV,checkBanner} from '@/jsFile/publicAPI.js';
@ -26,7 +35,23 @@
data() {
return {
statusBarHeight:uni.getSystemInfoSync().statusBarHeight,
statusHNH:uni.getStorageSync('statusHNH'),
statusHNH:uni.getStorageSync('customBar'),
type: [{
title: '全部'
}, {
title: '待付款'
}, {
title: '待发货'
}, {
title: '待收货'
}, {
title: '已完成'
}, {
title: '已取消'
}],
active: 0,
current:0,
swiperHeight:uni.getSystemInfoSync().windowHeight,
searchVal:'',//
publicColor:'',//
gonggList:[//
@ -82,9 +107,14 @@
onUnload() {
this.isAutoPlay = false;
},
onReady() {
// IDtab
uni.createSelectorQuery().in(this).select('#tab').boundingClientRect().exec(rect => {
this.swiperHeight = this.swiperHeight - rect[0].height
});
},
onShow() {
uni.setStorageSync('firstTime',1);
log('输出的解构')
this.checkNet()
this.$toolAll.tools.isLogin()
let maiOjb = {
@ -113,7 +143,6 @@
  return shareObj;
},
onLoad(options) {
this.$toolAll.tools.isVedio();
if(options.source_code!='' && options.source_code!=undefined){
this.loginEv(options);
} else if(options.q!=undefined){
@ -145,8 +174,6 @@
});
} else if(options.invite_code!='' && options.invite_code!=undefined){
this.loginEv(options);
} else {
this.$toolAll.tools.overdue()
}
const query = wx.createSelectorQuery()
query.select('.statusHNH').boundingClientRect((rect) => {
@ -167,6 +194,12 @@
this.checkUserInfo();
},
methods: {
clickTab(index){
this.current = index
},
swiperChange(e){
this.active = e.detail.current
},
loginEv(option){
console.log(option,'option');
uni.login({