Commit 95755050 authored by kisszxc's avatar kisszxc

Merge branch 'showroom-order' of http://gitlab2.dui88.com/fh/20250528_FHQ1 into showroom-order

parents be6982f3 d8904310
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -2883,12 +2883,13 @@ function forceResetRecorderManager() { ...@@ -2883,12 +2883,13 @@ function forceResetRecorderManager() {
// 开始录音 // 开始录音
async function startRecording() { async function startRecording() {
if (!recordingState.value.isRecording) {
md.sensorLogTake({ md.sensorLogTake({
xcxClick: "小程序页面点击事件", xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页", pageName: "喂养工具首页",
buttonName: "语音识别录制开始按钮", buttonName: "语音识别录制开始按钮",
}); });
}
console.log('开始录音请求...') console.log('开始录音请求...')
console.log('当前录音状态:', { console.log('当前录音状态:', {
...@@ -2990,11 +2991,7 @@ async function startRecording() { ...@@ -2990,11 +2991,7 @@ async function startRecording() {
async function stopRecording() { async function stopRecording() {
console.log('停止录音请求...') console.log('停止录音请求...')
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "语音识别录制结束按钮",
});
// 检查录音是否真正开始 // 检查录音是否真正开始
if (!recordingState.value.isRecording || !recordingState.value.recordingStartTime) { if (!recordingState.value.isRecording || !recordingState.value.recordingStartTime) {
...@@ -3002,6 +2999,13 @@ async function stopRecording() { ...@@ -3002,6 +2999,13 @@ async function stopRecording() {
return return
} }
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "语音识别录制结束按钮",
});
console.log('停止录音...') console.log('停止录音...')
recordingState.value.isRecording = false recordingState.value.isRecording = false
voiceRecognitionState.value.isRecording = false voiceRecognitionState.value.isRecording = false
......
...@@ -52,7 +52,9 @@ const globalStore = useGlobalStore() ...@@ -52,7 +52,9 @@ const globalStore = useGlobalStore()
// 登录获取 cuk // 登录获取 cuk
const wxAutoLogin = async () => { const wxAutoLogin = async () => {
await userStore.wxAutoLogin() await new Promise(resolve => {
userStore.syWxAutoLogin(resolve)
})
} }
// 接收webview消息 // 接收webview消息
...@@ -107,17 +109,16 @@ onLoad(async (options) => { ...@@ -107,17 +109,16 @@ onLoad(async (options) => {
return return
} }
// 固定写死的 URL(不从 options 读取 baseUrl) let baseUrl = res.data.url
const baseUrl = res.data.url
const cuk = globalStore.cuk const cuk = globalStore.cuk
const openId = globalStore.openId const openId = globalStore.openId
const unionId = globalStore.unionId const unionId = globalStore.unionId
// scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene // scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
// const scene = decodeURIComponent(options.scene) const scene = decodeURIComponent(decodeURIComponent(options.scene))
// options.scene = null options.scene = null
// console.warn("scene", scene) console.warn("scene", scene)
// 将 options 的所有参数原样作为查询参数传给 H5,并补齐 cuk // 将 options 的所有参数原样作为查询参数传给 H5,并补齐 cuk
const params = { ...(options || {}) } const params = { ...(options || {}) }
...@@ -141,6 +142,16 @@ onLoad(async (options) => { ...@@ -141,6 +142,16 @@ onLoad(async (options) => {
// 示例: // 示例:
// https://25niansuyuan.feihe.com/projects/Firmus/dev/index?p=xmh&openId=用户openid&unionId=用户unionid&&pt=yzhd123&shareToken=yzhd123&cuk=12121 // https://25niansuyuan.feihe.com/projects/Firmus/dev/index?p=xmh&openId=用户openid&unionId=用户unionid&&pt=yzhd123&shareToken=yzhd123&cuk=12121
if (scene) {
if (scene[0] === '?') {
baseUrl += scene
} else {
baseUrl += `?${scene}`
}
}
webviewUrl.value = paramStr webviewUrl.value = paramStr
? baseUrl + (baseUrl.includes('?') ? '&' : '?') + paramStr ? baseUrl + (baseUrl.includes('?') ? '&' : '?') + paramStr
: baseUrl : baseUrl
......
<template>
<view class="third-jump-page">
<image class="bg-img" :src="`${$baseUrl}thirdJumpMiddlePage/v1/syJumpPageBg.jpg`" mode="widthFix"
@click="retryJump"></image>
</view>
</template>
<script setup>
import { ref, onMounted, getCurrentInstance } from 'vue'
// 获取全局属性
const { proxy } = getCurrentInstance()
const $baseUrl = proxy.$baseUrl
// 响应式数据
const jumpFailed = ref(false)
const errorMessage = ref('')
const jumpParams = ref({})
const bgImg = ref('')
const bgImgObj = {
'sy': 'thirdJumpMiddlePage/v1/syJumpPageBg.jpg'
}
// 页面加载时获取参数
onMounted(() => {
// 获取页面参数
const pages = getCurrentPages()
const currentPage = pages[pages.length - 1]
const options = currentPage.options || {}
console.log('页面参数 options:', options)
const key = options.key || 'sy'
bgImg.value = bgImgObj[key]
// 解析跳转参数
jumpParams.value = {
appId: options.appId || '',
path: decodeURIComponent(options.path) || '',
extraData: options.extraData ? JSON.parse(decodeURIComponent(options.extraData)) : {},
envVersion: options.envVersion || 'release',
}
// 执行跳转
executeJump()
})
// 执行跳转
const executeJump = () => {
if (!jumpParams.value.appId) {
showError('缺少必要参数:appId')
return
}
console.log('开始跳转,参数:', jumpParams.value)
// 调用跳转方法
uni.navigateToMiniProgram({
appId: jumpParams.value.appId,
path: jumpParams.value.path,
extraData: jumpParams.value.extraData,
envVersion: jumpParams.value.envVersion,
success: (res) => {
console.log('跳转成功:', res)
// 跳转成功后可以做一些清理工作
},
fail: (err) => {
console.error('跳转失败:', err)
showError(`跳转失败:${err.errMsg || '未知错误'}`)
}
})
}
// 显示错误信息
const showError = (message) => {
errorMessage.value = message
jumpFailed.value = true
}
// 重试跳转
const retryJump = () => {
jumpFailed.value = false
errorMessage.value = ''
executeJump()
}
// 返回上一页
const goBack = () => {
uni.navigateBack({
delta: 1
})
}
</script>
<style lang="less" scoped>
.third-jump-page {
background: white;
display: flex;
align-items: center;
justify-content: center;
padding: 40rpx;
}
.bg-img {
width: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 1;
}
</style>
...@@ -27,7 +27,7 @@ export const useUserStore = defineStore("userInfo", { ...@@ -27,7 +27,7 @@ export const useUserStore = defineStore("userInfo", {
babyInfo: null, babyInfo: null,
memberInfo: null, memberInfo: null,
babyNickCache: [], babyNickCache: [],
cepingjieguoInfo:null, cepingjieguoInfo: null,
}; };
}, },
actions: { actions: {
...@@ -71,7 +71,7 @@ export const useUserStore = defineStore("userInfo", { ...@@ -71,7 +71,7 @@ export const useUserStore = defineStore("userInfo", {
* @param {Object} data : {encryptedData, iv, code} * @param {Object} data : {encryptedData, iv, code}
* @returns * @returns
*/ */
async phoneCallback(data, onOpenRegisterFn = () => {}) { async phoneCallback(data, onOpenRegisterFn = () => { }) {
uni.login({ uni.login({
provider: "weixin", provider: "weixin",
success: async (res) => { success: async (res) => {
...@@ -155,65 +155,65 @@ export const useUserStore = defineStore("userInfo", { ...@@ -155,65 +155,65 @@ export const useUserStore = defineStore("userInfo", {
// } // }
// } // }
// }, // },
async loadBabyInfo(retryCount = 0) { async loadBabyInfo(retryCount = 0) {
const MAX_RETRIES = 3; const MAX_RETRIES = 3;
const RETRY_DELAY = 1000; // 1 second const RETRY_DELAY = 1000; // 1 second
try { try {
const { data } = await fetchBabyInfo(); const { data } = await fetchBabyInfo();
console.log("babyInfo-宝宝信息", data); console.log("babyInfo-宝宝信息", data);
if (data?.memberId !== "not_login") { if (data?.memberId !== "not_login") {
this.babyInfo = data; this.babyInfo = data;
if (data.allBabyBaseInfo) { if (data.allBabyBaseInfo) {
if (this.babyInfo.babyAge == "0月龄") { if (this.babyInfo.babyAge == "0月龄") {
this.babyInfo.babyAge = "1月龄"; this.babyInfo.babyAge = "1月龄";
} }
console.log("this.11111", this.babyNickCache, data?.content?.id); console.log("this.11111", this.babyNickCache, data?.content?.id);
const findItem = this.babyNickCache.find( const findItem = this.babyNickCache.find(
(item) => item.id == data?.content?.id (item) => item.id == data?.content?.id
); );
if (data?.content?.id && findItem) { if (data?.content?.id && findItem) {
this.babyInfo.babyName = findItem.name; this.babyInfo.babyName = findItem.name;
this.babyInfo.allBabyBaseInfo.forEach((item) => { this.babyInfo.allBabyBaseInfo.forEach((item) => {
if (item.id == data?.content?.id) { if (item.id == data?.content?.id) {
item.babyName = findItem.name; item.babyName = findItem.name;
} }
}); });
} }
return; // Success case, exit the function return; // Success case, exit the function
} else { } else {
console.log("this.babyInfo", '重新请求接口'); console.log("this.babyInfo", '重新请求接口');
if (retryCount < MAX_RETRIES - 1) { if (retryCount < MAX_RETRIES - 1) {
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY)); await new Promise(resolve => setTimeout(resolve, RETRY_DELAY));
return this.loadBabyInfo(retryCount + 1); return this.loadBabyInfo(retryCount + 1);
} else { } else {
console.log("Max retries reached, giving up"); console.log("Max retries reached, giving up");
// Show user notification when max retries reached // Show user notification when max retries reached
// uni.showToast({ // uni.showToast({
// title: "系统繁忙,请稍后再试", // title: "系统繁忙,请稍后再试",
// icon: "none", // icon: "none",
// }); // });
} }
} }
} }
} catch (error) { } catch (error) {
console.log("🚀 ~ loadBabyInfo ~ error:", error); console.log("🚀 ~ loadBabyInfo ~ error:", error);
if (retryCount >= MAX_RETRIES - 1) { if (retryCount >= MAX_RETRIES - 1) {
// Show user notification when max retries reached with error // Show user notification when max retries reached with error
uni.showToast({ uni.showToast({
title: "系统繁忙,请稍后再试", title: "系统繁忙,请稍后再试",
icon: "none", icon: "none",
}); });
} }
} }
}, },
/** /**
* 获取用户积分信息 * 获取用户积分信息
*/ */
...@@ -247,7 +247,7 @@ export const useUserStore = defineStore("userInfo", { ...@@ -247,7 +247,7 @@ export const useUserStore = defineStore("userInfo", {
console.log("autoLoginByCode", data); console.log("autoLoginByCode", data);
// 如果登录成功,获取用户信息和宝宝信息,更新到state中,方便全局使用 // 如果登录成功,获取用户信息和宝宝信息,更新到state中,方便全局使用
if (data && data.cuk) { if (data && data.cuk) {
globalStore.setCuk(data.cuk,data.openId,data.unionId); globalStore.setCuk(data.cuk, data.openId, data.unionId);
await this.loadUserInfo(); await this.loadUserInfo();
await this.loadBabyInfo(); await this.loadBabyInfo();
...@@ -256,15 +256,44 @@ export const useUserStore = defineStore("userInfo", { ...@@ -256,15 +256,44 @@ export const useUserStore = defineStore("userInfo", {
}, },
/** /**
* 用户自动登录 * 用户自动登录
*/ */
async wxAutoLogin() { async wxAutoLogin(cb = null) {
uni.login({ uni.login({
provider: "weixin", provider: "weixin",
success: async (res) => { success: async (res) => {
console.log("wxAutoLogin", res); console.log("wxAutoLogin", res);
if (res.errMsg === "login:ok") { if (res.errMsg === "login:ok") {
await this.autoLoginByCode(res.code); await this.autoLoginByCode(res.code);
cb && cb();
} else {
uni.showToast({
title: res.errMsg,
icon: "error",
});
}
md.sensors.init();
},
});
},
/**
*
* @param {sy使用}
* @returns
*/
async syWxAutoLogin(cb = null) {
uni.login({
provider: "weixin",
success: async (res) => {
if (res.errMsg === "login:ok") {
const { data } = await autoLoginByCode(res.code);
// 如果登录成功,获取用户信息和宝宝信息,更新到state中,方便全局使用
if (data && data.cuk) {
globalStore.setCuk(data.cuk, data.openId, data.unionId);
cb && cb();
}
} else { } else {
uni.showToast({ uni.showToast({
title: res.errMsg, title: res.errMsg,
......
This diff is collapsed.
This diff is collapsed.
...@@ -573,37 +573,28 @@ ...@@ -573,37 +573,28 @@
}, },
"vipLvsQuanyi": [ "vipLvsQuanyi": [
{ {
"qunyiList": [0, 2, 4, 5], "qunyiList": [0, 2, 5],
"isNewArr": [] "isNewArr": []
}, },
{ {
"qunyiList": [6, 7, 0, 2, 4, 5], "qunyiList": [6, 7, 0, 2, 5],
"isNewArr": [6, 7] "isNewArr": [6, 7]
}, },
{ {
"qunyiList": [8, 1, 6, 7, 0, 2, 4, 5], "qunyiList": [8, 1, 6, 7, 0, 2, 5],
"isNewArr": [8, 1] "isNewArr": [8, 1]
}, },
{ {
"qunyiList": [9, 8, 1, 6, 7, 0, 2, 4, 5], "qunyiList": [9, 8, 1, 6, 7, 0, 2, 5],
"isNewArr": [9] "isNewArr": [9]
}, },
{ {
"qunyiList": [9, 8, 1, 6, 7, 0, 2, 4, 5], "qunyiList": [9, 8, 1, 6, 7, 0, 2, 5],
"isNewArr": [9] "isNewArr": [9]
} }
] ]
}, },
"vipActive": [ "vipActive": [
{
"img": "vipAct1.png",
"url": "subPackages/shopMainList/topicNew/index?id=1000912",
"type": 2,
"extra": {
"appId": "wx4205ec55b793245e",
"envVersion": "release"
}
},
{ {
"img": "vipAct2.png", "img": "vipAct2.png",
"url": "/subPackages/shopMainProcess/lottery/index?utm_campaign=%E6%BA%AF%E6%BA%90%E6%8A%BD%E5%A5%96&_channel_track_key=ngSppZAj", "url": "/subPackages/shopMainProcess/lottery/index?utm_campaign=%E6%BA%AF%E6%BA%90%E6%8A%BD%E5%A5%96&_channel_track_key=ngSppZAj",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment