Commit 778fb917 by 杨明

fixed

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