|
@@ -4,6 +4,8 @@ import styles from './index.module.less'
|
|
|
import activeButtonIcon from '@common/images/icon_checkbox.png'
|
|
|
import inactiveButtonIcon from '@common/images/icon_checkbox_default.png'
|
|
|
import ColHeader from '../col-header'
|
|
|
+import { state } from '@/state'
|
|
|
+import request from '@/helpers/request'
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'protocol',
|
|
@@ -19,14 +21,32 @@ export default defineComponent({
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- checked: false,
|
|
|
+ exists: true,
|
|
|
+ checked: this.modelValue,
|
|
|
popupStatus: false,
|
|
|
protocolHTML: '',
|
|
|
- protocolPopup: null as any
|
|
|
+ protocolPopup: null as any,
|
|
|
+ baseUrl:
|
|
|
+ state.platformType === 'STUDENT' ? '/api-student' : '/api-teacher'
|
|
|
}
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ async mounted() {
|
|
|
+ try {
|
|
|
+ const res = await request.get(
|
|
|
+ this.baseUrl + '/sysUserContractRecord/checkContractSign',
|
|
|
+ {
|
|
|
+ params: {
|
|
|
+ contractType: 'BUY_ORDER'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ // console.log(res)
|
|
|
+ this.exists = res.data
|
|
|
+ this.checked = this.checked || this.exists
|
|
|
+ this.$emit('update:modelValue', this.checked || this.exists)
|
|
|
+ } catch {}
|
|
|
this.checked = this.modelValue
|
|
|
+ // this.getContractDetail()
|
|
|
window.addEventListener('hashchange', this.onHash, false)
|
|
|
},
|
|
|
unmounted() {
|
|
@@ -38,14 +58,29 @@ export default defineComponent({
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ async getContractDetail() {
|
|
|
+ try {
|
|
|
+ console.log('getContractDetail')
|
|
|
+ // 判断是否有协议内容
|
|
|
+ if (!this.protocolHTML) {
|
|
|
+ const res = await request.get(
|
|
|
+ this.baseUrl + '/sysUserContractRecord/queryContract',
|
|
|
+ {
|
|
|
+ params: {
|
|
|
+ contractType: 'BUY_ORDER'
|
|
|
+ }
|
|
|
+ }
|
|
|
+ )
|
|
|
+ this.protocolHTML = res.data
|
|
|
+ console.log(res)
|
|
|
+ }
|
|
|
+ this.onPopupClose()
|
|
|
+ } catch {}
|
|
|
+ },
|
|
|
onHash() {
|
|
|
this.popupStatus = false
|
|
|
},
|
|
|
onPopupClose() {
|
|
|
- // 判断是否有协议内容
|
|
|
- // if (!this.protocolHTML) {
|
|
|
- // return
|
|
|
- // }
|
|
|
this.popupStatus = !this.popupStatus
|
|
|
|
|
|
// 打开弹窗
|
|
@@ -69,21 +104,24 @@ export default defineComponent({
|
|
|
render() {
|
|
|
return (
|
|
|
<div class={styles.colProtocol}>
|
|
|
- <Checkbox
|
|
|
- v-model={this.checked}
|
|
|
- v-slots={{
|
|
|
- icon: (props: any) => (
|
|
|
- <Icon
|
|
|
- class={styles.boxStyle}
|
|
|
- name={props.checked ? activeButtonIcon : inactiveButtonIcon}
|
|
|
- size="15"
|
|
|
- />
|
|
|
- )
|
|
|
- }}
|
|
|
- >
|
|
|
- 我已阅读并同意
|
|
|
- </Checkbox>
|
|
|
- <span onClick={this.onPopupClose} class={styles.protocolText}>
|
|
|
+ {!this.exists && (
|
|
|
+ <Checkbox
|
|
|
+ v-model={this.checked}
|
|
|
+ v-slots={{
|
|
|
+ icon: (props: any) => (
|
|
|
+ <Icon
|
|
|
+ class={styles.boxStyle}
|
|
|
+ name={props.checked ? activeButtonIcon : inactiveButtonIcon}
|
|
|
+ size="15"
|
|
|
+ />
|
|
|
+ )
|
|
|
+ }}
|
|
|
+ >
|
|
|
+ 我已阅读并同意
|
|
|
+ </Checkbox>
|
|
|
+ )}
|
|
|
+ {this.exists && <>查看</>}
|
|
|
+ <span onClick={this.getContractDetail} class={styles.protocolText}>
|
|
|
《酷乐秀平台服务协议》
|
|
|
</span>
|
|
|
|
|
@@ -94,10 +132,14 @@ export default defineComponent({
|
|
|
style={{ height: '100%' }}
|
|
|
>
|
|
|
{this.showHeader && <ColHeader title="酷乐秀平台服务协议" />}
|
|
|
- <div class={styles.protocolContent}>
|
|
|
- <div class={styles.protocolTitle}>酷乐秀平台服务协议</div>
|
|
|
- <div class={styles.protocolContent}>呆头呆脑的协议内容</div>
|
|
|
- </div>
|
|
|
+ {this.popupStatus && (
|
|
|
+ <div class={styles.protocolContent} id="mProtocol">
|
|
|
+ <div
|
|
|
+ class={styles.protocolContent}
|
|
|
+ v-html={this.protocolHTML}
|
|
|
+ ></div>
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
</Popup>
|
|
|
</div>
|
|
|
)
|