Bläddra i källkod

为线上发布修改为进入小程序可浏览非登录页面,可自行或弹框提示进行登录

htc 16 timmar sedan
förälder
incheckning
d572de247b
9 ändrade filer med 65 tillägg och 24 borttagningar
  1. 12 12
      http/index.js
  2. 3 3
      pages.json
  3. 2 1
      pages/dialog.vue
  4. 5 3
      pages/home.vue
  5. 4 3
      pages/login.vue
  6. 18 2
      pages/my.vue
  7. BIN
      static/logo.png
  8. BIN
      static/logo2.png
  9. 21 0
      utils/system.js

+ 12 - 12
http/index.js

@@ -25,18 +25,18 @@ export const $http = (url, method, data, json, isloading=true) => {
 		}
 		
 		if (response?.data?.code === 401 || response?.data?.msg.indexOf('未授权') > -1 || response?.data?.msg.indexOf('重新登录') > -1) {
-			return uni.showModal({
-				title: '温馨提示',
-				content:'当前登录已失效,是否返回重新登录',
-				success: (res) => {
-					if (res.confirm) {
-						uni.clearStorageSync();
-						uni.reLaunch({
-							url: '/pages/login'
-						})
-					}
-				}
-			})
+			// return uni.showModal({
+			// 	title: '温馨提示',
+			// 	content:'当前登录已失效,是否返回重新登录',
+			// 	success: (res) => {
+			// 		if (res.confirm) {
+			// 			uni.clearStorageSync();
+			// 			uni.reLaunch({
+			// 				url: '/pages/login'
+			// 			})
+			// 		}
+			// 	}
+			// })
 		}
 		
 		// 请根据后端规定的状态码判定

+ 3 - 3
pages.json

@@ -1,19 +1,19 @@
 {
 	"pages": [
 		{
-			"path": "pages/launch",
+			"path": "pages/home",
 			"style": {
 				"navigationStyle": "custom"
 			}
 		},
 		{
-			"path": "pages/login",
+			"path": "pages/launch",
 			"style": {
 				"navigationStyle": "custom"
 			}
 		},
 		{
-			"path": "pages/home",
+			"path": "pages/login",
 			"style": {
 				"navigationStyle": "custom"
 			}

+ 2 - 1
pages/dialog.vue

@@ -3,7 +3,7 @@
 		<u-navbar title="创衡汇教练AI智能体" bgColor="#FFFFFF" :titleStyle="{'font-size':'32rpx','font-weight':'bold'}">
 			<view class="u-nav-slot" slot="left" style="display: flex;background-color: transparent;">
 				<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/16/ef50e3e8-d0f9-41dd-a4ec-546b157a1de9.png" style="width: 45rpx;height: 45rpx;" @tap="toBack"></image>
-				<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/16/e536bf8e-3b33-4ea8-b60b-7154c6353bec.png" style="width: 42rpx;height: 42rpx;margin-left: 40rpx;" @tap="startNewDialog"></image>
+				<!-- <image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/16/e536bf8e-3b33-4ea8-b60b-7154c6353bec.png" style="width: 42rpx;height: 42rpx;margin-left: 40rpx;" @tap="startNewDialog"></image> -->
 			</view>
 		</u-navbar>
 		<template v-if="dialogList.length===0">
@@ -244,6 +244,7 @@
 			},
 			sendQuestion(){
 				if(!this.question) return this.$showToast('请输入您的问题');
+				if(!this.isLogin()) return
 				let qa = {
 					question:JSON.parse(JSON.stringify(this.question)),
 					answer:'',

+ 5 - 3
pages/home.vue

@@ -78,26 +78,28 @@
 		methods:{
 			toTurn(url){
 				if(!url) return 
+				if(url!=='/pages/dialog'&&!this.isLogin()) return
 				uni.navigateTo({
 					url
 				})
 			},
 			getWjList(){
 				this.$api.get('/core/teammember/que/listByUser').then(res=>{
-					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					// if(res.data.code!==0) return this.$showToast(res.data.msg)
+					if(res.data.code!==0) return
 					this.wjDwc = res.data.data.filter(d=>d.status===0).length;
 					this.wjYwc = res.data.data.filter(d=>d.status===1).length;
 				})
 			},
 			getReportList(){
 				this.$api.get('/core/report/member/personalReportList/2').then(res=>{
-					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					if(res.data.code!==0) return
 					this.bgGr = res.data.data.filter(d=>d.type==2).length;
 				})
 			},
 			getReportList2(){
 				this.$api.get('/core/report/member/personalReportList/1').then(res=>{
-					if(res.data.code!==0) return this.$showToast(res.data.msg)
+					if(res.data.code!==0) return
 					this.bgTd = res.data.data.filter(d=>d.type==1).length;
 				})
 			}

+ 4 - 3
pages/login.vue

@@ -2,7 +2,7 @@
 	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
 		<cus-header title='创衡汇教练AI智能体' :showback="false"></cus-header>
 		<div class="content">
-			<image src="@/static/logo.png" mode="heightFix"></image>
+			<image src="@/static/logo2.png" mode="heightFix"></image>
 			<div class="title">Hi,我是企业教练~</div>
 			<div class="tip">很高兴遇见你!作为你的AI教练,我随时可以回答您的问题</div>
 			<div class="item adf">
@@ -20,7 +20,7 @@
 				</div>
 			</div>
 			<button class="zt_btn" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">手机号一键登录</button>
-			<div class="qx_btn" @click="cancelLogin">取消</div>
+			<div class="qx_btn" @click="cancelLogin">取消登录</div>
 		</div>
 	</view>
 </template>
@@ -76,7 +76,8 @@
 				})
 			},
 			cancelLogin(){
-				uni.exitMiniProgram();
+				// uni.exitMiniProgram();
+				uni.reLaunch({ url:'/pages/home' })
 			}
 		}
 	}

