App.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <script>
  2. import config from './config'
  3. import store from '@/store'
  4. import { getToken } from '@/utils/auth'
  5. import self from '@/utils/location.js';
  6. import {getAdrinfo} from "@/api/index/index.js"
  7. export default {
  8. onLaunch: function() {
  9. this.initApp()
  10. // 小程序强制更新
  11. // #ifdef MP-WEIXIN
  12. const updateManager = uni.getUpdateManager()
  13. updateManager.onCheckForUpdate(function (res) {
  14. // 请求完新版本信息的回调
  15. updateManager.onUpdateReady(function () {
  16. uni.showModal({
  17. title: '更新提示',
  18. content: '新版本已经准备好,是否重启应用?',
  19. success: function (res) {
  20. if (res.confirm) {
  21. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  22. updateManager.applyUpdate()
  23. }
  24. }
  25. })
  26. })
  27. })
  28. updateManager.onUpdateFailed(function () {
  29. // 新的版本下载失败
  30. uni.showModal({
  31. title: '更新提示',
  32. content: '新版本下载失败',
  33. showCancel: false
  34. })
  35. })
  36. // #endif
  37. },
  38. methods: {
  39. // 初始化应用
  40. initApp() {
  41. // 初始化应用配置
  42. this.initConfig()
  43. // 检查用户登录状态
  44. this.checkLogin()
  45. //#ifdef H5
  46. //#endif
  47. },
  48. initConfig() {
  49. this.globalData.config = config
  50. },
  51. getAdrinfoFn(res){
  52. var params={
  53. address:res.address,
  54. longitude:res.lng,
  55. latitude:res.lat,
  56. }
  57. getAdrinfo(params).then(res=>{
  58. })
  59. },
  60. checkLogin() {
  61. var that=this;
  62. if (getToken()) {
  63. // #ifndef H5
  64. self.getLocation(function(res){
  65. if(res==-1){
  66. // that.setflag=true
  67. }else{
  68. that.getAdrinfoFn(res)
  69. }
  70. })
  71. // #endif
  72. }
  73. }
  74. }
  75. }
  76. </script>
  77. <style lang="scss">
  78. @import '@/static/scss/index.scss';
  79. @import "@/static/style.css";
  80. /* #ifdef MP-WEIXIN */
  81. .ytbox /deep/ uni-textarea{flex: 1;width: auto;text-align: right;}
  82. .xmmain /deep/ .uni-data-checklist .checklist-group{display: block;}
  83. .xmmain /deep/ .uni-data-checklist .checklist-group .checklist-box{padding: 28rpx 0;margin: 0;}
  84. .xmmain /deep/ .uni-data-checklist .checklist-group .checklist-box .checklist-text{color: #343434;font-size: 34rpx;font-weight: bold;}
  85. .xmmain /deep/ .uni-data-checklist .checklist-group .checklist-box .checkbox__inner{margin-right: 32rpx;}
  86. .xmmain /deep/ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checkbox__inner{border-color: #FF440B; background-color: #FF440B;}
  87. .xmmain /deep/ .uni-data-checklist .checklist-group .checklist-box.is--default.is-checked .checklist-text{color: #343434;}
  88. .addbox /deep/ .uni-forms{flex: 1;}
  89. .addbox /deep/ .uni-forms-item__label{flex: 0 0 auto;width: auto !important;font-size: 30rpx;font-weight: bold;
  90. color: #161616;}
  91. .addbox /deep/ .uni-forms .uni-forms-item{margin-bottom: 0;padding: 4rpx 32rpx;
  92. // &:nth-of-type(3){margin-bottom: 0;border-bottom: 0;}
  93. }
  94. .addbox /deep/ .uni-easyinput{height: 70rpx;}
  95. // .addbox /deep/ .uni-textarea-textarea{height: auto;}
  96. .addbox /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  97. .addbox /deep/ .uni-easyinput{flex: 1;text-align: right;}
  98. .addbox /deep/ .uni-easyinput__placeholder-class{font-size: 30rpx;}
  99. .addbox /deep/ .uni-easyinput__content-input{font-size: 30rpx;}
  100. .addbox /deep/ .uni-forms-item__error{margin-top:-12rpx;left: auto;right: 0;}
  101. .addbox /deep/ .uni-data-checklist .checklist-group .checklist-box{margin-right: 30rpx;}
  102. .addbox /deep/ .uni-forms-item__content{justify-content: flex-end;}
  103. .addbox /deep/ .uni-data-checklist .checklist-group{justify-content: flex-end;}
  104. //注册
  105. .regbox /deep/ .uni-forms{flex: 1;}
  106. .regbox /deep/ .uni-forms-item__label{flex: 0 0 auto;width: auto !important;font-size: 32rpx;font-weight: bold;
  107. color: #161616;}
  108. .regbox /deep/ .uni-forms .uni-forms-item{padding: 28rpx 24rpx 20rpx;border-bottom: 2rpx #C1C1C1 solid;margin-bottom: 0;
  109. // &:nth-of-type(3){margin-bottom: 0;border-bottom: 0;}
  110. }
  111. .regbox /deep/ .uni-forms-item__content{display: flex;align-items: center;flex-direction: row;}
  112. .regbox /deep/ .uni-easyinput{flex: 1;text-align: right;}
  113. .regbox /deep/ .uni-easyinput__placeholder-class{font-size: 30rpx;}
  114. .regbox /deep/ .uni-easyinput__content-input{font-size: 30rpx;}
  115. .regbox /deep/ .uni-forms-item__error{margin-top:20rpx;left: auto;right: 0;}
  116. .container .regbox /deep/ .uni-forms .uni-forms-item{padding: 10rpx 24rpx 10rpx;border-bottom: none;}
  117. .container .regbox /deep/ .uni-forms-item__error{margin-top:-16rpx;left: auto;right: 0;}
  118. // 日期格式
  119. .mind /deep/ .uni-input-wrapper{text-align: right;font-size: 30rpx;}
  120. .mind /deep/ .uni-date__x-input{padding: 0;text-align: right;font-size: 30rpx;}
  121. .mind /deep/ .uni-date-x{padding: 0;}
  122. .mind /deep/ .uniui-calendar::before{display: none;}
  123. .mind /deep/ .uni-input-placeholder{color:#AAAAAA;font-size: 30rpx;}
  124. // 历史记录
  125. .zb-table /deep/ .zb-table-fixed{background: #F1F5FF !important;}
  126. .zb-table /deep/ .item-th{text-align: center !important;padding: 0 4rpx;background: #F1F5FF !important;text-align: center;border-bottom: none !important;}
  127. .zb-table /deep/ .item-td{text-align: center !important;padding: 0 4rpx;}
  128. .container /deep/ .zb-table-fixed{background: #F1F5FF !important;}
  129. .container /deep/ .item-th{text-align: center !important;padding: 0 4rpx;background: #F1F5FF !important;text-align: center;}
  130. .container /deep/ .item-td{text-align: center !important;padding: 0 4rpx;}
  131. // 工资条
  132. .pay .paybox /deep/ .zb-table-header{background-color: #F2F5FB !important;}
  133. .pay .paybox /deep/ .zb-table-applet .zb-table-header .zb-stick-side{background-color: #F2F5FB !important;}
  134. .pay .paybox /deep/ .odd{background-color: #F2F5FB !important;}
  135. .pay .paybox /deep/ .item-td{border-bottom: none !important;font-weight: bold !important;font-size: 26rpx ;}
  136. .pay .paybox /deep/ .item-th{border-bottom: none !important;background-color: #F2F5FB !important;font-weight: bold !important;font-size: 26rpx;}
  137. .pay .paybox /deep/ .zb-table-tbody{padding-bottom: 20rpx !important;}
  138. .detail /deep/ .zb-table-header{background-color: #F2F5FB !important;}
  139. .detail /deep/ .zb-table-applet .zb-table-header .zb-stick-side{background-color: #F2F5FB !important;}
  140. .detail /deep/ .odd{background-color: #F2F5FB !important;}
  141. .detail /deep/ .item-td{border-bottom: none !important;}
  142. .detail /deep/ .item-th{border-bottom: none !important;background-color: #F2F5FB !important;}
  143. /* #endif */
  144. </style>