commit
2392106f78
@ -1,68 +1,72 @@
|
||||
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile '~/.gitignore_global'
|
||||
|
||||
# Ignore bundler config.
|
||||
/.bundle
|
||||
|
||||
# mac
|
||||
*.DS_Store
|
||||
|
||||
# Ignore all logfiles and tempfiles.
|
||||
/log/*
|
||||
/tmp/*
|
||||
!/log/.keep
|
||||
!/tmp/.keep
|
||||
|
||||
# Ignore uploaded files in development
|
||||
/storage/*
|
||||
|
||||
/node_modules
|
||||
/yarn-error.log
|
||||
|
||||
# /public/assets
|
||||
.byebug_history
|
||||
|
||||
# Ignore master key for decrypting credentials and more.
|
||||
/config/master.key
|
||||
/config/database.yml
|
||||
/.idea/*
|
||||
|
||||
# Ignore react node_modules
|
||||
/public/react/.cache
|
||||
/public/react/build
|
||||
/public/react/build/
|
||||
/public/react/node_modules/
|
||||
/public/react/config/stats.json
|
||||
/public/react/stats.json
|
||||
/public/react/.idea/*
|
||||
|
||||
/public/npm-debug.log
|
||||
|
||||
# avatars
|
||||
/public/images/avatars
|
||||
|
||||
/config/secrets.yml
|
||||
/config/redis.yml
|
||||
/config/elasticsearch.yml
|
||||
/config/aliyun_vod.yml
|
||||
|
||||
public/upload.html
|
||||
/config/configuration.yml
|
||||
/config/environments/production.rb
|
||||
/config/initializers/gitlab_config.rb
|
||||
/db/schema.rb
|
||||
.vscode/
|
||||
vendor/bundle/
|
||||
.ruby-version
|
||||
.ruby-gemset
|
||||
|
||||
/Users
|
||||
/files
|
||||
/public/images/avatars
|
||||
/public/files
|
||||
/workspace
|
||||
/log
|
||||
/public/admin
|
||||
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
||||
#
|
||||
# If you find yourself ignoring temporary files generated by your text editor
|
||||
# or operating system, you probably want to add a global ignore instead:
|
||||
# git config --global core.excludesfile '~/.gitignore_global'
|
||||
|
||||
# Ignore bundler config.
|
||||
/.bundle
|
||||
|
||||
# Ignore lock config file
|
||||
*.lock
|
||||
*.log
|
||||
|
||||
# mac
|
||||
*.DS_Store
|
||||
|
||||
# Ignore all logfiles and tempfiles.
|
||||
/log/*
|
||||
/tmp/*
|
||||
!/log/.keep
|
||||
!/tmp/.keep
|
||||
|
||||
# Ignore uploaded files in development
|
||||
/storage/*
|
||||
|
||||
/node_modules
|
||||
/yarn-error.log
|
||||
|
||||
# /public/assets
|
||||
.byebug_history
|
||||
|
||||
# Ignore master key for decrypting credentials and more.
|
||||
/config/master.key
|
||||
/config/database.yml
|
||||
/.idea/*
|
||||
|
||||
# Ignore react node_modules
|
||||
/public/react/.cache
|
||||
/public/react/build
|
||||
/public/react/build/
|
||||
/public/react/node_modules/
|
||||
/public/react/config/stats.json
|
||||
/public/react/stats.json
|
||||
/public/react/.idea/*
|
||||
|
||||
/public/npm-debug.log
|
||||
|
||||
# avatars
|
||||
/public/images/avatars
|
||||
|
||||
/config/secrets.yml
|
||||
/config/redis.yml
|
||||
/config/elasticsearch.yml
|
||||
/config/aliyun_vod.yml
|
||||
|
||||
public/upload.html
|
||||
/config/configuration.yml
|
||||
/config/environments/production.rb
|
||||
/config/initializers/gitlab_config.rb
|
||||
/db/schema.rb
|
||||
.vscode/
|
||||
vendor/bundle/
|
||||
.ruby-version
|
||||
.ruby-gemset
|
||||
|
||||
/Users
|
||||
/files
|
||||
/public/images/avatars
|
||||
/public/files
|
||||
/workspace
|
||||
/log
|
||||
/public/admin
|
||||
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cells": [],
|
||||
"metadata": {},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"cells": [],
|
||||
"metadata": {},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
@ -1,426 +0,0 @@
|
||||
PATH
|
||||
remote: lib/gitlab-cli
|
||||
specs:
|
||||
gitlab (3.2.0)
|
||||
httparty
|
||||
terminal-table
|
||||
|
||||
GEM
|
||||
remote: https://gems.ruby-china.com/
|
||||
specs:
|
||||
aasm (5.0.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activejob (= 5.2.1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
active_decorator (1.2.0)
|
||||
activejob (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
activerecord (5.2.1)
|
||||
activemodel (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
activerecord (= 5.2.1)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
acts-as-taggable-on (6.0.0)
|
||||
activerecord (~> 5.0)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
archive-zip (0.11.0)
|
||||
io-like (~> 0.3.0)
|
||||
arel (9.0.0)
|
||||
autoprefixer-rails (9.6.1)
|
||||
execjs
|
||||
awesome_print (1.8.0)
|
||||
axlsx (3.0.0.pre)
|
||||
htmlentities (~> 4.3, >= 4.3.4)
|
||||
mimemagic (~> 0.3)
|
||||
nokogiri (~> 1.8, >= 1.8.2)
|
||||
rubyzip (~> 1.2, >= 1.2.1)
|
||||
axlsx_rails (0.5.2)
|
||||
actionpack (>= 3.1)
|
||||
axlsx (>= 2.0.1)
|
||||
bindex (0.5.0)
|
||||
bootsnap (1.3.1)
|
||||
msgpack (~> 1.0)
|
||||
bootstrap (4.3.1)
|
||||
autoprefixer-rails (>= 9.1.0)
|
||||
popper_js (>= 1.14.3, < 2)
|
||||
sassc-rails (>= 2.0.0)
|
||||
builder (3.2.3)
|
||||
bulk_insert (1.7.0)
|
||||
activerecord (>= 3.2.0)
|
||||
byebug (10.0.2)
|
||||
capybara (3.5.1)
|
||||
addressable
|
||||
mini_mime (>= 0.1.3)
|
||||
nokogiri (~> 1.8)
|
||||
rack (>= 1.6.0)
|
||||
rack-test (>= 0.6.3)
|
||||
xpath (~> 3.1)
|
||||
childprocess (0.9.0)
|
||||
ffi (~> 1.0, >= 1.0.11)
|
||||
chromedriver-helper (1.2.0)
|
||||
archive-zip (~> 0.10)
|
||||
nokogiri (~> 1.8)
|
||||
chunky_png (1.3.10)
|
||||
concurrent-ruby (1.0.5)
|
||||
connection_pool (2.2.2)
|
||||
crass (1.0.4)
|
||||
diff-lcs (1.3)
|
||||
diffy (3.3.0)
|
||||
elasticsearch (7.2.0)
|
||||
elasticsearch-api (= 7.2.0)
|
||||
elasticsearch-transport (= 7.2.0)
|
||||
elasticsearch-api (7.2.0)
|
||||
multi_json
|
||||
elasticsearch-transport (7.2.0)
|
||||
faraday
|
||||
multi_json
|
||||
enumerize (2.3.1)
|
||||
activesupport (>= 3.2)
|
||||
erubi (1.7.1)
|
||||
execjs (2.7.0)
|
||||
faraday (0.15.4)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
ffi (1.9.25)
|
||||
font-awesome-sass (4.7.0)
|
||||
sass (>= 3.2)
|
||||
globalid (0.4.1)
|
||||
activesupport (>= 4.2.0)
|
||||
grape-entity (0.7.1)
|
||||
activesupport (>= 4.0)
|
||||
multi_json (>= 1.3.2)
|
||||
hashie (3.5.7)
|
||||
htmlentities (4.3.4)
|
||||
httparty (0.16.2)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.1.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
io-like (0.3.0)
|
||||
jbuilder (2.7.0)
|
||||
activesupport (>= 4.2.0)
|
||||
multi_json (>= 1.2)
|
||||
jquery-rails (4.3.5)
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
jwt (2.1.0)
|
||||
kaminari (1.1.1)
|
||||
activesupport (>= 4.1.0)
|
||||
kaminari-actionview (= 1.1.1)
|
||||
kaminari-activerecord (= 1.1.1)
|
||||
kaminari-core (= 1.1.1)
|
||||
kaminari-actionview (1.1.1)
|
||||
actionview
|
||||
kaminari-core (= 1.1.1)
|
||||
kaminari-activerecord (1.1.1)
|
||||
activerecord
|
||||
kaminari-core (= 1.1.1)
|
||||
kaminari-core (1.1.1)
|
||||
listen (3.1.5)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
ruby_dep (~> 1.2)
|
||||
loofah (2.2.2)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.0)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.2)
|
||||
mimemagic (~> 0.3.2)
|
||||
method_source (0.9.0)
|
||||
mimemagic (0.3.2)
|
||||
mini_mime (1.0.0)
|
||||
mini_portile2 (2.3.0)
|
||||
minitest (5.11.3)
|
||||
msgpack (1.2.4)
|
||||
multi_json (1.13.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
mustermann (1.0.3)
|
||||
mysql2 (0.5.2)
|
||||
nio4r (2.3.1)
|
||||
nokogiri (1.8.4)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
oauth2 (1.4.1)
|
||||
faraday (>= 0.8, < 0.16.0)
|
||||
jwt (>= 1.0, < 3.0)
|
||||
multi_json (~> 1.3)
|
||||
multi_xml (~> 0.5)
|
||||
rack (>= 1.2, < 3)
|
||||
omniauth (1.9.0)
|
||||
hashie (>= 3.4.6, < 3.7.0)
|
||||
rack (>= 1.6.2, < 3)
|
||||
omniauth-oauth2 (1.6.0)
|
||||
oauth2 (~> 1.1)
|
||||
omniauth (~> 1.9)
|
||||
pdfkit (0.8.4.1)
|
||||
popper_js (1.14.5)
|
||||
public_suffix (4.0.1)
|
||||
puma (3.12.0)
|
||||
rack (2.0.5)
|
||||
rack-cors (1.0.2)
|
||||
rack-protection (2.0.5)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.1)
|
||||
actioncable (= 5.2.1)
|
||||
actionmailer (= 5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activejob (= 5.2.1)
|
||||
activemodel (= 5.2.1)
|
||||
activerecord (= 5.2.1)
|
||||
activestorage (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.1)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-dom-testing (2.0.3)
|
||||
activesupport (>= 4.2.0)
|
||||
nokogiri (>= 1.6)
|
||||
rails-html-sanitizer (1.0.4)
|
||||
loofah (~> 2.2, >= 2.2.2)
|
||||
rails-i18n (5.1.3)
|
||||
i18n (>= 0.7, < 2)
|
||||
railties (>= 5.0, < 6)
|
||||
railties (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
rake (12.3.1)
|
||||
rb-fsevent (0.10.3)
|
||||
rb-inotify (0.9.10)
|
||||
ffi (>= 0.5.0, < 2)
|
||||
rchardet (1.8.0)
|
||||
redcarpet (3.4.0)
|
||||
redis (4.1.0)
|
||||
redis-actionpack (5.0.2)
|
||||
actionpack (>= 4.0, < 6)
|
||||
redis-rack (>= 1, < 3)
|
||||
redis-store (>= 1.1.0, < 2)
|
||||
redis-activesupport (5.0.7)
|
||||
activesupport (>= 3, < 6)
|
||||
redis-store (>= 1.3, < 2)
|
||||
redis-rack (2.0.5)
|
||||
rack (>= 1.5, < 3)
|
||||
redis-store (>= 1.2, < 2)
|
||||
redis-rails (5.0.2)
|
||||
redis-actionpack (>= 5.0, < 6)
|
||||
redis-activesupport (>= 5.0, < 6)
|
||||
redis-store (>= 1.2, < 2)
|
||||
redis-store (1.6.0)
|
||||
redis (>= 2.2, < 5)
|
||||
roo (2.8.2)
|
||||
nokogiri (~> 1)
|
||||
rubyzip (>= 1.2.1, < 2.0.0)
|
||||
roo-xls (1.2.0)
|
||||
nokogiri
|
||||
roo (>= 2.0.0, < 3)
|
||||
spreadsheet (> 0.9.0)
|
||||
rqrcode (0.10.1)
|
||||
chunky_png (~> 1.0)
|
||||
rqrcode_png (0.1.5)
|
||||
chunky_png
|
||||
rqrcode
|
||||
rspec-core (3.8.0)
|
||||
rspec-support (~> 3.8.0)
|
||||
rspec-expectations (3.8.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.8.0)
|
||||
rspec-mocks (3.8.0)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.8.0)
|
||||
rspec-rails (3.8.0)
|
||||
actionpack (>= 3.0)
|
||||
activesupport (>= 3.0)
|
||||
railties (>= 3.0)
|
||||
rspec-core (~> 3.8.0)
|
||||
rspec-expectations (~> 3.8.0)
|
||||
rspec-mocks (~> 3.8.0)
|
||||
rspec-support (~> 3.8.0)
|
||||
rspec-support (3.8.0)
|
||||
ruby-ole (1.2.12.2)
|
||||
ruby_dep (1.5.0)
|
||||
rubyzip (1.2.1)
|
||||
sass (3.5.7)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
sass-rails (5.0.7)
|
||||
railties (>= 4.0.0, < 6)
|
||||
sass (~> 3.1)
|
||||
sprockets (>= 2.8, < 4.0)
|
||||
sprockets-rails (>= 2.0, < 4.0)
|
||||
tilt (>= 1.1, < 3)
|
||||
sassc (2.0.1)
|
||||
ffi (~> 1.9)
|
||||
rake
|
||||
sassc-rails (2.1.2)
|
||||
railties (>= 4.0.0)
|
||||
sassc (>= 2.0)
|
||||
sprockets (> 3.0)
|
||||
sprockets-rails
|
||||
tilt
|
||||
searchkick (3.1.3)
|
||||
activemodel (>= 4.2)
|
||||
elasticsearch (>= 5)
|
||||
hashie
|
||||
selenium-webdriver (3.14.0)
|
||||
childprocess (~> 0.5)
|
||||
rubyzip (~> 1.2)
|
||||
sidekiq (5.2.7)
|
||||
connection_pool (~> 2.2, >= 2.2.2)
|
||||
rack (>= 1.5.0)
|
||||
rack-protection (>= 1.5.0)
|
||||
redis (>= 3.3.5, < 5)
|
||||
simple_form (4.1.0)
|
||||
actionpack (>= 5.0)
|
||||
activemodel (>= 5.0)
|
||||
simple_xlsx_reader (1.0.4)
|
||||
nokogiri
|
||||
rubyzip
|
||||
sinatra (2.0.5)
|
||||
mustermann (~> 1.0)
|
||||
rack (~> 2.0)
|
||||
rack-protection (= 2.0.5)
|
||||
tilt (~> 2.0)
|
||||
spreadsheet (1.2.3)
|
||||
ruby-ole (>= 1.0)
|
||||
spring (2.0.2)
|
||||
activesupport (>= 4.2)
|
||||
spring-watcher-listen (2.0.1)
|
||||
listen (>= 2.7, < 4.0)
|
||||
spring (>= 1.2, < 3.0)
|
||||
sprockets (3.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
sprockets-rails (3.2.1)
|
||||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thor (0.20.0)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.8)
|
||||
turbolinks (5.2.0)
|
||||
turbolinks-source (~> 5.2)
|
||||
turbolinks-source (5.2.0)
|
||||
tzinfo (1.2.5)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (4.1.17)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
unicode-display_width (1.4.0)
|
||||
web-console (3.6.2)
|
||||
actionview (>= 5.0)
|
||||
activemodel (>= 5.0)
|
||||
bindex (>= 0.4.0)
|
||||
railties (>= 5.0)
|
||||
websocket-driver (0.7.0)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.3)
|
||||
wkhtmltopdf-binary (0.12.4)
|
||||
xpath (3.1.0)
|
||||
nokogiri (~> 1.8)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
aasm
|
||||
active_decorator
|
||||
acts-as-taggable-on (~> 6.0)
|
||||
awesome_print
|
||||
axlsx (~> 3.0.0.pre)
|
||||
axlsx_rails (~> 0.5.2)
|
||||
bootsnap (>= 1.1.0)
|
||||
bootstrap (~> 4.3.1)
|
||||
bulk_insert
|
||||
byebug
|
||||
capybara (>= 2.15, < 4.0)
|
||||
chromedriver-helper
|
||||
diffy
|
||||
enumerize
|
||||
faraday (~> 0.15.4)
|
||||
font-awesome-sass (= 4.7.0)
|
||||
gitlab!
|
||||
grape-entity (~> 0.7.1)
|
||||
jbuilder (~> 2.5)
|
||||
jquery-rails
|
||||
kaminari (~> 1.1, >= 1.1.1)
|
||||
listen (>= 3.0.5, < 3.2)
|
||||
mysql2 (>= 0.4.4, < 0.6.0)
|
||||
oauth2
|
||||
omniauth (~> 1.9.0)
|
||||
omniauth-oauth2 (~> 1.6.0)
|
||||
pdfkit
|
||||
puma (~> 3.11)
|
||||
rack-cors
|
||||
rails (~> 5.2.0)
|
||||
rails-i18n (~> 5.1)
|
||||
rchardet (~> 1.8)
|
||||
redcarpet (~> 3.4)
|
||||
redis-rails
|
||||
roo-xls
|
||||
rqrcode (~> 0.10.1)
|
||||
rqrcode_png
|
||||
rspec-rails (~> 3.8)
|
||||
ruby-ole
|
||||
rubyzip
|
||||
sass-rails (~> 5.0)
|
||||
searchkick
|
||||
selenium-webdriver
|
||||
sidekiq
|
||||
simple_form
|
||||
simple_xlsx_reader
|
||||
sinatra
|
||||
spreadsheet
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
turbolinks (~> 5)
|
||||
tzinfo-data
|
||||
uglifier (>= 1.3.0)
|
||||
web-console (>= 3.3.0)
|
||||
wkhtmltopdf-binary
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.3.7p456
|
||||
|
||||
BUNDLED WITH
|
||||
1.17.3
|
@ -0,0 +1,126 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-laboratory-shixuns-index-page').length > 0) {
|
||||
var $searchForm = $('.laboratory-shixun-list-form .search-form');
|
||||
var laboratoryId = $('.laboratory-shixun-list-container').data('id');
|
||||
|
||||
$searchForm.find('select#tag_id').select2({
|
||||
placeholder: "请选择",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
// 定义状态切换监听事件
|
||||
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
|
||||
$('.laboratory-shixun-list-container').on('click', doElement, function () {
|
||||
var $doAction = $(this);
|
||||
var $undoAction = $doAction.siblings(undoElement);
|
||||
|
||||
var laboratoryShixunId = $doAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认进行该操作吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/admins/laboratories/' + laboratoryId + '/laboratory_shixuns/' + laboratoryShixunId + url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function () {
|
||||
show_success_flash();
|
||||
$doAction.hide();
|
||||
$undoAction.show();
|
||||
if (callback && typeof callback === "function") {
|
||||
callback(laboratoryShixunId, url);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 首页展示与取消首页展示
|
||||
var homepageShowCallback = function (laboratoryShixunId, url) {
|
||||
var $laboratoryShixunItem = $('.laboratory-shixun-list-container').find('.laboratory-shixun-item-' + laboratoryShixunId);
|
||||
|
||||
if (url === '/homepage') {
|
||||
$laboratoryShixunItem.find('.homepage-badge').show();
|
||||
} else {
|
||||
$laboratoryShixunItem.find('.homepage-badge').hide();
|
||||
}
|
||||
}
|
||||
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
|
||||
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
|
||||
|
||||
// 添加实训功能
|
||||
var $addModal = $('.modal.admin-add-laboratory-shixun-modal');
|
||||
var $addForm = $addModal.find('form.admin-add-laboratory-user-form');
|
||||
var $shixunSelect = $addForm.find('select.shixun-select');
|
||||
|
||||
$addModal.on('show.bs.modal', function(){
|
||||
$addModal.find('.error').html('');
|
||||
$shixunSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
$shixunSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入实训名称/创建者检索',
|
||||
multiple: true,
|
||||
closeOnSelect: false,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/admins/laboratories/' + laboratoryId + '/shixuns_for_select',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { keyword: params.term, page: params.page || 1, per_page: 20 };
|
||||
},
|
||||
processResults: function(data, params){
|
||||
params.page = params.page || 1;
|
||||
|
||||
return {
|
||||
results: data.shixuns,
|
||||
pagination: {
|
||||
more: (params.page * 20) < data.count
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
var ele = '<span>'
|
||||
ele += '<span>' + item.name + '</span>';
|
||||
ele += '<span class="font-12"> -- ' + item.creator_name + '</span>';
|
||||
ele += '<span class="font-12"> -- ' + item.status_text+ '</span>';
|
||||
ele += '</span>';
|
||||
|
||||
return $(ele);
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
var ele = '<span>' + (item.name || item.text) + '<span class="font-12"> -- ' + item.creator_name + '</span></span>'
|
||||
return $(ele);
|
||||
}
|
||||
});
|
||||
|
||||
$addModal.on('click', '.submit-btn', function(){
|
||||
$addModal.find('.error').html('');
|
||||
|
||||
var shixunIds = $shixunSelect.val();
|
||||
if (shixunIds && shixunIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/admins/laboratories/' + laboratoryId + '/laboratory_shixuns',
|
||||
data: { shixun_ids: shixunIds },
|
||||
success: function(){
|
||||
show_success_flash();
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(res){
|
||||
$addModal.find('.error').html(res.responseJSON.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$addModal.find('.error').html('请选择实训');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,149 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-laboratory-subjects-index-page').length > 0) {
|
||||
var $searchForm = $('.laboratory-subject-list-form .search-form');
|
||||
var laboratoryId = $('.laboratory-subject-list-container').data('id');
|
||||
|
||||
// ************** 学校选择 *************
|
||||
$searchForm.find('.school-select').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请选择创建者单位',
|
||||
allowClear: true,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/api/schools/search.json',
|
||||
dataType: 'json',
|
||||
data: function (params) {
|
||||
return {keyword: params.term};
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {results: data.schools}
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if (!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function (item) {
|
||||
if (item.id) {
|
||||
}
|
||||
return item.name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
// 定义状态切换监听事件
|
||||
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
|
||||
$('.laboratory-subject-list-container').on('click', doElement, function () {
|
||||
var $doAction = $(this);
|
||||
var $undoAction = $doAction.siblings(undoElement);
|
||||
|
||||
var laboratorySubjectId = $doAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认进行该操作吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/admins/laboratories/' + laboratoryId + '/laboratory_subjects/' + laboratorySubjectId + url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function () {
|
||||
show_success_flash();
|
||||
$doAction.hide();
|
||||
$undoAction.show();
|
||||
if (callback && typeof callback === "function") {
|
||||
callback(laboratorySubjectId, url);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 首页展示与取消首页展示
|
||||
var homepageShowCallback = function (laboratoryShixunId, url) {
|
||||
var $laboratoryShixunItem = $('.laboratory-subject-list-container').find('.laboratory-subject-item-' + laboratoryShixunId);
|
||||
|
||||
if (url === '/homepage') {
|
||||
$laboratoryShixunItem.find('.homepage-badge').show();
|
||||
} else {
|
||||
$laboratoryShixunItem.find('.homepage-badge').hide();
|
||||
}
|
||||
}
|
||||
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
|
||||
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
|
||||
|
||||
// 添加实践课程功能
|
||||
var $addModal = $('.modal.admin-add-laboratory-subject-modal');
|
||||
var $addForm = $addModal.find('form.admin-add-laboratory-user-form');
|
||||
var $subjectSelect = $addForm.find('select.subject-select');
|
||||
|
||||
$addModal.on('show.bs.modal', function(){
|
||||
$addModal.find('.error').html('');
|
||||
$subjectSelect.select2('val', ' ');
|
||||
});
|
||||
|
||||
$subjectSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入课程名称/创建者检索',
|
||||
multiple: false,
|
||||
closeOnSelect: true,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/admins/laboratories/' + laboratoryId + '/subjects_for_select',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { keyword: params.term, page: params.page || 1, per_page: 20 }
|
||||
},
|
||||
processResults: function(data, params){
|
||||
params.page = params.page || 1;
|
||||
|
||||
return {
|
||||
results: data.subjects,
|
||||
pagination: {
|
||||
more: (params.page * 20) < data.count
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
var ele = '<span>'
|
||||
ele += '<span>' + item.name + '</span>';
|
||||
ele += '<span class="font-12"> -- ' + item.creator_name + '</span>';
|
||||
ele += '<span class="font-12"> -- ' + item.status_text+ '</span>';
|
||||
ele += '</span>';
|
||||
|
||||
return $(ele);
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
var ele = '<span>' + (item.name || item.text) + '<span class="font-12"> -- ' + item.creator_name + '</span></span>'
|
||||
return $(ele);
|
||||
}
|
||||
});
|
||||
|
||||
$addModal.on('click', '.submit-btn', function(){
|
||||
$addModal.find('.error').html('');
|
||||
|
||||
var subjectIds = $subjectSelect.val();
|
||||
if (subjectIds && subjectIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/admins/laboratories/' + laboratoryId + '/laboratory_subjects',
|
||||
data: { subject_id: subjectIds },
|
||||
success: function(){
|
||||
show_success_flash();
|
||||
window.location.reload();
|
||||
},
|
||||
error: function(res){
|
||||
$addModal.find('.error').html(res.responseJSON.message);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$addModal.find('.error').html('请选择课程');
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -0,0 +1,90 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
var $modal = $('.modal.admin-select-school-modal');
|
||||
if ($modal.length > 0) {
|
||||
var $link = null;
|
||||
var $form = $modal.find('form.admin-select-school-form');
|
||||
var multiple = $form.data('multiple');
|
||||
|
||||
$form.find('.school-select').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请选择',
|
||||
multiple: multiple,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/api/schools/search.json',
|
||||
dataType: 'json',
|
||||
data: function (params) {
|
||||
return {keyword: params.term};
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {results: data.schools}
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if (!item.id || item.id === '') return item.text;
|
||||
var html = "<span>" + item.name + "<span class='ml-4 font-12'>";
|
||||
if(item.province){ html += item.province }
|
||||
html += "</span></span>";
|
||||
return $(html);
|
||||
},
|
||||
templateSelection: function (item) {
|
||||
if (item.id) {
|
||||
}
|
||||
return item.name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
school_ids: {
|
||||
required: true
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
school_ids: {
|
||||
required: '请选择'
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$modal.on('show.bs.modal', function(event){
|
||||
$link = $(event.relatedTarget);
|
||||
});
|
||||
|
||||
$modal.on('hide.bs.modal', function(){
|
||||
$form.find('.error').html('');
|
||||
$form.find('.school-select').select2('val', ' ');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if($form.valid()){
|
||||
var url = $form.data('url');
|
||||
var schoolIds = $form.find('#school_ids').val();
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: { school_ids: schoolIds },
|
||||
success: function(){
|
||||
$.notify({ message: '操作成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,28 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.partners-customers-page').length > 0) {
|
||||
var $customerContainer = $('.customer-list-container');
|
||||
var partnerId = $customerContainer.find('.customer-list-body').data('id');
|
||||
|
||||
$customerContainer.on('change', '.manager-group-select', function(){
|
||||
console.log('manager-group-select change', $(this).val());
|
||||
var $select = $(this);
|
||||
var customerId = $select.data('id');
|
||||
var managerGroupId = $select.val();
|
||||
|
||||
$.ajax({
|
||||
url: '/partners/' + partnerId + '/customer_manager_group.json',
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
data: { customer_id: customerId, manager_group_id: managerGroupId },
|
||||
success: function(){
|
||||
showSuccessFlash();
|
||||
$select.data('last', managerGroupId);
|
||||
},
|
||||
error: function(res){
|
||||
showErrorNotify(res.responseJSON.message);
|
||||
$select.val($select.data('last'));
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
});
|
@ -0,0 +1,125 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.partners-partner-manager-groups-page').length > 0) {
|
||||
var $container = $('.manager-group-list-container');
|
||||
var partnerId = $container.find('.manager-group-list-body').data('id');
|
||||
|
||||
// ------- 新建编辑权限组弹窗 --------
|
||||
var $managerGroupModal = $('.modal.partner-save-manager-group-modal');
|
||||
var $managerGroupForm = $managerGroupModal.find('form.partner-save-manager-group-form');
|
||||
var $managerGroupIdInput = $managerGroupForm.find('input[name="manager_group_id"]');
|
||||
var $managerGroupNameInput = $managerGroupForm.find('input[name="manager_group_name"]');
|
||||
|
||||
$managerGroupForm.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
manager_group_name: {
|
||||
required: true,
|
||||
maxlength: 20
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
$managerGroupModal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
var managerGroupId = $link.data('id');
|
||||
var managerGroupName = $link.data('name');
|
||||
|
||||
if(managerGroupId && managerGroupId !== ''){
|
||||
$managerGroupModal.find('.modal-title').html('重命名');
|
||||
$managerGroupIdInput.val(managerGroupId);
|
||||
$managerGroupNameInput.val(managerGroupName)
|
||||
} else {
|
||||
$managerGroupModal.find('.modal-title').html('新建');
|
||||
$managerGroupIdInput.val('');
|
||||
$managerGroupNameInput.val('');
|
||||
}
|
||||
});
|
||||
|
||||
$managerGroupModal.on('hide.bs.modal', function(){
|
||||
$managerGroupIdInput.val('');
|
||||
$managerGroupNameInput.val('');
|
||||
});
|
||||
|
||||
$managerGroupModal.on('click', '.submit-btn', function(){
|
||||
$managerGroupForm.find('.error').html('');
|
||||
var url = $managerGroupForm.data('url');
|
||||
|
||||
if ($managerGroupForm.valid()) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $managerGroupForm.serialize()
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// ---------- 添加管理员弹窗 ------------
|
||||
var $partnerManagerModal = $('.modal.partner-add-partner-manager-modal');
|
||||
var $partnerManagerForm = $partnerManagerModal.find('form.partner-add-partner-manager-form');
|
||||
var $managerGroupIdInput = $partnerManagerForm.find('input[name="manager_group_id"]');
|
||||
var $userSelect = $partnerManagerForm.find('.partner-manager-select');
|
||||
|
||||
$userSelect.select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请输入要添加的管理员姓名',
|
||||
multiple: true,
|
||||
closeOnSelect: false,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/api/users_for_partners',
|
||||
dataType: 'json',
|
||||
data: function(params){
|
||||
return { name: params.term, partner_id: partnerId, page: params.page || 1, per_page: 20 };
|
||||
},
|
||||
processResults: function(data, params){
|
||||
params.page = params.page || 1;
|
||||
|
||||
return {
|
||||
results: data.users,
|
||||
pagination: {
|
||||
more: (params.page * 20) < data.count
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if(!item.id || item.id === '') return item.text;
|
||||
return $("<span>" + item.real_name + " <span class='font-12'>" + item.school_name + ' ' + item.identity + "</span></span>");
|
||||
},
|
||||
templateSelection: function(item){
|
||||
if (item.id) {
|
||||
}
|
||||
return item.real_name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
$partnerManagerModal.on('show.bs.modal', function(event){
|
||||
var $link = $(event.relatedTarget);
|
||||
var managerGroupId = $link.data('id');
|
||||
|
||||
$managerGroupIdInput.val(managerGroupId);
|
||||
$userSelect.select2('val', ' ');
|
||||
$partnerManagerModal.find('.error').html('');
|
||||
});
|
||||
|
||||
$partnerManagerModal.on('click', '.submit-btn', function(){
|
||||
$partnerManagerModal.find('.error').html('');
|
||||
var managerGroupId = $managerGroupIdInput.val();
|
||||
|
||||
var userIds = $userSelect.val();
|
||||
if (userIds && userIds.length > 0) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'script',
|
||||
url: '/partners/' + partnerId + '/partner_managers',
|
||||
data: { user_ids: userIds, manager_group_id: managerGroupId }
|
||||
});
|
||||
} else {
|
||||
$partnerManagerModal.modal('hide');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,148 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.cooperative-competitions-index-page').length > 0) {
|
||||
$('.modal.cooperative-upload-file-modal').on('upload:success', function(e, data){
|
||||
var $imageElement = $('.competition-image-' + data.source_id);
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
});
|
||||
}
|
||||
|
||||
$(".cooperative-competition-list-form").on("change", '.competitions-hot-select', function () {
|
||||
var s_value = $(this).get(0).checked ? 1 : 0;
|
||||
var json = {};
|
||||
json["hot"] = s_value;
|
||||
$.ajax({
|
||||
url: "/cooperative/competitions/hot_setting",
|
||||
type: "POST",
|
||||
dataType:'json',
|
||||
data: json,
|
||||
success: function(){
|
||||
$.notify({ message: '操作成功' });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// ============== 新增竞赛 ===============
|
||||
var $modal = $('.modal.cooperative-create-competition-modal');
|
||||
var $form = $modal.find('form.cooperative-create-competition-form');
|
||||
var $competitionNameInput = $form.find('input[name="competition_name"]');
|
||||
|
||||
$form.validate({
|
||||
errorElement: 'span',
|
||||
errorClass: 'danger text-danger',
|
||||
rules: {
|
||||
competition_name: {
|
||||
required: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// modal ready fire
|
||||
$modal.on('show.bs.modal', function () {
|
||||
$competitionNameInput.val('');
|
||||
});
|
||||
|
||||
$modal.on('click', '.submit-btn', function(){
|
||||
$form.find('.error').html('');
|
||||
|
||||
if ($form.valid()) {
|
||||
var url = $form.data('url');
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: url,
|
||||
data: $form.serialize(),
|
||||
success: function(){
|
||||
$.notify({ message: '创建成功' });
|
||||
$modal.modal('hide');
|
||||
|
||||
setTimeout(function(){
|
||||
window.location.reload();
|
||||
}, 500);
|
||||
},
|
||||
error: function(res){
|
||||
var data = res.responseJSON;
|
||||
$form.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// 导入学生
|
||||
var $importScoreModal = $('.modal.cooperative-import-competition-score-modal');
|
||||
var $importScoreForm = $importScoreModal.find('form.cooperative-import-competition-score-form');
|
||||
var $competitionIdInput = $importScoreForm.find('input[name="competition_id"]');
|
||||
|
||||
$importScoreModal.on('show.bs.modal', function(event){
|
||||
resetFileInputFunc($importScoreModal.find('.upload-file-input'));
|
||||
$importScoreModal.find('.file-names').html('选择文件');
|
||||
$importScoreModal.find('.upload-file-input').trigger('click');
|
||||
|
||||
var $link = $(event.relatedTarget);
|
||||
var competitionId = $link.data('competition-id');
|
||||
$competitionIdInput.val(competitionId);
|
||||
});
|
||||
|
||||
$importScoreModal.on('change', '.upload-file-input', function(e){
|
||||
var file = $(this)[0].files[0];
|
||||
$importScoreModal.find('.file-names').html(file ? file.name : '请选择文件');
|
||||
});
|
||||
|
||||
var importUserFormValid = function(){
|
||||
if($importScoreForm.find('input[name="file"]').val() == undefined || $importScoreForm.find('input[name="file"]').val().length == 0){
|
||||
$importScoreForm.find('.error').html('请选择文件');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
var buildResultMessage = function(data){
|
||||
var messageHtml = "<div>导入结果:成功" + data.success + "条,失败"+ data.fail.length + "条</div>";
|
||||
|
||||
if(data.fail.length > 0){
|
||||
messageHtml += '<table class="table"><thead class="thead-light"><tr><th>数据</th><th>失败原因</th></tr></thead><tbody>';
|
||||
|
||||
data.fail.forEach(function(item){
|
||||
messageHtml += '<tr><td>' + item.data + '</td><td>' + item.message + '</td></tr>';
|
||||
});
|
||||
|
||||
messageHtml += '</tbody></table>'
|
||||
}
|
||||
|
||||
return messageHtml;
|
||||
};
|
||||
|
||||
$importScoreModal.on('click', '.submit-btn', function(){
|
||||
$importScoreForm.find('.error').html('');
|
||||
|
||||
if (importUserFormValid()) {
|
||||
$('body').mLoading({ text: '正在导入...' });
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
url: '/cooperative/import_competition_scores',
|
||||
data: new FormData($importScoreForm[0]),
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data){
|
||||
$('body').mLoading('destroy');
|
||||
$importScoreModal.modal('hide');
|
||||
|
||||
showMessageModal(buildResultMessage(data), function(){
|
||||
window.location.reload();
|
||||
});
|
||||
},
|
||||
error: function(res){
|
||||
$('body').mLoading('destroy');
|
||||
var data = res.responseJSON;
|
||||
$importScoreForm.find('.error').html(data.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,9 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if($('body.cooperative-enroll-lists-index-page').length > 0){
|
||||
var search_form = $(".search-form");
|
||||
//导出
|
||||
$(".competition-enroll-list-form").on("click","#enroll-lists-export",function () {
|
||||
window.location.href = "/cooperative/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists/export.xlsx?" + search_form.serialize();
|
||||
});
|
||||
}
|
||||
});
|
@ -0,0 +1,60 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.cooperative-laboratory-shixuns-index-page').length > 0) {
|
||||
var $searchForm = $('.laboratory-shixun-list-form .search-form');
|
||||
|
||||
$searchForm.find('select#tag_id').select2({
|
||||
placeholder: "请选择",
|
||||
allowClear: true
|
||||
});
|
||||
|
||||
// 上传图片
|
||||
$('.modal.cooperative-upload-file-modal').on('upload:success', function (e, data) {
|
||||
var $imageElement = $('.shixun-image-' + data.source_id);
|
||||
if($imageElement.length === 0) return;
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
});
|
||||
|
||||
// 定义状态切换监听事件
|
||||
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
|
||||
$('.laboratory-shixun-list-container').on('click', doElement, function () {
|
||||
var $doAction = $(this);
|
||||
var $undoAction = $doAction.siblings(undoElement);
|
||||
|
||||
var laboratoryShixunId = $doAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认进行该操作吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/cooperative/laboratory_shixuns/' + laboratoryShixunId + url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function () {
|
||||
show_success_flash();
|
||||
$doAction.hide();
|
||||
$undoAction.show();
|
||||
if (callback && typeof callback === "function") {
|
||||
callback(laboratoryShixunId, url);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 首页展示与取消首页展示
|
||||
var homepageShowCallback = function (laboratoryShixunId, url) {
|
||||
var $laboratoryShixunItem = $('.laboratory-shixun-list-container').find('.laboratory-shixun-item-' + laboratoryShixunId);
|
||||
|
||||
if (url === '/homepage') {
|
||||
$laboratoryShixunItem.find('.homepage-badge').show();
|
||||
} else {
|
||||
$laboratoryShixunItem.find('.homepage-badge').hide();
|
||||
}
|
||||
}
|
||||
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
|
||||
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
|
||||
}
|
||||
})
|
@ -0,0 +1,83 @@
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.cooperative-laboratory-subjects-index-page').length > 0) {
|
||||
var $searchForm = $('.laboratory-subject-list-form .search-form');
|
||||
|
||||
// ************** 学校选择 *************
|
||||
$searchForm.find('.school-select').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: '请选择创建者单位',
|
||||
allowClear: true,
|
||||
minimumInputLength: 1,
|
||||
ajax: {
|
||||
delay: 500,
|
||||
url: '/api/schools/search.json',
|
||||
dataType: 'json',
|
||||
data: function (params) {
|
||||
return {keyword: params.term};
|
||||
},
|
||||
processResults: function (data) {
|
||||
return {results: data.schools}
|
||||
}
|
||||
},
|
||||
templateResult: function (item) {
|
||||
if (!item.id || item.id === '') return item.text;
|
||||
return item.name;
|
||||
},
|
||||
templateSelection: function (item) {
|
||||
if (item.id) {
|
||||
}
|
||||
return item.name || item.text;
|
||||
}
|
||||
});
|
||||
|
||||
// 上传图片
|
||||
$('.modal.cooperative-upload-file-modal').on('upload:success', function (e, data) {
|
||||
var $imageElement = $('.subject-image-' + data.source_id);
|
||||
if($imageElement.length === 0) return;
|
||||
$imageElement.attr('src', data.url);
|
||||
$imageElement.show();
|
||||
$imageElement.next().html('重新上传');
|
||||
});
|
||||
|
||||
// 定义状态切换监听事件
|
||||
var defineStatusChangeFunc = function (doElement, undoElement, url, callback) {
|
||||
$('.laboratory-subject-list-container').on('click', doElement, function () {
|
||||
var $doAction = $(this);
|
||||
var $undoAction = $doAction.siblings(undoElement);
|
||||
|
||||
var laboratorySubjectId = $doAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认进行该操作吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/cooperative/laboratory_subjects/' + laboratorySubjectId + url,
|
||||
method: 'POST',
|
||||
dataType: 'json',
|
||||
success: function () {
|
||||
show_success_flash();
|
||||
$doAction.hide();
|
||||
$undoAction.show();
|
||||
if (callback && typeof callback === "function") {
|
||||
callback(laboratorySubjectId, url);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 首页展示与取消首页展示
|
||||
var homepageShowCallback = function (laboratoryShixunId, url) {
|
||||
var $laboratoryShixunItem = $('.laboratory-subject-list-container').find('.laboratory-subject-item-' + laboratoryShixunId);
|
||||
|
||||
if (url === '/homepage') {
|
||||
$laboratoryShixunItem.find('.homepage-badge').show();
|
||||
} else {
|
||||
$laboratoryShixunItem.find('.homepage-badge').hide();
|
||||
}
|
||||
}
|
||||
defineStatusChangeFunc('.homepage-show-action', '.homepage-hide-action', '/homepage', homepageShowCallback);
|
||||
defineStatusChangeFunc('.homepage-hide-action', '.homepage-show-action', '/cancel_homepage', homepageShowCallback);
|
||||
}
|
||||
})
|
@ -0,0 +1,18 @@
|
||||
$(document).on('turbolinks:load', function () {
|
||||
$('.cooperative-modal-container').on('show.bs.modal', '.modal.cooperative-edit-subject-modal', function () {
|
||||
var $modal = $('.modal.cooperative-edit-subject-modal');
|
||||
var $form = $modal.find('form.cooperative-edit-subject-form');
|
||||
|
||||
$modal.on('click', '.submit-btn', function () {
|
||||
$form.find('.error').html('');
|
||||
var url = $form.attr('action');
|
||||
|
||||
$.ajax({
|
||||
method: 'PATCH',
|
||||
dataType: 'script',
|
||||
url: url,
|
||||
data: $form.serialize()
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
@ -0,0 +1,131 @@
|
||||
.college-body-container {
|
||||
padding: 20px;
|
||||
flex: 1;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: scroll;
|
||||
|
||||
& > .content {
|
||||
flex: 1;
|
||||
font-size: 14px;
|
||||
|
||||
.box {
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
/* 面包屑 */
|
||||
.breadcrumb {
|
||||
padding-left: 5px;
|
||||
font-size: 20px;
|
||||
background: unset;
|
||||
}
|
||||
|
||||
/* 内容表格 */
|
||||
table {
|
||||
table-layout: fixed;
|
||||
|
||||
td {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
tr {
|
||||
&.no-data {
|
||||
&:hover {
|
||||
color: darkgrey;
|
||||
background: unset;
|
||||
}
|
||||
|
||||
& > td {
|
||||
text-align: center;
|
||||
height: 300px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.action-container {
|
||||
& > .action {
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
.more-action-dropdown {
|
||||
.dropdown-item {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 分页 */
|
||||
.paginate-container {
|
||||
margin-top: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.paginate-total {
|
||||
margin-bottom: 10px;
|
||||
color: darkgrey;
|
||||
}
|
||||
|
||||
.pagination {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
/* 搜索表单 */
|
||||
.search-form-container {
|
||||
display: flex;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.search-form {
|
||||
flex: 1;
|
||||
|
||||
* { font-size: 14px; }
|
||||
|
||||
select, input {
|
||||
margin-right: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.global-error {
|
||||
color: grey;
|
||||
min-height: 300px;
|
||||
|
||||
&-code {
|
||||
font-size: 80px;
|
||||
}
|
||||
|
||||
&-text {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.nav-tabs {
|
||||
.nav-link {
|
||||
padding: 0.5rem 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.CodeMirror {
|
||||
border: 1px solid #ced4da;
|
||||
}
|
||||
|
||||
.batch-action-container {
|
||||
padding: 10px 20px 0;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
.partners-customers-page {
|
||||
.customer-list-body {
|
||||
min-height: 300px;
|
||||
}
|
||||
}
|
@ -0,0 +1,104 @@
|
||||
.partners-partner-manager-groups-page {
|
||||
.customer-list-form {
|
||||
padding: 10px 20px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.manager-group-item {
|
||||
margin-bottom: 20px;
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
&-left {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
&-right {
|
||||
.action {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.partner-manager {
|
||||
&-body {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
&-item {
|
||||
padding: 5px 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
position: relative;
|
||||
|
||||
.remove-partner-manager-action {
|
||||
display: none;
|
||||
position: absolute;
|
||||
z-index: 100;
|
||||
right: 10px;
|
||||
top: 0;
|
||||
font-size: 24px;
|
||||
|
||||
& > i {
|
||||
color: #dc3545;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.remove-partner-manager-action {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
&-avatar {
|
||||
cursor: pointer;
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
overflow: hidden;
|
||||
border-radius: 50%;
|
||||
position: relative;
|
||||
|
||||
& > img {
|
||||
width: 80px;
|
||||
height: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
&.add-partner-manager-item {
|
||||
.partner-manager-item-avatar {
|
||||
background: #E4E4E4;
|
||||
|
||||
&:hover {
|
||||
background: #D0D0D0;
|
||||
}
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 39px;
|
||||
left: 20px;
|
||||
width: 40px;
|
||||
height: 2px;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 20px;
|
||||
left: 39px;
|
||||
width: 2px;
|
||||
height: 40px;
|
||||
background: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
.cooperative-competition-settings-index-page {
|
||||
.competition-mode-container {
|
||||
.row {
|
||||
height: 35px;
|
||||
}
|
||||
|
||||
.des-row {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.form-control {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
//.mode-input {
|
||||
// input {
|
||||
// width: 40%;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
.col-md-label{
|
||||
-webkit-box-flex: 0;
|
||||
flex: 0 0 10%;
|
||||
max-width: 10%;
|
||||
min-width: 30px;
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
position: relative;
|
||||
}
|
||||
.col-md-label-s{
|
||||
-webkit-box-flex: 0;
|
||||
flex: 0 0 30px;
|
||||
padding-right: 15px;
|
||||
padding-left: 15px;
|
||||
position: relative;
|
||||
}
|
||||
.setBtn_s{
|
||||
height: 35px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.sponsor_label{
|
||||
border:1px solid #4CACFF;
|
||||
border-radius: 5px;
|
||||
background-color: rgba(76,172,255,0.3);
|
||||
color: #333;
|
||||
padding:0px 4px;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
float: left;
|
||||
margin: 4px 5px;
|
||||
|
||||
span{
|
||||
display: block;
|
||||
float: left;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
a{
|
||||
font-size: 18px;
|
||||
float: left;
|
||||
height: 28px;
|
||||
line-height: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
.large_panel{
|
||||
padding:0px 15px;
|
||||
|
||||
.large_panel_part{
|
||||
border-top: 1px solid #eaeaea;
|
||||
}
|
||||
.large_panel_part:first-child{
|
||||
border:none;
|
||||
}
|
||||
|
||||
.large_panel_part >.row ,.small_panel >.row{
|
||||
border-bottom: 1px solid #eaeaea;
|
||||
padding:20px 0px;
|
||||
}
|
||||
.small_panel{
|
||||
margin-left: 20px;
|
||||
}
|
||||
.row:last-child{
|
||||
border:none;
|
||||
}
|
||||
|
||||
.task_Input_div:nth-child(3n-2) > span.col-4{
|
||||
flex: 0 0 81px;
|
||||
max-width: 81px;
|
||||
}
|
||||
.task_Input_div:nth-child(3n-2){
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n-1){
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n){
|
||||
flex: 0 0 25%;
|
||||
max-width: 25%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n) > span.col-4{
|
||||
flex: 0 0 33.3%;
|
||||
max-width: 33.3%;
|
||||
}
|
||||
.task_Input_div:nth-child(3n) > div.col-6{
|
||||
flex: 0 0 50%;
|
||||
max-width: 50%;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
class Admins::CustomersController < Admins::BaseController
|
||||
helper_method :current_partner
|
||||
|
||||
def index
|
||||
default_sort('created_at', 'desc')
|
||||
|
||||
customers = Admins::CustomerQuery.call(params.merge(partner_id: current_partner.id))
|
||||
@customers = paginate(customers.preload(:school))
|
||||
end
|
||||
|
||||
def create
|
||||
params[:school_ids] = Array.wrap(params[:school_ids])
|
||||
school_ids = School.where(id: params[:school_ids]).pluck(:id)
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
school_ids.each do |school_id|
|
||||
next if current_partner.customers.exists?(school_id)
|
||||
|
||||
customer = Customer.create!(school_id: school_id)
|
||||
current_partner.partner_customers.create!(customer: customer)
|
||||
end
|
||||
end
|
||||
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
current_partner.customers.find(params[:id]).destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_partner
|
||||
@_current_partner ||= Partner.find(params[:partner_id])
|
||||
end
|
||||
end
|
@ -0,0 +1,14 @@
|
||||
class Admins::ImportCompetitionScoresController < Admins::BaseController
|
||||
def create
|
||||
return render_error('请上传正确的文件') if params[:file].blank? || !params[:file].is_a?(ActionDispatch::Http::UploadedFile)
|
||||
|
||||
result = Admins::ImportCompetitionScoreService.call(params[:file].to_io, current_competition)
|
||||
render_ok(result)
|
||||
rescue Admins::ImportCompetitionScoreService::Error => ex
|
||||
render_error(ex)
|
||||
end
|
||||
|
||||
def current_competition
|
||||
competition = Competition.find_by!(id: params[:competition_id])
|
||||
end
|
||||
end
|
@ -0,0 +1,48 @@
|
||||
class Admins::LaboratoryShixunsController < Admins::BaseController
|
||||
helper_method :current_laboratory, :current_laboratory_shixun
|
||||
|
||||
def index
|
||||
laboratory_shixuns = Admins::LaboratoryShixunQuery.call(current_laboratory, params)
|
||||
@laboratory_shixuns = paginate laboratory_shixuns.includes(shixun: %i[tag_repertoires user])
|
||||
end
|
||||
|
||||
def create
|
||||
shixun_ids = Array.wrap(params[:shixun_ids])
|
||||
shixun_ids = Shixun.where(id: shixun_ids).pluck(:id)
|
||||
exist_shixun_id = current_laboratory.laboratory_shixuns.where(shixun_id: shixun_ids).pluck(:shixun_id)
|
||||
|
||||
LaboratoryShixun.bulk_insert(*%i[shixun_id laboratory_id created_at updated_at]) do |worker|
|
||||
(shixun_ids - exist_shixun_id).each do |shixun_id|
|
||||
worker.add(shixun_id: shixun_id, laboratory_id: current_laboratory.id)
|
||||
end
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
return render_js_error('不能删除自建实训', type: :notify) if current_laboratory_shixun.ownership?
|
||||
current_laboratory_shixun.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def homepage
|
||||
current_laboratory_shixun.update!(homepage: true)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
current_laboratory_shixun.update!(homepage: false)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory
|
||||
@_current_laboratory ||= Laboratory.find(params[:laboratory_id])
|
||||
end
|
||||
|
||||
def current_laboratory_shixun
|
||||
@_current_laboratory_shixun ||= current_laboratory.laboratory_shixuns.find(params[:id])
|
||||
end
|
||||
end
|
@ -0,0 +1,45 @@
|
||||
class Admins::LaboratorySubjectsController < Admins::BaseController
|
||||
helper_method :current_laboratory, :current_laboratory_subject
|
||||
|
||||
def index
|
||||
laboratory_subjects = Admins::LaboratorySubjectQuery.call(current_laboratory, params)
|
||||
|
||||
includes_tables = { subject: [:repertoire, :subject_level_system, user: {user_extension: :school}] }
|
||||
@laboratory_subjects = paginate(laboratory_subjects.includes(includes_tables))
|
||||
end
|
||||
|
||||
def create
|
||||
subject = Subject.find(params[:subject_id])
|
||||
Subjects::CopySubjectService.call(subject, current_user, current_laboratory)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
return render_js_error('不能删除自建课程', type: :notify) if current_laboratory_subject.ownership?
|
||||
|
||||
current_laboratory_subject.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
|
||||
def homepage
|
||||
current_laboratory_subject.update!(homepage: true)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
current_laboratory_subject.update!(homepage: false)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory
|
||||
@_current_laboratory ||= Laboratory.find(params[:laboratory_id])
|
||||
end
|
||||
|
||||
def current_laboratory_subject
|
||||
@_current_laboratory_subject ||= current_laboratory.laboratory_subjects.find(params[:id])
|
||||
end
|
||||
end
|
@ -0,0 +1,29 @@
|
||||
class Admins::PartnersController < Admins::BaseController
|
||||
def index
|
||||
default_sort('created_at', 'desc')
|
||||
|
||||
partners = Admins::PartnerQuery.call(params)
|
||||
@partners = paginate(partners.preload(:school))
|
||||
end
|
||||
|
||||
def create
|
||||
params[:school_ids] = Array.wrap(params[:school_ids])
|
||||
|
||||
school_ids = School.where(id: params[:school_ids]).pluck(:id)
|
||||
exist_school_ids = Partner.where(school_id: school_ids).pluck(:school_id)
|
||||
|
||||
Partner.bulk_insert(*%i[school_id created_at updated_at]) do |worker|
|
||||
(school_ids - exist_school_ids).each do |school_id|
|
||||
worker.add(school_id: school_id)
|
||||
end
|
||||
end
|
||||
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
Partner.find(params[:id]).destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
end
|
@ -1,4 +1,6 @@
|
||||
class Competitions::CompetitionStaffsController < Competitions::BaseController
|
||||
skip_before_action :require_login
|
||||
|
||||
def show
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,51 @@
|
||||
class Cooperative::CompetitionPrizeUsersController < Cooperative::BaseController
|
||||
def index
|
||||
@competition = current_competition
|
||||
|
||||
prize_users = Admins::CompetitionPrizeUserQuery.call(params.merge(competition_id: current_competition.id))
|
||||
include_class = [:competition_team, :competition_prize, :approver,
|
||||
user: [:process_real_name_apply, :process_professional_apply, user_extension: :school]]
|
||||
@prize_users = paginate(prize_users.preload(include_class))
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
format.xlsx do
|
||||
@all_prize_users = prize_users
|
||||
filename = "#{@competition.name}竞赛获奖人信息列表_#{Time.current.strftime('%Y%m%d%H%M%S')}.xlsx"
|
||||
render xlsx: 'index', filename: filename
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
Admins::CreateCompetitionPrizeUsersService.call(current_competition)
|
||||
render_ok
|
||||
rescue ApplicationService::Error => ex
|
||||
render_error(ex.message)
|
||||
end
|
||||
|
||||
def approve
|
||||
Admins::ApproveCompetitionPrizeUserService.call(current_prize_user, current_user)
|
||||
@prize_user = current_prize_user
|
||||
rescue ApplicationService::Error => ex
|
||||
render_js_error(ex.message, type: :notify)
|
||||
end
|
||||
|
||||
def unapprove
|
||||
Admins::UnapproveCompetitionPrizeUserService.call(current_prize_user, current_user)
|
||||
@prize_user = current_prize_user
|
||||
rescue ApplicationService::Error => ex
|
||||
render_js_error(ex.message, type: :notify)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_prize_user
|
||||
@_current_prize_user ||= current_competition.competition_prize_users.find(params[:id])
|
||||
end
|
||||
|
||||
def current_competition
|
||||
@_current_competition ||= current_laboratory.competitions.find(params[:competition_id])
|
||||
end
|
||||
end
|
@ -0,0 +1,43 @@
|
||||
class Cooperative::CompetitionPrizesController < Cooperative::BaseController
|
||||
def index
|
||||
@competition = current_competition
|
||||
end
|
||||
|
||||
def new
|
||||
@prize = current_competition.competition_prizes.new
|
||||
end
|
||||
|
||||
def create
|
||||
@prize = current_competition.competition_prizes.create!(save_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def edit
|
||||
@prize = current_competition_prize
|
||||
end
|
||||
|
||||
def update
|
||||
current_competition_prize.update!(save_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def destroy
|
||||
current_competition_prize.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_competition_prize
|
||||
@_current_competition_prize ||= current_competition.competition_prizes.find(params[:id])
|
||||
end
|
||||
|
||||
def current_competition
|
||||
@_current_competition ||= current_laboratory.competitions.find(params[:competition_id])
|
||||
end
|
||||
|
||||
def save_params
|
||||
params.require(:competition_prize).permit(:name, :category, :num)
|
||||
end
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
class Cooperative::CompetitionSettingsController < Cooperative::BaseController
|
||||
def index
|
||||
@competition = current_competition
|
||||
end
|
||||
|
||||
def basic_setting
|
||||
Admins::CompetitionBasicSettingService.call(current_competition, basic_form_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def nav_setting
|
||||
Admins::CompetitionNavSettingService.call(current_competition, nav_form_params)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_competition
|
||||
@_current_competition ||= current_laboratory.competitions.find(params[:competition_id])
|
||||
end
|
||||
|
||||
def basic_form_params
|
||||
params.permit(:identifier, :name, :sub_title, :start_time, :end_time, :mode,
|
||||
:identifier, :bonus, :awards_count, :description, :course_id, :teach_start_time,
|
||||
:teach_end_time, sponsor_schools: [], region_schools: [], manager_ids: [])
|
||||
end
|
||||
|
||||
def nav_form_params
|
||||
params.permit(:enroll_end_time,
|
||||
competition_staffs: %i[category minimum maximum mutiple_limited],
|
||||
navbar: %i[module_type module_id name hidden position url])
|
||||
end
|
||||
end
|
@ -0,0 +1,57 @@
|
||||
class Cooperative::CompetitionsController < Cooperative::BaseController
|
||||
before_action :find_competition, except: [:index]
|
||||
|
||||
def index
|
||||
# params[:sort_by] = params[:sort_by].presence || 'created_at'
|
||||
# params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
@competitions = current_laboratory.competitions.order("created_at desc")
|
||||
@params_page = params[:page] || 1
|
||||
@competitions = paginate @competitions
|
||||
ids = @competitions.map(&:id)
|
||||
@member_count_map = TeamMember.where(competition_id: ids).group(:competition_id).count
|
||||
|
||||
@competition_hot = ModuleSetting.exists?(module_type: "Competition", property: "hot")
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
name = params[:competition_name].to_s.strip
|
||||
Competition.create!(name: name)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def hot_setting
|
||||
if params[:hot].to_i == 1 && !ModuleSetting.exists?(module_type: "Competition", property: "hot")
|
||||
ModuleSetting.create!(module_type: "Competition", property: "hot")
|
||||
elsif params[:hot].to_i == 0 && ModuleSetting.exists?(module_type: "Competition", property: "hot")
|
||||
ModuleSetting.where(module_type: "Competition", property: "hot").destroy_all
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
|
||||
def publish
|
||||
@competition.update_attributes!(published_at: Time.now)
|
||||
end
|
||||
|
||||
def unpublish
|
||||
@competition.update_attributes!(published_at: nil)
|
||||
end
|
||||
|
||||
def online_switch
|
||||
if @competition.status
|
||||
@competition.update_attributes!(status: false)
|
||||
else
|
||||
@competition.update_attributes!(status: true, online_time: Time.now)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def find_competition
|
||||
@competition = current_laboratory.competitions.find_by(id: params[:id])
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,33 @@
|
||||
class Cooperative::EnrollListsController < Cooperative::BaseController
|
||||
|
||||
def index
|
||||
@competition = current_competition
|
||||
default_sort('created_at', 'desc')
|
||||
enroll_lists = Admins::CompetitionEnrollListQuery.call(@competition, params)
|
||||
|
||||
@params_page = params[:page] || 1
|
||||
@enroll_lists = paginate enroll_lists.preload(competition_team: [:user, :teachers], user: { user_extension: :school })
|
||||
@personal = @competition.personal?
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
format.html
|
||||
end
|
||||
end
|
||||
|
||||
def export
|
||||
default_sort('created_at', 'desc')
|
||||
@enroll_lists = Admins::CompetitionEnrollListQuery.call(current_competition, params)
|
||||
@enroll_lists = @enroll_lists.preload(competition_team: [:user, :teachers], user: { user_extension: :school })
|
||||
@competition_scores = current_competition.competition_scores.where(competition_stage_id: 0).order("score desc, cost_time desc").pluck(:competition_team_id)
|
||||
@personal = current_competition.personal?
|
||||
filename = ["#{current_competition.name}竞赛报名列表", Time.zone.now.strftime('%Y-%m-%d%H:%M:%S')].join('-') << '.xlsx'
|
||||
render xlsx: 'export', filename: filename
|
||||
end
|
||||
|
||||
private
|
||||
def current_competition
|
||||
@_current_competition ||= current_laboratory.competitions.find(params[:competition_id])
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,46 @@
|
||||
class Cooperative::LaboratoryShixunsController < Cooperative::BaseController
|
||||
before_action :check_shixun_ownership!, only: [:edit, :update]
|
||||
|
||||
helper_method :current_laboratory_shixun
|
||||
|
||||
def index
|
||||
laboratory_shixuns = Admins::LaboratoryShixunQuery.call(current_laboratory, params)
|
||||
@laboratory_shixuns = paginate laboratory_shixuns.includes(shixun: %i[tag_repertoires user])
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
return render_js_error('不能删除自建实训', type: :notify) if current_laboratory_shixun.ownership?
|
||||
current_laboratory_shixun.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def homepage
|
||||
current_laboratory_shixun.update!(homepage: true)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
current_laboratory_shixun.update!(homepage: false)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory_shixun
|
||||
@_current_laboratory_shixun ||= current_laboratory.laboratory_shixuns.find(params[:id])
|
||||
end
|
||||
|
||||
def check_shixun_ownership!
|
||||
return if current_laboratory_shixun.ownership?
|
||||
|
||||
render_forbidden
|
||||
end
|
||||
end
|
@ -0,0 +1,53 @@
|
||||
class Cooperative::LaboratorySubjectsController < Cooperative::BaseController
|
||||
before_action :check_subject_ownership!, only: [:edit, :update]
|
||||
|
||||
helper_method :current_laboratory_subject
|
||||
|
||||
def index
|
||||
laboratory_subjects = Admins::LaboratorySubjectQuery.call(current_laboratory, params)
|
||||
|
||||
includes_tables = { subject: [:repertoire, :subject_level_system, user: {user_extension: :school}] }
|
||||
@laboratory_subjects = paginate(laboratory_subjects.includes(includes_tables))
|
||||
end
|
||||
|
||||
def edit
|
||||
@laboratory_subject = current_laboratory_subject
|
||||
end
|
||||
|
||||
def update
|
||||
current_laboratory_subject.subject.update!(update_params)
|
||||
end
|
||||
|
||||
def destroy
|
||||
return render_js_error('不能删除自建实践课程', type: :notify) if current_laboratory_subject.ownership?
|
||||
current_laboratory_subject.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def homepage
|
||||
current_laboratory_subject.update!(homepage: true)
|
||||
render_ok
|
||||
end
|
||||
|
||||
def cancel_homepage
|
||||
current_laboratory_subject.update!(homepage: false)
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_laboratory_subject
|
||||
@_current_laboratory_subject ||= current_laboratory.laboratory_subjects.find(params[:id])
|
||||
end
|
||||
|
||||
def check_subject_ownership!
|
||||
return if current_laboratory_subject.ownership?
|
||||
|
||||
render_forbidden
|
||||
end
|
||||
|
||||
def update_params
|
||||
params.require(:laboratory_subject).permit(:repertoire_id, :subject_level_system_id)
|
||||
end
|
||||
end
|
@ -0,0 +1,137 @@
|
||||
class PartnersController < ApplicationController
|
||||
include Base::PaginateHelper
|
||||
include Admins::RenderHelper
|
||||
|
||||
layout 'college'
|
||||
|
||||
before_action :require_login, :check_partner_present!, :check_permission!
|
||||
before_action :check_admin_manager_group_permission!, except: [:customers]
|
||||
|
||||
helper_method :current_partner, :manager_permission?
|
||||
|
||||
def customers
|
||||
customers = CustomerQuery.call(current_partner, current_user, params)
|
||||
@customers = paginate(customers.includes(:school))
|
||||
|
||||
load_customer_extra_statistic_data
|
||||
end
|
||||
|
||||
def partner_manager_groups
|
||||
@manager_groups = current_partner.partner_manager_groups.includes(users: :user_extension).to_a
|
||||
end
|
||||
|
||||
def manager_group
|
||||
name = params[:manager_group_name].to_s.strip
|
||||
|
||||
if params[:manager_group_id].present?
|
||||
# 重命名
|
||||
@manager_group = current_partner.partner_manager_groups.find(params[:manager_group_id])
|
||||
return render_error('不能修改管理者权限组名称') if @manager_group.admin?
|
||||
@manager_group.update!(name: name)
|
||||
else
|
||||
# 新建
|
||||
@manager_group = current_partner.partner_manager_groups.create!(name: name)
|
||||
end
|
||||
end
|
||||
|
||||
def remove_manager_group
|
||||
manager_group = current_partner.partner_manager_groups.find(params[:manager_group_id])
|
||||
return render_error('不能删除管理者权限组') if manager_group.admin?
|
||||
manager_group.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def partner_managers
|
||||
user_ids = Array.wrap(params[:user_ids])
|
||||
@manager_group = current_partner.partner_manager_groups.find(params[:manager_group_id])
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
User.where(id: user_ids).pluck(:id).each do |user_id|
|
||||
next if current_partner.partner_managers.exists?(partner_manager_group: @manager_group, user_id: user_id)
|
||||
|
||||
current_partner.partner_managers.create!(partner_manager_group: @manager_group, user_id: user_id)
|
||||
end
|
||||
end
|
||||
|
||||
@manager_group.reload
|
||||
end
|
||||
|
||||
def remove_partner_manager
|
||||
partner_manager = current_partner.partner_managers.find(params[:manager_id])
|
||||
return render_error('不能删除自己') if partner_manager.user_id == current_user.id && partner_manager.partner_manager_group.admin?
|
||||
|
||||
partner_manager.destroy!
|
||||
|
||||
render_delete_success
|
||||
end
|
||||
|
||||
def customer_manager_group
|
||||
customer = current_partner.customers.find(params[:customer_id])
|
||||
|
||||
if params[:manager_group_id].present?
|
||||
manager_group = current_partner.partner_manager_groups.find(params[:manager_group_id])
|
||||
customer.update!(partner_manager_group: manager_group)
|
||||
else
|
||||
customer.update!(partner_manager_group_id: nil)
|
||||
end
|
||||
|
||||
render_ok
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def current_partner
|
||||
@_current_partner ||= Partner.find(params[:id].presence || params[:partner_id])
|
||||
end
|
||||
|
||||
def check_partner_present!
|
||||
return if current_partner.present?
|
||||
|
||||
redirect_to '/404'
|
||||
end
|
||||
|
||||
def manager_permission?
|
||||
admin_or_business? || current_user.partner_managers.exists?(partner_id: current_partner.id)
|
||||
end
|
||||
|
||||
def check_permission!
|
||||
return if manager_permission?
|
||||
|
||||
redirect_to '/403'
|
||||
end
|
||||
|
||||
def check_admin_manager_group_permission!
|
||||
return if admin_or_business?
|
||||
return if current_partner.admin_partner_manager_group.partner_managers.exists?(user: current_user)
|
||||
|
||||
render_forbidden
|
||||
end
|
||||
|
||||
def load_customer_extra_statistic_data
|
||||
school_ids = @customers.map(&:school_id)
|
||||
|
||||
teacher_map = UserExtension.where(school_id: school_ids, identity: 0).group(:school_id).count
|
||||
student_map = UserExtension.where(school_id: school_ids, identity: 1).group(:school_id).count
|
||||
course_map = Course.where(school_id: school_ids, is_delete: 0).where.not(id: 1309).group(:school_id).count
|
||||
shixun_map = Shixun.visible.joins('left join user_extensions on user_extensions.user_id = shixuns.user_id')
|
||||
.where(user_extensions: { school_id: school_ids }).group('user_extensions.school_id').count
|
||||
shixun_report_map = StudentWork.where(work_status: [1, 2]).where('myshixun_id != 0')
|
||||
.joins('left join user_extensions on user_extensions.user_id = student_works.user_id')
|
||||
.where(user_extensions: { school_id: school_ids })
|
||||
.group('user_extensions.school_id').count
|
||||
course_time_map = Course.where(school_id: school_ids, is_delete: 0)
|
||||
.where.not(id: 1309).group(:school_id).maximum(:updated_at)
|
||||
|
||||
@customers.each do |customer|
|
||||
customer._extra_data = {
|
||||
teacher_count: teacher_map[customer.school_id],
|
||||
student_count: student_map[customer.school_id],
|
||||
course_count: course_map[customer.school_id],
|
||||
shixun_count: shixun_map[customer.school_id],
|
||||
shixun_report_count: shixun_report_map[customer.school_id],
|
||||
course_time: course_time_map[customer.school_id]
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,27 @@
|
||||
class UsersForPartnersController < ApplicationController
|
||||
include Base::PaginateHelper
|
||||
|
||||
before_action :check_partner_manager_permission!
|
||||
|
||||
def index
|
||||
params[:sort_by] = params[:sort_by].presence || 'created_on'
|
||||
params[:sort_direction] = params[:sort_direction].presence || 'desc'
|
||||
|
||||
users = Admins::UserQuery.call(search_params)
|
||||
@users = paginate users.includes(user_extension: :school)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def search_params
|
||||
params.permit(:name, :sort_by, :sort_direction)
|
||||
end
|
||||
|
||||
def check_partner_manager_permission!
|
||||
partner = Partner.find(params[:partner_id])
|
||||
return if admin_or_business?
|
||||
return if partner.admin_partner_manager_group.partner_managers.exists?(user: current_user)
|
||||
|
||||
render_forbidden
|
||||
end
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue