|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356 |
- <script>
- import Vue from 'vue';
- //app.js
- var config = require("./config");
- export default {
- onLaunch: function(options) {
- uni.getSystemInfo({
- success: function(e) {
- console.log(e, 'adjsakljdklasjdklsakjdslakjd')
- // #ifdef MP-WEIXIN
- Vue.prototype.StatusBar = e.statusBarHeight;
- let custom = wx.getMenuButtonBoundingClientRect();
- Vue.prototype.Custom = custom;
- Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
- Vue.prototype.windowHeight = e.safeArea.height
- // #endif
- Vue.mixin({
- data() {
- return {
- StatusBar: Vue.prototype.StatusBar,
- CustomBar: Vue.prototype.CustomBar,
- windowHeight: Vue.prototype.windowHeight
- };
- }
- });
- }
- });
-
- if (wx.canIUse('getUpdateManager')) {
- const updateManager = wx.getUpdateManager()
- updateManager.onCheckForUpdate(function(res) {
- if (res.hasUpdate) {
- updateManager.onUpdateReady(function() {
- uni.showModal({
- title: '更新提示',
- cancelColor: "#999999",
- content: '新版本已经准备好,是否重启应用?',
- success: function(res) {
- if (res.confirm) {
- updateManager.applyUpdate()
- }
- }
- })
- })
- updateManager.onUpdateFailed(function() {
- uni.showModal({
- title: '已经有新版本了哟~',
- cancelColor: "#999999",
- content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
- })
- })
- }
- })
- } else {
- uni.showModal({
- title: '提示',
- cancelColor: "#999999",
- content: '当前微信版本过低,无法使用该功能,请升级到最新微信版本后重试。'
- })
- }
- const token = uni.getStorageSync("weapp_session_login_data")
- if (typeof token.token != "string") {
- return
- }
- uni.request({
- url: config.service.getUser,
- method: "GET",
- header: {
- 'content-type': 'application/json',
- 'Authorization': 'Bearer ' + uni.getStorageSync('weapp_session_login_data').token
- },
- success: (res) => {
- let rescor = res.data.data;
- console.log(res, '数据', rescor)
- // return
- if (res.statusCode == 401) {
- uni.showToast({
- title: '登录过期请重新登录',
- icon: "none",
- duration: 2000,
- })
- uni.navigateTo({
- url: `/pages/login/index`
- })
- return
- }
- if (rescor.user.total == 0) {
- uni.showToast({
- title: '暂无绑定项目',
- duration: 2000,
- icon: "none"
- });
- return
- } else {
- let lopan = {
- id: rescor.houseList[0].id,
- name: rescor.houseList[0].propertyName
- }
- let users = rescor.user
- users.zkProperties = rescor.houseList
- console.log(users, '角色数据')
- uni.setStorageSync("weapp_session_userInfo_data", users); //写入缓存
- }
- }
- })
- // this.$u.get("/user/getUser")
- // .then(data => {
- // if (data.user.total==0) {
- // uni.showToast({
- // title: '暂无绑定项目',
- // duration: 2000,
- // icon:"none"
- // });
- // return
- // } else {
- // let lopan = {
- // id: data.houseList[0].id,
- // name: data.houseList[0].propertyName
- // }
- // let users=data.user
- // users.zkProperties=data.houseList
- // uni.setStorageSync("weapp_session_userInfo_data",users); //写入缓存
- // }
- // })
- wx.setInnerAudioOption({
- obeyMuteSwitch: false
- });
- },
- onShow(options) {
- const token = uni.getStorageSync("weapp_session_login_data")
- if (typeof token.token != "string") {
- console.log("没有")
- return
- } else {}
- },
- onHide() {},
- methods: {}
- };
- </script>
-
- <style>
- @import "./app.css";
- </style>
- <style lang="scss">
- @import "uview-ui/index.scss";
-
- /*每个页面公共css */
- //图表样式等
- .single {
- width: 100%;
- background: #FFFFFF;
-
- .title {
- width: 100%;
- height: 90rpx;
- border-bottom: 1rpx solid #E0E0E0;
- display: flex;
-
- .title1 {
- flex: 2;
- font-size: 30rpx;
- font-weight: 600;
- color: #333333;
- line-height: 90rpx;
- text-indent: 30rpx;
- }
-
- .title3 {
- flex: 3;
- height: 90rpx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
-
- .title3-box {
- display: flex;
- align-items: center;
- width: 25%;
- justify-content: center;
-
- .activecltab {
- border-bottom: 2px solid #2671E2;
- }
- }
- }
-
- .title2 {
- flex: 3;
- height: 90rpx;
- display: flex;
- align-items: center;
-
- .title2-che {
- width: 178rpx;
- height: 48rpx;
- background: #FFFFFF;
- border-radius: 6rpx;
- border: 1px solid #E0E0E0;
- line-height: 48rpx;
- font-size: 28rpx;
- font-weight: 400;
- color: #666666;
- text-indent: 12rpx;
- margin-left: 35rpx;
- position: relative;
-
- .righttochoose {
- width: 18rpx;
- height: 24rpx;
- position: absolute;
- top: 12rpx;
- right: 12rpx;
- }
- }
- }
- }
-
- .swiper-box {
- width: 97%;
- margin: 0 auto;
- }
-
- .hejibox {
- width: 100%;
- height: 80rpx;
- display: flex;
-
- .heji {
- width: 50%;
- height: 100%;
- font-size: 28rpx;
- font-weight: 400;
- color: #666666;
- line-height: 80rpx;
- text-indent: 30rpx;
- }
- }
-
- .danwei {
- width: 100%;
- height: 40rpx;
- font-size: 24rpx;
- font-weight: 400;
- color: #999999;
- line-height: 40rpx;
- text-indent: 30rpx;
- }
-
- .uchaserbox {
- width: 95%;
- height: 470rpx;
- }
-
- .jindu {
- width: 100%;
- height: 300rpx;
-
- .jindu-box {
- width: 100%;
- padding-left: 30rpx;
- padding-right: 30rpx;
-
- .jindu-boxche {
- width: 100%;
- height: 46rpx;
- display: flex;
- align-items: center;
- height: 50rpx;
-
- .jindu-name {
- width: 120rpx;
- font-size: 28rpx;
- color: #666666;
- }
-
- .jindu-zxl {
- width: 120rpx;
- font-size: 26rpx;
- margin-left: 16rpx;
- color: #666666;
- text-align: center;
- }
- }
- }
- }
- }
-
- //时间切换的样式
- .boxtittab {
- width: 100;
- height: 92rpx;
- background: #FFFFFF;
- border: 1px solid #E0E0E0;
- display: flex;
- align-items: center;
-
- .tabbox {
- flex: 1;
- height: 100%;
- text-align: center;
- line-height: 92rpx;
- color: #666666;
- font-size: 28rpx;
- display: flex;
- justify-content: center;
-
- .activecllasscet {
- width: 96rpx;
- border-bottom: 2px solid #2671E2;
- }
- }
- }
-
- //多个格子的样式
- .boxzonglan {
- width: 100%;
- min-height: 496rpx;
- background: #FFFFFF;
- padding: 30rpx 30rpx 30rpx 30rpx;
-
- .zonglantit {
- font-size: 30rpx;
- color: #333333;
- font-family: PingFangSC-Semibold, PingFang SC;
- font-weight: 600;
- }
-
- .zonglanbox {
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- margin-top: 24rpx;
-
- .grid {
- width: 50%;
- height: 128rpx;
- border: 1px solid #E0E0E0;
-
- .audonum {
- color: #666666;
- text-indent: 40rpx;
- font-size: 26rpx;
- margin-top: 20rpx;
- }
-
- .num {
- color: #333333;
- text-indent: 40rpx;
- font-size: 32rpx;
- font-weight: 600;
- margin-top: 10rpx;
- }
- }
- }
- }
- </style>
|