123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- import Vue from 'vue'
- import store from 'vuejs/store'
- import VUserBlock from 'vuejs/components/User/UserBlock'
- import VTestContent from 'vuejs/components/Content/Test'
- import { mapState } from 'vuex'
- // require('theme/assets/styles/main.scss');
- import 'theme/assets/styles/main.scss'
- (function(Drupal, drupalSettings) {
- var MaterioTheme = function(){
- var v_user_block, v_test_content;
- // var _is_front = drupalSettings.path.isFront;
- console.log('drupalSettings', drupalSettings);
- // ___ _ _
- // |_ _|_ _ (_) |_
- // | || ' \| | _|
- // |___|_||_|_|\__|
- function init(){
- console.log("MaterioTheme init()")
- initVues()
- }
- function initVues(){
- initUserVBlock()
- initTestVContent()
- }
- function initUserVBlock(){
- let props = {
- title: ""
- };
- let mount_point = drupalSettings.user.uid !== 0 ? '#block-userblock' : '#block-userlogin';
- switch (mount_point) {
- case '#block-userlogin':
- let $block = document.querySelector(mount_point);
- props = {
- title: $block.querySelector('h2').textContent,
- form: {
- ph_email: $block.querySelector('input#edit-name').getAttribute('placeholder'),
- ph_pass: $block.querySelector('input#edit-pass').getAttribute('placeholder'),
- btn_value: $block.querySelector('input#edit-submit').getAttribute('value'),
- register: {
- title: $block.querySelector('a.create-account-link').textContent,
- href: $block.querySelector('a.create-account-link').getAttribute('href')
- },
- reset: {
- title: $block.querySelector('a.request-password-link').textContent,
- href: $block.querySelector('a.request-password-link').getAttribute('href')
- }
- }
- }
- break;
- case '#block-userblock':
- break;
- default:
- }
- console.log(props);
- v_user_block = new Vue({
- // data: data,
- store,
- computed: {
- ...mapState({
- isloggedin: state => state.User.isloggedin
- })
- },
- created () {
- if(drupalSettings.user.uid !== 0){
- this.$store.commit('User/setUid', drupalSettings.user.uid)
- this.$store.dispatch('User/getUser')
- }
- },
- render: h => h(VUserBlock, {props:props})
- }).$mount(mount_point)
- console.log('initUserVBlock', v_user_block);
- }
- function initTestVContent(){
- v_test_content = new Vue({
- store,
- render: h => h(VTestContent)
- }).$mount('#block-pagetitle')
- // console.log('initTestVContent', v_test_content);
- }
- init()
- } // end MaterioTheme()
- var materiotheme = new MaterioTheme();
- })(Drupal, drupalSettings);
|