Ver código fonte

增加app(安卓版)分支切换

htc 11 meses atrás
pai
commit
716bed5508

+ 17 - 7
App.vue

@@ -5,13 +5,23 @@
 		},
 		onShow: function() {
 			console.log('App Show')
-			// this.autoUpdate();
-			// if (uni.getStorageSync('userInfo')) uni.reLaunch({
-			// 	url: '/pages/home/index'
-			// })
-			// else uni.reLaunch({
-			// 	url: '/pages/login/index'
-			// })
+			this.autoUpdate();
+			// if (uni.getStorageSync('userInfo')){
+			// 	uni.reLaunch({
+			// 		url: '/pages/home/index'
+			// 	})
+			// } else{
+			//	// #ifdef APP-PLUS
+			// 		uni.reLaunch({
+			// 			url: '/pages/login/appIndex'
+			// 		})
+			// 	// #endif
+			// 	// #ifdef MP-WEIXIN
+			// 		uni.reLaunch({
+			// 			url: '/pages/login/index'
+			// 		})
+			// 	// #endif
+			// } 
 		},
 		onHide: function() {
 			console.log('App Hide')

+ 12 - 5
http/index.js

@@ -26,11 +26,18 @@ export const $http = (url, method, data, json, isAuth, isBuffer) => {
 				title: '温馨提示',
 				content: '当前登录已失效,是否重新登录?',
 				success: (res) => {
-					if (res.confirm) {
-						uni.clearStorageSync();
-						uni.reLaunch({
-							url: '/pages/login/index'
-						})
+					if (res.confirm) {
+						uni.clearStorageSync();
+						// #ifdef APP-PLUS
+							uni.reLaunch({
+								url: '/pages/login/appIndex'
+							})
+						// #endif
+						// #ifdef MP-WEIXIN
+							uni.reLaunch({
+								url: '/pages/login/index'
+							})
+						// #endif
 					}
 				}
 			})

+ 38 - 3
manifest.json

@@ -1,6 +1,6 @@
 {
-    "name" : "hotelHomestay",
-    "appid" : "__UNI__3A1C8AF",
+    "name" : "嵊泗商户端",
+    "appid" : "__UNI__40A92BD",
     "description" : "",
     "versionName" : "1.0.0",
     "versionCode" : "100",
@@ -43,7 +43,9 @@
                 ]
             },
             /* ios打包配置 */
-            "ios" : {},
+            "ios" : {
+                "dSYMs" : false
+            },
             /* SDK配置 */
             "sdkConfigs" : {
                 "maps" : {
@@ -52,6 +54,39 @@
                         "appkey_ios" : "b4dc067f2a3f52770d4c47d96a0499a9",
                         "appkey_android" : "b4dc067f2a3f52770d4c47d96a0499a9"
                     }
+                },
+                "ad" : {}
+            },
+            "icons" : {
+                "android" : {
+                    "hdpi" : "unpackage/res/icons/72x72.png",
+                    "xhdpi" : "unpackage/res/icons/96x96.png",
+                    "xxhdpi" : "unpackage/res/icons/144x144.png",
+                    "xxxhdpi" : "unpackage/res/icons/192x192.png"
+                },
+                "ios" : {
+                    "appstore" : "unpackage/res/icons/1024x1024.png",
+                    "ipad" : {
+                        "app" : "unpackage/res/icons/76x76.png",
+                        "app@2x" : "unpackage/res/icons/152x152.png",
+                        "notification" : "unpackage/res/icons/20x20.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "proapp@2x" : "unpackage/res/icons/167x167.png",
+                        "settings" : "unpackage/res/icons/29x29.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "spotlight" : "unpackage/res/icons/40x40.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png"
+                    },
+                    "iphone" : {
+                        "app@2x" : "unpackage/res/icons/120x120.png",
+                        "app@3x" : "unpackage/res/icons/180x180.png",
+                        "notification@2x" : "unpackage/res/icons/40x40.png",
+                        "notification@3x" : "unpackage/res/icons/60x60.png",
+                        "settings@2x" : "unpackage/res/icons/58x58.png",
+                        "settings@3x" : "unpackage/res/icons/87x87.png",
+                        "spotlight@2x" : "unpackage/res/icons/80x80.png",
+                        "spotlight@3x" : "unpackage/res/icons/120x120.png"
+                    }
                 }
             }
         }

+ 7 - 0
pages.json

@@ -38,6 +38,13 @@
 				"navigationStyle": "custom"
 			}
 		},
