微信登录问题修复
This commit is contained in:
@@ -8,22 +8,53 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
import {mapActions, mapState} from "vuex";
|
||||
import FormDetail from "./formDetail";
|
||||
import AiResult from "../../components/AiResult";
|
||||
|
||||
export default {
|
||||
name: "AppForm",
|
||||
appName: "问卷表单",
|
||||
inject: {root: {}},
|
||||
components: {AiResult, FormDetail},
|
||||
data() {
|
||||
return {
|
||||
access: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['openUser', 'user']),
|
||||
...mapState(['user', 'token']),
|
||||
showDetail() {
|
||||
return !!this.$route.query?.id
|
||||
return !!this.$route.query?.id && this.access
|
||||
},
|
||||
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>
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
|
||||
<script>
|
||||
|
||||
import {mapActions, mapState} from "vuex";
|
||||
import {mapState} from "vuex";
|
||||
import AiTextarea from "../../components/AiTextarea";
|
||||
import AiUploader from "../../components/AiUploader";
|
||||
import AiSelect from "../../components/AiSelect";
|
||||
@@ -76,6 +76,7 @@ import AiBack from "../../components/AiBack";
|
||||
|
||||
export default {
|
||||
name: "formDetail",
|
||||
inject: {root: {}},
|
||||
components: {
|
||||
AiBack,
|
||||
AiImage,
|
||||
@@ -90,11 +91,11 @@ export default {
|
||||
isExam() {
|
||||
return this.form?.type == 1
|
||||
},
|
||||
isPreview() {
|
||||
return !!this.$route.query?.preview
|
||||
},
|
||||
isResult() {
|
||||
return !!this.$route.query?.result
|
||||
},
|
||||
isPreview() {
|
||||
return !!this.$route.query?.preview
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -125,10 +126,20 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapActions(['getUserInfo', "getCode"]),
|
||||
getForm() {
|
||||
let {id} = this.$route.query
|
||||
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}
|
||||
}).then(res => {
|
||||
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() {
|
||||
this.checkForm()?.then(() => this.checkUser && this.getForm())
|
||||
this.isResult ? this.getResult() : this.getForm()
|
||||
},
|
||||
mounted() {
|
||||
document.title = this.form.title || "调查问卷"
|
||||
|
||||
Reference in New Issue
Block a user