| | |
| | | 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 |
| | |
| | | "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", |
| | |
| | | export default { |
| | | login: { |
| | | slogan: '髿§è½ / ç²¾è´ / ä¼é
', |
| | | describe: 'åºäºVue3 + Element-Plus çä¸åå°åç«¯è§£å³æ¹æ¡ã', |
| | | slogan: '', //é¦é¡µæè¿°æå |
| | | describe: '', //é¦é¡µæè¿°æå |
| | | signInTitle: 'ç¨æ·ç»å½', |
| | | accountLogin: 'è´¦å·ç»å½', |
| | | mobileLogin: 'ææºå·ç»å½', |
| | |
| | | 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 = { |
| | | |
| | |
| | | }) |
| | | }, |
| | | |
| | | /** post è¯·æ± |
| | | /** post è¯·æ± request payload |
| | | * @param {string} url æ¥å£å°å |
| | | * @param {object} data 请æ±åæ° |
| | | * @param {object} config åæ° |
| | |
| | | }) |
| | | }) |
| | | }, |
| | | |
| | | /** 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 请æ±åæ° |
| | |
| | | }, |
| | | 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") |
| | |
| | | <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> |
| | | |
| | |
| | | } |
| | | }, |
| | | 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){ |
| | | // 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.$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', |
| | |
| | | }) |
| | | 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.$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' |
| | | }); |
| | | } |
| | | }) |
| | | }, |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | .login-form {margin: 0 auto;margin-top: 46px;width: 354px;} |
| | | .inputHeight {height: 60px;line-height: 60px;} |
| | | </style> |
| | |
| | | <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> |
| | | <div class="title-name">ååå¶é 管çç³»ç»</div> |
| | | <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> |
| | | </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 { |
| | |
| | | name: 'English', |
| | | value: 'en', |
| | | } |
| | | ], |
| | | WechatLoginCode: "", |
| | | showWechatLogin: false, |
| | | isWechatLoginResult: false |
| | | ] |
| | | } |
| | | }, |
| | | watch:{ |
| | |
| | | }, |
| | | 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) |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | <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;} |
| | |
| | | .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;} |
| | |
| | | .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> |
| | |
| | | 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: { |
| | | |
| | |
| | | target: process.env.VUE_APP_API_BASEURL, |
| | | ws: true, |
| | | pathRewrite: { |
| | | '^/api': '/' |
| | | // '^/api': '/' |
| | | } |
| | | }, |
| | | '/myapi': { |