|
@@ -8,10 +8,16 @@ import { showNotify } from 'vant';
|
|
|
import 'vant/es/notify/style'
|
|
import 'vant/es/notify/style'
|
|
|
|
|
|
|
|
const codeParams = ref('');
|
|
const codeParams = ref('');
|
|
|
|
|
+const authInfoPopupVisible = ref(false);
|
|
|
|
|
+const authInfoText = ref('');
|
|
|
|
|
+const shouldShowAuthInfoPopup = ref(false);
|
|
|
|
|
+const externalContactPopupVisible = ref(false);
|
|
|
|
|
+const externalContactPopupText = ref('');
|
|
|
onLoad(async (option) => {
|
|
onLoad(async (option) => {
|
|
|
if (option && option.code) {
|
|
if (option && option.code) {
|
|
|
const { code } = option;
|
|
const { code } = option;
|
|
|
codeParams.value = code;
|
|
codeParams.value = code;
|
|
|
|
|
+ shouldShowAuthInfoPopup.value = true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!codeParams.value) {
|
|
if (!codeParams.value) {
|
|
@@ -31,16 +37,45 @@ const unionidValue = ref('');
|
|
|
const isQuestionEntry = ref(false); // 是否显示问题上报入口
|
|
const isQuestionEntry = ref(false); // 是否显示问题上报入口
|
|
|
const ownerId = ref(''); // 群主id
|
|
const ownerId = ref(''); // 群主id
|
|
|
|
|
|
|
|
|
|
+const openAuthInfoPopup = (data: Record<string, any>) => {
|
|
|
|
|
+ if (!shouldShowAuthInfoPopup.value) return;
|
|
|
|
|
+ authInfoText.value = JSON.stringify(data, null, 2);
|
|
|
|
|
+ authInfoPopupVisible.value = true;
|
|
|
|
|
+ shouldShowAuthInfoPopup.value = false;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const openExternalContactPopup = (data: Record<string, any> | null | undefined) => {
|
|
|
|
|
+ if (!data) return;
|
|
|
|
|
+ externalContactPopupText.value = JSON.stringify(data, null, 2);
|
|
|
|
|
+ externalContactPopupVisible.value = true;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const initPageData = async () => {
|
|
const initPageData = async () => {
|
|
|
- const { externalUserId, profile } = await syncExternalVisitorProfile(codeParams.value);
|
|
|
|
|
|
|
+ const { externalUserId, profile, userInfo, externalContact } = await syncExternalVisitorProfile(codeParams.value);
|
|
|
|
|
|
|
|
externalUserid.value = externalUserId;
|
|
externalUserid.value = externalUserId;
|
|
|
if (!externalUserId) {
|
|
if (!externalUserId) {
|
|
|
|
|
+ openAuthInfoPopup({
|
|
|
|
|
+ callbackParams: {
|
|
|
|
|
+ code: codeParams.value,
|
|
|
|
|
+ },
|
|
|
|
|
+ getuserinfo: userInfo,
|
|
|
|
|
+ externalcontact: externalContact,
|
|
|
|
|
+ message: '当前授权结果中未返回 external_userid',
|
|
|
|
|
+ });
|
|
|
isQuestionEntry.value = false;
|
|
isQuestionEntry.value = false;
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
unionidValue.value = profile?.unionid || '';
|
|
unionidValue.value = profile?.unionid || '';
|
|
|
|
|
+ openAuthInfoPopup({
|
|
|
|
|
+ callbackParams: {
|
|
|
|
|
+ code: codeParams.value,
|
|
|
|
|
+ },
|
|
|
|
|
+ getuserinfo: userInfo,
|
|
|
|
|
+ externalcontact: externalContact,
|
|
|
|
|
+ });
|
|
|
|
|
+ openExternalContactPopup(externalContact);
|
|
|
|
|
|
|
|
if (!unionidValue.value) {
|
|
if (!unionidValue.value) {
|
|
|
isQuestionEntry.value = false;
|
|
isQuestionEntry.value = false;
|
|
@@ -80,6 +115,11 @@ const getGroupChatStatus = async () => {
|
|
|
const { inGroup, ownerUserId } = await checkExternalUserInGroup(chatId, unionidValue.value);
|
|
const { inGroup, ownerUserId } = await checkExternalUserInGroup(chatId, unionidValue.value);
|
|
|
ownerId.value = ownerUserId;
|
|
ownerId.value = ownerUserId;
|
|
|
isQuestionEntry.value = inGroup;
|
|
isQuestionEntry.value = inGroup;
|
|
|
|
|
+ return {
|
|
|
|
|
+ chatId,
|
|
|
|
|
+ inGroup,
|
|
|
|
|
+ ownerUserId,
|
|
|
|
|
+ };
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const getQuestionPage = () => {
|
|
const getQuestionPage = () => {
|
|
@@ -109,6 +149,20 @@ const getQuestionPage = () => {
|
|
|
<navigator url="/subPages/pages/my/index" class="shadow">我的管理</navigator> -->
|
|
<navigator url="/subPages/pages/my/index" class="shadow">我的管理</navigator> -->
|
|
|
</view>
|
|
</view>
|
|
|
<img class="box_bg_bottom" src="@/assets/bg_bottom.png" alt="" srcset="">
|
|
<img class="box_bg_bottom" src="@/assets/bg_bottom.png" alt="" srcset="">
|
|
|
|
|
+
|
|
|
|
|
+ <van-popup v-model:show="authInfoPopupVisible" round closeable class="auth-popup">
|
|
|
|
|
+ <view class="auth-popup__header">授权回跳信息</view>
|
|
|
|
|
+ <scroll-view scroll-y class="auth-popup__content">
|
|
|
|
|
+ <text selectable class="auth-popup__json">{{ authInfoText }}</text>
|
|
|
|
|
+ </scroll-view>
|
|
|
|
|
+ </van-popup>
|
|
|
|
|
+
|
|
|
|
|
+ <van-popup v-model:show="externalContactPopupVisible" round closeable class="auth-popup">
|
|
|
|
|
+ <view class="auth-popup__header">外部联系人接口返回</view>
|
|
|
|
|
+ <scroll-view scroll-y class="auth-popup__content">
|
|
|
|
|
+ <text selectable class="auth-popup__json">{{ externalContactPopupText }}</text>
|
|
|
|
|
+ </scroll-view>
|
|
|
|
|
+ </van-popup>
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</template>
|
|
</template>
|
|
@@ -194,4 +248,36 @@ const getQuestionPage = () => {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.auth-popup {
|
|
|
|
|
+ width: 88vw;
|
|
|
|
|
+ max-height: 75vh;
|
|
|
|
|
+ padding: 20px 16px 16px;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+
|
|
|
|
|
+ &__header {
|
|
|
|
|
+ margin-bottom: 12px;
|
|
|
|
|
+ padding-right: 24px;
|
|
|
|
|
+ font-size: 16px;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &__content {
|
|
|
|
|
+ max-height: 60vh;
|
|
|
|
|
+ background: #f7f8fa;
|
|
|
|
|
+ border-radius: 8px;
|
|
|
|
|
+ padding: 12px;
|
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ &__json {
|
|
|
|
|
+ display: block;
|
|
|
|
|
+ white-space: pre-wrap;
|
|
|
|
|
+ word-break: break-all;
|
|
|
|
|
+ font-size: 12px;
|
|
|
|
|
+ line-height: 1.6;
|
|
|
|
|
+ color: #333;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|