App.vue 5.5 KB

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