浏览代码

登录调试

lilei 3 年之前
父节点
当前提交
5af0115bfc
共有 7 个文件被更改,包括 34 次插入17 次删除
  1. 2 2
      App.vue
  2. 1 1
      api/login.js
  3. 2 4
      api/request.js
  4. 26 7
      pages/index/index.vue
  5. 二进制
      static/def_patient_boy@2x.png
  6. 二进制
      static/def_patient_girl@2x.png
  7. 3 3
      store/index.js

+ 2 - 2
App.vue

@@ -1,8 +1,8 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.16.156:9110/saas/clz/', // 本地
-			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
+			baseUrl: 'http://192.168.16.103:7904/beauty-customer/', // 本地
+			// baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},
 		onLaunch: function() {

+ 1 - 1
api/login.js

@@ -19,7 +19,7 @@ export const code2Session = params => {
 // 手机登录
 export const login = params => {
   return request({
-    url: `auth/loginVerify`,
+    url: `auth/wxloginVerify`,
     data: params,
     method: 'post',
   })

+ 2 - 4
api/request.js

@@ -12,13 +12,11 @@ function request(options) {
 	const baseUrl = getApp().globalData.baseUrl
     Object.assign(_obj, options);
 	const header = {
-			'USER-TERM-TYPE': 'ipad', // 支付时需要用到 与pad一致
-			'App-Type': 2,
 			'Version': '1.0.0',
-			'authorization': uni.getStorageSync('token')
+			'X-AUTH-TOKEN': uni.getStorageSync('token')
 	}
 	_obj.header = header
-	_obj.header['X-HEADER-APPID'] = '!z2Yc.aes|STw5oReFk+wACvW4IGVHZsFe+/MgMT9cp0amuic1gqE=';
+	_obj.header['X-HEADER-APPID'] = '!z2Yc.aes|+Dtf7OBN+iytt6MIem2RukRIvLjBhIS/whu4EuxvvFk=';
 	
     _obj.url = baseUrl + _obj.url;
     _obj.method = _obj.method.toUpperCase();

+ 26 - 7
pages/index/index.vue

@@ -4,20 +4,22 @@
 		<view class="userCard flex align_center justify_between" @click="toUser">
 			<view class="userCard-info flex align_center justify_between">
 				<view>
-					<u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="60" height="60"></u-image>
-					<open-data v-else type="userAvatarUrl" class="user-photo"></open-data>
+					<u-image v-if="!hasLogin" src="/static/def_personal_avatar.png" width="80" height="80"></u-image>
+					<u-image v-if="userInfo.sex==1" src="/static/def_patient_boy@2x.png" width="80" height="80"></u-image>
+					<u-image v-if="userInfo.sex==0" src="/static/def_patient_girl@2x.png" width="80" height="80"></u-image>
 				</view>
 				<view>
 					<view v-if="!hasLogin" style="font-size: 40rpx;">
 						请点击登录
 					</view>
-					<view v-else>
-						<view>{{userInfo.userNameCN}}</view>
-						<view>{{userInfo.orgName}}</view>
+					<view v-else style="color: gold;">
+						<view>{{userInfo.name}}</view>
+						<view>{{userInfo.mobile}}</view>
 					</view>
 				</view>
 			</view>
 			<view>
+				<text v-if="hasLogin">退出</text>
 				<u-icon name="arrow-right"></u-icon>
 			</view>
 		</view>
@@ -43,6 +45,9 @@
 				<view class="des">请登录后查看套餐记录</view>
 			</view>
 		</view>
+		<uni-popup ref="openModal" type="center">
+			<uni-popup-dialog content="确定退出登录吗?" @confirm="onOk" title="提示"></uni-popup-dialog>
+		</uni-popup>
 	</view>
 </template>
 
@@ -51,10 +56,12 @@
 	    mapState,
 	    mapMutations,
 	} from 'vuex'
+	import uniPopup from '@/components/uni-popup/uni-popup.vue'
+	import uniPopupDialog from '@/components/uni-popup/uni-popup-dialog.vue'
 	import { listLookUp, getLookUpDatas } from '@/api/data.js';
-	import { scanVinLogQueryRoll, getScanVinLogList }from '@/api/car.js'
 	export default {
 		components: {
+			uniPopup,uniPopupDialog
 		},
 		data() {
 			return {
@@ -134,8 +141,20 @@
 					uni.navigateTo({
 						url:"/pages/login/login"
 					})
+				}else{
+					// 退出登录
+					this.$refs.openModal.open()
 				}
 			},
+			onOk(){
+				this.$refs.openModal.close()
+				this.$store.dispatch('userLogout');
+				setTimeout(function(){
+					  uni.redirectTo({
+						  url: '/pages/login/login'
+					  });
+				},300)
+			},
 			toDetail(item){
 				uni.navigateTo({
 					url:"/pages/bundelDetail/index"
@@ -154,7 +173,7 @@
 		flex-direction: column;
 		.userCard{
 			padding:1.2em 1em;
-			background-image: linear-gradient(#58c4c4 10%,#65e2e2);
+			background-image: linear-gradient(#58c4c4 30%,#65e2e2);
 			.userCard-info{
 				> view{
 					&:last-child{

二进制
static/def_patient_boy@2x.png


二进制
static/def_patient_girl@2x.png


+ 3 - 3
store/index.js

@@ -52,9 +52,9 @@ const store = new Vuex.Store({
         login(state, data) {
 			console.log(data)
             state.hasLogin = true;
-			uni.setStorageSync('token', data.access_token);
-			uni.setStorageSync('userInfo', data.auth_user);
-			state.vuex_userInfo = data.auth_user
+			uni.setStorageSync('token', data.token);
+			uni.setStorageSync('userInfo', data.customer);
+			state.vuex_userInfo = data.customer
         },
         logout(state) {
             state.hasLogin = false;