App.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <script>
  2. import {
  3. getWxJSSDKConfig
  4. } from '@/apis/user.js';
  5. import {
  6. getQueryString
  7. } from './common/util/index.js';
  8. import urlConfig from "./common/util/urlConfig";
  9. import VConsole from 'vconsole';
  10. let vConsole = null; //移动H5调试器
  11. export default {
  12. onLaunch: function() {
  13. this.fontSizeSetting();
  14. uni.toast = (...args) => uni.showToast({
  15. duration: 5678,
  16. title: args[0],
  17. icon: 'none'
  18. });
  19. uni.loading = () => uni.showLoading({
  20. mask: false
  21. });
  22. this.loadVConsole();
  23. // if (location.hash.length > 3) {
  24. // uni.reLaunch({ url: 'pages/index/index' })
  25. // }
  26. },
  27. onShow: function() {
  28. let code = getQueryString('code');
  29. if (code) {
  30. uni.setStorageSync('code', code);
  31. this.$store.commit('userinfo/SET_CODE', code);
  32. }
  33. },
  34. onHide: function() {
  35. console.log('App Hide');
  36. },
  37. methods: {
  38. fontSizeSetting() {
  39. window.onload = function() {
  40. setAndroidFontsize();
  41. htmlFontSize()
  42. }
  43. window.onresize = function() {
  44. setAndroidFontsize();
  45. htmlFontSize()
  46. }
  47. // 安卓解决微信浏览器字体被调大导致页面错乱的办法
  48. function setAndroidFontsize() {
  49. if (typeof window.WeixinJSBridge == "object" && typeof window.WeixinJSBridge.invoke == "function") {
  50. handleFontSize();
  51. } else {
  52. if (document.addEventListener) {
  53. document.addEventListener("WeixinJSBridgeReady", handleFontSize, false);
  54. } else if (document.attachEvent) {
  55. document.attachEvent("WeixinJSBridgeReady", handleFontSize);
  56. document.attachEvent("onWeixinJSBridgeReady", handleFontSize);
  57. }
  58. }
  59. }
  60. function handleFontSize() {
  61. window.WeixinJSBridge.invoke('setFontSizeCallback', {
  62. 'fontSize': 0
  63. });
  64. window.WeixinJSBridge.on('menu:setfont', function() {
  65. window.WeixinJSBridge.invoke('setFontSizeCallback', {
  66. 'fontSize': 0
  67. });
  68. });
  69. }
  70. function htmlFontSize() {
  71. var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  72. var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  73. var width = w > h ? h : w;
  74. width = width > 720 ? 720 : width
  75. var fz = ~~(width / 15)
  76. document.getElementsByTagName("html")[0].style.cssText = 'font-size: ' + fz + "px";
  77. var realfz = ~~(+window.getComputedStyle(document.getElementsByTagName("html")[0]).fontSize.replace(
  78. 'px', '') *
  79. 10000) / 10000
  80. if (fz !== realfz) {
  81. document.getElementsByTagName("html")[0].style.cssText = 'font-size: ' + fz * (fz / realfz) + "px";
  82. }
  83. }
  84. },
  85.  loadVConsole() { //初始化vConsole,用于H5调试用
  86. if (urlConfig.isVConsole) { //开启调试时
  87. // let systemInfo = getSystemInfo();
  88. // if (!(systemInfo.uniPlatform == 'app' || systemInfo.uniPlatform == 'web')) { // 当为app或者H5时
  89. // return;
  90. // }
  91. vConsole = new VConsole({
  92. defaultPlugins: ['system', 'network', 'element', 'storage'],
  93. // 可以在此设定要默认加载的面板
  94. maxLogNumber: 1000,
  95. // disableLogScrolling: true,
  96. onReady: () => {
  97. console.log('vConsole: onReady');
  98. // 置顶最高层级
  99. var vcSwitch = document.getElementsByClassName('vc-switch')[0];
  100. vcSwitch.style.zIndex = '9999999999';
  101. var vcMask = document.getElementsByClassName('vc-mask')[0];
  102. vcMask.style.zIndex = '9999999999';
  103. var vcPanel = document.getElementsByClassName('vc-panel')[0];
  104. vcPanel.style.zIndex = '9999999999';
  105. // console.log(vcSwitch, vcMask, vcPanel)
  106. console.log(this.globalData.systemInfo)
  107. },
  108. onClearLog: () => {
  109. console.log('vConsole: onClearLog');
  110. }
  111. });
  112. }
  113. },
  114. destroyVConsole() {
  115. // 结束调试后,可移除掉
  116. vConsole.destroy();
  117. }
  118. }
  119. };
  120. </script>
  121. <style lang="scss">
  122. @import 'common/style/main.scss'; //引入 ColorUI 组件库主样式
  123. @import 'common/style/icon.scss'; //引入 ColorUI 组件库图标样式
  124. @import 'common/style/animation.scss'; //引入 ColorUI 组件库动画样式
  125. @import 'common/style/shop.scss'; //引入店铺的公用样式
  126. @import 'common/style/chat_icon.css'; //引入微聊的icon
  127. @import 'common/style/new_iconfont.css'; //引入iconfont
  128. @import 'uview-ui/index.scss'; //引入uview-ui样式
  129. @import './static/css/iconfont.css';
  130. @import './static/css/base.css';
  131. // @font-face {
  132. // font-family: pingfang;
  133. // src: url('http://api.app.jiuweiyun.cn/PINGFANG_BOLD.TTF');
  134. // }
  135. view,
  136. text {
  137. color: #333;
  138. font-family: pingfang;
  139. }
  140. .uni-tabbar__label {
  141. font-weight: bold;
  142. }
  143. page,
  144. #app,
  145. html,
  146. body {
  147. margin: 0;
  148. padding: 0;
  149. -moz-text-size-adjust: 100% !important;
  150. -webkit-text-size-adjust: 100% !important;
  151. text-size-adjust: 100% !important;
  152. -moz-text-size-adjust: 100% !important;
  153. }
  154. ::-webkit-scrollbar {
  155. display: none;
  156. }
  157. uni-tabbar {
  158. width: 100vw;
  159. .uni-tabbar {
  160. width: 100vw;
  161. font-family: pingfang;
  162. }
  163. }
  164. page {
  165. //uniapp 中的 page 标签相当于 html 中的 body, 默认高度为 auto, 但是高度为 100% 更利于 app 布局,你也可以在 page 中设置一些全局样式,比如全局背景色
  166. height: 100%;
  167. background: #f9f9fb;
  168. color: $app-main-text-color;
  169. }
  170. /deep/ .uni-modal__bd {
  171. font-size: 24px !important;
  172. }
  173. .pro_name {
  174. font-size: 32rpx;
  175. font-weight: bold;
  176. }
  177. .total {
  178. font-size: 32rpx;
  179. // margin-top:12rpx;
  180. text {
  181. font-weight: bold;
  182. color: #f76454;
  183. }
  184. text:first-child {
  185. font-size: 28rpx;
  186. margin-right: 5rpx;
  187. }
  188. }
  189. .flexV {
  190. display: flex;
  191. align-items: center;
  192. }
  193. .flexC {
  194. display: flex;
  195. align-items: center;
  196. justify-content: center;
  197. }
  198. .flexS {
  199. display: flex;
  200. align-items: center;
  201. justify-content: flex-start;
  202. }
  203. .flexSS {
  204. display: flex;
  205. align-items: flex-start;
  206. justify-content: flex-start;
  207. }
  208. .flexE {
  209. display: flex;
  210. align-items: center;
  211. justify-content: flex-end;
  212. }
  213. .flexA {
  214. display: flex;
  215. justify-content: space-around;
  216. align-items: center;
  217. }
  218. .flexB {
  219. display: flex;
  220. justify-content: space-between;
  221. align-items: center;
  222. }
  223. .flexBS {
  224. display: flex;
  225. justify-content: space-between;
  226. align-items: flex-start;
  227. }
  228. .flexCC {
  229. display: flex;
  230. flex-direction: column;
  231. justify-content: center;
  232. align-items: center;
  233. }
  234. .safeguard {
  235. font-size: 24rpx;
  236. width: 140rpx;
  237. text-align: center;
  238. height: 46rpx;
  239. line-height: 46rpx;
  240. color: #999;
  241. background: #f8f8f8;
  242. margin-top: 16rpx;
  243. border-radius: 8rpx;
  244. box-sizing: border-box;
  245. }
  246. .gray {
  247. font-size: 28rpx;
  248. color: #999;
  249. margin-right: 5rpx;
  250. }
  251. .block {
  252. width: 750rpx;
  253. height: 20rpx;
  254. background-color: #f9f9fb;
  255. }
  256. //复制按钮
  257. .copy_btn {
  258. width: 100rpx;
  259. text-align: center;
  260. height: 50rpx;
  261. line-height: 50rpx;
  262. font-size: 28rpx;
  263. display: inline-block;
  264. background: $base-line-bg;
  265. border-radius: 24rpx;
  266. color: #fff;
  267. margin-left: 30rpx;
  268. }
  269. .base_btn {
  270. width: 176rpx;
  271. text-align: center;
  272. height: 68rpx;
  273. line-height: 68rpx;
  274. background: $base-line-bg;
  275. border-radius: 34rpx;
  276. font-size: 28rpx;
  277. color: #fff;
  278. margin-left: 15rpx;
  279. }
  280. .after_btn {
  281. width: 192rpx;
  282. height: 68rpx;
  283. background: #fff4f3;
  284. opacity: 1;
  285. border-radius: 34rpx;
  286. color: $base-color;
  287. text-align: center;
  288. line-height: 68rpx;
  289. }
  290. //查询按钮
  291. .search_btn {
  292. width: 124rpx;
  293. height: 64rpx;
  294. text-align: center;
  295. line-height: 64rpx;
  296. background: $base-line-bg;
  297. font-size: 28rpx;
  298. color: #fff;
  299. border-radius: 44rpx;
  300. }
  301. //提交按钮
  302. .sub_btn {
  303. width: 530rpx;
  304. margin: 0 auto;
  305. height: 88rpx;
  306. background: $base-line-bg;
  307. opacity: 1;
  308. border-radius: 44rpx;
  309. color: #fff;
  310. text-align: center;
  311. line-height: 88rpx;
  312. font-size: 32rpx;
  313. }
  314. .search_inp {
  315. width: 540rpx;
  316. }
  317. .iconxuanzhong {
  318. color: $base-color;
  319. }
  320. .iconfont {
  321. vertical-align: middle;
  322. }
  323. //无数据时显示
  324. .noData {
  325. width: 100%;
  326. text-align: center;
  327. margin-top: 15vh;
  328. image {
  329. width: 485rpx;
  330. height: 351rpx;
  331. }
  332. view {
  333. margin-top: 40rpx;
  334. }
  335. }
  336. //一年零一天,不满意退钱
  337. .one_year {
  338. padding: 5rpx 20rpx;
  339. background: #fff4f3;
  340. color: $base-color;
  341. border-radius: 8rpx;
  342. margin-top: 15rpx;
  343. font-size: 24rpx;
  344. }
  345. </style>