+ 18 - 2
pages/my.vue

@@ -22,7 +22,7 @@
 				</div>
 				<div class="bp_r">1.0.0</div>
 			</div>
-			<div class="b_pre adfacjb" @tap="exitLogin">
+			<div class="b_pre adfacjb" @tap="exitLogin" v-if="logined">
 				<div class="bp_l adfac">
 					<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/16/4d10c9ef-8a13-4502-adfd-d388628446ab.png"></image>
 					<text>退出登录</text>
@@ -31,6 +31,15 @@
 					<u-icon name="arrow-right" color="#D3D2D2" size="32"></u-icon>
 				</div>
 			</div>
+			<div class="b_pre adfacjb" @tap="toLogin" v-else>
+				<div class="bp_l adfac">
+					<image src="https://transcend.ringzle.com/xiaozhi-app/profile/2025/06/16/4d10c9ef-8a13-4502-adfd-d388628446ab.png"></image>
+					<text>立即登录</text>
+				</div>
+				<div class="bp_r">
+					<u-icon name="arrow-right" color="#D3D2D2" size="32"></u-icon>
+				</div>
+			</div>
 		</div>
 		<Tabbar :tabbarIndex="1"></Tabbar>
 	</view>
@@ -45,11 +54,13 @@
 				userName:'',
 				mobile:'',
 				enterpriseName:'',
-				teamName:''
+				teamName:'',
+				logined:false
 			}
 		},
 		onLoad() {
 			if(uni.getStorageSync('userInfo')){
+				this.logined = true;
 				this.userName = JSON.parse(uni.getStorageSync('userInfo')).realName||'';
 				this.mobile = JSON.parse(uni.getStorageSync('userInfo')).mobile||'';
 				this.enterpriseName = JSON.parse(uni.getStorageSync('userInfo')).enterpriseName||'';
@@ -63,6 +74,11 @@
 				uni.reLaunch({
 					url:'/pages/login'
 				})
+			},
+			toLogin(){
+				uni.reLaunch({
+					url:'/pages/login'
+				})
 			}
 		}
 	}

BIN
static/logo.png


BIN
static/logo2.png


+ 21 - 0
utils/system.js

@@ -15,5 +15,26 @@ export default {
 				}
 			}
 		})
+	},
+	methods:{
+		isLogin(){
+			if(uni.getStorageSync('token')){
+				return true
+			}else {
+				uni.showModal({
+					title:'温馨提示',
+					content:'当前功能需要登录后使用,是否跳转登录页面?',
+					success: (res) => {
+						if(res.confirm){
+							uni.reLaunch({
+								url:'/pages/login'
+							})
+						}else{
+							return false
+						}
+					}
+				})
+			}
+		}
 	}
 }