Jelajahi Sumber

Merge branch 'develop' into project/ZJ.330681

* develop:
  点击慢病管理按钮校验用户是否登录
  唐古增加跳转H5链接的按钮
  后端修改了上传图片的地址,前段同步
  优化调养计划中机构和后面的名称不对齐
  给唐古加跳转按钮
cc12458 8 jam lalu
induk
melakukan
3cf76397ed

+ 1 - 1
miniprogram/app.config.ts

@@ -11,7 +11,7 @@ if (env === "trial") {
 }
 export const HOST = host;
 export const Base_URL = `https://${host}/manager/fdhb-mobile`;
-export const Upload_URL = `https://${host}/manager/file`;
+// export const Upload_URL = `https://${host}/manager/file`;
 export const Locale_URL = `https://${host}/admin/i18n`
 export const ENV = env;
 

+ 11 - 4
miniprogram/lib/request/upload.ts

@@ -1,15 +1,19 @@
-import { Upload_URL } from "../../app.config";
+// import { Upload_URL } from "../../app.config";
+import { Base_URL } from "../../app.config";
 import { upload as _upload } from "../wx/network";
+import { getAccountInfoSync } from "../wx/open-api";
 
 import { token } from "../logic";
 
+const miniProgram = getAccountInfoSync();
+
 const Instance = (function createUploadRequest(option: IRequestCreateConfig) {
   const { baseURL } = option;
 
   return <R, T>(config: IUploadConfig<R, T>) => {
     let { url, data, params, header, meta, transform = (params: any) => params, ..._config } = config;
-
-    url ??= `/upload`;
+    // url ??= `/upload`;
+    url ??= `/common/upload`;
     header ??= {};
 
 
@@ -17,6 +21,8 @@ const Instance = (function createUploadRequest(option: IRequestCreateConfig) {
 
     // header['patientId'] = wx.getStorageSync('patientId') ?? '';
     // header['doctorId'] = wx.getStorageSync('doctorId') ?? '';
+    header['appId'] = miniProgram.appId ?? '';
+    header['env'] = miniProgram.envVersion ?? '';
 
     return _upload({
       url: /https?\:\/\//.test(url) ? url : `${baseURL}${url}`,
@@ -29,7 +35,8 @@ const Instance = (function createUploadRequest(option: IRequestCreateConfig) {
     }));
   }
 })({
-  baseURL: Upload_URL,
+  // baseURL: Upload_URL,
+  baseURL: Base_URL,
   token: token
 })
 

+ 1 - 2
miniprogram/module/article/pages/science-info/science-info.ts

@@ -9,10 +9,9 @@ Component({
   behaviors: [PageContainerBehavior, tickleBehavior],
   lifetimes: {
     attached() {
-      console.log(this.data, "this.data===获取宣教传来的参数111");
       const channel = this.getOpenerEventChannel();
       channel.on?.("load", (data: AnyObject) => {
-        console.log(data, "data===获取宣教传来的参数");
+        console.log(data, "data===获取来的参数");
         // 支持直接传入外链 URL,直接使用 web-view 打开 新加的
         if (data?.url) {
           this.setData({

+ 21 - 0
miniprogram/pages/home/home.scss

@@ -571,6 +571,27 @@ $scale: 0.5;
   height: 32rpx;
 }
 
+.chronic-container {
+  margin-top: 10px;
+  padding: 0px 9px;
+}
+
+.chronic-card {
+  background: #4165f4;
+  color: #fff;
+  font-weight: bold;
+  font-size: 32rpx;
+  border-radius: 12rpx;
+  padding: 20rpx;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.chronic-title {
+  text-align: center;
+}
+
 // 详细内容
 .detail-image {
   width: 120rpx;

+ 43 - 0
miniprogram/pages/home/home.ts

@@ -24,6 +24,8 @@ import {
   getPatientDescription,
   getNotDealLists,
   getCareList,
+  getChronicDiseaseManageName,
+  getChronicDiseaseManageUrl,
 } from "./request";
 import { toCertificationPage, toChats } from "./router";
 import { Post } from "../../lib/request/method";
@@ -41,6 +43,7 @@ Page({
     NoteTitle: "",
     isShowComplete: true,
     careList: [],
+    chronicDiseaseName: "",
     displayList: [] as {
       id: number;
       conditioningProgramType: string;
@@ -460,6 +463,14 @@ Page({
     }
     // 加载健康宣教的文章
     this.loadScienceList(true);
+    //获取慢病管理按钮名称:为空则不显示按钮,非空则作为按钮文案
+    getChronicDiseaseManageName()
+      .then((name) => {
+        this.setData({ chronicDiseaseName: name });
+      })
+      .catch((error) => {
+        wx.showToast({ title: error.message || "加载失败" });
+      });
     if (!this.data._loaded) {
       getSolarTerms()
         .then((solarTerms) => {
@@ -691,6 +702,38 @@ Page({
   toSciencePage() {
     wx.navigateTo({ url: `/module/article/pages/science-list/science-list` });
   },
+  //获取跳转慢病管理链接
+  async goChronicDisease() {
+    // 校验登录态:未登录(无 patientId)则提示并跳转登录页
+    if (!this.data.patient?.patientId) {
+      wx.showToast({ title: "请先登录", icon: "none" });
+      toCertificationPage();
+      return;
+    }
+    wx.showLoading({ title: "加载中" });
+    let url = "";
+    try {
+      url = await getChronicDiseaseManageUrl();
+    } catch (error: any) {
+      wx.hideLoading();
+      wx.showToast({
+        title: error?.errMsg || "加载失败",
+        icon: "none",
+      });
+      return;
+    }
+    wx.hideLoading();
+    if (!url) {
+      wx.showToast({ title: "暂无链接", icon: "none" });
+      return;
+    }
+    wx.navigateTo({
+      url: "/module/article/pages/science-info/science-info",
+      success: (res) => {
+        res.eventChannel?.emit?.("load", { title: this.data.chronicDiseaseName, url });
+      },
+    });
+  },
   async toReportPage() {
     // const { patient } = await getPatients(/*this.data.patientId*/);
     if (!this.data.patient) await toCertificationPage();

+ 9 - 4
miniprogram/pages/home/home.wxml

@@ -106,14 +106,12 @@
                   <view class="item-box">
                     <view class="flex" wx:if="{{item.arrangeDate && item.sellType==='2'}}"><text>下一次时间:</text><text>{{item.arrangeDate}}</text></view>
                     <view class="flex">
-                      <text wx:if="{{item.sellType==='2'}}">已完成:<text style="color:#2ec4b6">{{item.finishCount}}次</text><text style="margin:0 5px">/</text>
-                        <text>{{item.totalMeasure}}次</text></text>
+                      <text wx:if="{{item.sellType==='2'}}">已完成:<text style="color:#2ec4b6">{{item.finishCount}}次</text><text style="margin:0 5px">/</text><text>{{item.totalMeasure}}次</text></text>
 
                     </view>
                     <view>频次:每{{item.frequencyType}}天{{item.frequencyMeasure}}{{item.convertUnit?item.convertUnit:'次'}}</view>
                     <view>开具医生:{{item.operateBy}}</view>
-                    <view wx:if="{{item.sellType==='2'}}" class="ins-box"><text>机构:</text><text class="copyable-text" catchlongpress="onCopyInstitutionName" data-name="{{item.conditioningProgramSupplierName}}">
-                    {{item.conditioningProgramSupplierName?item.conditioningProgramSupplierName:'-'}}</text></view>
+                    <view wx:if="{{item.sellType==='2'}}" class="ins-box"><text>机构:</text><text class="copyable-text" catchlongpress="onCopyInstitutionName" data-name="{{item.conditioningProgramSupplierName}}">{{item.conditioningProgramSupplierName?item.conditioningProgramSupplierName:'-'}}</text></view>
                   </view>
                 </view>
                 <view data-id="{{item.id}}" wx:if="{{item.sellType!=='2'}}" class="verify-record" bindtap="isGoPunchcard" data-signinTime="{{item.signinTime}}">{{
@@ -133,6 +131,13 @@
       </view>
     </view>
 
+    <!-- 慢病管理入口,点击跳转 H5-->
+    <view class="chronic-container" wx:if="{{chronicDiseaseName}}" bindtap="goChronicDisease">
+      <view class="chronic-card">
+        <text class="chronic-title">{{chronicDiseaseName}}</text>
+      </view>
+    </view>
+
     <view class="science-list-wrapper" wx:if="{{scienceList.length}}">
       <view class="list-title" bind:tap="toSciencePage">
         <view class="missionary">{{i18n.healthTeach.title}}</view>

+ 26 - 0
miniprogram/pages/home/request.ts

@@ -28,6 +28,32 @@ export function getCareList() {
   );
 }
 
+// 获取唐古慢病管理按钮名称(返回字符串:为空则不显示按钮,非空则作为按钮文案)
+export function getChronicDiseaseManageName() {
+  return Post(
+    "/surplus/isShowTangGuBtn",
+    {},
+    {
+      transform({ data }: AnyObject) {
+        return typeof data === "string" ? data : "";
+      },
+    }
+  );
+}
+
+// 获取唐古慢病管理 H5 跳转链接
+export function getChronicDiseaseManageUrl() {
+  return Post(
+    "/surplus/getTangGuBtnUrl",
+    {},
+    {
+      transform({ data }: AnyObject) {
+        return typeof data === "string" ? data : "";
+      },
+    }
+  );
+}
+
 export function getPatients(id?: string) {
   id ??= wx.getStorageSync("patientId");
   const transform = ({ data }: AnyObject) => {