|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- <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,
- LOADING: false
- };
- },
-
- 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(config.service.notReadNum, {
- id: uni.getStorageSync('weapp_session_userInfo_data').accountId,
- projectId: uni.getStorageSync('buildingID').id
- }).then(res => {
- console.log(res)
- if (res > 0) {
- uni.setTabBarBadge({ //显示数字
- index: 4, //tabbar下标
- text: res || 0 //数字
- })
- } else {
- uni.removeTabBarBadge({
- index: 4
- })
- }
- }).catch(e => {
- uni.removeTabBarBadge({
- index: 4
- })
- })
-
- // 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: 80rpx;
- display: flex;
- align-items: center;
-
- .title1 {
- flex: 2;
- font-size: 30rpx;
- font-weight: 500;
- color: #333333;
- line-height: 80rpx;
- padding-left: 30rpx;
- font-family: PingFangSC-Medium, PingFang SC;
- }
-
- .title3 {
- flex: 3;
- height: 90rpx;
- display: flex;
- align-items: center;
- justify-content: flex-end;
- padding-right: 30rpx;
-
- .title3-box {
- display: flex;
- align-items: center;
- width: 25%;
- justify-content: center;
-
- .activecltab {
- color: #2671E2;
- border-bottom: 4rpx solid #2671E2;
- }
- }
- }
-
- .title2 {
- flex: 2;
- display: flex;
- justify-content: flex-end;
- align-items: center;
- height: 42rpx;
- font-size: 30rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 42rpx;
- margin-right: 30rpx;
- .righttochoose {
- width: 24rpx;
- height: 12rpx;
- margin-left: 12rpx;
- }
- }
- }
-
- .swiper-box {
- width: 97%;
- margin: 0 auto 26rpx;
- }
-
- .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%;
- min-height: 400rpx;
-
- .jindu-box {
- width: 100%;
- padding: 0 30rpx;
-
- .jindu-boxche {
- width: 100%;
- height: 40rpx;
- display: flex;
- align-items: center;
- margin-bottom: 38rpx;
- .jindu-name {
- width: 120rpx;
- font-size: 28rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #333333;
- line-height: 40rpx;
- }
-
- .progress-cus{
- flex: 1;
- height: 30rpx;
- margin-left: 10rpx;
- background: #F0F1F2;
- .color{
- height: 30rpx;
- background: linear-gradient(90deg, #3A82EF 0%, #7EB2FF 100%);
- }
- .color4{
- height: 30rpx;
- background: linear-gradient(270deg, #6DC5B8 0%, #07B79D 100%);
- }
- .color1{
- height: 30rpx;
- background: linear-gradient(270deg, #F88881 0%, #E6625B 100%);//1
- }
- .color2{
- height: 30rpx;
- background: linear-gradient(270deg, #FFC940 0%, #FF981E 100%);//2
- }
- .color3{
- height: 30rpx;
- background: linear-gradient(270deg, #FFE800 0%, #FFCC00 100%); //3
- }
- }
-
- .jindu-zxl {
- width: 120rpx;
- font-size: 28rpx;
- margin-left: 12rpx;
- color: #333;
- text-align: left;
- line-height: 40rpx;
- }
- }
- }
- }
- }
-
- //时间切换的样式
- .boxtittab {
- width: 100;
- height: 92rpx;
- background: #FFFFFF;
- display: flex;
- align-items: center;
-
- .tabbox {
- flex: 1;
- height: 100%;
- text-align: center;
- line-height: 92rpx;
- color: #666666;
- font-size: 28rpx;
- font-weight: 400;
- display: flex;
- justify-content: center;
-
- .activecllasscet {
- width: 96rpx;
- color: #2671E2;
- font-weight: 600;
- border-bottom: 4rpx 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: 500;
- }
-
- .zonglanbox {
- width: 100%;
- display: flex;
- flex-wrap: wrap;
- margin-top: 24rpx;
- box-shadow: 0px 0px 12rpx 0px rgba(38, 113, 226, 0.1);
- border-radius: 12rpx;
-
- .grid {
- width: 50%;
- // height: 128rpx;
- padding-bottom: 24rpx;
- // border: 1rpx solid #E0E0E0;
-
- .audonum {
- color: #666666;
- text-indent: 40rpx;
- font-size: 28rpx;
- margin-top: 20rpx;
- line-height: 40rpx;
- display: flex;
- align-items: center;
- .circle{
- width: 20rpx;
- height: 20rpx;
- background: #FFFFFF;
- border: 6rpx solid #2671E2;
- margin-right: 12rpx;
- margin-left: 30rpx;
- border-radius: 50%;
- }
- }
-
- .num {
- color: #333333;
- text-indent: 40rpx;
- font-size: 44rpx;
- font-weight: 600;
- line-height: 50rpx;
- margin-top: 18rpx;
- }
- }
- }
- }
- </style>
|