11
This commit is contained in:
parent
71496d4116
commit
3ba364d5db
|
@ -36,20 +36,23 @@ const install = (Vue, vm) => {
|
||||||
if (res.code) {
|
if (res.code) {
|
||||||
console.log('登录!', res);
|
console.log('登录!', res);
|
||||||
let data = {
|
let data = {
|
||||||
wxOpenId: res.code,
|
loginCode: res.code,
|
||||||
|
deptId: 100
|
||||||
};
|
};
|
||||||
vm.$u.post('/app/auth/wxLogin',data).then(res=>{
|
vm.$u.post('/app/auth/wxLogin',data).then(res=>{
|
||||||
|
uni.setStorageSync('code', res.code);
|
||||||
if (res.code == 10003) {
|
if (res.code == 10003) {
|
||||||
// uni.navigateTo({
|
uni.navigateTo({
|
||||||
// url:'/pages/login/login'
|
url:'/pages/login/login'
|
||||||
// })
|
})
|
||||||
|
|
||||||
} else if (res.code == 200) {
|
} else if (res.code == 200) {
|
||||||
|
uni.setStorageSync('token', res.token);
|
||||||
|
|
||||||
// console.log("老用户登录",res.data)
|
// console.log("老用户登录",res.data)
|
||||||
uni.switchTab({
|
// uni.switchTab({
|
||||||
url:'/pages/index/index'
|
// url:'/pages/index/index'
|
||||||
})
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
175
components/tab_bar_user/tab-bar.vue
Normal file
175
components/tab_bar_user/tab-bar.vue
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
<template>
|
||||||
|
<view class="cont">
|
||||||
|
<div class="tab" @tap.stop="changeTabbar(0)">
|
||||||
|
<view class="type1" v-if="indexs==0">
|
||||||
|
<image src="@/static/tabbar/home-active.png" mode="" ></image>
|
||||||
|
</view>
|
||||||
|
<view class="type2" v-if="indexs!=0">
|
||||||
|
<image src="@/static/tabbar/home.png" mode=""></image>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="tab" @tap.stop="changeTabbar(1)">
|
||||||
|
<view class="type1" v-if="indexs==1">
|
||||||
|
<image src="@/static/tabbar/fc-active.png" mode=""></image>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="type2" v-if="indexs!=1">
|
||||||
|
|
||||||
|
<image src="@/static/tabbar/fc.png" mode="" ></image>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="tab" @tap.stop="changeTabbar(2)">
|
||||||
|
<view class="type1" v-if="indexs==2">
|
||||||
|
<image src="@/static/tabbar/fx-act.png" mode=""></image>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="type2" v-if="indexs!=2">
|
||||||
|
|
||||||
|
<image src="@/static/tabbar/fx.png" mode="" ></image>
|
||||||
|
</view>
|
||||||
|
</div>
|
||||||
|
<div class="tab" @tap.stop="changeTabbar(3)">
|
||||||
|
<view class="type1" v-if="indexs==3">
|
||||||
|
<image src="@/static/tabbar/map-act.png" mode=""></image>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="type2" v-if="indexs!=3">
|
||||||
|
|
||||||
|
<image src="@/static/tabbar/map.png" mode="" ></image>
|
||||||
|
</view>
|
||||||
|
</div>
|
||||||
|
<div class="tab" @tap.stop="changeTabbar(4)">
|
||||||
|
<view class="type1" v-if="indexs==4">
|
||||||
|
<image src="@/static/tabbar/my-act.png" mode=""></image>
|
||||||
|
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="type2" v-if="indexs!=4">
|
||||||
|
|
||||||
|
<image src="@/static/tabbar/my.png" mode="" ></image>
|
||||||
|
</view>
|
||||||
|
</div>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
indexs: [Number, String], //题目id
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
currentTabbarIndex: 0,
|
||||||
|
|
||||||
|
// 自定义底栏对应页面的加载情况
|
||||||
|
tabberPageLoadFlag: [],
|
||||||
|
ispop: false,
|
||||||
|
// indexs:1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.currentTabbarIndex = this.indexs
|
||||||
|
// setTimeout(()=>{
|
||||||
|
// this.indexs=2
|
||||||
|
// },300)
|
||||||
|
|
||||||
|
},
|
||||||
|
methods:{
|
||||||
|
changeTabbar(index) {
|
||||||
|
// if (this.currentTabbarIndex === index) return
|
||||||
|
if(index==0){
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/index/index',
|
||||||
|
routeType: 'wx://modal',
|
||||||
|
success: () => {
|
||||||
|
this.currentTabbarIndex = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else if(index==1){
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/Apiary',
|
||||||
|
routeType: 'wx://modal',
|
||||||
|
success: () => {
|
||||||
|
this.currentTabbarIndex = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else if(index==2){
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/Beehive',
|
||||||
|
routeType: 'wx://modal',
|
||||||
|
success: () => {
|
||||||
|
this.currentTabbarIndex = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else if(index==3){
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/map',
|
||||||
|
routeType: 'wx://modal',
|
||||||
|
success: () => {
|
||||||
|
this.currentTabbarIndex = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}else if(index==4){
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/my',
|
||||||
|
routeType: 'wx://modal',
|
||||||
|
success: () => {
|
||||||
|
this.currentTabbarIndex = index
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.cont {
|
||||||
|
position: fixed;
|
||||||
|
left: 60rpx;
|
||||||
|
bottom: 78rpx;
|
||||||
|
width: 664rpx;
|
||||||
|
height: 122rpx;
|
||||||
|
background: #FFFFFF;
|
||||||
|
box-shadow: 0rpx 16rpx 40rpx 0rpx rgba(53, 140, 255, 0.1);
|
||||||
|
border-radius: 60rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-around;
|
||||||
|
.tab{
|
||||||
|
width: 96rpx;
|
||||||
|
height: 82rpx;
|
||||||
|
display: flex;
|
||||||
|
// flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
position: relative;
|
||||||
|
.type1{
|
||||||
|
|
||||||
|
|
||||||
|
image{
|
||||||
|
width: 96rpx;
|
||||||
|
height: 82rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.type2{
|
||||||
|
|
||||||
|
|
||||||
|
image{
|
||||||
|
margin-top: 8rpx;
|
||||||
|
width: 40rpx;
|
||||||
|
height: 68rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
3
main.js
3
main.js
|
@ -16,10 +16,11 @@ import'./common/css/iconfont.css'
|
||||||
// 引入公共组件 tabbar
|
// 引入公共组件 tabbar
|
||||||
|
|
||||||
import tabbar from '@/components/tab-bar/tab-bar.vue';
|
import tabbar from '@/components/tab-bar/tab-bar.vue';
|
||||||
|
import tabbars from '@/components/tab_bar_user/tab-bar.vue';
|
||||||
// import customizeAnswer from'@/components/customizeAnswer/customizeAnswer.vue'
|
// import customizeAnswer from'@/components/customizeAnswer/customizeAnswer.vue'
|
||||||
// Vue.use('customizeAnswer',customizeAnswer)
|
// Vue.use('customizeAnswer',customizeAnswer)
|
||||||
Vue.use('tab-bar',tabbar)
|
Vue.use('tab-bar',tabbar)
|
||||||
|
Vue.use('tab-bars',tabbars)
|
||||||
|
|
||||||
Vue.use(uView);
|
Vue.use(uView);
|
||||||
// Vue.use(cookies);
|
// Vue.use(cookies);
|
||||||
|
|
22
page_adoptBee/adoptIndex.vue
Normal file
22
page_adoptBee/adoptIndex.vue
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
|
@ -215,11 +215,11 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow() {
|
onShow() {
|
||||||
this.jmlogin()
|
this.getuserinfo()
|
||||||
this.ishave()
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$refs.canvas3.init(this.initChart3)
|
|
||||||
this.$refs.canvas4.init(this.initChart4)
|
|
||||||
}, 1500);
|
}, 1500);
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const previousDay = new Date(now)
|
const previousDay = new Date(now)
|
||||||
|
@ -271,7 +271,35 @@
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
getuserinfo(){
|
||||||
|
this.$u.get(`/app/user/userInfo`).then(res => {
|
||||||
|
if (res.code == 200) {
|
||||||
|
if(res.data.type==1){
|
||||||
|
this.ishave()
|
||||||
|
this.getchartData3()
|
||||||
|
this.getchartData4()
|
||||||
|
this.gettj()
|
||||||
|
this.getyj()
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
// uni.navigateTo({
|
||||||
|
// url:
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
setTimeout(()=>{
|
||||||
|
let code= uni.getStorageSync('code');
|
||||||
|
console.log(code,'codecodecode');
|
||||||
|
if(code==200){
|
||||||
|
this.getuserinfo()
|
||||||
|
}else{
|
||||||
|
this.logoflag = true
|
||||||
|
}
|
||||||
|
},500)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
// 统计
|
// 统计
|
||||||
gettj() {
|
gettj() {
|
||||||
this.$u.get(`/farmer/report/statistic`).then(res => {
|
this.$u.get(`/farmer/report/statistic`).then(res => {
|
||||||
|
@ -296,6 +324,7 @@
|
||||||
this.$u.get(`/farmer/report/weightDay?dateRange=${times},${time}&beehiveId=${''}`).then(res => {
|
this.$u.get(`/farmer/report/weightDay?dateRange=${times},${time}&beehiveId=${''}`).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.chartData3 = res.data.map(item => item.value)
|
this.chartData3 = res.data.map(item => item.value)
|
||||||
|
this.$refs.canvas3.init(this.initChart3)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -306,6 +335,7 @@
|
||||||
this.$u.get(`/farmer/report/ioCount?dateRange=${times},${time}&beehiveId=${''}`).then(res => {
|
this.$u.get(`/farmer/report/ioCount?dateRange=${times},${time}&beehiveId=${''}`).then(res => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
this.chartData4 = res.data.map(item => item.value)
|
this.chartData4 = res.data.map(item => item.value)
|
||||||
|
this.$refs.canvas4.init(this.initChart4)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user