tanxue 2 月之前
父節點
當前提交
43de622d40
共有 4 個文件被更改,包括 163 次插入1 次删除
  1. 10 0
      components/password-lli/password-lli.vue
  2. 7 1
      pages.json
  3. 75 0
      pages/admin/Login/index.vue
  4. 71 0
      pages/client/Login/index.vue

+ 10 - 0
components/password-lli/password-lli.vue

@@ -42,7 +42,17 @@
 			if (window.lli && typeof window.lli.encode === 'function') {
 			} else {
 				const script = document.createElement('script')
+				//#ifndef H5
+				script.src = '/static/encode.js'
+				console.log(1111)
+				//#endif
+				
+				//#ifdef APP-PLUS
 				script.src = 'static/encode.js'
+				console.log(2222)
+				//#endif
+
+				
 				document.head.appendChild(script)
 			}
 		},

+ 7 - 1
pages.json

@@ -1,7 +1,13 @@
 {
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/Login/index",
+			"path": "pages/admin/Login/index",
+			"style": {
+				"navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/client/Login/index",
 			"style": {
 				"navigationStyle": "custom"
 			}

+ 75 - 0
pages/admin/Login/index.vue

@@ -0,0 +1,75 @@
+<template>
+	<view>
+		北京诚祥 登录页面
+		<view>
+			<!-- <button type="primary" @click="setLocalData">设置缓存</button>
+			<button type="primary" @click="setPinia">设置状态</button>
+			<button type="primary" @click="goAdminShouye">去管理首页</button>
+			<button type="warn" @click="goJiaZhengShouye">去家政首页</button> -->
+			<input type="text" v-model="userName" placeholder="请输入用户名">
+			<input type="text" v-model="password" @blur="handleUpdateLLiPassword" placeholder="请输入密码">
+			<button type="warn" @click="handleLogin">登录</button>
+		</view>
+		已加密的:{{lliPassword}}
+
+    <!--  隐藏的同步加密密码组件 非可见  -->
+		<passwordLli ref="passLLiRef" :password="password" @lli-password="onLliPassword" />
+	</view>
+</template>
+
+<script setup>
+	import cacheManager from '@/utils/cacheManager.js'
+	import * as httpApi from "@/api/login.js"
+	import passwordLli from "@/components/password-lli/password-lli.vue";
+	import {
+		ref
+	} from "vue"
+	const userName = ref('18604088413') // 用户名
+	const password = ref('1') // 密码
+	const lliPassword = ref('') // 加密后的密码
+	const passLLiRef = ref(null)
+
+	function goAdminShouye() {
+		uni.navigateTo({
+			url: "/pages/ShouYe/shouyeOne"
+		})
+	}
+
+	function goJiaZhengShouye() {
+		uni.navigateTo({
+			url: "/pages/ShouYe/shouyeTwo"
+		})
+	}
+
+	function handleUpdateLLiPassword() {
+		passLLiRef.value.lliPassword();
+	}
+
+	function onLliPassword(password) {
+		lliPassword.value = password;
+	}
+
+	function handleLogin() {
+		httpApi.login({
+			userName: userName.value,
+			password: lliPassword.value
+		}).then(res => {
+			cacheManager.set('auth', res.data)
+			console.log('登录成功')
+
+			// 目前默认跳转管理端首页
+			// uni.navigateTo({
+			// 	url: `/pages/admin/ShouYe/shouye`
+			// })
+
+			// 目前默认管理端考试页面
+			uni.navigateTo({
+				url: `/pages/admin/Jiazheng/index`
+			})
+		})
+	}
+</script>
+
+<style lang="scss">
+
+</style>

+ 71 - 0
pages/client/Login/index.vue

@@ -0,0 +1,71 @@
+<template>
+	<view>
+		北京诚祥 登录页面
+		<view>
+			<!-- <button type="primary" @click="setLocalData">设置缓存</button>
+			<button type="primary" @click="setPinia">设置状态</button>
+			<button type="primary" @click="goAdminShouye">去管理首页</button>
+			<button type="warn" @click="goJiaZhengShouye">去家政首页</button> -->
+			<input type="text" v-model="userName" placeholder="请输入用户名">
+			<input type="text" v-model="password" @blur="handleUpdateLLiPassword" placeholder="请输入密码">
+			<button type="warn" @click="handleLogin">登录</button>
+		</view>
+		已加密的:{{lliPassword}}
+
+    <!--  隐藏的同步加密密码组件 非可见  -->
+		<passwordLli ref="passLLiRef" :password="password" @lli-password="onLliPassword" />
+	</view>
+</template>
+
+<script setup>
+	import cacheManager from '@/utils/cacheManager.js'
+	import * as httpApi from "@/api/login.js"
+	import passwordLli from "@/components/password-lli/password-lli.vue";
+	import {
+		ref
+	} from "vue"
+	const userName = ref('18604088413') // 用户名
+	const password = ref('1') // 密码
+	const lliPassword = ref('') // 加密后的密码
+	const passLLiRef = ref(null)
+
+	function goAdminShouye() {
+		uni.navigateTo({
+			url: "/pages/ShouYe/shouyeOne"
+		})
+	}
+
+	function goJiaZhengShouye() {
+		uni.navigateTo({
+			url: "/pages/ShouYe/shouyeTwo"
+		})
+	}
+
+	function handleUpdateLLiPassword() {
+		passLLiRef.value.lliPassword();
+	}
+
+	function onLliPassword(password) {
+		lliPassword.value = password;
+	}
+
+	function handleLogin() {
+		httpApi.login({
+			userName: userName.value,
+			password: lliPassword.value
+		}).then(res => {
+			cacheManager.set('auth', res.data)
+			console.log('登录成功')
+
+			// 目前默认跳转管理端首页
+			// uni.navigateTo({
+			// 	url: `/pages/admin/ShouYe/shouye`
+			// })
+
+			// 目前默认管理端考试页面
+			uni.navigateTo({
+				url: `/pages/admin/Jiazheng/index`
+			})
+		})
+	}
+</script>