index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  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 :preview-options="{ closeable: true }" accept="image/*" v-model="photo"
  49. :max-count="1" :max-size="524288000" @oversize="filesize" :after-read="beforeRead"
  50. result-type="file">
  51. </van-uploader>
  52. <p style="font-size: 12px;" v-text="lang[langType].photoSubContent"> </p>
  53. </template>
  54. </van-field>
  55. <br />
  56. <h4 class="title" v-text="lang[langType].conference"></h4>
  57. <van-field label-width="7em" v-model="from.cardTypeName" is-link readonly
  58. :label="lang[langType].conferenceType" :placeholder="lang[langType].conferenceTypeContent"
  59. @click="showCardType = true" />
  60. <van-popup v-model:show="showCardType" destroy-on-close round position="bottom">
  61. <van-picker :model-value="from.cardType" :columns="cardTypeList" @cancel="showCardType = false"
  62. @confirm="onConfirm" />
  63. </van-popup>
  64. <br />
  65. <h4 class="title" v-text="lang[langType].orther"></h4>
  66. <van-field label-width="7em" v-model="from.message" rows="3" autosize
  67. :label="lang[langType].ortherNotes" type="textarea"
  68. :placeholder="lang[langType].ortherNotesContent" />
  69. </van-cell-group>
  70. </div>
  71. <div class="btn_bottom" native-type="submit" v-text="lang[langType].submit" @click="onSubmit"> </div>
  72. <div style="text-align: center;line-height: 2.5em;font-size: 12px;" v-text="lang[langType].copyright"></div>
  73. </van-form>
  74. </div>
  75. </template>
  76. <script setup>
  77. // import { onMounted, reactive } from "vue";
  78. import { ref, reactive, onBeforeUpdate } from 'vue';
  79. import { showToast } from 'vant';
  80. import axios from 'axios';
  81. import config from '@/config/index.js';
  82. import soundbyteJpg from '../../assets/img/2025lameifenghui.png';
  83. import { getJoinType, saveData } from '@/api/2025.js';
  84. import langpkg from './lang.js';
  85. const langObj = [
  86. { text: '中文', value: 'zh' },
  87. { text: 'English', value: 'en' },
  88. ]
  89. const langObjT = {
  90. zh: '中文',
  91. en: 'English',
  92. }
  93. // import en from './en.json';
  94. /**
  95. * window.$originData.orginParames.title 页面标题
  96. * window.$originData.orginParames.parameters 固定参数值
  97. * window.$originData.urlParames url参数
  98. */
  99. const lang = ref(langpkg);
  100. const langType = ref(localStorage.getItem('langType') || 'zh');
  101. const showLange = ref(false);
  102. const showCardType = ref(false);
  103. const cardTypeList = ref([])
  104. const photo = ref([])
  105. const isFile = () => {
  106. return photo.value && photo.value.length;
  107. };
  108. const langChange = ({ selectedValues }) => {
  109. langType.value = selectedValues[0];
  110. localStorage.setItem('langType', 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.value[langType.value].fileSize);
  135. // 选择证件类型
  136. const onConfirm = ({ selectedValues, selectedOptions }) => {
  137. showCardType.value = false;
  138. from.cardType = selectedValues;
  139. from.cardTypeName = selectedOptions[0].text;
  140. };
  141. const beforeRead = () => {
  142. if (!isFile) showToast(lang.value[langType.value].changePhono);
  143. const item = photo.value[0]
  144. const oriData = new FormData();
  145. oriData.append('file', item.file);
  146. axios({
  147. method: 'post',
  148. url: config.base.Url2025 + 'dev/file/uploadDynamicReturnUrl',
  149. headers: {
  150. 'Content-Type': 'multipart/form-data',
  151. },
  152. data: oriData,
  153. })
  154. .then(res => {
  155. if (res.status !== 200 || res.data.code !== 0) {
  156. showToast(lang.value[langType.value].upFileError);
  157. from.photoUrl = []
  158. return
  159. }
  160. showToast(lang.value[langType.value].upFileSusscess);
  161. from.photoUrl = [{ url: res.data.data }]
  162. photo.value = [
  163. {
  164. url: res.data.data,
  165. file: item.file,
  166. }
  167. ]
  168. })
  169. return true;
  170. };
  171. // 选择权限范围
  172. const onSubmit = () => {
  173. if (!isFile) showToast(lang.value[langType.value].selectFile);
  174. saveData({
  175. "name": from.name,
  176. "photo": from.photoUrl[0].url,
  177. "nationality": from.nationality,
  178. "passportOrId": from.idCard,
  179. "contact": from.contact,
  180. "position": from.career,
  181. "company": from.company,
  182. "participationType": from.cardType.join(','),
  183. "remarks": from.message
  184. }).then(() => {
  185. showToast(lang.value[langType.value].registration);
  186. // 清空表单内容
  187. from.name = '';
  188. from.idCard = '';
  189. from.nationality = '';
  190. from.company = '';
  191. from.career = '';
  192. from.photoUrl = []
  193. from.contact = '';
  194. from.cardType = [];
  195. photo.value = [];
  196. from.message = '';
  197. }).catch(() => {
  198. showToast(lang.value[langType.value].registrationError);
  199. });
  200. };
  201. </script>
  202. <style lang="scss">
  203. .fenghui {
  204. overflow-x: hidden;
  205. width: 100vw;
  206. max-width: 750px;
  207. margin: 0 auto;
  208. min-height: 100vh;
  209. // background: linear-gradient(270deg, #1C4DD6 0%, #1D18BC 100%);
  210. font-weight: 400;
  211. position: relative;
  212. .swith {
  213. position: absolute;
  214. right: 10px;
  215. top: 10px;
  216. z-index: 999;
  217. color: #fff;
  218. .title {
  219. cursor: pointer;
  220. }
  221. }
  222. input {
  223. text-align: right;
  224. }
  225. .text {
  226. padding: 8px 8px 0 8px;
  227. text-align: justify;
  228. line-height: 1.5em;
  229. font-size: 14px;
  230. color: #3D3D3D;
  231. }
  232. .introduce {
  233. background-color: #FAFAFA;
  234. padding-bottom: 10px;
  235. overflow: hidden;
  236. h4 {
  237. color: #031280;
  238. }
  239. }
  240. .van-hairline--bottom:after {
  241. border-bottom-width: 0px;
  242. }
  243. .van-button__text {
  244. font-size: 15px;
  245. font-weight: 400;
  246. color: #031280;
  247. }
  248. .icon {
  249. position: absolute;
  250. right: 10px;
  251. top: 50%;
  252. transform: translateY(-50%);
  253. }
  254. .btn_bottom {
  255. color: #ffffff;
  256. text-align: center;
  257. height: 60px;
  258. line-height: 60px;
  259. background: linear-gradient(270deg, #1D19BC 0%, #1C4CD5 100%);
  260. }
  261. .submit {
  262. .title {
  263. padding: 0 16px;
  264. }
  265. .van-cell-group,
  266. .van-cell {
  267. margin: 0%;
  268. }
  269. .van-field__body input {
  270. &::placeholder,
  271. &::-webkit-input-placeholder,
  272. &:-moz-placeholder,
  273. &::-moz-placeholder,
  274. &:-ms-input-placeholder {
  275. color: rgba(255, 255, 255, 0.6);
  276. }
  277. }
  278. }
  279. }
  280. </style>