Compare commits
11 Commits
3a5fa0b7d2
...
home3.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 85a61d5bbf | |||
| bbca2d14c9 | |||
| b070429f5c | |||
| bef68d4f3c | |||
| 58a88b7953 | |||
| 9c83a47260 | |||
| 255b40aad7 | |||
| 25c8a3570d | |||
| a3c82382c2 | |||
| 42e0e4920f | |||
| 9455beec4d |
@@ -74,5 +74,6 @@
|
||||
"@vue/tsconfig": "^0.1.3",
|
||||
"sass": "1.58.3",
|
||||
"vite": "5.2.8"
|
||||
}
|
||||
},
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
import { ref } from "vue";
|
||||
import { onShow } from "@dcloudio/uni-app";
|
||||
|
||||
const showPrivacy = ref(true);
|
||||
const showPrivacy = ref(false);
|
||||
const privacyContractName = ref("隐私保护指引");
|
||||
|
||||
onShow(() => {
|
||||
@@ -41,9 +41,9 @@ onShow(() => {
|
||||
wx.getPrivacySetting({
|
||||
success: (res) => {
|
||||
console.log("cj隐私配置", res);
|
||||
if (res.errMsg == "getPrivacySetting:ok" && res.needAuthorization) {
|
||||
if (res.errMsg == "getPrivacySetting:ok") {
|
||||
privacyContractName.value = res.privacyContractName;
|
||||
showPrivacy.value = res.needAuthorization;
|
||||
showPrivacy.value = !!res.needAuthorization;
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -54,6 +54,7 @@ onShow(() => {
|
||||
uni.getPrivacySetting({
|
||||
success: (res) => {
|
||||
console.log(res);
|
||||
showPrivacy.value = !!res.needAuthorization;
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
|
||||
@@ -69,18 +69,46 @@ export const checkToken = () => {
|
||||
|
||||
// 刷新token
|
||||
export const refreshToken = () => {
|
||||
let provider = "weixin";
|
||||
let grant_type = "wechat";
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
if (systemInfo.platform === "ios") {
|
||||
provider = "apple";
|
||||
grant_type = "apple";
|
||||
}
|
||||
// #endif
|
||||
|
||||
return new Promise(async (resolve) => {
|
||||
uni.login({
|
||||
provider: "weixin", //使用微信登录
|
||||
success: async ({ code }) => {
|
||||
console.log("进入 refreshToken success", code);
|
||||
provider,
|
||||
success: async (loginRes) => {
|
||||
console.log("refreshToken success: ", JSON.stringify(loginRes));
|
||||
const openIdCode =
|
||||
provider === "apple"
|
||||
? loginRes.appleInfo && loginRes.appleInfo.identityToken
|
||||
: loginRes.code;
|
||||
console.log("获取到的授权code:", openIdCode);
|
||||
|
||||
if (!openIdCode) {
|
||||
console.warn("refreshToken 未获取到登录 code");
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const params = {
|
||||
openIdCode: [code],
|
||||
grant_type: "wechat",
|
||||
scope: "server",
|
||||
grant_type: grant_type,
|
||||
clientId: clientId,
|
||||
scope: "server",
|
||||
};
|
||||
console.log("获取到的微信授权params:", JSON.stringify(params));
|
||||
|
||||
if (provider === "apple") {
|
||||
params.identityToken = openIdCode;
|
||||
} else {
|
||||
params.openIdCode = [openIdCode];
|
||||
}
|
||||
console.log("获取到的授权params:", JSON.stringify(params));
|
||||
|
||||
const response = await oauthToken(params);
|
||||
if (response.access_token) {
|
||||
@@ -89,7 +117,6 @@ export const refreshToken = () => {
|
||||
const checkRes = await checkUserPhone({
|
||||
token: response.access_token,
|
||||
});
|
||||
|
||||
if (checkRes.data) {
|
||||
// 登录成功后,触发登录成功事件
|
||||
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
|
||||
@@ -99,6 +126,10 @@ export const refreshToken = () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.warn("refreshToken uni.login fail:", err);
|
||||
resolve(true);
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -23,7 +23,9 @@ export function createApp() {
|
||||
|
||||
pinia.use(createUnistorage());
|
||||
app.use(pinia);
|
||||
// #ifdef MP-WEIXIN
|
||||
app.use(share);
|
||||
// #endif
|
||||
|
||||
return {
|
||||
app,
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
export const getWeChatAuthCode = (e) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// 条件编译微信小程序、抖音小程序
|
||||
let provider = "";
|
||||
// #ifdef MP-WEIXIN
|
||||
provider = "weixin";
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-TOUTIAO
|
||||
provider = "toutiao";
|
||||
// #endif
|
||||
|
||||
// 判断用户拒绝授权
|
||||
if (
|
||||
e !== undefined &&
|
||||
e.detail.errMsg === "getPhoneNumber:fail user deny"
|
||||
) {
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
uni.login({
|
||||
provider,
|
||||
onlyAuthorize: true,
|
||||
success: (res) => resolve(res.code),
|
||||
fail: (err) => reject(err),
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,5 +1,4 @@
|
||||
import { oauthToken, bindUserPhone } from "../request/api/LoginApi";
|
||||
import { getWeChatAuthCode } from "./AuthManager";
|
||||
import { clientId } from "@/constant/base";
|
||||
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
|
||||
import { removeAccessToken, setAccessToken } from "../constant/token";
|
||||
@@ -7,25 +6,72 @@ import { removeAccessToken, setAccessToken } from "../constant/token";
|
||||
const loginAuth = (e) => {
|
||||
removeAccessToken();
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
const openIdCode = await getWeChatAuthCode(e);
|
||||
console.log("获取到的微信授权code:", openIdCode);
|
||||
const params = {
|
||||
openIdCode: [openIdCode],
|
||||
grant_type: "wechat",
|
||||
scope: "server",
|
||||
clientId: clientId,
|
||||
};
|
||||
console.log("获取到的微信授权params:", JSON.stringify(params));
|
||||
const response = await oauthToken(params);
|
||||
console.log("获取到的微信授权response:", response);
|
||||
// 条件编译微信小程序、抖音小程序、APP-PLUS(包含iOS和Android)
|
||||
let provider = "weixin";
|
||||
let grant_type = "wechat";
|
||||
|
||||
if (response.access_token) {
|
||||
setAccessToken(response.access_token);
|
||||
resolve();
|
||||
} else {
|
||||
reject(response.message || "登录失败");
|
||||
}
|
||||
// #ifdef MP-WEIXIN
|
||||
provider = "weixin";
|
||||
grant_type = "wechat";
|
||||
// #endif
|
||||
|
||||
// #ifdef MP-TOUTIAO
|
||||
provider = "toutiao";
|
||||
grant_type = "toutiao";
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
if (systemInfo.platform === "ios") {
|
||||
provider = "apple";
|
||||
grant_type = "apple";
|
||||
}
|
||||
// #endif
|
||||
|
||||
return new Promise(async (resolve, reject) => {
|
||||
uni.login({
|
||||
provider,
|
||||
onlyAuthorize: true,
|
||||
success: async (loginRes) => {
|
||||
console.log("Authorize success: ", JSON.stringify(loginRes));
|
||||
const openIdCode =
|
||||
provider === "apple"
|
||||
? loginRes.appleInfo && loginRes.appleInfo.identityToken
|
||||
: loginRes.code;
|
||||
console.log("获取到的授权code:", openIdCode);
|
||||
|
||||
if (!openIdCode) {
|
||||
console.warn("refreshToken 未获取到登录 code");
|
||||
reject("refreshToken 未获取到登录 code");
|
||||
return;
|
||||
}
|
||||
|
||||
const params = {
|
||||
grant_type: grant_type,
|
||||
clientId: clientId,
|
||||
scope: "server",
|
||||
};
|
||||
|
||||
if (provider === "apple") {
|
||||
params.identityToken = openIdCode;
|
||||
} else {
|
||||
params.openIdCode = [openIdCode];
|
||||
}
|
||||
|
||||
console.log("获取到的授权params:", JSON.stringify(params));
|
||||
|
||||
const response = await oauthToken(params);
|
||||
if (response.access_token) {
|
||||
setAccessToken(response.access_token);
|
||||
resolve();
|
||||
} else {
|
||||
reject(response.message || "登录失败");
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
reject("登录失败");
|
||||
},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -34,7 +80,7 @@ const bindPhone = async (params) => {
|
||||
const response = await bindUserPhone(params);
|
||||
return response;
|
||||
} catch (error) {
|
||||
throw err;
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,109 +1,105 @@
|
||||
{
|
||||
"name": "YGTianmuCS",
|
||||
"appid": "__UNI__BB03E8A",
|
||||
"description": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": "100",
|
||||
"transformPx": false,
|
||||
/* 5+App特有相关 */
|
||||
"app-plus": {
|
||||
"usingComponents": true,
|
||||
"nvueStyleCompiler": "uni-app",
|
||||
"compilerVersion": 3,
|
||||
"splashscreen": {
|
||||
"alwaysShowBeforeRender": true,
|
||||
"waiting": true,
|
||||
"autoclose": true,
|
||||
"delay": 0
|
||||
"name" : "YGChatCS",
|
||||
"appid" : "__UNI__38F74B8",
|
||||
"description" : "",
|
||||
"versionName" : "1.0.0",
|
||||
"versionCode" : "100",
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"usingComponents" : true,
|
||||
"nvueStyleCompiler" : "uni-app",
|
||||
"compilerVersion" : 3,
|
||||
"optimization" : {
|
||||
"subPackages" : true
|
||||
},
|
||||
"compatible" : {
|
||||
"ignoreVersion" : true
|
||||
},
|
||||
"splashscreen" : {
|
||||
"alwaysShowBeforeRender" : true,
|
||||
"waiting" : true,
|
||||
"autoclose" : true,
|
||||
"delay" : 0
|
||||
},
|
||||
"safearea" : {
|
||||
"bottom" : {
|
||||
"offset" : "auto"
|
||||
}
|
||||
},
|
||||
"modules" : {},
|
||||
"distribute" : {
|
||||
"android" : {
|
||||
"permissions" : [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
"ios" : {},
|
||||
"sdkConfigs" : {
|
||||
"oauth" : {}
|
||||
}
|
||||
}
|
||||
},
|
||||
"safearea": {
|
||||
"bottom": {
|
||||
"offset": "auto" // 自动适配安全区域
|
||||
}
|
||||
"quickapp" : {},
|
||||
"mp-weixin" : {
|
||||
"appid" : "wx5e79df5996572539",
|
||||
"setting" : {
|
||||
"urlCheck" : false,
|
||||
"minified" : true
|
||||
},
|
||||
"optimization" : {
|
||||
"subPackages" : true
|
||||
},
|
||||
"usingComponents" : true,
|
||||
"requiredPrivateInfos" : [ "getLocation" ],
|
||||
"permission" : {
|
||||
"scope.userLocation" : {
|
||||
"desc" : "用于获取当前所在城市信息"
|
||||
}
|
||||
},
|
||||
"plugins" : {
|
||||
"WechatSI" : {
|
||||
"version" : "0.3.6",
|
||||
"provider" : "wx069ba97219f66d99"
|
||||
}
|
||||
},
|
||||
"__usePrivacyCheck__" : true
|
||||
},
|
||||
/* 模块配置 */
|
||||
"modules": {},
|
||||
/* 应用发布信息 */
|
||||
"distribute": {
|
||||
/* android打包配置 */
|
||||
"android": {
|
||||
"permissions": [
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
|
||||
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
|
||||
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
|
||||
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
|
||||
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
|
||||
"<uses-feature android:name=\"android.hardware.camera\"/>",
|
||||
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
|
||||
]
|
||||
},
|
||||
/* ios打包配置 */
|
||||
"ios": {},
|
||||
/* SDK配置 */
|
||||
"sdkConfigs": {
|
||||
"oauth": {}
|
||||
}
|
||||
}
|
||||
},
|
||||
/* 快应用特有相关 */
|
||||
"quickapp": {},
|
||||
/* 小程序特有相关 同时更改 project.config.json文件
|
||||
智念:wx5e79df5996572539
|
||||
朵花:wx23f86d809ae80259
|
||||
*/
|
||||
"mp-weixin": {
|
||||
"appid": "wx5e79df5996572539",
|
||||
"setting": {
|
||||
"urlCheck": false,
|
||||
"minified": true
|
||||
"mp-alipay" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"optimization": {
|
||||
"subPackages": true
|
||||
"mp-baidu" : {
|
||||
"usingComponents" : true
|
||||
},
|
||||
"usingComponents": true,
|
||||
"requiredPrivateInfos": ["getLocation"],
|
||||
"permission": {
|
||||
"scope.userLocation": {
|
||||
"desc": "用于获取当前所在城市信息"
|
||||
}
|
||||
"mp-toutiao" : {
|
||||
"usingComponents" : true,
|
||||
"usePrivacyCheck" : true
|
||||
},
|
||||
"plugins": {
|
||||
"WechatSI": {
|
||||
"version": "0.3.6",
|
||||
"provider": "wx069ba97219f66d99"
|
||||
}
|
||||
"uniStatistics" : {
|
||||
"enable" : false
|
||||
},
|
||||
"__usePrivacyCheck__": true
|
||||
},
|
||||
"mp-alipay": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-baidu": {
|
||||
"usingComponents": true
|
||||
},
|
||||
"mp-toutiao": {
|
||||
"usingComponents": true,
|
||||
"usePrivacyCheck": true
|
||||
},
|
||||
"uniStatistics": {
|
||||
"enable": false
|
||||
},
|
||||
"vueVersion": "3",
|
||||
"h5": {
|
||||
"router": {
|
||||
"base": "./",
|
||||
"mode": "hash"
|
||||
"vueVersion" : "3",
|
||||
"h5" : {
|
||||
"router" : {
|
||||
"base" : "./",
|
||||
"mode" : "hash"
|
||||
},
|
||||
"devServer" : {
|
||||
"https" : false
|
||||
}
|
||||
},
|
||||
"devServer": {
|
||||
"https": false
|
||||
}
|
||||
}
|
||||
"fallbackLocale" : "zh-Hans"
|
||||
}
|
||||
|
||||
@@ -298,6 +298,7 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
||||
// 在发起微信支付前关闭 loading(避免与原生支付 UI 冲突)
|
||||
uni.hideLoading();
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 调用微信支付
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
@@ -322,6 +323,15 @@ const handlePayClick = ThrottleUtils.createThrottle(async (goodsData) => {
|
||||
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "支付功能开发中",
|
||||
showCancel: false,
|
||||
});
|
||||
// #endif
|
||||
}, 1000);
|
||||
</script>
|
||||
|
||||
|
||||
@@ -111,6 +111,7 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => {
|
||||
// 在发起微信支付前关闭 loading(避免与原生支付 UI 冲突)
|
||||
uni.hideLoading();
|
||||
|
||||
// #ifdef MP-WEIXIN
|
||||
// 调用微信支付
|
||||
uni.requestPayment({
|
||||
provider: "wxpay",
|
||||
@@ -133,6 +134,15 @@ const handleButtonClick = DebounceUtils.createDebounce(async (orderData) => {
|
||||
uni.showToast({ title: "支付失败,请重试", icon: "none" });
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
uni.showModal({
|
||||
title: "提示",
|
||||
content: "支付功能开发中",
|
||||
showCancel: false,
|
||||
});
|
||||
// #endif
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("操作失败:", error);
|
||||
|
||||
@@ -38,6 +38,12 @@
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/ChatMain/NoticeMessage/detail",
|
||||
"style": {
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
<view class="input-area-wrapper">
|
||||
<view v-if="!visibleWaveBtn" class="area-input">
|
||||
<!-- 语音/键盘切换 -->
|
||||
<view class="input-container-voice" @click="toggleVoiceMode">
|
||||
<view
|
||||
v-if="isSpeechRecognitionSupported"
|
||||
class="input-container-voice"
|
||||
@click="toggleVoiceMode"
|
||||
>
|
||||
<image
|
||||
class="voice-icon"
|
||||
v-if="!isVoiceMode"
|
||||
@@ -16,7 +20,10 @@
|
||||
</view>
|
||||
|
||||
<!-- 输入框/语音按钮容器 -->
|
||||
<view class="input-button-container">
|
||||
<view
|
||||
class="input-button-container"
|
||||
:class="{ 'input-button-container--no-voice': !isSpeechRecognitionSupported }"
|
||||
>
|
||||
<textarea
|
||||
ref="textareaRef"
|
||||
v-if="!isVoiceMode"
|
||||
@@ -77,8 +84,15 @@ import { ref, computed, watch, nextTick, onMounted, defineExpose, onUnmounted }
|
||||
import RecordingWaveBtn from "@/components/Speech/RecordingWaveBtn.vue";
|
||||
import { getCurrentConfig } from "@/constant/base";
|
||||
|
||||
let manager = null;
|
||||
const isSpeechRecognitionSupported = ref(false);
|
||||
|
||||
// WechatSI 是微信小程序插件,App 原生基座没有 requirePlugin。
|
||||
// #ifdef MP-WEIXIN
|
||||
const plugin = requirePlugin("WechatSI");
|
||||
const manager = plugin.getRecordRecognitionManager();
|
||||
manager = plugin.getRecordRecognitionManager();
|
||||
isSpeechRecognitionSupported.value = !!manager;
|
||||
// #endif
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: String,
|
||||
@@ -151,11 +165,13 @@ watch(inputMessage, (val) => {
|
||||
|
||||
// 切换语音/文本模式
|
||||
const toggleVoiceMode = () => {
|
||||
if (!isSpeechRecognitionSupported.value) return;
|
||||
isVoiceMode.value = !isVoiceMode.value;
|
||||
};
|
||||
|
||||
// 处理语音按钮长按开始
|
||||
const handleVoiceTouchStart = () => {
|
||||
if (!manager) return;
|
||||
try {
|
||||
manager.start({ lang: "zh_CN" });
|
||||
isRecording.value = true;
|
||||
@@ -177,6 +193,11 @@ const handleVoiceTouchStart = () => {
|
||||
|
||||
// 处理语音按钮长按结束
|
||||
const handleVoiceTouchEnd = () => {
|
||||
if (!manager) {
|
||||
resetUI();
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果本地状态不是录音中,也确保 UI 恢复
|
||||
if (!isRecording.value) {
|
||||
if (recordingWaveBtnRef.value) {
|
||||
@@ -202,6 +223,8 @@ const handleVoiceTouchEnd = () => {
|
||||
|
||||
// 处理发送原语音
|
||||
const initRecord = () => {
|
||||
if (!manager) return;
|
||||
|
||||
manager.onRecognize = (res) => {
|
||||
let text = res.result || "";
|
||||
inputMessage.value = text;
|
||||
@@ -247,14 +270,16 @@ onMounted(() => {
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
try {
|
||||
manager.stop && manager.stop();
|
||||
} catch (e) {
|
||||
// ignore
|
||||
if (manager) {
|
||||
try {
|
||||
manager.stop && manager.stop();
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
manager.onRecognize = null;
|
||||
manager.onStop = null;
|
||||
manager.onError = null;
|
||||
}
|
||||
manager.onRecognize = null;
|
||||
manager.onStop = null;
|
||||
manager.onError = null;
|
||||
resetUI();
|
||||
});
|
||||
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
.input-button-container {
|
||||
flex: 1;
|
||||
position: relative;
|
||||
|
||||
&--no-voice {
|
||||
margin-left: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.hold-to-talk-button {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</view>
|
||||
|
||||
<view class="relative">
|
||||
<image class="w-full block" :src="mainPageDataModel.initPageImages.backgroundImageUrl"
|
||||
<image class="w-full block" :src="mainPageDataModel?.initPageImages?.backgroundImageUrl"
|
||||
mode="aspectFill" style="height: 252px;" />
|
||||
<view class="absolute bottom-0 left-0 right-0 flex-full">
|
||||
<view class="px-12 pt-12">
|
||||
@@ -92,14 +92,21 @@
|
||||
item.toolCall.componentName === CompName.mapCard
|
||||
"
|
||||
/>
|
||||
<GeneratorPhotoComponent
|
||||
<!-- <GeneratorPhotoComponent
|
||||
v-else-if="
|
||||
item.toolCall &&
|
||||
item.toolCall.componentName ===
|
||||
CompName.aigcPhotoGeneratorCard
|
||||
"
|
||||
:toolCall="item.toolCall"
|
||||
/> -->
|
||||
<ZModuleC01
|
||||
v-else-if="
|
||||
item.toolCall &&
|
||||
item.toolCall.componentName === CompName.aigcPhotoGeneratorCard
|
||||
"
|
||||
/>
|
||||
|
||||
<Feedback
|
||||
v-else-if="
|
||||
item.toolCall &&
|
||||
@@ -204,8 +211,6 @@ import HomeWelcome from "../HomeWelcome/index.vue";
|
||||
import AiTabSwitch from "@/components/AiTabSwitch/index.vue";
|
||||
import Discovery from "../../Discovery/index.vue";
|
||||
|
||||
import ChatTopWelcome from "../ChatTopWelcome/index.vue";
|
||||
import NoticeMessage from "../NoticeMessage/index.vue";
|
||||
import ChatTopNavBar from "../ChatTopNavBar/index.vue";
|
||||
import ChatCardAI from "../ChatCardAi/index.vue";
|
||||
import ChatCardMine from "../ChatCardMine/index.vue";
|
||||
@@ -223,6 +228,8 @@ import OpenMapComponent from "../../ChatModule/OpenMapComponent/index.vue";
|
||||
import AnswerComponent from "../../ChatModule/AnswerComponent/index.vue";
|
||||
import GeneratorPhotoComponent from "../../ChatModule/GeneratorPhotoComponent/index.vue";
|
||||
|
||||
import ZModuleC01 from "../../ChatModule/ZModuleC01/index.vue";
|
||||
|
||||
import CreateServiceOrder from "@/components/CreateServiceOrder/index.vue";
|
||||
import Feedback from "@/components/Feedback/index.vue";
|
||||
import AddCarCrad from "@/components/AddCarCrad/index.vue";
|
||||
|
||||
@@ -7,58 +7,21 @@
|
||||
<view class="flex flex-col flex-full min-width-0">
|
||||
<view class="flex flex-row flex-items-center flex-justify-between min-width-0">
|
||||
<text class="flex-full min-width-0 font-size-20 font-500 color-white ellipsis-1">{{ mainPageDataModel.welcomeContent }}</text>
|
||||
<text class="flex-shrink-0 font-size-20 font-500 color-white mt-4"> 26°C ☀️ </text>
|
||||
<text class="flex-shrink-0 font-size-20 font-500 color-white mt-4"> {{ weatherText }} </text>
|
||||
</view>
|
||||
|
||||
<swiper @change="onSwiperChange" class="swiper" circular :autoplay="autoplay" :interval="interval"
|
||||
:duration="duration" :indicator-dots="false">
|
||||
<swiper-item v-for="item in bannerList" :key="item.title">
|
||||
<view class="swiper-item flex flex-col flex-items-start flex-justify-between px-10">
|
||||
<text class="font-size-12 font-600 color-B45309">
|
||||
{{ item.title }}
|
||||
</text>
|
||||
<view class="flex flex-row flex-justify-between">
|
||||
<text class="font-size-10 font-500 color-D97706">
|
||||
发布时间:{{ item.time }}
|
||||
</text>
|
||||
<text class="font-size-10 font-500 color-B45309 underline-text">
|
||||
详情
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<yo-indicator-dot :current-index="currentIndex" :length="bannerList.length" duration="0.5" default-width="4px"
|
||||
active-width="16px" dot-height="4px" shape="circle" default-color="rgba(255,255,255,0.5)"
|
||||
active-color="rgba(255,255,255,1)" />
|
||||
<NoticeMessage />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ref } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { defineProps, computed } from "vue";
|
||||
import SpriteAnimator from "@/components/Sprite/SpriteAnimator.vue";
|
||||
import NoticeMessage from "../NoticeMessage/index.vue";
|
||||
import { getLocalWeather } from "@/request/api/MainPageDataApi";
|
||||
|
||||
const autoplay = ref(true);
|
||||
const interval = ref(7000);
|
||||
const duration = ref(500);
|
||||
|
||||
const currentIndex = ref(0);
|
||||
const bannerList = ref([
|
||||
{
|
||||
title: "小七欢迎你~",
|
||||
time: "2025年7月12日 09:30",
|
||||
},
|
||||
{
|
||||
title: "小8欢迎你~",
|
||||
time: "2025年7月13日 09:30",
|
||||
},
|
||||
{
|
||||
title: "小9欢迎你~",
|
||||
time: "2025年7月15日 09:30",
|
||||
},
|
||||
]);
|
||||
const weatherText = ref("26°C ☀️");
|
||||
|
||||
const props = defineProps({
|
||||
mainPageDataModel: {
|
||||
@@ -92,29 +55,18 @@ const spriteStyle = computed(() => {
|
||||
};
|
||||
});
|
||||
|
||||
const onSwiperChange = (e) => {
|
||||
currentIndex.value = e.detail.current;
|
||||
};
|
||||
const getLocalWeatherData = async () => {
|
||||
const res = await getLocalWeather();
|
||||
if (res && res.code === 0) {
|
||||
const { temperature, weather } = res.data;
|
||||
weatherText.value = `${temperature}°C ${weather}`;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getLocalWeatherData();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.swiper {
|
||||
height: 50px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.swiper-item {
|
||||
display: block;
|
||||
height: 46px;
|
||||
background: #fffbeb;
|
||||
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 12px;
|
||||
border: 2px solid #fef3c7;
|
||||
}
|
||||
|
||||
.underline-text {
|
||||
text-decoration: underline;
|
||||
text-decoration-color: #b45309;
|
||||
}
|
||||
</style>
|
||||
<style scoped></style>
|
||||
|
||||
77
src/pages/ChatMain/NoticeMessage/detail.vue
Normal file
77
src/pages/ChatMain/NoticeMessage/detail.vue
Normal file
@@ -0,0 +1,77 @@
|
||||
<template>
|
||||
<view class="flex flex-col bg-liner h-screen overflow-hidden">
|
||||
<!-- ✅ 顶部固定导航 -->
|
||||
<view class="flex-shrink-0">
|
||||
<TopNavBar :title="detailTitle" background="transparent" />
|
||||
</view>
|
||||
|
||||
<!-- ✅ 滚动区域 -->
|
||||
<scroll-view class="flex-full overflow-hidden" scroll-y >
|
||||
<view class="pb-24 border-box overflow-hidden">
|
||||
<image v-if="coverImage" class="w-full block" :src="coverImage" mode="aspectFill" />
|
||||
|
||||
<view class="pt-16 px-12 pb-24 border-box">
|
||||
<view class="color-171717 font-size-16 font-weight-600">{{ detailTitle }}</view>
|
||||
|
||||
<view v-if="publishTime" class="notice-time-tag flex flex-row flex-items-center mt-16">
|
||||
<uni-icons type="clock" size="18" color="#5A6780" />
|
||||
<text class="color-171717 font-size-12 font-weight-600 ml-8">发布时间:{{ publishTime }}</text>
|
||||
</view>
|
||||
|
||||
<view class="mt-16 mx-12 bg-gray w-full height-1"></view>
|
||||
|
||||
<view class="mt-16 color-666 font-size-14 line-height-20">{{ noticeContent }}</view>
|
||||
</view>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import TopNavBar from "@/components/TopNavBar/index.vue";
|
||||
import { computed, ref } from "vue";
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
|
||||
const noticeData = ref({});
|
||||
|
||||
const detailTitle = computed(() => {
|
||||
return noticeData.value.entityName?.trim() || "消息详情";
|
||||
});
|
||||
|
||||
const publishTime = computed(() => {
|
||||
return noticeData.value.effectiveStartTime?.trim();
|
||||
});
|
||||
|
||||
const coverImage = computed(() => {
|
||||
return noticeData.value.eventImage?.trim();
|
||||
});
|
||||
|
||||
const noticeContent = computed(() => {
|
||||
return noticeData.value.eventDescription?.trim();
|
||||
});
|
||||
|
||||
onLoad((query = {}) => {
|
||||
if (query.noticeData) {
|
||||
try {
|
||||
noticeData.value = JSON.parse(decodeURIComponent(query.noticeData));
|
||||
} catch (error) {
|
||||
console.warn("noticeData parse failed:", error);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.notice-time-tag {
|
||||
display: inline-flex;
|
||||
height: 28px;
|
||||
padding: 6px 12px;
|
||||
background: linear-gradient(180deg, #f4f7fb 0%, #e9eef6 100%);
|
||||
border: 1px solid #d6dde8;
|
||||
border-radius: 14px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -1,40 +1,100 @@
|
||||
<template>
|
||||
|
||||
<view class="border-box pl-12 pr-12">
|
||||
<view class="wrap rounded-20 bg-white relative overflow-hidden">
|
||||
<view class="flex flex-col p-16 mr-110 border-box">
|
||||
<view class="flex flex-row flex-items-center justify-center">
|
||||
<view class="w-24 h-24 rounded-full bg-theme-color-500 flex flex-items-center flex-justify-center">
|
||||
<uni-icons type="sound" size="16" color="#ffffff"/>
|
||||
<view >
|
||||
<swiper @change="onSwiperChange" class="swiper" circular :autoplay="autoplay" :interval="interval"
|
||||
:duration="duration" :indicator-dots="false">
|
||||
<swiper-item v-for="item in bannerList" :key="item.entityName">
|
||||
<view class="swiper-item flex flex-col flex-items-start flex-justify-between px-10" @click="clickItem(item)">
|
||||
<text class="font-size-12 font-600 color-B45309">
|
||||
{{ item.entityName }}
|
||||
</text>
|
||||
<view class="flex flex-row flex-justify-between">
|
||||
<text class="font-size-10 font-500 color-D97706">
|
||||
发布时间:{{ item.effectiveStartTime }}
|
||||
</text>
|
||||
<text class="font-size-10 font-500 color-B45309 underline-text">
|
||||
详情
|
||||
</text>
|
||||
</view>
|
||||
<text class="font-size-16 font-500 text-color-900 ml-6">临时提醒</text>
|
||||
</view>
|
||||
<view class="font-size-12 font-color-600 mt-8">{{ props.noticeContent.eventMessageContent }}</view>
|
||||
</view>
|
||||
<image class="mt-4 object-cover absolute right-0 bottom-0 bg-image" src="./notice_bg_img.png"/>
|
||||
</view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
|
||||
<yo-indicator-dot :current-index="currentIndex" :length="bannerList.length" duration="0.5" default-width="4px"
|
||||
active-width="16px" dot-height="4px" shape="circle" default-color="rgba(255,255,255,0.5)"
|
||||
active-color="rgba(255,255,255,1)" />
|
||||
|
||||
</view>
|
||||
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { defineProps } from "vue";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { getTimeNoticeList } from "@/request/api/MainPageDataApi";
|
||||
|
||||
const props = defineProps({
|
||||
noticeContent: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
const autoplay = ref(true);
|
||||
const interval = ref(7000);
|
||||
const duration = ref(500);
|
||||
|
||||
const currentIndex = ref(0);
|
||||
// const bannerList = ref([]);
|
||||
const bannerList = ref([
|
||||
{
|
||||
entityName: "小七欢迎你~",
|
||||
effectiveStartTime: "2025年7月12日 09:30",
|
||||
},
|
||||
{
|
||||
entityName: "小8欢迎你~",
|
||||
effectiveStartTime: "2025年7月13日 09:30",
|
||||
},
|
||||
{
|
||||
entityName: "小9欢迎你~",
|
||||
effectiveStartTime: "2025年7月15日 09:30",
|
||||
},
|
||||
]);
|
||||
|
||||
|
||||
const onSwiperChange = (e) => {
|
||||
currentIndex.value = e.detail.current;
|
||||
};
|
||||
|
||||
const getTimeNoticeListData = async () => {
|
||||
const res = await getTimeNoticeList();
|
||||
if (res && res.code === 0) {
|
||||
bannerList.value = res.data;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getTimeNoticeListData();
|
||||
});
|
||||
|
||||
const clickItem = (item) => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/ChatMain/NoticeMessage/detail?noticeData=${encodeURIComponent(JSON.stringify(item))}`
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.bg-image {
|
||||
width: 140px;
|
||||
height: 96px;
|
||||
.swiper {
|
||||
height: 50px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.mr-110 {
|
||||
margin-right: 110px;
|
||||
|
||||
.swiper-item {
|
||||
display: block;
|
||||
height: 46px;
|
||||
background: #fffbeb;
|
||||
box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 12px;
|
||||
border: 2px solid #fef3c7;
|
||||
}
|
||||
|
||||
.underline-text {
|
||||
text-decoration: underline;
|
||||
text-decoration-color: #b45309;
|
||||
}
|
||||
|
||||
</style>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 178 KiB |
21
src/pages/ChatModule/ZModuleBase/index.vue
Normal file
21
src/pages/ChatModule/ZModuleBase/index.vue
Normal file
@@ -0,0 +1,21 @@
|
||||
<template>
|
||||
<view class="container w-full border-box border-ff overflow-hidden rounded-24 flex flex-col">
|
||||
<!-- 占位撑开 -->
|
||||
<view class="w-vw"></view>
|
||||
<view class="flex flex-col m-4 border-box rounded-24">
|
||||
<slot name="content"></slot>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.container {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
box-shadow: 0px 9px 34px 0px rgba(27, 9, 91, 0.07);
|
||||
}
|
||||
|
||||
</style>
|
||||
12
src/pages/ChatModule/ZModuleC01/index.vue
Normal file
12
src/pages/ChatModule/ZModuleC01/index.vue
Normal file
@@ -0,0 +1,12 @@
|
||||
<template>
|
||||
<ZModuleBase>
|
||||
<template #content >
|
||||
灌灌灌灌灌滚滚滚
|
||||
</template>
|
||||
</ZModuleBase>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import ZModuleBase from "../ZModuleBase/index.vue";
|
||||
|
||||
</script>
|
||||
@@ -29,10 +29,12 @@ import CardSwiper from "./components/CardSwiper/index.vue";
|
||||
import QuickQuestions from "./components/QuickQuestions/index.vue";
|
||||
import discoveryCover from "@/components/ImageSwiper/images/2025-07-12_180248.jpg";
|
||||
|
||||
import { homeTabsData, homeTabContentData, homeQuickQuestionData } from "../../request/api/MainPageDataApi";
|
||||
import { useAppStore } from "@/store";
|
||||
import { homeTabsData, getNearbyTags, homeTabContentData, homeQuickQuestionData } from "../../request/api/MainPageDataApi";
|
||||
import { useAppStore, useLocationStore } from "@/store";
|
||||
import { JumpType } from "../../model/ChatModel";
|
||||
|
||||
const appStore = useAppStore();
|
||||
const locationStore = useLocationStore();
|
||||
/// 从个渠道获取如二维码
|
||||
const sceneId = appStore.sceneId || "";
|
||||
|
||||
@@ -58,15 +60,20 @@ const queryTabsList = async () => {
|
||||
}));
|
||||
/// 设置tab数据
|
||||
discoveryTabs.value = tabList;
|
||||
|
||||
/// 查询是否有sceneId参数
|
||||
const activeTabIndex = discoveryTabs.value.findIndex((tab) => tab.id === sceneId);
|
||||
|
||||
/// 如果有则优先展示对应tab数据,没有则展示第一个tab数据
|
||||
if (activeTabIndex > -1) {
|
||||
activeIndex.value = activeTabIndex;
|
||||
queryDiscoveryData(sceneId);
|
||||
} else {
|
||||
/// 根据sceneId查询对应tab数据
|
||||
findTabByIdWithActiveTabIndex(sceneId);
|
||||
}
|
||||
}
|
||||
/// 根据id查询tab并设置activeIndex
|
||||
const findTabByIdWithActiveTabIndex = (tabsId) => {
|
||||
/// 查询是否有id参数
|
||||
const activeTabIndex = discoveryTabs.value.findIndex((tab) => tab.id === tabsId);
|
||||
/// 如果有则优先展示对应tab数据,没有则展示第一个tab数据
|
||||
if (activeTabIndex > -1) {
|
||||
activeIndex.value = activeTabIndex;
|
||||
queryDiscoveryData(tabsId);
|
||||
} else {
|
||||
if (discoveryTabs.value.length > 0) {
|
||||
activeIndex.value = 0;
|
||||
queryDiscoveryData(discoveryTabs.value[0].id);
|
||||
}
|
||||
@@ -145,10 +152,37 @@ const handleClick = async (item) => {
|
||||
}
|
||||
}
|
||||
|
||||
/// 获取位置信息
|
||||
const getLocation = () => {
|
||||
/// 已经有sceneId了,说明之前已经获取过位置信息了,就不需要再获取一次了
|
||||
if (sceneId) return;
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: function (res) {
|
||||
// 将位置信息存储到 Pinia 中
|
||||
locationStore.setLocationData({
|
||||
latitude: res.latitude,
|
||||
longitude: res.longitude,
|
||||
});
|
||||
console.log('当前位置:' + JSON.stringify(res));
|
||||
getNearbyTagsData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 获取附近标签数据
|
||||
const getNearbyTagsData = async () => {
|
||||
const res = await getNearbyTags();
|
||||
if (res.code === 0) {
|
||||
const nearbyTagId = res.data;
|
||||
findTabByIdWithActiveTabIndex(nearbyTagId);
|
||||
}
|
||||
}
|
||||
|
||||
/// 组件挂载后请求数据
|
||||
onMounted(() => {
|
||||
queryTabsList();
|
||||
getLocation();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<script setup>
|
||||
import { onLoad } from "@dcloudio/uni-app";
|
||||
import { ref, onUnmounted } from "vue";
|
||||
import { ref, onUnmounted, onMounted } from "vue";
|
||||
import { getUrlParams } from "@/utils/UrlParams";
|
||||
import { useAppStore } from "@/store";
|
||||
import { checkToken } from "@/hooks/useGoLogin";
|
||||
@@ -31,7 +31,6 @@ import DrawerSection from "../DrawerSection/index.vue";
|
||||
import Calender from "@/components/Calender/index.vue";
|
||||
|
||||
const appStore = useAppStore();
|
||||
|
||||
const calendarVisible = ref(false);
|
||||
const selectedDate = ref("");
|
||||
|
||||
@@ -52,14 +51,6 @@ uni.$on("openCalendar", () => {
|
||||
calendarVisible.value = true;
|
||||
});
|
||||
|
||||
const getWeixinMiniProgramParams = (e) => {
|
||||
console.log("Params:", e);
|
||||
if (e.q && e.q != "undefined") {
|
||||
const qrUrl = decodeURIComponent(e.q); // 获取到二维码原始链接内容
|
||||
const params = getUrlParams(qrUrl);
|
||||
appStore.setSceneId(params.sceneId || params.tagId);
|
||||
}
|
||||
};
|
||||
|
||||
// 打开窗口
|
||||
const drawerRef = ref(null);
|
||||
@@ -68,19 +59,32 @@ const showDrawer = async (e) => {
|
||||
|
||||
drawerRef.value.open();
|
||||
};
|
||||
|
||||
uni.$on("SHOW_DRAWER", showDrawer);
|
||||
|
||||
// 关闭窗口
|
||||
const closeDrawer = (e) => drawerRef.value.close();
|
||||
|
||||
///获取到二维码原始链接内容
|
||||
const getWeixinMiniProgramParams = (e) => {
|
||||
console.log("Params:", e);
|
||||
if (e.q && e.q != "undefined") {
|
||||
const qrUrl = decodeURIComponent(e.q);
|
||||
const params = getUrlParams(qrUrl);
|
||||
appStore.setSceneId(params.sceneId || params.tagId);
|
||||
}
|
||||
};
|
||||
|
||||
onLoad((e) => {
|
||||
getWeixinMiniProgramParams(e);
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
// uni.$off('openCalendar')
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
@@ -28,11 +28,17 @@
|
||||
<!-- 按钮区域 -->
|
||||
<view class="login-btn-area">
|
||||
<!-- 同意隐私协议并获取手机号按钮 -->
|
||||
<button v-if="needWxAuthLogin" class="login-btn" type="primary" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
|
||||
手机号快捷登录
|
||||
<button
|
||||
v-if="needWxAuthLogin && !isAppleLogin"
|
||||
class="login-btn"
|
||||
type="primary"
|
||||
open-type="getPhoneNumber"
|
||||
@getphonenumber="getPhoneNumber"
|
||||
>
|
||||
{{ loginButtonText }}
|
||||
</button>
|
||||
<button v-else class="login-btn" type="primary" @click="handleAgreeAndGetPhone">
|
||||
手机号快捷登录
|
||||
{{ loginButtonText }}
|
||||
</button>
|
||||
</view>
|
||||
|
||||
@@ -62,11 +68,20 @@ const privacyAgreement = ref("");
|
||||
// 协议类型
|
||||
const AgreeType = ref("service");
|
||||
const logo = computed(() => getCurrentConfig().logo);
|
||||
const isAppleLogin = ref(false);
|
||||
const loginButtonText = computed(() =>
|
||||
isAppleLogin.value ? "Apple ID快捷登录" : "手机号快捷登录"
|
||||
);
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
const systemInfo = uni.getSystemInfoSync();
|
||||
isAppleLogin.value = systemInfo.platform === "ios";
|
||||
// #endif
|
||||
|
||||
// 同意隐私协议并获取手机号
|
||||
const handleAgreeAndGetPhone = () => {
|
||||
// 如果需要微信登录,直接返回
|
||||
if (needWxAuthLogin.value) {
|
||||
if (needWxAuthLogin.value && !isAppleLogin.value) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,21 @@ function homeTabContentData(args) {
|
||||
return request.post("/hotelBiz/mainScene/queryContentListWithCache", args);
|
||||
}
|
||||
|
||||
/// 获取距离用户最近的标签
|
||||
function getNearbyTags(args) {
|
||||
return request.get("/hotelBiz/mainScene/nearestTag", args);
|
||||
}
|
||||
|
||||
/// 获取本地天气
|
||||
function getLocalWeather(args) {
|
||||
return request.get("/hotelBiz/mainScene/getLocalWeather", args);
|
||||
}
|
||||
|
||||
/// 获取时间公告列表
|
||||
function getTimeNoticeList(args) {
|
||||
return request.get("/hotelBiz/mainScene/eventList", args);
|
||||
}
|
||||
|
||||
/// 快速问题列表
|
||||
function homeQuickQuestionData(args) {
|
||||
return request.post("/hotelBiz/mainScene/queryQuickQuestionListWithCache", args);
|
||||
@@ -34,6 +49,9 @@ function discoveryCradComponent() {
|
||||
export {
|
||||
homeTabsData,
|
||||
homeTabContentData,
|
||||
getNearbyTags,
|
||||
getLocalWeather,
|
||||
getTimeNoticeList,
|
||||
homeQuickQuestionData,
|
||||
mainPageData,
|
||||
quickBookingComponent,
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { getCurrentConfig } from "@/constant/base";
|
||||
import { useAppStore } from "@/store";
|
||||
import { useAppStore, useLocationStore } from "@/store";
|
||||
import { NOTICE_EVENT_LOGOUT } from "@/constant/constant";
|
||||
import { getAccessToken } from "@/constant/token";
|
||||
import { getAccessToken, removeAccessToken } from "@/constant/token";
|
||||
import { goLogin } from "../../hooks/useGoLogin";
|
||||
|
||||
const clientId = getCurrentConfig().clientId;
|
||||
const defaultConfig = {
|
||||
header: {
|
||||
Authorization: "", // 可在此动态设置 token
|
||||
"Content-Type": "application/json",
|
||||
Authorization: "", // 可在此动态设置 token
|
||||
clientId: clientId,
|
||||
},
|
||||
};
|
||||
@@ -19,6 +19,17 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
||||
if (!/^http/.test(url)) {
|
||||
url = appStore.serverConfig?.baseUrl + url;
|
||||
}
|
||||
|
||||
// 获取位置信息并添加到请求头
|
||||
const locationStore = useLocationStore();
|
||||
if (locationStore.latitude && locationStore.longitude) {
|
||||
customConfig.header = {
|
||||
...customConfig.header,
|
||||
"X-Latitude": locationStore.latitude,
|
||||
"X-Longitude": locationStore.longitude
|
||||
};
|
||||
}
|
||||
|
||||
// 动态获取 token
|
||||
const token = getAccessToken();
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.h-1 {
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
.h-8 {
|
||||
height: 8px;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useAppStore } from "./app";
|
||||
import { useSelectedDateStore } from "./selectedDate";
|
||||
import { usePictureStore } from "./picture";
|
||||
import { useLocationStore } from "./location";
|
||||
|
||||
export { useAppStore, useSelectedDateStore, usePictureStore };
|
||||
export { useAppStore, useSelectedDateStore, usePictureStore, useLocationStore };
|
||||
19
src/store/modules/location.js
Normal file
19
src/store/modules/location.js
Normal file
@@ -0,0 +1,19 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useLocationStore = defineStore("location", {
|
||||
state() {
|
||||
return {
|
||||
latitude: 0, // 纬度
|
||||
longitude: 0, // 经度
|
||||
};
|
||||
},
|
||||
|
||||
actions: {
|
||||
setLocationData(data) {
|
||||
this.latitude = data.latitude;
|
||||
this.longitude = data.longitude;
|
||||
},
|
||||
},
|
||||
|
||||
unistorage: true,
|
||||
});
|
||||
@@ -1,4 +1,5 @@
|
||||
export const updateManager = () => {
|
||||
// #ifdef MP-WEIXIN || MP-TOUTIAO
|
||||
const updateManager = uni.getUpdateManager();
|
||||
|
||||
// 当向小程序后台请求完新版本信息,会进行回调
|
||||
@@ -22,4 +23,5 @@ export const updateManager = () => {
|
||||
|
||||
// 当新版本下载失败,会进行回调
|
||||
updateManager.onUpdateFailed(() => {});
|
||||
// #endif
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export default {
|
||||
install(app) {
|
||||
// #ifdef MP-WEIXIN
|
||||
app.mixin({
|
||||
onLoad() {
|
||||
const page = getCurrentPages().pop();
|
||||
@@ -13,5 +14,6 @@ export default {
|
||||
}
|
||||
},
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user