App.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <script>
  2. export default {
  3. onPageNotFound(){
  4. mpvue.reLaunch({
  5. url:'/pages/index/main'
  6. })
  7. },
  8. //外发
  9. onShow(options){
  10. let query = options.query.other
  11. console.log('进入小程序了',options)
  12. // 有无参数
  13. if(query){
  14. console.log('外发给你')
  15. wx.setStorageSync("is_out", true);
  16. }else{
  17. wx.setStorageSync("is_out", false);
  18. }
  19. // 判断是啥券
  20. if(query == 1){
  21. console.log("外发其它券")
  22. wx.setStorageSync("is_other_first", true);
  23. }else{
  24. wx.setStorageSync("is_other_first", false);
  25. }
  26. },
  27. onHide(){
  28. wx.removeStorageSync("is_out");
  29. wx.removeStorageSync("is_other_first");
  30. wx.removeStorageSync("is_other");
  31. },
  32. created() {
  33. // 调用API从本地缓存中获取数据
  34. /*
  35. * 平台 api 差异的处理方式: api 方法统一挂载到 mpvue 名称空间, 平台判断通过 mpvuePlatform 特征字符串
  36. * 微信:mpvue === wx, mpvuePlatform === 'wx'
  37. * 头条:mpvue === tt, mpvuePlatform === 'tt'
  38. * 百度:mpvue === swan, mpvuePlatform === 'swan'
  39. * 支付宝(蚂蚁):mpvue === my, mpvuePlatform === 'my'
  40. */
  41. // let logs
  42. // if (mpvuePlatform === 'my') {
  43. // logs = mpvue.getStorageSync({key: 'logs'}).data || []
  44. // logs.unshift(Date.now())
  45. // mpvue.setStorageSync({
  46. // key: 'logs',
  47. // data: logs
  48. // })
  49. // } else {
  50. // logs = mpvue.getStorageSync('logs') || []
  51. // logs.unshift(Date.now())
  52. // mpvue.setStorageSync('logs', logs)
  53. // }
  54. },
  55. log() {
  56. console.log(`log at:${Date.now()}`)
  57. }
  58. }
  59. </script>
  60. <style>
  61. @import "../static/colorui/main.wxss";
  62. @import "../static/colorui/icon.wxss";
  63. .not_show{
  64. visibility: hidden;
  65. }
  66. .full_img {
  67. width: 100%;
  68. }
  69. .main_banner {
  70. height: 241px;
  71. }
  72. .title_color {
  73. color: #4C4C4C;
  74. }
  75. .cu-btn-primary {
  76. background-image: url("https://img.shuimuai.com/web/Rectangle.png");
  77. background-position: center;
  78. background-size: 100% 100%;
  79. width: 100%;
  80. }
  81. .under_line {
  82. text-decoration: underline;
  83. }
  84. .text-primary {
  85. color: #6858C4;
  86. }
  87. .bg-primary {
  88. background-color: #6858C4;
  89. }
  90. /* this rule will be remove */
  91. * {
  92. transition: width 2s;
  93. -moz-transition: width 2s;
  94. -webkit-transition: width 2s;
  95. -o-transition: width 2s;
  96. margin: 0px;
  97. padding: 0px;
  98. font-family: MicrosoftYaHei-Bold;
  99. }
  100. </style>