Browse Source

update 选 拼

wangxy 3 tháng trước cách đây
mục cha
commit
7f373da57f

+ 12 - 0
api/word.js

@@ -35,6 +35,18 @@ export function getWordInfo(data = {}) {
   })
 }
 
+export function getCommonWordInfo(data = {}) {
+  return request({
+    'url': '/common/word/info',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
+}
+
 export function getWordWancheng(data = {}) {
   return request({
     'url': '/app/word/wancheng',

+ 3 - 3
pages/newEnglish/components/beiPage.vue

@@ -13,7 +13,7 @@
 		<view class="bei-body-box">
 			<!-- 提示 -->
 			<!-- <view class="pin-tip">提示:请点击页面下方键盘,输入正确字母。</view> -->
-			
+
 			<!-- 解释区 需要分成多行 大哥看这里-->
 			<view class="pin-words-explain-box">
 				<view class="words-explain-item">{{activeWord.jianyi.join(';')}}</view>
@@ -36,7 +36,7 @@
 				<btnTxtVue @text-select="handleSelect('g')">g</btnTxtVue>
 				<btnTxtVue @text-select="handleSelect('h')">h</btnTxtVue>
 				<btnTxtVue @text-select="handleSelect('i')">i</btnTxtVue>
-	
+
 			</view>
 			<view class="keyboard-row">
 				<btnTxtVue @text-select="handleSelect('j')">j</btnTxtVue>
@@ -122,7 +122,7 @@
 		}
 
 	}
-	
+
 	function handleSelect(word) {
 		console.log('xxxx',word)
 		data.answer+=word;

+ 2 - 1
pages/newEnglish/components/btnTxt.vue

@@ -15,11 +15,12 @@
 	// 按下状态
 	const btnStatus = ref(false)
 	
-	const emits = defineEmits(['text-select'])
+	const emits = defineEmits(['text-select', 'touch-start','touch-end'])
 
 	// 按下
 	function handleTouchStart() {
 		btnStatus.value = true // 按下变红色
+		emits('touch-start')
 	}
 	// 松开
 	function handleTouchEnd() {

+ 26 - 11
pages/newEnglish/index.vue

@@ -183,17 +183,32 @@
 	}
 
 	function initWordInfo() {
-		httpApi.getWordInfo({
-			jieId: data.jieId,
-			wordId: data.activeId
-		}).then(res => {
-			data.activeWord = res.data;
-			data.wordList = res.data.danciList; // 单词组
-			data.collectFlag = res.data.collectFlag; // 收藏状态
-			if (data.wordList.length) {
-				data.arrayList = chunkArray(data.wordList, 5); // 将1维单词数组转换为2维数组
-			}
-		})
+		
+		if (userCode !== 'Visitor') {
+			httpApi.getWordInfo({
+				jieId: data.jieId,
+				wordId: data.activeId
+			}).then(res => {
+				data.activeWord = res.data;
+				data.wordList = res.data.danciList; // 单词组
+				data.collectFlag = res.data.collectFlag; // 收藏状态
+				if (data.wordList.length) {
+					data.arrayList = chunkArray(data.wordList, 5); // 将1维单词数组转换为2维数组
+				}
+			})
+		} else {
+			httpApi.getCommonWordInfo({
+				jieId: data.jieId,
+				wordId: data.activeId
+			}).then(res => {
+				data.activeWord = res.data;
+				data.wordList = res.data.danciList; // 单词组
+				data.collectFlag = res.data.collectFlag; // 收藏状态
+				if (data.wordList.length) {
+					data.arrayList = chunkArray(data.wordList, 5); // 将1维单词数组转换为2维数组
+				}
+			})
+		}
 	}
 </script>