fix: 2.45遗留bug修复

This commit is contained in:
huxuejian 2026-06-04 10:56:39 +08:00
parent 6334d7c318
commit 0378c0523c
4 changed files with 31 additions and 6 deletions

View File

@ -10,7 +10,8 @@
</view> </view>
<template #footer> <template #footer>
<button-footer v-if="canEdit" confirmText="保存" :showCancel="false" @confirm="confirm()" /> <button-footer v-if="canEdit" :confirmText="nextTypes.length ? '下一步' : '保存'" :showCancel="false"
@confirm="confirm()" />
</template> </template>
</full-page> </full-page>
</template> </template>

View File

@ -15,7 +15,9 @@
<script setup> <script setup>
import { computed, ref } from "vue"; import { computed, ref } from "vue";
import { storeToRefs } from 'pinia';
import { onLoad } from "@dcloudio/uni-app"; import { onLoad } from "@dcloudio/uni-app";
import useAccount from '@/store/account';
import api from "@/utils/api.js"; import api from "@/utils/api.js";
import { loading, toast, hideLoading } from "@/utils/widget"; import { loading, toast, hideLoading } from "@/utils/widget";
@ -24,6 +26,8 @@ import surveyCover from "./components/survey-cover.vue";
import surveyQuestion from "./components/survey-question.vue"; import surveyQuestion from "./components/survey-question.vue";
import surveyRecord from "./components/survey-record.vue"; import surveyRecord from "./components/survey-record.vue";
const env = __VITE_ENV__;
const appid = env.MP_WX_APP_ID;
const corpId = ref(''); const corpId = ref('');
const surveryId = ref(''); const surveryId = ref('');
const answerId = ref(''); const answerId = ref('');
@ -32,7 +36,7 @@ const survey = ref(null);
const emptyTxt = ref('') const emptyTxt = ref('')
const customerName = ref(''); const customerName = ref('');
const step = ref('cover'); const step = ref('cover');
const { login, getExternalUserId } = useAccount();
const readonly = computed(() => survey.value && survey.value.submitTime); const readonly = computed(() => survey.value && survey.value.submitTime);
const list = computed(() => survey.value && Array.isArray(survey.value.list) ? survey.value.list : []); const list = computed(() => survey.value && Array.isArray(survey.value.list) ? survey.value.list : []);
const showList = computed(() => { const showList = computed(() => {
@ -80,7 +84,8 @@ async function init() {
async function getAnswerRecord() { async function getAnswerRecord() {
const res = await api('getAnswer', { corpId: corpId.value, surveryId: surveryId.value, answerId: answerId.value, memberId: memberId.value }); const res = await api('getAnswer', { corpId: corpId.value, surveryId: surveryId.value, answerId: answerId.value, memberId: memberId.value });
if (res && res.success) { if (res && res.success) {
return res.record relateWxappp(res.record)
return res.record;
} }
return Promise.reject(); return Promise.reject();
} }
@ -108,17 +113,34 @@ async function submit({ list, score }) {
} }
} }
async function relateWxappp(record) {
const { teamId, corpId, memberId } = record || {};
if (!(teamId && corpId && memberId)) return;
const account = await login();
const externalUserId = await getExternalUserId(corpId);
if (!externalUserId) return;
const res = await api('relateWxappTeamByExternalUserId', {
appid,
openid: account.openid,
teamId: teamId,
corpId: corpId,
memberId: memberId,
externalUserId: externalUserId,
})
console.clear()
console.log(res)
}
onLoad(opts => { onLoad(opts => {
corpId.value = opts.corpId; corpId.value = opts.corpId;
surveryId.value = opts.surveryId; surveryId.value = opts.surveryId;
answerId.value = opts.answerId; answerId.value = opts.answerId;
memberId.value = opts.memberId; memberId.value = opts.memberId;
customerName.value = opts.name; customerName.value = decodeURIComponent(decodeURIComponent(opts.name || ''));
init(); init();
}) })
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -154,6 +154,7 @@ export default defineStore("accountStore", () => {
const res = await api('getUnionidToExternalUserid', { unionid, openid, corpId }, false); const res = await api('getUnionidToExternalUserid', { unionid, openid, corpId }, false);
const id = res && res.success && typeof res.data === 'string' && res.data.trim() ? res.data.trim() : ''; const id = res && res.success && typeof res.data === 'string' && res.data.trim() ? res.data.trim() : '';
externalUserId.value = id; externalUserId.value = id;
return id;
} }
watch(hasImCorpId, n => { watch(hasImCorpId, n => {

View File

@ -14,7 +14,8 @@ const urlsConfig = {
getWxappRelateTeams: 'getWxappRelateTeams', getWxappRelateTeams: 'getWxappRelateTeams',
getTeamMemberAvatarsAndName: "getTeamMemberAvatarsAndName", getTeamMemberAvatarsAndName: "getTeamMemberAvatarsAndName",
getMiniAppHomeStats: "getMiniAppHomeStats", getMiniAppHomeStats: "getMiniAppHomeStats",
getResponsiblePerson: 'getTeamResponsiblePerson' getResponsiblePerson: 'getTeamResponsiblePerson',
relateWxappTeamByExternalUserId: 'relateWxappTeamByExternalUserId'
}, },
knowledgeBase: { knowledgeBase: {