index.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. var app = getApp();
  2. Component({
  3. properties: {
  4. parameter:{
  5. type: Object,
  6. value:{
  7. class:'0'
  8. },
  9. },
  10. logoUrl:{
  11. type:String,
  12. value:'',
  13. }
  14. },
  15. data: {
  16. navH: ""
  17. },
  18. ready: function(){
  19. this.setClass();
  20. var pages = getCurrentPages();
  21. if (pages.length <= 1) this.setData({'parameter.return':0});
  22. },
  23. attached: function () {
  24. this.setData({
  25. navH: app.globalData.navHeight
  26. });
  27. },
  28. methods: {
  29. return:function(){
  30. wx.navigateBack();
  31. },
  32. setGoodsSearch:function(){
  33. wx.navigateTo({
  34. url: '/pages/goods_search/index',
  35. })
  36. },
  37. setClass:function(){
  38. var color = '';
  39. switch (this.data.parameter.class) {
  40. case "0": case 'on':
  41. color = 'on'
  42. break;
  43. case '1': case 'black':
  44. color = 'black'
  45. break;
  46. case '2': case 'gray':
  47. color = 'gray'
  48. break;
  49. case '3': case "red":
  50. color = 'red'
  51. break;
  52. case '4': case "gradual01":
  53. color = 'gradual01'
  54. break;
  55. case '5': case "indexbg":
  56. color = 'indexbg'
  57. break;
  58. case '6': case "loginbg":
  59. color = 'loginbg'
  60. break;
  61. case '7': case "bgcolor":
  62. color = 'bgcolor'
  63. break;
  64. case '8': case "white":
  65. color = 'white'
  66. break;
  67. default:
  68. break;
  69. }
  70. this.setData({
  71. 'parameter.class': color
  72. })
  73. }
  74. }
  75. })