1
lzhe
2024-03-24 66cca2985fedd90ec2d7ecd637df8c03ae6f1bc2
1
已删除1个文件
已添加1个文件
已修改10个文件
318 ■■■■ 文件已修改
.env.development 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
package.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/img/auth_banner.jpg 补丁 | 查看 | 原始文档 | blame | 历史
public/img/bg-login.fb434d99.jpg 补丁 | 查看 | 原始文档 | blame | 历史
src/locales/lang/zh-cn.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/request.js 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/home/widgets/components/ver.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/components/passwordForm.vue 145 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login/index.vue 94 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/other/verificate.vue 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vue.config.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
副本智能制造系统功能定义.xls 补丁 | 查看 | 原始文档 | blame | 历史
.env.development
@@ -8,10 +8,10 @@
NODE_ENV = development
# æ ‡é¢˜
VUE_APP_TITLE = CPS10.0协同智造
VUE_APP_TITLE = ç‰ˆæœ¬å·ï¼š 93.1.14 - 2024.0323
# æŽ¥å£åœ°å€
VUE_APP_API_BASEURL = https://mock.apifox.com/m1/4021385-0-default/api
VUE_APP_API_BASEURL = http://116.63.155.153:83
VUE_APP_API_MYBASEURL = https://mock.apifox.com/m1/4213246-0-default/api
# æœ¬åœ°ç«¯å£
VUE_APP_PORT = 2800
package.json
@@ -27,7 +27,8 @@
        "vuedraggable": "4.0.3",
        "vuex": "4.1.0",
        "xgplayer": "2.32.2",
        "xgplayer-hls": "2.5.2"
        "xgplayer-hls": "2.5.2",
        "qs": "6.7.0"
    },
    "devDependencies": {
        "@babel/core": "7.21.00",
public/img/auth_banner.jpg
Binary files differ
public/img/bg-login.fb434d99.jpg
src/locales/lang/zh-cn.js
@@ -1,7 +1,7 @@
export default {
    login: {
        slogan: '高性能 / ç²¾è‡´ / ä¼˜é›…',
        describe: '基于Vue3 + Element-Plus çš„中后台前端解决方案。',
        slogan: '',  //首页描述文字
        describe: '',  //首页描述文字
        signInTitle: '用户登录',
        accountLogin: '账号登录',
        mobileLogin: '手机号登录',
src/utils/request.js
@@ -79,6 +79,18 @@
        return Promise.reject(error.response);
    }
);
function qsStringify(obj) {
  return Object.keys(obj)
    .map(key => {
      if (Array.isArray(obj[key])) {
        return obj[key]
          .map(arrayValue => `${encodeURIComponent(key)}=${encodeURIComponent(arrayValue)}`)
          .join('&');
      }
      return `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`;
    })
    .join('&');
}
var http = {
@@ -102,7 +114,7 @@
        })
    },
    /** post è¯·æ±‚
    /** post è¯·æ±‚ request payload
     * @param  {string} url æŽ¥å£åœ°å€
     * @param  {object} data è¯·æ±‚参数
     * @param  {object} config å‚æ•°
@@ -121,7 +133,26 @@
            })
        })
    },
    /** post è¯·æ±‚ query string parameters
     * @param  {string} url æŽ¥å£åœ°å€
     * @param  {object} data è¯·æ±‚参数
     * @param  {object} config å‚æ•°
     */
     postJ: function(url, data={}, config={}) {
        return new Promise((resolve, reject) => {
            axios({
                method: 'post',
                url: url,
                headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8','Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0'},
                data: qsStringify(data),
                ...config
            }).then((response) => {
                resolve(response.data);
            }).catch((error) => {
                reject(error);
            })
        })
    },
    /** put è¯·æ±‚
     * @param  {string} url æŽ¥å£åœ°å€
     * @param  {object} data è¯·æ±‚参数
src/views/home/widgets/components/ver.vue
@@ -27,8 +27,7 @@
        },
        methods: {
            async getVer(){
                const ver = await this.$API.demo.ver.get()
                this.ver = ver.data
                this.ver = "1.0.0"
            },
            golog(){
                window.open("https://gitee.com/lolicode/scui/releases")
src/views/login/components/passwordForm.vue
@@ -1,32 +1,15 @@
<template>
    <el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large" @keyup.enter="login">
    <el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large" @keyup.enter="login" class="login-form">
        <el-form-item prop="user">
            <el-input v-model="form.user" prefix-icon="el-icon-user" clearable :placeholder="$t('login.userPlaceholder')">
                <template #append>
                    <el-select v-model="userType" style="width: 130px;">
                        <el-option :label="$t('login.admin')" value="admin"></el-option>
                        <el-option :label="$t('login.user')" value="user"></el-option>
                    </el-select>
                </template>
            <el-input v-model="form.user" prefix-icon="el-icon-user" clearable :placeholder="$t('login.userPlaceholder')" class="inputHeight">
            </el-input>
        </el-form-item>
        <el-form-item prop="password">
            <el-input v-model="form.password" prefix-icon="el-icon-lock" clearable show-password :placeholder="$t('login.PWPlaceholder')"></el-input>
        </el-form-item>
        <el-form-item style="margin-bottom: 10px;">
                <el-col :span="12">
                    <el-checkbox :label="$t('login.rememberMe')" v-model="form.autologin"></el-checkbox>
                </el-col>
                <el-col :span="12" class="login-forgot">
                    <router-link to="/reset_password">{{ $t('login.forgetPassword') }}?</router-link>
                </el-col>
            <el-input v-model="form.password" prefix-icon="el-icon-lock" clearable show-password :placeholder="$t('login.PWPlaceholder')" class="inputHeight"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="primary" style="width: 100%;" :loading="islogin" round @click="login">{{ $t('login.signIn') }}</el-button>
            <el-button type="primary" style="width: 100%;" :loading="islogin" @click="login">{{ $t('login.signIn') }}</el-button>
        </el-form-item>
        <div class="login-reg">
            {{$t('login.noAccount')}} <router-link to="/user_register">{{$t('login.createAccount')}}</router-link>
        </div>
    </el-form>
</template>
@@ -63,65 +46,99 @@
            }
        },
        mounted() {
            //this.$HTTP.get('/api/blade-sync/outer-app-config/appStatus')
        },
        methods: {
            async login(){
                var validate = await this.$refs.loginForm.validate().catch(()=>{})
                if(!validate){ return false }
                this.islogin = true
                var data = {
                    username: this.form.user,
                    password: this.$TOOL.crypto.MD5(this.form.password)
                }
                //获取token
                var user = await this.$API.auth.token.post(data)
                if(user.code == 200){
                    this.$TOOL.cookie.set("TOKEN", user.data.token, {
                        expires: this.form.autologin? 24*60*60 : 0
                    })
                    this.$TOOL.data.set("USER_INFO", user.data.userInfo)
                }else{
                    this.islogin = false
                    this.$message.warning(user.message)
                    return false
                    //password: this.$TOOL.crypto.MD5(this.form.password)
                    password: this.form.password,
                    tenantId: "000000",
                    grant_type: "password",
                    scope: "all"
                }
                //获取菜单
                var menu = null
                if(this.form.user == 'admin'){
                    menu = await this.$API.system.menu.myMenus.get()
                }else{
                    menu = await this.$API.demo.menu.get()
                }
                if(menu.code == 200){
                    if(menu.data.menu.length==0){
                        this.islogin = false
                        this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
                            type: 'error',
                            center: true
                        })
                        return false
                    }
                    this.$TOOL.data.set("MENU", menu.data.menu)
                    this.$TOOL.data.set("PERMISSIONS", menu.data.permissions)
                    this.$TOOL.data.set("DASHBOARDGRID", menu.data.dashboardGrid)
                }else{
                    this.islogin = false
                    this.$message.warning(menu.message)
                    return false
                }
                // var menu = null
                // if(this.form.user == 'admin'){
                //     menu = await this.$API.system.menu.myMenus.get()
                // }else{
                //     menu = await this.$API.demo.menu.get()
                // }
                // if(menu.code == 200){
                //     if(menu.data.menu.length==0){
                //         this.islogin = false
                //         this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
                //             type: 'error',
                //             center: true
                //         })
                //         return false
                //     }
                //     this.$TOOL.data.set("MENU", menu.data.menu)
                //     this.$TOOL.data.set("PERMISSIONS", menu.data.permissions)
                //     this.$TOOL.data.set("DASHBOARDGRID", menu.data.dashboardGrid)
                // }else{
                //     this.islogin = false
                //     this.$message.warning(menu.message)
                //     return false
                // }
                this.$router.replace({
                    path: '/'
                // this.$router.replace({
                //     path: '/'
                // })
                // this.$message.success("Login Success ç™»å½•成功")
                // this.islogin = false
                this.$HTTP.postJ("/api/blade-auth/oauth/token",data).then(res=> {
                    if(res.user_id) {
                        //获取token
                        this.$TOOL.cookie.set("TOKEN", res.access_token, {
                            expires: this.form.autologin? 24*60*60 : 0
                        })
                        res.userName = res.user_name;
                        res.role = ["SA", "admin", "Auditor"];
                        res.dashboard = "0";
                        res.userId =  "1";
                        this.$TOOL.data.set("USER_INFO", res);
                        //获取菜单
                        this.$API.system.menu.myMenus.get().then(resp=> {
                            if(resp.data.menu.length==0){
                                this.islogin = false
                                this.$alert("当前用户无任何菜单权限,请联系系统管理员", "无权限访问", {
                                    type: 'error',
                                    center: true
                                })
                                return false
                            }
                            this.$TOOL.data.set("MENU", resp.data.menu)
                            this.$TOOL.data.set("PERMISSIONS", resp.data.permissions)
                            this.$TOOL.data.set("DASHBOARDGRID", resp.data.dashboardGrid)
                        });
                        this.$router.replace({
                            path: '/'
                        })
                        this.$message.success("Login Success ç™»å½•成功")
                        this.islogin = false
                    }else {
                        this.islogin = false;
                        this.$message({
                          showClose: true,
                          message: res.error_description,
                          type: 'error'
                        });
                    }
                })
                this.$message.success("Login Success ç™»å½•成功")
                this.islogin = false
            },
        }
    }
</script>
<style>
.login-form {margin: 0 auto;margin-top: 46px;width: 354px;}
.inputHeight {height: 60px;line-height: 60px;}
</style>
src/views/login/index.vue
@@ -1,84 +1,25 @@
<template>
    <div class="login_bg">
        <div class="login_adv" style="background-image: url(img/auth_banner.jpg);">
            <div class="login_adv__title">
                <h2>SCUI</h2>
                <h4>{{ $t('login.slogan') }}</h4>
                <p>{{ $t('login.describe') }}</p>
                <div>
                    <span>
                        <el-icon><sc-icon-vue /></el-icon>
                    </span>
                    <span>
                        <el-icon class="add"><el-icon-plus /></el-icon>
                    </span>
                    <span>
                        <el-icon><el-icon-eleme-filled /></el-icon>
                    </span>
                </div>
            </div>
            <div class="login_adv__mask"></div>
        <div class="login_adv" style="background-image: url(img/bg-login.fb434d99.jpg);">
            <div class="login_adv__bottom">
                Â© {{$CONFIG.APP_NAME}} {{$CONFIG.APP_VER}}
                Â© {{$CONFIG.APP_NAME}}
            </div>
        </div>
        <div class="login_main">
            <div class="login_config">
                <el-button :icon="config.dark?'el-icon-sunny':'el-icon-moon'" circle type="info" @click="configDark"></el-button>
                <el-dropdown trigger="click" placement="bottom-end" @command="configLang">
                    <el-button circle>
                        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 512 512"><path d="M478.33 433.6l-90-218a22 22 0 0 0-40.67 0l-90 218a22 22 0 1 0 40.67 16.79L316.66 406h102.67l18.33 44.39A22 22 0 0 0 458 464a22 22 0 0 0 20.32-30.4zM334.83 362L368 281.65L401.17 362z" fill="currentColor"></path><path d="M267.84 342.92a22 22 0 0 0-4.89-30.7c-.2-.15-15-11.13-36.49-34.73c39.65-53.68 62.11-114.75 71.27-143.49H330a22 22 0 0 0 0-44H214V70a22 22 0 0 0-44 0v20H54a22 22 0 0 0 0 44h197.25c-9.52 26.95-27.05 69.5-53.79 108.36c-31.41-41.68-43.08-68.65-43.17-68.87a22 22 0 0 0-40.58 17c.58 1.38 14.55 34.23 52.86 83.93c.92 1.19 1.83 2.35 2.74 3.51c-39.24 44.35-77.74 71.86-93.85 80.74a22 22 0 1 0 21.07 38.63c2.16-1.18 48.6-26.89 101.63-85.59c22.52 24.08 38 35.44 38.93 36.1a22 22 0 0 0 30.75-4.9z" fill="currentColor"></path></svg>
                    </el-button>
                    <template #dropdown>
                        <el-dropdown-menu>
                            <el-dropdown-item v-for="item in lang" :key="item.value" :command="item" :class="{'selected':config.lang==item.value}">{{item.name}}</el-dropdown-item>
                        </el-dropdown-menu>
                    </template>
                </el-dropdown>
            </div>
            <div class="login-form">
                <div class="login-header">
                    <div class="logo">
                        <img :alt="$CONFIG.APP_NAME" src="img/logo.png">
                        <label>{{$CONFIG.APP_NAME}}</label>
                    </div>
                </div>
                <el-tabs>
                    <el-tab-pane :label="$t('login.accountLogin')" lazy>
                        <password-form></password-form>
                    </el-tab-pane>
                    <el-tab-pane :label="$t('login.mobileLogin')" lazy>
                        <phone-form></phone-form>
                    </el-tab-pane>
                </el-tabs>
                <template v-if="$CONFIG.MY_SHOW_LOGIN_OAUTH">
                    <el-divider>{{ $t('login.signInOther') }}</el-divider>
                    <div class="login-oauth">
                        <el-button type="success" icon="sc-icon-wechat" circle @click="wechatLogin"></el-button>
                    </div>
                </template>
                <div class="title-name">协同制造管理系统</div>
                <password-form></password-form>
            </div>
        </div>
    </div>
    <el-dialog v-model="showWechatLogin" :title="$t('login.wechatLoginTitle')" :width="400" destroy-on-close>
        <div class="qrCodeLogin">
            <sc-qr-code class="qrCode" :text="WechatLoginCode" :size="200"></sc-qr-code>
            <p class="msg">{{$tc('login.wechatLoginMsg', 1)}}<br/>{{$tc('login.wechatLoginMsg', 2)}}</p>
            <div class="qrCodeLogin-result" v-if="isWechatLoginResult">
                <el-result icon="success" :title="$tc('login.wechatLoginResult', 1)" :sub-title="$tc('login.wechatLoginResult', 2)"></el-result>
            </div>
        </div>
    </el-dialog>
</template>
<script>
    import passwordForm from './components/passwordForm'
    import phoneForm from './components/phoneForm'
    export default {
        components: {
            passwordForm,
            phoneForm
            passwordForm
        },
        data() {
            return {
@@ -95,10 +36,7 @@
                        name: 'English',
                        value: 'en',
                    }
                ],
                WechatLoginCode: "",
                showWechatLogin: false,
                isWechatLoginResult: false
                ]
            }
        },
        watch:{
@@ -134,14 +72,6 @@
            },
            configLang(command){
                this.config.lang = command.value
            },
            wechatLogin(){
                this.showWechatLogin = true
                this.WechatLoginCode = "SCUI-823677237287236-" + new Date().getTime()
                this.isWechatLoginResult = false
                setTimeout(()=>{
                    this.isWechatLoginResult = true
                },3000)
            }
        }
    }
@@ -149,7 +79,7 @@
<style scoped>
    .login_bg {width: 100%;height: 100%;background: #fff;display: flex;}
    .login_adv {width: 33.33333%;background-color: #555;background-size: cover;background-position: center center;background-repeat: no-repeat;position: relative;}
    .login_adv {width: 100%;background-color: #555;background-size: cover;background-position: center center;background-repeat: no-repeat;position: relative;}
    .login_adv__title {color: #fff;padding: 40px;position: absolute;top:0px;left:0px;right: 0px;z-index: 2;}
    .login_adv__title h2 {font-size: 40px;}
    .login_adv__title h4 {font-size: 18px;margin-top: 10px;font-weight: normal;}
@@ -161,8 +91,8 @@
    .login_adv__bottom {position: absolute;left:0px;right: 0px;bottom: 0px;color: #fff;padding: 40px;background-image:linear-gradient(transparent, #000);z-index: 3;}
    .login_adv__mask {position: absolute;top:0px;left:0px;right: 0px;bottom: 0px;background: rgba(0,0,0,0.5);z-index: 1;}
    .login_main {flex: 1;overflow: auto;display:flex;}
    .login-form {width: 400px;margin: auto;padding:20px 0;}
    .login_main {position: absolute;top: 0;right:150px;width: 484px;height: 640px;top: 50%;-webkit-transform: translateY(-50%);transform: translateY(-50%);background: #fff;text-align: center;padding: 22px 25px 28px;}
    .login-form {}
    .login-header {margin-bottom: 40px;}
    .login-header .logo {display: flex;align-items: center;}
    .login-header .logo img {width: 40px;height: 40px;vertical-align: bottom;margin-right: 10px;}
@@ -190,14 +120,10 @@
    .qrCodeLogin img.qrCode {background: #fff;padding:20px;border-radius:10px;}
    .qrCodeLogin p.msg {margin-top: 15px;}
    .qrCodeLogin .qrCodeLogin-result {position: absolute;top:0;left:0;right: 0;bottom: 0;text-align: center;background: var(--el-mask-color);}
    @media (max-width: 1200px){
        .login-form {width: 340px;}
    }
    .title-name {font-weight: 900;font-size: 24px;color: rgb(59, 142, 142);margin-top: 56px;line-height: 24px;margin-bottom:46px;}
    @media (max-width: 1000px){
        .login_main {display: block;}
        .login_main .login_config {position: static;padding:20px 20px 0 20px;text-align: right;}
        .login-form {width:100%;padding:20px 40px;}
        .login_adv {display: none;}
    }
</style>
src/views/other/verificate.vue
@@ -76,20 +76,20 @@
                    custom: [
                        { required: true, validator: (rule, value)=>{return value === '1'}, message: '请填写数字1' , trigger:'blur'}
                    ],
                    async: [
                        {
                            required: true,
                            validator: (rule, value, callback)=>{
                                this.$API.demo.ver.get({value: value}).then(res => {
                                    if(res.data != value){
                                        return callback(new Error('请输入SCUI最新版本号:'+res.data))
                                    }
                                    callback()
                                })
                            },
                            trigger:'blur'
                        }
                    ]
                    // async: [
                    //     {
                    //         required: true,
                    //         validator: (rule, value, callback)=>{
                    //             this.$API.demo.ver.get({value: value}).then(res => {
                    //                 if(res.data != value){
                    //                     return callback(new Error('请输入SCUI最新版本号:'+res.data))
                    //                 }
                    //                 callback()
                    //             })
                    //         },
                    //         trigger:'blur'
                    //     }
                    // ]
                },
                form2: {
vue.config.js
@@ -25,7 +25,7 @@
                target: process.env.VUE_APP_API_BASEURL,
                ws: true,
                pathRewrite: {
                    '^/api': '/'
                    // '^/api': '/'
                }
            },
            '/myapi': {
¸±±¾ÖÇÄÜÖÆÔìϵͳ¹¦Äܶ¨Òå.xls
Binary files differ