mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-28 03:31:49 +01:00
Bring updates from AppServ branch
This commit is contained in:
parent
4e967f0b1e
commit
1d99514428
@ -2,7 +2,6 @@ const webpack = require('webpack');
|
|||||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
|
||||||
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
||||||
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
@ -24,6 +23,10 @@ module.exports = {
|
|||||||
entry: {
|
entry: {
|
||||||
app: './src/js/app.js',
|
app: './src/js/app.js',
|
||||||
},
|
},
|
||||||
|
performance: {
|
||||||
|
hints: false,
|
||||||
|
maxEntrypointSize: 400000,
|
||||||
|
},
|
||||||
output: {
|
output: {
|
||||||
path: resolvePath(isCordova ? (isElectronWatch ? 'cordova/platforms/electron/www' : 'cordova/www') : 'www'),
|
path: resolvePath(isCordova ? (isElectronWatch ? 'cordova/platforms/electron/www' : 'cordova/www') : 'www'),
|
||||||
filename: 'js/[name].js',
|
filename: 'js/[name].js',
|
||||||
@ -37,16 +40,18 @@ module.exports = {
|
|||||||
alias: {
|
alias: {
|
||||||
'@': resolvePath('src'),
|
'@': resolvePath('src'),
|
||||||
},
|
},
|
||||||
|
fallback: { crypto: false },
|
||||||
},
|
},
|
||||||
devtool: env === 'production' ? 'source-map' : 'eval',
|
devtool: env === 'production' ? 'source-map' : 'eval',
|
||||||
devServer: {
|
devServer: {
|
||||||
hot: true,
|
hot: true,
|
||||||
open: true,
|
open: true,
|
||||||
compress: true,
|
compress: true,
|
||||||
contentBase: '/www/',
|
//contentBase: '/www/',
|
||||||
disableHostCheck: true,
|
static: '/www/',
|
||||||
|
allowedHosts: "all",
|
||||||
historyApiFallback: true,
|
historyApiFallback: true,
|
||||||
|
port: 8082,
|
||||||
},
|
},
|
||||||
optimization: {
|
optimization: {
|
||||||
concatenateModules: true,
|
concatenateModules: true,
|
||||||
@ -58,12 +63,10 @@ module.exports = {
|
|||||||
test: /\.(mjs|js|jsx)$/,
|
test: /\.(mjs|js|jsx)$/,
|
||||||
include: [
|
include: [
|
||||||
resolvePath('src'),
|
resolvePath('src'),
|
||||||
|
|
||||||
],
|
],
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: require.resolve('babel-loader'),
|
loader: require.resolve('babel-loader'),
|
||||||
|
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -74,8 +77,6 @@ module.exports = {
|
|||||||
'framework7-loader',
|
'framework7-loader',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
use: [
|
use: [
|
||||||
@ -133,33 +134,24 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||||
loader: 'url-loader',
|
type: "asset/resource",
|
||||||
options: {
|
generator: {
|
||||||
limit: 10000,
|
filename: "images/[name][ext]",
|
||||||
name: 'images/[name].[ext]',
|
}
|
||||||
|
|
||||||
},
|
|
||||||
type: 'javascript/auto'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac|m4a)(\?.*)?$/,
|
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac|m4a)(\?.*)?$/,
|
||||||
loader: 'url-loader',
|
type: "asset/resource",
|
||||||
options: {
|
generator: {
|
||||||
limit: 10000,
|
filename: "media/[name][ext]",
|
||||||
name: 'media/[name].[ext]',
|
}
|
||||||
|
|
||||||
},
|
|
||||||
type: 'javascript/auto'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||||
loader: 'url-loader',
|
type: "asset/resource",
|
||||||
options: {
|
generator: {
|
||||||
limit: 10000,
|
filename: "fonts/[name][ext]",
|
||||||
name: 'fonts/[name].[ext]',
|
}
|
||||||
|
|
||||||
},
|
|
||||||
type: 'javascript/auto'
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -211,6 +203,5 @@ module.exports = {
|
|||||||
swSrc: resolvePath('src/service-worker.js'),
|
swSrc: resolvePath('src/service-worker.js'),
|
||||||
})
|
})
|
||||||
] : []),
|
] : []),
|
||||||
|
|
||||||
],
|
],
|
||||||
};
|
};
|
@ -1,101 +0,0 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
|
||||||
<widget id="com.comidacab.app" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
|
|
||||||
<name>Comida Cab</name>
|
|
||||||
<description>
|
|
||||||
A sample Apache Cordova application that responds to the deviceready event.
|
|
||||||
</description>
|
|
||||||
<author email="dev@cordova.apache.org" href="http://cordova.io">
|
|
||||||
Apache Cordova Team
|
|
||||||
</author>
|
|
||||||
<content src="index.html" />
|
|
||||||
<plugin name="cordova-plugin-whitelist" spec="1" />
|
|
||||||
<access origin="*" />
|
|
||||||
<allow-intent href="http://*/*" />
|
|
||||||
<allow-intent href="https://*/*" />
|
|
||||||
<allow-intent href="tel:*" />
|
|
||||||
<allow-intent href="sms:*" />
|
|
||||||
<allow-intent href="mailto:*" />
|
|
||||||
<allow-intent href="geo:*" />
|
|
||||||
<platform name="android">
|
|
||||||
<allow-intent href="market:*" />
|
|
||||||
</platform>
|
|
||||||
<platform name="ios">
|
|
||||||
<allow-intent href="itms:*" />
|
|
||||||
<allow-intent href="itms-apps:*" />
|
|
||||||
</platform>
|
|
||||||
|
|
||||||
<allow-navigation href="*" />
|
|
||||||
|
|
||||||
<platform name="android">
|
|
||||||
<preference name="StatusBarOverlaysWebView" value="false" />
|
|
||||||
<preference name="android-minSdkVersion" value="22" />
|
|
||||||
<preference name="SplashMaintainAspectRatio" value="true" />
|
|
||||||
<splash density="land-hdpi" src="res/screen/android/drawable-hdpi/screen.png" />
|
|
||||||
<splash density="land-mdpi" src="res/screen/android/drawable-mdpi/screen.png" />
|
|
||||||
<splash density="land-xhdpi" src="res/screen/android/drawable-xhdpi/screen.png" />
|
|
||||||
<splash density="land-xxhdpi" src="res/screen/android/drawable-xxhdpi/screen.png" />
|
|
||||||
<splash density="land-xxxhdpi" src="res/screen/android/drawable-xxxhdpi/screen.png" />
|
|
||||||
<splash density="port-hdpi" src="res/screen/android/drawable-hdpi/screen.png" />
|
|
||||||
<splash density="port-mdpi" src="res/screen/android/drawable-mdpi/screen.png" />
|
|
||||||
<splash density="port-xhdpi" src="res/screen/android/drawable-xhdpi/screen.png" />
|
|
||||||
<splash density="port-xxhdpi" src="res/screen/android/drawable-xxhdpi/screen.png" />
|
|
||||||
<splash density="port-xxxhdpi" src="res/screen/android/drawable-xxxhdpi/screen.png" />
|
|
||||||
<icon density="ldpi" src="res/icon/android/mipmap-ldpi/ic_launcher.png" />
|
|
||||||
<icon density="mdpi" src="res/icon/android/mipmap-mdpi/ic_launcher.png" />
|
|
||||||
<icon density="hdpi" src="res/icon/android/mipmap-hdpi/ic_launcher.png" />
|
|
||||||
<icon density="xhdpi" src="res/icon/android/mipmap-xhdpi/ic_launcher.png" />
|
|
||||||
<icon density="xxhdpi" src="res/icon/android/mipmap-xxhdpi/ic_launcher.png" />
|
|
||||||
<icon density="xxxhdpi" src="res/icon/android/mipmap-xxxhdpi/ic_launcher.png" />
|
|
||||||
</platform>
|
|
||||||
|
|
||||||
|
|
||||||
<platform name="ios">
|
|
||||||
<config-file parent="CFBundleAllowMixedLocalizations" platform="ios" target="*-Info.plist">
|
|
||||||
<true />
|
|
||||||
</config-file>
|
|
||||||
<preference name="scheme" value="app" />
|
|
||||||
<preference name="hostname" value="localhost" />
|
|
||||||
<preference name="StatusBarOverlaysWebView" value="true" />
|
|
||||||
<splash src="res/screen/ios/Default@2x~universal~anyany.png" />
|
|
||||||
<icon height="180" src="res/icon/ios/icon-60x60@3x.png" width="180" />
|
|
||||||
<icon height="60" src="res/icon/ios/icon-60x60@1x.png" width="60" />
|
|
||||||
<icon height="120" src="res/icon/ios/icon-60x60@2x.png" width="120" />
|
|
||||||
<icon height="76" src="res/icon/ios/icon-76x76@1x.png" width="76" />
|
|
||||||
<icon height="152" src="res/icon/ios/icon-76x76@2x.png" width="152" />
|
|
||||||
<icon height="228" src="res/icon/ios/icon-76x76@3x.png" width="228" />
|
|
||||||
<icon height="40" src="res/icon/ios/icon-40x40@1x.png" width="40" />
|
|
||||||
<icon height="80" src="res/icon/ios/icon-40x40@2x.png" width="80" />
|
|
||||||
<icon height="87" src="res/icon/ios/icon-29x29@3x.png" width="87" />
|
|
||||||
<icon height="57" src="res/icon/ios/icon-57x57@1x.png" width="57" />
|
|
||||||
<icon height="114" src="res/icon/ios/icon-57x57@2x.png" width="114" />
|
|
||||||
<icon height="72" src="res/icon/ios/icon-72x72@1x.png" width="72" />
|
|
||||||
<icon height="144" src="res/icon/ios/icon-72x72@2x.png" width="144" />
|
|
||||||
<icon height="167" src="res/icon/ios/icon-83.5x83.5@2x.png" width="167" />
|
|
||||||
<icon height="29" src="res/icon/ios/icon-29x29@1x.png" width="29" />
|
|
||||||
<icon height="58" src="res/icon/ios/icon-29x29@2x.png" width="58" />
|
|
||||||
<icon height="50" src="res/icon/ios/icon-50x50@1x.png" width="50" />
|
|
||||||
<icon height="100" src="res/icon/ios/icon-50x50@2x.png" width="100" />
|
|
||||||
<icon height="167" src="res/icon/ios/icon-83.5x83.5@2x.png" width="167" />
|
|
||||||
<icon height="1024" src="res/icon/ios/icon-512x512@2x.png" width="1024" />
|
|
||||||
</platform>
|
|
||||||
|
|
||||||
|
|
||||||
<platform name="electron">
|
|
||||||
<preference name="ElectronSettingsFilePath" value="electron-settings.json" />
|
|
||||||
<icon src="res/icon/electron/app.png" target="app" />
|
|
||||||
<icon src="res/icon/electron/installer.png" target="installer" />
|
|
||||||
<preference name="ShowSplashScreen" value="false" />
|
|
||||||
<preference name="AutoHideSplashScreen" value="true" />
|
|
||||||
</platform>
|
|
||||||
|
|
||||||
|
|
||||||
<preference name="DisallowOverscroll" value="true" />
|
|
||||||
<preference name="BackupWebStorage" value="local" />
|
|
||||||
<preference name="AutoHideSplashScreen" value="false" />
|
|
||||||
<preference name="ShowSplashScreenSpinner" value="false" />
|
|
||||||
<preference name="SplashScreenDelay" value="0" />
|
|
||||||
<preference name="Suppresses3DTouchGesture" value="true" />
|
|
||||||
<preference name="Allow3DTouchLinkPreview" value="false" />
|
|
||||||
<preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
|
|
||||||
<preference name="AllowInlineMediaPlayback" value="true" />
|
|
||||||
</widget>
|
|
10
cordova/package-lock.json
generated
10
cordova/package-lock.json
generated
@ -1033,6 +1033,11 @@
|
|||||||
"integrity": "sha512-EYC5eQFVkoYXq39l7tYKE6lEjHJ04mvTmKXxGL7quHLdFPfJMNzru/UYpn92AOfpl3PQaZmou78C7EgmFOwFQQ==",
|
"integrity": "sha512-EYC5eQFVkoYXq39l7tYKE6lEjHJ04mvTmKXxGL7quHLdFPfJMNzru/UYpn92AOfpl3PQaZmou78C7EgmFOwFQQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"cordova-sms-plugin": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/cordova-sms-plugin/-/cordova-sms-plugin-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-M4PJVor41e/+KkntTIg8FoVQRDSeLzJhFiwk7AkXU82ssqdVBn/z0yb8mG3Ylx9goUCGGQYtmqdt1hJJx8lWLQ=="
|
||||||
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
|
||||||
@ -2273,6 +2278,11 @@
|
|||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"onesignal-cordova-plugin": {
|
||||||
|
"version": "2.11.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/onesignal-cordova-plugin/-/onesignal-cordova-plugin-2.11.4.tgz",
|
||||||
|
"integrity": "sha512-Iy0u65XK/gXj4U/82prOOcNZMKm415FThhxqMY4epJcW11EjdMIm33DQr1MDnV9s3UjZcgTZ4DIlhLEoLGR05w=="
|
||||||
|
},
|
||||||
"os-homedir": {
|
"os-homedir": {
|
||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz",
|
||||||
|
@ -18,14 +18,18 @@
|
|||||||
"cordova-ios": "^6.2.0",
|
"cordova-ios": "^6.2.0",
|
||||||
"cordova-plugin-keyboard": "^1.2.0",
|
"cordova-plugin-keyboard": "^1.2.0",
|
||||||
"cordova-plugin-splashscreen": "^6.0.0",
|
"cordova-plugin-splashscreen": "^6.0.0",
|
||||||
"cordova-plugin-statusbar": "^2.4.3"
|
"cordova-plugin-statusbar": "^2.4.3",
|
||||||
|
"cordova-sms-plugin": "^1.0.1",
|
||||||
|
"onesignal-cordova-plugin": "^2.11.4"
|
||||||
},
|
},
|
||||||
"cordova": {
|
"cordova": {
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"cordova-plugin-statusbar": {},
|
"cordova-plugin-statusbar": {},
|
||||||
"cordova-plugin-keyboard": {},
|
"cordova-plugin-keyboard": {},
|
||||||
"cordova-plugin-splashscreen": {},
|
"cordova-plugin-splashscreen": {},
|
||||||
"cordova-plugin-whitelist": {}
|
"cordova-plugin-whitelist": {},
|
||||||
|
"cordova-sms-plugin": {},
|
||||||
|
"onesignal-cordova-plugin": {}
|
||||||
},
|
},
|
||||||
"platforms": [
|
"platforms": [
|
||||||
"ios",
|
"ios",
|
||||||
|
@ -1,39 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "com.comidacab.app",
|
|
||||||
"displayName": "Comida Cab",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "A sample Apache Cordova application that responds to the deviceready event.",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"ecosystem:cordova"
|
|
||||||
],
|
|
||||||
"author": "Apache Cordova Team",
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"dependencies": {
|
|
||||||
"cordova-android": "^8.1.0",
|
|
||||||
"cordova-electron": "^1.1.1",
|
|
||||||
"cordova-ios": "^6.2.0",
|
|
||||||
"cordova-plugin-keyboard": "^1.2.0",
|
|
||||||
"cordova-plugin-splashscreen": "^6.0.0",
|
|
||||||
"cordova-plugin-statusbar": "^2.4.3"
|
|
||||||
},
|
|
||||||
"cordova": {
|
|
||||||
"plugins": {
|
|
||||||
"cordova-plugin-statusbar": {},
|
|
||||||
"cordova-plugin-keyboard": {},
|
|
||||||
"cordova-plugin-splashscreen": {},
|
|
||||||
"cordova-plugin-whitelist": {}
|
|
||||||
},
|
|
||||||
"platforms": [
|
|
||||||
"ios",
|
|
||||||
"android",
|
|
||||||
"electron"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"cordova-plugin-whitelist": "^1.3.4"
|
|
||||||
}
|
|
||||||
}
|
|
3530
package-lock.json
generated
3530
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
41
package.json
41
package.json
@ -7,14 +7,14 @@
|
|||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm run dev",
|
"start": "npm run dev",
|
||||||
"dev": "cross-env NODE_ENV=development webpack serve --config ./build/webpack.config.js --port 8082",
|
"dev": "cross-env NODE_ENV=development webpack serve --config ./build/webpack.config.js",
|
||||||
"build": "cross-env NODE_ENV=production node ./build/build.js",
|
"build": "cross-env NODE_ENV=production node ./build/build.js",
|
||||||
"build-cordova": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build",
|
"build-cordova": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build",
|
||||||
"build-cordova-ios": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build ios",
|
|
||||||
"cordova-ios": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova run ios",
|
|
||||||
"build-cordova-android": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build android",
|
"build-cordova-android": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build android",
|
||||||
"cordova-android": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova run android",
|
"build-cordova-ios": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build ios",
|
||||||
"build-cordova-electron": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build electron",
|
"build-cordova-electron": "cross-env TARGET=cordova cross-env NODE_ENV=production node ./build/build.js && cd cordova && cordova build electron",
|
||||||
|
"cordova-android": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova run android",
|
||||||
|
"cordova-ios": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && cd cordova && cordova run ios",
|
||||||
"cordova-electron": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && concurrently --kill-others \"cross-env TARGET=cordova cross-env ELECTRON_WATCH=true cross-env NODE_ENV=development cross-env webpack --progress --config ./build/webpack.config.js --watch\" \"cd cordova && cordova run electron --nobuild\"",
|
"cordova-electron": "cross-env TARGET=cordova cross-env NODE_ENV=development node ./build/build.js && concurrently --kill-others \"cross-env TARGET=cordova cross-env ELECTRON_WATCH=true cross-env NODE_ENV=development cross-env webpack --progress --config ./build/webpack.config.js --watch\" \"cd cordova && cordova run electron --nobuild\"",
|
||||||
"postinstall": "cpy ./node_modules/framework7-icons/fonts/*.* ./src/fonts/"
|
"postinstall": "cpy ./node_modules/framework7-icons/fonts/*.* ./src/fonts/"
|
||||||
},
|
},
|
||||||
@ -30,21 +30,22 @@
|
|||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"crypto-js": "^4.1.1",
|
"crypto-js": "^4.1.1",
|
||||||
"dom7": "^3.0.0",
|
"dom7": "^3.0.0",
|
||||||
"framework7": "^6.0.22",
|
"framework7": "^6.3.0",
|
||||||
"framework7-icons": "^4.0.2",
|
"framework7-icons": "^5.0.3",
|
||||||
"localforage": "^1.9.0",
|
"html2pdf.js": "^0.9.3",
|
||||||
|
"localforage": "^1.10.0",
|
||||||
"skeleton-elements": "^3.4.0",
|
"skeleton-elements": "^3.4.0",
|
||||||
"swiper": "^6.8.0"
|
"swiper": "^6.8.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.14.8",
|
"@babel/core": "^7.15.0",
|
||||||
"@babel/plugin-transform-runtime": "^7.14.5",
|
"@babel/plugin-transform-runtime": "^7.15.0",
|
||||||
"@babel/preset-env": "^7.14.8",
|
"@babel/preset-env": "^7.15.0",
|
||||||
"@babel/preset-react": "^7.14.5",
|
"@babel/preset-react": "^7.14.5",
|
||||||
"@babel/runtime": "^7.14.8",
|
"@babel/runtime": "^7.15.3",
|
||||||
"babel-loader": "^8.2.2",
|
"babel-loader": "^8.2.2",
|
||||||
"chalk": "^4.1.1",
|
"chalk": "^4.1.2",
|
||||||
"concurrently": "^6.2.0",
|
"concurrently": "^6.2.1",
|
||||||
"copy-webpack-plugin": "^9.0.1",
|
"copy-webpack-plugin": "^9.0.1",
|
||||||
"cpy-cli": "^3.1.1",
|
"cpy-cli": "^3.1.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
@ -52,10 +53,12 @@
|
|||||||
"css-minimizer-webpack-plugin": "^3.0.2",
|
"css-minimizer-webpack-plugin": "^3.0.2",
|
||||||
"file-loader": "^6.2.0",
|
"file-loader": "^6.2.0",
|
||||||
"framework7-loader": "^3.0.2",
|
"framework7-loader": "^3.0.2",
|
||||||
|
"html2canvas": "^1.3.2",
|
||||||
"html-webpack-plugin": "^5.3.2",
|
"html-webpack-plugin": "^5.3.2",
|
||||||
|
"jspdf": "^2.3.1",
|
||||||
"less": "^4.1.1",
|
"less": "^4.1.1",
|
||||||
"less-loader": "^10.0.1",
|
"less-loader": "^10.0.1",
|
||||||
"mini-css-extract-plugin": "^2.1.0",
|
"mini-css-extract-plugin": "^2.2.0",
|
||||||
"ora": "^5.4.1",
|
"ora": "^5.4.1",
|
||||||
"postcss-loader": "^6.1.1",
|
"postcss-loader": "^6.1.1",
|
||||||
"postcss-preset-env": "^6.7.0",
|
"postcss-preset-env": "^6.7.0",
|
||||||
@ -63,9 +66,9 @@
|
|||||||
"style-loader": "^3.2.1",
|
"style-loader": "^3.2.1",
|
||||||
"terser-webpack-plugin": "^5.1.4",
|
"terser-webpack-plugin": "^5.1.4",
|
||||||
"url-loader": "^4.1.1",
|
"url-loader": "^4.1.1",
|
||||||
"webpack": "^5.46.0",
|
"webpack": "^5.51.1",
|
||||||
"webpack-cli": "^4.7.2",
|
"webpack-cli": "^4.8.0",
|
||||||
"webpack-dev-server": "^3.11.2",
|
"webpack-dev-server": "^4.0.0",
|
||||||
"workbox-webpack-plugin": "^6.1.5"
|
"workbox-webpack-plugin": "^6.2.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import themes from './js/stores/theme.js';
|
import theme from './js/stores/theme.js';
|
||||||
|
import user from './js/stores/user.js';
|
||||||
|
|
||||||
export default (props, { $f7, $, $update, $onMounted }) => {
|
export default (props, { $f7, $, $update, $onMounted }) => {
|
||||||
|
|
||||||
$onMounted(async () => {
|
$onMounted(async () => {
|
||||||
await themes.dispatch('initTheme', '#app');
|
await theme.dispatch('initTheme', '#app');
|
||||||
|
await user.dispatch('checkData');
|
||||||
});
|
});
|
||||||
|
|
||||||
return $render;
|
return $render;
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -4,6 +4,7 @@ import axios from 'axios';
|
|||||||
|
|
||||||
const http = axios.create({
|
const http = axios.create({
|
||||||
baseURL: `${url}`,
|
baseURL: `${url}`,
|
||||||
|
validateStatus: status => (status => 200 && status < 300) || (status => 400 && status < 500),
|
||||||
});
|
});
|
||||||
|
|
||||||
async function checkToken (){
|
async function checkToken (){
|
||||||
@ -15,4 +16,4 @@ async function checkToken (){
|
|||||||
|
|
||||||
checkToken();
|
checkToken();
|
||||||
|
|
||||||
export { http, localForage };
|
export { http, localForage };
|
||||||
|
@ -50,6 +50,12 @@ var app = new Framework7({
|
|||||||
closeButtonText: "[X]"
|
closeButtonText: "[X]"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
smartSelect:{
|
||||||
|
openIn:"popup",
|
||||||
|
searchbar:"true",
|
||||||
|
popupCloseLinkText:"Cerrar",
|
||||||
|
},
|
||||||
|
|
||||||
// Input settings
|
// Input settings
|
||||||
input: {
|
input: {
|
||||||
scrollIntoViewOnFocus: device.cordova && !device.electron,
|
scrollIntoViewOnFocus: device.cordova && !device.electron,
|
||||||
|
127
src/js/components/pickertime.js
Normal file
127
src/js/components/pickertime.js
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
|
||||||
|
let datetimePicker = {
|
||||||
|
timeConfig(selector){
|
||||||
|
let currentDate = new Date();
|
||||||
|
let hour = currentDate.getHours();
|
||||||
|
let min = currentDate.getMinutes();
|
||||||
|
|
||||||
|
hour = (hour < 10) ? '0' + hour : hour;
|
||||||
|
min = (min < 10) ? '0'+ min : min;
|
||||||
|
|
||||||
|
return {
|
||||||
|
inputEl: selector,
|
||||||
|
toolbar: true,
|
||||||
|
toolbarCloseText: 'Cerrar',
|
||||||
|
rotateEffect: true,
|
||||||
|
openIn: 'sheet',
|
||||||
|
value: [ hour, min ],
|
||||||
|
formatValue: function (values) {
|
||||||
|
return values[0] + ':' + values[1] + ':00';
|
||||||
|
},
|
||||||
|
cols: [
|
||||||
|
// Hours
|
||||||
|
{
|
||||||
|
values: (function () {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 0; i <= 23; i++) { arr.push(i < 10 ? '0' + i : i); }
|
||||||
|
return arr;
|
||||||
|
})(),
|
||||||
|
},
|
||||||
|
// Divider
|
||||||
|
{
|
||||||
|
divider: true,
|
||||||
|
content: ':'
|
||||||
|
},
|
||||||
|
// Minutes
|
||||||
|
{
|
||||||
|
values: (function () {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 0; i <= 59; i++) { arr.push(i < 10 ? '0' + i : i); }
|
||||||
|
return arr;
|
||||||
|
})(),
|
||||||
|
}
|
||||||
|
],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
dateConfig(selector){
|
||||||
|
const today = new Date();
|
||||||
|
return{
|
||||||
|
inputEl: selector,
|
||||||
|
toolbar: true,
|
||||||
|
toolbarCloseText: 'Cerrar',
|
||||||
|
rotateEffect: true,
|
||||||
|
openIn: "sheet",
|
||||||
|
value: [
|
||||||
|
today.getMonth(),
|
||||||
|
today.getDate(),
|
||||||
|
today.getFullYear(),
|
||||||
|
today.getHours() < 10 ? '0' + today.getHours() : today.getHours(),
|
||||||
|
today.getMinutes() < 10 ? '0' + today.getMinutes() : today.getMinutes()
|
||||||
|
],
|
||||||
|
formatValue: function (values, displayValues) {
|
||||||
|
let day = values[1];
|
||||||
|
let month = values[0];
|
||||||
|
month++;
|
||||||
|
month = (month < 10) ? "0" + month : month;
|
||||||
|
day = (day < 10) ? "0" + day : day;
|
||||||
|
return values[2] + '-' + month + '-' + day + ' ' + values[3] + ':' + values[4] + ':00';
|
||||||
|
},
|
||||||
|
cols: [
|
||||||
|
// Months
|
||||||
|
{
|
||||||
|
values: ('0 1 2 3 4 5 6 7 8 9 10 11').split(' '),
|
||||||
|
displayValues: ('Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre').split(' '),
|
||||||
|
textAlign: 'left'
|
||||||
|
},
|
||||||
|
// Days
|
||||||
|
{
|
||||||
|
values: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],
|
||||||
|
},
|
||||||
|
// Years
|
||||||
|
{
|
||||||
|
values: (function () {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 1950; i <= 2030; i++) { arr.push(i); }
|
||||||
|
return arr;
|
||||||
|
})(),
|
||||||
|
},
|
||||||
|
// Space divider
|
||||||
|
{
|
||||||
|
divider: true,
|
||||||
|
content: ' '
|
||||||
|
},
|
||||||
|
// Hours
|
||||||
|
{
|
||||||
|
values: (function () {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 0; i <= 23; i++) { arr.push(i < 10 ? '0' + i : i); }
|
||||||
|
return arr;
|
||||||
|
})(),
|
||||||
|
},
|
||||||
|
// Divider
|
||||||
|
{
|
||||||
|
divider: true,
|
||||||
|
content: ':'
|
||||||
|
},
|
||||||
|
// Minutes
|
||||||
|
{
|
||||||
|
values: (function () {
|
||||||
|
var arr = [];
|
||||||
|
for (var i = 0; i <= 59; i++) { arr.push(i < 10 ? '0' + i : i); }
|
||||||
|
return arr;
|
||||||
|
})(),
|
||||||
|
}
|
||||||
|
],
|
||||||
|
on: {
|
||||||
|
change: function (picker, values, displayValues) {
|
||||||
|
var daysInMonth = new Date(picker.value[2], picker.value[0]*1 + 1, 0).getDate();
|
||||||
|
if (values[1] > daysInMonth) {
|
||||||
|
picker.cols[1].setValue(daysInMonth);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default datetimePicker;
|
35
src/js/components/preloader.js
Normal file
35
src/js/components/preloader.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import $$ from 'dom7';
|
||||||
|
|
||||||
|
let Preload = {
|
||||||
|
Autocomplete(list, selectorText, selectorValue){
|
||||||
|
return {
|
||||||
|
inputEl: selectorText,
|
||||||
|
openIn: 'dropdown',
|
||||||
|
valueProperty: 'text',
|
||||||
|
textProperty: 'text',
|
||||||
|
limit: 8,
|
||||||
|
source: function (query, render) {
|
||||||
|
let results = [];
|
||||||
|
|
||||||
|
if (query.length === 0) {
|
||||||
|
render(results);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].text.toLowerCase().indexOf(query.toLowerCase()) >= 0){
|
||||||
|
results.push(list[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
render(results);
|
||||||
|
},
|
||||||
|
on: {
|
||||||
|
change: function (value) {
|
||||||
|
$$(selectorValue).val(value[0].id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Preload;
|
@ -13,6 +13,7 @@ import Progressbar from 'framework7/components/progressbar';
|
|||||||
import Sortable from 'framework7/components/sortable';
|
import Sortable from 'framework7/components/sortable';
|
||||||
import Swipeout from 'framework7/components/swipeout';
|
import Swipeout from 'framework7/components/swipeout';
|
||||||
import Accordion from 'framework7/components/accordion';
|
import Accordion from 'framework7/components/accordion';
|
||||||
|
import Gauge from 'framework7/components/gauge';
|
||||||
import ContactsList from 'framework7/components/contacts-list';
|
import ContactsList from 'framework7/components/contacts-list';
|
||||||
import VirtualList from 'framework7/components/virtual-list';
|
import VirtualList from 'framework7/components/virtual-list';
|
||||||
import ListIndex from 'framework7/components/list-index';
|
import ListIndex from 'framework7/components/list-index';
|
||||||
@ -67,6 +68,7 @@ Framework7.use([
|
|||||||
Sortable,
|
Sortable,
|
||||||
Swipeout,
|
Swipeout,
|
||||||
Accordion,
|
Accordion,
|
||||||
|
Gauge,
|
||||||
ContactsList,
|
ContactsList,
|
||||||
VirtualList,
|
VirtualList,
|
||||||
ListIndex,
|
ListIndex,
|
||||||
|
94
src/js/stores/file.js
Normal file
94
src/js/stores/file.js
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
import { createStore } from 'framework7';
|
||||||
|
import { http } from './../api/config.js';
|
||||||
|
|
||||||
|
const file = createStore({
|
||||||
|
state: {
|
||||||
|
item: {},
|
||||||
|
list: [],
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
//Mutations
|
||||||
|
insert_list_data({ state }, data) {
|
||||||
|
state.list = data;
|
||||||
|
},
|
||||||
|
set_item({ state}, data){
|
||||||
|
state.item = data;
|
||||||
|
},
|
||||||
|
//End mutations
|
||||||
|
async getFileItem({ dispatch }, param){
|
||||||
|
let response = [];
|
||||||
|
let result = {};
|
||||||
|
|
||||||
|
result = await http.get(`file/get/${param}`);
|
||||||
|
if (result.status === 200){
|
||||||
|
response = result.data;
|
||||||
|
response.FilePath = `${http.defaults.baseURL}/${response.FilePath}/${response.FileName}`;
|
||||||
|
dispatch('set_item', response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getFileRequestOrder({ dispatch }, param){
|
||||||
|
let response = [];
|
||||||
|
let result = {};
|
||||||
|
|
||||||
|
result = await http.get(`file/requestorder/${param}`);
|
||||||
|
if (result.status === 200){
|
||||||
|
response = result.data;
|
||||||
|
dispatch('set_item', response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getFileRequestOrderItem({ dispatch }, param){
|
||||||
|
let response = [];
|
||||||
|
let result = {};
|
||||||
|
|
||||||
|
result = await http.get(`file/requestorder/${param}`);
|
||||||
|
if (result.status === 200){
|
||||||
|
response = result.data;
|
||||||
|
dispatch('insert_list_data', response);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async uploadFileRequestOrder({ dispatch }, item){
|
||||||
|
let response = [];
|
||||||
|
let result = {};
|
||||||
|
|
||||||
|
result = await http.post(`file/upload/requestorder/single`, item);
|
||||||
|
if (result.status === 201){
|
||||||
|
response = result.data;
|
||||||
|
//item.RequestOrderId = response;
|
||||||
|
//dispatch('add_request_order_to_list', item);
|
||||||
|
//return item;
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async getFileBatch({ dispatch }, params){
|
||||||
|
|
||||||
|
},
|
||||||
|
async uploadFileItem({ dispatch }, params){
|
||||||
|
|
||||||
|
},
|
||||||
|
async uploadFileBatch({ dispatch }, params){
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
Item({ state }) {
|
||||||
|
return state.name;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default file;
|
86
src/js/stores/geolocation.js
Normal file
86
src/js/stores/geolocation.js
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import { createStore } from 'framework7';
|
||||||
|
import { container } from 'webpack';
|
||||||
|
import { http, localForage } from './../api/config.js';
|
||||||
|
|
||||||
|
const geolocation = createStore({
|
||||||
|
state:{
|
||||||
|
position: {
|
||||||
|
// latitude: 0.00,
|
||||||
|
// longitude: 0.00,
|
||||||
|
},
|
||||||
|
container: 'map',
|
||||||
|
},
|
||||||
|
actions: {
|
||||||
|
//Mutations
|
||||||
|
setPosition({ state }, result) {
|
||||||
|
state.position = result;
|
||||||
|
},
|
||||||
|
setContainer({ state }, result){
|
||||||
|
state.container = result;
|
||||||
|
},
|
||||||
|
//End mutations
|
||||||
|
getMapLocation({ dispatch}, item){
|
||||||
|
dispatch('setContainer', item);
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
navigator.geolocation.getCurrentPosition(
|
||||||
|
position => {
|
||||||
|
resolve(this.mapSuccess(position));
|
||||||
|
},
|
||||||
|
error => { reject (this.mapError(error));
|
||||||
|
},
|
||||||
|
{ enableHighAccuracy: true }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
//navigator.geolocation.getCurrentPosition(this.mapSuccess, this.mapError, { enableHighAccuracy: true });
|
||||||
|
},
|
||||||
|
|
||||||
|
getMap (latitude, longitude){
|
||||||
|
},
|
||||||
|
|
||||||
|
getLocationData({ dispatch }){
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
navigator.geolocation.getCurrentPosition(
|
||||||
|
position => {
|
||||||
|
dispatch('setPosition', position);
|
||||||
|
resolve(position);
|
||||||
|
},
|
||||||
|
error => { reject(this.mapError(error)); },
|
||||||
|
{ enableHighAccuracy: true }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
mapSuccess(position){
|
||||||
|
let mapOptions = {
|
||||||
|
center: new google.maps.LatLng(0, 0),
|
||||||
|
zoom: 1,
|
||||||
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
||||||
|
};
|
||||||
|
const map = new google.maps.Map(document.getElementById(this.state.container), mapOptions);
|
||||||
|
const latLong = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
|
||||||
|
|
||||||
|
const marker = new google.maps.Marker({
|
||||||
|
position: latLong
|
||||||
|
});
|
||||||
|
|
||||||
|
marker.setMap(map);
|
||||||
|
map.setZoom(15);
|
||||||
|
map.setCenter(marker.getPosition());
|
||||||
|
},
|
||||||
|
|
||||||
|
mapError(error){
|
||||||
|
console.log('code: ' + error.code + '\n' +
|
||||||
|
'message: ' + error.message + '\n');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getters: {
|
||||||
|
Position({ state }){
|
||||||
|
return state.position;
|
||||||
|
},
|
||||||
|
Container({ state }) {
|
||||||
|
return state.container;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
export default geolocation;
|
@ -14,6 +14,7 @@ const theme = createStore({
|
|||||||
//End mutations
|
//End mutations
|
||||||
async checkTheme({ dispatch }, selector){
|
async checkTheme({ dispatch }, selector){
|
||||||
let theme = await localForage.getItem('theme');
|
let theme = await localForage.getItem('theme');
|
||||||
|
if (theme == null) theme = 'theme-dark';
|
||||||
if (theme != 'theme-dark'){ $(selector).removeClass('theme-dark'); }
|
if (theme != 'theme-dark'){ $(selector).removeClass('theme-dark'); }
|
||||||
dispatch('changeTheme', theme);
|
dispatch('changeTheme', theme);
|
||||||
},
|
},
|
||||||
@ -31,7 +32,7 @@ const theme = createStore({
|
|||||||
getters: {
|
getters: {
|
||||||
Name({ state }) {
|
Name({ state }) {
|
||||||
return state.name;
|
return state.name;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -7,22 +7,19 @@ const user = createStore({
|
|||||||
token: '',
|
token: '',
|
||||||
user: {},
|
user: {},
|
||||||
roles: [],
|
roles: [],
|
||||||
//location: {},
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
async setBasicData({ dispatch }, { token, user, roles/*, location*/ }){
|
async setBasicData({ dispatch }, { token, user, roles }){
|
||||||
await localForage.setItem('user', user);
|
await localForage.setItem('user', user);
|
||||||
await localForage.setItem('token', token);
|
await localForage.setItem('token', token);
|
||||||
await localForage.setItem('roles', roles);
|
await localForage.setItem('roles', roles);
|
||||||
//await localForage.setItem('location', location);
|
dispatch('auth_success', { token, user, roles});
|
||||||
dispatch('auth_success', { token, user, roles/*, location*/ });
|
|
||||||
},
|
},
|
||||||
async getBasicData({ dispatch }){
|
async getBasicData({ dispatch }){
|
||||||
const result = {
|
const result = {
|
||||||
user: await localForage.getItem('user'),
|
user: await localForage.getItem('user'),
|
||||||
token: await localForage.getItem('token'),
|
token: await localForage.getItem('token'),
|
||||||
roles: await localForage.getItem('roles'),
|
roles: await localForage.getItem('roles'),
|
||||||
//location: await localForage.getItem('location'),
|
|
||||||
}
|
}
|
||||||
dispatch('auth_success', result);
|
dispatch('auth_success', result);
|
||||||
},
|
},
|
||||||
@ -30,12 +27,20 @@ const user = createStore({
|
|||||||
await localForage.deleteItem('user');
|
await localForage.deleteItem('user');
|
||||||
await localForage.deleteItem('token');
|
await localForage.deleteItem('token');
|
||||||
await localForage.deleteItem('roles');
|
await localForage.deleteItem('roles');
|
||||||
//await localForage.deleteItem('location');
|
|
||||||
},
|
},
|
||||||
async checkData({ dispatch }){
|
async checkData({ dispatch }){
|
||||||
let token = await localForage.getItem('token');
|
let token = await localForage.getItem('token');
|
||||||
if (token != null){
|
if (token != null){
|
||||||
await dispatch('getBasicData');
|
let data = this.decodeJWT(token);
|
||||||
|
let today = new Date(); //Current date
|
||||||
|
let expirationDate = new Date(data.expiration);
|
||||||
|
|
||||||
|
if (today.getTime() < expirationDate.getTime()){
|
||||||
|
await dispatch('getBasicData');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
await dispatch('logOut');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async logIn({ dispatch }, data){
|
async logIn({ dispatch }, data){
|
||||||
@ -48,7 +53,6 @@ const user = createStore({
|
|||||||
|
|
||||||
delete response.data.token;
|
delete response.data.token;
|
||||||
delete response.data.roles;
|
delete response.data.roles;
|
||||||
//delete response.data.location;
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@ -64,22 +68,29 @@ const user = createStore({
|
|||||||
delete http.defaults.headers.common['Authorization'];
|
delete http.defaults.headers.common['Authorization'];
|
||||||
},
|
},
|
||||||
//Mutations
|
//Mutations
|
||||||
|
decodeJWT (token) {
|
||||||
|
let base64Url = token.split('.')[1];
|
||||||
|
let base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
||||||
|
let jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
|
||||||
|
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
||||||
|
}).join(''));
|
||||||
|
|
||||||
|
return JSON.parse(jsonPayload);
|
||||||
|
},
|
||||||
logout({ state }){
|
logout({ state }){
|
||||||
state.status = '';
|
state.status = '';
|
||||||
state.token = '';
|
state.token = '';
|
||||||
state.user = {};
|
state.user = {};
|
||||||
state.roles = [];
|
state.roles = [];
|
||||||
//state.location = {};
|
|
||||||
},
|
},
|
||||||
auth_request({ state }){
|
auth_request({ state }){
|
||||||
state.status = 'loading';
|
state.status = 'loading';
|
||||||
},
|
},
|
||||||
auth_success({ state }, { token, user, roles/*, location*/ }){
|
auth_success({ state }, { token, user, roles }){
|
||||||
state.status = 'success';
|
state.status = 'success';
|
||||||
state.token = token;
|
state.token = token;
|
||||||
state.user = user;
|
state.user = user;
|
||||||
state.roles = roles;
|
state.roles = roles;
|
||||||
//state.location = location;
|
|
||||||
},
|
},
|
||||||
auth_error({ state }){
|
auth_error({ state }){
|
||||||
state.status = 'error'
|
state.status = 'error'
|
||||||
@ -99,9 +110,6 @@ const user = createStore({
|
|||||||
roles({ state }){
|
roles({ state }){
|
||||||
return state.roles;
|
return state.roles;
|
||||||
},
|
},
|
||||||
// location({ state }){
|
|
||||||
// return state.location
|
|
||||||
// },
|
|
||||||
displayName({ state }){
|
displayName({ state }){
|
||||||
return state.user;
|
return state.user;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="title sliding">Administración de app</div>
|
<div class="title sliding">Administración de app</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
|
<a class="link icon-only">
|
||||||
|
<i class="icon material-icons color-teal">notifications
|
||||||
|
<span class="badge color-red">5</span>
|
||||||
|
</i>
|
||||||
|
</a>
|
||||||
|
<a class="link icon-only">
|
||||||
|
<i class="icon material-icons color-orange">task
|
||||||
|
<span class="badge color-red">3</span>
|
||||||
|
</i>
|
||||||
|
</a>
|
||||||
<a href="/panel-right/" class="link icon-only">
|
<a href="/panel-right/" class="link icon-only">
|
||||||
<i class="icon f7-icons if-not-md">menu</i>
|
<i class="icon material-icons">more_vert</i>
|
||||||
<i class="icon material-icons if-md">more_vert</i>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="title-large">
|
<div class="title-large">
|
||||||
@ -33,7 +42,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<a href="/about/" class="item-content item-link">
|
<a href="/about/" class="item-content item-link">
|
||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title"><i class="icon f7-icons color-lime">info_circle</i> Acerca de</div>
|
<div class="item-title"><i class="icon f7-icons color-lime">info_circle</i> Acerca de ...</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -43,7 +52,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
export default () => {
|
export default (props, { $, $f7, $on }) => {
|
||||||
|
$on('pageInit', () => {
|
||||||
|
|
||||||
|
})
|
||||||
return $render;
|
return $render;
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
@ -77,11 +77,11 @@ export default (props, { $f7, $, $on, $onMounted, $update, $f7router }) => {
|
|||||||
await themes.dispatch('checkTheme', '.panel-right');
|
await themes.dispatch('checkTheme', '.panel-right');
|
||||||
});
|
});
|
||||||
|
|
||||||
const logout = () => {
|
const logout = async () => {
|
||||||
user.dispatch('logOut').then( () => {
|
await user.dispatch('logOut');
|
||||||
$f7router.navigate('/');
|
|
||||||
$f7.toast.show( { text: "Ha cerrado sesión." });
|
$f7router.navigate('/');
|
||||||
});
|
$f7.toast.show( { text: "Ha cerrado sesión." });
|
||||||
};
|
};
|
||||||
|
|
||||||
const setTheme = async () => {
|
const setTheme = async () => {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<div class="item-inner">
|
<div class="item-inner">
|
||||||
<div class="item-title item-label">Contraseña</div>
|
<div class="item-title item-label">Contraseña</div>
|
||||||
<div class="item-input-wrap">
|
<div class="item-input-wrap">
|
||||||
<input id="password" type="password" name="password" alue="${password}" @input="${updatePassword}" placeholder="Ingresa tu contraseña" autocomplete="off" @keypress="${pressEnter}" />
|
<input id="password" type="password" name="password" value="${password}" @input="${updatePassword}" placeholder="Ingresa tu contraseña" autocomplete="off" @keypress="${pressEnter}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
@ -53,16 +53,20 @@ export default (props, { $f7, $on, $update, $f7router }) => {
|
|||||||
const updatePassword = (e) => {
|
const updatePassword = (e) => {
|
||||||
password = e.target.value;
|
password = e.target.value;
|
||||||
$update();
|
$update();
|
||||||
}
|
};
|
||||||
|
|
||||||
const checkLogin = () => {
|
const checkLogin = async () => {
|
||||||
$f7.preloader.show();
|
$f7.preloader.show();
|
||||||
const data = {
|
|
||||||
UserData : username,
|
try {
|
||||||
UserPassword : password,
|
const data = {
|
||||||
};
|
UserData : username,
|
||||||
user.dispatch('logIn', data).then(function(result){
|
UserPassword : password,
|
||||||
|
};
|
||||||
|
|
||||||
|
const result = await user.dispatch('logIn', data);
|
||||||
$f7.preloader.hide();
|
$f7.preloader.hide();
|
||||||
|
|
||||||
if (result.status === 200){
|
if (result.status === 200){
|
||||||
$f7router.navigate('/');
|
$f7router.navigate('/');
|
||||||
$f7.toast.show( { text: "Ha iniciado sesión." });
|
$f7.toast.show( { text: "Ha iniciado sesión." });
|
||||||
@ -70,10 +74,11 @@ export default (props, { $f7, $on, $update, $f7router }) => {
|
|||||||
else{
|
else{
|
||||||
$f7.toast.show( { text: result.message });
|
$f7.toast.show( { text: result.message });
|
||||||
}
|
}
|
||||||
}).catch(function(error){
|
}
|
||||||
|
catch (error) {
|
||||||
$f7.preloader.hide();
|
$f7.preloader.hide();
|
||||||
$f7.toast.show( { text: error.message });
|
$f7.toast.show( { text: error.message });
|
||||||
});
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const pressEnter = (e) => {
|
const pressEnter = (e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user