Răsfoiți Sursa

方案列表以及详情对接

liyuliangjiazai 4 luni în urmă
părinte
comite
73f4aaada9

+ 2 - 2
code/ajyApp/manifest.json

@@ -2,8 +2,8 @@
     "name" : "ajyApp",
     "appid" : "__UNI__A3304B5",
     "description" : "",
-    "versionName" : "1.0.1",
-    "versionCode" : 101,
+    "versionName" : "1.0.2",
+    "versionCode" : 102,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 3 - 3
code/ajyApp/pages/device/deviceInfo/deviceInfo.nvue

@@ -96,9 +96,9 @@
 					<view class="modeBtn" v-if="picMode===2" @click="picModeChange(1)" :class="picMode===1?'curBtn':''">
 						<text class="modeBtnTxt" :style="{color:picMode===1?'#545F71':'#fff'}">设备</text>
 					</view>
-					<view class="modeBtn" @click="picModeChange(2)" :class="picMode===2?'curBtn':''">
+					<!--<view class="modeBtn" @click="picModeChange(2)" :class="picMode===2?'curBtn':''">
 						<text class="modeBtnTxt" :style="{color:picMode===2?'#545F71':'#fff'}">穴位</text>
-					</view>
+					</view>-->
 				</view>
 
 				<!-- 穴位图 -->
@@ -287,7 +287,7 @@
 						<text class="planActionBtn planEditBtn" @click="goEditCustomPlan(item)">编辑</text>
 						<text class="planActionBtn planDeleteBtn" @click="confirmDeletePlan(item)">删除</text>
 					</view>
-					<view class="planItemCheck" v-else>
+					<view class="planItemCheck" v-else @click="selectPlan(item)">
 						<view class="checkboxCustom">
 							<view v-if="selectedPlan && selectedPlan.id === item.id" class="checkboxCircle"></view>
 						</view>

+ 41 - 22
code/ajyApp/pages/device/deviceInfo/mixins/plan-mixin.js

@@ -2,7 +2,7 @@
  * 方案管理 mixin
  * 负责:方案列表加载、子方案选择、模式切换时刷新方案
  */
