root 9 months ago
parent
commit
63e02cfbc8

+ 0 - 16
.hbuilderx/launch.json

@@ -1,16 +0,0 @@
-{
-    "version" : "1.0",
-    "configurations" : [
-        {
-            "openVueDevtools" : true,
-            "type" : "uni-app:h5"
-        },
-	{
-		"mp-toutiao" : 
-		{
-			"launchtype" : "local"
-		},
-		"type" : "uniCloud"
-	}
-    ]
-}

+ 3 - 3
App.vue

@@ -14,9 +14,9 @@
 	/*每个页面公共css */
 	@font-face {
 		font-family: 'Alibaba PuHuiTi 2.0';
-		src: url('https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff2') format('woff2'),
-			url('https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff') format('woff'),
-			url('https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.ttf') format('truetype');
+		src: url('../../static/images/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff2') format('woff2'),
+			url('../../static/images/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.woff') format('woff'),
+			url('../../static/images/EQtest/font/AlibabaPuHuiTi-2-55-Regular/AlibabaPuHuiTi-2-55-Regular.ttf') format('truetype');
 		font-weight: normal;
 		font-style: normal;
 		font-display: swap;

+ 5 - 6
common/request.js

@@ -71,9 +71,8 @@ class Request {
 		_options.url = Request.getUrl(_options)
 		if (!_options.header['Content-Type']) {
 			_options.header['Content-Type'] = Request.getContentType(_options)
-			let setUerInfo = uni.getStorageSync('setUerInfo');
-			let token = setUerInfo ? setUerInfo.token : undefined;
-			_options.header["Authorization"] = `Bearer ${token}`
+			
+			_options.header["Authorization"] = `Bearer ${sessionStorage.getItem("token")}`
 		}
 		let _config = _options
 		if (that.interceptor.request && typeof that.interceptor.request === 'function') {
@@ -104,8 +103,8 @@ class Request {
 					})
 				}
 			} else {
-				console.log(_config)
-
+                console.log(_config)
+			
 				task = uni.request({
 					..._config,
 					success: res => {
@@ -126,7 +125,7 @@ class Request {
 		}
 		return promise;
 	}
-	aa() {
+	aa(){
 		console.log('掉到了')
 	}
 	get(options = {}) {

+ 1 - 0
components/mpvueEcharts/leiDa.vue

@@ -35,6 +35,7 @@
 
 				// let legendData =
 				// 	_this.reference?.length > 0 ? ["你的分数", "参考值"] : ["你的分数"];
+				// debugger
 				// _this.option = {
 				// 	color: ["#67F9D8", "#FFE434", "#56A3F1", "#FF917C"],
 				// 	title: {

+ 62 - 0
examWidght/examWidght/1.json

@@ -0,0 +1,62 @@
+{
+	"questionID": "655180e7-c06a-42ca-a043-6ead0dc41b2f",
+	"fldName": "下列哪种灭火器不可用于电器类火灾()。",
+	"fldAnswer": null,
+	"questionType": 0,
+	"QuestionOptionList": [{
+			"fldOptionText": "干粉灭火器",
+			"fldOptionIndex": 1
+		},
+		{
+			"fldOptionText": "二氧化碳灭火器",
+			"fldOptionIndex": 2
+		},
+		{
+			"fldOptionText": "泡沫灭火器",
+			"fldOptionIndex": 3
+		},
+		{
+			"fldOptionText": "泡灭火器",
+			"fldOptionIndex": 4
+		}
+	]
+},
+answer: "你常感到与周围人的关系和谐吗?"
+checkItems: "从不 ;很少;有时;一直"
+flag: "20210617000232"
+id: "2c91f37d7a135392017a158f550b0078"
+questionNo: "1"
+questionType: "0"
+score: ""
+scoreDirection: "0"
+serialNo: "1"
+weight: ""
+
+
+// 回答的数据
+
+answer: "你常感到与周围人的关系和谐吗?"
+checkItems: "从不 "
+flag: "20210617000232"
+id: "2c91f37d7a135392017a158f550b0078"
+questionNo: "1"
+questionType: "0"
+score: ""
+scoreDirection: "0"
+serialNo: "1"
+weight: ""
+
+
+QuestionOptionList: (5) [{…}, {…}, {…}, {…}, {…}, __ob__: Observer]
+answer: (...)
+checkItems: (...)
+flag: (...)
+fldAnswer: "极重"
+id: (...)
+questionID: "2c91f37d7a135392017a158e850b0076"
+questionNo: (...)
+questionType: (...)
+score: (...)
+scoreDirection: (...)
+serialNo: (...)
+weight: (...)

+ 402 - 0
examWidght/examWidght/index.vue

@@ -0,0 +1,402 @@
+<template>
+	<view class="question_class">
+		<view class="">
+			<LineProgress class="pro-bg" :currentIndex="currentIndex" :total="total" />
+			<swiper :current="currentIndex" style="height: 98vh" :disable-touch="true">
+				<swiper-item style="overflow-y: scroll" v-for="(item, indexa) in QuestionListAll" :key="indexa" m
+					catchtouchmove="catchTouchMove">
+					<scroll-view scroll-y @scrolltolower="" style="height: 90vh">
+						<exam-widght :total="total" :currentIndex="currentIndex" :QuestionList="QuestionList"
+							@goPrevAnswer="goPrevAnswer" @goNextAnswer="goNextAnswer" @onItemAnswer="onItemAnswer"
+							@subMitList="subMitList" @onListItemAnswer="onListItemAnswer" />
+					</scroll-view>
+				</swiper-item>
+			</swiper>
+		</view>
+	</view>
+</template>
+
+<script>
+	import examWidght from "@/examWidght/components/Li-ExamWidght/Li-ExamWidght.vue";
+	import LineProgress from "@/examWidght/components/lineProgress";
+	import {
+		getScaleInfo,
+		getUserInfo,
+		getResult,
+		queryPromotionBySubjectId,
+	} from "@/api/index.js";
+	var _this;
+	export default {
+		components: {
+			examWidght,
+			LineProgress,
+		},
+		data() {
+			return {
+				//当前索引
+				currentIndex: 0,
+				//总条数
+				total: 0,
+				QuestionListAll: [],
+				//当前答案
+				QuestionList: {
+					answer: "",
+				},
+				//// 全部题目
+				scale_infos: [{
+					questionType: "",
+					answer: "",
+				}, ],
+				//题目总数
+				scale_all: 0,
+				//备选答案数组
+				scale_checkItems: [],
+				//量表进度吧
+				scale_percent: 0,
+				// 当前索引
+				scale_index: 0,
+				//量表flag
+				flag: "",
+				//分享人的uid
+				uid: "",
+				//来源
+				source: "",
+				//是否重复点击标志
+				loading: false,
+				//支付金额
+				price: "",
+				//量表结果保存的唯一id
+				resultId: "",
+				userInfo: null,
+			};
+		},
+		destroyed() {},
+		onLoad(options) {
+			_this = this;
+			uni.pageScrollTo({
+				scrollTop: 0,
+				duration: 50
+			})
+			//查看是否传进来flag
+			_this.uid = options.uid;
+			_this.source = options.source;
+			if (options.flag) {
+				_this.flag = options.flag;
+
+				_this.selectUser();
+				//根据flag查询出量表全部题目
+				_this.getScaleInfoAnswerList(options.flag);
+			}
+			//调用接口
+
+			//根据传过来的参数进行渲染题目
+			// console.log(_this.$request)
+			// this.queryTopic()
+		},
+
+		onHide() {
+			// clearInterval(this.timer);
+			// https://blog.csdn.net/weixin_42738504/article/details/125521004
+		},
+		methods: {
+			//根据flag查询渲染的结果
+			// queryTopic() {
+			// 	this.$request.get({
+			// 		url: 'https://www.example.com/request',
+			// 		loadingTip: "加载中...",
+			// 		data: {},
+			// 	}).then((res) => {
+
+			// 	})
+			// },
+			//查询用户信息
+			selectUser() {
+				this.$request
+					.get({
+						url: 'system/temporaryUser',
+						loadingTip: "加载中..."
+					})
+					.then((res) => {
+						this.userInfo = res.data.user;
+						sessionStorage.setItem("user", JSON.stringify(res.data.user));
+						sessionStorage.setItem("token", res.data.token);
+					});
+			},
+			//上一题
+			goPrevAnswer() {
+				if (_this.currentIndex < 1) {
+					uni.showToast({
+						icon: "none",
+						title: "已经是第一题",
+					});
+					return;
+				}
+
+				let newIndex = _this.currentIndex - 1;
+				_this.currentIndex = newIndex;
+				let QuestionListNew = Object.assign({}, _this.QuestionListAll[newIndex]);
+				_this.QuestionList = QuestionListNew;
+			},
+			//下一题
+			goNextAnswer(blankAnswer) {
+				if (_this.scale_infos[_this.currentIndex].questionType == "5") {
+					let paramsArr = JSON.parse(_this.scale_infos[_this.currentIndex].questionParam);
+					blankAnswer = paramsArr[blankAnswer].label
+				}
+
+				if (blankAnswer) {
+					_this.QuestionListAll[_this.currentIndex].checkItems = blankAnswer;
+					_this.QuestionListAll[_this.currentIndex].fldAnswer = blankAnswer;
+				}
+				let newIndexs = _this.currentIndex + 1;
+				if (newIndexs > _this.QuestionListAll.length - 1) {
+					_this.currentIndex = newIndexs - 1;
+					uni.showToast({
+						icon: "none",
+						title: "已经是最后一题",
+					});
+					return;
+				}
+				if (_this.QuestionListAll[_this.currentIndex].fldAnswer == "") {
+					uni.showToast({
+						icon: "none",
+						title: "请先答题",
+					});
+					return;
+				}
+				_this.currentIndex = newIndexs;
+				let QuestionListNew = Object.assign({}, _this.QuestionListAll[newIndexs]);
+				_this.QuestionList = QuestionListNew;
+			},
+			//获取问题及答案全部列表
+			getScaleInfoAnswerList(flag) {
+				_this.$request
+					.get({
+						url: `${getScaleInfo}/${flag}`,
+						loadingTip: "加载中...",
+						data: {},
+					})
+					.then((res) => {
+						if (res.code == 200 && res.data.length > 0) {
+							_this.scale_infos = res.data;
+							_this.scale_all = _this.scale_infos.length;
+							_this.scale_checkItems =
+								_this.scale_infos[_this.scale_index].checkItems.split(";");
+							_this.scale_percent = parseInt(
+								(_this.scale_index + 1) / _this.scale_all
+							);
+							_this.scale_percent =
+								((_this.scale_index + 1) * 100) / _this.scale_all;
+							let listAll = [];
+							_this.scale_infos.forEach((item, index) => {
+								item.questionID = item.id;
+								// item.fldName = item.answer;
+								item.fldAnswer = "";
+								let QuestionOptionList = [];
+								if (item.checkItems) {
+									let arrList = item.checkItems.split(";");
+									arrList.forEach((items, i) => {
+										QuestionOptionList.push({
+											fldOptionText: items,
+											fldOptionIndex: i + 1,
+										});
+									});
+									item.QuestionOptionList = QuestionOptionList;
+								}
+							});
+							_this.total = _this.scale_infos.length;
+							_this.QuestionListAll = _this.scale_infos;
+							_this.QuestionList = _this.scale_infos[_this.currentIndex];
+						}
+					});
+			},
+			onListItemAnswer(item) {
+				if (_this.currentIndex >= _this.total - 1) {
+					_this.QuestionListAll[_this.currentIndex].checkItems =
+						item.fldOptionText;
+					_this.QuestionListAll[_this.currentIndex].fldAnswer =
+						item.fldOptionText;
+					let QuestionListNew = Object.assign({},
+						_this.QuestionListAll[_this.currentIndex]
+					);
+					_this.QuestionList = QuestionListNew;
+					// if (_this.handleNumber == 1) {
+					// 	_this.subMitList();
+					// }
+
+					return;
+				} else {
+					_this.currentIndex = _this.currentIndex + 1;
+					_this.QuestionListAll[_this.currentIndex - 1].checkItems =
+						item.fldOptionText;
+					_this.QuestionListAll[_this.currentIndex - 1].fldAnswer =
+						item.fldOptionText;
+					let QuestionListNew = Object.assign({},
+						_this.QuestionListAll[_this.currentIndex]
+					);
+					_this.QuestionList = QuestionListNew;
+				}
+			},
+			onItemAnswer(item) {
+				_this.QuestionListAll[_this.currentIndex].checkItems = item.fldOptionText;
+				_this.QuestionListAll[_this.currentIndex].fldAnswer = item.fldOptionText;
+				let QuestionListNew = Object.assign({},
+					_this.QuestionListAll[_this.currentIndex]
+				);
+				_this.QuestionList = QuestionListNew;
+			},
+			subMitList(flag) {
+				// _this.handleNumber = 2
+				// if (_this.handleNumber == 1) {
+				// 	_this.subMitList();
+				// }
+				if (_this.QuestionListAll[_this.currentIndex].fldAnswer == "") {
+					uni.showToast({
+						icon: "none",
+						title: "请先答题",
+					});
+					return;
+				}
+
+				//调用提交答案的接口
+
+				this.createResult();
+
+				// uni.navigateTo({
+				// 	url:'/paymentPage/paymentPage/index'
+				// })
+				//提交时防抖函数
+				// console.log(uni.$u)
+				// uni.$u.throttle(this.createResult, 2500);
+			},
+
+			// 生成测试结果
+			createResult() {
+				let _this = this;
+				if (this.loading) {
+					return;
+				}
+				this.loading = true;
+				let subMitListData = _this.QuestionListAll;
+				subMitListData.forEach((item) => {
+					delete item.QuestionOptionList;
+					delete item.fldAnswer;
+					delete item.questionID;
+				});
+
+				let params = {
+					testPlanId: "",
+					scale_result: subMitListData,
+					userId: JSON.parse(sessionStorage.getItem("user")).id,
+				};
+				console.log("提交的参数", params);
+
+				uni.showLoading({
+					title: "测试结果生成中",
+				});
+				// _this.$dot.submit(0, _this.id);
+				_this.$request
+					.post({
+						url: `${getResult}/${_this.flag}`,
+						loadingTip: "加载中...",
+						data: params,
+					})
+					.then((res) => {
+						_this.resultId = res.data;
+						_this.$request.post({
+							url: `scaleExternalSource/save`,
+							loadingTip: "加载中...",
+							data: {
+								currentUserId: _this.userInfo.id,
+								resultId: _this.resultId,
+								uid: _this.uid,
+								source: _this.source,
+								flag: _this.flag,
+							},
+						}).then(() => {})
+						uni.hideLoading();
+						// 答题结束获取支付
+						_this.getQueryPromotionBySubjectId(_this.flag);
+						_this.loading = false;
+					})
+					.catch(() => {
+						uni.showToast({
+							icon: "none",
+							title: "提交失败",
+						});
+						_this.loading = false;
+					});
+			},
+			// 获取支付金额
+			async getQueryPromotionBySubjectId(id) {
+				let _this = this;
+				let urls = queryPromotionBySubjectId + "/" + id;
+				await _this.$request
+					.get({
+						url: urls,
+						loadingTip: "加载中...",
+						data: {},
+					})
+					.then((res) => {
+						console.log('量表支付信息', res.data);
+						let data = res.data;
+						if (data.price == 0) {
+							uni.navigateTo({
+								url: `/scaleTestResults/testResults/index?resultId=${_this.resultId}&messageShare=1`
+							});
+						} else {
+							let params = {
+								productId: id,
+								userId: _this.userInfo?.id,
+								resultId: _this.resultId,
+								description: data.name,
+								total: data.price,
+								sceneType: uni.getSystemInfoSync().platform == "android" ?
+									"Android" : "iOS",
+							};
+							sessionStorage.setItem('orderInfo', JSON.stringify(params))
+							uni.navigateTo({
+								url: "/paymentPage/paymentPage/index",
+							});
+						}
+					});
+			}
+		},
+	};
+</script>
+<style scoped>
+	/deep/ uni-swiper {
+		min-height: 80vh;
+	}
+
+	.question_class {
+		background: linear-gradient(180deg, #d8fff2 0%, #46e2ed 42%, #beffe8 98%);
+		border-radius: 0px 0px 0px 0px;
+		padding-left: 10px;
+		padding-right: 10px;
+		padding-top: 20px;
+	}
+
+	.question_inner {
+		padding-left: 10px;
+		padding-right: 10px;
+		padding-top: 20px;
+		/* background: url('/static/images/question_main.png') no-repeat 100% 100%; */
+		background-image: url("/static/images/question_main.png");
+		/* background-size:contain; */
+		background-size: 100% 100px;
+		background-repeat: no-repeat;
+		background-position: top;
+	}
+
+	.pro-bg {
+		background-image: url("/static/images/question_main1.png");
+		/* background-size: contain; */
+		background-size: 100% 100%;
+		background-position: top;
+		background-repeat: no-repeat;
+		padding-top: 80rpx;
+		padding-left: 40rpx;
+		padding-right: 40rpx;
+	}
+</style>

+ 0 - 47
newScale/EQtest/index.vue

@@ -380,19 +380,9 @@
 					return
 				}
 
-<<<<<<< HEAD
-				if (uni.getStorageSync('setUerInfo')) {
-					uni.navigateTo({
-						url: '/newScale/EQtest/testPage'
-					})
-				} else {
-					this.loginHandle()
-				}
-=======
 				uni.navigateTo({
 					url: '/newScale/EQtest/testPage'
 				})
->>>>>>> e4a217fb30fa759feae09081f8f7cb81fa9387e6
 			},
 			toggle() {
 				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
@@ -401,44 +391,7 @@
 			close() {
 				this.$refs.popup.close();
 				this.isChecked = true;
-<<<<<<< HEAD
-			},
-			loginHandle() {
-				let _this = this;
-				tt.login({
-					success(res) {
-						_this.getUerInfo(res.code)
-					},
-				})
-			},
-			getUerInfo(code) {
-				let _this = this;
-				let para = {
-					code: code,
-					petName: '',
-					modelPhone: '',
-				};
-				_this.$request
-					.post({
-						url: 'api/douyin/code2Session',
-						data: para
-					})
-					.then(
-						(res) => {
-							uni.setStorageSync("setUerInfo", res.data);
-							uni.navigateTo({
-								url: '/newScale/EQtest/testPage'
-							})
-							console.log("登录成功");
-						},
-						(err) => {
-							console.log("登录失败", err);
-						}
-					);
-			},
-=======
 			}
->>>>>>> e4a217fb30fa759feae09081f8f7cb81fa9387e6
 		}
 	}
 </script>

+ 30 - 117
newScale/EQtest/paymentPage.vue

@@ -1,16 +1,16 @@
 <template>
 	<view class="payment_bg">
 		<view class="payment_info">
-			<view class="people_num"><text>{{ peopleNum }}人已测</text></view>
-			<view class="price_num"><text>¥{{ orderInfo.total }}</text></view>
-			<view class="pay_btn_sm" @click="createOrder">{{ orderInfo.total }}元解锁专属测试报告</view>
+			<view class="people_num"><text>{{peopleNum}}人已测</text></view>
+			<view class="price_num"><text>¥{{orderInfo.total}}</text></view>
+			<view class="pay_btn_sm" @click="getH5Pay()">{{orderInfo.total}}元解锁专属测试报告</view>
 		</view>
 		<view class="payment_desc">
 			<image src="https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/paymentPage/pay_scale_desc.png"
 				mode="widthFix"></image>
 		</view>
-		<view class="pay_btn_lg" @click="createOrder()">
-			{{ orderInfo.total }}元解锁专属测试报告
+		<view class="pay_btn_lg" @click="getH5Pay()">
+			{{orderInfo.total}}元解锁专属测试报告
 		</view>
 		<uni-popup ref="popup" type="center">
 			<view class="pay_dialog">
@@ -32,10 +32,8 @@
 		data() {
 			return {
 				orderNo: '',
-				orderInfo: {
-					total: 0
-				},
-				peopleNum: 0,
+				orderInfo: {},
+				peopleNum: 0
 			}
 		},
 		onLoad(options) {
@@ -45,7 +43,7 @@
 					this.payEnsure();
 				}, 200)
 			}
