App.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  1. <script>
  2. var jpushModule = uni.requireNativePlugin("JG-JPush")
  3. export default {
  4. globalData: {
  5. baseUrl: '',
  6. token: '',
  7. changeOrg:'',
  8. version: '', // 当前版本号
  9. buildType: 'uat', // 打包环境对应类型,pro 生产 uat 预发布 dev 本地开发
  10. envTips: '', // 环境文字提示
  11. theme: 'default', // 主题,default
  12. isIphoneXup: false //是否iphonex以及以上的版本
  13. },
  14. mounted() {
  15. // 非V3模式
  16. if (this.$scope) {
  17. this.$scope.globalData.token = this.$store.state.vuex_token;
  18. this.$scope.globalData.changeOrg = this.$store.state.vuex_changeOrg;
  19. } else {
  20. // V3模式
  21. getApp({ allowDefault: true }).globalData.token = this.$store.state.vuex_token;
  22. getApp({ allowDefault: true }).globalData.changeOrg = this.$store.state.vuex_changeOrg;
  23. }
  24. this.$config('init');
  25. },
  26. onLaunch: function() {
  27. console.log('App launch')
  28. // // 极光推送
  29. // if(uni.getSystemInfoSync().platform == "ios"){
  30. // // 请求定位权限
  31. // let locationServicesEnabled = jpushModule.locationServicesEnabled()
  32. // let locationAuthorizationStatus = jpushModule.getLocationAuthorizationStatus()
  33. // console.log('locationAuthorizationStatus',locationAuthorizationStatus)
  34. // if (locationServicesEnabled == true && locationAuthorizationStatus < 3) {
  35. // jpushModule.requestLocationAuthorization((result)=>{
  36. // console.log('定位权限',result.status)
  37. // })
  38. // }
  39. // jpushModule.requestNotificationAuthorization((result)=>{
  40. // let status = result.status
  41. // if (status < 2) {
  42. // uni.showToast({
  43. // icon: 'none',
  44. // title: '您还没有打开通知权限',
  45. // duration: 3000
  46. // })
  47. // }
  48. // })
  49. // }
  50. // // 初始化
  51. // jpushModule.initJPushService();
  52. // jpushModule.setLoggerEnable(true);
  53. // jpushModule.addConnectEventListener(result=>{
  54. // let connectEnable = result.connectEnable
  55. // uni.$emit('connectStatusChange',connectEnable)
  56. // });
  57. // jpushModule.addNotificationListener(result=>{
  58. // let notificationEventType = result.notificationEventType
  59. // let messageID = result.messageID
  60. // let title = result.title
  61. // let content = result.content
  62. // let extras = result.extras
  63. // uni.showToast({
  64. // icon: 'none',
  65. // title: JSON.stringify(result),
  66. // duration: 3000
  67. // })
  68. // });
  69. // jpushModule.addCustomMessageListener(result=>{
  70. // let type = result.type
  71. // let messageType = result.messageType
  72. // let content = result.content
  73. // uni.showToast({
  74. // icon: 'none',
  75. // title: JSON.stringify(result),
  76. // duration: 3000
  77. // })
  78. // })
  79. // jpushModule.addLocalNotificationListener(result=>{
  80. // let messageID = result.messageID
  81. // let title = result.title
  82. // let content = result.content
  83. // let extras = result.extras
  84. // uni.showToast({
  85. // icon: 'none',
  86. // title: JSON.stringify(result),
  87. // duration: 3000
  88. // })
  89. // })
  90. // jpushModule.addGeofenceListener(result=>{
  91. // let code = result.code
  92. // let type = result.type
  93. // let geofenceId = result.geofenceId
  94. // let userInfo = result.userInfo
  95. // uni.showToast({
  96. // icon: 'none',
  97. // title: '触发地理围栏',
  98. // duration: 3000
  99. // })
  100. // })
  101. // jpushModule.setIsAllowedInMessagePop(true)
  102. // jpushModule.pullInMessage(result=>{
  103. // let code = result.code
  104. // console.log(code)
  105. // })
  106. // jpushModule.addInMessageListener(result=>{
  107. // let eventType = result.eventType
  108. // let messageType = result.messageType
  109. // let content = result.content
  110. // console.log('inMessageListener',eventType,messageType,content)
  111. // uni.showToast({
  112. // icon: 'none',
  113. // title: JSON.stringify(result),
  114. // duration: 3000
  115. // })
  116. // })
  117. },
  118. onShow: function() {
  119. console.log('App Show')
  120. },
  121. onHide: function() {
  122. console.log('App Hide')
  123. },
  124. }
  125. </script>
  126. <style lang="scss">
  127. @import "./static/iconfont/iconfont.css";
  128. @import "uview-ui/index.scss";
  129. /*每个页面公共css */
  130. page {
  131. width: 100%;
  132. min-height: 100%;
  133. display: flex;
  134. background-color: #F8F8F8;
  135. }
  136. /* 登录页是否记住密码多选框样式 */
  137. uni-checkbox.login-form-checkbox .uni-checkbox-input{
  138. width: 24upx !important;
  139. height: 24upx !important;
  140. }
  141. .status_bar {
  142. height: var(--status-bar-height);
  143. width: 100%;
  144. }
  145. .isIPXup{
  146. padding-bottom: 64rpx !important;
  147. }
  148. /* form表单样式 */
  149. .form-box{
  150. background-color: #fff;
  151. padding: 0 30rpx;
  152. }
  153. .form-input {
  154. font-size: 28rpx;
  155. color: #333;
  156. text-align: right;
  157. width: 95%;
  158. box-sizing: border-box;
  159. height: 60rpx;
  160. line-height: 60rpx;
  161. &.textarea{
  162. height: 240rpx;
  163. padding: 24rpx 0;
  164. text-align: left;
  165. }
  166. }
  167. .form-input-placeholder {
  168. font-size: 28rpx;
  169. color: #999;
  170. }
  171. .form-textarea{
  172. height: 240rpx;
  173. padding: 24rpx 0;
  174. text-align: left;
  175. }
  176. .form-number-input{
  177. margin: 0 auto;
  178. }
  179. .u-required{
  180. position: relative;
  181. }
  182. .u-required:before{
  183. content: '*';
  184. position: absolute;
  185. left: -8px;
  186. top: 10upx;
  187. font-size: 14px;
  188. color: #fa3534;
  189. height: 9px;
  190. line-height: 1;
  191. }
  192. /* 元素宽度 百分比 */
  193. .uni-col-1{
  194. box-sizing: border-box;
  195. width: 10%;
  196. }
  197. .uni-col-2{
  198. box-sizing: border-box;
  199. width: 20%;
  200. }
  201. .uni-col-3{
  202. box-sizing: border-box;
  203. width: 30%;
  204. }
  205. .uni-col-4{
  206. box-sizing: border-box;
  207. width: 40%;
  208. }
  209. .uni-col-5{
  210. box-sizing: border-box;
  211. width: 50%;
  212. }
  213. .uni-col-6{
  214. box-sizing: border-box;
  215. width: 60%;
  216. }
  217. .uni-col-7{
  218. box-sizing: border-box;
  219. width: 70%;
  220. }
  221. .uni-col-8{
  222. box-sizing: border-box;
  223. width: 80%;
  224. }
  225. .uni-col-9{
  226. box-sizing: border-box;
  227. width: 90%;
  228. }
  229. .uni-col-10{
  230. box-sizing: border-box;
  231. width: 100%;
  232. }
  233. /* felx布局 */
  234. .flex{
  235. display: -webkit-flex; /* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */
  236. display: -moz-flex; /* Firefox 18+ */
  237. display: -ms-flexbox; /* IE 10 */
  238. display: flex; /* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
  239. }
  240. /*伸缩流方向*/
  241. .flex_column{
  242. -webkit-box-orient: vertical;
  243. -ms-flex-direction: column;
  244. -webkit-flex-direction: column;
  245. flex-direction: column;
  246. }
  247. /*主轴对齐*/
  248. .justify_center{
  249. -webkit-box-pack: center;
  250. -ms-flex-pack: center;
  251. -webkit-justify-content: center;
  252. justify-content: center;
  253. }
  254. .justify_end{
  255. -webkit-box-pack: end;
  256. -ms-flex-pack: end;
  257. -webkit-justify-content: flex-end;
  258. justify-content: flex-end;
  259. }
  260. .justify_between{
  261. -webkit-box-pack: justify;
  262. -ms-flex-pack: justify;
  263. -webkit-justify-content: space-between;
  264. justify-content: space-between;
  265. }
  266. /*侧轴对齐*/
  267. .align_start{
  268. -webkit-box-align: start;
  269. -ms-flex-align: start;
  270. -webkit-align-items: flex-start;
  271. align-items: flex-start;
  272. }
  273. .align_end{
  274. -webkit-box-align: end;
  275. -ms-flex-align: end;
  276. -webkit-align-items: flex-end;
  277. align-items: flex-end;
  278. }
  279. .align_center{
  280. -webkit-box-align: center;
  281. -ms-flex-align: center;
  282. -webkit-align-items: center;
  283. align-items: center;
  284. }
  285. .align_baseline{
  286. -webkit-box-align: baseline;
  287. -ms-flex-align: baseline;
  288. -webkit-align-items: baseline;
  289. align-items: baseline;
  290. }
  291. /*伸缩性*/
  292. .flex_auto{
  293. -webkit-box-flex: 1;
  294. -ms-flex: auto;
  295. -webkit-flex: auto;
  296. flex: auto;
  297. }
  298. .flex_1{
  299. -webkit-box-flex: 1;
  300. -ms-flex: 1;
  301. -webkit-flex: 1;
  302. flex: 1;
  303. }
  304. // ios15原生input的type=search时会默认自带搜索图标。
  305. // 在全局的公共样式隐藏ios自带搜索图标即可
  306. [type="search"]::-webkit-search-decoration {
  307. display: none;
  308. }
  309. uni-toast {
  310. z-index: 1000000;
  311. }
  312. </style>