mytheme.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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>
  13. <rich-text :content="content"></rich-text>
  14. <!-- <u-popup :show="show" :round="5" mode="bottom" :closeOnClickOverlay="true" :overlay="true" @close="popClose">-->
  15. <!-- <view class="pop-form-content">-->
  16. <!-- <RegistForm-->
  17. <!-- v-if="rules"-->
  18. <!-- :rules="rules"-->
  19. <!-- ref="registForm"-->
  20. <!-- @onSubmitHandle="onFormSubmit"-->
  21. <!-- :regist-info="model1.userInfo"-->
  22. <!-- >-->
  23. <!-- <template v-slot:footer>-->
  24. <!-- <view class="review-msg" v-if="REVIEW_STATUS.noPass.value === model1.userInfo.reviewState">-->
  25. <!-- 审核信息:{{ model1.userInfo.reviewMsg }}-->
  26. <!-- </view>-->
  27. <!-- </template>-->
  28. <!-- </RegistForm>-->
  29. <!-- </view>-->
  30. <!-- </u-popup>-->
  31. <!-- <view class="regist-btn">-->
  32. <!-- <u-button-->
  33. <!-- v-if="REVIEW_STATUS[model1.userInfo.reviewState]"-->
  34. <!-- :text="REVIEW_STATUS[model1.userInfo.reviewState].name"-->
  35. <!-- size="normal"-->
  36. <!-- type="primary"-->
  37. <!-- :disabled="REVIEW_STATUS.pass.value === model1.userInfo.reviewState"-->
  38. <!-- @click="onRegistClick"-->
  39. <!-- ></u-button>-->
  40. <!-- </view>-->
  41. </template>
  42. <view class="regist-btn" v-if="isEmpty">
  43. <u-button
  44. text="我要报名"
  45. size="normal"
  46. type="primary"
  47. throttle-time="500"
  48. @click="toRegistClick"
  49. ></u-button>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. import { fetchUsrThemeMeetingInfo, formCfg, putUsrRegist } from '@/common/api';
  55. import { CONTENT_TYPE, MEETING_TYPE, REVIEW_STATUS, USR_TYPE_LIST } from '@/common/EnumConst';
  56. import RegistForm from '@/components/RegistForm/index.vue';
  57. import RichText from '@/components/RichText/index.vue';
  58. import SingleDropList from '@/components/SingleDropList/index.vue';
  59. import { authLogin, getStorageObj, storageKey } from '@/util';
  60. const staticRules = {
  61. 'userInfo.email': {
  62. pattern: /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/,
  63. },
  64. };
  65. export default {
  66. name: 'content',
  67. computed: {
  68. REVIEW_STATUS() {
  69. return REVIEW_STATUS;
  70. },
  71. },
  72. components: {
  73. SingleDropList,
  74. RichText,
  75. RegistForm,
  76. },
  77. props: {},
  78. data() {
  79. return {
  80. CONTENT_TYPE,
  81. content: null,
  82. queryParams: {},
  83. title: '',
  84. date: '',
  85. contentType: '',
  86. show: false,
  87. isEmpty: false,
  88. id: '',
  89. USR_TYPE_LIST,
  90. loading: false,
  91. model1: {
  92. userInfo: {
  93. usrName: '',
  94. conferenceFlag: '1',
  95. },
  96. },
  97. rules: null,
  98. };
  99. },
  100. created() {
  101. },
  102. async onLoad(res) {
  103. // 登录返回之后的页面
  104. this.queryParams = getStorageObj(storageKey.regtheme);
  105. this.getUsrContent();
  106. const { msg } = await formCfg('theme_form_cfg');
  107. if (msg) {
  108. const cfgJson = JSON.parse(msg);
  109. Object.keys(staticRules).forEach(item => {
  110. if (!cfgJson[item]) {
  111. Object.assign(cfgJson[item], staticRules[item]);
  112. }
  113. });
  114. this.rules = cfgJson;
  115. }
  116. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  117. this.$refs.registForm?.setFormRules();
  118. },
  119. methods: {
  120. async onFormSubmit(usrInfo) {
  121. await putUsrRegist({
  122. ...usrInfo,
  123. contentId: this.id,
  124. }, this.queryParams.type);
  125. uni.showToast({
  126. mask: true,
  127. title: '报名完成',
  128. icon: 'success',
  129. });
  130. },
  131. popClose() {
  132. this.show = false;
  133. },
  134. async getUsrContent() {
  135. const {
  136. data,
  137. } = await fetchUsrThemeMeetingInfo({}, this.queryParams.type);
  138. if (!data) {
  139. this.isEmpty = true;
  140. return;
  141. }
  142. const {
  143. content: {
  144. title,
  145. content,
  146. createTime,
  147. id,
  148. contentType,
  149. },
  150. ...usrInfoApply
  151. } = data;
  152. this.content = content;
  153. this.title = title;
  154. this.contentType = contentType;
  155. this.model1 = {
  156. userInfo: { ...usrInfoApply },
  157. };
  158. this.id = id;
  159. uni.setNavigationBarTitle({
  160. title,
  161. });
  162. this.date = uni.$u.timeFormat(createTime, 'yyyy-mm-dd');
  163. },
  164. onRegistClick() {
  165. authLogin(async (usr) => {
  166. this.show = true;
  167. this.$refs.registForm?.clearValidate();
  168. });
  169. },
  170. toRegistClick() {
  171. uni.$u.route({
  172. type: 'navigateTo',
  173. url: '/pasb/pages/regist/index',
  174. });
  175. // if (this.queryParams.type == MEETING_TYPE.theme.value) {
  176. // uni.$u.route({
  177. // type: 'reLaunch',
  178. // url: '/pages/tabbar/index/index',
  179. // });
  180. // }
  181. // if (this.queryParams.type == MEETING_TYPE.conference.value) {
  182. // uni.$u.route({
  183. // type: 'navigateTo',
  184. // url: '/pasb/pages/meeting-info/index',
  185. // });
  186. // }
  187. },
  188. },
  189. };
  190. </script>
  191. <style lang="scss" src="./index.scss" />;