App.vue 2.3 KB

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