|
@@ -301,7 +301,8 @@ import {
|
|
|
switchCompany,
|
|
|
getWeather,
|
|
|
} from '@/api/home.js';
|
|
|
-import { getCompanyDataByPhone, wxLogin } from '@/service/user.js';
|
|
|
+import { getCompanyDataByPhone, wxLogin , checkHasUserInfo, checkLoginNew } from '@/service/user.js';
|
|
|
+
|
|
|
|
|
|
wepy.page({
|
|
|
store,
|
|
@@ -458,42 +459,50 @@ wepy.page({
|
|
|
},
|
|
|
},
|
|
|
onLoad() {
|
|
|
+ console.log("home----onLoad");
|
|
|
+ checkLoginNew()
|
|
|
+ .then(() => {
|
|
|
+ //获取项目list
|
|
|
+ getCompanyDataByPhone()
|
|
|
+ .then((res) => {
|
|
|
+ this.companyList = res || [];
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
+ getWeather(this.userInfo.projectId)
|
|
|
+ .then((res) => {
|
|
|
+ this.weather = res.content || {}; //{ temperature: 30, text: '云' };
|
|
|
+ var text = '云';
|
|
|
+ var imgname = 'sunny.png';
|
|
|
+ if (text.indexOf('晴') > -1) {
|
|
|
+ imgname = 'sunny.png';
|
|
|
+ } else if (text.indexOf('雨') > -1) {
|
|
|
+ imgname = 'rain.png';
|
|
|
+ } else if (text.indexOf('阴') > -1) {
|
|
|
+ imgname = 'cloudy.png';
|
|
|
+ } else if (text.indexOf('云') > -1) {
|
|
|
+ imgname = 'muchCloud.png';
|
|
|
+ } else if (text.indexOf('雾') > -1 || text.indexOf('霾') > -1) {
|
|
|
+ imgname = 'fog.png';
|
|
|
+ } else if (text.indexOf('风') > -1) {
|
|
|
+ imgname = 'wind.png';
|
|
|
+ } else if (text.indexOf('雪') > -1) {
|
|
|
+ imgname = 'snow.png';
|
|
|
+ }
|
|
|
+ this.weather.imgname = imgname;
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
+ this.loadData();
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
+
|
|
|
// 获取系统信息
|
|
|
const systemInfo = wx.getSystemInfoSync();
|
|
|
this.screenHeight = systemInfo.screenHeight;
|
|
|
-
|
|
|
- //获取项目list
|
|
|
- getCompanyDataByPhone()
|
|
|
- .then((res) => {
|
|
|
- this.companyList = res || [];
|
|
|
- })
|
|
|
- .catch((err) => {});
|
|
|
- getWeather(this.userInfo.projectId)
|
|
|
- .then((res) => {
|
|
|
- this.weather = res.content || {}; //{ temperature: 30, text: '云' };
|
|
|
- var text = '云';
|
|
|
- var imgname = 'sunny.png';
|
|
|
- if (text.indexOf('晴') > -1) {
|
|
|
- imgname = 'sunny.png';
|
|
|
- } else if (text.indexOf('雨') > -1) {
|
|
|
- imgname = 'rain.png';
|
|
|
- } else if (text.indexOf('阴') > -1) {
|
|
|
- imgname = 'cloudy.png';
|
|
|
- } else if (text.indexOf('云') > -1) {
|
|
|
- imgname = 'muchCloud.png';
|
|
|
- } else if (text.indexOf('雾') > -1 || text.indexOf('霾') > -1) {
|
|
|
- imgname = 'fog.png';
|
|
|
- } else if (text.indexOf('风') > -1) {
|
|
|
- imgname = 'wind.png';
|
|
|
- } else if (text.indexOf('雪') > -1) {
|
|
|
- imgname = 'snow.png';
|
|
|
- }
|
|
|
- this.weather.imgname = imgname;
|
|
|
- })
|
|
|
- .catch((err) => {});
|
|
|
- this.loadData();
|
|
|
},
|
|
|
- onShow() {},
|
|
|
+ onShow() {
|
|
|
+ console.log("home----onShow");
|
|
|
+ checkHasUserInfo();
|
|
|
+ },
|
|
|
});
|
|
|
</script>
|
|
|
<config>
|