Browse Source

登录功能完善

nanMing 1 year ago
parent
commit
47552a7159
4 changed files with 63 additions and 72 deletions
  1. 2 5
      App.vue
  2. 0 4
      api/login.js
  3. 1 3
      pages.json
  4. 60 60
      pages/index/index.vue

+ 2 - 5
App.vue

@@ -1,12 +1,9 @@
 <script>
-  import { getToken } from '@/common/auth.js'
   export default {
-    onLaunch: (options) => {
+    onLaunch: () => {
       const openid = uni.getStorageSync('openid') || null
-      const token = getToken() || null
-      console.log(options);
       if (!openid) {
-        console.log('no id');
+        console.log('openid', openid);
         uni.reLaunch({
           url: '/pages/login/login'
         })

+ 0 - 4
api/login.js

@@ -3,11 +3,7 @@ import request from '@/common/request.js'
 // 登录方法
 export const login = (data) => {
 	return request({
-		// url: '/auth/firstLogin',
 		url: '/auth/wxlogin',
-		// headers: {
-		// 	isToken: false
-		// },
 		method: 'post',
 		data: data
 	})

+ 1 - 3
pages.json

@@ -1,5 +1,4 @@
 {
-  "lazyCodeLoading": "requiredComponents",
   "tabBar": {
     "color": "#7A7E83",
     "selectedColor": "#3cc51f",
@@ -30,8 +29,7 @@
     {
       "path": "pages/login/login",
       "style": {
-        "navigationBarTitleText": "登录",
-        "enablePullDownRefresh": true
+        "navigationBarTitleText": "登录"
       }
     },
     {

+ 60 - 60
pages/index/index.vue

@@ -1,42 +1,42 @@
 <template>
-	<view class="page-main">
-		<!-- <next-indexed-xlist :dataList="dataList" :showAvatar="true" isInterlock @itemclick="itemclick"> -->
-			<!--这是默认插槽,额外添加部分-->
-			<!--    <view class="content-block">
+  <view class="page-main">
+    <next-indexed-xlist :dataList="dataList" :showAvatar="true" isInterlock @itemclick="itemclick">
+      <!--这是默认插槽,额外添加部分-->
+      <!--    <view class="content-block">
                 <view class="title"><text>历史记录:</text></view>
                 <view class="btn"><text>朝阳区</text></view>
                 <view class="btn"><text>东城区</text></view>
                 <view class="btn"><text>海淀区</text></view>
             </view> -->
-		<!-- </next-indexed-xlist> -->
-		<navigator url="/pages/lr/index">
-			<image src="../../static/image/add.png" class="floating-button"></image>
-		</navigator>
-	</view>
+    </next-indexed-xlist>
+    <navigator url="/pages/lr/index">
+      <image src="../../static/image/add.png" class="floating-button"></image>
+    </navigator>
+  </view>
 </template>
 
 <script>
-	export default {
-		data() {
-			return {
-				dataList: [{
-					id: '1',
-					name: '刘**',
-					phone: '181****5576',
-					img: 'https://img1.baidu.com/it/u=1016138010,1907110459&fm=253&fmt=auto&app=138&f=JPEG?w=300&h=300'
+  export default {
+    data() {
+      return {
+        dataList: [{
+          id: '1',
+          name: '刘**',
+          phone: '181****5576',
+          img: 'https://img1.baidu.com/it/u=1016138010,1907110459&fm=253&fmt=auto&app=138&f=JPEG?w=300&h=300'
 				}]
-			}
+      }
 
-		},
-		computed: {},
-		onLoad() {},
-		onReady() {},
-		methods: {
-			itemclick(e) {
-				console.log('点击列表回调:', e)
-			}
-		}
-	}
+    },
+    computed: {},
+    onLoad() {},
+    onReady() {},
+    methods: {
+      itemclick(e) {
+        console.log('点击列表回调:', e)
+      }
+    }
+  }
 </script>
 
 
@@ -44,40 +44,40 @@
 
 
 <style lang="scss" scoped>
-	.content-block {
-		display: flex;
-		flex-direction: row;
-		justify-content: flex-start;
-		background-color: #fff;
+  .content-block {
+    display: flex;
+    flex-direction: row;
+    justify-content: flex-start;
+    background-color: #fff;
 
-		.title {
-			color: #333;
-			padding: 20rpx;
-			margin-right: 20rpx;
-			display: flex;
-			flex-direction: column;
-			justify-content: center;
-		}
+    .title {
+      color: #333;
+      padding: 20rpx;
+      margin-right: 20rpx;
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
+    }
 
-		.btn {
-			color: #ccc;
-			padding: 10rpx;
-			border: 1rpx solid #ccc;
-			border-radius: 10rpx;
-			margin: 20rpx 10rpx;
-			font-size: 28rpx;
-			display: flex;
-			flex-direction: column;
-			justify-content: center;
+    .btn {
+      color: #ccc;
+      padding: 10rpx;
+      border: 1rpx solid #ccc;
+      border-radius: 10rpx;
+      margin: 20rpx 10rpx;
+      font-size: 28rpx;
+      display: flex;
+      flex-direction: column;
+      justify-content: center;
 
-		}
-	}
+    }
+  }
 
-	.floating-button {
-		position: fixed;
-		bottom: 20px;
-		right: 20px;
-		width: 120rpx;
-		height: 120rpx;
-	}
+  .floating-button {
+    position: fixed;
+    bottom: 20px;
+    right: 20px;
+    width: 120rpx;
+    height: 120rpx;
+  }
 </style>