shoplazza-cli 1.1.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/LICENSE +21 -0
- package/README.md +206 -332
- package/README.zh.md +318 -0
- package/package.json +24 -70
- package/scripts/install.js +144 -0
- package/scripts/jsbuild/dev/index.js +123 -0
- package/scripts/jsbuild/index.js +77 -0
- package/{lib/checkout/build → scripts/jsbuild}/plugin/vite-plugin-add-extension-id.js +4 -2
- package/scripts/jsbuild/vite.config.js +35 -0
- package/scripts/run.js +29 -0
- package/.editorconfig +0 -28
- package/.prettierrc +0 -9
- package/bin/shoplazza +0 -137
- package/fixtures/assets/blog.scss +0 -74
- package/fixtures/assets/cart_modal.scss +0 -450
- package/fixtures/assets/collection_detail.js +0 -234
- package/fixtures/assets/collection_detail.scss +0 -345
- package/fixtures/assets/collection_list.scss +0 -11
- package/fixtures/assets/collection_slider.scss +0 -169
- package/fixtures/assets/feature_columns.scss +0 -26
- package/fixtures/assets/feature_product.scss +0 -109
- package/fixtures/assets/footer.js +0 -58
- package/fixtures/assets/footer.scss +0 -337
- package/fixtures/assets/four_images.scss +0 -29
- package/fixtures/assets/gallery.scss +0 -55
- package/fixtures/assets/header.js +0 -178
- package/fixtures/assets/header.scss +0 -929
- package/fixtures/assets/image_text.scss +0 -72
- package/fixtures/assets/logo_bar.scss +0 -11
- package/fixtures/assets/newsletter.scss +0 -90
- package/fixtures/assets/not_found.scss +0 -39
- package/fixtures/assets/page_detail.scss +0 -16
- package/fixtures/assets/pagination.scss +0 -150
- package/fixtures/assets/postcss.config.js +0 -6
- package/fixtures/assets/product_description.scss +0 -88
- package/fixtures/assets/product_detail.js +0 -634
- package/fixtures/assets/product_detail.scss +0 -1106
- package/fixtures/assets/relative_product.scss +0 -45
- package/fixtures/assets/reviews.scss +0 -70
- package/fixtures/assets/rich_text.scss +0 -71
- package/fixtures/assets/search.js +0 -87
- package/fixtures/assets/search.scss +0 -67
- package/fixtures/assets/slide.scss +0 -51
- package/fixtures/assets/slider.scss +0 -141
- package/fixtures/assets/test.scss +0 -1
- package/fixtures/assets/theme.css +0 -976
- package/fixtures/assets/theme.scss +0 -1100
- package/fixtures/assets/three_images.scss +0 -20
- package/fixtures/assets/tools.scss +0 -23
- package/fixtures/assets/two_images.scss +0 -24
- package/fixtures/assets/video.scss +0 -45
- package/fixtures/assets/video_text.scss +0 -63
- package/fixtures/config/settings_data.json +0 -107
- package/fixtures/config/settings_schema.json +0 -690
- package/fixtures/layout/theme.liquid +0 -76
- package/fixtures/locales/ar-SA.json +0 -212
- package/fixtures/locales/de-DE.json +0 -290
- package/fixtures/locales/en-US.json +0 -290
- package/fixtures/locales/es-ES.json +0 -290
- package/fixtures/locales/fr-FR.json +0 -290
- package/fixtures/locales/id-ID.json +0 -212
- package/fixtures/locales/it-IT.json +0 -212
- package/fixtures/locales/ja-JP.json +0 -289
- package/fixtures/locales/ko-KR.json +0 -290
- package/fixtures/locales/nl-NL.json +0 -290
- package/fixtures/locales/pl-PL.json +0 -290
- package/fixtures/locales/pt-PT.json +0 -212
- package/fixtures/locales/ru-RU.json +0 -212
- package/fixtures/locales/th-TH.json +0 -212
- package/fixtures/locales/zh-CN.json +0 -290
- package/fixtures/locales/zh-TW.json +0 -290
- package/fixtures/sections/apps.liquid +0 -47
- package/fixtures/sections/blog.liquid +0 -137
- package/fixtures/sections/collection_desc.liquid +0 -34
- package/fixtures/sections/collection_detail.liquid +0 -436
- package/fixtures/sections/collection_image.liquid +0 -104
- package/fixtures/sections/collection_list.liquid +0 -161
- package/fixtures/sections/collection_name.liquid +0 -34
- package/fixtures/sections/collection_slider.liquid +0 -330
- package/fixtures/sections/feature_columns.liquid +0 -275
- package/fixtures/sections/feature_product.liquid +0 -227
- package/fixtures/sections/footer.liquid +0 -488
- package/fixtures/sections/four_images.liquid +0 -160
- package/fixtures/sections/gallery.liquid +0 -258
- package/fixtures/sections/header.liquid +0 -1157
- package/fixtures/sections/html.liquid +0 -40
- package/fixtures/sections/image_text.liquid +0 -350
- package/fixtures/sections/instagram_plus.liquid +0 -393
- package/fixtures/sections/logo_bar.liquid +0 -183
- package/fixtures/sections/newsletter.liquid +0 -225
- package/fixtures/sections/not_found.liquid +0 -39
- package/fixtures/sections/overlay_image.liquid +0 -648
- package/fixtures/sections/page_detail.liquid +0 -39
- package/fixtures/sections/photo_collection.liquid +0 -433
- package/fixtures/sections/product_description.liquid +0 -208
- package/fixtures/sections/product_detail.liquid +0 -611
- package/fixtures/sections/products.liquid +0 -216
- package/fixtures/sections/relative_product.liquid +0 -121
- package/fixtures/sections/reviews.liquid +0 -115
- package/fixtures/sections/rich_text.liquid +0 -157
- package/fixtures/sections/search.liquid +0 -163
- package/fixtures/sections/slide.liquid +0 -719
- package/fixtures/sections/three_images.liquid +0 -157
- package/fixtures/sections/two_images.liquid +0 -125
- package/fixtures/sections/video.liquid +0 -95
- package/fixtures/sections/video_text.liquid +0 -128
- package/fixtures/snippets/bgset.liquid +0 -21
- package/fixtures/snippets/card_title.liquid +0 -8
- package/fixtures/snippets/cart_modal.liquid +0 -74
- package/fixtures/snippets/collection.liquid +0 -77
- package/fixtures/snippets/collection_filter_modal.liquid +0 -56
- package/fixtures/snippets/default_image_4.liquid +0 -14
- package/fixtures/snippets/default_image_6.liquid +0 -18
- package/fixtures/snippets/default_image_8.liquid +0 -23
- package/fixtures/snippets/four_images_item.liquid +0 -8
- package/fixtures/snippets/header_ads.liquid +0 -95
- package/fixtures/snippets/hero_image.liquid +0 -94
- package/fixtures/snippets/icon_video_play_large.liquid +0 -1
- package/fixtures/snippets/icon_video_play_medium.liquid +0 -4
- package/fixtures/snippets/icon_video_play_small.liquid +0 -4
- package/fixtures/snippets/lazyimg.liquid +0 -22
- package/fixtures/snippets/lazyimg_art.liquid +0 -36
- package/fixtures/snippets/lazysizes.liquid +0 -41
- package/fixtures/snippets/link.liquid +0 -2
- package/fixtures/snippets/pagination.liquid +0 -48
- package/fixtures/snippets/product.liquid +0 -126
- package/fixtures/snippets/product_art_tpl.liquid +0 -152
- package/fixtures/snippets/product_info_body.liquid +0 -337
- package/fixtures/snippets/product_info_tpl.liquid +0 -423
- package/fixtures/snippets/product_label.liquid +0 -46
- package/fixtures/snippets/settings.liquid +0 -295
- package/fixtures/snippets/social-meta-tags.liquid +0 -106
- package/fixtures/snippets/video_html.liquid +0 -11
- package/fixtures/snippets/video_source.liquid +0 -98
- package/fixtures/snippets/video_thumb_icon.liquid +0 -2
- package/fixtures/templates/404.liquid +0 -1
- package/fixtures/templates/collection.liquid +0 -92
- package/fixtures/templates/index.liquid +0 -206
- package/fixtures/templates/page.liquid +0 -1
- package/fixtures/templates/product.liquid +0 -99
- package/fixtures/templates/search.liquid +0 -1
- package/jest.config.js +0 -192
- package/lib/__tests__/log.test.js +0 -15
- package/lib/__tests__/utils.test.js +0 -69
- package/lib/app/api/cli.js +0 -225
- package/lib/app/api/openapi.js +0 -121
- package/lib/app/api/partnerOpenapi.js +0 -104
- package/lib/app/bin/index.js +0 -20
- package/lib/app/bin/javy/javy-arm-linux-v5.0.1 +0 -0
- package/lib/app/bin/javy/javy-arm-macos-v5.0.1 +0 -0
- package/lib/app/bin/javy/javy-x86_64-linux-v5.0.1 +0 -0
- package/lib/app/bin/javy/javy-x86_64-macos-v5.0.1 +0 -0
- package/lib/app/bin/javy/javy-x86_64-windows-v5.0.1 +0 -0
- package/lib/app/commands/config/actions/link.js +0 -189
- package/lib/app/commands/config/actions/use.js +0 -40
- package/lib/app/commands/config/index.js +0 -25
- package/lib/app/commands/config/link.js +0 -11
- package/lib/app/commands/config/use.js +0 -11
- package/lib/app/commands/deploy/actions/deploy.js +0 -196
- package/lib/app/commands/deploy/index.js +0 -11
- package/lib/app/commands/dev/actions/dev.js +0 -206
- package/lib/app/commands/dev/index.js +0 -11
- package/lib/app/commands/generate/actions/extension.js +0 -97
- package/lib/app/commands/generate/actions/generateCheckout.js +0 -58
- package/lib/app/commands/generate/actions/generateFunction.js +0 -56
- package/lib/app/commands/generate/actions/generateTheme.js +0 -128
- package/lib/app/commands/generate/extension.js +0 -11
- package/lib/app/commands/generate/index.js +0 -22
- package/lib/app/commands/index.js +0 -82
- package/lib/app/commands/info/actions/info.js +0 -168
- package/lib/app/commands/info/index.js +0 -11
- package/lib/app/commands/init/actions/init.js +0 -176
- package/lib/app/commands/init/index.js +0 -14
- package/lib/app/commands/versions/actions/list.js +0 -210
- package/lib/app/commands/versions/index.js +0 -22
- package/lib/app/commands/versions/list.js +0 -14
- package/lib/app/constant/code.js +0 -7
- package/lib/app/constant/color.js +0 -18
- package/lib/app/constant/extension.js +0 -16
- package/lib/app/constant/host.js +0 -23
- package/lib/app/constant/sso.js +0 -7
- package/lib/app/index.js +0 -8
- package/lib/app/services/auth/config.js +0 -33
- package/lib/app/services/auth/index.js +0 -9
- package/lib/app/services/auth/oauth-server.js +0 -70
- package/lib/app/services/auth/partner-token.js +0 -45
- package/lib/app/services/auth/sso-token.js +0 -69
- package/lib/app/services/auth/store-token.js +0 -100
- package/lib/app/services/auth/url-builder.js +0 -23
- package/lib/app/services/config/index.js +0 -41
- package/lib/app/services/devServer/app.js +0 -76
- package/lib/app/services/devServer/index.js +0 -103
- package/lib/app/services/devServer/middleware/hmacValidatorMiddleWare.js +0 -20
- package/lib/app/services/devServer/middleware/index.js +0 -5
- package/lib/app/services/devServer/tunnel/index.js +0 -43
- package/lib/app/services/devServer/tunnel/providers/cloudflare.js +0 -364
- package/lib/app/services/devServer/tunnel/providers/ngrok.js +0 -70
- package/lib/app/services/devServer/utils/index.js +0 -5
- package/lib/app/services/devServer/utils/secureCompare.js +0 -5
- package/lib/app/services/devServer/views/app.ejs +0 -133
- package/lib/app/services/extension-build/buildCheckout.js +0 -47
- package/lib/app/services/extension-build/buildFunction.js +0 -57
- package/lib/app/services/extension-build/buildTheme.js +0 -100
- package/lib/app/services/extension-build/index.js +0 -23
- package/lib/app/services/extension-build/plugins/vite-plugin-add-extension-id.js +0 -26
- package/lib/app/services/extension-diff/index.js +0 -132
- package/lib/app/services/extension-upsert/index.js +0 -21
- package/lib/app/services/extension-upsert/upsertCheckout.js +0 -44
- package/lib/app/services/extension-upsert/upsertFunction.js +0 -52
- package/lib/app/services/extension-upsert/upsertTheme.js +0 -113
- package/lib/app/services/oss/index.js +0 -45
- package/lib/app/services/partner/index.js +0 -52
- package/lib/app/store/base-store.js +0 -37
- package/lib/app/store/config-store.js +0 -55
- package/lib/app/store/config.js +0 -21
- package/lib/app/store/index.js +0 -14
- package/lib/app/store/install-store.js +0 -41
- package/lib/app/store/sso-store.js +0 -55
- package/lib/app/utils/asyncPool.js +0 -42
- package/lib/app/utils/debug/index.js +0 -16
- package/lib/app/utils/env.js +0 -24
- package/lib/app/utils/error.js +0 -20
- package/lib/app/utils/git.js +0 -20
- package/lib/app/utils/json.js +0 -27
- package/lib/app/utils/path.js +0 -33
- package/lib/app/utils/platform.js +0 -37
- package/lib/app/utils/request/cli.js +0 -72
- package/lib/app/utils/request/debug.js +0 -13
- package/lib/app/utils/request/openapi.js +0 -67
- package/lib/app/utils/request/partnerOpenapi.js +0 -47
- package/lib/app/utils/toml.js +0 -56
- package/lib/app/utils/views/message.js +0 -68
- package/lib/app/utils/views/select.js +0 -36
- package/lib/app/utils/withTempDir.js +0 -55
- package/lib/auth/__mocks__/getCode.js +0 -7
- package/lib/auth/__mocks__/index.js +0 -0
- package/lib/auth/child.js +0 -23
- package/lib/auth/getCode.js +0 -39
- package/lib/auth/index.js +0 -134
- package/lib/check.js +0 -28
- package/lib/checkout/api.js +0 -164
- package/lib/checkout/build/plugin/vite-plugin-transform-extension-html.js +0 -207
- package/lib/checkout/build/vite.config.js +0 -34
- package/lib/checkout/build.js +0 -38
- package/lib/checkout/config.js +0 -97
- package/lib/checkout/create.js +0 -132
- package/lib/checkout/delete.js +0 -26
- package/lib/checkout/deploy.js +0 -59
- package/lib/checkout/dev/index.js +0 -143
- package/lib/checkout/fields.js +0 -29
- package/lib/checkout/index.js +0 -63
- package/lib/checkout/preview.js +0 -52
- package/lib/checkout/pull.js +0 -22
- package/lib/checkout/push.js +0 -141
- package/lib/checkout/template/README.md +0 -34
- package/lib/checkout/template/_gitignore +0 -4
- package/lib/checkout/template/extension.config.js +0 -4
- package/lib/checkout/template/extensions/extension-template/extension.json +0 -10
- package/lib/checkout/template/extensions/extension-template/src/content.html +0 -3
- package/lib/checkout/template/extensions/extension-template/src/index.html +0 -5
- package/lib/checkout/template/extensions/extension-template/src/index.js +0 -11
- package/lib/checkout/template/extensions/extension-template/src/script.html +0 -3
- package/lib/checkout/template/extensions/extension-template/src/style.html +0 -3
- package/lib/checkout/template/package.json +0 -17
- package/lib/checkout/undeploy.js +0 -40
- package/lib/checkout/util.js +0 -201
- package/lib/checkout/verify.js +0 -16
- package/lib/checkout/version.js +0 -7
- package/lib/commands/__tests__/login.test.js +0 -77
- package/lib/commands/__tests__/logout.test.js +0 -29
- package/lib/commands/__tests__/store.test.js +0 -44
- package/lib/commands/__tests__/switch.test.js +0 -45
- package/lib/commands/login.js +0 -120
- package/lib/commands/logout.js +0 -23
- package/lib/commands/store.js +0 -14
- package/lib/commands/switch.js +0 -52
- package/lib/commands/theme/__tests__/delete.test.js +0 -49
- package/lib/commands/theme/__tests__/init.test.js +0 -21
- package/lib/commands/theme/__tests__/list.test.js +0 -80
- package/lib/commands/theme/__tests__/package.test.js +0 -17
- package/lib/commands/theme/__tests__/publish.test.js +0 -61
- package/lib/commands/theme/__tests__/pull.test.js +0 -69
- package/lib/commands/theme/__tests__/push.test.js +0 -63
- package/lib/commands/theme/__tests__/serve.test.js +0 -107
- package/lib/commands/theme/delete.js +0 -64
- package/lib/commands/theme/init.js +0 -51
- package/lib/commands/theme/list.js +0 -28
- package/lib/commands/theme/package.js +0 -37
- package/lib/commands/theme/publish.js +0 -56
- package/lib/commands/theme/pull.js +0 -62
- package/lib/commands/theme/push.js +0 -106
- package/lib/commands/theme/serve.js +0 -153
- package/lib/commands/theme/share.js +0 -20
- package/lib/commands/version.js +0 -6
- package/lib/common/constants.js +0 -24
- package/lib/common/db/partner.js +0 -91
- package/lib/common/inquirers/choose-app.js +0 -79
- package/lib/common/inquirers/choose-partner.js +0 -74
- package/lib/common/log.js +0 -15
- package/lib/common/login.js +0 -125
- package/lib/common/logout.js +0 -16
- package/lib/db/__mocks__/index.js +0 -9
- package/lib/db/__tests__/analytics.test.js +0 -19
- package/lib/db/__tests__/user.test.js +0 -20
- package/lib/db/analytics.js +0 -48
- package/lib/db/index.js +0 -9
- package/lib/db/user.js +0 -71
- package/lib/function/bin/index.js +0 -20
- package/lib/function/bin/javy/javy-arm-linux-v5.0.1 +0 -0
- package/lib/function/bin/javy/javy-arm-macos-v5.0.1 +0 -0
- package/lib/function/bin/javy/javy-x86_64-linux-v5.0.1 +0 -0
- package/lib/function/bin/javy/javy-x86_64-macos-v5.0.1 +0 -0
- package/lib/function/bin/javy/javy-x86_64-windows-v5.0.1 +0 -0
- package/lib/function/commands/compile.js +0 -43
- package/lib/function/commands/create.js +0 -77
- package/lib/function/commands/list.js +0 -18
- package/lib/function/commands/release.js +0 -69
- package/lib/function/index.js +0 -24
- package/lib/function/template/js/README.md +0 -37
- package/lib/function/template/js/_gitignore +0 -4
- package/lib/function/template/js/extension.config.json +0 -5
- package/lib/function/template/js/package.json +0 -17
- package/lib/function/template/js/src/index.js +0 -64
- package/lib/function/utils.js +0 -29
- package/lib/log.js +0 -13
- package/lib/openAPI/__mocks__/index.js +0 -20
- package/lib/openAPI/api.js +0 -76
- package/lib/openAPI/index.js +0 -56
- package/lib/oss.js +0 -102
- package/lib/partner-api/axios.js +0 -67
- package/lib/partner-api/index.js +0 -79
- package/lib/report.js +0 -37
- package/lib/theme-extension/api/index.js +0 -96
- package/lib/theme-extension/commands/build.js +0 -114
- package/lib/theme-extension/commands/connect.js +0 -73
- package/lib/theme-extension/commands/create.js +0 -105
- package/lib/theme-extension/commands/deploy.js +0 -56
- package/lib/theme-extension/commands/list.js +0 -35
- package/lib/theme-extension/commands/release.js +0 -59
- package/lib/theme-extension/commands/serve.js +0 -179
- package/lib/theme-extension/commands/versions.js +0 -55
- package/lib/theme-extension/index.js +0 -29
- package/lib/theme-extension/template/basic-app/README.md +0 -125
- package/lib/theme-extension/template/basic-app/extension.config.json +0 -4
- package/lib/theme-extension/template/basic-app/package.json +0 -18
- package/lib/theme-extension/template/basic-app/theme-app/assets/index.css +0 -4
- package/lib/theme-extension/template/basic-app/theme-app/assets-manifest.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/blocks/index.liquid +0 -16
- package/lib/theme-extension/template/basic-app/theme-app/locales/ar-SA.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/de-DE.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/en-US.json +0 -6
- package/lib/theme-extension/template/basic-app/theme-app/locales/es-ES.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/fr-FR.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/id-ID.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/it-IT.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/ja-JP.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/ko-KR.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/nl-NL.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/pl-PL.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/pt-PT.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/ru-RU.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/th-TH.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/locales/zh-CN.json +0 -6
- package/lib/theme-extension/template/basic-app/theme-app/locales/zh-TW.json +0 -1
- package/lib/theme-extension/template/basic-app/theme-app/snippets/index.liquid +0 -8
- package/lib/theme-extension/template/embed-app/README.md +0 -125
- package/lib/theme-extension/template/embed-app/extension.config.json +0 -4
- package/lib/theme-extension/template/embed-app/package.json +0 -18
- package/lib/theme-extension/template/embed-app/theme-app/assets-manifest.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/blocks/index.liquid +0 -18
- package/lib/theme-extension/template/embed-app/theme-app/locales/ar-SA.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/de-DE.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/en-US.json +0 -6
- package/lib/theme-extension/template/embed-app/theme-app/locales/es-ES.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/fr-FR.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/id-ID.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/it-IT.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/ja-JP.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/ko-KR.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/nl-NL.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/pl-PL.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/pt-PT.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/ru-RU.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/th-TH.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/locales/zh-CN.json +0 -6
- package/lib/theme-extension/template/embed-app/theme-app/locales/zh-TW.json +0 -1
- package/lib/theme-extension/template/embed-app/theme-app/snippets/index.liquid +0 -8
- package/lib/theme-extension/template/embed-app/theme-app/snippets/index_css.liquid +0 -6
- package/lib/theme-extension/utils/config.js +0 -32
- package/lib/theme-extension/utils/index.js +0 -213
- package/lib/tracing.js +0 -50
- package/lib/utils/config.js +0 -12
- package/lib/utils/console.js +0 -33
- package/lib/utils/env.js +0 -17
- package/lib/utils/file.js +0 -48
- package/lib/utils/platform.js +0 -37
- package/lib/utils/utils.js +0 -165
- /package/{lib/checkout → scripts/jsbuild}/dev/client.js +0 -0
- /package/{lib/app/services/extension-build/plugins → scripts/jsbuild/plugin}/vite-plugin-transform-extension-html.js +0 -0
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
@import './tools.scss';
|
|
2
|
-
|
|
3
|
-
#atc_container .container{
|
|
4
|
-
padding: 15px !important;
|
|
5
|
-
max-width: unset !important;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
#atc_container .cart__recommended,
|
|
9
|
-
#atc_container .mobile-recommended,
|
|
10
|
-
#atc_container .cart__discount-container,
|
|
11
|
-
#atc_container .cart__compare-at-price,
|
|
12
|
-
#atc_container .cart__remove,
|
|
13
|
-
#atc_container .free-gift .sep-font-angle-down-fill,
|
|
14
|
-
#atc_container .cart__total-price-wrapper .cart__original-price {
|
|
15
|
-
display: none;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
#atc_container .cart__total-price-wrapper .cart__sub-total {
|
|
19
|
-
font-size: 17px;
|
|
20
|
-
font-weight: 500;
|
|
21
|
-
color: #000000;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
#atc_container .cart__total-price-wrapper_last {
|
|
25
|
-
margin-bottom: 16px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
#atc_container .cart__total-price-wrapper .cart__total-price {
|
|
29
|
-
font-size: 18px;
|
|
30
|
-
font-weight: 500 !important;
|
|
31
|
-
color: #9b3c44;
|
|
32
|
-
line-height: 20px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
#atc_container .cart__detail .cart__discount {
|
|
36
|
-
font-size: 14px;
|
|
37
|
-
font-weight: 400;
|
|
38
|
-
line-height: 17px;
|
|
39
|
-
color: #9b3c44;
|
|
40
|
-
margin-top: 2px;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
#atc_container #cart_form {
|
|
44
|
-
margin-bottom: 17px;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
#atc_container .currency__cart-tip>div:nth-child(1) {
|
|
48
|
-
padding-left: 32px;
|
|
49
|
-
font-style: italic;
|
|
50
|
-
font-size: 14px;
|
|
51
|
-
color: #999999;
|
|
52
|
-
justify-content: flex-end !important;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
#atc_container .currency__cart-tip>div:nth-child(2) {
|
|
56
|
-
font-style: italic;
|
|
57
|
-
font-size: 14px;
|
|
58
|
-
color: #999999;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
#atc_container .currency__cart-tip>div:nth-child(1)>span:nth-child(1) {
|
|
62
|
-
display: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
#atc_container .currency__cart-tip_exchange {
|
|
66
|
-
height: auto;
|
|
67
|
-
background: #f3f3f3;
|
|
68
|
-
font-size: 14px !important;
|
|
69
|
-
font-weight: 400;
|
|
70
|
-
color: #383838 !important;
|
|
71
|
-
line-height: 18px;
|
|
72
|
-
text-align: left !important;
|
|
73
|
-
padding: 10px !important;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
#atc_container .cart__checkbox {
|
|
77
|
-
border-radius: 50%;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
#atc_container .cart__checkbox>svg {
|
|
81
|
-
border-radius: 50%;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
#atc_container .pp_container .paypal-express-button-container {
|
|
85
|
-
margin-top: 16px;
|
|
86
|
-
width: auto;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.modal-backdrop.show {
|
|
90
|
-
opacity: .6;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
#atc-modal {
|
|
94
|
-
z-index: 1051;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
#atc-modal .modal-body {
|
|
98
|
-
height: 100vh;
|
|
99
|
-
overflow: auto;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
#atc_container .cart {
|
|
103
|
-
padding-bottom: 0;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
#atc_container .cart__title {
|
|
107
|
-
font-size: 24px;
|
|
108
|
-
padding: 0;
|
|
109
|
-
padding-bottom: 20px;
|
|
110
|
-
font-weight: 500 !important;
|
|
111
|
-
text-align: left !important;
|
|
112
|
-
letter-spacing: 0;
|
|
113
|
-
color: #000;
|
|
114
|
-
border-bottom: 1px solid #e3e3e3;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
#atc_container .cart__checkbox {
|
|
118
|
-
margin: auto 15px auto 0 !important;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
#atc_container .cart__header {
|
|
122
|
-
display: none;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
#atc_container .cart__item .cart__checkbox {
|
|
126
|
-
margin: 0 15px 0 0;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
#atc_container .cart__img {
|
|
131
|
-
background-position-x: center;
|
|
132
|
-
width: 5.625rem;
|
|
133
|
-
height: 6.875rem;
|
|
134
|
-
margin-right: 0;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
#atc_container .cart__detail {
|
|
138
|
-
flex-direction: column;
|
|
139
|
-
position: relative;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
#atc_container .cart__detail>div {
|
|
143
|
-
width: auto;
|
|
144
|
-
margin: 0 0px 0 20px;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
#atc_container .cart__content .product_title {
|
|
148
|
-
-webkit-line-clamp: 2;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
#atc_container .cart__remove {
|
|
152
|
-
position: absolute;
|
|
153
|
-
right: -17px;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
#atc_container .cart__total {
|
|
157
|
-
display: none;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
#atc_container .cart__qty {
|
|
161
|
-
position: absolute;
|
|
162
|
-
bottom: 0;
|
|
163
|
-
left: 20px;
|
|
164
|
-
margin: 14px 0 0 0 !important;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
#atc_container .cart__content .spec p {
|
|
168
|
-
margin-top: .3125rem;
|
|
169
|
-
margin-bottom: 0;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
#atc_container .cart__counter,
|
|
173
|
-
#atc_container .cart__qty-input {
|
|
174
|
-
width: 24px;
|
|
175
|
-
height: 24px;
|
|
176
|
-
line-height: 22px;
|
|
177
|
-
font-size: 12px;
|
|
178
|
-
top: 0;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
#atc_container .cart__price {
|
|
182
|
-
text-align: right;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
#atc_container .cart__content {
|
|
186
|
-
margin-bottom: 14px !important;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
#atc_container .cart__checkout_wrapper {
|
|
190
|
-
width: 100%;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
#atc_container .cart__sub-total {
|
|
194
|
-
color: #000000;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/* }
|
|
198
|
-
|
|
199
|
-
@media (max-width: 767.98px) { */
|
|
200
|
-
#atc-modal .modal-dialog {
|
|
201
|
-
box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.12);
|
|
202
|
-
margin: 0;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
#atc-modal .modal__close.close {
|
|
206
|
-
font-size: 0.75rem;
|
|
207
|
-
top: 0.625rem;
|
|
208
|
-
right: 1rem;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/* } */
|
|
212
|
-
|
|
213
|
-
#atc_container .product-atc-title {
|
|
214
|
-
color: #000000;
|
|
215
|
-
font-weight: 700;
|
|
216
|
-
font-size: 16px;
|
|
217
|
-
margin-bottom: 15px;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.atc-modal {
|
|
221
|
-
display: flex;
|
|
222
|
-
flex-wrap: nowrap;
|
|
223
|
-
align-items: center;
|
|
224
|
-
overflow: hidden;
|
|
225
|
-
padding-bottom: 20px;
|
|
226
|
-
margin-bottom: 20px;
|
|
227
|
-
border-bottom: 1px solid #E5E5E5;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.atc-modal .atc-image {
|
|
231
|
-
width: 100px;
|
|
232
|
-
flex: 0 0 auto;
|
|
233
|
-
padding: 0 0.625rem 0 0;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
.atc-modal .atc-image img {
|
|
237
|
-
width: 100%;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
.atc-modal .atc-info {
|
|
241
|
-
text-align: center;
|
|
242
|
-
width: calc(100% - 110px);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
.atc-modal .atc-info__title {
|
|
246
|
-
font-size: 0.875rem;
|
|
247
|
-
font-weight: bold;
|
|
248
|
-
color: #212121;
|
|
249
|
-
margin-bottom: 0.375rem;
|
|
250
|
-
text-align: left;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.atc-modal .atc-info__subtitle {
|
|
254
|
-
font-size: 0.875rem;
|
|
255
|
-
color: #212121;
|
|
256
|
-
margin-bottom: 0.25rem;
|
|
257
|
-
text-align: left;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
#atc_container .product-atc-btn {
|
|
261
|
-
display: flex;
|
|
262
|
-
align-items: center;
|
|
263
|
-
flex-direction: column;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
#atc_container .product-atc-btn .atc-btn__link {
|
|
267
|
-
color: #202020;
|
|
268
|
-
font-size: 16px;
|
|
269
|
-
text-decoration: underline;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
#atc_container .product-atc-btn .atc-btn__button {
|
|
273
|
-
width: 100%;
|
|
274
|
-
height: 3.125rem;
|
|
275
|
-
order: 0;
|
|
276
|
-
margin-bottom: 1.25rem;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
#atc_container .cart__detail .cart__now-price {
|
|
280
|
-
margin: 0;
|
|
281
|
-
font-size: 18px;
|
|
282
|
-
font-weight: 400;
|
|
283
|
-
color: #9b3c44;
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
#atc-modal .text_toggle {
|
|
287
|
-
-webkit-line-clamp: 2;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
@media ($pc) {
|
|
291
|
-
#atc-modal .modal-dialog {
|
|
292
|
-
width: 400px;
|
|
293
|
-
margin: 0;
|
|
294
|
-
position: fixed;
|
|
295
|
-
box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.12);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
#atc_container .cart__checkbox_total {
|
|
299
|
-
display: block !important;
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
#atc_container .cart_modal_icon_hide {
|
|
303
|
-
display: none !important;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
html[dir='rtl'] #atc_container .cart__img {
|
|
307
|
-
margin: 0 15px 0 20px;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
html[dir='rtl'] #atc_container .cart__checkbox {
|
|
311
|
-
margin: auto 0 !important;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
.right {
|
|
315
|
-
right: 0;
|
|
316
|
-
width: 400px;
|
|
317
|
-
left: auto;
|
|
318
|
-
transition: right .15s linear;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
.right:not(.show) {
|
|
322
|
-
right: 0px;
|
|
323
|
-
left: auto;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
html[dir='rtl'] .right {
|
|
327
|
-
left: 0;
|
|
328
|
-
width: 400px;
|
|
329
|
-
right: auto;
|
|
330
|
-
transition: left .15s linear;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
html[dir='rtl'] .right:not(.show) {
|
|
334
|
-
left: 0;
|
|
335
|
-
right: auto;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
@media ($mobile) {
|
|
340
|
-
.right {
|
|
341
|
-
right: 0;
|
|
342
|
-
width: 325px;
|
|
343
|
-
left: auto;
|
|
344
|
-
transition: right .15s linear;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
.right:not(.show) {
|
|
348
|
-
right: 0px;
|
|
349
|
-
left: auto;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
html[dir='rtl'] .right {
|
|
353
|
-
left: 0;
|
|
354
|
-
width: 325px;
|
|
355
|
-
right: auto;
|
|
356
|
-
transition: left .15s linear;
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
html[dir='rtl'] .right:not(.show) {
|
|
360
|
-
left: 0;
|
|
361
|
-
right: auto;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
html[dir='rtl'] #atc_container .cart__checkbox {
|
|
365
|
-
margin: auto 0px auto 15px !important;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
#atc-modal .modal-dialog {
|
|
369
|
-
width: 325px;
|
|
370
|
-
margin: 0;
|
|
371
|
-
position: fixed;
|
|
372
|
-
box-shadow: 0px 8px 32px 0px rgba(0, 0, 0, 0.12);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
#atc_container .cart__title {
|
|
376
|
-
font-size: 18px;
|
|
377
|
-
height: auto;
|
|
378
|
-
line-height: 1;
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
#atc-modal .modal__close.close {
|
|
382
|
-
top: 0;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
#atc_container .cart__item {
|
|
386
|
-
padding: 1.25rem 0;
|
|
387
|
-
margin: 0;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
#atc_container .cart__submit {
|
|
391
|
-
padding: 0;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
#atc_container .cart__detail>div {
|
|
395
|
-
margin: 0 10px 0 10px;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
#atc_container .cart__qty {
|
|
399
|
-
left: 10px;
|
|
400
|
-
bottom: -15px;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
#atc_container .cart__detail .cart__price {
|
|
404
|
-
position: absolute;
|
|
405
|
-
bottom: -1rem;
|
|
406
|
-
right: -1rem;
|
|
407
|
-
margin: 0;
|
|
408
|
-
width: 5.625rem;
|
|
409
|
-
text-align: center;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
#atc_container .cart__detail .cart__now-price {
|
|
413
|
-
line-height: 26px;
|
|
414
|
-
font-size: 15px;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
#atc_container .cart__detail .cart__discount {
|
|
418
|
-
font-size: 12px;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
#atc_container .currency__cart-tip_exchange {
|
|
422
|
-
font-size: 12px !important;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
.atc-btn__link {
|
|
428
|
-
color: #202020;
|
|
429
|
-
font-size: 16px;
|
|
430
|
-
text-decoration: underline;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
.modal.fade .modal-dialog {
|
|
434
|
-
transition: none;
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
html[dir='rtl'] #atc_container .currency__cart-tip>div:nth-child(1) {
|
|
438
|
-
justify-content: flex-start !important;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
.cart_fixed-screen {
|
|
442
|
-
overflow: hidden;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
@media screen and (max-width: 768px) {#atc-modal{width:100%;right:0;left:0;}}
|
|
446
|
-
@media screen and (min-width: 768px) {#atc-modal{width:100%;right:0;left:0;}}
|
|
447
|
-
#atc-modal .modal-dialog{right:0;}
|
|
448
|
-
#atc-modal div.modal-body { height: 100%; overflow-y: scroll; }
|
|
449
|
-
#atc-modal .modal-dialog { height: 100%; }
|
|
450
|
-
#atc-modal .modal-content { height: 100%; }
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
(function ($) {
|
|
2
|
-
$.collectionDetail = function (params) {
|
|
3
|
-
var collectionId = params.collection_id;
|
|
4
|
-
var $section = $('[data-section-id=' + params.id + ']');
|
|
5
|
-
var $content = $section.find('.collection-product__wrapper');
|
|
6
|
-
var $number = $section.find('.collection__number');
|
|
7
|
-
var isPaginationShow = params.is_pagination_show;
|
|
8
|
-
var limit = params.limit; // 每页数量
|
|
9
|
-
var total = params.pages; //总页数
|
|
10
|
-
var queryParams = $.params();
|
|
11
|
-
var page = parseInt(queryParams.page, 10) || 1, //分页码
|
|
12
|
-
loading = false, // 请求数据标示
|
|
13
|
-
hasMore = true; // 是否还有数据
|
|
14
|
-
var sort = {
|
|
15
|
-
name: 'Recommend',
|
|
16
|
-
value: queryParams.sort_by || 'manual'
|
|
17
|
-
};
|
|
18
|
-
if (params.current_tags) {
|
|
19
|
-
params.current_tags.split(',').map(function (i) {
|
|
20
|
-
// TODO escape css selector
|
|
21
|
-
$("[data-type=tag_filter] :radio[value='" + i.replace(/ /g, "\\ ") + "']").prop("checked", true)
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
sort.value && ($(".collection__sort select").val(sort.value));
|
|
25
|
-
queryParams.price && ($("[data-type=price_filter] :radio").each(function (i, r) {
|
|
26
|
-
if (r.value.replace(/[^\d-]/g, "").replace("-", ",") == (queryParams.price || "").replace(/,$/, "")) {
|
|
27
|
-
r.checked = true;
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
// 获取数据,拼接html模板
|
|
33
|
-
var getData = function (param, reload, cb) {
|
|
34
|
-
// 显示分页直接跳转页面
|
|
35
|
-
if (isPaginationShow) {
|
|
36
|
-
return location.href = "/collections/" + params.handle + (param.tags ? "/" : "") + (param.tags || "") + "?" + $.toQuery(Object.assign($.params(), param, {
|
|
37
|
-
page: param.page + 1
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
// 请求数据
|
|
41
|
-
$(document).trigger('dj.common.load_more.loading.start', { sectionId: params.id })
|
|
42
|
-
$.get('/api/collections/' + encodeURIComponent(collectionId) + '/products?' + $.toQuery(param), function (res, status) {
|
|
43
|
-
if (res && res.data && status == 'success') {
|
|
44
|
-
var products = res.data.products || [];
|
|
45
|
-
products = products.filter(function (item) {
|
|
46
|
-
return item.published;
|
|
47
|
-
})
|
|
48
|
-
page++;
|
|
49
|
-
hasMore = res.data.has_more == 1 ? true : false;
|
|
50
|
-
var html = '';
|
|
51
|
-
var topProductIds = [];
|
|
52
|
-
$('.top-product').each(function(_, element) {
|
|
53
|
-
topProductIds.push($(element).data('product-id'));
|
|
54
|
-
});
|
|
55
|
-
products = products.filter(function(p) {
|
|
56
|
-
return topProductIds.indexOf(p.id) === -1
|
|
57
|
-
});
|
|
58
|
-
$('.collection-empty-art-tpl').remove();
|
|
59
|
-
if (products.length > 0) {
|
|
60
|
-
html = window.template('collection-art-tpl', {
|
|
61
|
-
products: products,
|
|
62
|
-
filter: params.filter,
|
|
63
|
-
});
|
|
64
|
-
} else if (res.data.count == 0 && !$('.top-product').length) {
|
|
65
|
-
// 总数为0,提示搜索结果空
|
|
66
|
-
html = window.template('collection-empty-art-tpl');
|
|
67
|
-
}
|
|
68
|
-
// 更新商品数量
|
|
69
|
-
$number.html($number.text().replace(/\d+(\.\d+)?/g, res.data.count))
|
|
70
|
-
// 如果reload,清空原来的列表,重置page数值
|
|
71
|
-
reload && $content.find('.common__product-gap:not(.top-product)').remove() && (page = 1);
|
|
72
|
-
$content.append(html);
|
|
73
|
-
}else{
|
|
74
|
-
hasMore = false;
|
|
75
|
-
}
|
|
76
|
-
if (hasMore) {
|
|
77
|
-
$(document).trigger('dj.common.load_more.loading.end', { sectionId: params.id })
|
|
78
|
-
} else {
|
|
79
|
-
$(document).trigger('dj.common.load_more.hide', { sectionId: params.id })
|
|
80
|
-
}
|
|
81
|
-
loading = false;
|
|
82
|
-
})
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// 监听select排序,请求数据
|
|
86
|
-
$(document).off('dj.common.sort_select.change').on('dj.common.sort_select.change', function (e, data) {
|
|
87
|
-
$('#pagination').off('pagination-change');
|
|
88
|
-
// 初始化组件
|
|
89
|
-
if (isPaginationShow && !$.isMobile()) {
|
|
90
|
-
initPagination(1);
|
|
91
|
-
}
|
|
92
|
-
// 请求数据
|
|
93
|
-
if (data.sectionId == params.id) {
|
|
94
|
-
hasMore = true;
|
|
95
|
-
sort = data;
|
|
96
|
-
getData({
|
|
97
|
-
page: 0,
|
|
98
|
-
sort_by: sort.value,
|
|
99
|
-
limit: limit,
|
|
100
|
-
tags: getTags('tag'),
|
|
101
|
-
price: getTags('price'),
|
|
102
|
-
}, true);
|
|
103
|
-
}
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
var loadMore = function () {
|
|
107
|
-
if (!loading && hasMore) {
|
|
108
|
-
loading = true;
|
|
109
|
-
getData({
|
|
110
|
-
page: page,
|
|
111
|
-
sort_by: sort.value,
|
|
112
|
-
limit: limit,
|
|
113
|
-
tags: getTags('tag'),
|
|
114
|
-
price: getTags('price'),
|
|
115
|
-
}, false);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// 不分页,监听滚动,请求数据
|
|
120
|
-
if (!isPaginationShow) {
|
|
121
|
-
$(document).on('scroll', $.debounce(function () {
|
|
122
|
-
// 判断是否到底
|
|
123
|
-
if ($.isToPageEnd(params.id)) {
|
|
124
|
-
loadMore();
|
|
125
|
-
}
|
|
126
|
-
}, 10, 50));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// 监听loadmore点击,请求数据
|
|
130
|
-
$(document).on('dj.common.load_more.is_click', function (e, data) {
|
|
131
|
-
if (data.sectionId == params.id) {
|
|
132
|
-
loadMore();
|
|
133
|
-
}
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
// filter(mobile)
|
|
137
|
-
var filter_wrapper = $('.collection-filter__wrapper');
|
|
138
|
-
$(document).on('click', '.collection__filter-by', function () {
|
|
139
|
-
//$('html, body').addClass('collection-filter__scroll');
|
|
140
|
-
filter_wrapper.addClass('collection-filter__wrapper-open');
|
|
141
|
-
})
|
|
142
|
-
var closeFilter = function () {
|
|
143
|
-
//$('html, body').removeClass('collection-filter__scroll');
|
|
144
|
-
filter_wrapper.removeClass('collection-filter__wrapper-open');
|
|
145
|
-
}
|
|
146
|
-
var getPrice = function(str) {
|
|
147
|
-
var price = (str + '').replace(/[\r\n]/g, "").replace(/\ +/g, "");
|
|
148
|
-
price = price.charAt(price.length - 2) == '.' ? price + '0' : price;
|
|
149
|
-
var decimal = false; // 是否需要精度
|
|
150
|
-
// 判断是否需要精度
|
|
151
|
-
if (price.charAt(price.length - 3) == ',' || price.charAt(price.length - 3) == '.') {
|
|
152
|
-
decimal = true;
|
|
153
|
-
price = price.substr(0, price.length - 3) + '*' + price.substr(price.length - 3);
|
|
154
|
-
}
|
|
155
|
-
// 去掉千分位分割
|
|
156
|
-
price = price.replace(/\./g, '').replace(/\,/g, '').replace(/\'/g, '');
|
|
157
|
-
if (decimal) {
|
|
158
|
-
price = price.replace('*', '.');
|
|
159
|
-
}
|
|
160
|
-
// 去掉货币符号
|
|
161
|
-
var res = /\d+(\.\d+)?/g.exec(price.replace(/,/g, ''));
|
|
162
|
-
return res && res[0] ? res[0] : price;
|
|
163
|
-
}
|
|
164
|
-
var getTags = function (type) {
|
|
165
|
-
var tagList = [];
|
|
166
|
-
$('.collection-filter__item[data-type=' + type + '_filter]').each(function (k, v) {
|
|
167
|
-
var val = $(v).find('input:checked').val();
|
|
168
|
-
if (type == 'price' && val) {
|
|
169
|
-
var val_arr = val.split('-');
|
|
170
|
-
if (val_arr.length == 2) {
|
|
171
|
-
val = getPrice(val_arr[0]) + ',' + getPrice(val_arr[1]);
|
|
172
|
-
} else if (val_arr.length == 1) {
|
|
173
|
-
val = getPrice(val_arr[0]) + ',';
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
val && tagList.push(val);
|
|
177
|
-
})
|
|
178
|
-
return tagList.join(',')
|
|
179
|
-
}
|
|
180
|
-
$(document).on('click', '.collection-filter__footer-confirm', closeFilter);
|
|
181
|
-
filter_wrapper.click(function (e) {
|
|
182
|
-
if ($(e.target).hasClass('collection-filter__wrapper')) {
|
|
183
|
-
closeFilter();
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
// clear all
|
|
187
|
-
$('.collection-filter__wrapper').on('click', '.collection-filter-clear', function () {
|
|
188
|
-
$('.custom-control-input').attr('checked', false);
|
|
189
|
-
getData({
|
|
190
|
-
page: 0,
|
|
191
|
-
sort_by: sort.value,
|
|
192
|
-
limit: limit,
|
|
193
|
-
tags: getTags('tag'),
|
|
194
|
-
price: getTags('price'),
|
|
195
|
-
}, true);
|
|
196
|
-
})
|
|
197
|
-
.on('change', '.custom-control-input', function () {
|
|
198
|
-
getData({
|
|
199
|
-
page: 0,
|
|
200
|
-
sort_by: sort.value,
|
|
201
|
-
limit: limit,
|
|
202
|
-
tags: getTags('tag'),
|
|
203
|
-
price: getTags('price'),
|
|
204
|
-
}, true);
|
|
205
|
-
})
|
|
206
|
-
if (window.SHOP_PARAMS.shop_env == '1') {
|
|
207
|
-
$(window).resize($.throttle(closeFilter, 200, 200));
|
|
208
|
-
}
|
|
209
|
-
//分页
|
|
210
|
-
var initPagination = function (page) {
|
|
211
|
-
$("#pagination").pagination({
|
|
212
|
-
labelPrev: '<' + params.lang.prev,
|
|
213
|
-
labelNext: params.lang.next + '>',
|
|
214
|
-
labelPageSize: params.lang.items_per_page,
|
|
215
|
-
page: page,
|
|
216
|
-
total: total,
|
|
217
|
-
pageSize: limit,
|
|
218
|
-
onChange: function (e, data) {
|
|
219
|
-
getData({
|
|
220
|
-
page: data.page - 1,
|
|
221
|
-
sort_by: sort.value,
|
|
222
|
-
limit: limit,
|
|
223
|
-
tags: getTags('tag'),
|
|
224
|
-
price: getTags('price'),
|
|
225
|
-
}, true);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
|
-
initPagination(page);
|
|
230
|
-
$(document).on('dj.editor.update dj.editor.delete dj.editor.sort dj.editor.add', function () {
|
|
231
|
-
$('body').removeClass('overflow-hidden');
|
|
232
|
-
});
|
|
233
|
-
}
|
|
234
|
-
})(window.jQuery);
|