+		{
+			"path": "pages/login/appIndex",
+			"style": {
+				"navigationBarTitleText": "登录",
+				"navigationStyle": "custom"
+			}
+		},
 		{
 			"path": "pages/login/forgot",
 			"style": {

+ 152 - 0
pages/login/appIndex.vue

@@ -0,0 +1,152 @@
+<template>
+	<view class="page" :style="{'min-height':h+'px'}">
+		<view class="box">
+			<view class="text">您好!欢迎使用<br>游嵊泗商家服务平台</view>
+			<view class="login">
+				<view class="item">
+					<u--input
+						placeholder="用户名"
+						prefixIcon="account-fill"
+						prefixIconStyle="font-size: 22px;color: #909399"
+						labelColor="#ffffff"
+						v-model="dataFrom.username"
+					></u--input>
+				</view>
+				<view class="item">
+					<u--input
+						placeholder="密码"
+						prefixIcon="lock-fill"
+						prefixIconStyle="font-size: 22px;color: #909399"
+						labelColor="#ffffff"
+						type="password"
+						v-model="dataFrom.password"
+					></u--input>
+				</view>
+				<!-- <view class="item" @click="typeShow=true">
+					<u--input
+						placeholder="类型"
+						prefixIcon="coupon-fill"
+						suffixIcon="arrow-down"
+						prefixIconStyle="font-size: 22px;color: #909399"
+						suffixIconStyle="font-size: 22px;color: #909399"
+						readonly
+						v-model="userType"
+					></u--input>
+				</view> -->
+				<button @click="login">登录</button>
+				<u-picker :show="typeShow" :columns="columns" @close="typeShow=false" @cancel="typeShow=false" @confirm="confirm"></u-picker>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				typeShow:false,
+				userType:'',
+				columns:[['酒店民宿','商家']],
+				typeCfg:{'酒店民宿':'1','商家':'2'},
+				dataFrom:{
+					username:'',
+					password:'',
+					usertype:'1',
+					captcha:'666',
+					uuid: "",
+					grant_type: "password",
+				}
+			}
+		},
+		onLoad() {
+			uni.clearStorageSync();
+		},
+		methods: {
+			confirm(e){
+				this.userType = e.value[0];
+				this.typeShow = false;
+			},
+			login(){
+				// this.dataFrom.usertype = this.typeCfg[this.userType]||'';
+				if(!this.dataFrom.username) return this.$showToast('请输入用户名');
+				if(!this.dataFrom.password) return this.$showToast('请输入密码');
+				// if(!this.dataFrom.usertype) return this.$showToast('请选择类型');
+				
+				uni.setStorageSync('authorization','Basic cmVucmVuaW86cmVucmVuaW8=');
+				let that = this;
+				this.$api.post("/auth/oauth/token", {
+					...this.dataFrom,
+					username: this.dataFrom.username + "&&" + `${this.dataFrom.usertype}`,
+				},false,true).then(res=>{
+					if(res.data.code==0){
+						uni.setStorageSync('authorization',res.data.token_type+' '+res.data.access_token);
+						uni.setStorageSync('access_token',res.data.access_token);
+						that.$api.get('/sys/user/info').then(resu=>{
+							if(resu.data.code===0){
+								that.$showToast('登录成功');
+								uni.setStorageSync('userInfo',resu.data.data);
+								setTimeout(()=>{
+									uni.reLaunch({
+										url:'/pages/login/select?userInfo='+encodeURIComponent(JSON.stringify(resu.data.data))
+									})
+								},1500)
+							}else that.$showToast(resu.data.msg)
+						})
+					}else that.$showToast(res.data.msg)
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="less">
+	.page{
+		background: url(https://i.ringzle.com/file/20240109/472b6b7b9ea44652b85e73c796876378.png) no-repeat;
+		background-size: 100% 100%;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		.box{
+			width: calc(100% - 180rpx);
+			display: flex;
+			flex-direction: column;
+			align-items: center;
+			image{
+				width: 480rpx;
+				height: 520rpx;
+			}
+			.text{
+				text-align: center;
+				font-size: 56rpx;
+				font-family: PingFang SC, PingFang SC;
+				font-weight: 800;
+				color: #FFFFFF;
+				line-height: 96rpx;
+			}
+			.login{
+				margin-top: 80rpx;
+				width: 100%;
+				
+				.item{
+					margin-bottom: 40rpx;
+					::v-deep input{
+						color: #FFFFFF !important;
+					}
+				}
+				
+				button{
+					width: 100%;
+					height: 100%;
+					background: #FFFFFF;
+					border-radius: 48rpx 48rpx 48rpx 48rpx;
+					line-height: 96rpx;
+					text-align: center;
+					font-size: 34rpx;
+					font-family: PingFang SC, PingFang SC;
+					font-weight: 400;
+					color: #145EE6;
+				}
+			}
+		}
+	}
+</style>

+ 27 - 3
pages/login/select.vue

@@ -21,12 +21,36 @@
 				list: []
 			}
 		},
-		created() {
-			this.getType();
+		created() {
+			if(uni.getStorageSync('userInfo')) this.getType();
+			else{
+				// #ifdef APP-PLUS
+					uni.reLaunch({
+						url: '/pages/login/appIndex'
+					})
+				// #endif
+				// #ifdef MP-WEIXIN
+					uni.reLaunch({
+						url: '/pages/login/index'
+					})
+				// #endif
+			}
 		},
 		onLoad(option) {
 			//if (option.userInfo) this.userInfo = JSON.parse(decodeURIComponent(option.userInfo));
-			this.getList();
+			if(uni.getStorageSync('userInfo')) this.getList();
+			else{
+				// #ifdef APP-PLUS
+					uni.reLaunch({
+						url: '/pages/login/appIndex'
+					})
+				// #endif
+				// #ifdef MP-WEIXIN
+					uni.reLaunch({
+						url: '/pages/login/index'
+					})
+				// #endif
+			}
 		},
 		methods: {
 			goBack(e) {

+ 0 - 0
pagesHouse/除tabbar页面外其余房态相关页面存放此分包内.txt


+ 0 - 0
static/存放图片.txt