| | |
| | | <template> |
| | | <div class="container"> |
| | | <scroll-view scroll-y class="content" v-html="content"></scroll-view> |
| | | <div class="button" @click="toapply">确认了解</div> |
| | | </div> |
| | | <view class="container"> |
| | | <scroll-view scroll-y class="content"> |
| | | <view> |
| | | <view v-html="content"></view> |
| | | </view> |
| | | <view class="empty"></view> |
| | | </scroll-view> |
| | | <view class="button" :class="{ disable: num > 0 }" @click="toapply"> |
| | | 已知晓,下一步 |
| | | <text v-if="num > 0">({{ num }}秒)</text> |
| | | </view> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | export default { |
| | | name: 'Index', |
| | | data() { |
| | | return { |
| | | content: '', |
| | | answer: '' |
| | | } |
| | | }, |
| | | onLoad() { |
| | | this.getInfo() |
| | | }, |
| | | methods: { |
| | | getInfo() { |
| | | // 入场须知详情 |
| | | this.$u.api.getSystemDictData({ |
| | | dictCode: 'SYSTEM', |
| | | label: 'VISIT_NOTICE' |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.content = res.data.code |
| | | } |
| | | }) |
| | | // 是否需要答题 |
| | | this.$u.api.getSystemDictData({ |
| | | dictCode: 'SYSTEM', |
| | | label: 'PROBLEM_VISIT_REQUIRED' |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.answer = res.data.code |
| | | } |
| | | }) |
| | | }, |
| | | toapply() { |
| | | if (this.answer === '0') { |
| | | uni.navigateTo({ |
| | | url: '/pages/userinfo/userinfo' |
| | | }) |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: '/pages/answer/answer' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | let timer |
| | | import { getSystemDictData } from "@/api" |
| | | import { getCode } from "@/utils/getCode.js"; |
| | | export default { |
| | | name: 'Index', |
| | | data() { |
| | | return { |
| | | content: ``, |
| | | answer: '', |
| | | num: 5 |
| | | } |
| | | }, |
| | | onLoad() { |
| | | this.getInfo() |
| | | getCode(code => { |
| | | console.log('code', code) |
| | | }); |
| | | // if (!this.$store.state.openId) { |
| | | // this.initToken() |
| | | // } |
| | | }, |
| | | methods: { |
| | | initToken() { |
| | | const appID = 'wxac2a80c2144c4ee0' |
| | | // const AppSecret = '922c93596d134fedf5bd22a9354b3bfe' |
| | | let uri = encodeURIComponent('http://xiaopiqiu2.natapp1.cc/static/redirect.html') |
| | | let authURL = |
| | | `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appID}&redirect_uri=${uri}&response_type=code&scope=snsapi_base&state=123#wechat_redirect` |
| | | window.location.href = authURL |
| | | }, |
| | | getInfo() { |
| | | // 入园须知详情 |
| | | getSystemDictData({ |
| | | dictCode: 'SYSTEM', |
| | | label: 'VISIT_NOTICE' |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.content = res.data.code |
| | | } |
| | | }) |
| | | // 倒计时时间 |
| | | getSystemDictData({ |
| | | dictCode: 'SYSTEM', |
| | | label: 'NOTICE_CUTNTDOWN' |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.num = res.data.code |
| | | timer = setInterval(() => { |
| | | this.num-- |
| | | if (this.num === 0) { |
| | | clearInterval(timer) |
| | | } |
| | | }, 1000) |
| | | } |
| | | }) |
| | | // 是否需要答题 |
| | | getSystemDictData({ |
| | | dictCode: 'SYSTEM', |
| | | label: 'PROBLEM_VISIT_REQUIRED' |
| | | }).then(res => { |
| | | if (res.code === 200) { |
| | | this.answer = res.data.code |
| | | } |
| | | }) |
| | | }, |
| | | toapply() { |
| | | if (this.num > 0) return |
| | | if (this.answer === '0') { |
| | | uni.navigateTo({ |
| | | url: '/pages/userinfo/userinfo' |
| | | }) |
| | | } else { |
| | | uni.navigateTo({ |
| | | url: '/pages/answer/answer' |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | .container { |
| | | width: 100%; |
| | | height: 100vh; |
| | | padding: 30rpx; |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | flex-flow: column; |
| | | |
| | | .content { |
| | | flex: 1; |
| | | height: calc(100% - 88rpx - 60rpx - 40rpx); |
| | | } |
| | | |
| | | .button { |
| | | margin-top: 40rpx; |
| | | width: 100%; |
| | | height: 88rpx; |
| | | line-height: 88rpx; |
| | | text-align: center; |
| | | background: #025EEF; |
| | | border-radius: 44rpx; |
| | | font-size: 32rpx; |
| | | font-weight: 500; |
| | | color: #FFFFFF; |
| | | } |
| | | } |
| | | .container { |
| | | width: 100%; |
| | | height: 100vh; |
| | | padding: 10rpx 30rpx 0; |
| | | box-sizing: border-box; |
| | | display: flex; |
| | | flex-direction: column; |
| | | .content { |
| | | height: calc(100% - 130rpx); |
| | | .title { |
| | | color: #333333; |
| | | font-weight: 600; |
| | | margin-bottom: 16rpx; |
| | | } |
| | | .text { |
| | | font-weight: 350; |
| | | } |
| | | .empty { |
| | | height: 160rpx; |
| | | } |
| | | } |
| | | .button { |
| | | width: 690rpx; |
| | | height: 88rpx; |
| | | line-height: 88rpx; |
| | | text-align: center; |
| | | background: #4d99a8; |
| | | border-radius: 44rpx; |
| | | font-size: 32rpx; |
| | | color: #ffffff; |
| | | position: fixed; |
| | | bottom: 30rpx; |
| | | left: 30rpx; |
| | | } |
| | | .disable { |
| | | background-color: #cccccc; |
| | | } |
| | | } |
| | | </style> |