Compare commits
10 Commits
de272b1160
...
V1.0.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f803b662a | |||
| 84b77b3fe6 | |||
| 92f981769f | |||
| f69225dbff | |||
| f422dbaa00 | |||
| 14fee13568 | |||
| ed62f3fbbc | |||
|
|
8f79f5aecf | ||
|
|
c2c4f323dc | ||
|
|
de412aed9c |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"zhinian": {
|
"zhinian": {
|
||||||
"clientId": "2",
|
"clientId": "6",
|
||||||
"appId": "wx5e79df5996572539",
|
"appId": "wx5e79df5996572539",
|
||||||
"name": "智念",
|
"name": "智念",
|
||||||
"placeholder": "快告诉智念您在想什么~",
|
"placeholder": "快告诉智念您在想什么~",
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
|
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
|
||||||
import { getEvnUrl } from "@/request/api/config";
|
import { getEvnUrl } from "@/request/api/config";
|
||||||
|
import { refreshToken } from "@/hooks/useGoLogin";
|
||||||
|
|
||||||
onLaunch(() => {
|
onLaunch(() => {
|
||||||
getEvnUrl({ versionValue: "1.0.1" });
|
getEvnUrl({ versionValue: "1.0.1" });
|
||||||
|
refreshToken();
|
||||||
});
|
});
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="!isCallSuccess" class="order-content border-box p-12">
|
<view v-if="!isCallSuccess" class="border-box p-12">
|
||||||
<view
|
<view
|
||||||
class="bg-F5F7FA border-box flex flex-items-center p-12 rounded-10 font-size-14 color-171717 mb-12"
|
class="bg-F5F7FA border-box flex flex-items-center p-12 rounded-10 font-size-14 color-171717 mb-12"
|
||||||
>
|
>
|
||||||
@@ -149,6 +149,8 @@ const originalPhone = ref("");
|
|||||||
const contactPhone = ref("");
|
const contactPhone = ref("");
|
||||||
// 是否用户已编辑过手机号(一旦编辑则不再脱敏)
|
// 是否用户已编辑过手机号(一旦编辑则不再脱敏)
|
||||||
const hasEditedPhone = ref(false);
|
const hasEditedPhone = ref(false);
|
||||||
|
// 需求信息描述:使用可写的 ref,并从工具结果初始化
|
||||||
|
const contactText = ref("");
|
||||||
|
|
||||||
// 手机号脱敏:138****1234(仅对11位数字进行处理)
|
// 手机号脱敏:138****1234(仅对11位数字进行处理)
|
||||||
const maskPhone = (phone) => {
|
const maskPhone = (phone) => {
|
||||||
@@ -163,13 +165,10 @@ watch(
|
|||||||
originalPhone.value = val?.userPhone || "";
|
originalPhone.value = val?.userPhone || "";
|
||||||
hasEditedPhone.value = false;
|
hasEditedPhone.value = false;
|
||||||
contactPhone.value = maskPhone(originalPhone.value);
|
contactPhone.value = maskPhone(originalPhone.value);
|
||||||
|
contactText.value = val?.callServiceContent || "";
|
||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
const contactText = computed({
|
|
||||||
get: () => toolResult.value?.callServiceContent || "",
|
|
||||||
set: (val) => (contactText.value = val),
|
|
||||||
});
|
|
||||||
|
|
||||||
// 处理图片上传
|
// 处理图片上传
|
||||||
const handleChooseImage = () => {
|
const handleChooseImage = () => {
|
||||||
|
|||||||
@@ -6,9 +6,6 @@
|
|||||||
width: 98px;
|
width: 98px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
.order-content {
|
|
||||||
width: 335px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.help-icon {
|
.help-icon {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view v-if="!isCallSuccess" class="order-content border-box p-12">
|
<view v-if="!isCallSuccess" class="border-box p-12">
|
||||||
<view
|
<view
|
||||||
class="bg-F5F7FA border-box flex flex-items-center p-12 rounded-10 font-size-14 color-171717 mb-12"
|
class="bg-F5F7FA border-box flex flex-items-center p-12 rounded-10 font-size-14 color-171717 mb-12"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -7,10 +7,6 @@
|
|||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.order-content {
|
|
||||||
width: 335px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.help-icon {
|
.help-icon {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
|
import { wxLogin } from "../request/api/LoginApi";
|
||||||
import { loginAuth, bindPhone, checkPhone } from "@/manager/LoginManager";
|
import { loginAuth, bindPhone, checkPhone } from "@/manager/LoginManager";
|
||||||
import { clientId } from "@/constant/base";
|
import { clientId } from "@/constant/base";
|
||||||
import { useAppStore } from "@/store";
|
import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
|
||||||
|
|
||||||
// 跳转登录
|
// 跳转登录
|
||||||
export const goLogin = () => uni.navigateTo({ url: "/pages/login/index" });
|
export const goLogin = () => uni.navigateTo({ url: "/pages/login/index" });
|
||||||
@@ -46,14 +47,44 @@ export const onLogin = async (e) => {
|
|||||||
|
|
||||||
// 检测token
|
// 检测token
|
||||||
export const checkToken = () => {
|
export const checkToken = () => {
|
||||||
|
const token = uni.getStorageSync("token");
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const appStore = useAppStore();
|
if (!token) {
|
||||||
console.log("appStore.hasToken: ", appStore.hasToken);
|
|
||||||
if (!appStore.hasToken) {
|
|
||||||
console.log("没有token,跳转到登录页");
|
|
||||||
goLogin();
|
goLogin();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 刷新token
|
||||||
|
export const refreshToken = () => {
|
||||||
|
const token = uni.getStorageSync("token");
|
||||||
|
|
||||||
|
if (!token) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uni.login({
|
||||||
|
provider: "weixin", //使用微信登录
|
||||||
|
success: async ({ code }) => {
|
||||||
|
console.log("refreshToken", code);
|
||||||
|
const params = {
|
||||||
|
openIdCode: [code],
|
||||||
|
grant_type: "wechat",
|
||||||
|
scope: "server",
|
||||||
|
clientId: clientId,
|
||||||
|
};
|
||||||
|
console.log("获取到的微信授权params:", JSON.stringify(params));
|
||||||
|
const response = await wxLogin(params);
|
||||||
|
|
||||||
|
if (response.access_token) {
|
||||||
|
uni.setStorageSync("token", response.access_token);
|
||||||
|
// 登录成功后,触发登录成功事件
|
||||||
|
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
@@ -22,12 +22,8 @@ export const getWeChatAuthCode = (e) => {
|
|||||||
uni.login({
|
uni.login({
|
||||||
provider,
|
provider,
|
||||||
onlyAuthorize: true,
|
onlyAuthorize: true,
|
||||||
success: (res) => {
|
success: (res) => resolve(res.code),
|
||||||
resolve(res.code);
|
fail: (err) => reject(err),
|
||||||
},
|
|
||||||
fail: (err) => {
|
|
||||||
reject(err);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { NOTICE_EVENT_LOGIN_SUCCESS } from "@/constant/constant";
|
|||||||
const loginAuth = (e) => {
|
const loginAuth = (e) => {
|
||||||
uni.setStorageSync("token", "");
|
uni.setStorageSync("token", "");
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
appStore.setHasToken(false);
|
|
||||||
|
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const openIdCode = await getWeChatAuthCode(e);
|
const openIdCode = await getWeChatAuthCode(e);
|
||||||
@@ -28,8 +27,6 @@ const loginAuth = (e) => {
|
|||||||
|
|
||||||
if (response.access_token) {
|
if (response.access_token) {
|
||||||
uni.setStorageSync("token", response.access_token);
|
uni.setStorageSync("token", response.access_token);
|
||||||
const appStore = useAppStore();
|
|
||||||
appStore.setHasToken(true);
|
|
||||||
// 登录成功后,触发登录成功事件
|
// 登录成功后,触发登录成功事件
|
||||||
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
|
uni.$emit(NOTICE_EVENT_LOGIN_SUCCESS);
|
||||||
resolve();
|
resolve();
|
||||||
|
|||||||
@@ -57,7 +57,6 @@ const count = computed({
|
|||||||
const totalAmt = computed(() => {
|
const totalAmt = computed(() => {
|
||||||
const { totalDays } = props.selectedDate;
|
const { totalDays } = props.selectedDate;
|
||||||
const { specificationPrice } = props.orderData;
|
const { specificationPrice } = props.orderData;
|
||||||
|
|
||||||
return count.value * Number(specificationPrice) * totalDays;
|
return count.value * Number(specificationPrice) * totalDays;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -128,11 +128,6 @@ const isDeleting = ref(false); // 标志位,防止删除时watch冲突
|
|||||||
watch(
|
watch(
|
||||||
quantity,
|
quantity,
|
||||||
async (newQuantity) => {
|
async (newQuantity) => {
|
||||||
// 非酒店类型,不处理
|
|
||||||
if (orderData.value.commodityTypeCode !== "0") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果正在执行删除操作,跳过watch逻辑
|
// 如果正在执行删除操作,跳过watch逻辑
|
||||||
if (isDeleting.value) {
|
if (isDeleting.value) {
|
||||||
isDeleting.value = false;
|
isDeleting.value = false;
|
||||||
|
|||||||
@@ -100,8 +100,6 @@ const handleLogout = () => {
|
|||||||
success: (res) => {
|
success: (res) => {
|
||||||
if (res.confirm) {
|
if (res.confirm) {
|
||||||
uni.clearStorageSync();
|
uni.clearStorageSync();
|
||||||
appStore.setHasToken(false);
|
|
||||||
appStore.setTokenExpired(true);
|
|
||||||
emits("close");
|
emits("close");
|
||||||
uni.$emit(NOTICE_EVENT_LOGOUT);
|
uni.$emit(NOTICE_EVENT_LOGOUT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -346,7 +346,9 @@ onLoad(() => {
|
|||||||
// token存在,初始化数据
|
// token存在,初始化数据
|
||||||
const initHandler = () => {
|
const initHandler = () => {
|
||||||
console.log("initHandler");
|
console.log("initHandler");
|
||||||
if (!appStore.hasToken) return;
|
const token = uni.getStorageSync("token");
|
||||||
|
|
||||||
|
if (!token) return;
|
||||||
loadRecentConversation();
|
loadRecentConversation();
|
||||||
///loadConversationMsgList();
|
///loadConversationMsgList();
|
||||||
initWebSocket();
|
initWebSocket();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<view
|
<view
|
||||||
class="quick-access border-box flex flex-nowrap items-center ml-12 pt-8 pb-8"
|
class="quick-access flex flex-row ml-12 pt-8 pb-8 scroll-x whitespace-nowrap"
|
||||||
>
|
>
|
||||||
<view
|
<view
|
||||||
class="item border-box rounded-50 flex flex-row items-center"
|
class="item border-box rounded-50 flex flex-row items-center"
|
||||||
|
|||||||
@@ -3,11 +3,21 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ip {
|
.ip {
|
||||||
|
position: relative;
|
||||||
flex: 0 0 158px;
|
flex: 0 0 158px;
|
||||||
width: 158px;
|
width: 158px;
|
||||||
height: 134px;
|
height: 134px;
|
||||||
animation: sprite-play calc(var(--ipLargeTime) * 1s)
|
animation: sprite-play calc(var(--ipLargeTime) * 1s)
|
||||||
steps(var(--ipLargeImageStep)) infinite;
|
steps(var(--ipLargeImageStep)) infinite;
|
||||||
|
&::before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
background-color: #f9fcfd;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
height: 3px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes sprite-play {
|
@keyframes sprite-play {
|
||||||
|
|||||||
@@ -55,15 +55,6 @@
|
|||||||
>
|
>
|
||||||
手机号快捷登录
|
手机号快捷登录
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
|
||||||
v-if="isAgree && appStore.tokenExpired"
|
|
||||||
class="login-btn"
|
|
||||||
type="primary"
|
|
||||||
@click="handleLogin"
|
|
||||||
>
|
|
||||||
手机号快捷登录
|
|
||||||
</button>
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<AgreePopup
|
<AgreePopup
|
||||||
@@ -120,20 +111,6 @@ const getPhoneNumber = (e) => {
|
|||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLogin = () => {
|
|
||||||
console.log("handleLogin");
|
|
||||||
onLogin()
|
|
||||||
.then(() => {
|
|
||||||
uni.showToast({
|
|
||||||
title: "登录成功",
|
|
||||||
icon: "success",
|
|
||||||
});
|
|
||||||
appStore.setTokenExpired(false);
|
|
||||||
goBack();
|
|
||||||
})
|
|
||||||
.catch(() => {});
|
|
||||||
};
|
|
||||||
|
|
||||||
// 处理同意协议点击事件
|
// 处理同意协议点击事件
|
||||||
const handleAgreeClick = (type) => {
|
const handleAgreeClick = (type) => {
|
||||||
visible.value = true;
|
visible.value = true;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
|||||||
...defaultConfig.header,
|
...defaultConfig.header,
|
||||||
...customConfig.header,
|
...customConfig.header,
|
||||||
};
|
};
|
||||||
|
|
||||||
// 判断是否需要 token
|
// 判断是否需要 token
|
||||||
if (customConfig.noToken) {
|
if (customConfig.noToken) {
|
||||||
delete header.Authorization;
|
delete header.Authorization;
|
||||||
@@ -58,8 +59,6 @@ function request(url, args = {}, method = "POST", customConfig = {}) {
|
|||||||
if (res.statusCode && res.statusCode === 424) {
|
if (res.statusCode && res.statusCode === 424) {
|
||||||
console.log("424错误,重新登录");
|
console.log("424错误,重新登录");
|
||||||
uni.setStorageSync("token", "");
|
uni.setStorageSync("token", "");
|
||||||
appStore.setHasToken(false);
|
|
||||||
appStore.setTokenExpired(true);
|
|
||||||
uni.$emit(NOTICE_EVENT_LOGOUT);
|
uni.$emit(NOTICE_EVENT_LOGOUT);
|
||||||
goLogin();
|
goLogin();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ export const useAppStore = defineStore("app", {
|
|||||||
return {
|
return {
|
||||||
title: "",
|
title: "",
|
||||||
sceneId: "", // 分身场景id
|
sceneId: "", // 分身场景id
|
||||||
hasToken: false, // 是否有token
|
|
||||||
tokenExpired: false, // token是否过期
|
|
||||||
previewImageData: [], // 预览图片数据
|
previewImageData: [], // 预览图片数据
|
||||||
serverConfig: {
|
serverConfig: {
|
||||||
baseUrl: "https://onefeel.brother7.cn/ingress", // 服务器基础地址
|
baseUrl: "https://onefeel.brother7.cn/ingress", // 服务器基础地址
|
||||||
@@ -23,12 +21,6 @@ export const useAppStore = defineStore("app", {
|
|||||||
setSceneId(data) {
|
setSceneId(data) {
|
||||||
this.sceneId = data;
|
this.sceneId = data;
|
||||||
},
|
},
|
||||||
setHasToken(status) {
|
|
||||||
this.hasToken = status;
|
|
||||||
},
|
|
||||||
setTokenExpired(status) {
|
|
||||||
this.tokenExpired = status;
|
|
||||||
},
|
|
||||||
setPreviewImageData(data) {
|
setPreviewImageData(data) {
|
||||||
this.previewImageData = data;
|
this.previewImageData = data;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ import { defineStore } from "pinia";
|
|||||||
export const useSelectedDateStore = defineStore("selectedDate", {
|
export const useSelectedDateStore = defineStore("selectedDate", {
|
||||||
state() {
|
state() {
|
||||||
return {
|
return {
|
||||||
selectedDate: {},
|
selectedDate: {
|
||||||
|
startDate: "",
|
||||||
|
endDate: "",
|
||||||
|
totalDays: 1,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user