Browse Source

体质诊断检测表,添加舌头状态

hanchong 1 year ago
parent
commit
f522d7ab80

+ 39 - 17
subpages/constitutionDiagnosis/constitutionDiagnosis.js

@@ -6,7 +6,7 @@ const homeApi = "https://fare.somnisix.top";
 const homeApiTest = "http://localhost:8080";
 const token = "eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjoxLCJ1c2VyX2tleSI6Ijk5YzI3MjI2LTdkOWQtNDhiOC1hYjlhLWM4YjVjYWZiZGNkNyIsInVzZXJuYW1lIjoiYWRtaW4ifQ.zITQOINFkHs19_1RAgHS4I9YMaVxVq0Dsn3t6r_K7rv3rXvJy0sMtodejIMi_PNa_m4uQYxnU-6k3wC2LZht_Q";
 
-
+let countABCDEF;
 Page({
 	data: {
 
@@ -111,18 +111,24 @@ Page({
 		
 		//七、睡眠
 		sleepOptions: [
-			{ value: '0',remark: 'A', label: '过度依赖人际关系' },
-			{ value: '1',remark: 'B', label: '具有攻击性,不善于体谅别人' },
-			{ value: '2',remark: 'C', label: '属冷静、认真型' },	
-			{ value: '3',remark: 'C', label: '善于制造一个自我世界并沉溺其中' },	
-			{ value: '4',remark: 'D', label: '忍耐性较强的性格,容易积聚压力' },	
-			{ value: '5',remark: 'D', label: '接人待物中规中矩,严守礼节' },	
-			{ value: '6',remark: 'F', label: '以自我为中心,争强好胜,嫉妒心强,爱慕虚荣' },	
-			{ value: '7',remark: 'F', label: '喜欢奢华、热闹的氛围' },	
+			{ value: '0',remark: 'B', label: '入睡闲难' },
+			{ value: '1',remark: 'C', label: '睡眠浅,易做梦' },
 		],
 		
 		sleep: [],// 七、睡眠
 		
+		//八、舌头状态
+		tongueStateOptions: [
+			{ value: '0',remark: 'A', label: '整体色淡;厚、肿大;边缘呈齿状' },
+			{ value: '1',remark: 'B', label: '两侧赤红;中间色淡或偏白;薄薄的黄色舌苔' },
+			{ value: '2',remark: 'C', label: '舌体偏小;色淡、偏白,舌苔整体偏薄' },	
+			{ value: '3',remark: 'D', label: '舌色暗、偏紫色;有黑色斑点;舌下两根静脉粗粗地浮现出来' },	
+			{ value: '4',remark: 'E', label: '舌色整体发红;舌苔少、甚至没有;舌面有齿痕' },	
+			{ value: '5',remark: 'F', label: '舌苔厚、黏黏糊糊;舌苔色黄或白;舌体肿胀' },
+		],
+		
+		tongueState: [],// 八、舌头状态
+		
 		comScore: 0,
 		comScoreStatus: '',
 		comScoreIndex: 0,
@@ -228,9 +234,18 @@ Page({
 			sleep: e.detail
 		});
 	},
-	//统计这6个数组,总共包含A,B,C,D,E,F的个数,返回最多的一项:
-	//如果一样多,返回最多的几个,如果都是0或者空,返回空
-	findMostFrequentLetters: function(arr1, arr2, arr3, arr4, arr5, arr6, arr7) {  
+	
+	// 八、舌头状态
+	bindTongueState: function (e) {
+		console.log(e)
+		this.setData({
+			tongueState: e.detail
+		});
+	},
+	
+	//统计这8个数组,总共包含A,B,C,D,E,F的个数,返回最多的一项(也可能多项):
+	//如果有多个 最多 的情况,返回最多的几个,如果都是0或者空,返回空
+	findMostFrequentLetters: function(arr1, arr2, arr3, arr4, arr5, arr6, arr7, arr8) {  
 		
 		console.log('arr1='+arr1);
 		console.log('arr2='+arr2);
@@ -239,8 +254,9 @@ Page({
 		console.log('arr5='+arr5);
 		console.log('arr6='+arr6);
 		console.log('arr7='+arr7);
+		console.log('arr8='+arr8);
 		//判断6个数组是否都为空
-		if(this.areAllArraysEmpty(arr1, arr2, arr3, arr4, arr5, arr6, arr7))
+		if(this.areAllArraysEmpty(arr1, arr2, arr3, arr4, arr5, arr6, arr7, arr8))
 		return '';
 	    // 初始化一个对象来存储每个字母的计数  
 	        const letterCounts = {  
@@ -271,7 +287,8 @@ Page({
 	        updateCounts(arr5);  
 	        updateCounts(arr6);  
 			updateCounts(arr7);
-	      
+			updateCounts(arr8);
+			countABCDEF = letterCounts;
 	        // 找出出现次数最多的字母及其计数  
 	        let maxCount = 0;  
 	        let mostFrequentLetters = [];  
@@ -347,7 +364,8 @@ Page({
 												  this.getRemarkValues(this.data.emotionOptions,this.data.emotion),
 												  this.getRemarkValues(this.data.menstruationOptions,this.data.menstruation),
 												  this.getRemarkValues(this.data.characterOptions,this.data.character),
-												  this.getRemarkValues(this.data.sleepOptions,this.data.sleep)
+												  this.getRemarkValues(this.data.sleepOptions,this.data.sleep),
+												  this.getRemarkValues(this.data.tongueStateOptions,this.data.tongueState)
 										);
 		let comScoreIndex = [];
 		let _comScoreStatus = "";
@@ -459,6 +477,10 @@ Page({
 			menstruation: (!this.data.menstruation || this.data.menstruation.length === 0) ? '' : (Array.isArray(this.data.menstruation) ? this.data.menstruation.map(item => String(item)).join(',') : this.data.menstruation),
 			character: (!this.data.character || this.data.character.length === 0) ? '' : (Array.isArray(this.data.character) ? this.data.character.map(item => String(item)).join(',') : this.data.character),
 			sleep: (!this.data.sleep || this.data.sleep.length === 0) ? '' : (Array.isArray(this.data.sleep) ? this.data.sleep.map(item => String(item)).join(',') : this.data.sleep),
+			//舌头状态是新增加项,赋给value1了,数据库里有value1...value8,以备增加项用
+			value1: (!this.data.tongueState || this.data.tongueState.length === 0) ? '' : (Array.isArray(this.data.tongueState) ? this.data.tongueState.map(item => String(item)).join(',') : this.data.tongueState),
+			//value2 保存A、B、C、D、E、F 每个的个数
+			value2:JSON.stringify(countABCDEF),
 			comScoreStatus: _comScoreStatus,
 			comScoreIndex: comScoreIndex,
 			comScoreDesc: _comScoreDesc,
@@ -600,9 +622,9 @@ Page({
 		} */
 		
 	},
-	areAllArraysEmpty: function (arr1, arr2, arr3, arr4, arr5, arr6, arr7) {  
+	areAllArraysEmpty: function (arr1, arr2, arr3, arr4, arr5, arr6, arr7, arr8) {  
 	  // 定义一个数组来包含所有传入的数组  
-	  const arrays = [arr1, arr2, arr3, arr4, arr5, arr6, arr7];  
+	  const arrays = [arr1, arr2, arr3, arr4, arr5, arr6, arr7, arr8];  
 	  
 	  // 遍历这个数组,检查每一项(即传入的数组)是否为空  
 	  for (let i = 0; i < arrays.length; i++) {  

+ 15 - 7
subpages/constitutionDiagnosis/constitutionDiagnosis.wxml

@@ -15,7 +15,6 @@
 	  
 	  <view class='title_1'>一、身体综合(多选)</view>
 	  <view class="section" id="bodySynthesis">
-	    <!-- <text>6、入住之后,您觉得哪些方面让您比较满意?(多选)</text> -->
 	    <van-checkbox-group value="{{ bodySynthesis }}" bind:change="bindBodySynthesis">
 	      <van-checkbox wx:for="{{bodySynthesisOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
 	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
@@ -31,7 +30,6 @@
 	  
 	  <view class='title_1'>二、面部五官(多选)</view>
 	  <view class="section" id="facialFeatures">
-	    <!-- <text>6、入住之后,您觉得哪些方面让您比较满意?(多选)</text> -->
 	    <van-checkbox-group value="{{ facialFeatures }}" bind:change="bindFacialFeatures">
 	      <van-checkbox wx:for="{{facialFeaturesOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
 	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
@@ -47,7 +45,6 @@
 	  
 	  <view class='title_1'>三、皮肤毛发(多选)</view>
 	  <view class="section" id="skinHair">
-	    <!-- <text>6、入住之后,您觉得哪些方面让您比较满意?(多选)</text> -->
 	    <van-checkbox-group value="{{ skinHair }}" bind:change="bindSkinHair">
 	      <van-checkbox wx:for="{{skinHairOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
 	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
@@ -63,7 +60,6 @@
 	  
 	  <view class='title_1'>四、情绪方面(多选)</view>
 	  <view class="section" id="emotion">
-	    <!-- <text>6、入住之后,您觉得哪些方面让您比较满意?(多选)</text> -->
 	    <van-checkbox-group value="{{ emotion }}" bind:change="bindEmotion">
 	      <van-checkbox wx:for="{{emotionOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
 	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
@@ -79,7 +75,6 @@
 	  
 	  <view class='title_1'>五、月经方面(多选)</view>
 	  <view class="section" id="menstruation">
-	    <!-- <text>6、入住之后,您觉得哪些方面让您比较满意?(多选)</text> -->
 	    <van-checkbox-group value="{{ menstruation }}" bind:change="bindMenstruation">
 	      <van-checkbox wx:for="{{menstruationOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
 	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
@@ -95,7 +90,6 @@
 	  
 	  <view class='title_1'>六、性格方面(多选)</view>
 	  <view class="section" id="character">
-	    <!-- <text>6、入住之后,您觉得哪些方面让您比较满意?(多选)</text> -->
 	    <van-checkbox-group value="{{ character }}" bind:change="bindCharacter">
 	      <van-checkbox wx:for="{{characterOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
 	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
@@ -111,7 +105,6 @@
 	  
 	  <view class='title_1'>七、睡眠(多选)</view>
 	  <view class="section" id="sleep">
-	    <!-- <text>6、入住之后,您觉得哪些方面让您比较满意?(多选)</text> -->
 	    <van-checkbox-group value="{{ sleep }}" bind:change="bindSleep">
 	      <van-checkbox wx:for="{{sleepOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
 	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
@@ -124,6 +117,21 @@
 	      </van-checkbox>
 	    </van-checkbox-group>
 	  </view>
+	  
+	  <view class='title_1'>八、舌头状态(多选)</view>
+	  <view class="section" id="tongueState">
+	    <van-checkbox-group value="{{ tongueState }}" bind:change="bindTongueState">
+	      <van-checkbox wx:for="{{tongueStateOptions}}" wx:key="index" shape="square" checked-color="#0ABCA4"
+	        name="{{item.value}}" custom-class="custom-radio-class" use-icon-slot>
+	        <view class="radio-view">
+	          <image class="radio-icon" slot="icon"
+	            src="{{ jstools.includes(tongueState,item.value) ? activeIcon : normalIcon }}" />
+	          <text class="radio-title"
+	            style="{{  jstools.includes(tongueState,item.value) ? activeColor : normalColor }}">{{item.label}}</text>
+	        </view>
+	      </van-checkbox>
+	    </van-checkbox-group>
+	  </view>
 
       <!-- 提交按钮 -->
       <text class="commit-btn" bindtap="submitSurvey">提交问卷</text>