-import { getCareList, getCareDetail, getCustomPlanList, getCustomPlanDetail, deleteCustomPlan } from '@/utils/api/care.js'
+import { getCustomPlanList, getCustomPlanDetail, deleteCustomPlan, getProfessionalPlanList, getProfessionalPlanDetail, getMasterPlanList, getMasterPlanDetail } from '@/utils/api/care.js'
 
 export default {
 	data() {
@@ -41,9 +41,10 @@ export default {
 		async loadPlanList(mode) {
 			this.planLoading = true
 			try {
+				let res
 				if (mode === 2) {
 					// 自定义模式 - 使用自定义方案列表接口
-					const res = await getCustomPlanList()
+					res = await getCustomPlanList()
 					if (res && Array.isArray(res)) {
 						this.planList = res.map(item => ({
 							id: item.id,
@@ -57,24 +58,14 @@ export default {
 					} else {
 						this.planList = []
 					}
-				} else {
-					// 专业模式/延年圣手模式 - 使用原有调理方案列表接口
-					const modeMap = {
-						1: 'PROFESSIONAL',
-						3: 'EXPERT'
-					}
-					const res = await getCareList({ modeType: modeMap[mode] || '' })
-					if (res && res.records) {
-						this.planList = res.records.map(item => ({
-							id: item.id,
-							name: item.title || item.name || '未命名方案',
-							description: item.description || item.remark || '',
-							steps: item.stepCount || item.steps || 0,
-							duration: item.totalDuration || 0
-						}))
-					} else {
-						this.planList = []
-					}
+				} else if (mode === 1) {
+					// 专业模式 - 使用专业模式方案列表接口
+					res = await getProfessionalPlanList()
+					this.planList = this._mapSystemPlanList(res)
+				} else if (mode === 3) {
+					// 延年圣手模式 - 使用延年圣手方案列表接口
+					res = await getMasterPlanList()
+					this.planList = this._mapSystemPlanList(res)
 				}
 			} catch (e) {
 				console.error('加载方案列表失败', e)
@@ -83,6 +74,30 @@ export default {
 			this.planLoading = false
 		},
 
+		/** 映射系统方案列表数据(专业模式/延年圣手模式通用) */
+		_mapSystemPlanList(res) {
+			if (res && Array.isArray(res)) {
+				return res.map(item => ({
+					id: item.id,
+					name: item.name || item.title || '未命名方案',
+					description: item.description || item.remark || '',
+					steps: item.stepCount || item.steps || 0,
+					duration: item.totalDuration || item.duration || 0
+				}))
+			}
+			// 兼容分页结构
+			if (res && res.records) {
+				return res.records.map(item => ({
+					id: item.id,
+					name: item.name || item.title || '未命名方案',
+					description: item.description || item.remark || '',
+					steps: item.stepCount || item.steps || 0,
+					duration: item.totalDuration || item.duration || 0
+				}))
+			}
+			return []
+		},
+
 		/** 打开方案选择弹窗 */
 		showPlanDrawer() {
 			if (this.planList.length === 0 && this.modeType !== 0) {
@@ -149,8 +164,12 @@ export default {
 				if (this.modeType === 2) {
 					// 自定义模式 - 使用自定义方案详情接口
 					res = await getCustomPlanDetail(plan.id)
-				} else {
-					res = await getCareDetail(plan.id)
+				} else if (this.modeType === 1) {
+					// 专业模式 - 使用专业模式方案详情接口
+					res = await getProfessionalPlanDetail(plan.id)
+				} else if (this.modeType === 3) {
+					// 延年圣手模式 - 使用延年圣手方案详情接口
+					res = await getMasterPlanDetail(plan.id)
 				}
 				if (res && res.steps) {
 					this.curCase = res.steps.map(step => ({

+ 36 - 0
code/ajyApp/utils/api/care.js

@@ -46,6 +46,42 @@ export function getCareDetail(id) {
 	return http.get('/userCare/careDetail', { data: { id } })
 }
 
+/**
+ * 获取专业模式方案列表
+ * 所有 APP 用户共享同一份方案,仅返回已发布方案
+ * @returns {Promise<Array>}
+ */
+export function getProfessionalPlanList() {
+	return http.get('/app/professional-plan/list')
+}
+
+/**
+ * 获取专业模式方案详情(含穴位步骤列表)
+ * @param {string|number} id - 方案ID
+ * @returns {Promise<Object>}
+ */
+export function getProfessionalPlanDetail(id) {
+	return http.get(`/app/professional-plan/${id}`)
+}
+
+/**
+ * 获取延年圣手模式方案列表
+ * 所有 APP 用户共享同一份方案,仅返回已发布方案
+ * @returns {Promise<Array>}
+ */
+export function getMasterPlanList() {
+	return http.get('/app/master-plan/list')
+}
+
+/**
+ * 获取延年圣手模式方案详情(含穴位步骤列表)
+ * @param {string|number} id - 方案ID
+ * @returns {Promise<Object>}
+ */
+export function getMasterPlanDetail(id) {
+	return http.get(`/app/master-plan/${id}`)
+}
+
 /**
  * 新增用户自定义方案
  * @param {Object} data - 方案数据 { name, symptoms, applicableGender, ageMin, ageMax, description, status, steps }

+ 2 - 2
code/ajyApp/utils/http/config.js

@@ -12,9 +12,9 @@ baseUrl = '/api' // H5 走代理
 
 // #ifdef APP-PLUS || MP-WEIXIN || MP-ALIPAY
 // baseUrl = 'http://110.177.148.159:18888/api'
-baseUrl = 'http://192.168.1.5:18888/api' // TODO: 替换为实际接口域名
+// baseUrl = 'http://192.168.1.5:18888/api' // TODO: 替换为实际接口域名
 // #endif
- // baseUrl = 'http://ajy.iwintrue.com/api'
+ baseUrl = 'http://ajy.iwintrue.com/api'
 export default {
   // 接口基础地址
   baseUrl,