Browse Source

微信自动登录

xiaohaizhao 1 year ago
parent
commit
f54f8b0f9b

+ 3 - 0
App.vue

@@ -1,7 +1,9 @@
 <script>
+import { Login } from "./utils/login"
 export default {
 	onLaunch: function () {
 		require("./utils/tool").mount();
+		new Login().wechatLogin()
 
 		/* uni.addInterceptor('navigateTo', {//监听跳转
 			success(e) {
@@ -14,6 +16,7 @@ export default {
 			}) */
 	},
 	onShow: function () {
+
 	},
 	onHide: function () {
 	}

+ 0 - 1
main.js

@@ -42,7 +42,6 @@ import {
   ApiModel
 } from './utils/api'
 Vue.prototype.$Http = new ApiModel(http);
-
 App.mpType = 'app'
 const app = new Vue({
   ...App

+ 1 - 8
pages.json

@@ -1,12 +1,5 @@
 {
 	"pages": [{
-		"path": "pages/login/login"
-	}, {
-		"path": "pages/login/selectSite",
-		"style": {
-			"navigationBarTitleText": "选择登录站点"
-		}
-	}, {
 		"path": "pages/index/index"
 	}, {
 		"path": "pages/picture/index"
@@ -76,7 +69,7 @@
 		}]
 	}],
 	"preloadRule": {
-		"pages/login/login": {
+		"pages/index/index": {
 			"network": "all",
 			"packages": ["packageCase", "packageA"]
 		}

+ 15 - 7
pages/index/index.vue

@@ -29,13 +29,21 @@ export default {
 		}
 	},
 	onShow() {
-		this.$Http.changePage = function (itemId, page, params) {
-			this.$refs.pages.onClick(itemId, page, false, params)
-		}.bind(this)
-
-		// #ifdef MP-WEIXIN
-		this.updatePageData(this.swiperItemID, this.page)
-		// #endif
+		const systemInitIsComplete = this.$Http.systemInitIsComplete;
+		if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
+			this.$Http.HomePageStartRendering = render.bind(this)
+		} else {
+			render()
+		}
+		function render() {
+			console.log(this.$Http.systemInitIsComplete)
+			this.$Http.changePage = function (itemId, page, params) {
+				this.$refs.pages.onClick(itemId, page, false, params)
+			}.bind(this)
+			// #ifdef MP-WEIXIN
+			this.updatePageData(this.swiperItemID, this.page)
+			// #endif
+		}
 	},
 	methods: {
 		updatePageData(itemId, page) {

+ 0 - 147
pages/login/login.vue

@@ -1,147 +0,0 @@
-<template>
-	<view class="container">
-		<image class="image"
-			src="https://yossys22170.obs.cn-east-2.myhuaweicloud.com:443/202309251695606306772B2018b85b.jpg"
-			mode="scaleToFill" />
-		<view class="box">
-			<view :style="{ height: height }" />
-			<view class="logo">
-				<u--image src="/static/img/LOGO-c1524a7d.svg" width="39.200vw" height="12.533vw" mode="scaleToFill">
-					<template v-slot:loading>
-						<u-loading-icon color="red"></u-loading-icon>
-					</template>
-					<view slot="error" style="font-size: 12px;">加载失败</view>
-				</u--image>
-			</view>
-			<account :isAgreement="isAgreement" v-show="loginMethod == 'account'" />
-			<phone :isAgreement="isAgreement" v-show="loginMethod == 'phone'" />
-			<view style="height: 25px;" />
-			<view class="agreement">
-				<u-checkbox :checked="isAgreement" shape="circle" @change="changeAgreement" />
-				<view @click="changeAgreement">
-					已阅读并同意
-				</view>
-				<text class="nav" @tap="checkTheAgreement">《隐私协议》</text>
-			</view>
-			<other-login :isAgreement="isAgreement" :loginMethod="loginMethod" @onChange="changeLoginMethod" />
-		</view>
-	</view>
-</template>
-<script>
-import account from "./modules/account.vue";
-import phone from "./modules/phone.vue";
-import otherLogin from "./modules/otherLogin.vue";
-export default {
-	components: {
-		account,
-		phone,
-		otherLogin
-	},
-	data() {
-		return {
-			loginMethod: "",
-			height: this.usePort == 'h5' ? "100px" : "100px",
-			isAgreement: false
-		};
-	},
-	onLoad() {
-		this.loginMethod = uni.getStorageSync('loginMethod') || 'account';//登录方式
-		if (uni.getStorageSync("isAgreement")) this.isAgreement = true;
-	},
-	methods: {
-		/* 修改登录方式 */
-		changeLoginMethod(Method) {
-			this.loginMethod = Method;
-		},
-		changeAgreement() {
-			this.isAgreement = !this.isAgreement;
-		},
-		checkTheAgreement() {
-			uni.showLoading({
-				title: '加载中...',
-			})
-			uni.downloadFile({
-				url: 'https://yossys22170.obs.cn-east-2.myhuaweicloud.com:443/202309261695715892017B6ef5bd76.docx',
-				success: (res) => {
-					uni.openDocument({
-						filePath: res.tempFilePath,
-						fileType: "docx",
-						success: (s) => {
-							uni.hideLoading();
-						},
-						fail: (err) => {
-							console.log("openDocument", err)
-							uni.hideLoading();
-							uni.showToast({
-								title: '读取失败,请稍后再试',
-								icon: "none"
-							})
-						}
-					})
-				},
-				fail: (err) => {
-					console.log("downloadFile", err)
-					uni.hideLoading();
-					uni.showToast({
-						title: '读取失败,请稍后再试',
-						icon: "none"
-					})
-				}
-			})
-		}
-	}
-}
-</script>
-
-<style lang="scss" scoped>
-.container {
-	position: relative;
-
-	.box {
-		position: fixed;
-		top: 0;
-		left: 0;
-		width: 100vw;
-		box-sizing: border-box;
-		z-index: 9;
-
-		.logo {
-			width: 147px;
-			height: 42px;
-			margin: 0 auto 50px;
-		}
-
-		.agreement {
-			display: flex;
-			justify-content: center;
-			margin: 0 auto;
-			height: 17px;
-			font-size: 12px;
-			font-weight: 400;
-			color: #fff;
-
-			.nav {
-				color: #16FFF6;
-			}
-		}
-
-		/deep/.u-checkbox__icon-wrap,
-		/deep/.u-checkbox__icon-wrap--circle {
-			width: 16px !important;
-			height: 16px !important;
-
-			.u-icon__icon {
-				font-size: 10px !important;
-			}
-		}
-	}
-
-	.image {
-		width: 100vw;
-		height: 100vh;
-		position: absolute;
-		top: 0;
-		z-index: 3;
-	}
-}
-</style>

+ 0 - 194
pages/login/modules/account.vue

@@ -1,194 +0,0 @@
-<template>
-	<view class="container">
-		<view class="input-box">
-			<view class="iconfont icon-zhanghao" />
-			<input class="input" placeholder-class="placeholder" type="text" :value="account.account" placeholder="请输入账号"
-				data-name='account' @input="onInput">
-		</view>
-		<view class="input-box" style="margin-top:15px;">
-			<view class="iconfont icon-mima" />
-			<input class="input" placeholder-class="placeholder" type="password" :value="account.password"
-				placeholder="请输入密码" data-name='password' @input="onInput">
-		</view>
-		<view class="assist">
-			<navigator class="navigator" url="#" style="display: flex; align-items: center;"
-				@click="memory = memory == '1' ? '0' : '1'">
-				<u-checkbox :checked="memory == 1" />记住密码
-			</navigator>
-
-			<!-- <navigator class="navigator" url="#">忘记密码?</navigator> -->
-		</view>
-		<u-button :customStyle="butSty" :disabled="account.account == '' || account.password == ''" :loading="loading"
-			loadingText='登陆中...' @click="startLogging">
-			<text style="font-size: 4.267vw;">
-				确 定
-			</text>
-		</u-button>
-	</view>
-</template>
-
-<script>
-import { hexMD5 } from "./md5";
-import { loginMsg } from "./dispose";
-export default {
-	name: "Account",
-	props: {
-		isAgreement: Boolean
-	},
-	data() {
-		return {
-			memory: 1,//是否记忆密码
-			loading: false,
-			account: {
-				account: "",
-				password: ""
-			},
-			butSty: {
-				width: "73.333vw",
-				height: "12.000vw",
-				background: "#0A3971",
-				borderRadius: "1.067vw",
-				opacity: "0.65",
-				borderWidth: 0,
-				fontFamily: " PingFang SC - Regular, PingFang SC",
-				color: " #FFFFFF",
-				margin: "17.867vw auto 0"
-			}
-		};
-	},
-	mounted() {
-		this.account = uni.getStorageSync("account") || {
-			account: "",
-			password: ""
-		};
-		this.memory = uni.getStorageSync("memory") || 0;
-	},
-	methods: {
-		/* 输入框输入内容 */
-		onInput(e) {
-			this.account[e.target.dataset.name] = e.detail.value;
-		},
-		/* 开始登录 */
-		startLogging() {
-			if (this.loading) return;
-			if (!this.isAgreement) return uni.showToast({
-				title: '请阅读并勾选用户协议',
-				icon: 'none',
-			})
-			this.loading = true;
-			this.$Http.login({
-				"accountno": this.account.account,
-				"password": hexMD5(this.account.password),
-				"systemclient": "marketingtool"
-			}).then(res => {
-				console.log("账号密码登录", res)
-				this.loading = false;
-				if (res.code == 0) {
-					uni.showToast({
-						title: res.msg,
-						duration: 2000,
-						icon: "none"
-					});
-				} else {
-					//存储是否记住密码 以及登录方式
-					uni.setStorageSync("memory", this.memory + '');
-					uni.setStorageSync("loginMethod", 'account')
-					uni.setStorageSync("account", {
-						account: this.account.account,
-						password: this.memory == 1 ? this.account.password : ''
-					});
-					loginMsg(res.account_list, this)
-				}
-			})
-
-		}
-	}
-}
-</script>
-
-<style lang="scss">
-.input-box {
-	display: flex;
-	align-items: center;
-	width: 275px;
-	height: 45px;
-	background: #FFFFFF;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin: 0 auto 0;
-
-	.input {
-		font-size: 14px;
-		height: 30px;
-	}
-
-	.placeholder {
-		font-size: 12px !important;
-	}
-
-	.iconfont {
-		font-size: 12px;
-		padding: 0 10px;
-		color: #052E5D;
-	}
-}
-
-.icon {
-	width: 16px;
-	height: 16px;
-	margin: 0 10px;
-}
-
-input {
-	width: 80%;
-}
-
-/* 验证码 */
-.authcode {
-	display: flex;
-	justify-content: space-between;
-	height: 45px;
-	width: 275px;
-	margin: 0 auto 0;
-}
-
-.authcode .input-box {
-	width: 170px;
-}
-
-.authcode .cu-btn {
-	width: 97px;
-	height: 45px;
-	background: #0A3971;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin-left: 8px;
-	font-size: 24px;
-	font-family: PingFang SC-Regular, PingFang SC;
-	padding: 0;
-}
-
-.icon {
-	background-color: #dd524d;
-}
-
-.assist {
-	display: flex;
-	justify-content: space-between;
-	align-items: center;
-	width: 274px;
-	margin: 13px auto 0;
-
-	.navigator {
-		padding-right: 5px;
-		font-family: PingFang SC-Regular, PingFang SC;
-		font-size: 12px !important;
-		color: #FFFFFF;
-		border-radius: 4px;
-	}
-}
-
-/deep/.u-button__loading-text {
-	font-size: 14px !important;
-}
-</style>

+ 0 - 109
pages/login/modules/dispose.js

@@ -1,109 +0,0 @@
-let count = 0; //接口完成数量
-import {
-    parsingAuth
-} from "../../../utils/auth";
-let that = null;
-
-function loginMsg(account_list, _this, storage = true) {
-    that = _this;
-    if (storage) uni.setStorageSync("account_list", account_list);
-    uni.setStorageSync("isAgreement", true);
-    if (account_list.length == 1) {
-        uni.setStorageSync('userMsg', account_list[0])
-        query_userauth();
-        // query_adspacelist();
-        querySite_Parameter();
-        querySite(that)
-    } else {
-        uni.navigateTo({
-            url: '/pages/login/selectSite'
-        })
-    }
-}
-/* 获取用户权限 */
-function query_userauth() {
-    that.$Http.basic({
-        "classname": "sysmanage.develop.userauth.userauth",
-        "method": "query_userauth",
-        content: {
-            nocache: true
-        }
-    }).then(res => {
-        console.log("查询用户权限", res)
-        if (res.msg != '成功') return uni.showToast({
-            title: res.msg,
-            icon: "none"
-        });
-        parsingAuth(res.data)
-        count += 1;
-        toHome();
-    });
-}
-/* 查询站点数据 */
-function querySite_Parameter() {
-    that.$Http.basic({
-        "classname": "webmanage.site.site",
-        "method": "querySite_Parameter", //查询站点数据
-        "content": {}
-    }).then(res => {
-        console.log("查询站点配置", res)
-        if (res.msg != '成功') return uni.showToast({
-            title: res.msg,
-            icon: "none"
-        });
-        uni.setStorageSync('siteP', res.data);
-        count += 1;
-        toHome();
-    })
-}
-
-/* 查询站点数据 */
-function querySite(that) {
-    that.$Http.basic({
-        "classname": "webmanage.site.site",
-        "method": "querySite",
-        "content": {},
-    }).then(res => {
-        console.log("查询站点数据", res)
-        if (res.msg != '成功') return uni.showToast({
-            title: res.msg,
-            icon: "none"
-        });
-        res.data.logo = res.data.attinfos.length ? that.getSpecifiedImage(res.data.attinfos.find(s => s.usetype == "actionlogo") || res.data.attinfos[0]) : ''
-        uni.setStorageSync('site', res.data);
-        count += 1;
-        toHome();
-    })
-}
-
-/* 查询轮播图 */
-function query_adspacelist() {
-    that.$Http.basic({
-        id: 20230608100802,
-        "content": {}
-    }).then(res => {
-        console.log("查询轮播图", res)
-        if (res.msg != '成功') return uni.showToast({
-            title: res.msg,
-            icon: "none"
-        });
-        uni.setStorageSync('banner_list', res.data)
-        count += 1;
-        toHome();
-    })
-}
-
-function toHome() {
-    if (count < 3) return;
-    uni.reLaunch({
-        url: '/pages/index/index',
-    });
-    count = 0;
-    /*     that.$Socket.initSocket()
-        console.log("Socket", that.$Socket) */
-}
-/* 站点数据查询 */
-module.exports = {
-    loginMsg,
-    query_userauth
-}

+ 0 - 223
pages/login/modules/md5.js

@@ -1,223 +0,0 @@
-/* 
- * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message 
- * Digest Algorithm, as defined in RFC 1321. 
- * Version 1.1 Copyright (C) Paul Johnston 1999 - 2002. 
- * Code also contributed by Greg Holt 
- * See http://pajhome.org.uk/site/legal.html for details. 
- */
-
-/* 
- * Add integers, wrapping at 2^32. This uses 16-bit operations internally 
- * to work around bugs in some JS interpreters. 
- */
-function safe_add(x, y) {
-    var lsw = (x & 0xFFFF) + (y & 0xFFFF)
-    var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
-    return (msw << 16) | (lsw & 0xFFFF)
-}
-
-/* 
- * Bitwise rotate a 32-bit number to the left. 
- */
-function rol(num, cnt) {
-    return (num << cnt) | (num >>> (32 - cnt))
-}
-
-/* 
- * These functions implement the four basic operations the algorithm uses. 
- */
-function cmn(q, a, b, x, s, t) {
-    return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b)
-}
-
-function ff(a, b, c, d, x, s, t) {
-    return cmn((b & c) | ((~b) & d), a, b, x, s, t)
-}
-
-function gg(a, b, c, d, x, s, t) {
-    return cmn((b & d) | (c & (~d)), a, b, x, s, t)
-}
-
-function hh(a, b, c, d, x, s, t) {
-    return cmn(b ^ c ^ d, a, b, x, s, t)
-}
-
-function ii(a, b, c, d, x, s, t) {
-    return cmn(c ^ (b | (~d)), a, b, x, s, t)
-}
-
-/* 
- * Calculate the MD5 of an array of little-endian words, producing an array 
- * of little-endian words. 
- */
-function coreMD5(x) {
-    var a = 1732584193
-    var b = -271733879
-    var c = -1732584194
-    var d = 271733878
-
-    for (var i = 0; i < x.length; i += 16) {
-        var olda = a
-        var oldb = b
-        var oldc = c
-        var oldd = d
-
-        a = ff(a, b, c, d, x[i + 0], 7, -680876936)
-        d = ff(d, a, b, c, x[i + 1], 12, -389564586)
-        c = ff(c, d, a, b, x[i + 2], 17, 606105819)
-        b = ff(b, c, d, a, x[i + 3], 22, -1044525330)
-        a = ff(a, b, c, d, x[i + 4], 7, -176418897)
-        d = ff(d, a, b, c, x[i + 5], 12, 1200080426)
-        c = ff(c, d, a, b, x[i + 6], 17, -1473231341)
-        b = ff(b, c, d, a, x[i + 7], 22, -45705983)
-        a = ff(a, b, c, d, x[i + 8], 7, 1770035416)
-        d = ff(d, a, b, c, x[i + 9], 12, -1958414417)
-        c = ff(c, d, a, b, x[i + 10], 17, -42063)
-        b = ff(b, c, d, a, x[i + 11], 22, -1990404162)
-        a = ff(a, b, c, d, x[i + 12], 7, 1804603682)
-        d = ff(d, a, b, c, x[i + 13], 12, -40341101)
-        c = ff(c, d, a, b, x[i + 14], 17, -1502002290)
-        b = ff(b, c, d, a, x[i + 15], 22, 1236535329)
-
-        a = gg(a, b, c, d, x[i + 1], 5, -165796510)
-        d = gg(d, a, b, c, x[i + 6], 9, -1069501632)
-        c = gg(c, d, a, b, x[i + 11], 14, 643717713)
-        b = gg(b, c, d, a, x[i + 0], 20, -373897302)
-        a = gg(a, b, c, d, x[i + 5], 5, -701558691)
-        d = gg(d, a, b, c, x[i + 10], 9, 38016083)
-        c = gg(c, d, a, b, x[i + 15], 14, -660478335)
-        b = gg(b, c, d, a, x[i + 4], 20, -405537848)
-        a = gg(a, b, c, d, x[i + 9], 5, 568446438)
-        d = gg(d, a, b, c, x[i + 14], 9, -1019803690)
-        c = gg(c, d, a, b, x[i + 3], 14, -187363961)
-        b = gg(b, c, d, a, x[i + 8], 20, 1163531501)
-        a = gg(a, b, c, d, x[i + 13], 5, -1444681467)
-        d = gg(d, a, b, c, x[i + 2], 9, -51403784)
-        c = gg(c, d, a, b, x[i + 7], 14, 1735328473)
-        b = gg(b, c, d, a, x[i + 12], 20, -1926607734)
-
-        a = hh(a, b, c, d, x[i + 5], 4, -378558)
-        d = hh(d, a, b, c, x[i + 8], 11, -2022574463)
-        c = hh(c, d, a, b, x[i + 11], 16, 1839030562)
-        b = hh(b, c, d, a, x[i + 14], 23, -35309556)
-        a = hh(a, b, c, d, x[i + 1], 4, -1530992060)
-        d = hh(d, a, b, c, x[i + 4], 11, 1272893353)
-        c = hh(c, d, a, b, x[i + 7], 16, -155497632)
-        b = hh(b, c, d, a, x[i + 10], 23, -1094730640)
-        a = hh(a, b, c, d, x[i + 13], 4, 681279174)
-        d = hh(d, a, b, c, x[i + 0], 11, -358537222)
-        c = hh(c, d, a, b, x[i + 3], 16, -722521979)
-        b = hh(b, c, d, a, x[i + 6], 23, 76029189)
-        a = hh(a, b, c, d, x[i + 9], 4, -640364487)
-        d = hh(d, a, b, c, x[i + 12], 11, -421815835)
-        c = hh(c, d, a, b, x[i + 15], 16, 530742520)
-        b = hh(b, c, d, a, x[i + 2], 23, -995338651)
-
-        a = ii(a, b, c, d, x[i + 0], 6, -198630844)
-        d = ii(d, a, b, c, x[i + 7], 10, 1126891415)
-        c = ii(c, d, a, b, x[i + 14], 15, -1416354905)
-        b = ii(b, c, d, a, x[i + 5], 21, -57434055)
-        a = ii(a, b, c, d, x[i + 12], 6, 1700485571)
-        d = ii(d, a, b, c, x[i + 3], 10, -1894986606)
-        c = ii(c, d, a, b, x[i + 10], 15, -1051523)
-        b = ii(b, c, d, a, x[i + 1], 21, -2054922799)
-        a = ii(a, b, c, d, x[i + 8], 6, 1873313359)
-        d = ii(d, a, b, c, x[i + 15], 10, -30611744)
-        c = ii(c, d, a, b, x[i + 6], 15, -1560198380)
-        b = ii(b, c, d, a, x[i + 13], 21, 1309151649)
-        a = ii(a, b, c, d, x[i + 4], 6, -145523070)
-        d = ii(d, a, b, c, x[i + 11], 10, -1120210379)
-        c = ii(c, d, a, b, x[i + 2], 15, 718787259)
-        b = ii(b, c, d, a, x[i + 9], 21, -343485551)
-
-        a = safe_add(a, olda)
-        b = safe_add(b, oldb)
-        c = safe_add(c, oldc)
-        d = safe_add(d, oldd)
-    }
-    return [a, b, c, d]
-}
-
-/* 
- * Convert an array of little-endian words to a hex string. 
- */
-function binl2hex(binarray) {
-    var hex_tab = "0123456789abcdef"
-    var str = ""
-    for (var i = 0; i < binarray.length * 4; i++) {
-        str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF) +
-            hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF)
-    }
-    return str
-}
-
-/* 
- * Convert an array of little-endian words to a base64 encoded string. 
- */
-function binl2b64(binarray) {
-    var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
-    var str = ""
-    for (var i = 0; i < binarray.length * 32; i += 6) {
-        str += tab.charAt(((binarray[i >> 5] << (i % 32)) & 0x3F) |
-            ((binarray[i >> 5 + 1] >> (32 - i % 32)) & 0x3F))
-    }
-    return str
-}
-
-/* 
- * Convert an 8-bit character string to a sequence of 16-word blocks, stored 
- * as an array, and append appropriate padding for MD4/5 calculation. 
- * If any of the characters are >255, the high byte is silently ignored. 
- */
-function str2binl(str) {
-    var nblk = ((str.length + 8) >> 6) + 1 // number of 16-word blocks  
-    var blks = new Array(nblk * 16)
-    for (var i = 0; i < nblk * 16; i++) blks[i] = 0
-    for (var i = 0; i < str.length; i++)
-        blks[i >> 2] |= (str.charCodeAt(i) & 0xFF) << ((i % 4) * 8)
-    blks[i >> 2] |= 0x80 << ((i % 4) * 8)
-    blks[nblk * 16 - 2] = str.length * 8
-    return blks
-}
-
-/* 
- * Convert a wide-character string to a sequence of 16-word blocks, stored as 
- * an array, and append appropriate padding for MD4/5 calculation. 
- */
-function strw2binl(str) {
-    var nblk = ((str.length + 4) >> 5) + 1 // number of 16-word blocks  
-    var blks = new Array(nblk * 16)
-    for (var i = 0; i < nblk * 16; i++) blks[i] = 0
-    for (var i = 0; i < str.length; i++)
-        blks[i >> 1] |= str.charCodeAt(i) << ((i % 2) * 16)
-    blks[i >> 1] |= 0x80 << ((i % 2) * 16)
-    blks[nblk * 16 - 2] = str.length * 16
-    return blks
-}
-
-/* 
- * External interface 
- */
-function hexMD5(str) {
-    return binl2hex(coreMD5(str2binl(str)))
-}
-
-function hexMD5w(str) {
-    return binl2hex(coreMD5(strw2binl(str)))
-}
-
-function b64MD5(str) {
-    return binl2b64(coreMD5(str2binl(str)))
-}
-
-function b64MD5w(str) {
-    return binl2b64(coreMD5(strw2binl(str)))
-}
-/* Backward compatibility */
-function calcMD5(str) {
-    return binl2hex(coreMD5(str2binl(str)))
-}
-module.exports = {
-    hexMD5: hexMD5,
-    hexMD5w
-}

+ 0 - 100
pages/login/modules/otherLogin.vue

@@ -1,100 +0,0 @@
-<template>
-    <view class="container">
-        <u-divider text="其他登录方式" textSize="3.2vw" textColor="#fff" lineColor="#fff" />
-        <view class="grid-box">
-            <view class="item" @click="changeLoginMethod">
-                <text class="iconfont" :class="loginMethod == 'phone' ? 'icon-zhanghaodenglu' : 'icon-shoujidenglu'" />
-            </view>
-            <view class="item" style="background-color: #28C445;" v-if="port == 'wechat'" @click="wechatLogin">
-                <u-icon name="weixin-fill" size="8vw" color="#fff"></u-icon>
-            </view>
-        </view>
-    </view>
-</template>
-
-<script>
-import { loginMsg } from "./dispose";
-export default {
-    name: "OtherLogin",
-    props: {
-        "loginMethod": String,
-        onChange: Function,
-        isAgreement: Boolean
-    },
-    data() {
-        return {
-            port: 'wechat'
-        }
-    },
-    created() {
-        // #ifndef MP
-        this.port = 'h5'
-        // #endif
-        // #ifdef MP-WEIXIN
-        this.port = 'wechat'
-        // #endif
-    },
-    methods: {
-        /* 改变登录方式 */
-        changeLoginMethod() {
-            this.$emit("onChange", this.loginMethod == 'account' ? 'phone' : 'account')
-        },
-        /* 微信登录 */
-        wechatLogin() {
-            if (!this.isAgreement) return uni.showToast({
-                title: '请阅读并勾选用户协议',
-                icon: 'none',
-            })
-            let that = this;
-            uni.login({
-                success(res) {
-                    console.log(res)
-                    return uni.setClipboardData({
-                        data: res.code,
-                        showToast: true,
-                    });
-                    that.$Http.loginbywechat({
-                        wechat_code: res.code,
-                        "systemclient": "marketingtool"
-                    }).then(res => {
-                        console.log("微信快捷登录", res)
-                        if (that.cutoff(res.msg)) return;
-                        loginMsg(res.account_list, that)
-                    })
-                }
-            })
-        },
-    },
-}
-</script>
-
-<style lang="scss" scoped>
-.container {
-    width: 275px !important;
-    margin: 0 auto;
-
-    .grid-box {
-        display: flex;
-        width: 100%;
-        justify-content: center;
-        flex-wrap: wrap;
-
-        .item {
-            display: flex;
-            justify-content: center;
-            align-items: center;
-            width: 40px;
-            height: 40px;
-            border-radius: 50%;
-            background-color: rgba($color: #fff, $alpha: .3);
-            flex-shrink: 0;
-            margin: 0 7px 7px;
-            color: #fff;
-
-            .iconfont {
-                font-size: 20px;
-            }
-        }
-    }
-}
-</style>

+ 0 - 234
pages/login/modules/phone.vue

@@ -1,234 +0,0 @@
-<template>
-	<view class="container">
-		<view class="input-box">
-			<view class="iconfont icon-shoujihao" />
-			<input class="input" placeholder-class="placeholder" type="number" :value="phoneNumber" placeholder="请输入手机号码"
-				data-name='phoneNumber' @input="onInput">
-		</view>
-		<view class="authcode" style="margin-top:15px;">
-			<view class="input-box">
-				<view class="iconfont icon-duanxinyanzheng" />
-				<input class="input" placeholder-class="placeholder" type="number" :value="password" placeholder="请输入验证码"
-					data-name='password' @input="onInput">
-			</view>
-			<button class="cu-btn bg-red" :loading='loading' @click="getAuthcode">{{ butText }}</button>
-		</view>
-		<u-button :customStyle="butSty" :disabled="phoneNumber == '' || password == ''" :loading="loading"
-			loadingText='登陆中...' @click="startLogging">
-			<text style="font-size: 4.267vw;">
-				确 定
-			</text>
-		</u-button>
-	</view>
-</template>
-
-<script>
-let countDown = null;
-import { hexMD5 } from "./md5";
-import { CheckPhoneNumber } from "../../../utils/basicInspection";
-import { loginMsg } from "./dispose";
-
-export default {
-	name: "Phone",
-	props: {
-		isAgreement: Boolean
-	},
-	data() {
-		return {
-			loading: false,
-			phoneNumber: "",
-			password: "",
-			butText: "获取验证码",
-			butSty: {
-				width: "73.333vw",
-				height: "12.000vw",
-				background: "#0A3971",
-				borderRadius: "1.067vw",
-				opacity: "0.65",
-				borderWidth: 0,
-				fontFamily: " PingFang SC - Regular, PingFang SC",
-				color: " #FFFFFF",
-				margin: "17.867vw auto 0"
-			}
-		};
-	},
-	mounted() {
-		this.phoneNumber = uni.getStorageSync("phoneNumber") || "";
-	},
-	methods: {
-		/* 获取验证码 */
-		getAuthcode() {
-			if (this.butText == '获取验证码' || this.butText == '重新获取') {
-				if (!CheckPhoneNumber(this.phoneNumber, '请输入正确的手机号码')) return;
-				this.$Http.getpassword({
-					"phonenumber": this.phoneNumber,
-					"systemclient": "marketingtool"
-				}).then(res => {
-					console.log("获取验证码", res)
-					uni.showToast({
-						title: res.msg,
-						duration: 3000,
-						icon: "none",
-					});
-					if (res.code == 0) return;
-					var count = 30;
-					this.butText = count + 's';
-					countDown = setInterval(() => {
-						if (count == 0) {
-							clearInterval(countDown);
-							this.butText = '重新获取';
-						} else {
-							count = count - 1;
-							this.butText = count + 's';
-						}
-					}, 1000)
-				});
-			};
-		},
-		/* 输入框输入内容 */
-		onInput(e) {
-			this[e.currentTarget.dataset.name] = e.detail.value;
-		},
-		/* 开始登录 */
-		startLogging() {
-			if (this.loading) return;
-			if (!this.isAgreement) return uni.showToast({
-				title: '请阅读并勾选用户协议',
-				icon: 'none',
-			})
-			if (!CheckPhoneNumber(this.phoneNumber, '请输入正确的手机号码')) return;
-			if (this.password == "") return uni.showToast({
-				title: '还未填写验证码',
-				duration: 2000,
-				icon: "none",
-			});
-			this.loading = true;
-			this.$Http.plogin({
-				"phonenumber": this.phoneNumber,
-				"password": hexMD5(this.password),
-				"systemclient": "marketingtool"
-			}).then(res => {
-				console.log("验证码登录", res)
-				this.loading = false;
-				if (res.code == 0) {
-					uni.showToast({
-						title: res.msg,
-						duration: 2000,
-						icon: "none"
-					});
-				} else {
-					uni.setStorageSync("phoneNumber", this.phoneNumber);
-					uni.setStorageSync("loginMethod", 'phone');
-					loginMsg(res.account_list, this.$Http)
-				}
-			})
-		}
-	}
-}
-</script>
-
-<style lang="scss">
-.input-box {
-	display: flex;
-	align-items: center;
-	width: 275px;
-	height: 45px;
-	background: #FFFFFF;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin: 0 auto;
-
-	.input {
-		font-size: 14px;
-		height: 30px;
-		line-height: 30px;
-	}
-
-	.placeholder {
-		font-size: 12px !important;
-	}
-
-	.iconfont {
-		font-size: 11px;
-		padding: 0 10px;
-		color: #052E5D;
-	}
-}
-
-.icon {
-	width: 16px;
-	height: 16px;
-	margin: 0 10px;
-}
-
-input {
-	width: 80%;
-}
-
-/* 验证码 */
-.authcode {
-	display: flex;
-	justify-content: space-between;
-	height: 45px;
-	width: 275px;
-	margin: 0 auto 0;
-}
-
-.authcode .input-box {
-	width: 170px;
-}
-
-.authcode .cu-btn {
-	width: 97px;
-	height: 45px;
-	background: #0A3971;
-	border-radius: 4px;
-	opacity: 0.65;
-	margin-left: 8px;
-	font-size: 12px;
-	font-family: PingFang SC-Regular, PingFang SC;
-	padding: 0;
-}
-
-.icon {
-	background-color: #dd524d;
-}
-
-/deep/uni-checkbox.blue.checked .uni-checkbox-input {
-	background-color: #0A3971 !important;
-	opacity: 0.65;
-}
-
-.assist {
-	display: flex;
-	justify-content: space-between;
-	width: 274px;
-	height: 17px;
-	font-size: 12px;
-	font-family: PingFang SC-Regular, PingFang SC;
-	color: #FFFFFF;
-	margin: 13px auto 0;
-
-	label {
-		display: flex;
-		align-items: center;
-
-		checkbox {
-			transform: scale(0.6);
-			background: #0A3971;
-			color: #0A3971;
-			border-radius: 4px;
-			opacity: 0.65;
-			border: 1px solid rgba(11, 63, 126, 0.1);
-		}
-	}
-
-	navigator {
-		padding-right: 5px;
-	}
-}
-
-/deep/.u-button__loading-text {
-	font-size: 14px !important;
-}
-</style>

+ 0 - 45
pages/login/selectSite.vue

@@ -1,45 +0,0 @@
-<template>
-    <view>
-        <navigator class="site" v-for="(item, i) in account_list" :key="item.userid" url="#" @click="selectSite(i)">
-            {{ item.sitename }}-{{ item.name }}
-        </navigator>
-    </view>
-</template>
-
-<script>
-import { loginMsg } from "./modules/dispose";
-export default {
-    name: "SelectSite",
-    data() {
-        return {
-            account_list: uni.getStorageSync('account_list')
-        }
-    },
-    methods: {
-        selectSite(index) {
-            let that = this,
-                site = this.account_list[index];
-            uni.showModal({
-                title: '提示',
-                content: `是否确定登录“${site.sitename}”站点的“${site.name}”账号`,
-                success: ({ confirm }) => {
-                    if (confirm) loginMsg([site], that, false);
-                }
-            })
-        },
-    },
-}
-</script>
-
-<style lang="scss" scoped>
-.site {
-    width: 345px;
-    border-radius: 4px;
-    background: #fff;
-    padding: 10px 15px;
-    box-sizing: border-box;
-    margin: 10px auto;
-    font-size: 14px;
-    color: #333333;
-}
-</style>

+ 0 - 28
utils/auth.js

@@ -1,28 +0,0 @@
-function parsingAuth(list) {
-    let authList = {}
-    list.forEach(system => {
-        // let systemObj = {}
-        system.modules.forEach(app => {
-            let appObj = {}
-            app.apps.forEach(m => {
-                appObj[m.meta.title] = {
-                    path: m.path,
-                    pathDetail: m.path_index,
-                    pathDetail: m.path_index,
-                    name: m.name,
-                    remark: m.meta.title,
-                    cover: m.cover,
-                    option: m.meta.auth.map(v => v.option),
-                    optionname: m.meta.auth.map(v => v.optionname)
-                }
-            })
-            // systemObj[app.systemmodulename] = appObj;
-            authList[app.systemmodulename] = appObj;
-        })
-        // authList[system.systemname] = systemObj;
-    });
-    uni.setStorageSync('authList', authList)
-}
-module.exports = {
-    parsingAuth
-}

+ 114 - 0
utils/login.js

@@ -0,0 +1,114 @@
+import Vue from 'vue'
+class Login {
+    wechatLogin() {
+        let that = this;
+        return new Promise((resolve, reject) => {
+            uni.login({
+                success(res) {
+                    Vue.prototype.$Http.loginbywechat({
+                        wechat_code: res.code,
+                        "systemclient": "marketingtool"
+                    }).then(res => {
+                        console.log("微信登录", res)
+                        if (Vue.prototype.cutoff(res.msg)) return resolve({});
+                        uni.removeStorage({
+                            key: 'userMsg',
+                        })
+                        uni.setStorageSync('userMsg', res.account_list[0])
+                        Vue.prototype.$Http.systemInitIsComplete = Promise.all([that.query_userauth(), that.querySite_Parameter(), that.querySite()]).then(res => {
+                            Vue.prototype.$Http.systemInitIsComplete = true
+                            Vue.prototype.$Http.HomePageStartRendering && Vue.prototype.$Http.HomePageStartRendering()
+                        })
+                    })
+                }
+            })
+        })
+    }
+    /* 获取用户权限 */
+    query_userauth() {
+        return new Promise((resolve, reject) => {
+            Vue.prototype.$Http.basic({
+                "classname": "sysmanage.develop.userauth.userauth",
+                "method": "query_userauth",
+                content: {
+                    nocache: true
+                }
+            }).then(res => {
+                console.log("查询用户权限", res)
+                if (Vue.prototype.cutoff(res.msg)) return resolve(false);
+                resolve(true)
+                this.parsingAuth(res.data)
+            });
+        })
+
+    }
+    /* 查询站点数据 */
+    querySite_Parameter() {
+        return new Promise((resolve, reject) => {
+            Vue.prototype.$Http.basic({
+                "classname": "webmanage.site.site",
+                "method": "querySite_Parameter", //查询站点数据
+                "content": {}
+            }).then(res => {
+                console.log("查询站点配置", res)
+                if (Vue.prototype.cutoff(res.msg)) return resolve(false);
+                uni.removeStorage({
+                    key: 'siteP',
+                })
+                uni.setStorageSync('siteP', res.data);
+                resolve(true)
+            });
+        })
+    }
+    /* 查询站点数据 */
+    querySite() {
+        return new Promise((resolve, reject) => {
+            Vue.prototype.$Http.basic({
+                "classname": "webmanage.site.site",
+                "method": "querySite",
+                "content": {},
+            }).then(res => {
+                console.log("查询站点配置", res)
+                if (Vue.prototype.cutoff(res.msg)) return resolve(false);
+                res.data.logo = res.data.attinfos.length ? Vue.prototype.getSpecifiedImage(res.data.attinfos.find(s => s.usetype == "actionlogo") || res.data.attinfos[0]) : ''
+                uni.removeStorage({
+                    key: 'site',
+                })
+                uni.setStorageSync('site', res.data);
+                resolve(true)
+            });
+        })
+    }
+    /* 格式化权限 */
+    parsingAuth(list) {
+        let authList = {}
+        list.forEach(system => {
+            // let systemObj = {}
+            system.modules.forEach(app => {
+                let appObj = {}
+                app.apps.forEach(m => {
+                    appObj[m.meta.title] = {
+                        path: m.path,
+                        pathDetail: m.path_index,
+                        pathDetail: m.path_index,
+                        name: m.name,
+                        remark: m.meta.title,
+                        cover: m.cover,
+                        option: m.meta.auth.map(v => v.option),
+                        optionname: m.meta.auth.map(v => v.optionname)
+                    }
+                })
+                // systemObj[app.systemmodulename] = appObj;
+                authList[app.systemmodulename] = appObj;
+            })
+            // authList[system.systemname] = systemObj;
+        });
+        uni.removeStorage({
+            key: 'authList'
+        })
+        uni.setStorageSync('authList', authList)
+    }
+}
+export {
+    Login
+}