From 3ba364d5dbbe2428b06de7e53ae28ed7c23fd4f3 Mon Sep 17 00:00:00 2001
From: Sliverber <2622874537@qq.com>
Date: Fri, 5 Jul 2024 14:07:51 +0800
Subject: [PATCH] 11
---
common/http.interceptor.js | 19 +--
components/tab_bar_user/tab-bar.vue | 175 ++++++++++++++++++++++++++++
main.js | 3 +-
page_adoptBee/adoptIndex.vue | 22 ++++
pages/index/index.vue | 40 ++++++-
5 files changed, 245 insertions(+), 14 deletions(-)
create mode 100644 components/tab_bar_user/tab-bar.vue
create mode 100644 page_adoptBee/adoptIndex.vue
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 06b4786..92607ea 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -36,20 +36,23 @@ const install = (Vue, vm) => {
if (res.code) {
console.log('登录!', res);
let data = {
- wxOpenId: res.code,
-
+ loginCode: res.code,
+ deptId: 100
};
vm.$u.post('/app/auth/wxLogin',data).then(res=>{
+ uni.setStorageSync('code', res.code);
if (res.code == 10003) {
- // uni.navigateTo({
- // url:'/pages/login/login'
- // })
+ uni.navigateTo({
+ url:'/pages/login/login'
+ })
} else if (res.code == 200) {
+ uni.setStorageSync('token', res.token);
+
// console.log("老用户登录",res.data)
- uni.switchTab({
- url:'/pages/index/index'
- })
+ // uni.switchTab({
+ // url:'/pages/index/index'
+ // })
}
});
diff --git a/components/tab_bar_user/tab-bar.vue b/components/tab_bar_user/tab-bar.vue
new file mode 100644
index 0000000..4dbc302
--- /dev/null
+++ b/components/tab_bar_user/tab-bar.vue
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/main.js b/main.js
index 28f7b2c..598a320 100644
--- a/main.js
+++ b/main.js
@@ -16,10 +16,11 @@ import'./common/css/iconfont.css'
// 引入公共组件 tabbar
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'
// Vue.use('customizeAnswer',customizeAnswer)
Vue.use('tab-bar',tabbar)
+Vue.use('tab-bars',tabbars)
Vue.use(uView);
// Vue.use(cookies);
diff --git a/page_adoptBee/adoptIndex.vue b/page_adoptBee/adoptIndex.vue
new file mode 100644
index 0000000..8183fd0
--- /dev/null
+++ b/page_adoptBee/adoptIndex.vue
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 943f074..4e05897 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -215,11 +215,11 @@
},
onShow() {
- this.jmlogin()
- this.ishave()
+ this.getuserinfo()
+
setTimeout(() => {
- this.$refs.canvas3.init(this.initChart3)
- this.$refs.canvas4.init(this.initChart4)
+
+
}, 1500);
const now = new Date();
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() {
this.$u.get(`/farmer/report/statistic`).then(res => {
@@ -296,6 +324,7 @@
this.$u.get(`/farmer/report/weightDay?dateRange=${times},${time}&beehiveId=${''}`).then(res => {
if (res.code == 200) {
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 => {
if (res.code == 200) {
this.chartData4 = res.data.map(item => item.value)
+ this.$refs.canvas4.init(this.initChart4)
}
})
},