makeApply.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. <template>
  2. <view style="background-color: #FF531C;">
  3. <!-- 预约报名 -->
  4. <image :src="bg1" mode="widthFix" style="width: 100%;" class="bground">
  5. <!-- <image src="../../static/apply/bg.png" mode="widthFix" style="width: 100%;" class="bground"> -->
  6. <view class="bground_time">报名时间:{{ sign_start_time }}-{{ sign_end_time }}</view>
  7. <view class="bground_box" v-if="apply === 0">
  8. <view class="title">大卫博士学位争霸赛第{{season}}季</view>
  9. <video id="myVideo" :src="src" controls></video>
  10. <view class="shuoming">赛事规则说明</view>
  11. <view class="apply" @click="$noMultipleClicks(goApply)" >预约报名</view>
  12. </view>
  13. <view class="bground_box" v-if="apply === 1">
  14. <view class="title">大卫博士学位争霸赛第{{season}}季</view>
  15. <!-- <image src="../../static/apply/success.png" mode="widthFix" style="width: 260rpx;"></image> -->
  16. <image :src="bg2" mode="widthFix" style="width: 260rpx;"></image>
  17. <view class="success">预约成功!</view>
  18. <view style="margin-bottom: 164rpx;text-align: center;">
  19. <view class="tixing">报名开始时会有微信消息提醒,请注意查收!</view>
  20. <view class="tixing">报名时请使用已注册账号。</view>
  21. </view>
  22. </view>
  23. <view class="bground_box" v-if="apply === 2">
  24. <view class="title">大卫博士学位争霸赛第{{season}}季</view>
  25. <image :src="bg3" mode="widthFix" style="width: 260rpx;"></image>
  26. <!-- <image src="../../static/apply/error.png" mode="widthFix" style="width: 260rpx;"></image> -->
  27. <view class="success">无法报名</view>
  28. <view class="error">抱歉您还不是公司客户,暂无法报名!</view>
  29. </view>
  30. </image>
  31. </view>
  32. </template>
  33. <script>
  34. import { GetAppointmentInfo, Appointment } from '../../api.js'
  35. export default {
  36. data() {
  37. return {
  38. noClick:true,
  39. apply: 0,
  40. sign_start_time: '',
  41. sign_end_time: '',
  42. season: '',
  43. bg1: 'https://api.admin.jiuweiyun.cn/uploads/images/rule/202205/06/rule_1651832138_qhqrS4AqcC.png',
  44. bg2: 'https://api.admin.jiuweiyun.cn/uploads/images/rule/202205/06/rule_1651832177_1zgFmqrSEw.png',
  45. bg3: 'https://api.admin.jiuweiyun.cn/uploads/images/rule/202205/06/rule_1651832158_EVe4qth6lv.png',
  46. src:'https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/%E7%AC%AC1%E8%AE%B2%EF%BC%88uni-app%E4%BA%A7%E5%93%81%E4%BB%8B%E7%BB%8D%EF%BC%89-%20DCloud%E5%AE%98%E6%96%B9%E8%A7%86%E9%A2%91%E6%95%99%E7%A8%8B@20200317.mp4'
  47. }
  48. },
  49. onShow() {
  50. this.$store.dispatch('onLaunch').then(() => {
  51. this.getAppointment()
  52. }).catch(e => {})
  53. },
  54. methods: {
  55. happenTimeFun(num){//时间戳数据处理
  56. let date = new Date(num*1000);
  57. //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  58. let y = date.getFullYear();
  59. let MM = date.getMonth() + 1;
  60. MM = MM < 10 ? ('0' + MM) : MM;//月补0
  61. let d = date.getDate();
  62. d = d < 10 ? ('0' + d) : d;//天补0
  63. let h = date.getHours();
  64. h = h < 10 ? ('0' + h) : h;//小时补0
  65. let m = date.getMinutes();
  66. m = m < 10 ? ('0' + m) : m;//分钟补0
  67. let s = date.getSeconds();
  68. s = s < 10 ? ('0' + s) : s;//秒补0
  69. return y + '.' + MM + '.' + d;
  70. },
  71. getAppointment() {
  72. uni.showLoading({title: '加载中',mask:true});
  73. this.$ajax.get(`${GetAppointmentInfo}`).then(([, { data: res }]) => {
  74. setTimeout(function () {uni.hideLoading();}, 100);
  75. this.sign_start_time = this.happenTimeFun(Number(res.data.sign_start_time))
  76. this.sign_end_time = this.happenTimeFun(Number(res.data.sign_end_time))
  77. this.season = res.data.season
  78. if (res.data.status === true) {
  79. this.apply = 1
  80. } else {
  81. this.apply = 0
  82. }
  83. })
  84. },
  85. async goApply() {
  86. const res = await uni.getSetting({ withSubscriptions: true })
  87. const go = () => {
  88. this.sureApply()
  89. }
  90. let s;
  91. try {
  92. const [, { subscriptionsSetting: { itemSettings: _s } }] = await uni.getSetting({ withSubscriptions: true })
  93. s = _s
  94. } catch(e) {
  95. go()
  96. return false
  97. }
  98. const tmplIds = [
  99. 't9_3hsUqanNeYNheYEDtsL26VWqCVRrFBaj7QLiSh2M',
  100. '8R9SbxBeziYURpzOqMYQUyd1dCzBKQVuayrpeUr4PSQ',
  101. 'FjXnhSWmUSoCLf-eC1zkNxbojpD7bzoe0U9yVGRZR54'
  102. ]
  103. const t_alen = tmplIds.length
  104. let t_len = 0
  105. if(s) {
  106. const s_k = Object.keys(s)
  107. const s_v = Object.values(s)
  108. t_len = tmplIds.filter(id => s_k.indexOf(id) !== -1).length
  109. }
  110. if(!s || t_len !== t_alen) {
  111. uni.requestSubscribeMessage({
  112. tmplIds,
  113. success(res) {
  114. const _o = Object.assign({}, res)
  115. Reflect.deleteProperty(_o, 'errMsg')
  116. const a_len = Object.values(_o).filter(s => s === 'accept').length
  117. if(a_len !== t_alen){
  118. uni.showModal({
  119. title: '提示',
  120. content: '请选择订阅服务,以便我们通知您活动信息',
  121. showCancel: false
  122. })
  123. } else {
  124. go()
  125. }
  126. },
  127. fail(err) {
  128. uni.showModal({
  129. title: '失败',
  130. content: '打开订阅服务失败',
  131. showCancel: false
  132. })
  133. go()
  134. }
  135. })
  136. } else {
  137. go()
  138. }
  139. },
  140. sureApply() {
  141. this.$ajax.get(`${Appointment}`).then(([, { data: res }]) => {
  142. if (res.code === 200) {
  143. this.apply = 1
  144. } else {
  145. this.apply = 2
  146. }
  147. })
  148. }
  149. }
  150. }
  151. </script>
  152. <style lang="scss" scoped>
  153. page {
  154. width: 100%;
  155. display: flex;
  156. flex-direction: column;
  157. }
  158. .bground {
  159. position: relative;
  160. &_time {
  161. width: 522rpx;
  162. font-size: 32rpx;
  163. font-weight: bold;
  164. line-height: 32rpx;
  165. color: #FFFFFF;
  166. position: absolute;
  167. left: 50%;
  168. top: 450rpx;
  169. margin-left: -242rpx;
  170. }
  171. &_box {
  172. position: absolute;
  173. left: 50%;
  174. top: 420rpx;
  175. margin-left: -345rpx;
  176. width: 690rpx;
  177. height: 924rpx;
  178. border-radius: 24rpx;
  179. padding: 120rpx 0 64rpx 0;
  180. display: flex;
  181. justify-content: space-between;
  182. flex-direction: column;
  183. align-items: center;
  184. color: #333333;
  185. font-weight: bold;
  186. .title {
  187. font-size: 44rpx;
  188. }
  189. .shuoming {
  190. font-size: 32rpx;
  191. }
  192. .apply {
  193. width: 582rpx;
  194. line-height: 100rpx;
  195. background: linear-gradient(179deg, #F7C02F 0%, #F17E06 100%);
  196. opacity: 1;
  197. border-radius: 50rpx;
  198. color: #fff;
  199. font-size: 36rpx;
  200. text-align: center;
  201. }
  202. .success {
  203. font-size: 56rpx;
  204. }
  205. .tixing {
  206. font-size: 30rpx;
  207. line-height: 40rpx;
  208. margin-top: 10rpx;
  209. }
  210. .error {
  211. font-size: 36rpx;
  212. margin-bottom: 212rpx;
  213. }
  214. }
  215. }
  216. </style>