App.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <script>
  2. import { User } from '@/config/api.js'
  3. export default {
  4. onLaunch: function() {
  5. !this.$db.get('access_token') && this.getOpenid();
  6. // #ifdef MP
  7. this.checkVersion();
  8. // #endif
  9. },
  10. onShow: function() {
  11. },
  12. onHide: function() {
  13. },
  14. globalData:{
  15. isLogin:false,
  16. isAuth:null,//是否需要授权 uniid
  17. isBind:null,// 是否需要绑定手机号/邮箱
  18. userInfo:null,//用户信息
  19. access_token:'',
  20. loadOver:'',
  21. bgAudioManager:uni.getBackgroundAudioManager()
  22. },
  23. methods:{
  24. /* 微信code换临时token */
  25. getOpenid() {
  26. uni.login({
  27. success: result=> {
  28. User.wechatLog({
  29. Code:result.code
  30. }).then(res => {
  31. try {
  32. let token = res.Data.Authorization;
  33. this.$db.set('access_token',token)
  34. // this.$isResolve()
  35. }catch (e){
  36. }
  37. })
  38. }
  39. });
  40. },
  41. checkVersion() {
  42. const updateManager = uni.getUpdateManager();
  43. updateManager.onCheckForUpdate(function (res) {
  44. // 请求完新版本信息的回调
  45. // console.log(res.hasUpdate);
  46. });
  47. updateManager.onUpdateReady(function (res) {
  48. uni.showModal({
  49. title: '更新提示',
  50. content: '新版本已经准备好,是否重启应用?',
  51. success(res) {
  52. if (res.confirm) {
  53. // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  54. updateManager.applyUpdate();
  55. }
  56. }
  57. });
  58. });
  59. updateManager.onUpdateFailed(function (res) {
  60. // 新的版本下载失败
  61. });
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. @import "uview-ui/index.scss";
  68. /*每个页面公共css */
  69. * {
  70. margin: 0;padding: 0;
  71. box-sizing: border-box;
  72. }
  73. ::-webkit-scrollbar {
  74. display:none;
  75. width:0;
  76. height:0;
  77. color:transparent;
  78. }
  79. view,text {
  80. box-sizing: border-box;
  81. }
  82. input {
  83. box-sizing: border-box;
  84. }
  85. button {
  86. margin: 0;padding: 0;
  87. }
  88. button::after {
  89. border:none;
  90. }
  91. .container {
  92. width: 100%;
  93. min-height: 100vh;
  94. font-size: 28rpx;
  95. }
  96. text {
  97. display: block;
  98. }
  99. button {
  100. text-align: center;
  101. border-radius: 8rpx;
  102. }
  103. /* border 1px样式 */
  104. .border_bottom, .border_top, .border_all {
  105. position: relative;
  106. }
  107. .border_top::after {
  108. position: absolute;
  109. content: '';
  110. width: 100%;
  111. left: 0;
  112. top: 0;
  113. height: 1px;
  114. padding: 0 32rpx;
  115. box-sizing: border-box;
  116. background-color: #E5E5E5;
  117. -webkit-transform: scale(1, 0.5);
  118. transform: scale(1, 0.5);
  119. -webkit-transform-origin: center bottom;
  120. transform-origin: center bottom;
  121. }
  122. .border_bottom::after {
  123. position: absolute;
  124. content: '';
  125. width: 100%;
  126. left: 0;
  127. bottom: 0;
  128. height: 1px;
  129. padding: 0 32rpx;
  130. box-sizing: border-box;
  131. background-color: #E5E5E5;
  132. -webkit-transform: scale(1, 0.5);
  133. transform: scale(1, 0.5);
  134. -webkit-transform-origin: center bottom;
  135. transform-origin: center bottom;
  136. }
  137. .border_all::before {
  138. content: '';
  139. display: block;
  140. position: absolute;
  141. width: 200%;
  142. height: 200%;
  143. border: 1px solid #d9d9d9;
  144. border-radius: 10rpx;
  145. transform-origin: 0 0;
  146. transform: scale(0.5, 0.5);
  147. -webkit-transform: scale(0.5, 0.5);
  148. box-sizing: border-box;
  149. }
  150. //全屏蒙版
  151. .mask-diaog {
  152. position: fixed;
  153. left: 0;
  154. top: 0;
  155. bottom: 0;
  156. right: 0;
  157. overflow: hidden;
  158. background-color: rgba(0, 0, 0, 0.5);
  159. z-index: 1000;
  160. color: #fff;
  161. }
  162. // 底部确认按钮
  163. .bot-btn-cont {
  164. width: 100%;
  165. position: fixed;
  166. left:0;
  167. bottom: 122rpx;
  168. z-index: 9;
  169. .bot-btn {
  170. margin: 0 auto;
  171. width: 694rpx;
  172. height: 88rpx;
  173. line-height: 88rpx;
  174. text-align:center;
  175. font-size: 36rpx;
  176. color: #fff;
  177. background-color: #3385FF;
  178. }
  179. }
  180. // 无数据
  181. .nodata {
  182. text-align: center;
  183. display: block;
  184. color: #D8D8D8;
  185. padding: 200rpx 0;
  186. margin: 0 auto;
  187. .nodata_ico {
  188. width: 150rpx;
  189. height: 162rpx;
  190. margin-bottom: 50rpx;
  191. }
  192. }
  193. .nodata2 {
  194. margin-top: 300rpx;
  195. }
  196. // 单行省略
  197. .text_oneLine {
  198. overflow: hidden;
  199. text-overflow:ellipsis;
  200. white-space: nowrap;
  201. }
  202. /* 2行省略 */
  203. .text_twoLine {
  204. text-overflow: -o-ellipsis-lastline;
  205. overflow: hidden;
  206. text-overflow: ellipsis;
  207. display: -webkit-box;
  208. -webkit-line-clamp: 2;
  209. line-clamp: 2;
  210. -webkit-box-orient: vertical;
  211. }
  212. /* 按钮空心样式 */
  213. .plain-style {
  214. background-color: #F2F2F2 !important;
  215. color: #07C160 !important;
  216. }
  217. .select-box{
  218. width: 100%;
  219. .box {
  220. height: 95prx;
  221. line-height: 95rpx;
  222. text-align: center;
  223. font-size: 32rpx;
  224. border-bottom: 1rpx solid #EBEBEB;
  225. }
  226. .box-bottom {
  227. border-bottom: none !important;
  228. }
  229. }
  230. .slot-content {
  231. width: 100%;
  232. padding: 50rpx;
  233. text-align: center;
  234. font-size: 32rpx;
  235. color: #0F1826;
  236. line-height: 48rpx;
  237. }
  238. .forbid-copy {
  239. -webkit-user-select: none;
  240. -khtml-user-select: none;
  241. -moz-user-select: none;
  242. -ms-user-select: none;
  243. user-select: none;
  244. }
  245. </style>