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() {
// 开始录音
async function startRecording() {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "语音识别录制开始按钮",
});
if (!recordingState.value.isRecording) {
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "语音识别录制开始按钮",
});
}
console.log('开始录音请求...')
console.log('当前录音状态:', {
......@@ -2990,11 +2991,7 @@ async function startRecording() {
async function stopRecording() {
console.log('停止录音请求...')
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "语音识别录制结束按钮",
});
// 检查录音是否真正开始
if (!recordingState.value.isRecording || !recordingState.value.recordingStartTime) {
......@@ -3002,6 +2999,13 @@ async function stopRecording() {
return
}
md.sensorLogTake({
xcxClick: "小程序页面点击事件",
pageName: "喂养工具首页",
buttonName: "语音识别录制结束按钮",
});
console.log('停止录音...')
recordingState.value.isRecording = false
voiceRecognitionState.value.isRecording = false
......
......@@ -52,7 +52,9 @@ const globalStore = useGlobalStore()
// 登录获取 cuk
const wxAutoLogin = async () => {
await userStore.wxAutoLogin()
await new Promise(resolve => {
userStore.syWxAutoLogin(resolve)
})
}
// 接收webview消息
......@@ -107,17 +109,16 @@ onLoad(async (options) => {
return
}
// 固定写死的 URL(不从 options 读取 baseUrl)
const baseUrl = res.data.url
let baseUrl = res.data.url
const cuk = globalStore.cuk
const openId = globalStore.openId
const unionId = globalStore.unionId
// scene 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene
// const scene = decodeURIComponent(options.scene)
// options.scene = null
const scene = decodeURIComponent(decodeURIComponent(options.scene))
options.scene = null
// console.warn("scene", scene)
console.warn("scene", scene)
// 将 options 的所有参数原样作为查询参数传给 H5,并补齐 cuk
const params = { ...(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
if (scene) {
if (scene[0] === '?') {
baseUrl += scene
} else {
baseUrl += `?${scene}`
}
}
webviewUrl.value = paramStr
? baseUrl + (baseUrl.includes('?') ? '&' : '?') + paramStr
: 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", {
babyInfo: null,
memberInfo: null,
babyNickCache: [],
cepingjieguoInfo:null,
cepingjieguoInfo: null,
};
},
actions: {
......@@ -71,7 +71,7 @@ export const useUserStore = defineStore("userInfo", {
* @param {Object} data : {encryptedData, iv, code}
* @returns
*/
async phoneCallback(data, onOpenRegisterFn = () => {}) {
async phoneCallback(data, onOpenRegisterFn = () => { }) {
uni.login({
provider: "weixin",
success: async (res) => {
......@@ -155,65 +155,65 @@ export const useUserStore = defineStore("userInfo", {
// }
// }
// },
async loadBabyInfo(retryCount = 0) {
const MAX_RETRIES = 3;
const RETRY_DELAY = 1000; // 1 second
try {
const { data } = await fetchBabyInfo();
console.log("babyInfo-宝宝信息", data);
if (data?.memberId !== "not_login") {
async loadBabyInfo(retryCount = 0) {
const MAX_RETRIES = 3;
const RETRY_DELAY = 1000; // 1 second
try {
const { data } = await fetchBabyInfo();
console.log("babyInfo-宝宝信息", data);
if (data?.memberId !== "not_login") {
this.babyInfo = data;
if (data.allBabyBaseInfo) {
if (data.allBabyBaseInfo) {
if (this.babyInfo.babyAge == "0月龄") {
this.babyInfo.babyAge = "1月龄";
}
console.log("this.11111", this.babyNickCache, data?.content?.id);
const findItem = this.babyNickCache.find(
(item) => item.id == data?.content?.id
);
if (data?.content?.id && findItem) {
this.babyInfo.babyName = findItem.name;
this.babyInfo.allBabyBaseInfo.forEach((item) => {
if (item.id == data?.content?.id) {
item.babyName = findItem.name;
}
});
}
return; // Success case, exit the function
} else {
console.log("this.babyInfo", '重新请求接口');
if (retryCount < MAX_RETRIES - 1) {
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY));
return this.loadBabyInfo(retryCount + 1);
} else {
console.log("Max retries reached, giving up");
// Show user notification when max retries reached
// uni.showToast({
// title: "系统繁忙,请稍后再试",
// icon: "none",
// });
}
}
}
} catch (error) {
console.log("🚀 ~ loadBabyInfo ~ error:", error);
if (retryCount >= MAX_RETRIES - 1) {
// Show user notification when max retries reached with error
uni.showToast({
title: "系统繁忙,请稍后再试",
icon: "none",
});
}
}
},
console.log("this.11111", this.babyNickCache, data?.content?.id);
const findItem = this.babyNickCache.find(
(item) => item.id == data?.content?.id
);
if (data?.content?.id && findItem) {
this.babyInfo.babyName = findItem.name;
this.babyInfo.allBabyBaseInfo.forEach((item) => {
if (item.id == data?.content?.id) {
item.babyName = findItem.name;
}
});
}
return; // Success case, exit the function
} else {
console.log("this.babyInfo", '重新请求接口');
if (retryCount < MAX_RETRIES - 1) {
await new Promise(resolve => setTimeout(resolve, RETRY_DELAY));
return this.loadBabyInfo(retryCount + 1);
} else {
console.log("Max retries reached, giving up");
// Show user notification when max retries reached
// uni.showToast({
// title: "系统繁忙,请稍后再试",
// icon: "none",
// });
}
}
}
} catch (error) {
console.log("🚀 ~ loadBabyInfo ~ error:", error);
if (retryCount >= MAX_RETRIES - 1) {
// Show user notification when max retries reached with error
uni.showToast({
title: "系统繁忙,请稍后再试",
icon: "none",
});
}
}
},
/**
* 获取用户积分信息
*/
......@@ -247,7 +247,7 @@ export const useUserStore = defineStore("userInfo", {
console.log("autoLoginByCode", data);
// 如果登录成功,获取用户信息和宝宝信息,更新到state中,方便全局使用
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.loadBabyInfo();
......@@ -256,15 +256,44 @@ export const useUserStore = defineStore("userInfo", {
},
/**
* 用户自动登录
*/
async wxAutoLogin() {
* 用户自动登录
*/
async wxAutoLogin(cb = null) {
uni.login({
provider: "weixin",
success: async (res) => {
console.log("wxAutoLogin", res);
if (res.errMsg === "login:ok") {
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 {
uni.showToast({
title: res.errMsg,
......
This diff is collapsed.
This diff is collapsed.
......@@ -573,37 +573,28 @@
},
"vipLvsQuanyi": [
{
"qunyiList": [0, 2, 4, 5],
"qunyiList": [0, 2, 5],
"isNewArr": []
},
{
"qunyiList": [6, 7, 0, 2, 4, 5],
"qunyiList": [6, 7, 0, 2, 5],
"isNewArr": [6, 7]
},
{
"qunyiList": [8, 1, 6, 7, 0, 2, 4, 5],
"qunyiList": [8, 1, 6, 7, 0, 2, 5],
"isNewArr": [8, 1]
},
{
"qunyiList": [9, 8, 1, 6, 7, 0, 2, 4, 5],
"qunyiList": [9, 8, 1, 6, 7, 0, 2, 5],
"isNewArr": [9]
},
{
"qunyiList": [9, 8, 1, 6, 7, 0, 2, 4, 5],
"qunyiList": [9, 8, 1, 6, 7, 0, 2, 5],
"isNewArr": [9]
}
]
},
"vipActive": [
{
"img": "vipAct1.png",
"url": "subPackages/shopMainList/topicNew/index?id=1000912",
"type": 2,
"extra": {
"appId": "wx4205ec55b793245e",
"envVersion": "release"
}
},
{
"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",
......
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