App.vue 5.7 KB

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