lilei 4 år sedan
förälder
incheckning
80210d8dab
3 ändrade filer med 45 tillägg och 9 borttagningar
  1. 2 2
      libs/axios.js
  2. 37 6
      pages/index/index.vue
  3. 6 1
      pages/login/login.vue

+ 2 - 2
libs/axios.js

@@ -21,7 +21,7 @@ const request = (opts, hasToken) => {
 	let promise = new Promise(function(resolve, reject) {
 		uni.request(DefaultOpts).then(
 			(res) => {
-				console.log(res)
+				console.log(res,'pppp')
 				// 是否超时已跳转
 				let loginTimeOut = uni.getStorageSync('loginTimeOut');
 				if(res[0]&&res[0].errMsg.indexOf('request:fail')>=0){
@@ -39,7 +39,7 @@ const request = (opts, hasToken) => {
 				if(ret.status == '200'){
 					resolve(ret)
 				}else{
-					if(ret.status == 500 || ret.status == 401 || ret.status == '9001'){
+					if(ret.status == 500 || ret.status == 401){
 						uni.showToast({
 							icon:'none',
 							title: ret.message,

+ 37 - 6
pages/index/index.vue

@@ -4,7 +4,7 @@
 		<!-- 导航按钮 -->
 		<view class="nav">
 			<u-grid :col="4" :border="false" @click="toPage">
-				<u-grid-item :index="1">
+				<u-grid-item :index="0">
 					<u-image width="90rpx" height="90rpx" src="/static/zhinan.png"></u-image>
 					<view class="grid-text">回收分类</view>
 				</u-grid-item>
@@ -69,14 +69,24 @@
 	import {bannerList} from '@/api/banner.js'
 	import {getLookUpDatas} from '@/api/data.js'
 	import {stationList} from '@/api/station.js'
+	import { checkLogin } from '@/api/login.js'
 	export default {
 		data() {
 			return {
 				imageTopList: [],
-				stationDataList: [] //  附近网点列表
+				stationDataList: [] ,//  附近网点列表
+				hasLogin: false
 			}
 		},
 		onLoad() {
+			// 是否登录
+			checkLogin().then(res => {
+				console.log(res,'checkLogin')
+				this.hasLogin = res.status == 200
+				if(!this.hasLogin){
+					this.toLoginPage()
+				}
+			})
 			// 获取订单状态数据字典
 			this.getCodeList('RUBBISH_TYPE','vuex_rubbishType')
 			// 获取顶部轮播图
@@ -97,6 +107,9 @@
 			uni.$on("updateGoodsBuyQty",item=>{
 				this.updateGoodsBuyQty(item)
 			})
+		},
+		onShow() {
+			
 		},
 		methods: { 
 			// 获取数据字典
@@ -197,6 +210,12 @@
 					url:"/pages/goods/goods?id="+clsId
 				})
 			},
+			// 去登录
+			toLoginPage(){
+				uni.navigateTo({
+					url: '/pages/login/login'
+				})
+			},
 			// 快速导航
 			toPage(e){
 				let path=[
@@ -205,13 +224,25 @@
 					'/pages/userCenter/ldDetailed',
 					''
 				]
-				if(path[e]!=''){
+				 
+				if(e>1){
+					//判断是否登录
+					if(this.hasLogin){
+						if(path[e]!=''){
+							uni.navigateTo({
+								url: path[e]
+							})
+						}else{
+							// 核销
+							this.smHx()
+						}
+					}else{
+						this.toLoginPage()
+					}
+				}else{
 					uni.navigateTo({
 						url: path[e]
 					})
-				}else{
-					// 核销
-					this.smHx()
 				}
 			},
 			// 扫码核销

+ 6 - 1
pages/login/login.vue

@@ -14,7 +14,7 @@
 				</u-button>
 			</view>
 		</view>
-		<view>登录即代表同意<text>隐私政策</text>和<text>服务条款</text></view>
+		<view @click="toYs">登录即代表同意<text>隐私政策</text>和<text>服务条款</text></view>
 	</view>
 </template>
 
@@ -54,6 +54,11 @@
 			}
 		},
 		methods: {
+			toYs(){
+				uni.navigateTo({
+					url: '/pages/agreement/agreement'
+				})
+			},
 			getPhoneNumber(e) {
 				let _this = this
 				uni.showLoading({