chenrui 4 anni fa
parent
commit
2dd232f096

+ 9 - 2
api/user.js

@@ -5,7 +5,7 @@ import axios from '@/libs/axios.js'
 // 登录
 export const login = (params) => {
   return axios.request({
-    url: 'auth/login',
+    url: 'login',
     data: params,
     method: 'post'
   }, true)
@@ -58,7 +58,7 @@ export const logout = () => {
 // 修改密码
 export const changePwd = params => {
   return axios.request({
-    url: 'employee/changePWD',
+    url: 'user/updatePwd',
     method: 'post',
     data: {
       oldPassword: params.oldPassword,
@@ -130,4 +130,11 @@ export const getMessage = params => {
     data: params,
     method: 'post'
   })
+}
+// 获取用户信息
+export const getUserInfo = params => {
+  return axios.request({
+    url: `user/userInfo`,
+    method: 'get'
+  })
 }

+ 1 - 0
components/m-input.vue

@@ -105,6 +105,7 @@
 		/* width: 100%; */
 		flex: 1;
 		padding: 0 10px;
+		margin-top: 20rpx;
 	}
 
 	.m-input-input {

+ 8 - 7
pages.json

@@ -4,23 +4,24 @@
 	},
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
 		{
-			"path": "pages/index/index", // 首页
+			"path": "pages/login/login",
 			"style": {
-				"navigationBarTitleText": "乐色助手",
-				"enablePullDownRefresh": false
+				"navigationBarTitleText": "登录"
 			}
 		},
 		{
-			"path": "pages/login/login",
+			"path": "pages/index/index", // 首页
 			"style": {
-				"navigationBarTitleText": "登录"
+				"navigationBarTitleText": "乐色助手",
+				"enablePullDownRefresh": false
 			}
 		},
+		
 		{
 			"path": "pages/userCenter/index",
 			"style": {
 				"navigationBarTitleText": "个人中心",
-				"navigationBarBackgroundColor": "#01c9b2",
+				"navigationBarBackgroundColor": "#2ab4e5",
 				"navigationBarTextStyle": "white"
 			}
 		},
@@ -56,7 +57,7 @@
 	},
 	"tabBar": {
 		"color": "#7A7E83",
-		"selectedColor": "#01c9b2",
+		"selectedColor": "#2ab4e5",
 		"backgroundColor": "#ffffff",
 		"fontSize": "14px",
 		"list": [

+ 2 - 2
pages/index/index.vue

@@ -74,8 +74,8 @@
 					account: ''  //  支付账户
 				},
 				customBtnStyle: {  //  撤销单据  自定义按钮样式
-					borderColor: '#07c160',
-					backgroundColor: '#07c160',
+					borderColor: '#2ab4e5',
+					backgroundColor: '#2ab4e5',
 					color: '#fff'
 				}
 			}

+ 2 - 2
pages/index/searchModal.vue

@@ -62,8 +62,8 @@ export default {
 	data() {
 		return {
 			customBtnStyle: {  //  自定义按钮样式
-				borderColor: '#07c160',
-				backgroundColor: '#07c160',
+				borderColor: '#2ab4e5',
+				backgroundColor: '#2ab4e5',
 				color: '#fff'
 			},
 			isShow: this.visible, // 显示隐藏

+ 5 - 4
pages/login/login.scss

@@ -5,9 +5,9 @@
 	box-sizing: border-box;
 	.logo{
 		display: block;
-		width: 300upx;
-		height: 106upx;
-		padding-top: 200upx;
+		width: 180upx;
+		height: 180upx;
+		padding-top: 120upx;
 		margin: 0 auto;
 	}
 	.login-form{
@@ -54,7 +54,8 @@
 				display: block;
 				line-height: 84upx;
 				margin: 0 auto;
-				background-color: #298bf2;
+				background-color: #2ab4e5;
+				// background-color: #298bf2;
 				color: #fff;
 			}
 			uni-button.form-btn:after{

+ 51 - 33
pages/login/login.vue

@@ -1,11 +1,11 @@
 <template>
 	<view class="login-wrap">
 		<view v-if="!buildType" style="text-align: center;color: #999999;padding-top: 40px;">{{ envTips }}</view>
-		<image src="../../static/logo-h.png" class="logo"></image>
+		<image src="../../static/logo.jpg" class="logo"></image>
 		<form class="login-form" @submit="formSubmit">
 			<view class="form-item">
 				<u-icon size="34" color="#999" name="account"></u-icon>
-				<input v-model="form.username" class="item-inp" name="username" type="number" maxlength="11" placeholder="请输入用户名" />
+				<input v-model="form.loginName" class="item-inp" name="loginName" type="number" maxlength="11" placeholder="请输入用户名" />
 			</view>
 			<view class="form-item">
 				<u-icon size="34" color="#999" name="lock"></u-icon>
@@ -13,14 +13,8 @@
 			</view>
 			<view class="flex-box" style="margin-top: 60upx;">
 				<view class="remember-pass">
-					<checkbox-group @change="rememberChange">
-						<label>
-							<checkbox value="true" :checked="isRemember" class="login-form-checkbox" />
-							<text>记住密码</text>
-						</label>
-					</checkbox-group>
+					<u-checkbox v-model="isRemember" value="true" :size="30" :label-size="26" active-color="#2ab4e5" class="login-form-checkbox" @change="rememberChange">记住密码</u-checkbox>
 				</view>
-				<!-- <view class="forget-pass" @click="forgetPass">忘记密码</view> -->
 			</view>
 			<view class="form-btn-con">
 				<button class="form-btn" form-type="submit">登录</button>
@@ -28,13 +22,8 @@
 			</view>
 		</form>
 		<view class="authUserYs">
-			<checkbox-group @change="authuserChange">
-				<label>
-					<checkbox value="true" :checked="isAuthuserYs" class="login-form-checkbox" />
-					登录代表同意
-					<text @click="toYsPage()">章鱼车管家用户协议及隐私保护政策</text>
-				</label>
-			</checkbox-group>
+			<u-checkbox v-model="isAuthuserYs" value="true" :size="30" :label-size="26" active-color="#2ab4e5" class="login-form-checkbox" @change="authuserChange">登录代表同意</u-checkbox>
+			<text @click="toYsPage()" style="vertical-align: text-top;font-size: 26rpx;text-decoration: underline;">乐色助手用户协议及隐私保护政策</text>
 		</view>
 	</view>
 </template>
@@ -49,13 +38,13 @@ export default {
 	data() {
 		return {
 			form: {
-				username: this.$store.state.vuex_user.account,
+				loginName: this.$store.state.vuex_user.account,
 				password: this.$store.state.vuex_user.password
 			},
 			isRemember: true, //  是否记住密码
 			isAuthuserYs: false, // 是否同意隐私政策
 			envTips: '',
-			buildType: ''
+			buildType: '',
 		};
 	},
 	mounted() {
@@ -82,6 +71,22 @@ export default {
 		//#endif
 	},
 	methods: {
+		//  获取微信login  code
+		getWechatCode(){
+			const _this = this
+			wx.login({
+			  success (res) {
+			    if (res.code) {
+					//发起网络请求
+					let formData = JSON.parse(JSON.stringify(_this.form))
+					formData.code = res.code
+					_this.submitForm(formData)
+			    } else {
+					console.log('登录失败,点击“登录”重试!' + res.errMsg)
+			    }
+			  }
+			})
+		},
 		// 安卓版本更新
 		AndroidCheckUpdate(){
 			let _this = this
@@ -126,11 +131,11 @@ export default {
 		formSubmit() {
 			const _this = this;
 			//  表单校验
-			if (_this.form.username == '') {
+			if (_this.form.loginName == '') {
 				uni.showToast({ icon: 'none', title: '请输入用户名' });
 				return;
 			}
-			if (!isvalidPhone(_this.form.username)) {
+			if (!isvalidPhone(_this.form.loginName)) {
 				uni.showToast({ icon: 'none', title: '请输入正确的手机号码' });
 				return;
 			}
@@ -149,27 +154,37 @@ export default {
 			uni.showLoading({
 				title: '正在登录...'
 			});
+			// #ifdef MP-WEIXIN
+				//  获取微信login   code
+				this.getWechatCode()
+			// #endif
+			// #ifndef MP-WEIXIN
+				this.submitForm(_this.form)
+			// #endif
+		},
+		submitForm(formData){
+			const _this = this;
 			//  登录
-			login(_this.form).then(ret => {
+			login(formData).then(res => {
 				uni.hideLoading();
-				let res = ret.data ? ret.data : ret;
 				if (res.status == 200) {
-					_this.$u.vuex('vuex_token', 'Bearer ' + res.access_token);
-					_this.$u.vuex('vuex_userData', _this.fiterAuthCode(res.auth_user));
-					getApp().globalData.token = 'Bearer ' + res.access_token;
+					_this.$u.vuex('vuex_token', res.data);
+					// _this.$u.vuex('vuex_userData', _this.fiterAuthCode(res.auth_user));
+					getApp().globalData.token = res.data;
 					//登录成功将用户名密码存储到用户本地
 					if (_this.isRemember) {
 						//用户勾选“记住密码”
-						_this.$u.vuex('vuex_user.account', _this.form.username);
+						_this.$u.vuex('vuex_user.account', _this.form.loginName);
 						_this.$u.vuex('vuex_user.password', _this.form.password);
 					} else {
 						//用户没有勾选“记住密码”
 						_this.$u.vuex('vuex_user.account', '');
 						_this.$u.vuex('vuex_user.password', '');
-						_this.form.username = '';
+						_this.form.loginName = '';
 						_this.form.password = '';
 					}
 					uni.setStorageSync('loginTimeOut', 'NO');
+					console.log('登陆成功')
 					_this.toMain();
 				} else {
 					uni.showToast({ icon: 'none', title: res.message });
@@ -177,9 +192,10 @@ export default {
 			});
 		},
 		toMain() {
+			console.log('跳转')
 			// 跳转到首页
-			uni.redirectTo({
-				url: '/pages/index'
+			uni.switchTab({
+				url: '/pages/index/index'
 			});
 		},
 		//  申请试用
@@ -191,21 +207,23 @@ export default {
 		//  忘记密码
 		forgetPass() {
 			uni.navigateTo({
-				url: '/pages/login/forget-pass?username=' + this.form.username
+				url: '/pages/login/forget-pass?username=' + this.form.loginName
 			});
 		},
 		//  判断是否记住密码
 		rememberChange(e) {
-			this.isRemember = e.detail.value.length > 0;
+			this.isRemember = e.value;
+			// this.isRemember = e.detail.value.length > 0;
 		},
 		// 隐私
 		authuserChange(e) {
-			this.isAuthuserYs = e.detail.value.length > 0;
+			this.isAuthuserYs = e.value;
+			// this.isAuthuserYs = e.detail.value.length > 0;
 			this.$u.vuex('vuex_isUsrAuthYs', this.isAuthuserYs);
 		},
 		toYsPage() {
 			uni.navigateTo({
-				url: '/pages/login/userAuthYs'
+				url: '/pages/agreement/agreement'
 			});
 		}
 	}

+ 14 - 6
pages/userCenter/changePwd.vue

@@ -19,12 +19,14 @@
 		</view>
 		<!-- 消息提醒弹窗 -->
 		<view class="form-footer-btn">
-			<button @click="handleReset" type="info">
+			<!-- <button @click="handleReset" type="info">
 				重置
 			</button>
 			<button @click="handleSubmit" :loading="loading" type="primary">
 				保存
-			</button>
+			</button> -->
+			<u-button size="medium" hover-class="none" @click="handleReset">重置</u-button>
+			<u-button size="medium" hover-class="none" :loading="loading" :custom-style="customBtnStyle" @click="handleSubmit">保存</u-button>
 		</view>
 	</view>
 </template>
@@ -44,7 +46,12 @@
 				  passwdCheck: '',
 				  oldPwd: ''
 				},
-				loading: false
+				loading: false,
+				customBtnStyle: {  //  自定义按钮样式
+					borderColor: '#2ab4e5',
+					backgroundColor: '#2ab4e5',
+					color: '#fff'
+				},
 			}
 		},
 		methods:{
@@ -103,7 +110,7 @@
 					console.log(res)
 					this.messageInfo(res.message)
 					if(res.status == 200){
-						this.$store.commit("$closeWebsocket")
+						// this.$store.commit("$closeWebsocket")
 						this.$store.state.vuex_token = ''
 						this.$store.state.vuex_userData = ''
 						uni.setStorageSync('setStatusIndexFunc', 0)
@@ -151,6 +158,7 @@
 				border-radius: 10rpx;
 				line-height: 32px;
 				display: flex;
+				align-items: center;
 				.title{
 					width:140rpx;
 					display: inline-block;
@@ -175,9 +183,9 @@
 			bottom: 10rpx;
 		}
 		.form-footer-btn{
-			margin: 50upx;
+			margin: 140upx 50upx 0;
 			display: flex;
-			justify-content: center;
+			justify-content: space-between;
 		}
 		.form-footer-btn uni-button{
 			width: 50%;

+ 24 - 7
pages/userCenter/index.vue

@@ -3,11 +3,11 @@
 		<!-- 头部 -->
 		<view class="user-head">
 			<view class="user-photo">
-				<u-image width="130rpx" height="130rpx" shape="circle" :src="userAvatarUrl"></u-image>
+				<open-data type="userAvatarUrl" class="avatar"></open-data>
 			</view>
 			<view class="user-info">
-				<text class="user-name">userName</text>
-				<text class="user-phone">15778787878</text>
+				<text class="user-name">{{userInfoData.name || ''}}</text>
+				<text class="user-phone">{{userInfoData.phone || ''}}</text>
 			</view>
 		</view>
 		<!-- 列表 -->
@@ -27,22 +27,35 @@
 
 <script>
 	import {logout} from '@/api/login.js'
+	import { getUserInfo } from '@/api/user.js'
 	export default {
 		data() {
 			return {
 				quitButton: {
 					borderRadius:'100rpx',
 					fontSize:'30rpx',
-					background: '#01c9b2'
+					background: '#2ab4e5'
 				},
+				userInfoData: null,  //  用户信息
 				userAvatarUrl: ''  //  用户头像
 			};
 		},
 		onShow() {
+			this.getUserInfo()
 		},
 		onLoad() {
 		},
 		methods:{
+			//  获取用户信息
+			getUserInfo(){
+				getUserInfo().then(res => {
+					if(res.status == 200){
+						this.userInfoData = res.data
+					}else{
+						this.userInfoData = null
+					}
+				})
+			},
 			// 打开对应的页面
 			toPage(index){
 				let pageUrl=[
@@ -82,9 +95,9 @@
 				       getApp().globalData.token = ''
 				       _this.$u.vuex('vuex_token','')
 					   // 关闭socket
-					   _this.$store.commit("$closeWebsocket")
+					   // _this.$store.commit("$closeWebsocket")
 				        uni.reLaunch({
-				        	url: '/pages/index/index'
+				        	url: '/pages/login/login'
 				        })
 				      })
 				    }
@@ -99,13 +112,17 @@
 	.user-content{
 		width: 100%;
 		.user-head{
-			background: #01c9b2;
+			background: #2ab4e5;
 			display: flex;
 			align-items: center;
 			padding: 35rpx 55rpx;
 			.user-photo{
 				flex-shrink: 0;
 				margin-right: 5rpx;
+				width: 130rpx;
+				height: 130rpx;
+				border-radius: 50%;
+				overflow: hidden;
 			}
 			.user-info{
 				flex-grow: 1;

BIN
static/filter.png


BIN
static/logo-h.png


BIN
static/tabbar/home-active.png


BIN
static/tabbar/home.png


BIN
static/tabbar/record-active.png


BIN
static/tabbar/shop-active.png


BIN
static/tabbar/shop.png


BIN
static/tabbar/user-active.png