mytheme.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <view class="theme-regist-content-info-container">
  3. <u-empty
  4. mode="data"
  5. text="暂未报名,前去报名"
  6. v-if="isEmpty"
  7. >
  8. </u-empty>
  9. <template v-else>
  10. <view class="title-container">
  11. <view class="title-content-text">{{ title }}</view>
  12. <view class="title-content-date">{{ date }}</view>
  13. </view>
  14. <rich-text :content="content"></rich-text>
  15. <u-popup :show="show" :round="5" mode="bottom" :closeOnClickOverlay="true" :overlay="true" @close="popClose">
  16. <view class="pop-form-content">
  17. <u--form
  18. labelPosition="left"
  19. :model="model1"
  20. :rules="rules"
  21. ref="uForm"
  22. @submit="onSubmit"
  23. >
  24. <u-form-item
  25. label="姓名"
  26. prop="userInfo.usrName"
  27. borderBottom
  28. >
  29. <u--input
  30. placeholder="输入姓名"
  31. v-model="model1.userInfo.usrName"
  32. border="none"
  33. ></u--input>
  34. </u-form-item>
  35. <u-form-item
  36. label="单位名称"
  37. prop="userInfo.orgUnitName"
  38. borderBottom
  39. >
  40. <u--input
  41. placeholder="输入单位名称"
  42. v-model="model1.userInfo.orgUnitName"
  43. border="none"
  44. ></u--input>
  45. </u-form-item>
  46. <u-form-item
  47. label="职务"
  48. prop="userInfo.uniLevel"
  49. borderBottom
  50. >
  51. <u--input
  52. placeholder="输入职务"
  53. v-model="model1.userInfo.uniLevel"
  54. border="none"
  55. ></u--input>
  56. </u-form-item>
  57. <u-form-item
  58. label="联系电话"
  59. prop="userInfo.tel"
  60. borderBottom
  61. >
  62. <u--input
  63. placeholder="输入联系电话"
  64. border="none"
  65. type="number"
  66. maxlength="11"
  67. v-model="model1.userInfo.tel"
  68. ></u--input>
  69. </u-form-item>
  70. <u-form-item
  71. label="邮箱"
  72. prop="userInfo.email"
  73. borderBottom
  74. >
  75. <u--input
  76. placeholder="输入邮箱"
  77. border="none"
  78. type="number"
  79. v-model="model1.userInfo.email"
  80. ></u--input>
  81. </u-form-item>
  82. <u-form-item
  83. label="人员类型"
  84. prop="userInfo.usrType"
  85. borderBottom
  86. >
  87. <u-radio-group
  88. v-model="model1.userInfo.usrType"
  89. placement="row"
  90. >
  91. <u-radio
  92. :style="{
  93. marginRight: '20rpx'
  94. }"
  95. v-for="(item, index) in USR_TYPE_LIST"
  96. :key="index"
  97. :label="item.name"
  98. :name="item.value"
  99. >
  100. </u-radio>
  101. </u-radio-group>
  102. </u-form-item>
  103. </u--form>
  104. <view class="review-msg" v-if="REVIEW_STATUS.noPass.value === model1.userInfo.reviewState">
  105. 审核备注:{{ model1.userInfo.reviewMsg }}
  106. </view>
  107. <u-button
  108. :style="{
  109. marginTop: 'auto',
  110. marginBottom: '80rpx'
  111. }"
  112. type="primary"
  113. text="提交"
  114. :disabled="loading"
  115. :loading="loading"
  116. loadingText="正在提交..."
  117. @click="onSubmit"
  118. >
  119. </u-button>
  120. </view>
  121. </u-popup>
  122. <view class="regist-btn">
  123. <u-button
  124. :text="REVIEW_STATUS[model1.userInfo.reviewState].name"
  125. size="normal"
  126. type="primary"
  127. :disabled="REVIEW_STATUS.pass.value === model1.userInfo.reviewState"
  128. @click="onRegistClick"
  129. ></u-button>
  130. </view>
  131. </template>
  132. <view class="regist-btn" v-if="isEmpty">
  133. <u-button
  134. text="我要报名"
  135. size="normal"
  136. type="primary"
  137. throttle-time="500"
  138. @click="toRegistClick"
  139. ></u-button>
  140. </view>
  141. </view>
  142. </template>
  143. <script>
  144. import { fetchUsrThemeMeetingInfo, putUsrRegist } from '@/common/api';
  145. import { CONTENT_TYPE, MEETING_TYPE, REVIEW_STATUS, USR_TYPE_LIST } from '@/common/EnumConst';
  146. import RichText from '@/components/RichText/index.vue';
  147. import SingleDropList from '@/components/SingleDropList/index.vue';
  148. import { authLogin, getStorageObj, storageKey } from '@/util';
  149. export default {
  150. name: 'content',
  151. computed: {
  152. REVIEW_STATUS() {
  153. return REVIEW_STATUS;
  154. },
  155. },
  156. components: {
  157. SingleDropList,
  158. RichText,
  159. },
  160. props: {},
  161. data() {
  162. return {
  163. CONTENT_TYPE,
  164. content: null,
  165. queryParams: {},
  166. title: '',
  167. date: '',
  168. contentType: '',
  169. show: false,
  170. isEmpty: false,
  171. id: '',
  172. USR_TYPE_LIST,
  173. loading: false,
  174. model1: {
  175. userInfo: {
  176. usrName: '',
  177. conferenceFlag: '1',
  178. },
  179. },
  180. rules: {
  181. 'userInfo.usrName': {
  182. type: 'string',
  183. required: true,
  184. message: '请填写姓名',
  185. trigger: ['blur', 'change'],
  186. },
  187. 'userInfo.tel': {
  188. type: 'string',
  189. len: 11,
  190. required: true,
  191. message: '请填写11位手机号',
  192. trigger: ['blur', 'change'],
  193. },
  194. 'userInfo.email': {
  195. type: 'string',
  196. required: true,
  197. message: '请填写邮箱',
  198. pattern: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
  199. trigger: ['blur', 'change'],
  200. },
  201. 'userInfo.orgUnitName': {
  202. type: 'string',
  203. required: true,
  204. message: '请填写单位名称',
  205. trigger: ['blur', 'change'],
  206. },
  207. 'userInfo.uniLevel': {
  208. type: 'string',
  209. required: true,
  210. message: '请填写职务',
  211. trigger: ['blur', 'change'],
  212. },
  213. 'userInfo.usrType': {
  214. type: 'string',
  215. required: true,
  216. message: '请填写人员类型',
  217. trigger: ['blur', 'change'],
  218. },
  219. },
  220. };
  221. },
  222. created() {
  223. },
  224. onLoad(res) {
  225. // 登录返回之后的页面
  226. this.queryParams = getStorageObj(storageKey.regtheme);
  227. this.getUsrContent();
  228. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  229. this.$refs.uForm.setRules(this.rules);
  230. },
  231. methods: {
  232. onSubmit() {
  233. this.loading = true;
  234. this.$refs.uForm.validate().then(async (res) => {
  235. const { code } = await putUsrRegist({
  236. ...this.model1.userInfo,
  237. contentId: this.id,
  238. }, this.queryParams.type);
  239. this.loading = false;
  240. if (code !== 200) {
  241. return;
  242. }
  243. uni.showToast({
  244. mask: true,
  245. title: '报名完成',
  246. icon: 'success',
  247. success: async () => {
  248. this.show = false;
  249. },
  250. });
  251. }).catch(errors => {
  252. this.loading = false;
  253. });
  254. },
  255. popClose() {
  256. this.show = false;
  257. },
  258. async getUsrContent() {
  259. const {
  260. data,
  261. } = await fetchUsrThemeMeetingInfo({}, this.queryParams.type);
  262. if (!data) {
  263. this.isEmpty = true;
  264. return;
  265. }
  266. const {
  267. content: {
  268. title,
  269. content,
  270. createTime,
  271. id,
  272. contentType,
  273. },
  274. ...usrInfoApply
  275. } = data;
  276. this.content = content;
  277. this.title = title;
  278. this.contentType = contentType;
  279. this.model1 = {
  280. userInfo: { ...usrInfoApply },
  281. };
  282. this.id = id;
  283. uni.setNavigationBarTitle({
  284. title,
  285. });
  286. this.date = uni.$u.timeFormat(createTime, 'yyyy-mm-dd');
  287. },
  288. onRegistClick() {
  289. authLogin(async (usr) => {
  290. this.show = true;
  291. this.$refs.uForm.clearValidate();
  292. });
  293. },
  294. toRegistClick() {
  295. if (this.queryParams.type == MEETING_TYPE.theme.value) {
  296. uni.$u.route({
  297. type: 'reLaunch',
  298. url: '/pages/tabbar/index/index',
  299. });
  300. }
  301. if (this.queryParams.type == MEETING_TYPE.conference.value) {
  302. uni.$u.route({
  303. type: 'navigateTo',
  304. url: '/pasb/pages/meeting-info/index',
  305. });
  306. }
  307. },
  308. },
  309. };
  310. </script>
  311. <style lang="scss" src="./index.scss" />;