Commit 778fb917 by 杨明

fixed

1 parent 8e58180b
// custom-tab-bar/index.js
import {
wyMerchantId
wyMerchantId
} from '~/utils/request/environment'
Component({
options:{
styleIsolation:'shared'
},
data: {
active: 0,
list:[
{
path:"/pages/tab/output/output",
normal: '/images/output.png',
active: '/images/output_active.png',
text:"产值"
},
{
path:"/pages/tab/discovery/discovery",
normal: '/images/home.png',
active: '/images/home_active.png',
text:"发现",
},
{
path:"/pages/tab/mine/mine",
normal: '/images/mine.png',
active: '/images/mine_active.png',
text:"我的"
}
]
},
lifetimes: {
attached() {
if (wyMerchantId.includes(wx.$storage.get('userInfo').merchantId)) {
const {list} = this.data
list.splice(1,1)
this.setData({list})
}
options: {
styleIsolation: 'shared'
},
data: {
active: 0,
initList: [{
path: "/pages/tab/output/output",
normal: '/images/output.png',
active: '/images/output_active.png',
text: "产值"
},
{
path: "/pages/tab/discovery/discovery",
normal: '/images/home.png',
active: '/images/home_active.png',
text: "发现",
},
{
path: "/pages/tab/mine/mine",
normal: '/images/mine.png',
active: '/images/mine_active.png',
text: "我的"
}
],
list: [{
path: "/pages/tab/output/output",
normal: '/images/output.png',
active: '/images/output_active.png',
text: "产值"
},
{
path: "/pages/tab/discovery/discovery",
normal: '/images/home.png',
active: '/images/home_active.png',
text: "发现",
},
{
path: "/pages/tab/mine/mine",
normal: '/images/mine.png',
active: '/images/mine_active.png',
text: "我的"
}
]
},
methods: {
onChange(event) {
const {
list
} = this.data
this.setData({
active: event.detail
})
wx.switchTab({
url: list[event.detail].path
})
}
}
},
methods: {
onChange(event) {
const {list} = this.data
this.setData({
active:event.detail
})
wx.switchTab({
url: list[event.detail].path
})
}
}
})
\ No newline at end of file
<view class="container" style="padding-bottom: calc(100rpx + {{isFullSucreen ? '34' : 0}}px);">
<view class="container" style="padding-bottom: calc(150rpx + {{isFullSucreen ? '34' : 0}}px);">
<navigation-bar bindnavbarReady="navbarReady">
<view class="my-tab">
<view wx:for="{{tabList}}" wx:key="index" bindtap="changeMyTab" data-id="{{index}}" class='my-tab-item {{myTabIdx==index ? "tab-item-active": ""}}'>{{item.name}}</view>
......
......@@ -6,6 +6,10 @@ const IMAGES = Object.freeze({
})
// import { getMockData } from '~/api/api'
import USERAPI from '~/api/usersApi/index'
import util from '~/utils/util'
import {
wyMerchantId
} from '~/utils/request/environment'
Page({
/**
* 页面的初始数据
......@@ -83,9 +87,14 @@ Page({
onShow: function (){
if (typeof this.getTabBar === 'function' ) {
this.getTabBar((tabBar) => {
const len = tabBar.data.list.length
const list = util.deepClone(tabBar.data.initList)
if (wyMerchantId.includes(+wx.$storage.get().userInfo.merchantId)) {
list.splice(1, 1);
}
tabBar.setData({
active: len - 1
active: list.length - 1,
list
})
})
}
......
......@@ -9,6 +9,7 @@
<view class="info">
<view class="name">{{userInfo.merchantName}}</view>
<view class="id">{{userInfo.phone}}</view>
</view>
<button class="logoutBtn" size="default" type="default" isabled="{{false}}" loading="{{false}}" bindtap="logout" hover-class="button-hover">
退出登录
......
// pages/tab/output/output.js
import USERAPI from '~/api/usersApi/index'
import util from '~/utils/util'
import {
IMG_URL
} from '~/utils/constantData'
......@@ -155,7 +156,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
if (wyMerchantId.includes(wx.$storage.get('userInfo').merchantId)) {
if (wyMerchantId.includes(+wx.$storage.get().userInfo.merchantId)) {
this.setData({
isWy: true
})
......@@ -198,13 +199,21 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
let title = '看产值'
if (typeof this.getTabBar === 'function') {
this.getTabBar((tabBar) => {
const list = util.deepClone(tabBar.data.initList)
if (wyMerchantId.includes(+wx.$storage.get().userInfo.merchantId)) {
list.splice(1, 1);
title = wx.$storage.get().userInfo.merchantName
}
tabBar.setData({
active: 0
active: 0,list
})
})
}
this.setData({title})
},
/**
......
......@@ -2,7 +2,7 @@
<block wx:if="{{isShow}}">
<navigation-bar navStyle="{{navStyle}}" bindnavbarReady="navbarReady">看产值</navigation-bar>
<navigation-bar navStyle="{{navStyle}}" bindnavbarReady="navbarReady">{{title}}</navigation-bar>
<view class="layout" wx:if="{{isWy}}">
<scroll-view class="stat-scroll" scroll-y="true" style="padding-top:{{navHeight}}px; height: calc(100vh - 360rpx)">
<stat></stat>
......
......@@ -25,7 +25,7 @@
.children-item {
display: flex;
align-items: center;
margin-left: 80rpx;
margin-left: 40rpx;
&:first-child {
margin-bottom: 32rpx;
}
......
......@@ -8,6 +8,10 @@ Component({
type: Number,
value: {}
},
isLabel:{
type: Boolean,
value: false
},
Id: {
type: String
},
......@@ -25,10 +29,11 @@ Component({
methods: {
setRatio() {
const {
width
width,
isLabel
} = this.data
//这里的第一个 750 对应 css .charts 的 width
const cWidth = width / 750 * wx.getSystemInfoSync().windowWidth;
const cWidth = (isLabel?700:width) / 750 * wx.getSystemInfoSync().windowWidth;
//这里的 500 对应 css .charts 的 height
const cHeight = width / 750 * wx.getSystemInfoSync().windowWidth;
const pixelRatio = wx.getSystemInfoSync().pixelRatio;
......@@ -72,14 +77,17 @@ Component({
context: ctx,
width: this.data.cWidth * this.data.pixelRatio,
height: this.data.cHeight * this.data.pixelRatio,
pixelRatio: this.data.isLabel?this.data.pixelRatio:1,
series: data.series,
animation: true,
rotate: false,
rotateLock: false,
background: "#FFFFFF",
color,
fontSize: 16,
fontColor: color,
padding: [5, 5, 5, 5],
dataLabel: true,
dataLabel: this.data.isLabel?true:false,
enableScroll: false,
legend: {
show: false
......@@ -99,7 +107,7 @@ Component({
showBox: false
},
ring: {
ringWidth: this.data.width / 4,
ringWidth: this.data.isLabel?60:this.data.width / 4,
activeOpacity: 0.5,
activeRadius: 10,
offsetAngle: 0,
......
<!--pages/tab/stat/components/circle/circle.wxml-->
<view class="charts" style="width: {{width}}rpx;height: {{width}}rpx;">
<canvas style="width: {{width}}rpx;height: {{width}}rpx;" canvas-id="{{Id}}" id="{{Id}}" type="2d"/>
<view class="charts" style="width: {{isLabel?700:width}}rpx;height: {{width}}rpx;">
<canvas style="width: {{isLabel?700:width}}rpx;height: {{width}}rpx;" canvas-id="{{Id}}" id="{{Id}}" type="2d"/>
</view>
......@@ -14,11 +14,11 @@ Component({
methods: {
setRatio() {
getRatio() {
//这里的第一个 750 对应 css .charts 的 width
const cWidth = 750 / 750 * wx.getSystemInfoSync().windowWidth;
const cWidth = 700 / 750 * wx.getSystemInfoSync().windowWidth;
//这里的 500 对应 css .charts 的 height
const cHeight = 500 / 750 * wx.getSystemInfoSync().windowWidth;
const cHeight = 480 / 750 * wx.getSystemInfoSync().windowWidth;
const pixelRatio = wx.getSystemInfoSync().pixelRatio;
this.setData({
cWidth,
......@@ -28,25 +28,32 @@ Component({
this.getServerData();
},
getServerData() {
const {viewCustomerPortrait:{productDistribution }} = this.data,
categories = productDistribution.map(i=>i.name),
data = productDistribution.map((i,k)=>{
return {
value: i.value,
color: k%2 == 0?'#3582EE':'#5CF0D8'
let _max = 0;
const {
viewCustomerPortrait: {
productDistribution
}
})
let res = {
categories,
series: [{
name: "目标值",
textColor: '#A6A6A6',
data
}, ]
};
this.drawCharts('afMCYQMEmXXVAjNQFJvvfxbLSHuxNEOL', res);
} = this.data,
categories = (productDistribution || []).map(i => i.name),
data = (productDistribution || []).map((i, k) => {
_max = Math.max(_max, i.value)
return {
value: i.value,
color: k % 2 == 0 ? '#3582EE' : '#5CF0D8'
}
})
let res = {
categories,
series: [{
name: "目标值",
textColor: '#A6A6A6',
data
}, ]
};
this.drawCharts('afMCYQMEmXXVAjNQFJvvfxbLSHuxNEOL', res, _max);
},
drawCharts(id, data) {
drawCharts(id, data, _max) {
_max = Math.ceil(_max / 5) * 5
const query = wx.createSelectorQuery().in(this);
query.select('#' + id).fields({
node: true,
......@@ -79,7 +86,7 @@ Component({
legend: {
show: false,
},
padding: [15, 15, 0, 5],
padding: [15, 15, 5, 5],
pixelRatio: this.data.pixelRatio,
series: data.series,
type: "column",
......@@ -96,7 +103,8 @@ Component({
data: [{
axisLine: false,
fontColor: '#A6A6A6',
min: 0
min: 0,
max: _max
}]
}
});
......
......@@ -31,7 +31,7 @@
}
.charts {
width: 750rpx;
height: 500rpx;
width: 700rpx;
height: 480rpx;
}
}
\ No newline at end of file
<view class="box">
<view class="box-title">甄选商品偏好(top10)<text>单位:人</text></view>
<view class="chart-title">单位:人</view>
<view class="charts">
<canvas canvas-id="afMCYQMEmXXVAjNQFJvvfxbLSHuxNEOL" id="afMCYQMEmXXVAjNQFJvvfxbLSHuxNEOL" type="2d" class="charts"/>
</view>
......
<view class="box">
<view class="box-title">/租住比</view>
<view class="box-title">租住比</view>
<view class="box-body">
<view class="children-box">
<view class="children-item" wx:for="{{lodgeDistribution}}">
......
......@@ -56,7 +56,8 @@
justify-content: space-between;
text {
padding: 0rpx 16rpx;
font-size: 24rpx;
padding: 0rpx 10rpx;
}
}
......
......@@ -46,7 +46,7 @@
</view>
</view>
<view class="box-title">有无小孩</view>
<circle width="400" ratioList="{{childDistribution}}" Id="pot734"></circle>
<circle width="500" ratioList="{{childDistribution}}" Id="pot734" isLabel="{{true}}"></circle>
<view class="children-box">
<view class="children-item" wx:for="{{childDistribution}}">
<view class="icon" style="background: {{item.color}};"></view>
......
......@@ -25,8 +25,8 @@ Component({
},
getServerData() {
const {viewCustomerPortrait:{browseDistribution}} = this.data,
categories = browseDistribution.map(i=>i.name),
data = browseDistribution.map(i=>i.value);
categories = browseDistribution.map(i=>i.name).filter((v,k)=>k%2==1),
data = browseDistribution.map(i=>i.value).filter((v,k)=>k%2==1);
//模拟从服务器获取数据时的延时
setTimeout(() => {
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接
......
<!--pages/tab/stat/components/custom/custom.wxml-->
<view class="box">
<view class="box-title">/浏览时段偏好<text>单位:人</text></view>
<view class="box-title">浏览时段偏好<text>单位:人</text></view>
<view class="charts">
<canvas canvas-id="MkatSdTACyZKZRwWnLaWPTKfZrUmkBlh" id="MkatSdTACyZKZRwWnLaWPTKfZrUmkBlh" type="2d" class="charts" bindtouchend="tap"/>
</view>
......
......@@ -10,6 +10,8 @@ Component({
merchantId
} = wx.$storage.get('userInfo')
outputApi.portraitView({merchantId}).then(res=>{
res.produceValueTotal = res.produceValueTotal/100
res.todayProduceValueTotal = res.todayProduceValueTotal/100
this.setData({viewCustomerPortrait:res})
})
}
......
<!--pages/tab/stat/stat.wxml-->
<view class="stat-box">
<browse viewCustomerPortrait="{{viewCustomerPortrait}}"></browse>
<portrait viewCustomerPortrait="{{viewCustomerPortrait}}"></portrait>
<custom viewCustomerPortrait="{{viewCustomerPortrait}}"></custom>
<commodity viewCustomerPortrait="{{viewCustomerPortrait}}"></commodity>
<browse viewCustomerPortrait="{{viewCustomerPortrait}}"></browse>
<portrait viewCustomerPortrait="{{viewCustomerPortrait}}"></portrait>
<custom viewCustomerPortrait="{{viewCustomerPortrait}}"></custom>
<commodity viewCustomerPortrait="{{viewCustomerPortrait}}"></commodity>
<!-- <timeline viewCustomerPortrait="{{viewCustomerPortrait}}"></timeline> -->
<!-- <lodge viewCustomerPortrait="{{viewCustomerPortrait}}"></lodge>
<car viewCustomerPortrait="{{viewCustomerPortrait}}"></car>
<consume viewCustomerPortrait="{{viewCustomerPortrait}}"></consume> -->
</view >
<timeline viewCustomerPortrait="{{viewCustomerPortrait}}"></timeline>
<lodge viewCustomerPortrait="{{viewCustomerPortrait}}"></lodge>
<car viewCustomerPortrait="{{viewCustomerPortrait}}"></car>
<consume viewCustomerPortrait="{{viewCustomerPortrait}}"></consume>
</view>
\ No newline at end of file
......@@ -153,7 +153,7 @@ const pathEnum = {
const wyMerchantId = {
ip: [44211774],
dev: [44211774],
uat: [44210895],
uat: [44212578,44212577],
preRelease: [44184606],
prod: [44209563,44209565,44209566]
}[target[index]]
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!