ffttpp / website-lankaola

website for lankaola
75 stars 44 forks source link

请问大神,升级到thinkjs2.2,base基类init()如何传递参数呢? #2

Open wangsenyan opened 6 years ago

wangsenyan commented 6 years ago

init: function (http) {
      var self = this;
      self.super("init", http);
      self.assign({
        jsPath: 'http://js.lankaola.com/js/??',
        cssPath: 'http://js.lankaola.com/css/??',
        imgPath: 'http://img.lankaola.com/images/',
        productImgPath: productImgUrl,
        globalFid: 0
      });
      return self.session('userInfo').then(function (userInfo) {
        if (isEmpty(userInfo)) {
          self.assign({
            loginStatus: 0,
            userInfo: {}
          })
        } else {
          self.assign({
            loginStatus: 1,
            userInfo: userInfo
          })
        }
        return Promise.resolve();
      })
    }
改成
init(http) {
      var self = this;
      super.init( http);
      self.assign({
        productImgPath: productImgUrl,
        globalFid: 0
      });
      return self.session('userInfo').then(function (userInfo) {
        if (isEmpty(userInfo)) {
          self.assign({
            loginStatus: 0,
            userInfo: {}
          })
        } else {
          self.assign({
            loginStatus: 1,
            userInfo: userInfo
          })
        }
        return Promise.resolve();
      })
    }
只有将return 前面的self.assign()中的数据传到前端,后面的不能传递了,求大神解释下啊