diff --git a/App.vue b/App.vue index 361262d..7b888dd 100644 --- a/App.vue +++ b/App.vue @@ -4,10 +4,26 @@ export default { globalData: { // 用于从首页跳转到服务页面时传递需要高亮的分类 - serviceCategory: null + serviceCategory: null, + // 扫码进入时携带的邀请码(小程序码 scene),格式:邀请类型-用户id,如 '0-123' + inviteCode: null }, - onLaunch: function() { + onLaunch: function(options) { console.log('App Launch') + // 扫码进入:小程序码的 scene 即邀请码(格式 邀请类型-用户id,如 0-123、1-123) + const scene = (options && options.query && options.query.scene) || (options && options.scene) + const sceneStr = scene != null ? String(scene) : '' + if (sceneStr && /^\d+-\d+$/.test(sceneStr)) { + this.globalData.inviteCode = sceneStr + uni.setStorageSync('inviteCode', sceneStr) + // 未登录时直接进入登录注册页,便于邀请流程 + if (!uni.getStorageSync('token')) { + setTimeout(() => { + uni.reLaunch({ url: '/pages/login/login' }) + }, 50) + return + } + } // 检查登录状态 this.checkLoginStatus() }, diff --git a/api/auth.js b/api/auth.js index d7fb49b..6de6439 100644 --- a/api/auth.js +++ b/api/auth.js @@ -27,7 +27,7 @@ export function login(data) { * @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) + * @param {String} data.inviteCode 邀请码,可选。格式 "邀请类型-用户id":0=会员邀请会员,1=系统用户邀请会员。例如 0-123、1-123 * @returns {Promise} 返回登录结果(包含token等) */ export function loginByPhone(data) { diff --git a/api/profile.js b/api/profile.js index bf87b24..1d8ca48 100644 --- a/api/profile.js +++ b/api/profile.js @@ -28,6 +28,17 @@ export function createRealNameInfo(data) { }) } +// 获得实名信息 +export function getRealNameInfo(data) { + return request({ + url: '/app-api/member/user-real-name/get', + method: 'GET', + data: data, + showLoading: false, + needAuth: true // 需要token认证 + }) +} + // 我的收藏 export function getMyCollect(data) { return request({ @@ -39,6 +50,17 @@ export function getMyCollect(data) { }) } +// 业务数据获取,主要是分享,收藏等根据业务id 和类型获取数据 +export function getBusinessData(data) { + return request({ + url: '/app-api/member/lu-buiness/get', + method: 'GET', + data: data, + showLoading: false, + needAuth: true // 需要token认证 + }) +} + // 创建会员建议 export function createLaborUnionSuggest(data) { return request({ @@ -50,6 +72,17 @@ export function createLaborUnionSuggest(data) { }) } +// 获得会员建议分页 +export function getLaborUnionSuggestPage(data) { + return request({ + url: '/app-api/member/labor-union-suggest/page', + method: 'GET', + data: data, + showLoading: false, + needAuth: true // 需要token认证 + }) +} + // 发布消息 export function createLaborUnionMessage(data) { return request({ @@ -59,4 +92,44 @@ export function createLaborUnionMessage(data) { showLoading: false, needAuth: true // 需要token认证 }) +} + +/** + * 获取邀请小程序码图片。入参格式与后端约定一致,支持返回 URL 或 Base64。 + * @param {String} inviteCode 邀请码,格式 邀请类型-用户id,如 '0-123',会作为 scene 传给后端(若后端需数字可传 userId) + * @returns {Promise} 小程序码图片 URL 或 Data URL(Base64),失败则抛出 + */ +export function getInviteQRCode(inviteCode) { + // 入参示例:scene、path、width、autoColor、checkPath、hyaline + const scene = inviteCode || '' + const path = 'pages/login/login' + return request({ + url: '/app-api/member/social-user/wxa-qrcode', + method: 'POST', + data: { + scene, + path, + width: 430, + autoColor: true, + checkPath: true, + hyaline: true + }, + showLoading: false, + needAuth: true + }).then(res => { + if (res == null) return null + // 接口可能直接返回 base64 字符串(request 里 resolve 的 data 即为该字符串) + if (typeof res === 'string') { + const raw = res.trim() + if (raw.startsWith('data:image')) return raw + if (raw.length > 0) return 'data:image/png;base64,' + raw + return null + } + const url = res.url || (res.data && res.data.url) + if (url) return url + const base64 = res.data && typeof res.data === 'string' ? res.data : (res.data && res.data.data) + if (typeof base64 === 'string' && base64.length > 0) + return base64.startsWith('data:image') ? base64 : 'data:image/png;base64,' + base64 + return null + }) } \ No newline at end of file diff --git a/components/DetailActionBar/DetailActionBar.vue b/components/DetailActionBar/DetailActionBar.vue index 852c968..2cedee0 100644 --- a/components/DetailActionBar/DetailActionBar.vue +++ b/components/DetailActionBar/DetailActionBar.vue @@ -6,8 +6,13 @@ --> - - 点赞 + + 点赞 - - 收藏 + + 收藏 @@ -255,11 +265,6 @@ export default { &.active { transform: scale(1.1); } - - .icon-text { - font-size: 48rpx; - line-height: 1; - } } .action-text { diff --git a/pages/activities/complaints.vue b/pages/activities/complaints.vue index 38d2c77..ab1175c 100644 --- a/pages/activities/complaints.vue +++ b/pages/activities/complaints.vue @@ -1,10 +1,18 @@