|
- <script>
- import Vue from 'vue';
- //app.js
- var config = require("./config");
- export default {
- onLaunch(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
- };
- },
-
- methods: {
- // 时分秒转换为秒
- TIMEEVENT(e) {
- var time = e;
- var len = time.split(':')
- if (len.length == 3) {
- var hour = time.split(':')[0];
- var min = time.split(':')[1];
- var sec = time.split(':')[2];
- return Number(hour * 3600) + Number(min * 60) + Number(sec);
- }
- if (len.length == 2) {
- var min = time.split(':')[0];
- var sec = time.split(':')[1];
- return Number(min * 60) + Number(sec);
- }
- if (len.length == 1) {
- var sec = time.split(':')[0];
- return Number(sec);
- }
- },
-
- // 目前使用页面为录音页面
- SPEAKERSTYLE(index) {
- let obj = {
- color: '',
- }
- switch (index) {
- case 1:
- obj.color = '#60CBEC';
- break;
- case 2:
- obj.color = '#EC8B47';
- break;
- case 3:
- obj.color = '#4F861E';
- break;
- case 5:
- obj.color = '#4980C8';
- break;
- case 6:
- obj.color = '#60CBEC';
- break;
- case 7:
- obj.color = '#EC8B47';
- break;
- case 8:
- obj.color = '#4F861E';
- break;
- default:
- obj.color = '#9F61C8';
- break;
- }
- return obj
- },
- },
-
- filters: {
- // ASCII码转换 大写字母A是65 演讲人是从1开始所以num+64
- toCapital(num) {
- let str = ''
- if (num) {
- str = String.fromCharCode(num + 64)
- }
- return str
- }
- }
- });
- }
- });
-
- 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 {}
- }
- };
- </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>
|