From 66cca2985fedd90ec2d7ecd637df8c03ae6f1bc2 Mon Sep 17 00:00:00 2001
From: lzhe <181968431@qq.com>
Date: 星期日, 24 三月 2024 09:53:03 +0800
Subject: [PATCH] 1

---
 src/utils/request.js                        |   35 +++++
 .env.development                            |    4 
 /dev/null                                   |    0 
 public/img/bg-login.fb434d99.jpg            |    0 
 src/locales/lang/zh-cn.js                   |    4 
 vue.config.js                               |    2 
 副本智能制造系统功能定义.xls                            |    0 
 src/views/login/index.vue                   |   94 +--------------
 package.json                                |    3 
 src/views/login/components/passwordForm.vue |  145 +++++++++++++----------
 src/views/home/widgets/components/ver.vue   |    3 
 src/views/other/verificate.vue              |   28 ++--
 12 files changed, 146 insertions(+), 172 deletions(-)

diff --git a/.env.development b/.env.development
index a56df6d..1573b1e 100644
--- a/.env.development
+++ b/.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
diff --git a/package.json b/package.json
index f682913..f5156b8 100644
--- a/package.json
+++ b/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",
diff --git a/public/img/auth_banner.jpg b/public/img/auth_banner.jpg
deleted file mode 100644
index 449b0ad..0000000
--- a/public/img/auth_banner.jpg
+++ /dev/null
Binary files differ
diff --git a/public/img/bg-login.fb434d99.jpg b/public/img/bg-login.fb434d99.jpg
new file mode 100644
index 0000000..70a1aa2
--- /dev/null
+++ b/public/img/bg-login.fb434d99.jpg
Binary files differ
diff --git a/src/locales/lang/zh-cn.js b/src/locales/lang/zh-cn.js
index 87c0150..70911dd 100644
--- a/src/locales/lang/zh-cn.js
+++ b/src/locales/lang/zh-cn.js
@@ -1,7 +1,7 @@
 export default {
 	login: {
-		slogan: '楂樻�ц兘 / 绮捐嚧 / 浼橀泤',
-		describe: '鍩轰簬Vue3 + Element-Plus 鐨勪腑鍚庡彴鍓嶇瑙e喅鏂规銆�',
+		slogan: '',  //棣栭〉鎻忚堪鏂囧瓧
+		describe: '',  //棣栭〉鎻忚堪鏂囧瓧
 		signInTitle: '鐢ㄦ埛鐧诲綍',
 		accountLogin: '璐﹀彿鐧诲綍',
 		mobileLogin: '鎵嬫満鍙风櫥褰�',
diff --git a/src/utils/request.js b/src/utils/request.js
index 82891d0..8834691 100644
--- a/src/utils/request.js
+++ b/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 璇锋眰鍙傛暟
diff --git a/src/views/home/widgets/components/ver.vue b/src/views/home/widgets/components/ver.vue
index d3b0d71..0725645 100644
--- a/src/views/home/widgets/components/ver.vue
+++ b/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")
diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue
index db1b966..924bd4b 100644
--- a/src/views/login/components/passwordForm.vue
+++ b/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>
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 2fa9a63..6331676 100644
--- a/src/views/login/index.vue
+++ b/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>
diff --git a/src/views/other/verificate.vue b/src/views/other/verificate.vue
index fa85dd5..6050768 100644
--- a/src/views/other/verificate.vue
+++ b/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('璇疯緭鍏CUI鏈�鏂扮増鏈彿锛�'+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('璇疯緭鍏CUI鏈�鏂扮増鏈彿锛�'+res.data))
+					// 				}
+					// 				callback()
+					// 			})
+					// 		},
+					// 		trigger:'blur'
+					// 	}
+					// ]
 				},
 				form2: {
 
diff --git a/vue.config.js b/vue.config.js
index 095362b..13af8eb 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -25,7 +25,7 @@
 				target: process.env.VUE_APP_API_BASEURL,
 				ws: true,
 				pathRewrite: {
-					'^/api': '/'
+					// '^/api': '/'
 				}
 			},
 			'/myapi': {
diff --git "a/\345\211\257\346\234\254\346\231\272\350\203\275\345\210\266\351\200\240\347\263\273\347\273\237\345\212\237\350\203\275\345\256\232\344\271\211.xls" "b/\345\211\257\346\234\254\346\231\272\350\203\275\345\210\266\351\200\240\347\263\273\347\273\237\345\212\237\350\203\275\345\256\232\344\271\211.xls"
index 5afc21d..33c598f 100644
--- "a/\345\211\257\346\234\254\346\231\272\350\203\275\345\210\266\351\200\240\347\263\273\347\273\237\345\212\237\350\203\275\345\256\232\344\271\211.xls"
+++ "b/\345\211\257\346\234\254\346\231\272\350\203\275\345\210\266\351\200\240\347\263\273\347\273\237\345\212\237\350\203\275\345\256\232\344\271\211.xls"
Binary files differ

--
Gitblit v1.9.3