瀏覽代碼

修改:1.增加获取经理人指数链接接口,跳转打开网页;2.注册时身份证为必填项;

littleblue55 20 小時之前
父節點
當前提交
6813f3b9f9
共有 6 個文件被更改,包括 95 次插入47 次删除
  1. 10 0
      api/home.js
  2. 1 0
      main.js
  3. 11 0
      pages.json
  4. 30 23
      pages/index/index.vue
  5. 28 24
      pages/register/register.vue
  6. 15 0
      pages/webview/webview.vue

+ 10 - 0
api/home.js

@@ -55,4 +55,14 @@ export function getSwiperDetail(id){
 		},
 		'method': 'get'
 	})
+}
+
+export function loadJlrzsUrl(){
+	return request({
+		url: '/home/getJlrzs',
+		headers: {
+			isToken: true
+		},
+		'method': 'get'
+	})
 }

+ 1 - 0
main.js

@@ -31,6 +31,7 @@ export function createApp() {
 	app.use(pinia)
 	const authStore = useAuthStore();
 	authStore.loadAuthToken();
+	authStore.loadOpenid();
 	return {
 		app
 	}

+ 11 - 0
pages.json

@@ -450,6 +450,17 @@
 					"titleNView": true
 				}
 			}
+		},
+		{
+			"path" : "pages/webview/webview",
+			"style" : 
+			{
+				"navigationStyle" : "custom",
+				"app-plus" : 
+				{
+					"bounce" : "none"
+				}
+			}
 		}
 	],
 	"globalStyle": {

+ 30 - 23
pages/index/index.vue

@@ -40,7 +40,7 @@
 						@click="toPage('/pages/researchReport/reportHome/reportHome')"></u-section>
 				</template>
 				<template v-slot:body>
-					<view v-if="reportList.length!=0" >
+					<view v-if="reportList.length!=0">
 						<view v-for="(data,index) in reportList" :key="index" class="u-body-item u-flex u-p-t-0 "
 							style="align-items: inherit;" @click="toReport(data.id, data.title)">
 							<image :src="data.cover" mode="aspectFill"></image>
@@ -134,7 +134,8 @@
 		homeCourseList,
 		homeReportList,
 		homeSetting,
-		homeSwiperList
+		homeSwiperList,
+		loadJlrzsUrl
 	} from '@/api/home.js'
 	import {
 		me
@@ -162,7 +163,7 @@
 		return tabbarStore.inactiveColor
 	})
 	const tabbarCurrentIndex = 0
-
+	const jlrzsUrl = ref(null)
 	const authStore = useAuthStore()
 	// 屏幕状态栏高度
 	const statusBarHeight = ref(0)
@@ -180,20 +181,7 @@
 	const isMember = ref(false)
 
 	// 首页-轮播图
-	const swiperList = ref([
-		// {
-		// 	imgUrl: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.YKoZzgmubNBxQ8j-mmoTKAHaEK?rs=1&pid=ImgDetMain',
-		// 	id: 1
-		// },
-		// {
-		// 	imgUrl: 'https://pic3.zhimg.com/v2-e52354ffdbd94a8e0a7649eacd34a788_r.jpg?source=1940ef5c',
-		// 	id: 2
-		// },
-		// {
-		// 	imgUrl: 'https://desk-fd.zol-img.com.cn/t_s960x600c5/g4/M03/00/0C/Cg-4zFS8bC-Ie9zBADCvovJAqiEAATJ8wDX__cAMK-6184.jpg',
-		// 	id: 3
-		// },
-	])
+	const swiperList = ref([])
 
 	const courseList = ref([{
 			courseImg: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.YKoZzgmubNBxQ8j-mmoTKAHaEK?rs=1&pid=ImgDetMain',
@@ -272,7 +260,7 @@
 			title: '经理人指数',
 			icon: 'icon-zhishu',
 			url: '跳转页面的路径',
-			toOtherApp: true,
+			toOtherApp: false,
 			otherAppId: '其他小程序的appid'
 		},
 		{
@@ -286,10 +274,10 @@
 		}
 	])
 
