App.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  1. <style lang="scss">
  2. /* 注意要写在第一行,同时给style标签加入lang="scss"属性 */
  3. @import "@/uni_modules/uview-ui/index.scss";
  4. </style>
  5. <script>
  6. import Vue from "vue";
  7. import appUpdate from "common/util/appUpdate.js";
  8. import configService from "@/common/service/config.service.js";
  9. export default {
  10. data() {
  11. return {
  12. socketTask: null,//websocket对象
  13. }
  14. },
  15. onLaunch: function () {
  16. //消息推送
  17. uni.getPushClientId({
  18. //获取客户端推送标识
  19. success: (res) => {
  20. console.log(res.cid, 'cid---');
  21. uni.setStorageSync('push_cid', res.cid); // 存储CID供后续使用
  22. },
  23. fail(err) {
  24. console.log(err)
  25. }
  26. });
  27. // uni.onPushMessage((res) => {
  28. // //客户端监听推送消息
  29. // console.log("收到推送消息:", res) //监听推送消息
  30. // if (res.data) {
  31. // uni.createPushMessage(res.data) //收到消息推送,创建系统状态栏及锁屏通 知
  32. // }
  33. // })
  34. const savedIP = uni.getStorageSync("selectedIP");
  35. if (configService.apiUrl !== "") {
  36. uni.getSystemInfo({
  37. success: function (e) {
  38. // #ifdef APP-PLUS
  39. // 检测升级
  40. appUpdate();
  41. // #endif
  42. // #ifndef MP
  43. Vue.prototype.StatusBar = e.statusBarHeight;
  44. if (e.platform == "android") {
  45. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  46. } else {
  47. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  48. }
  49. // #endif
  50. // #ifdef MP-WEIXIN
  51. Vue.prototype.StatusBar = e.statusBarHeight;
  52. let custom = wx.getMenuButtonBoundingClientRect();
  53. Vue.prototype.Custom = custom;
  54. Vue.prototype.CustomBar =
  55. custom.bottom + custom.top - e.statusBarHeight;
  56. // #endif
  57. // #ifdef MP-ALIPAY
  58. Vue.prototype.StatusBar = e.statusBarHeight;
  59. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  60. // #endif
  61. // #ifdef APP-PLUS
  62. //Vue.prototype.$api.listenTranMsg()
  63. // var info = plus.push.getClientInfo();
  64. // /* 5+ push 消息推送 ps:使用:H5+的方式监听,实现推送*/
  65. // plus.push.addEventListener("click", function(msg) {
  66. // console.log("click:" + JSON.stringify(msg));
  67. // console.log(msg.payload);
  68. // console.log(JSON.stringify(msg));
  69. // //这里可以写跳转业务代码
  70. // }, false);
  71. // // 监听在线消息事件
  72. // plus.push.addEventListener("receive", function(msg) {
  73. // // plus.ui.alert(2);
  74. // //这里可以写跳转业务代码
  75. // console.log("recevice:" + JSON.stringify(msg))
  76. // }, false);
  77. // #endif
  78. //Vue.prototype.$api.initLogin()
  79. },
  80. });
  81. Vue.prototype.NavBarColor = "bg-gradual-blue";
  82. Vue.prototype.Radio_Check_Size = "scale(0.7)";
  83. Vue.prototype.ColorList = [
  84. {
  85. title: "嫣红",
  86. name: "red",
  87. color: "#e54d42",
  88. },
  89. {
  90. title: "桔橙",
  91. name: "orange",
  92. color: "#f37b1d",
  93. },
  94. {
  95. title: "明黄",
  96. name: "yellow",
  97. color: "#fbbd08",
  98. },
  99. {
  100. title: "橄榄",
  101. name: "olive",
  102. color: "#8dc63f",
  103. },
  104. {
  105. title: "森绿",
  106. name: "green",
  107. color: "#39b54a",
  108. },
  109. {
  110. title: "天青",
  111. name: "cyan",
  112. color: "#1cbbb4",
  113. },
  114. {
  115. title: "海蓝",
  116. name: "blue",
  117. color: "#0081ff",
  118. },
  119. {
  120. title: "姹紫",
  121. name: "purple",
  122. color: "#6739b6",
  123. },
  124. {
  125. title: "木槿",
  126. name: "mauve",
  127. color: "#9c26b0",
  128. },
  129. {
  130. title: "桃粉",
  131. name: "pink",
  132. color: "#e03997",
  133. },
  134. {
  135. title: "棕褐",
  136. name: "brown",
  137. color: "#a5673f",
  138. },
  139. {
  140. title: "玄灰",
  141. name: "grey",
  142. color: "#8799a3",
  143. },
  144. {
  145. title: "草灰",
  146. name: "gray",
  147. color: "#aaaaaa",
  148. },
  149. {
  150. title: "墨黑",
  151. name: "black",
  152. color: "#333333",
  153. },
  154. {
  155. title: "雅白",
  156. name: "white",
  157. color: "#ffffff",
  158. },
  159. ];
  160. } else {
  161. if (!savedIP) {
  162. uni.reLaunch({ url: "/pages/ipConfig/ipConfig" });
  163. return;
  164. } else {
  165. uni.getSystemInfo({
  166. success: function (e) {
  167. // #ifdef APP-PLUS
  168. // 检测升级
  169. appUpdate();
  170. // #endif
  171. // #ifndef MP
  172. Vue.prototype.StatusBar = e.statusBarHeight;
  173. if (e.platform == "android") {
  174. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  175. } else {
  176. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  177. }
  178. // #endif
  179. // #ifdef MP-WEIXIN
  180. Vue.prototype.StatusBar = e.statusBarHeight;
  181. let custom = wx.getMenuButtonBoundingClientRect();
  182. Vue.prototype.Custom = custom;
  183. Vue.prototype.CustomBar =
  184. custom.bottom + custom.top - e.statusBarHeight;
  185. // #endif
  186. // #ifdef MP-ALIPAY
  187. Vue.prototype.StatusBar = e.statusBarHeight;
  188. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  189. // #endif
  190. // #ifdef APP-PLUS
  191. //Vue.prototype.$api.listenTranMsg()
  192. // var info = plus.push.getClientInfo();
  193. // /* 5+ push 消息推送 ps:使用:H5+的方式监听,实现推送*/
  194. // plus.push.addEventListener("click", function(msg) {
  195. // console.log("click:" + JSON.stringify(msg));
  196. // console.log(msg.payload);
  197. // console.log(JSON.stringify(msg));
  198. // //这里可以写跳转业务代码
  199. // }, false);
  200. // // 监听在线消息事件
  201. // plus.push.addEventListener("receive", function(msg) {
  202. // // plus.ui.alert(2);
  203. // //这里可以写跳转业务代码
  204. // console.log("recevice:" + JSON.stringify(msg))
  205. // }, false);
  206. // #endif
  207. //Vue.prototype.$api.initLogin()
  208. },
  209. });
  210. Vue.prototype.NavBarColor = "bg-gradual-blue";
  211. Vue.prototype.Radio_Check_Size = "scale(0.7)";
  212. Vue.prototype.ColorList = [
  213. {
  214. title: "嫣红",
  215. name: "red",
  216. color: "#e54d42",
  217. },
  218. {
  219. title: "桔橙",
  220. name: "orange",
  221. color: "#f37b1d",
  222. },
  223. {
  224. title: "明黄",
  225. name: "yellow",
  226. color: "#fbbd08",
  227. },
  228. {
  229. title: "橄榄",
  230. name: "olive",
  231. color: "#8dc63f",
  232. },
  233. {
  234. title: "森绿",
  235. name: "green",
  236. color: "#39b54a",
  237. },
  238. {
  239. title: "天青",
  240. name: "cyan",
  241. color: "#1cbbb4",
  242. },
  243. {
  244. title: "海蓝",
  245. name: "blue",
  246. color: "#0081ff",
  247. },
  248. {
  249. title: "姹紫",
  250. name: "purple",
  251. color: "#6739b6",
  252. },
  253. {
  254. title: "木槿",
  255. name: "mauve",
  256. color: "#9c26b0",
  257. },
  258. {
  259. title: "桃粉",
  260. name: "pink",
  261. color: "#e03997",
  262. },
  263. {
  264. title: "棕褐",
  265. name: "brown",
  266. color: "#a5673f",
  267. },
  268. {
  269. title: "玄灰",
  270. name: "grey",
  271. color: "#8799a3",
  272. },
  273. {
  274. title: "草灰",
  275. name: "gray",
  276. color: "#aaaaaa",
  277. },
  278. {
  279. title: "墨黑",
  280. name: "black",
  281. color: "#333333",
  282. },
  283. {
  284. title: "雅白",
  285. name: "white",
  286. color: "#ffffff",
  287. },
  288. ];
  289. }
  290. }
  291. },
  292. onShow: function () {
  293. console.log("App Show");
  294. },
  295. onHide: function () {
  296. console.log("App Hide");
  297. clearInterval(this.$store.state.timer); // 假设定时器存储在 Vuex 的状态管理中
  298. },
  299. methods: {}
  300. };
  301. </script>
  302. <style>
  303. @import "plugin/colorui/main.css";
  304. @import "plugin/colorui/icon.css";
  305. @import "plugin/colorui/animation.css";
  306. .nav-list {
  307. display: flex;
  308. flex-wrap: wrap;
  309. padding: 0px 40upx 0px;
  310. justify-content: space-between;
  311. }
  312. .nav-li {
  313. padding: 30upx;
  314. border-radius: 12upx;
  315. width: 45%;
  316. margin: 0 2.5% 40upx;
  317. background-image: url(https://cdn.nlark.com/yuque/0/2019/png/280374/1552996358352-assets/web-upload/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
  318. background-size: cover;
  319. background-position: center;
  320. position: relative;
  321. z-index: 1;
  322. }
  323. .nav-li::after {
  324. content: "";
  325. position: absolute;
  326. z-index: -1;
  327. background-color: inherit;
  328. width: 100%;
  329. height: 100%;
  330. left: 0;
  331. bottom: -10%;
  332. border-radius: 10upx;
  333. opacity: 0.2;
  334. transform: scale(0.9, 0.9);
  335. }
  336. .nav-li.cur {
  337. color: #fff;
  338. background: rgb(94, 185, 94);
  339. box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
  340. }
  341. .nav-title {
  342. font-size: 32upx;
  343. font-weight: 300;
  344. }
  345. .nav-title::first-letter {
  346. font-size: 40upx;
  347. margin-right: 4upx;
  348. }
  349. .nav-name {
  350. font-size: 28upx;
  351. text-transform: Capitalize;
  352. margin-top: 20upx;
  353. position: relative;
  354. }
  355. .nav-name::before {
  356. content: "";
  357. position: absolute;
  358. display: block;
  359. width: 40upx;
  360. height: 6upx;
  361. background: #fff;
  362. bottom: 0;
  363. right: 0;
  364. opacity: 0.5;
  365. }
  366. .nav-name::after {
  367. content: "";
  368. position: absolute;
  369. display: block;
  370. width: 100upx;
  371. height: 1px;
  372. background: #fff;
  373. bottom: 0;
  374. right: 40upx;
  375. opacity: 0.3;
  376. }
  377. .nav-name::first-letter {
  378. font-weight: bold;
  379. font-size: 36upx;
  380. margin-right: 1px;
  381. }
  382. .nav-li text {
  383. position: absolute;
  384. right: 30upx;
  385. top: 30upx;
  386. font-size: 52upx;
  387. width: 60upx;
  388. height: 60upx;
  389. text-align: center;
  390. line-height: 60upx;
  391. }
  392. .text-light {
  393. font-weight: 300;
  394. }
  395. @keyframes show {
  396. 0% {
  397. transform: translateY(-50px);
  398. }
  399. 60% {
  400. transform: translateY(40upx);
  401. }
  402. 100% {
  403. transform: translateY(0px);
  404. }
  405. }
  406. @-webkit-keyframes show {
  407. 0% {
  408. transform: translateY(-50px);
  409. }
  410. 60% {
  411. transform: translateY(40upx);
  412. }
  413. 100% {
  414. transform: translateY(0px);
  415. }
  416. }
  417. </style>