Giter Club home page Giter Club logo

Comments (5)

85636682 avatar 85636682 commented on July 21, 2024

附上我的js文件

//= require jquery
//= require jquery.turbolinks
//= require jquery_ujs
//= require bootstrap
//= require 'china_city/jquery.china_city'
//= require nprogress
//= require message-bus
//= require jquery.qrcode.min
//= require bootstrap-notify.min
//= require turbolinks

window.App = {
  current_merchant_id: null,
  access_token: '',
  isLogined: function() {
    return App.current_merchant_id !== null;
  }
};

NProgress.configure({
  speed: 300,
  minimum: 0.03,
  ease: 'ease'
});

$(document).on('page:fetch',   function() { NProgress.start(); });
$(document).on('page:change',  function() { 
  NProgress.done();

  MessageBus.start(); // call once at startup
  // how often do you want the callback to fire in ms
  MessageBus.callbackInterval = 500;
  MessageBus.subscribe("/notifications_count/" + App.access_token, function(data){
    // data shipped from server

    var div, link, new_title, span, url;
    span = $(".notification-count span");
    link = $(".notification-count a");
    new_title = document.title.replace(/^\(\d+\) /, '');
    if (data.count > 0) {
      span.show();
      new_title = "(" + data.count + ") " + new_title;

      link.addClass("new");

      $.notify({
        title: "<strong>" + data.title + "</strong> ",
        message: "您有新订单(" + data.content + "),请赶快处理 <a href=\"" + data.content_path + "\">点击这里</a>"
      },{
        delay: 10000
      });
    } else {
      span.hide();
      link.removeClass("new");
    }
    span.text(data.count);
    return document.title = new_title;
  });
});
$(document).on('page:restore', function() { NProgress.remove(); });

from china_city.

85636682 avatar 85636682 commented on July 21, 2024

经过测试,问题出现在两处地方

$("option:gt(0)", next_selects).remove() 这一句会导致option残留一些错误数据

以下的data是错误的,因为后台返回的json是{city_data:[...]}

data = data.data if data.data?
next_selects.first()[0].options.add(new Option(option[0], option[1])) for option in data

应该改为

for option in data.city_data

from china_city.

bingxie avatar bingxie commented on July 21, 2024

不知道为什么要关闭这个问题,现在0.0.4版本还是有问题呀。

from china_city.

85636682 avatar 85636682 commented on July 21, 2024

@bingxie 你按照我的方法修改就行了,可能作者太忙

from china_city.

beitaz avatar beitaz commented on July 21, 2024

我也遇到这个问题,希望作者能够抽出一些时间,或者开放修改。谢谢。

from china_city.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.