mytheme.vue 8.6 KB

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