瀏覽代碼

修改微信小程序

wangfumin 1 月之前
父節點
當前提交
60f3e1475f

+ 0 - 1
app.wxss

@@ -1,5 +1,4 @@
 /**app.wxss**/
-@import "utils/wxParse/wxParse.wxss";
 .container {
   height: 100%;
   display: flex;

+ 0 - 1
components/active-time-select/index.wxss

@@ -96,7 +96,6 @@
   margin-bottom: 2rpx;
   color: #584735;
   text-align: center;
-  line-height: 1.2;
 }
 
 .day-status {

+ 0 - 1
components/time-select/time-select.wxss

@@ -96,7 +96,6 @@
   margin-bottom: 2rpx;
   color: #584735;
   text-align: center;
-  line-height: 1.2;
 }
 
 .day-status {

+ 7 - 5
pages/exhibition/activeDetails/index.js

@@ -1,5 +1,6 @@
 // pages/exhibition/activeDetails/index.js
 const { museumApi } = require('../../../utils/api.js');
+const WxParse = require('../../../utils/wxParse/wxParse.js');
 
 Page({
   /**
@@ -193,7 +194,7 @@ Page({
    */
   loadDetailData(options) {
     const { id, type } = options;
-    
+    const that = this;
     if (!id) {
       console.error('缺少ID参数');
       return;
@@ -232,15 +233,16 @@ Page({
       .then(response => {
         if (response) {
           // 获取内容字段
-          const content = this.getContentForParsing(response);
-          const parsedContent = this.parseContent(content);
-          
+          // const content = this.getContentForParsing(response);
+          // const parsedContent = this.parseContent(content);
+          let article = response.context;
+          WxParse.wxParse('article', 'html', article, that, 5);
           // 格式化发布时间
           const formattedTime = this.formatTimeWithDash(response.publish);
           
           this.setData({
             detailData: response,
-            contentItems: parsedContent,
+            // contentItems: parsedContent,
             formattedPublishTime: formattedTime
           });
         }

+ 4 - 12
pages/exhibition/activeDetails/index.wxml

@@ -1,4 +1,5 @@
 <!--pages/exhibition/activeDetails/index.wxml-->
+<import src="../../../utils/wxParse/wxParse.wxml"/> 
 <view class="detail-container">
   <!-- 返回按钮 -->
   <!-- <view wx:if="{{shouldShowBackButton}}" class="back-button" bindtap="goBack">
@@ -24,34 +25,25 @@
 
     <!-- 处理后的内容 -->
     <view wx:if="{{detailData.context}}" class="detail-text">
-      <view class="processed-html-content">
+    <template is="wxParse" data="{{wxParseData: article.nodes}}"/>
+      <!-- <view class="processed-html-content">
         <block wx:for="{{contentItems}}" wx:key="index">
-          <!-- 文本内容 -->
           <text decode='true' wx:if="{{item.type === 'text'}}" class="text-content {{item.indent ? 'indent' : ''}}">{{item.content}}</text>
-          
-          <!-- 包含链接的文本内容 -->
           <view wx:elif="{{item.type === 'text_with_links'}}" class="text-with-links {{item.indent ? 'indent' : ''}}">
             <rich-text nodes="{{item.content}}" class="rich-text-content" bindtap="onRichTextTap" data-links="{{item.links}}"></rich-text>
           </view>
-          
-          <!-- 图片内容 -->
           <view wx:elif="{{item.type === 'image'}}" class="image-item">
             <image src="{{item.src}}" mode="widthFix" class="content-image" lazy-load></image>
           </view>
-          
-          <!-- 视频内容 -->
           <view wx:elif="{{item.type === 'video'}}" class="video-item">
             <video src="{{item.src}}" poster="{{item.poster}}" class="content-video" controls></video>
           </view>
-          
-          <!-- 音频内容 -->
           <view wx:elif="{{item.type === 'audio'}}" class="audio-item">
             <view class="audio-title">{{item.title}}</view>
-            <!-- 小程序中可以使用audio组件或者自定义音频播放器 -->
             <view class="audio-placeholder">音频: {{item.title}}</view>
           </view>
         </block>
-      </view>
+      </view> -->
     </view>
 
     <!-- 展览特有按钮 -->

+ 2 - 1
pages/exhibition/activeDetails/index.wxss

@@ -1,8 +1,9 @@
 /* pages/exhibition/activeDetails/index.wxss */
+@import "../../../utils/wxParse/wxParse.wxss";
 .detail-container {
   position: relative;
   min-height: 100vh;
-  padding: 20rpx 20rpx 80rpx 20rpx;
+  padding: 20rpx 20rpx 130rpx 20rpx;
   background: url('https://sit-kelamayi.4dage.com/mini/wxImg/bg.png') no-repeat;
   background-size: cover;
 }

+ 0 - 3
pages/index/active-people/active-people.wxss

@@ -101,7 +101,6 @@
   border: none;
   color: #F45151;
   font-size: 28rpx;
-  line-height: 36rpx;
 }
 .delete-img{
   width: 32rpx;
@@ -242,8 +241,6 @@
   left: 0;
   right: 0;
   padding: 30rpx;
-  background: white;
-  border-top: 2rpx solid #eee;
 }
 
 .confirm-btn {

+ 3 - 3
pages/index/news/news.wxss

@@ -1,9 +1,9 @@
 /* pages/index/news/news.wxss */
 .news-container {
   position: relative;
-  height: 100vh;
-  padding: 40rpx;
-  background: url('https://sit-kelamayi.4dage.com/mini/wxImg/bg.png') no-repeat;
+  min-height: 100vh;
+  padding: 40rpx 40rpx 0 40rpx;
+  background: url('https://sit-kelamayi.4dage.com/mini/wxImg/bg.png');
   background-size: cover;
 }
 

+ 0 - 3
pages/index/visit-people/visit-people.wxss

@@ -101,7 +101,6 @@
   border: none;
   color: #F45151;
   font-size: 28rpx;
-  line-height: 36rpx;
 }
 .delete-img{
   width: 32rpx;
@@ -242,8 +241,6 @@
   left: 0;
   right: 0;
   padding: 30rpx;
-  background: white;
-  border-top: 2rpx solid #eee;
 }
 
 .confirm-btn {

+ 2 - 3
pages/user/feedback/index.js

@@ -112,10 +112,10 @@ Page({
     
     museumApi.submitFeedback(submitData)
       .then((res) => {
+        wx.hideLoading();
         wx.showToast({
           title: '提交成功',
           icon: 'success',
-          duration: 2000
         });
         
         // 清空表单
@@ -132,8 +132,7 @@ Page({
         // 延迟返回上一页
         setTimeout(() => {
           wx.navigateBack();
-        }, 2000);
-        wx.hideLoading();
+        }, 1000);
       })
       .catch((error) => {
         console.error('提交反馈失败:', error);

+ 1 - 1
pages/user/map/index.wxss

@@ -1,4 +1,5 @@
 /* pages/user/map/index.wxss */
+@import "../../../utils/wxParse/wxParse.wxss";
 .detail-container {
   position: relative;
   min-height: 100vh;
@@ -45,7 +46,6 @@
   font-weight: bold;
   color: #584735;
   margin-bottom: 20rpx;
-  line-height: 1.4;
 }
 
 .line {

+ 2 - 2
utils/api.js

@@ -1,4 +1,4 @@
-const { request } = require('./request.js');
+const { request, baseURL } = require('./request.js');
 
 /**
  * 工具函数
@@ -71,7 +71,7 @@ const utils = {
 
     return new Promise((resolve, reject) => {
       wx.request({
-        url: 'https://sit-kelamayi.4dage.com/api/museum/refresh',
+        url: `${baseURL}/museum/refresh`,
         method: 'POST',
         header: {
           'token': currentToken

+ 7 - 5
utils/request.js

@@ -22,10 +22,9 @@ function request(options) {
       'Content-Type': 'application/json;charset=UTF-8',
       ...header
     };
-
+    const app = getApp();
     // 如果需要使用token,则添加到请求头
     if (useToken) {
-      const app = getApp();
       let token = null;
       
       // 优先从全局数据获取token
@@ -74,9 +73,11 @@ function request(options) {
             wx.showToast({
               title: '未登录,即将跳转',
               icon: 'none',
-              duration: 1000
             });
-            
+            wx.removeStorageSync('token');
+            wx.removeStorageSync('userInfo');
+            app.globalData.userInfo = null;
+            app.globalData.token = null;
             // 延迟1秒后跳转到用户页面并触发自动登录
             setTimeout(() => {
               wx.switchTab({
@@ -114,5 +115,6 @@ function request(options) {
 }
 
 module.exports = {
-  request
+  request,
+  baseURL
 };

+ 14 - 0
utils/util.js

@@ -22,6 +22,20 @@ const formatNumber = n => {
  * @param {string} path - 页面路径
  */
 const navigateToWebview = (path, mode) => {
+  // 检查链接中是否包含type=activity
+  if (path.includes('type=activity') && !mode) {
+    // 提取链接中的id参数
+    const idMatch = path.match(/[?&]id=([^&]*)/);
+    if (idMatch) {
+      const activityId = idMatch[1];
+      console.log('检测到activity类型链接,跳转到活动详情页,id:', activityId);
+      wx.navigateTo({
+        url: `/pages/exhibition/activeDetails/index?isFrom=weixin&id=${activityId}&type=activity`
+      });
+      return;
+    }
+  }
+  
   let fullUrl;
   
   // 如果mode为'open',直接使用原始链接

+ 1 - 1
utils/wxParse/wxParse.wxml

@@ -34,7 +34,7 @@
 </template>
 
 <template name="WxParseBr">
-  <text>\n</text>
+  <text>{{'\n'}}</text>
 </template>
 <!--入口模版-->