index.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. <template>
  2. <div class="Soundbyte">
  3. <van-image :width="topWidth" :height="topWidth / 1.7" :src="soundbyteJpg" />
  4. <br />
  5. <van-cell-group inset>
  6. <van-nav-bar title="活动介绍" />
  7. <p
  8. style="
  9. text-indent: 2em;
  10. padding: 8px;
  11. text-align: justify;
  12. line-height: 1.5em;
  13. font-size: 16px;
  14. "
  15. >
  16. 由陕西广电融媒体集团(台)官方平台闪视频APP与陕西音乐广播FM98.8共同打造的校园音乐IP-“战马音浪•校园歌手大赛”将于2022年11月16日-11月26日举办。本次活动以线上直播PK
  17. 为主,结合线上线下丰富有趣的内容设置,依托省台影响力将赛事在全网曝光。
  18. </p>
  19. </van-cell-group>
  20. <br />
  21. <van-form @submit="onSubmit">
  22. <van-cell-group inset>
  23. <van-nav-bar title="报名信息" />
  24. <van-field
  25. required
  26. v-model="from.name"
  27. label="选手姓名"
  28. placeholder="请输入用户名"
  29. :rules="[{ validator: isString, message: '请输入正确内容' }]"
  30. />
  31. <van-field
  32. name="radio"
  33. label="参赛方式"
  34. required
  35. :rules="[{ validator: isString, message: '请输入正确内容' }]"
  36. >
  37. <template #input>
  38. <van-radio-group v-model="from.isOnLine" direction="horizontal">
  39. <van-radio name="线上" checked-color="#ff2c2c">线上</van-radio>
  40. <van-radio name="线下" checked-color="#ff2c2c">线下</van-radio>
  41. </van-radio-group>
  42. </template>
  43. </van-field>
  44. <van-field
  45. required
  46. v-model.number="from.tel"
  47. label="联系方式"
  48. type="tel"
  49. maxlength="11"
  50. placeholder="请输入手机号"
  51. :rules="[{ validator: isNumber, message: '请输入正确内容' }]"
  52. />
  53. <van-field
  54. required
  55. v-model="from.university"
  56. label="参赛院校"
  57. placeholder="请输入院校名称"
  58. :rules="[{ validator: isString, message: '请输入正确内容' }]"
  59. />
  60. <van-field
  61. placeholder="上传作品"
  62. required
  63. label="上传作品"
  64. :rules="[{ validator: isFile, message: '请输入正确内容' }]"
  65. >
  66. <template #input>
  67. <van-uploader
  68. accept="video/*"
  69. v-model="from.file"
  70. :max-count="1"
  71. :max-size="524288000"
  72. @oversize="filesize"
  73. result-type="file"
  74. >
  75. <template #preview-cover>
  76. <van-icon
  77. color="#fff"
  78. size="40"
  79. @click="previewClick"
  80. name="play-circle-o play"
  81. />
  82. </template>
  83. </van-uploader>
  84. <p style="font-size: 12px; color: #666">
  85. 支持上传MP4、MOV格式的视频,视频时长三分钟以内,视频大小500M以内
  86. </p>
  87. </template>
  88. </van-field>
  89. <div style="padding: 5px">
  90. <van-button block type="danger" native-type="submit">
  91. 我要报名
  92. </van-button>
  93. </div>
  94. </van-cell-group>
  95. </van-form>
  96. <br />
  97. <div class="guize" @click="showGuize">活动规则</div>
  98. <div
  99. class="Preview"
  100. :style="preview !== '' ? '' : 'z-index: -1;opacity: 0'"
  101. >
  102. <van-icon
  103. name="close"
  104. color="#fff"
  105. size="30"
  106. class="close"
  107. @click="closePreview"
  108. />
  109. <video ref="previewVideo" controls :src="preview"></video>
  110. </div>
  111. </div>
  112. </template>
  113. <script setup>
  114. // import { onMounted, reactive } from "vue";
  115. import { ref, reactive } from "vue";
  116. import { Toast, Dialog } from "vant";
  117. import axios from "axios";
  118. import soundbyteJpg from "../../assets/img/soundbyte.jpg";
  119. /**
  120. * window.$originData.orginParames.title 页面标题
  121. * window.$originData.orginParames.parameters 固定参数值
  122. * window.$originData.urlParames url参数
  123. */
  124. const topWidth = ref(window.$originData.orginParames.availWidth);
  125. const preview = ref("");
  126. const previewVideo = ref(null);
  127. const shanshipin = window.$shanshipin || {};
  128. const from = reactive({
  129. name: shanshipin.UserName || "",
  130. tel:
  131. !isNaN(shanshipin.Phone) && Number(shanshipin.Phone)
  132. ? shanshipin.Phone
  133. : "",
  134. university: "",
  135. isOnLine: "线上",
  136. file: [],
  137. });
  138. const filesize = () => Toast("超出文件大小限制");
  139. const previewClick = () => {
  140. let getUrl = null;
  141. const file = from.file[0].file;
  142. if (window.createObjectURL != undefined) {
  143. //basic
  144. getUrl = window.createObjectURL(file);
  145. } else if (window.URL != undefined) {
  146. //window.URL 标准定义
  147. getUrl = window.URL.createObjectURL(file);
  148. } else if (window.webkitURL != undefined) {
  149. //window.webkitURL是webkit的内核
  150. //webkit or chrome
  151. getUrl = window.webkitURL.createObjectURL(file);
  152. }
  153. preview.value = getUrl;
  154. previewVideo.value.play();
  155. };
  156. const closePreview = () => {
  157. preview.value = "";
  158. };
  159. const showGuize = () => {
  160. Dialog.alert({
  161. title: "活动规则",
  162. messageAlign: "left",
  163. confirmButtonText: "关闭",
  164. message:
  165. "1、报名时间:即日起至2022年11月25日。\n2、参与对象:陕西各高校学生。\n3、参赛要求:曲风不限,自行准备演唱伴奏。\n4、嘉宾评委:陕西广播电视台音乐类主播/西安知名音乐人/歌手。\n5、评比规则:唱功为基本要求,结合现场表现、演唱发挥进行综合评分,优秀选手将直接进入总决赛(决赛时间:2022年11月26日),线上将评出人气选手。\n6、线上比赛时间:11月16日 19:00--21:00、11月23日 19:00--21:00。\n7、线下比赛时间:11月12日 14:00--16:00、11月13日 14:00--16:00、11月19日 14:00--16:00、11月20日 14:00--16:00。",
  166. });
  167. };
  168. const isString = v => {
  169. return !!v && typeof v == "string" && isNaN(v);
  170. };
  171. const isNumber = v => {
  172. return !!v && !isNaN(v);
  173. };
  174. const isFile = () => {
  175. return from.file && from.file.length;
  176. };
  177. window.appLoginSuccess = () => {
  178. console.log("登录");
  179. };
  180. const onSubmit = () => {
  181. if (!isFile) Toast("请上传作品");
  182. const oriData = new FormData();
  183. oriData.append("name", from.name);
  184. oriData.append("phone", from.tel);
  185. oriData.append("university", from.university);
  186. oriData.append("isOnLine", from.isOnLine);
  187. oriData.append("file", from.file[0].file);
  188. Toast.loading({
  189. message: "报名中...",
  190. forbidClick: true,
  191. duration: 0,
  192. });
  193. axios({
  194. method: "post",
  195. url: "https://topic.smcic.net/xian-song/store",
  196. headers: {
  197. "Content-Type": "multipart/form-data",
  198. },
  199. data: oriData,
  200. })
  201. .then(r => {
  202. console.log(r);
  203. Toast.clear();
  204. Dialog.alert({
  205. title: "报名成功",
  206. messageAlign: "left",
  207. confirmButtonText: "关闭",
  208. message: () => (
  209. <img
  210. src="https://cxzx.smcic.net/topic/tool/img/er.jpg"
  211. style="width: 100%"
  212. />
  213. ),
  214. });
  215. })
  216. .catch(() => {
  217. Toast.clear();
  218. Toast("报名失败");
  219. });
  220. };
  221. </script>
  222. <style>
  223. .Soundbyte {
  224. width: 100vw;
  225. min-height: 100vh;
  226. background-color: #0c0000;
  227. font-weight: 400;
  228. }
  229. .Soundbyte .van-hairline--bottom:after {
  230. border-bottom-width: 0px;
  231. }
  232. .Soundbyte .van-nav-bar__content {
  233. background-image: url("../../assets/img/title.png");
  234. background-size: 100% 100%;
  235. background-repeat: no-repeat;
  236. overflow: hidden;
  237. }
  238. .Soundbyte .van-nav-bar__title {
  239. color: #f63634;
  240. font-size: 23px;
  241. }
  242. .Soundbyte .van-button__text {
  243. font-size: 15px;
  244. font-weight: 400;
  245. }
  246. .Soundbyte .van-uploader__preview-cover {
  247. background-color: #000;
  248. }
  249. .van-uploader__preview-cover video {
  250. width: 100%;
  251. height: 100%;
  252. }
  253. .Soundbyte .play {
  254. position: relative;
  255. top: 50%;
  256. left: 50%;
  257. transform: translate(-50%, -50%);
  258. }
  259. .Soundbyte .Preview {
  260. position: fixed;
  261. top: 0;
  262. left: 0;
  263. right: 0;
  264. bottom: 0;
  265. background-color: rgba(0, 0, 0, 0.3);
  266. z-index: 10;
  267. }
  268. .Soundbyte .Preview video {
  269. position: absolute;
  270. left: 0;
  271. top: 50%;
  272. transform: translateY(-50%);
  273. width: 100vw;
  274. max-width: 100vh;
  275. background: #000;
  276. }
  277. .Soundbyte .Preview .close {
  278. position: absolute;
  279. right: 5px;
  280. top: 5px;
  281. }
  282. .Soundbyte .guize {
  283. background-color: #ff2c2c;
  284. position: fixed;
  285. right: 0;
  286. top: 2em;
  287. color: #fff;
  288. font-weight: 400;
  289. font-size: 16px;
  290. padding: 3px 5px 3px 15px;
  291. border-top-left-radius: 1em;
  292. border-bottom-left-radius: 1em;
  293. z-index: 11;
  294. }
  295. </style>