index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <div class="fenghui">
  3. <div class="swith">
  4. <div class="title" @click="showLange = true">
  5. {{ langObjT[langType] }}
  6. <van-icon name="arrow-down" />
  7. </div>
  8. <van-popup v-model:show="showLange" destroy-on-close round position="bottom">
  9. <van-picker :model-value="[langType]" :columns="langObj" @cancel="showLange = false"
  10. @confirm="langChange" />
  11. </van-popup>
  12. </div>
  13. <van-image style="width: 100%;" :src="soundbyteJpg" />
  14. <br />
  15. <div class="introduce">
  16. <h4 class="text" v-text="lang[langType].forumTopic"> </h4>
  17. <p class="text" v-text="lang[langType].forumTopicContent"></p>
  18. <h4 class="text" v-text="lang[langType].wrestleMania"></h4>
  19. <p class="text" v-text="lang[langType].wrestleManiaContent"></p>
  20. <h4 class="text" v-text="lang[langType].venue"></h4>
  21. <p class="text" v-text="lang[langType].venueContent"></p>
  22. <h4 class="text" v-text="lang[langType].organization"></h4>
  23. <div class="text" v-text="lang[langType].organizationSub1"></div>
  24. <div class="text" v-text="lang[langType].organizationSub2"></div>
  25. <h4 class="text" v-text="lang[langType].scale"></h4>
  26. <div class="text" style="text-indent: 2em;" v-text="lang[langType].scaleContent"></div>
  27. </div>
  28. <br />
  29. <van-form @submit="onSubmit">
  30. <div class="submit">
  31. <van-cell-group inset>
  32. <h4 class="title" v-text="lang[langType].basicInformation"></h4>
  33. <van-field label-width="7em" v-model="from.name" :label="lang[langType].name"
  34. :placeholder="lang[langType].nameContent" />
  35. <van-field label-width="7em" v-model="from.idCard" :label="lang[langType].idCard"
  36. :placeholder="lang[langType].idCardContent" />
  37. <van-field label-width="7em" v-model="from.nationality" :label="lang[langType].nationality"
  38. :placeholder="lang[langType].nationalityContent" />
  39. <van-field label-width="7em" v-model="from.company" :label="lang[langType].company"
  40. :placeholder="lang[langType].companyContent" />
  41. <van-field label-width="7em" v-model="from.career" :label="lang[langType].career"
  42. :placeholder="lang[langType].careerContent" />
  43. <van-field label-width="7em" v-model="from.contact" :label="lang[langType].contact"
  44. :placeholder="lang[langType].contactContent" />
  45. <van-field label-width="7em" :placeholder="lang[langType].photoContent"
  46. :label="lang[langType].photo">
  47. <template #input>
  48. <van-uploader accept="image/*" v-model="from.photo" :max-count="1" :max-size="524288000"
  49. @oversize="filesize" :after-read="beforeRead" result-type="file">
  50. <template #preview-cover>
  51. <van-icon color="#000" size="40" @click="previewClick" name="play-circle-o play" />
  52. </template>
  53. </van-uploader>
  54. <p style="font-size: 12px;" v-text="lang[langType].photoSubContent"> </p>
  55. </template>
  56. </van-field>
  57. <br />
  58. <h4 class="title" v-text="lang[langType].conference"></h4>
  59. <van-field label-width="7em" v-model="from.cardTypeName" is-link readonly
  60. :label="lang[langType].conferenceType" :placeholder="lang[langType].conferenceTypeContent"
  61. @click="showCardType = true" />
  62. <van-popup v-model:show="showCardType" destroy-on-close round position="bottom">
  63. <van-picker :model-value="from.cardType" :columns="cardTypeList" @cancel="showCardType = false"
  64. @confirm="onConfirm" />
  65. </van-popup>
  66. <br />
  67. <h4 class="title" v-text="lang[langType].orther"></h4>
  68. <van-field label-width="7em" v-model="from.message" rows="3" autosize :label="lang[langType].notes" type="textarea"
  69. :placeholder="lang[langType].ortherNotesContent" />
  70. </van-cell-group>
  71. </div>
  72. <div class="btn_bottom" native-type="submit" v-text="lang[langType].submit" @click="onSubmit"> </div>
  73. <div style="text-align: center;line-height: 2.5em;font-size: 12px;" v-text="lang[langType].copyright"></div>
  74. </van-form>
  75. </div>
  76. </template>
  77. <script setup>
  78. // import { onMounted, reactive } from "vue";
  79. import { ref, reactive, onBeforeUpdate } from 'vue';
  80. import { showToast } from 'vant';
  81. import axios from 'axios';
  82. import config from '@/config/index.js';
  83. import soundbyteJpg from '../../assets/img/2025lameifenghui.png';
  84. import { getJoinType, saveData } from '@/api/2025.js';
  85. import langpkg from './lang.js';
  86. const langObj = [
  87. { text: '中文', value: 'zh' },
  88. { text: 'English', value: 'en' },
  89. ]
  90. const langObjT = {
  91. zh: '中文',
  92. en: 'English',
  93. }
  94. // import en from './en.json';
  95. /**
  96. * window.$originData.orginParames.title 页面标题
  97. * window.$originData.orginParames.parameters 固定参数值
  98. * window.$originData.urlParames url参数
  99. */
  100. const lang = ref(langpkg);
  101. const langType = ref('zh');
  102. const preview = ref('');
  103. const showLange = ref(false);
  104. const showCardType = ref(false);
  105. const cardTypeList = ref([])
  106. const isFile = () => {
  107. return from.photo && from.photo.length;
  108. };
  109. const langChange = ({ selectedValues }) => {
  110. langType.value = selectedValues[0];
  111. showLange.value = false;
  112. };
  113. const from = reactive({
  114. name: '',
  115. idCard: '',
  116. nationality: '',
  117. company: '',
  118. career: '',
  119. contact: '',
  120. photoUrl: '',
  121. cardType: [],
  122. photo: [],
  123. message: ''
  124. });
  125. onBeforeUpdate(() => { });
  126. getJoinType().then((res) => {
  127. cardTypeList.value = res.map((item) => {
  128. return {
  129. text: item.dictLabel,
  130. value: item.dictValue,
  131. }
  132. })
  133. })
  134. const filesize = () => showToast(lang[langType].fileSize);
  135. const previewClick = () => {
  136. let getUrl = null;
  137. const file = from.photo[0].file;
  138. if (window.createObjectURL != undefined) {
  139. //basic
  140. getUrl = window.createObjectURL(file);
  141. } else if (window.URL != undefined) {
  142. //window.URL 标准定义
  143. getUrl = window.URL.createObjectURL(file);
  144. } else if (window.webkitURL != undefined) {
  145. //window.webkitURL是webkit的内核
  146. //webkit or chrome
  147. getUrl = window.webkitURL.createObjectURL(file);
  148. }
  149. preview.value = getUrl;
  150. };
  151. // 选择证件类型
  152. const onConfirm = ({ selectedValues, selectedOptions }) => {
  153. showCardType.value = false;
  154. from.cardType = selectedValues;
  155. from.cardTypeName = selectedOptions[0].text;
  156. };
  157. const beforeRead = () => {
  158. if (!isFile) showToast(lang[langType].changePhono);
  159. const oriData = new FormData();
  160. oriData.append('file', from.photo[0].file);
  161. axios({
  162. method: 'post',
  163. url: config.base.Url2025 + 'dev/file/uploadDynamicReturnUrl',
  164. headers: {
  165. 'Content-Type': 'multipart/form-data',
  166. },
  167. data: oriData,
  168. })
  169. .then(res => {
  170. if (res.status !== 200 || res.data.code !== 0) {
  171. showToast(lang[langType].upFileError);
  172. from.photoUrl = ''
  173. return
  174. }
  175. showToast(lang[langType].upFileSusscess);
  176. from.photoUrl = res.data.data
  177. })
  178. return true;
  179. };
  180. // 选择权限范围
  181. const onSubmit = () => {
  182. if (!isFile) showToast(lang[langType].selectFile);
  183. saveData({
  184. "name": from.name,
  185. "photo": from.photoUrl,
  186. "nationality": from.nationality,
  187. "passportOrId": from.idCard,
  188. "contact": from.contact,
  189. "position": from.career,
  190. "company": from.company,
  191. "participationType": from.cardType.join(','),
  192. "remarks": from.message
  193. }).then(() => {
  194. showToast(lang[langType].registration);
  195. // 清空表单内容
  196. from.name = '';
  197. from.idCard = '';
  198. from.nationality = '';
  199. from.company = '';
  200. from.career = '';
  201. from.photoUrl = ''
  202. from.contact = '';
  203. from.cardType = [];
  204. from.photo = [];
  205. from.message = '';
  206. }).catch(() => {
  207. showToast(lang[langType].registrationError);
  208. });
  209. };
  210. </script>
  211. <style lang="scss">
  212. .fenghui {
  213. overflow-x: hidden;
  214. width: 100vw;
  215. max-width: 750px;
  216. margin: 0 auto;
  217. min-height: 100vh;
  218. // background: linear-gradient(270deg, #1C4DD6 0%, #1D18BC 100%);
  219. font-weight: 400;
  220. position: relative;
  221. .swith {
  222. position: absolute;
  223. right: 10px;
  224. top: 10px;
  225. z-index: 999;
  226. color: #fff;
  227. .title {
  228. cursor: pointer;
  229. }
  230. }
  231. input {
  232. text-align: right;
  233. }
  234. .text {
  235. padding: 8px 8px 0 8px;
  236. text-align: justify;
  237. line-height: 1.5em;
  238. font-size: 14px;
  239. color: #3D3D3D;
  240. }
  241. .introduce {
  242. background-color: #FAFAFA;
  243. padding-bottom: 10px;
  244. overflow: hidden;
  245. h4 {
  246. color: #031280;
  247. }
  248. }
  249. .van-hairline--bottom:after {
  250. border-bottom-width: 0px;
  251. }
  252. .van-button__text {
  253. font-size: 15px;
  254. font-weight: 400;
  255. color: #031280;
  256. }
  257. .van-uploader__preview-cover {
  258. background-color: #000;
  259. }
  260. .btn_bottom {
  261. color: #ffffff;
  262. text-align: center;
  263. height: 60px;
  264. line-height: 60px;
  265. background: linear-gradient(270deg, #1D19BC 0%, #1C4CD5 100%);
  266. }
  267. .submit {
  268. .title {
  269. padding: 0 16px;
  270. }
  271. .van-cell-group,
  272. .van-cell {
  273. margin: 0%;
  274. }
  275. .van-field__body input {
  276. &::placeholder,
  277. &::-webkit-input-placeholder,
  278. &:-moz-placeholder,
  279. &::-moz-placeholder,
  280. &:-ms-input-placeholder {
  281. color: rgba(255, 255, 255, 0.6);
  282. }
  283. }
  284. }
  285. }
  286. </style>