微信登录问题修复
This commit is contained in:
@@ -8,22 +8,53 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from "vuex";
|
import {mapActions, mapState} from "vuex";
|
||||||
import FormDetail from "./formDetail";
|
import FormDetail from "./formDetail";
|
||||||
import AiResult from "../../components/AiResult";
|
import AiResult from "../../components/AiResult";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AppForm",
|
name: "AppForm",
|
||||||
appName: "问卷表单",
|
appName: "问卷表单",
|
||||||
|
inject: {root: {}},
|
||||||
components: {AiResult, FormDetail},
|
components: {AiResult, FormDetail},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
access: false
|
||||||
|
}
|
||||||
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(['openUser', 'user']),
|
...mapState(['user', 'token']),
|
||||||
showDetail() {
|
showDetail() {
|
||||||
return !!this.$route.query?.id
|
return !!this.$route.query?.id && this.access
|
||||||
},
|
},
|
||||||
errMsg() {
|
errMsg() {
|
||||||
return this.showDetail ? "加载表单中..." : "表单不存在"
|
return this.access ? "表单不存在" : "无法获取用户信息"
|
||||||
|
},
|
||||||
|
isPreview() {
|
||||||
|
return !!this.$route.query?.preview
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
...mapActions(['getCode', 'getToken']),
|
||||||
|
checkAccess() {
|
||||||
|
let {corpId, code, suiteId} = this.$route.query
|
||||||
|
if (this.isPreview) {
|
||||||
|
this.access = true
|
||||||
|
} else if (!!this.token) {
|
||||||
|
this.access = true
|
||||||
|
} else if (code) {
|
||||||
|
this.getToken({code, corpId, suiteId, isAppForm: true}).then(() => {
|
||||||
|
let {query, path, hash} = this.$route
|
||||||
|
delete query.code
|
||||||
|
this.root.goto({query, path, hash})
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.getCode({corpId, url: location.href})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.checkAccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {mapActions, mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import AiTextarea from "../../components/AiTextarea";
|
import AiTextarea from "../../components/AiTextarea";
|
||||||
import AiUploader from "../../components/AiUploader";
|
import AiUploader from "../../components/AiUploader";
|
||||||
import AiSelect from "../../components/AiSelect";
|
import AiSelect from "../../components/AiSelect";
|
||||||
@@ -76,6 +76,7 @@ import AiBack from "../../components/AiBack";
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "formDetail",
|
name: "formDetail",
|
||||||
|
inject: {root: {}},
|
||||||
components: {
|
components: {
|
||||||
AiBack,
|
AiBack,
|
||||||
AiImage,
|
AiImage,
|
||||||
@@ -90,11 +91,11 @@ export default {
|
|||||||
isExam() {
|
isExam() {
|
||||||
return this.form?.type == 1
|
return this.form?.type == 1
|
||||||
},
|
},
|
||||||
isPreview() {
|
|
||||||
return !!this.$route.query?.preview
|
|
||||||
},
|
|
||||||
isResult() {
|
isResult() {
|
||||||
return !!this.$route.query?.result
|
return !!this.$route.query?.result
|
||||||
|
},
|
||||||
|
isPreview() {
|
||||||
|
return !!this.$route.query?.preview
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -125,10 +126,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions(['getUserInfo', "getCode"]),
|
|
||||||
getForm() {
|
getForm() {
|
||||||
let {id} = this.$route.query
|
let {id} = this.$route.query
|
||||||
this.$http.post("/app/appquestionnairetemplate/queryDetailById", null, {
|
this.$http.post("/app/appquestionnairetemplate/queryDetailById", null, {
|
||||||
|
withoutToken: true,
|
||||||
|
params: {id}
|
||||||
|
}).then(res => {
|
||||||
|
if (res?.data) {
|
||||||
|
this.form = res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getResult() {
|
||||||
|
let {id} = this.$route.query
|
||||||
|
this.$http.post("/app/appquestionnairetemplate/commitCheck", null, {
|
||||||
params: {id}
|
params: {id}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res?.data) {
|
if (res?.data) {
|
||||||
@@ -207,45 +218,9 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
checkForm() {
|
|
||||||
if (this.isPreview) {
|
|
||||||
this.checkUser = true
|
|
||||||
return Promise.resolve()
|
|
||||||
}
|
|
||||||
let {query: {id}} = this.$route,
|
|
||||||
{openId} = this.openUser
|
|
||||||
if (openId) {
|
|
||||||
return new Promise(resolve => {
|
|
||||||
this.$http.post("/app/appquestionnairetemplate/commitCheck", null, {
|
|
||||||
params: {id, openId}
|
|
||||||
}).then(res => {
|
|
||||||
if (res?.code == 0) {
|
|
||||||
this.checkUser = true
|
|
||||||
if (this.isResult && res?.data) {
|
|
||||||
this.form = res?.data
|
|
||||||
} else resolve()
|
|
||||||
} else this.result = {
|
|
||||||
tips: "调查问卷加载失败",
|
|
||||||
status: "error",
|
|
||||||
btn: "重新加载",
|
|
||||||
btnTap() {
|
|
||||||
location.reload()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).catch(err => {
|
|
||||||
this.result = {
|
|
||||||
tips: err || "调查问卷加载失败",
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
let {corpId} = this.$route.query
|
|
||||||
this.getCode({corpId, url: location.href})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.checkForm()?.then(() => this.checkUser && this.getForm())
|
this.isResult ? this.getResult() : this.getForm()
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.title = this.form.title || "调查问卷"
|
document.title = this.form.title || "调查问卷"
|
||||||
|
|||||||
Reference in New Issue
Block a user