-	const reportList = ref(
-		[])
+	const reportList = ref([])
 	// 跳转页面
 	const jumpToPage = (data) => {
+		
 		if (data.toOtherApp) {
 			// 跳转其他小程序
 			wx.navigateToMiniProgram({
@@ -311,7 +299,13 @@
 				return
 			}
 		}
-
+		if (data.id === 'index') {
+			const src = encodeURIComponent(jlrzsUrl.value);
+			uni.navigateTo({
+				url: `/pages/webview/webview?url=${src}`
+			});
+			return
+		}
 		uni.navigateTo({
 			url: data.url
 		})
@@ -379,13 +373,15 @@
 		// 	console.log(res)
 		// })
 	}
-	function initReport (){
+
+	function initReport() {
 		homeReportList().then(res => {
 			if (res?.data) {
 				reportList.value = res.data
 			}
 		})
 	}
+
 	function getCharCount() {
 		count().then(res => {
 			if (res && res.message === 'success') {
@@ -408,6 +404,14 @@
 		})
 	}
 
+	function loadUrl() {
+		loadJlrzsUrl().then(res => {
+			if (res && res.code === 0) {
+				jlrzsUrl.value = res.data.url
+			}
+		})
+	}
+
 	onReady(() => {
 		uni.getSystemInfo({
 			success(e) {
@@ -431,6 +435,9 @@
 			// 登录后才请求消息数量
 			getCharCount()
 			initReport()
+			if(!jlrzsUrl.value){
+				loadUrl()
+			}
 			// 没有用户信息就加载一边
 			if (!isUserInfo) {
 				initUser();
@@ -674,4 +681,4 @@
 			color: $uni-text-color;
 		}
 	}
-</style>
+</style>

+ 28 - 24
pages/register/register.vue

@@ -22,7 +22,7 @@
 				<u-input height="80" placeholder="请输入手机号" border-color="#d0d0d0" v-model="registerForm.phone"
 					:border="true" class="form-item-input" type="number" disabled/>
 			</u-form-item>
-			<u-form-item label="身份证" prop="userCode" :border-bottom="false">
+			<u-form-item label="身份证" prop="userCode"  required :border-bottom="false">
 				<u-input height="80" placeholder="请输入身份证" border-color="#d0d0d0" v-model="registerForm.userCode"
 					:border="true" class="form-item-input" />
 			</u-form-item>
@@ -115,6 +115,10 @@
 						trigger: ['blur']
 					}],
 					userCode: [{
+						required: true,
+						message: '请输入身份证号码',
+						trigger: ['blur']
+					},{
 						pattern: /^(?:\d{15}|\d{17}[\dXx])$/,
 						transform(value) {
 							return String(value);
@@ -142,30 +146,30 @@
 			submit() {
 				const that = this;
 				that.$refs.registerForm.validate(async (valid) => {
-					const form = {
-						...this.registerForm
-					};
-					form.password = encryptAESCBC(form.password);
-					form.checkPwd = encryptAESCBC(form.checkPwd);
-					
-					const loginRes = await wx.login();
-					const code = loginRes.code;
-					let wxRes = await wxLoginOpenid({code})
-					if(wxRes && wxRes?.data){
-						const { openid, sessionKey } = wxRes.data
-						// this.useAuthStore.setOpenid(openid)
-						this.registerForm.openid = openid
-						form.openid = openid
-						register(form).then(res => {
-							if (res?.data) {
-								this.useAuthStore.setAuthToken(res.data.token);
-								msgSuccess("注册成功");
-								this.initUser()
-							}
-						})
+					if(valid){
+						const form = {
+							...this.registerForm
+						};
+						form.password = encryptAESCBC(form.password);
+						form.checkPwd = encryptAESCBC(form.checkPwd);
+						
+						const loginRes = await wx.login();
+						const code = loginRes.code;
+						let wxRes = await wxLoginOpenid({code})
+						if(wxRes && wxRes?.data){
+							const { openid, sessionKey } = wxRes.data
+							// this.useAuthStore.setOpenid(openid)
+							this.registerForm.openid = openid
+							form.openid = openid
+							register(form).then(res => {
+								if (res?.data) {
+									this.useAuthStore.setAuthToken(res.data.token);
+									msgSuccess("注册成功");
+									this.initUser()
+								}
+							})
+						}
 					}
-					
-					
 				})
 			},
 			async initUser(){

+ 15 - 0
pages/webview/webview.vue

@@ -0,0 +1,15 @@
+<template>
+	<web-view :src="url"></web-view>
+</template>
+<script setup>
+	import {
+		ref
+	} from 'vue'
+	import {
+		onLoad
+	} from '@dcloudio/uni-app';
+	const url = ref('');
+	onLoad((options) => {
+		url.value = decodeURIComponent(options.url || ''); // 解码传递的URL
+	});
+</script>