diff --git a/api/auth.js b/api/auth.js
index 86fcdef..d7fb49b 100644
--- a/api/auth.js
+++ b/api/auth.js
@@ -24,14 +24,15 @@ export function login(data) {
/**
* 小程序一键授权手机号登录
* @param {Object} data 登录数据
- * @param {String} data.code 微信授权code
- * @param {String} data.encryptedData 加密数据
- * @param {String} data.iv 初始向量
+ * @param {String} data.phoneCode 手机 code, 小程序通过 wx.getPhoneNumber 方法获得
+ * @param {String} data.loginCode 登录 code, 小程序通过 wx.login 方法获得
+ * @param {String} data.state state 参数,必填,用于回调的随机值
+ * @param {String} data.inviteCode 邀请码,可选(第一位是类型第二位是用户id,例如:1-1, 0-1)
* @returns {Promise} 返回登录结果(包含token等)
*/
export function loginByPhone(data) {
return request({
- url: '/app-api/member/auth/login',
+ url: '/app-api/member/auth/weixin-mini-app-login',
method: 'POST',
data: data,
showLoading: true,
diff --git a/api/service.js b/api/service.js
index 66d8a22..faaefd3 100644
--- a/api/service.js
+++ b/api/service.js
@@ -37,4 +37,13 @@ export function getGuildCoupon(params = {}) {
method: 'GET',
data: params,
})
+}
+
+// 获得图文消息分页
+export function getMessagePage(params = {}) {
+ return request({
+ url: '/app-api/member/labor-union-message/page',
+ method: 'GET',
+ data: params,
+ })
}
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
index 3a78ffa..8ca22dc 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,6 +1,6 @@
{
"name" : "demo",
- "appid" : "__UNI__B358CDA",
+ "appid" : "wxa3c0e1381f643f59",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@@ -50,7 +50,7 @@
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
- "appid" : "",
+ "appid" : "wxa3c0e1381f643f59",
"setting" : {
"urlCheck" : false
},
diff --git a/pages.json b/pages.json
index 7d91f20..84d6a36 100644
--- a/pages.json
+++ b/pages.json
@@ -1,141 +1,160 @@
-{
- "pages": [
- {
- "path": "pages/login/login",
- "style": {
- "navigationBarTitleText": "登录",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/index/index",
- "style": {
- "navigationBarTitleText": "首页",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/service/service",
- "style": {
- "navigationBarTitleText": "服务",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/profile/profile",
- "style": {
- "navigationBarTitleText": "个人中心",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/profile/realNameAuth",
- "style": {
- "navigationBarTitleText": "实名认证",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "pages/profile/serviceRecords",
- "style": {
- "navigationBarTitleText": "服务记录",
- "navigationStyle": "custom"
- }
- }
- ],
- "subPackages": [
- {
- "root": "pages/detail",
- "pages": [
- {
- "path": "serviceDetail",
- "style": {
- "navigationBarTitleText": "店铺详情",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "activitiesDetail",
- "style": {
- "navigationBarTitleText": "工会详情",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "mapDetail",
- "style": {
- "navigationBarTitleText": "地图",
- "navigationStyle": "custom"
- }
- }
- ]
- },
- {
- "root": "pages/activities",
- "pages": [
- {
- "path": "list",
- "style": {
- "navigationBarTitleText": "工会活动",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "myCollect",
- "style": {
- "navigationBarTitleText": "我的收藏",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "complaints",
- "style": {
- "navigationBarTitleText": "投诉建议",
- "navigationStyle": "custom"
- }
- },
- {
- "path": "postMessage",
- "style": {
- "navigationBarTitleText": "发布消息",
- "navigationStyle": "custom"
- }
- }
- ]
- }
- ],
- "globalStyle": {
- "navigationBarTextStyle": "black",
- "navigationBarTitleText": "uni-app",
- "navigationBarBackgroundColor": "#F8F8F8",
- "backgroundColor": "#F8F8F8"
- },
- "tabBar": {
- "color": "#7A7E83",
- "selectedColor": "#004294",
- "borderStyle": "black",
- "backgroundColor": "#ffffff",
- "iconWidth": "41rpx",
- "list": [
- {
- "pagePath": "pages/index/index",
- "iconPath": "static/tabbar/home.png",
- "selectedIconPath": "static/tabbar/home-active.png",
- "text": "首页"
- },
- {
- "pagePath": "pages/service/service",
- "iconPath": "static/tabbar/service.png",
- "selectedIconPath": "static/tabbar/service-active.png",
- "text": "服务"
- },
- {
- "pagePath": "pages/profile/profile",
- "iconPath": "static/tabbar/profile.png",
- "selectedIconPath": "static/tabbar/profile-active.png",
- "text": "我的"
- }
- ]
- },
- "uniIdRouter": {}
-}
+{
+ "pages": [
+ {
+ "path": "pages/index/index",
+ "style": {
+ "navigationBarTitleText": "首页",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/login/login",
+ "style": {
+ "navigationBarTitleText": "登录",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/service/service",
+ "style": {
+ "navigationBarTitleText": "服务",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/profile/profile",
+ "style": {
+ "navigationBarTitleText": "个人中心",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/webview/webview",
+ "style": {
+ "navigationBarTitleText": "网页",
+ "navigationStyle": "custom"
+ }
+ }
+ ],
+ "subPackages": [
+ {
+ "root": "pages/detail",
+ "pages": [
+ {
+ "path": "serviceDetail",
+ "style": {
+ "navigationBarTitleText": "店铺详情",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "activitiesDetail",
+ "style": {
+ "navigationBarTitleText": "工会详情",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "mapDetail",
+ "style": {
+ "navigationBarTitleText": "地图",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "richTextDetail",
+ "style": {
+ "navigationBarTitleText": "详情",
+ "navigationStyle": "custom"
+ }
+ }
+ ]
+ },
+ {
+ "root": "pages/activities",
+ "pages": [
+ {
+ "path": "list",
+ "style": {
+ "navigationBarTitleText": "工会活动",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "myCollect",
+ "style": {
+ "navigationBarTitleText": "我的收藏",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "complaints",
+ "style": {
+ "navigationBarTitleText": "投诉建议",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "postMessage",
+ "style": {
+ "navigationBarTitleText": "发布消息",
+ "navigationStyle": "custom"
+ }
+ }
+ ]
+ },
+ {
+ "root": "pages/profileSub",
+ "pages": [
+ {
+ "path": "realNameAuth",
+ "style": {
+ "navigationBarTitleText": "实名认证",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "serviceRecords",
+ "style": {
+ "navigationBarTitleText": "服务记录",
+ "navigationStyle": "custom"
+ }
+ }
+ ]
+ }
+ ],
+ "globalStyle": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "uni-app",
+ "navigationBarBackgroundColor": "#F8F8F8",
+ "backgroundColor": "#F8F8F8"
+ },
+ "tabBar": {
+ "color": "#7A7E83",
+ "selectedColor": "#004294",
+ "borderStyle": "black",
+ "backgroundColor": "#ffffff",
+ "iconWidth": "41rpx",
+ "list": [
+ {
+ "pagePath": "pages/index/index",
+ "iconPath": "static/tabbar/home.png",
+ "selectedIconPath": "static/tabbar/home-active.png",
+ "text": "首页"
+ },
+ {
+ "pagePath": "pages/service/service",
+ "iconPath": "static/tabbar/service.png",
+ "selectedIconPath": "static/tabbar/service-active.png",
+ "text": "服务"
+ },
+ {
+ "pagePath": "pages/profile/profile",
+ "iconPath": "static/tabbar/profile.png",
+ "selectedIconPath": "static/tabbar/profile-active.png",
+ "text": "我的"
+ }
+ ]
+ },
+ "uniIdRouter": {}
+}
diff --git a/pages/activities/list.vue b/pages/activities/list.vue
index 5530e70..182172d 100644
--- a/pages/activities/list.vue
+++ b/pages/activities/list.vue
@@ -107,7 +107,7 @@ export default {
const res = await getHomeData({
page: this.page,
pageSize: this.pageSize,
- noticeType: 2, // 活动类型
+ noticeType: 21, // 活动类型
});
if (res) {
@@ -159,10 +159,10 @@ export default {
// 活动项点击
handleActivityClick(item) {
- // 后续可以跳转到活动详情页
- // uni.navigateTo({
- // url: `/pages/activities/detail?id=${item.id}`
- // })
+ // 点击活动项跳转到详情页
+ uni.navigateTo({
+ url: `/pages/detail/activitiesDetail?id=${item.id}`
+ });
},
// 参与活动
diff --git a/pages/detail/activitiesDetail.vue b/pages/detail/activitiesDetail.vue
index cf11e0f..a34e41f 100644
--- a/pages/detail/activitiesDetail.vue
+++ b/pages/detail/activitiesDetail.vue
@@ -10,9 +10,21 @@
加载中...
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -40,6 +52,7 @@ export default {
return {
activityId: null,
activityDetail: null,
+ parsedContent: [], // 解析后的内容数组
loading: false,
};
},
@@ -69,6 +82,10 @@ export default {
const res = await getGuildDetail(this.activityId);
if (res) {
this.activityDetail = res;
+ // 解析 HTML,分离图片和文本
+ if (res.content) {
+ this.parsedContent = this.parseHtmlContent(res.content);
+ }
}
} catch (error) {
console.error("加载活动详情失败:", error);
@@ -80,6 +97,64 @@ export default {
this.loading = false;
}
},
+ // 解析 HTML 内容,将图片和文本分离
+ parseHtmlContent(html) {
+ if (!html) return [];
+
+ const result = [];
+ let currentIndex = 0;
+
+ // 匹配所有 img 标签
+ const imgRegex = /
]*)>/gi;
+ let match;
+ let lastIndex = 0;
+
+ while ((match = imgRegex.exec(html)) !== null) {
+ // 添加图片之前的文本内容
+ if (match.index > lastIndex) {
+ const textContent = html.substring(lastIndex, match.index);
+ if (textContent.trim()) {
+ result.push({
+ type: 'text',
+ html: textContent
+ });
+ }
+ }
+
+ // 提取图片 src
+ const imgAttrs = match[1];
+ const srcMatch = imgAttrs.match(/src=["']([^"']+)["']/i);
+ if (srcMatch && srcMatch[1]) {
+ result.push({
+ type: 'image',
+ src: srcMatch[1]
+ });
+ }
+
+ lastIndex = match.index + match[0].length;
+ }
+
+ // 添加最后剩余的文本内容
+ if (lastIndex < html.length) {
+ const textContent = html.substring(lastIndex);
+ if (textContent.trim()) {
+ result.push({
+ type: 'text',
+ html: textContent
+ });
+ }
+ }
+
+ // 如果没有匹配到图片,直接返回整个内容作为文本
+ if (result.length === 0 && html.trim()) {
+ result.push({
+ type: 'text',
+ html: html
+ });
+ }
+
+ return result;
+ }
},
};
@@ -106,60 +181,40 @@ export default {
border-radius: 20rpx;
min-height: 200rpx;
box-sizing: border-box;
- overflow: hidden;
+ overflow-x: hidden;
+ overflow-y: visible;
+ word-wrap: break-word;
+ word-break: break-all;
- // 富文本内容样式
- :deep(rich-text) {
+ // 图片容器样式
+ .rich-text-image-wrapper {
+ width: 100%;
+ margin: 20rpx 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ box-sizing: border-box;
+
+ .rich-text-image {
+ width: 100%;
+ height: auto;
+ display: block;
+ max-width: 100%;
+ }
+ }
+
+ // 文本内容样式
+ .rich-text-content {
+ width: 100%;
+ display: block;
font-family: PingFang-SC, PingFang-SC;
font-size: 28rpx;
line-height: 1.8;
color: #333333;
word-wrap: break-word;
word-break: break-all;
- display: block;
- width: 100%;
box-sizing: border-box;
}
-
- // 富文本内容中的元素样式
- :deep(img) {
- max-width: 100% !important;
- width: auto !important;
- height: auto !important;
- display: block;
- margin: 20rpx auto;
- box-sizing: border-box;
- }
-
- :deep(p) {
- margin: 20rpx 0;
- line-height: 1.8;
- }
-
- :deep(h1),
- :deep(h2),
- :deep(h3),
- :deep(h4),
- :deep(h5),
- :deep(h6) {
- margin: 30rpx 0 20rpx 0;
- font-weight: bold;
- }
-
- :deep(ul),
- :deep(ol) {
- margin: 20rpx 0;
- padding-left: 40rpx;
- }
-
- :deep(li) {
- margin: 10rpx 0;
- }
-
- :deep(a) {
- color: #004294;
- text-decoration: underline;
- }
}
/* 加载状态 */
diff --git a/pages/detail/richTextDetail.vue b/pages/detail/richTextDetail.vue
new file mode 100644
index 0000000..2cddb89
--- /dev/null
+++ b/pages/detail/richTextDetail.vue
@@ -0,0 +1,239 @@
+
+
+
+
+
+
+
+
+
+ 加载中...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 暂无内容
+
+
+
+
+
+
+
+
+
diff --git a/pages/detail/serviceDetail.vue b/pages/detail/serviceDetail.vue
index dc0af5d..7173f9e 100644
--- a/pages/detail/serviceDetail.vue
+++ b/pages/detail/serviceDetail.vue
@@ -65,10 +65,10 @@