Merge branch 'weixin_guange' into develop
Conflicts: app/views/wechats/login.html.erb
This commit is contained in:
commit
ff974d6901
25
Client.html
25
Client.html
|
@ -1,25 +0,0 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>
|
||||
Client
|
||||
</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<hr />
|
||||
<h2>这是一张图片</h2>
|
||||
<p>photo<a href="http://10.0.47.15:3000/shares/new?access_token='2d3dda45dsd'&comment='verygood'&title=davide&share_type=1&url=http://www.baidu.com"> Share A </a></p>
|
||||
<hr />
|
||||
|
||||
<h2>这是一段视频</h2>
|
||||
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=kaka&share_type=2&url=http://www.sina.com"> Share B </a></p>
|
||||
<hr />
|
||||
|
||||
<h2>这是一篇文章</h2>
|
||||
<p>Text<a href="http://10.0.47.15:3000/shares/new?access_token=2d3dda45dsd&comment=verygood&title=pepe&share_type=3&url=http://www.sina.com"> Share C </a></p>
|
||||
<hr />
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
386
Gemfile.lock~
386
Gemfile.lock~
|
@ -1,386 +0,0 @@
|
|||
GIT
|
||||
remote: http://github.com/guange2015/wechat.git
|
||||
revision: a18c3d6603cb1aa7bd1fe887b17f67426be01f35
|
||||
specs:
|
||||
wechat (0.7.1)
|
||||
activerecord (>= 3.2, < 5.1.x)
|
||||
http (~> 1.0, >= 1.0.1)
|
||||
nokogiri (>= 1.6.0)
|
||||
thor
|
||||
|
||||
PATH
|
||||
remote: lib/gitlab-cli
|
||||
specs:
|
||||
gitlab (3.2.0)
|
||||
httparty
|
||||
terminal-table
|
||||
|
||||
PATH
|
||||
remote: lib/grack
|
||||
specs:
|
||||
grack (2.0.2)
|
||||
rack (~> 1.4.5)
|
||||
|
||||
PATH
|
||||
remote: lib/rails_kindeditor
|
||||
specs:
|
||||
rails_kindeditor (0.4.5)
|
||||
carrierwave
|
||||
mini_magick
|
||||
|
||||
GEM
|
||||
remote: https://ruby.taobao.org/
|
||||
specs:
|
||||
actionmailer (3.2.22.2)
|
||||
actionpack (= 3.2.22.2)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (3.2.22.2)
|
||||
activemodel (= 3.2.22.2)
|
||||
activesupport (= 3.2.22.2)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.4)
|
||||
rack (~> 1.4.5)
|
||||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.2.1)
|
||||
activemodel (3.2.22.2)
|
||||
activesupport (= 3.2.22.2)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.22.2)
|
||||
activemodel (= 3.2.22.2)
|
||||
activesupport (= 3.2.22.2)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.22.2)
|
||||
activemodel (= 3.2.22.2)
|
||||
activesupport (= 3.2.22.2)
|
||||
activesupport (3.2.22.2)
|
||||
i18n (~> 0.6, >= 0.6.4)
|
||||
multi_json (~> 1.0)
|
||||
acts-as-taggable-on (2.4.1)
|
||||
rails (>= 3, < 5)
|
||||
addressable (2.4.0)
|
||||
ansi (1.5.0)
|
||||
arel (3.0.3)
|
||||
axiom-types (0.1.1)
|
||||
descendants_tracker (~> 0.0.4)
|
||||
ice_nine (~> 0.11.0)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
better_errors (1.1.0)
|
||||
coderay (>= 1.0.0)
|
||||
erubis (>= 2.6.6)
|
||||
binding_of_caller (0.7.2)
|
||||
debug_inspector (>= 0.0.1)
|
||||
builder (3.0.0)
|
||||
byebug (8.2.2)
|
||||
carrierwave (0.10.0)
|
||||
activemodel (>= 3.2.0)
|
||||
activesupport (>= 3.2.0)
|
||||
json (>= 1.7)
|
||||
mime-types (>= 1.16)
|
||||
chinese_pinyin (1.0.0)
|
||||
climate_control (0.0.3)
|
||||
activesupport (>= 3.0)
|
||||
cocaine (0.5.8)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
coderay (1.1.1)
|
||||
coercible (1.0.0)
|
||||
descendants_tracker (~> 0.0.1)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.10.0)
|
||||
daemons (1.2.3)
|
||||
debug_inspector (0.0.2)
|
||||
delayed_job (4.1.1)
|
||||
activesupport (>= 3.0, < 5.0)
|
||||
delayed_job_active_record (4.1.0)
|
||||
activerecord (>= 3.0, < 5)
|
||||
delayed_job (>= 3.0, < 5)
|
||||
descendants_tracker (0.0.4)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
diff-lcs (1.2.5)
|
||||
domain_name (0.5.20160216)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
elasticsearch (1.0.15)
|
||||
elasticsearch-api (= 1.0.15)
|
||||
elasticsearch-transport (= 1.0.15)
|
||||
elasticsearch-api (1.0.15)
|
||||
multi_json
|
||||
elasticsearch-model (0.1.8)
|
||||
activesupport (> 3)
|
||||
elasticsearch (> 0.4)
|
||||
hashie
|
||||
elasticsearch-rails (0.1.8)
|
||||
elasticsearch-transport (1.0.15)
|
||||
faraday
|
||||
multi_json
|
||||
equalizer (0.0.11)
|
||||
erubis (2.7.0)
|
||||
execjs (2.6.0)
|
||||
factory_girl (4.5.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.6.0)
|
||||
factory_girl (~> 4.5.0)
|
||||
railties (>= 3.0.0)
|
||||
faraday (0.9.2)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
fastercsv (1.5.5)
|
||||
grape (0.9.0)
|
||||
activesupport
|
||||
builder
|
||||
hashie (>= 2.1.0)
|
||||
multi_json (>= 1.3.2)
|
||||
multi_xml (>= 0.5.2)
|
||||
rack (>= 1.3.0)
|
||||
rack-accept
|
||||
rack-mount
|
||||
virtus (>= 1.0.0)
|
||||
grape-entity (0.4.8)
|
||||
activesupport
|
||||
multi_json (>= 1.3.2)
|
||||
grape-swagger (0.10.4)
|
||||
grape (>= 0.8.0)
|
||||
grape-entity (< 0.5.0)
|
||||
hashie (3.4.3)
|
||||
hike (1.2.3)
|
||||
htmlentities (4.3.4)
|
||||
http (1.0.2)
|
||||
addressable (~> 2.3)
|
||||
http-cookie (~> 1.0)
|
||||
http-form_data (~> 1.0.1)
|
||||
http_parser.rb (~> 0.6.0)
|
||||
http-cookie (1.0.2)
|
||||
domain_name (~> 0.5)
|
||||
http-form_data (1.0.1)
|
||||
http_parser.rb (0.6.0)
|
||||
httparty (0.13.7)
|
||||
json (~> 1.8)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (0.6.11)
|
||||
ice_nine (0.11.2)
|
||||
iconv (1.0.4)
|
||||
journey (1.0.4)
|
||||
jquery-rails (2.0.3)
|
||||
railties (>= 3.1.0, < 5.0)
|
||||
thor (~> 0.14)
|
||||
json (1.8.3)
|
||||
kaminari (0.16.3)
|
||||
actionpack (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
libv8 (3.16.14.13)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
method_source (0.8.2)
|
||||
mime-types (1.25.1)
|
||||
mini_magick (4.4.0)
|
||||
mini_portile2 (2.0.0)
|
||||
multi_json (1.11.2)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
mysql2 (0.3.18)
|
||||
net-ldap (0.3.1)
|
||||
netrc (0.11.0)
|
||||
nokogiri (1.6.7.2)
|
||||
mini_portile2 (~> 2.0.0.rc2)
|
||||
paperclip (3.5.4)
|
||||
activemodel (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (~> 0.5.3)
|
||||
mime-types
|
||||
polyglot (0.3.5)
|
||||
pry (0.10.3)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
slop (~> 3.4)
|
||||
pry-byebug (3.3.0)
|
||||
byebug (~> 8.0)
|
||||
pry (~> 0.10)
|
||||
pry-rails (0.3.4)
|
||||
pry (>= 0.9.10)
|
||||
pry-stack_explorer (0.4.9.2)
|
||||
binding_of_caller (>= 0.7)
|
||||
pry (>= 0.9.11)
|
||||
rack (1.4.7)
|
||||
rack-accept (0.4.5)
|
||||
rack (>= 0.4)
|
||||
rack-cache (1.6.1)
|
||||
rack (>= 0.4)
|
||||
rack-cors (0.4.0)
|
||||
rack-mount (0.8.3)
|
||||
rack (>= 1.0.0)
|
||||
rack-openid (1.4.2)
|
||||
rack (>= 1.1.0)
|
||||
ruby-openid (>= 2.1.8)
|
||||
rack-raw-upload (1.1.1)
|
||||
multi_json
|
||||
rack-ssl (1.3.4)
|
||||
rack
|
||||
rack-test (0.6.3)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.22.2)
|
||||
actionmailer (= 3.2.22.2)
|
||||
actionpack (= 3.2.22.2)
|
||||
activerecord (= 3.2.22.2)
|
||||
activeresource (= 3.2.22.2)
|
||||
activesupport (= 3.2.22.2)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.22.2)
|
||||
railties (3.2.22.2)
|
||||
actionpack (= 3.2.22.2)
|
||||
activesupport (= 3.2.22.2)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.5.0)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
redis (3.2.2)
|
||||
redis-actionpack (3.2.4)
|
||||
actionpack (~> 3.2.0)
|
||||
redis-rack (~> 1.4.4)
|
||||
redis-store (~> 1.1.4)
|
||||
redis-activesupport (3.2.5)
|
||||
activesupport (~> 3.2.0)
|
||||
redis-store (~> 1.1.0)
|
||||
redis-rack (1.4.4)
|
||||
rack (~> 1.4.0)
|
||||
redis-store (~> 1.1.4)
|
||||
redis-rails (3.2.4)
|
||||
redis-actionpack (~> 3.2.4)
|
||||
redis-activesupport (~> 3.2.4)
|
||||
redis-store (~> 1.1.4)
|
||||
redis-store (1.1.7)
|
||||
redis (>= 2.2)
|
||||
ref (2.0.0)
|
||||
rest-client (1.8.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 3.0)
|
||||
netrc (~> 0.7)
|
||||
rich (1.4.6)
|
||||
jquery-rails
|
||||
kaminari
|
||||
mime-types
|
||||
paperclip
|
||||
rack-raw-upload
|
||||
rails (>= 3.2.0)
|
||||
sass-rails
|
||||
rspec-core (3.4.3)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-expectations (3.4.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-mocks (3.4.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-rails (3.4.2)
|
||||
actionpack (>= 3.0, < 4.3)
|
||||
activesupport (>= 3.0, < 4.3)
|
||||
railties (>= 3.0, < 4.3)
|
||||
rspec-core (~> 3.4.0)
|
||||
rspec-expectations (~> 3.4.0)
|
||||
rspec-mocks (~> 3.4.0)
|
||||
rspec-support (~> 3.4.0)
|
||||
rspec-support (3.4.1)
|
||||
ruby-ole (1.2.12)
|
||||
ruby-openid (2.1.8)
|
||||
rubyzip (1.2.0)
|
||||
sass (3.4.21)
|
||||
sass-rails (3.2.6)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
seems_rateable (1.0.13)
|
||||
jquery-rails
|
||||
rails
|
||||
slop (3.6.0)
|
||||
spreadsheet (1.1.1)
|
||||
ruby-ole (>= 1.0)
|
||||
sprockets (2.2.3)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
rack (~> 1.0)
|
||||
tilt (~> 1.1, != 1.3.0)
|
||||
terminal-table (1.5.2)
|
||||
therubyracer (0.12.2)
|
||||
libv8 (~> 3.16.14.0)
|
||||
ref
|
||||
thor (0.19.1)
|
||||
thread_safe (0.3.5)
|
||||
tilt (1.4.1)
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.46)
|
||||
uglifier (2.7.2)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.2)
|
||||
virtus (1.0.5)
|
||||
axiom-types (~> 0.1)
|
||||
coercible (~> 1.0)
|
||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
||||
equalizer (~> 0.0, >= 0.0.9)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
acts-as-taggable-on (= 2.4.1)
|
||||
ansi
|
||||
better_errors (~> 1.1.0)
|
||||
binding_of_caller
|
||||
builder (= 3.0.0)
|
||||
chinese_pinyin
|
||||
coderay (~> 1.1.0)
|
||||
coffee-rails (~> 3.2.1)
|
||||
daemons
|
||||
delayed_job_active_record
|
||||
elasticsearch-model
|
||||
elasticsearch-rails
|
||||
factory_girl_rails
|
||||
fastercsv (~> 1.5.0)
|
||||
gitlab!
|
||||
grack!
|
||||
grape (~> 0.9.0)
|
||||
grape-entity
|
||||
grape-swagger
|
||||
htmlentities
|
||||
i18n (~> 0.6.0)
|
||||
iconv
|
||||
jquery-rails (~> 2.0.2)
|
||||
kaminari
|
||||
mysql2 (= 0.3.18)
|
||||
net-ldap (~> 0.3.1)
|
||||
paperclip (~> 3.5.4)
|
||||
pry-byebug
|
||||
pry-rails
|
||||
pry-stack_explorer
|
||||
rack-cors
|
||||
rack-openid
|
||||
rails (~> 3.2)
|
||||
rails_kindeditor!
|
||||
redis-rails
|
||||
rest-client
|
||||
rich (= 1.4.6)
|
||||
rspec-rails (~> 3.0)
|
||||
ruby-ole
|
||||
ruby-openid (~> 2.1.4)
|
||||
rubyzip
|
||||
sass-rails (~> 3.2.3)
|
||||
seems_rateable (~> 1.0.13)
|
||||
spreadsheet
|
||||
therubyracer
|
||||
uglifier (>= 1.0.3)
|
||||
wechat!
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.6
|
112
Gemfile~
112
Gemfile~
|
@ -1,112 +0,0 @@
|
|||
source 'http://rubygems.org/'
|
||||
### ÕâÀïÖ´ÐÐbundle config mirror.https://rubygems.org https://gems.ruby-china.org Çл»µ½ruby-chinaÔ´
|
||||
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
# unix-like only
|
||||
gem 'iconv'
|
||||
end
|
||||
|
||||
gem 'certified'
|
||||
|
||||
gem 'wechat',path: 'lib/wechat'
|
||||
gem 'grack', path:'lib/grack'
|
||||
gem 'gitlab', path: 'lib/gitlab-cli'
|
||||
gem 'rest-client'
|
||||
gem "mysql2", "= 0.3.18"
|
||||
gem 'redis-rails'
|
||||
gem 'rubyzip'
|
||||
gem 'delayed_job_active_record'#, :group => :production
|
||||
gem 'daemons'
|
||||
gem 'grape', '~> 0.9.0'
|
||||
gem 'grape-entity'
|
||||
gem 'rack-cors', :require => 'rack/cors'
|
||||
gem 'seems_rateable', '~> 1.0.13'
|
||||
gem 'rails', '~> 3.2'
|
||||
gem "jquery-rails", "~> 2.0.2"
|
||||
gem "i18n", "~> 0.6.0"
|
||||
gem 'coderay', '~> 1.1.0'
|
||||
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
|
||||
gem "builder", "3.0.0"
|
||||
gem 'acts-as-taggable-on', '2.4.1'
|
||||
gem 'spreadsheet'
|
||||
gem 'ruby-ole'
|
||||
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
|
||||
#gem "rmagick", ">= 2.0.0"
|
||||
gem 'binding_of_caller'
|
||||
gem 'chinese_pinyin'
|
||||
# gem 'sunspot_rails', '~> 1.3.3'
|
||||
# gem 'sunspot_solr'
|
||||
# gem 'sunspot'
|
||||
# gem 'progress_bar'
|
||||
gem 'ansi'
|
||||
|
||||
gem 'kaminari'
|
||||
gem 'elasticsearch-model'
|
||||
gem 'elasticsearch-rails'
|
||||
|
||||
|
||||
### profile
|
||||
#gem 'oneapm_rpm'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
gem 'better_errors', '~> 1.1.0'
|
||||
# gem "query_reviewer"
|
||||
# gem 'rack-mini-profiler', '~> 0.9.3'
|
||||
if RUBY_PLATFORM =~ /w32/
|
||||
gem 'win32console'
|
||||
end
|
||||
end
|
||||
|
||||
group :development, :test do
|
||||
unless RUBY_PLATFORM =~ /w32/
|
||||
gem 'pry-rails'
|
||||
if RUBY_VERSION >= '2.0.0'
|
||||
gem 'pry-byebug'
|
||||
end
|
||||
gem 'pry-stack_explorer'
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
gem 'puma'
|
||||
end
|
||||
end
|
||||
|
||||
gem 'rspec-rails', '~> 3.0'
|
||||
gem 'factory_girl_rails'
|
||||
end
|
||||
|
||||
# Gems used only for assets and not required
|
||||
# in production environments by default.
|
||||
group :assets do
|
||||
gem 'sass-rails', '~> 3.2.3'
|
||||
gem 'coffee-rails', '~> 3.2.1'
|
||||
|
||||
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
|
||||
gem 'therubyracer', :platforms => :ruby
|
||||
|
||||
gem 'uglifier', '>= 1.0.3'
|
||||
end
|
||||
|
||||
# Optional gem for LDAP authentication
|
||||
group :ldap do
|
||||
gem "net-ldap", "~> 0.3.1"
|
||||
end
|
||||
|
||||
|
||||
# Optional gem for OpenID authentication
|
||||
group :openid do
|
||||
gem "ruby-openid", "~> 2.1.4", :require => "openid"
|
||||
gem "rack-openid"
|
||||
end
|
||||
|
||||
|
||||
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
|
||||
if File.exist?(database_file)
|
||||
else
|
||||
warn("Please configure your config/database.yml first")
|
||||
end
|
||||
|
||||
# Load plugins' Gemfiles
|
||||
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
|
||||
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
|
||||
instance_eval File.read(file)
|
||||
end
|
|
@ -151,87 +151,111 @@ class WechatsController < ActionController::Base
|
|||
end
|
||||
|
||||
|
||||
def get_open_id
|
||||
begin
|
||||
raise "非法操作, code不存在" unless params[:code]
|
||||
openid = get_openid_from_code(params[:code])
|
||||
raise "无法获取到openid" unless openid
|
||||
render :json => {status:0, openid: openid}
|
||||
rescue Exception=>e
|
||||
render :json => {status: -1, msg: e.message}
|
||||
|
||||
|
||||
### controller method
|
||||
|
||||
|
||||
module Controllers
|
||||
def get_open_id
|
||||
begin
|
||||
|
||||
code = params[:code] || session[:wechat_code]
|
||||
openid = get_openid_from_code(code)
|
||||
|
||||
|
||||
raise "无法获取到微信openid" unless openid
|
||||
render :json => {status:0, openid: openid}
|
||||
rescue Exception=>e
|
||||
render :json => {status: -1, msg: e.message}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def bind
|
||||
begin
|
||||
raise "非法操作, code不存在" unless params[:code]
|
||||
openid = get_openid_from_code(params[:code])
|
||||
raise "无法获取到openid" unless openid
|
||||
raise "此微信号已绑定用户, 不能重复绑定" if user_binded?(openid)
|
||||
def bind
|
||||
begin
|
||||
|
||||
user, last_login_on = User.try_to_login(params[:username], params[:password])
|
||||
raise "用户名或密码错误,请重新登录" unless user
|
||||
#补全用户信息
|
||||
code = params[:code] || session[:wechat_code]
|
||||
openid = get_openid_from_code(code)
|
||||
|
||||
raise "此用户已经绑定了公众号" if user.user_wechat
|
||||
raise "无法获取到openid" unless openid
|
||||
raise "此微信号已绑定用户, 不能重复绑定" if user_binded?(openid)
|
||||
|
||||
UserWechat.create!(
|
||||
openid: openid,
|
||||
user: user
|
||||
)
|
||||
render :json => {status:0, msg: "绑定成功"}
|
||||
rescue Exception=>e
|
||||
render :json => {status: -1, msg: e.message}
|
||||
user, last_login_on = User.try_to_login(params[:username], params[:password])
|
||||
raise "用户名或密码错误,请重新登录" unless user
|
||||
#补全用户信息
|
||||
|
||||
raise "此用户已经绑定过公众号, 请换一个帐户试试" if user.user_wechat
|
||||
|
||||
UserWechat.create!(
|
||||
openid: openid,
|
||||
user: user
|
||||
)
|
||||
render :json => {status:0, msg: "绑定成功"}
|
||||
rescue Exception=>e
|
||||
render :json => {status: -1, msg: e.message}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def login
|
||||
@code = params[:code] #TODO 安全性
|
||||
render 'wechats/login', layout: 'base_wechat'
|
||||
end
|
||||
def login
|
||||
session[:wechat_code] = params[:code] if params[:code]
|
||||
render 'wechats/login', layout: 'base_wechat'
|
||||
end
|
||||
|
||||
private
|
||||
def get_openid_from_code(code)
|
||||
url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=#{Wechat.config.appid}&secret=#{Wechat.config.secret}&code=#{code}&grant_type=authorization_code"
|
||||
logger.debug url
|
||||
body = URI.parse(url).read
|
||||
logger.debug body
|
||||
JSON.parse(body)["openid"]
|
||||
end
|
||||
private
|
||||
def get_openid_from_code(code)
|
||||
openid = session[:wechat_openid]
|
||||
|
||||
def user_binded?(openid)
|
||||
uw = UserWechat.where(openid: openid).first
|
||||
end
|
||||
|
||||
def user_activity(user)
|
||||
@user = user
|
||||
shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
|
||||
|
||||
end
|
||||
|
||||
def process_activity(user_activity)
|
||||
act= user_activity.act
|
||||
case user_activity.container_type.to_s
|
||||
when 'Course'
|
||||
when 'Project'
|
||||
case user_activity.act_type.to_s
|
||||
when 'Issue'
|
||||
[act.project.name.to_s+" | 项目问题", act.subject.to_s, url_to_avatar(act.author),"http://wechat.trustie.net/app.html#/issue/#{act.id}"]
|
||||
unless openid
|
||||
if code
|
||||
openid = wechat.web_access_token(code)["openid"]
|
||||
end
|
||||
end
|
||||
|
||||
if openid
|
||||
session[:wechat_openid] = openid
|
||||
end
|
||||
|
||||
return openid
|
||||
end
|
||||
|
||||
def user_binded?(openid)
|
||||
uw = UserWechat.where(openid: openid).first
|
||||
end
|
||||
|
||||
def user_activity(user)
|
||||
@user = user
|
||||
shield_project_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Project'").map(&:shield_id)
|
||||
shield_course_ids = ShieldActivity.where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
|
||||
@page = params[:page] ? params[:page].to_i + 1 : 0
|
||||
user_project_ids = (@user.projects.visible.map{|project| project.id}-shield_project_ids).empty? ? "(-1)" : "(" + (@user.projects.visible.map{|project| project.id}-shield_project_ids).join(",") + ")"
|
||||
user_course_ids = (@user.courses.visible.map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.courses.visible.map{|course| course.id}-shield_course_ids).join(",") + ")"
|
||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||
project_types = "('Message','Issue','Project')"
|
||||
principal_types = "JournalsForMessage"
|
||||
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
|
||||
|
||||
|
||||
end
|
||||
|
||||
def process_activity(user_activity)
|
||||
act= user_activity.act
|
||||
case user_activity.container_type.to_s
|
||||
when 'Course'
|
||||
when 'Project'
|
||||
case user_activity.act_type.to_s
|
||||
when 'Issue'
|
||||
[act.project.name.to_s+" | 项目问题", act.subject.to_s, url_to_avatar(act.author),"http://wechat.trustie.net/app.html#/issue/#{act.id}"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
include Controllers
|
||||
|
||||
end
|
||||
|
|
|
@ -12,8 +12,7 @@
|
|||
<div class="weui_cell">
|
||||
<div class="weui_cell_hd"><label class="weui_label">用户名</label></div>
|
||||
<div class="weui_cell_bd weui_cell_primary">
|
||||
<input class="weui_input" autocapitalize="off" type="text" name="username" placeholder="请输入邮箱/登录名"/>
|
||||
</div>
|
||||
<input class="weui_input" autocapitalize="off" type="text" name="username" placeholder="请输入邮箱/登录名"/> </div>
|
||||
</div>
|
||||
|
||||
<div class="weui_cell">
|
||||
|
@ -23,8 +22,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" value="<%=@code%>" name="code">
|
||||
|
||||
<div class="weui_btn_area">
|
||||
<a class="weui_btn weui_btn_primary" id="submitForm">确定</a>
|
||||
</div>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<div ng-repeat="act in activities">
|
||||
<div ng-if="act.container_type=='Course'">
|
||||
<div ng-if="act.act_type=='HomeworkCommon'">
|
||||
<div class="post-container">
|
||||
<div class="post-container" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/homework/'+ ($(this).attr('dataID'))">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
|
||||
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
|
||||
<div ng-if="act.act_type=='News'">
|
||||
<div class="post-container">
|
||||
<div class="post-container" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/course_notice/'+ ($(this).attr('dataID'))">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
|
||||
|
@ -66,7 +66,7 @@
|
|||
</div>
|
||||
|
||||
<div ng-if="act.act_type=='Message'">
|
||||
<div class="post-container">
|
||||
<div class="post-container" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/course_discussion/'+ ($(this).attr('dataID'))">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
|
||||
|
@ -109,7 +109,7 @@
|
|||
|
||||
<div ng-if="act.container_type=='Project'">
|
||||
<div ng-if="act.act_type=='Issue'">
|
||||
<div class="post-container">
|
||||
<div class="post-container" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/issues/'+ ($(this).attr('dataID'))">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
|
||||
|
@ -139,7 +139,7 @@
|
|||
|
||||
|
||||
<div ng-if="act.act_type=='Message'">
|
||||
<div class="post-container">
|
||||
<div class="post-container" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/project_discussion/'+ ($(this).attr('dataID'))">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
|
||||
|
@ -181,7 +181,7 @@
|
|||
|
||||
<div ng-if="act.container_type=='Principal'">
|
||||
<div ng-if="act.act_type=='JournalsForMessage'">
|
||||
<div class="post-container">
|
||||
<div class="post-container" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/journal_for_message/'+ ($(this).attr('dataID'))">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
|
||||
|
@ -208,7 +208,7 @@
|
|||
</div>
|
||||
|
||||
<div ng-if="act.act_type=='BlogComment'">
|
||||
<div class="post-container">
|
||||
<div class="post-container" dataID = "{{act.act_id}}" onclick="javascript:window.location.href='#/blog_comment/'+ ($(this).attr('dataID'))">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-avatar fl"><img ng-src="{{replaceUrl(act.author.img_url)}}" width="40" height="40" class="border-radius" /></div>
|
||||
|
|
|
@ -1,47 +1,49 @@
|
|||
|
||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-title mb5"><span class="c-grey3 f15 fb">{{blog.title}}</span><span ng-if="blog.locked" class="locked_btn_cir ml10" title="已锁定"> </span></div>
|
||||
<div class="post-title"><a herf="javascript:void(0);" class="mr10">{{blog.user.realname}}</a>发表博客</div>
|
||||
<div class="cl"></div>
|
||||
<div class="post-content" style="height:auto;">
|
||||
<div class="post-all-content c-grey3 mt10" ng-bind-html="blog.content|safeHtml"></div>
|
||||
<div ng-if="blog.act_type == 'BlogComment'">
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-title mb5"><span class="c-grey3 f15 fb">{{blog.title}}</span></div>
|
||||
<div class="post-title"><a herf="javascript:void(0);" class="mr10">{{blog.user.realname}}</a>发表博客</div>
|
||||
<div class="cl"></div>
|
||||
<div class="post-content" style="height:auto;">
|
||||
<div class="post-all-content c-grey3 mt10" ng-bind-html="blog.content|safeHtml"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<span class="c-grey f13 mt10 fl">{{blog.created_at}}</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<span class="c-grey f13 mt10 fl">{{blog.created_at}}</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey">回复 <span class="reply-num">({{blog.comment_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey" ng-if="blog.has_praise" ng-click="decreasePraise(blog);">已赞 ({{blog.praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey" ng-if="!blog.has_praise" ng-click="addPraise(blog);">赞 ({{blog.praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_blog_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in blog.blog_comment_children">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<div class="post-reply-content c-grey2 mb10" ng-bind-html="journal.content|safeHtml"></div>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey">回复 <span class="reply-num">({{blog.comment_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey" ng-if="blog.has_praise" ng-click="decreasePraise(blog);">已赞 ({{blog.praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey" ng-if="!blog.has_praise" ng-click="addPraise(blog);">赞 ({{blog.praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_blog_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in blog.blog_comment_children">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<pre class="post-reply-content c-grey2 mb10" ng-bind-html="journal.content|safeHtml"></pre>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<div class="post-input-container">
|
||||
<textarea class="copy-input"></textarea>
|
||||
<textarea input-auto type="text" class="post-reply-input" id="postInput" ng-model="formData.comment" /></textarea>
|
||||
</div>
|
||||
<button ng-click="addBlogReply(formData)" ng-disabled="formData.disabled" class="post-reply-submit fr mt10">回复</button>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="!blog.locked" class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<div class="post-input-container">
|
||||
<textarea class="copy-input"></textarea>
|
||||
<textarea input-auto type="text" class="post-reply-input" id="postInput" ng-model="formData.comment" /></textarea>
|
||||
</div>
|
||||
<button ng-click="addBlogReply(formData)" ng-disabled="formData.disabled" class="post-reply-submit fr mt10">回复</button>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,53 +1,56 @@
|
|||
|
||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-title mb5"><span class="c-grey3 f15 fb">{{discussion.subject}}</span><span ng-if="discussion.locked" class="locked_btn_cir ml10" title="已锁定"> </span></div>
|
||||
<table class="post-detail-info"><tr>
|
||||
<td class="text-nowrap v-top">发布者:</td>
|
||||
<td>{{discussion.user.realname}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-nowrap v-top">来 源:</td>
|
||||
<td>{{discussion.course_project_name}} | 课程问答区</td>
|
||||
</tr></table>
|
||||
<div class="post-content c-grey3 mt10" style="height:auto;">
|
||||
<div class="post-all-content" ng-bind-html="discussion.content|safeHtml"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<span class="c-grey f13 mt10 fl">{{discussion.created_on}}</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey" ng-if="discussion.has_praise" ng-click="decreasePraise(discussion);">已赞 ({{discussion.praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey" ng-if="!discussion.has_praise" ng-click="addPraise(discussion);">赞 ({{discussion.praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_course_message_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<div class="post-reply-content c-grey2 mb10" ng-bind-html="journal.content|safeHtml"></div>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
<div ng-if="discussion.act_type == 'Message'">
|
||||
<div class="post-container">
|
||||
<div loading-spinner></div>
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-title mb5"><span class="c-grey3 f15 fb">{{discussion.subject}}</span></div>
|
||||
<table class="post-detail-info"><tr>
|
||||
<td class="text-nowrap v-top">发布者:</td>
|
||||
<td>{{discussion.user.realname}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="text-nowrap v-top">来 源:</td>
|
||||
<td>{{discussion.course_project_name}} | 课程问答区</td>
|
||||
</tr></table>
|
||||
<div class="post-content c-grey3 mt10" style="height:auto;">
|
||||
<div class="post-all-content" ng-bind-html="discussion.content|safeHtml"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="!discussion.locked" class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<div class="post-input-container">
|
||||
<textarea class="copy-input"></textarea>
|
||||
<textarea input-auto type="text" class="post-reply-input" id="postInput" ng-model="formData.comment" /></textarea>
|
||||
</div>
|
||||
<button ng-click="addDiscussionReply(formData)" ng-disabled="formData.disabled" class="post-reply-submit fr mt10">回复</button>
|
||||
<span class="c-grey f13 mt10 fl">{{discussion.created_on}}</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey">回复 <span class="reply-num">({{discussion.replies_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey" ng-if="discussion.has_praise" ng-click="decreasePraise(discussion);">已赞 ({{discussion.praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey" ng-if="!discussion.has_praise" ng-click="addPraise(discussion);">赞 ({{discussion.praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_course_message_reply">
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in discussion.message_children">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<pre class="post-reply-content c-grey2 mb10" ng-bind-html="journal.content|safeHtml"></pre>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<div class="post-input-container">
|
||||
<textarea class="copy-input"></textarea>
|
||||
<textarea input-auto type="text" class="post-reply-input" id="postInput" ng-model="formData.comment" /></textarea>
|
||||
</div>
|
||||
<button ng-click="addDiscussionReply(formData)" ng-disabled="formData.disabled" class="post-reply-submit fr mt10">回复</button>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
<div ng-if="news.act_type == 'News'">
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
|
@ -30,7 +31,7 @@
|
|||
<div class="post-reply-avatar fl"><img ng-src="{{comments.author.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{comments.author.realname}}</div>
|
||||
<div class="post-reply-content c-grey2 mb10" ng-bind-html="comments.comments|safeHtml"></div>
|
||||
<pre class="post-reply-content c-grey2 mb10" ng-bind-html="comments.comments|safeHtml"></pre>
|
||||
<div class="post-reply-date fl">{{comments.created_on}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
|
@ -51,3 +52,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
<div ng-if="homework.act_type == 'HomeworkCommon'">
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
|
@ -36,7 +37,7 @@
|
|||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<div class="post-reply-content c-grey2 mb10" ng-bind-html="journal.notes|safeHtml"></div>
|
||||
<pre class="post-reply-content c-grey2 mb10" ng-bind-html="journal.notes|safeHtml"></pre>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
|
@ -56,4 +57,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
<div ng-if="issue.act_type == 'Issue'">
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
|
@ -34,7 +35,7 @@
|
|||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<div class="post-reply-content c-grey2 mb10" ng-bind-html="journal.notes|safeHtml"></div>
|
||||
<pre class="post-reply-content c-grey2 mb10" ng-bind-html="journal.notes|safeHtml"></pre>
|
||||
<div class="post-reply-date fl">{{journal.created_on}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
|
@ -55,3 +56,4 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,45 +1,47 @@
|
|||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-title mb5"><a herf="javascript:void(0);" class="mr10">{{message.user.realname}}</a><span style="vertical-align:top;">给您留言了</span><br /></div>
|
||||
<div class="post-title">{{message.created_on}}</div>
|
||||
<div class="cl"></div>
|
||||
<div class="post-content c-grey2 mt10" style="height:auto;">
|
||||
<div class="post-all-content" ng-bind-html="message.notes|safeHtml"></div>
|
||||
<div ng-if="message.act_type == 'JournalsForMessage'">
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-title mb5"><a herf="javascript:void(0);" class="mr10">{{message.user.realname}}</a><span style="vertical-align:top;">给您留言了</span><br /></div>
|
||||
<div class="post-title">{{message.created_on}}</div>
|
||||
<div class="cl"></div>
|
||||
<div class="post-content c-grey2 mt10" style="height:auto;">
|
||||
<div class="post-all-content" ng-bind-html="message.notes|safeHtml"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey">回复 <span class="reply-num">({{message.reply_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey" ng-if="message.has_praise" ng-click="decreasePraise(message);">已赞 ({{message.praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey" ng-if="!message.has_praise" ng-click="addPraise(message);">赞 ({{message.praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_message_reply">
|
||||
<div class="post-interactive border-bottom">
|
||||
<div class="post-interactive-reply c-grey">回复 <span class="reply-num">({{message.reply_count}})</span></div>
|
||||
<div class="post-interactive-column c-grey" ng-if="message.has_praise" ng-click="decreasePraise(message);">已赞 ({{message.praise_count}})</div>
|
||||
<div class="post-interactive-column c-grey" ng-if="!message.has_praise" ng-click="addPraise(message);">赞 ({{message.praise_count}})</div>
|
||||
</div>
|
||||
<div id="all_message_reply">
|
||||
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in message.child_reply">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<div class="post-reply-content c-grey2 mb10" ng-bind-html="journal.notes|safeHtml"></div>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
<div class="post-reply-wrap border-bottom" ng-repeat="journal in message.child_reply">
|
||||
<div class="post-reply-row">
|
||||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<pre class="post-reply-content c-grey2 mb10" ng-bind-html="journal.notes|safeHtml"></pre>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<div class="post-input-container">
|
||||
<textarea class="copy-input"></textarea>
|
||||
<textarea input-auto type="text" class="post-reply-input" id="postInput" ng-model="formData.comment" /></textarea>
|
||||
</div>
|
||||
<button ng-click="addJournalReply(formData)" ng-disabled="formData.disabled" class="post-reply-submit fr mt10">回复</button>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<div class="post-input-container">
|
||||
<textarea class="copy-input"></textarea>
|
||||
<textarea input-auto type="text" class="post-reply-input" id="postInput" ng-model="formData.comment" /></textarea>
|
||||
</div>
|
||||
<button ng-click="addJournalReply(formData)" ng-disabled="formData.disabled" class="post-reply-submit fr mt10">回复</button>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
<!-- 模板1开始,可以使用script(type设置为text/html)来存放模板片段,并且用id标示 -->
|
||||
<div ng-if="discussion.act_type == 'Message'">
|
||||
<div class="post-container">
|
||||
<div class="post-wrapper">
|
||||
<div class="post-main">
|
||||
<div class="post-title mb5"><span class="c-grey3 f15 fb">{{discussion.subject}}</span><span ng-if="discussion.locked" class="locked_btn_cir ml10" title="已锁定"> </span></div>
|
||||
<div class="post-title mb5"><span class="c-grey3 f15 fb">{{discussion.subject}}</span></div>
|
||||
<table class="post-detail-info"><tr>
|
||||
<td class="text-nowrap v-top">发布者:</td>
|
||||
<td>{{discussion.user.realname}}</td>
|
||||
|
@ -30,7 +31,7 @@
|
|||
<div class="post-reply-avatar fl"><img ng-src="{{journal.user.img_url}}" width="45" height="45" class="border-radius" /></div>
|
||||
<div class="ml55">
|
||||
<div class="post-reply-user hidden">{{journal.user.realname}}</div>
|
||||
<div class="post-reply-content c-grey2 mb10" ng-bind-html="journal.content|safeHtml"></div>
|
||||
<pre class="post-reply-content c-grey2 mb10" ng-bind-html="journal.content|safeHtml"></pre>
|
||||
<div class="post-reply-date fl">{{journal.lasted_comment}}</div>
|
||||
<div class="post-reply-trigger fr undis">回复</div>
|
||||
</div>
|
||||
|
@ -38,7 +39,7 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-if="!discussion.locked" class="post-input-wrap">
|
||||
<div class="post-input-wrap">
|
||||
<div class="post-reply-row">
|
||||
<!--<div class="post-reply-avatar fl"><img src="images/post-avatar.jpg" width="30" height="30" /></div>-->
|
||||
<div class="post-input-container">
|
||||
|
@ -50,4 +51,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB |
|
@ -136,7 +136,7 @@ app.factory('common', function($http, auth, $routeParams){
|
|||
url: apiUrl+ "new_comment/"+id,
|
||||
data: userInfo
|
||||
}).then(function successCallback(response) {
|
||||
alert("提交成功");
|
||||
//alert("提交成功");
|
||||
//数据提交完成,回复按钮启用
|
||||
data.disabled = false;
|
||||
if(typeof cb === 'function'){
|
||||
|
@ -446,11 +446,16 @@ app.directive('inputAuto',function(){
|
|||
scope: {},
|
||||
link: function(scope, element){
|
||||
var copyContainer = element.parent().children().eq(0);
|
||||
var sendButton = element.parent().next();
|
||||
element.on('input',function(){
|
||||
console.log(sendButton);
|
||||
copyContainer.html(element[0].value);
|
||||
var textHeight = copyContainer[0].scrollHeight;
|
||||
element.css('height', textHeight + 'px');
|
||||
});
|
||||
sendButton.on('click',function(){
|
||||
element.css('height','28px');
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*基本样式*/
|
||||
body,table,input,textarea,select,button { font-family: "微软雅黑","宋体";}
|
||||
h1,h2,h3,h4,h5,p {padding:0px; margin:0px;}
|
||||
h1,h2,h3,h4,h5,p,pre {padding:0px; margin:0px;}
|
||||
.f12 {font-size:12px;}
|
||||
.f13 {font-size:13px;}
|
||||
.f15 {font-size:15px;}
|
||||
|
@ -70,11 +70,11 @@ a.underline {text-decoration:underline;}
|
|||
.post-reply-date, .post-reply-trigger {font-size:13px;}
|
||||
.post-input-container {padding-right:2px;}
|
||||
.copy-input {width:100%; height:28px; line-height:28px; border-radius:3px; position:absolute; left:-9999em;}
|
||||
.post-reply-input {width:100%; height:28px; max-height:84px; line-height:28px; border:1px solid #e6e6e6; outline:none; padding:0; margin:0; border-radius:3px; overflow-y:hidden; resize:none;}
|
||||
.post-reply-input {width:100%; height:28px; max-height:84px; line-height:28px; border:1px solid #e6e6e6; outline:none; padding:0; margin:0; border-radius:3px; overflow-y:auto; resize:none;}
|
||||
.post-reply-submit {font-size:13px; padding:3px 8px; color:#fff; background-color:#269ac9; outline:none; border:none; display:inline-block;}
|
||||
.reply-icon {background:url(/images/wechat/wechat_icon.gif) -100px 1px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}
|
||||
.praise-icon {background:url(/images/wechat/wechat_icon.gif) -100px -38px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}
|
||||
.praised-icon {background:url(/images/wechat/wechat_icon.gif) -100px -76px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}
|
||||
.reply-icon {background:url(/images/wechat/icon_list.gif) -150px -155px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}
|
||||
.praise-icon {background:url(/images/wechat/icon_list.gif) -36px -88px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}
|
||||
.praised-icon {background:url(/images/wechat/icon_list.gif) -152px -86px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;}
|
||||
|
||||
/* loading 弹框*/
|
||||
.loading-bg {position:fixed; width:100%; height:100%; left:0; top:0; z-index:99; background:rgba(206, 206, 206, 0.3); overflow:hidden;}
|
||||
|
|
Loading…
Reference in New Issue