App.vue 5.7 KB

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