Laravel Vuejs面板登录可在PC上使用,但不适用于iPhone和Android

问题描述

我用Vuejs + Vue引导程序+ metronic面板创建了一个Web应用程序 我将其上传到主机上,当我尝试使用PC登录时,它运行正常,但当我尝试使用iphone和android登录时,显示未授权...。

这是我的webpack-rtl.config.js:

/**
 * Main file of webpack config for RTL.
 * Please do not modified unless you kNow what to do
 */
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const WebpackRTLPlugin = require("webpack-rtl-plugin");
const WebpackMessages = require("webpack-messages");
const del = require("del");

// theme name
const themeName = "metronic";
// global variables
const rootPath = path.resolve(__dirname);
const distPath = rootPath + "/src/assets";

const entries = {
    "css/style.vue": "./src/assets/sass/style.vue.scss"
};

// remove older folders and files
(async () => {
    await del.sync(distPath + "/css",{ force: true });
})();

const mainConfig = function() {
    return {
        mode: "development",stats: "errors-only",performance: {
            hints: false
        },entry: entries,output: {
            // main output path in assets folder
            path: distPath,// output path based on the entries' filename
            filename: "[name].js"
        },resolve: {
            alias: {
                vue$: "vue/dist/vue.runtime.esm.js","@": path.resolve(__dirname,"src")
            },extensions: [".scss"]
        },plugins: [
            // webpack log message
            new WebpackMessages({
                name: themeName,logger: str => console.log(`>> ${str}`)
            }),// create css file
            new MiniCssExtractPlugin({
                filename: "[name].css"
            }),new WebpackRTLPlugin({
                filename: "[name].rtl.css"
            }),{
                apply: compiler => {
                    // hook name
                    compiler.hooks.afterEmit.tap("AfterEmitPlugin",() => {
                        (async () => {
                            await del.sync(distPath + "/css/*.js",{
                                force: true
                            });
                        })();
                    });
                }
            }
        ],module: {
            rules: [
                {
                    test: /\.scss$/,use: [
                        MiniCssExtractPlugin.loader,"css-loader",{
                            loader: "sass-loader",options: {
                                sourceMap: true
                            }
                        }
                    ]
                }
            ]
        }
    };
};

module.exports = function() {
    return [mainConfig()];
};

这是我的laravel登录方法


   public function login(Request $request)
    {
        if (!Auth::attempt($request->only(['email','password']))){
            dump(Auth::attempt($request->only(['email','password'])),$request->all());
            return response()->json(['message' => 'Unauthorized'],401);
        }

        $user = Auth::user();

        $tokenResult = $user->createtoken('authToken');
        $token = $tokenResult->token;

        if ($request->has('remember_me'))
            $token->expires_at = Now()->addWeeks(1);

        $token->save();

        return response()->json([
            'user' => $user,'permissions' => $user->permissions()->pluck('name')->toArray(),'access_token' => $tokenResult->accesstoken,'token_type' => 'Bearer','expires_at' => Carbon::parse($tokenResult->token->expires_at)->toDateTimeString()
        ]);
    }

如果需要更多信息,请告诉我 Tnx

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)