-			this.orderInfo = uni.getStorageSync('orderInfo');
+			this.orderInfo = JSON.parse(sessionStorage.getItem('orderInfo'));
 			this.getPeople();
 		},
 		methods: {
@@ -70,123 +68,38 @@
 						}
 					});
 			},
-
-			createOrder() {
-				let _this = this;
-				let params = {
-					resultId: _this.orderInfo.resultId,
-					subject: _this.orderInfo.description,
-					body: _this.orderInfo.description,
-					total_amount: _this.orderInfo.total * 100,
-					msgPage: "",
-				}
-				_this.$request
-					.post({
-						url: "api/douyin/createOrder",
-						loadingTip: "加载中...",
-						data: params
-					})
-					.then((res) => {
-						_this.orderNo = res.data.orderNo;
-						let imageUrl = 'https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/banner1.png';
-						// _this.syncOrder({
-						// 	resultId: params.resultId,
-						// 	total_amount: params * 100,
-						// 	subject: params.subject,
-						// 	path: `/newScale/EQtest/testResult?resultId=${_this.orderInfo.resultId}&messageShare=1`,
-						// 	orderNo: _this.orderNo,
-						// 	openId: uni.getStorageSync("setUerInfo").openId,
-						// 	orderStatus: "1",
-						// 	imgPath: imageUrl,
-						// });
-						_this.payToutiao(
-							res.data.orderId,
-							res.data.orderToken,
-							res.data.orderNo
-						);
-					});
-			},
-			payToutiao(orderId, orderToken, orderNo) {
-				let _this = this;
-				tt.pay({
-					orderInfo: {
-						order_id: orderId,
-						order_token: orderToken,
-					},
-					service: 5,
-					success: (response) => {
-						_this.timer = setInterval(() => {
-							_this.getQueryOrder(orderNo);
-						}, 1000);
-					},
-					fail: (err) => {
-						uni.showToast({
-							icon: "none",
-							name: "支付失败",
-						});
-					},
-				});
-			},
-			// 订单状态
-			getQueryOrder(orderNo) {
+			// 拉起微信支付
+			getH5Pay(params) {
 				let _this = this;
 				_this.$request
 					.get({
-						url: `api/douyin/queryOrder/${orderNo}`,
+						url: `api/orderInfo/queryOrderByResultIdAndUserId/${this.orderInfo.userId}/${this.orderInfo.resultId}`,
 						loadingTip: "加载中...",
 						data: {},
 					})
 					.then((res) => {
-						if (res.code == "200") {
-							if (res.data.statusCode == "SUCCESS") {
-								let imageUrl =
-									'https://test.jue-ming.com:8849/api/show?filePath=./webo/EQtest/banner1.png';
-								// _this.syncOrder({
-								// 	resultId: _this.orderInfo.resultId,
-								// 	total_amount: _this.orderInfo.total * 100,
-								// 	subject: _this.orderInfo.description.subject,
-								// 	path: `/newScale/EQtest/testResult?resultId=${_this.orderInfo.resultId}&messageShare=1`,
-								// 	orderNo: _this.orderNo,
-								// 	openId: uni.getStorageSync("setUerInfo").openId,
-								// 	orderStatus: "2",
-								// 	imgPath: imageUrl,
-								// });
-								uni.navigateTo({
-									url: `/newScale/EQtest/testResult?resultId=${_this.orderInfo.resultId}&messageShare=1`
-								});
-
-								clearInterval(_this.timer);
-								uni.showToast({
-									title: "支付成功",
-								});
-							} else if (res.data.statusCode == "CLOSED") {
-								// console.log("订单支付回调成功===========CLOSED》", _this.trade_state_closed );
-							} else {
-								clearInterval(_this.timer);
-								// console.log("订单支付回调成功CLOSED===========》", _this.trade_state_closed);
-							}
-						} else {
-							uni.showToast({
-								title: "支付失败",
+						uni.hideLoading();
+						if (res.data && res.data.orderStatus === '支付成功') {
+							uni.navigateTo({
+								url: `/newScale/EQtest/paySuccess?resultId=${this.orderInfo.resultId}&userId=${this.orderInfo.userId}`
 							});
+						} else {
+							// _this.orderInfo.total = _this.hasDiscount ? _this.promotionPrice : _this.price;
+							_this.$request
+								.post({
+									url: "api/wx-pay/h5Pay",
+									loadingTip: "加载中...",
+									data: _this.orderInfo
+								})
+								.then((res) => {
+									let redirect_url = encodeURI(
+										`http://hnhong-duo.com/webo/newScale/EQtest/paymentPage?orderNo=${res.data.orderNo}`
+									)
+									window.location.href = `${res.data.codeUrl}&redirect_url=${redirect_url}`;
+								});
 						}
 					});
 			},
-			// 同步订单
-			syncOrder(params) {
-				this.$request
-					.post({
-						url: "api/douyin/pushOrder",
-						loadingTip: "加载中...",
-						data: params,
-					})
-					.then((res) => {
-						console.log(res);
-					})
-					.catch((err) => {
-						console.log(err);
-					});
-			},
 			// 查询测试人数
 			getPeople() {
 				let _this = this;
@@ -320,7 +233,7 @@
 	}
 
 	.price_num {
-		margin-top: 64rpx;
+		margin-top: 72rpx;
 	}
 
 	.price_num text {

+ 4 - 3
newScale/EQtest/testPage.vue

@@ -63,7 +63,7 @@
 		},
 		created() {
 			this.loadData();
-			this.userInfo = uni.getStorageSync("setUerInfo").user
+			this.userInfo = JSON.parse(sessionStorage.getItem("user"));
 		},
 		methods: {
 			loadData() {
@@ -117,8 +117,9 @@
 				let params = {
 					testPlanId: "",
 					scale_result: _this.userAnswerList,
-					userId: uni.getStorageSync("setUerInfo").user.id
+					userId: JSON.parse(sessionStorage.getItem("user")).id,
 				};
+
 				uni.showLoading({
 					title: "测试结果生成中",
 				});
@@ -183,7 +184,7 @@
 								sceneType: uni.getSystemInfoSync().platform == "android" ?
 									"Android" : "iOS",
 							};
-							uni.setStorageSync('orderInfo', params);
+							sessionStorage.setItem('orderInfo', JSON.stringify(params))
 							uni.navigateTo({
 								url: "/newScale/EQtest/paymentPage",
 							});

+ 27 - 25
pages.json

@@ -5,35 +5,18 @@
 			"^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue"
 		}
 	},
+	// "easycom": {
+	//   "autoscan": true,
+	//   "custom": {
+	//     "^uni-(.*)": "@/components/uni-$1.vue", // 匹配components目录内的vue文件
+	//     "^vue-file-(.*)": "packageName/path/to/vue-file-$1.vue" // 匹配node_modules内的vue文件
+	//   }
+	// },
 	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
-		{
-			"path": "newScale/EQtest/index",
-			"style": {
-				"navigationStyle": "custom",
-				"navigationBarTitleText": "",
-				"enablePullDownRefresh": false
-			}
-		},
-		{
-			"path": "newScale/EQtest/testPage",
-			"style": {
-				"navigationStyle": "custom",
-				"navigationBarTitleText": "",
-				"enablePullDownRefresh": false
-			}
-		},
-		{
-			"path": "newScale/EQtest/testResult",
-			"style": {
-				"navigationStyle": "custom",
-				"navigationBarTitleText": "",
-				"enablePullDownRefresh": false
-			}
-		},
 		{
 			"path": "pages/index/index",
 			"style": {
-				// "navigationStyle": "default",
+				"navigationStyle": "default",
 				// "navigationBarTitleText": "uni-app"
 				"navigationStyle": "custom"
 			}
@@ -78,6 +61,25 @@
 				"enablePullDownRefresh": false
 			}
 		}
+		// {   "root":"examWidght",
+		// 	"pages":[{
+		// 		"path": "examWidght/index",
+		// 		"style": {
+		// 			// "navigationBarTitleText": "uni-app"
+		// 			"navigationStyle": "custom"
+		// 		}
+		// 	}]
+		// }
+		// {
+		// 	"root": "examWidght",
+		// 	"pages": [{
+		// 		"path": "examWidght/index",
+		// 		"style": {
+		// 			"navigationBarTitleText": "量表",
+		// 			"enablePullDownRefresh": false
+		// 		}
+		// 	}]
+		// },
 	],
 	"subPackages": [{
 		"root": "examWidght",

+ 3 - 0
pages/index/index.vue

@@ -9,9 +9,12 @@
 				<image class='main_scale_top_img' src="../../static/images/topImg.png" mode="widthFix"></image>
 			</a>
 			<view class='main_scale_name'>
+				<!-- <img style='width:50px;height:30px' src='/static/images/main-left.png' /> -->
 				<view class='main_top_name'>{{scaleInfoNew.scaleName}}</view>
+				<!-- <img style='width:50px;height:28px' src='/static/images/main-right.png' /> -->
 			</view>
 
+			<!-- <view class='main_scale_des'>{{scaleDes}}</view> -->
 			<view class='main_scale_num'>{{scaleInfoNew.testNum}}人测试过</view>
 		</view>
 		<view class='main_scale_cpll_out'>

+ 589 - 0
paymentPage/paymentPage/index.vue

@@ -0,0 +1,589 @@
+<template>
+	<view class="top_main">
+		<view class="top_page_out">
+			<view class="top_page">
+				<view>
+					<view class="pay_title">已为您生成深度分析报告</view>
+					<!-- <img class='top_page_img' src='/static/images/top_1.png' /> -->
+					<view class="top_page_tab">
+						<view class="top_page_m">
+							<view style="margin-left: 23px">
+								<img style="width: 80px; height: 80px" src="/static/images/top_2.png" />
+							</view>
+							<view class="top_page_tab_right">
+								<view class="top_page_scale_title">{{orderInfo.description}}</view>
+								<view class="top_page_scale_title">个人深度分析报告</view>
+								<view class="top_page_yh">{{hasDiscount? '限时专享优惠价' : '专享价'}}</view>
+								<view class="top_page_price"> ¥{{hasDiscount? promotionPrice : price}} </view>
+								<!-- <view class='top_people'>
+									100.3w<text class='page_yice'>人已测</text>
+								</view> -->
+							</view>
+						</view>
+						<view class="top_page_b">
+							<button class="top_page_b_b">{{hasDiscount? promotionPrice : price}}元解锁报告数据</button>
+						</view>
+					</view>
+				</view>
+				<!-- <view style="margin-top: 40px">
+					<view class="main_scale_gmcp">
+						<img class="main_xing_left" src="/static/images/xing_left3.png" />
+						<view class="main_scale_font_gmcp">购买测评的这样说</view>
+						<img class="main_xing_right" src="/static/images/xing_right3.png" />
+					</view>
+				</view>
+				<view class="scale_gmcp_connent">
+					<view style="display: flex; margin-bottom: 20px">
+						<img style="width: 43px; height: 43px; border-radius: 50%" src="/static/images/topImg1.png" />
+						<view style="margin-left: 20px">
+							<view class="pub_time">发布时间:2023-01-01 12:00</view>
+							<view class="pub_connnet">测得很准</view>
+						</view>
+					</view>
+					<view style="display: flex">
+						<img style="width: 43px; height: 43px; border-radius: 50%" src="/static/images/phone2.png" />
+						<view style="margin-left: 20px">
+							<view class="pub_time">发布时间:2023-05-01 12:00</view>
+							<view class="pub_connnet">确实不错</view>
+						</view>
+					</view>
+				</view> -->
+			</view>
+		</view>
+
+		<view class="top_footer">
+			<template v-if="hasDiscount">
+				<view class="pay_price">
+					<!-- <view class='pay_price_y'>优惠价</view> -->
+					<view class="pay_price_p">¥{{price}}</view>
+					<view class="pro_tag">优惠价:¥<text class="price"> {{promotionPrice}}</text></view>
+				</view>
+				<view style="display: flex;justify-content: space-between; align-items: center; margin: 20rpx 0;">
+					<view class="people_sy"> 本次优惠剩余名额:{{residueNum}} </view>
+					<view class="people_sy_time">
+						<!-- <uni-countdown :show-day="false" :hour="testHour" :minute="testMinute" :second="testSecond" /> -->
+						<text>倒计时:</text><uni-countdown :show-day="true" background-color="#FF9D41" color="#ffffff"
+							:start="start" :hour="testHour" :minute="testMinute" :second="testSecond" />
+					</view>
+				</view>
+			</template>
+			<!-- <view>
+				<radio-group @change="radioChange" class='radio_class_1'>
+					<label class='radio_class' v-for="(item, index) in payList" :key="item.value">
+						<img style='width:25px;height:25px' :src='item.url' />&nbsp;
+						<view>{{item.value}}</view>&nbsp;
+						<view>
+							<radio :value="item.value" color='#fe605f' :checked="index === current" />
+						</view>
+					</label>
+				</radio-group>
+			</view> -->
+			<view style="margin-bottom: 20rpx;">
+				<button class="top_page_b_1" @click="getH5Pay()">
+					<text class="price-suo">{{hasDiscount? promotionPrice : price}}元解锁报告数据</text>
+				</button>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import {
+		timestampFormatter
+	} from '../../utils/util.js'
+	export default {
+		data() {
+			return {
+				current: 0,
+				payList: [{
+						index: 1,
+						value: "微信支付",
+						url: new URL(`/static/images/wx.png`, import.meta.url).href,
+						checked: true,
+					},
+					{
+						index: 1,
+						value: "支付宝支付",
+						url: new URL(`/static/images/zfb.png`, import.meta.url).href,
+						checked: false,
+					},
+				],
+				orderInfo: null,
+				residueNum: 0, // 剩余名额
+				price: 0, // 正常价格
+				promotionPrice: 0, // 优惠价格
+				promotionEndTime: 0, // 结束时间(时间戳)
+				testHour: 0, // 时
+				testMinute: 0, // 分
+				testSecond: 0, // 秒
+				start: false
+			};
+		},
+		computed: {
+			// 是否有折扣
+			hasDiscount() {
+				let timeSpan = new Date().getTime();
+				let endTime = this.promotionEndTime - timeSpan;
+				return this.residueNum > 0 && endTime > 0
+			}
+		},
+		onLoad(options) {
+			if (options.orderNo) {
+				this.orderNo = options.orderNo;
+				this.payEnsure();
+			}
+			this.orderInfo = JSON.parse(sessionStorage.getItem('orderInfo'));
+			this.queryPromotion();
+		},
+		methods: {
+			radioChange() {},
+			// 查询优惠信息
+			queryPromotion() {
+				let _this = this;
+				_this.$request
+					.get({
+						url: `api/promotionInfo/queryPromotionDetail/${this.orderInfo.productId}`,
+						loadingTip: "加载中...",
+						data: {},
+					})
+					.then((res) => {
+						this.residueNum = res.data.residueNum
+						this.price = res.data.price;
+						this.promotionPrice = res.data.promotionPrice;
+						this.promotionEndTime = new Date(res.data.promotionEndTime).getTime()
+						this.getDhms();
+						uni.hideLoading();
+					});
+			},
+
+			// 查询是否有订单
+			queryHasOrder() {
+				let _this = this;
+				_this.$request
+					.get({
+						url: `api/orderInfo/queryOrderByResultIdAndUserId/${this.orderInfo.userId}/${this.orderInfo.resultId}`,
+						loadingTip: "加载中...",
+						data: {},
+					})
+					.then((res) => {
+						uni.hideLoading();
+					});
+			},
+
+			// 检查订单支付状态
+			checkOrder() {
+				let _this = this;
+				_this.$request
+					.get({
+						url: `api/wx-pay/queryOrder/${_this.orderNo}`,
+						loadingTip: "加载中...",
+						data: {},
+					})
+					.then((res) => {
+						uni.hideLoading();
+						let resultInfo = JSON.parse(res.data.body)
+						if (resultInfo.trade_state === 'SUCCESS') {
+							uni.navigateTo({
+								url: `/paymentPage/phoneSave/index?resultId=${this.orderInfo.resultId}&userId=${this.orderInfo.userId}`
+							});
+						} else {
+							return;
+						}
+					});
+			},
+			// 拉起微信支付
+			getH5Pay(params) {
+				let _this = this;
+				uni.showLoading();
+				_this.$request
+					.get({
+						url: `api/orderInfo/queryOrderByResultIdAndUserId/${this.orderInfo.userId}/${this.orderInfo.resultId}`,
+						loadingTip: "加载中...",
+						data: {},
+					})
+					.then((res) => {
+						uni.hideLoading();
+						if (res.data && res.data.orderStatus === '支付成功') {
+							uni.navigateTo({
+								url: `/paymentPage/phoneSave/index?resultId=${this.orderInfo.resultId}&userId=${this.orderInfo.userId}`
+							});
+						} else {
+							_this.orderInfo.total = _this.hasDiscount ? _this.promotionPrice : _this.price;
+							_this.$request
+								.post({
+									url: "api/wx-pay/h5Pay",
+									loadingTip: "加载中...",
+									data: _this.orderInfo
+								})
+								.then((res) => {
+									let redirect_url = encodeURI(
+										`http://hnhong-duo.com/webo/paymentPage/paymentPage/index?orderNo=${res.data.orderNo}`
+									)
+									window.location.href = `${res.data.codeUrl}&redirect_url=${redirect_url}`;
+								});
+						}
+					});
+			},
+			payEnsure() {
+				let _this = this;
+				uni.showModal({
+					title: '支付确认',
+					content: '请在微信内完成支付,如您已支付成功,请点击"已完成支付按钮"',
+					cancelText: '未支付',
+					confirmText: '已完成支付',
+					success() {
+						uni.showLoading({
+							title: ''
+						});
+						_this.checkOrder();
+					},
+					fail() {
+
+					}
+				})
+			},
+
+			// 获取天时分秒
+			getDhms() {
+				let timeSpan = this.promotionEndTime - new Date().getTime();
+				let time = timestampFormatter(timeSpan);
+				this.testHour = time.h;
+				this.testMinute = time.m;
+				this.testSecond = time.s;
+				this.start = true;
+			}
+		},
+	};
+</script>
+
+<style scoped>
+	.top_page {
+		width: 90%;
+
+		/* height: 400px; */
+		padding-left: 5%;
+		padding-right: 5%;
+		overflow-y: scroll;
+	}
+
+	.top_page_out {
+		width: 100%;
+		height: 100vh;
+		background: url(/static/images/top-bg.png) no-repeat center;
+		background-size: cover;
+	}
+
+	.top_page_img {
+		/* max-width: 100%; */
+		width: 100%;
+		margin-top: 100px;
+	}
+
+	.top_main {
+		width: 100%;
+		height: 100vh;
+		background: linear-gradient(180deg, #ffecd5 0%, #ffffff 100%);
+	}
+
+	.top_page_tab {
+		width: 100%;
+		height: 180px;
+		background-color: #ffffff;
+		border-radius: 6px;
+		margin-top: 5px;
+		display: flex;
+		flex-direction: column;
+		justify-content: space-between;
+	}
+
+	.top_page_m {
+		display: flex;
+		flex-direction: row;
+		width: 100%;
+		height: 150px;
+		align-items: center;
+		/* margin-left: 10px;
+		margin-top: 20px; */
+	}
+
+	.top_page_b {
+		margin-left: 20px;
+		margin-right: 20px;
+		/* width: 100%; */
+		/* height:150px; */
+		margin-bottom: 10px;
+	}
+
+	.top_page_tab_right {
+		margin-left: 10px;
+	}
+
+	.top_page_b_b {
+		font-size: 32rpx;
+		line-height: 72rpx;
+		height: 72rpx;
+		background: linear-gradient(270deg, #fc3c3c 0%, #ff9d41 100%);
+		box-shadow: 0px 8rpx 20rpx 0px rgba(244, 107, 107, 0.302);
+		border-radius: 20px 20px 20px 20px;
+		opacity: 1;
+		border: 1px solid #ffe8ba;
+		color: #ffffff;
+	}
+
+	.top_page_b_1 {
+		color: #ffffff;
+		line-height: 80rpx;
+		background: linear-gradient(270deg, #fc3c3c 0%, #ff9d41 100%);
+		box-shadow: 0px 4px 10px 0px rgba(244, 107, 107, 0.302);
+		border-radius: 10px 10px 10px 10px;
+		opacity: 1;
+		border: 1px solid #ffe8ba;
+		margin-left: 10px;
+		margin-right: 10px;
+	}
+
+	.top_page_scale_title {
+		/* margin-bottom: 5px;
+		font-size: 16px;
+		font-weight: 700; */
+		font-size: 14px;
+		font-family: Source Han Sans-Bold, Source Han Sans;
+		font-weight: 700;
+		color: #040000;
+		line-height: 20px;
+	}
+
+	.top_page_price {
+		color: #f94206;
+		font-size: 14px;
+	}
+
+	.page_yice {
+		color: #a4a4a4;
+	}
+
+	.top_people {
+		font-size: 14px;
+		display: flex;
+	}
+
+	.top_page1 {
+		width: 90%;
+		/* height: 400px; */
+		/* background-image: url(/static/images/top-bg.png); */
+		padding-left: 5%;
+		padding-right: 5%;
+	}
+
+	.middle_get {
+		text-align: center;
+		font-size: 16px;
+		font-weight: 700;
+		margin-bottom: 10px;
+		margin-top: 10px;
+	}
+
+	.middle_get::before {
+		background: url("/static/images/middle_left.png");
+		background-size: 100% 100%;
+		content: "";
+		display: inline-flex;
+		width: 50px;
+		height: 10px;
+	}
+
+	.middle_get::after {
+		background: url("/static/images/middle_right.png");
+		background-size: 100% 100%;
+		content: "";
+		display: inline-flex;
+		width: 50px;
+		height: 10px;
+	}
+
+	.middle_get_img {
+		width: 100%;
+	}
+
+	.middle_get_img1 {
+		width: 100%;
+		margin-bottom: 140px;
+	}
+
+	.top_footer {
+		border-top-left-radius: 20px;
+		border-top-right-radius: 20px;
+		background: linear-gradient(355deg, #fff0e5, #fff8e0);
+		width: 100%;
+		/* max-width: 10rem; */
+		position: fixed;
+		bottom: 0;
+	}
+
+	.pay_price {
+		display: flex;
+		align-items: center;
+		padding-top: 10px;
+	}
+
+	.pay_price_y {
+		background-color: #fe605f;
+		margin-left: 20px;
+		margin-right: 5px;
+		color: #ffffff;
+	}
+
+	.pay_price_p {
+		font-size: 32rpx;
+		font-family: Source Han Sans-Bold, Source Han Sans;
+		font-weight: 700;
+		color: #f94206;
+		/* line-height: 38px; */
+		margin-left: 10px;
+	}
+
+	.radio_class {
+		display: flex;
+		background-color: #ffffff;
+		margin-bottom: 10px;
+		padding-left: 10px;
+		padding-right: 10px;
+		padding-top: 5px;
+		border-radius: 5px;
+		padding-bottom: 5px;
+		align-items: center;
+	}
+
+	.radio_class_1 {
+		display: flex;
+		justify-content: space-around;
+	}
+
+	.pay_title {
+		text-align: center;
+		/* margin-top:38px; */
+		font-size: 20px;
+		font-family: AlibabaPuHuiTi-Heavy, AlibabaPuHuiTi;
+		font-weight: 900;
+		color: #500000;
+		line-height: 101px;
+	}
+
+	.top_page_yh {
+		font-size: 14px;
+		font-family: Source Han Sans-Regular, Source Han Sans;
+		font-weight: 400;
+		color: #656c74;
+		line-height: 20px;
+	}
+
+	.main_scale_gmcp {
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.main_scale_font_gmcp {
+		font-size: 16px;
+		font-family: Source Han Sans-Medium, Source Han Sans;
+		font-weight: 700;
+		color: #040000;
+	}
+
+	.main_xing_left {
+		height: 30px;
+		width: 20px;
+		margin-right: 20px;
+	}
+
+	.main_xing_right {
+		height: 30px;
+		width: 20px;
+		margin-left: 20px;
+	}
+
+	.scale_gmcp_connent {
+		margin-top: 10px;
+		background-color: #ffffff;
+		border-radius: 10px 10px 10px 10px;
+		opacity: 1;
+		padding: 24px 15px;
+		margin-bottom: 200px;
+		overflow-y: scroll;
+	}
+
+	.pub_time {
+		margin-top: 5px;
+		font-size: 12px;
+		font-family: Source Han Sans-Regular, Source Han Sans;
+		font-weight: 400;
+		color: #c4c4c4;
+		line-height: 17px;
+	}
+
+	.pub_connnet {
+		font-size: 14px;
+		font-family: Source Han Sans-Regular, Source Han Sans;
+		font-weight: 400;
+		color: #3d3d3d;
+		line-height: 20px;
+	}
+
+	.people_sy {
+		font-size: 14px;
+		font-family: Source Han Sans-Regular, Source Han Sans;
+		font-weight: 400;
+		color: #656c74;
+		line-height: 20px;
+		margin-left: 4px;
+	}
+
+	.people_sy_time {
+		font-size: 14px;
+		font-family: Source Han Sans-Regular, Source Han Sans;
+		font-weight: 400;
+		color: #656c74;
+		line-height: 20px;
+		display: flex;
+		margin-right: 4px;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.time_ol {
+		background: linear-gradient(270deg, #ff9d41 0%, #fc3c3c 100%);
+		border-radius: 4px 4px 4px 4px;
+		padding: 2px;
+		color: #ffffff;
+	}
+
+	.time_mao {
+		color: #ff9d41;
+	}
+
+	.price-suo {
+		font-size: 16px;
+		font-family: Source Han Sans-Regular, Source Han Sans;
+		font-weight: 400;
+		color: #ffffff;
+		line-height: 40px;
+	}
+
+	.pro_tag {
+		padding: 12rpx 20rpx;
+		background: #EA0000;
+		border-radius: 40rpx 40rpx 40rpx 40rpx;
+		margin-left: 16rpx;
+		color: #ffffff;
+		display: flex;
+		align-items: center;
+		font-size: 24rpx;
+
+		.price {
+			font-size: 39rpx !important;
+			font-weight: 700;
+			margin: 0 0 10rpx 10rpx;
+		}
+	}
+</style>

BIN
static/images/1.jpg


BIN
static/images/2.jpg


BIN
static/images/3.jpg


BIN
static/images/phone-class.png


BIN
static/images/phone1.png


BIN
static/images/phone2.png


BIN
static/images/question_main.png


BIN
static/images/question_main1.png


BIN
static/images/sj1.png


BIN
static/images/success_icon.png


BIN
static/images/top-bg.png


BIN
static/images/top-bg1.png


BIN
static/images/topImg.png


BIN
static/images/topImg1.png


BIN
static/images/top_1.png


BIN
static/images/top_12.png


BIN
static/images/top_2.png


BIN
static/images/xing_left1.png


BIN
static/images/xing_left2.png


BIN
static/images/xing_left3.png


BIN
static/images/xing_left4.png


BIN
static/images/xing_right1.png


BIN
static/images/xing_right2.png


BIN
static/images/xing_right3.png


BIN
static/images/xing_right4.png


+ 0 - 19
unpackage/dist/dev/mp-toutiao/project.private.config.json

@@ -1,19 +0,0 @@
-{
-    "condition": {
-        "miniprogram": {
-            "current": -1,
-            "list": [
-                {
-                    "id": 1715760685287,
-                    "name": "newScale/EQtest/testResult",
-                    "pathName": "newScale/EQtest/testResult",
-                    "query": "resultId=ff8081818f7b2de3018f7b4bdffb000e",
-                    "scene": "011001",
-                    "launchFrom": "search_used_list",
-                    "location": "",
-                    "mockUpdateType": "Noupdate"
-                }
-            ]
-        }
-    }
-}