This commit is contained in:
@@ -320,15 +320,85 @@
|
||||
showModifyWifi.value = false;
|
||||
};
|
||||
|
||||
const connectKF = () => uni.showToast({
|
||||
title: '正在跳转客服',
|
||||
icon: 'none'
|
||||
});
|
||||
const connectKF = () => {
|
||||
const kfUrl = 'https://work.weixin.qq.com/kfid/kfc0fd79f27686fb65e?enc_scene=ENCfR9AVui6UfvvxySGVuvaG&scene_param=commonlink';
|
||||
|
||||
const enterBack = () => uni.showToast({
|
||||
title: '正在跳转后台',
|
||||
icon: 'none'
|
||||
});
|
||||
// #ifdef H5
|
||||
window.location.href = kfUrl;
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 微信小程序跳转到企业微信客服
|
||||
wx.openCustomerServiceChat({
|
||||
extInfo: { url: kfUrl },
|
||||
corpId: 'ww4e3b7f9f7c8a9b0c',
|
||||
success: () => {
|
||||
console.log('打开客服会话成功');
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('打开客服会话失败', err);
|
||||
// 失败时使用网页跳转
|
||||
uni.navigateTo({
|
||||
url: `/pages/webview/webview?url=${encodeURIComponent(kfUrl)}`
|
||||
});
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifndef H5 || MP-WEIXIN
|
||||
// 其他平台,复制链接
|
||||
uni.showModal({
|
||||
title: '联系客服',
|
||||
content: '是否复制客服链接?',
|
||||
confirmText: '复制',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.setClipboardData({
|
||||
data: kfUrl,
|
||||
success: () => {
|
||||
uni.showToast({ title: '客服链接已复制', icon: 'success' });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
};
|
||||
|
||||
const enterBack = () => {
|
||||
if (!deviceInfo.lan_ip || deviceInfo.lan_ip === '-') {
|
||||
uni.showToast({
|
||||
title: '暂无后台地址',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// 跳转到设备后台管理地址
|
||||
const url = deviceInfo.lan_ip.startsWith('http') ? deviceInfo.lan_ip : `http://${deviceInfo.lan_ip}`;
|
||||
|
||||
// #ifdef H5
|
||||
window.location.href = url;
|
||||
// #endif
|
||||
|
||||
// #ifndef H5
|
||||
uni.showModal({
|
||||
title: '后台地址',
|
||||
content: url,
|
||||
confirmText: '复制',
|
||||
success: (res) => {
|
||||
if (res.confirm) {
|
||||
uni.setClipboardData({
|
||||
data: url,
|
||||
success: () => {
|
||||
uni.showToast({ title: '地址已复制', icon: 'success' });
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
};
|
||||
|
||||
const YesRestart = async () => {
|
||||
try {
|
||||
@@ -496,11 +566,62 @@
|
||||
showSmsCode.value = false;
|
||||
};
|
||||
|
||||
const onSync = () => {
|
||||
uni.showToast({
|
||||
title: '同步成功',
|
||||
icon: 'success'
|
||||
const onSync = async () => {
|
||||
const identifier = userStore.state.identifier;
|
||||
if (!identifier) {
|
||||
uni.showToast({
|
||||
title: '请先登录',
|
||||
icon: 'none'
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
uni.showLoading({
|
||||
title: '同步中...',
|
||||
mask: true
|
||||
});
|
||||
|
||||
try {
|
||||
const data = await assetApi.refresh(identifier);
|
||||
|
||||
uni.hideLoading();
|
||||
|
||||
if (data.accepted) {
|
||||
const refreshTypeText = data.refresh_type === 'device' ? '设备' : '卡';
|
||||
uni.showToast({
|
||||
title: `${refreshTypeText}数据同步成功`,
|
||||
icon: 'success',
|
||||
duration: 2000
|
||||
});
|
||||
|
||||
// 同步成功后,延迟重新加载资产信息
|
||||
setTimeout(() => {
|
||||
loadAssetInfo();
|
||||
}, 2000);
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '同步失败,请稍后重试',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
uni.hideLoading();
|
||||
console.error('同步数据失败', e);
|
||||
|
||||
// 如果是冷却时间错误,显示提示
|
||||
if (e.msg && e.msg.includes('冷却')) {
|
||||
uni.showToast({
|
||||
title: e.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '同步失败',
|
||||
icon: 'none'
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const enterDetail = (name) => {
|
||||
|
||||
Reference in New Issue
Block a user