applyshare.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. title="全民分享"
  5. :placeholder="true"
  6. :autoBack="true"
  7. :safeAreaInsetTop="true"
  8. bgColor="#ED0000"
  9. :titleStyle="{color:'#fff'}"
  10. leftIconColor="#fff"
  11. >
  12. </u-navbar>
  13. <view class="title">
  14. 请填写您的报名信息
  15. </view>
  16. <view class="form-wrap">
  17. <u--form labelPosition="left" labelAlign="right" labelWidth="70px" :model="form" :rules="rules" ref="uForm" >
  18. <u-form-item label="姓名" prop="name" required ref="name" >
  19. <u--input
  20. v-model="form.name"
  21. border="none"
  22. placeholder="请输入您的真实姓名"
  23. :customStyle="inputCustomStyle"
  24. ></u--input>
  25. </u-form-item>
  26. <u-form-item label="联系电话" prop="mobile" required ref="mobile" >
  27. <u--input
  28. v-model="form.mobile"
  29. border="none"
  30. placeholder="请输入您的联系电话"
  31. :customStyle="inputCustomStyle"
  32. ></u--input>
  33. </u-form-item>
  34. <u-form-item label="职业" prop="careerName" required ref="careerName" >
  35. <u--input
  36. v-model="form.careerName"
  37. border="none"
  38. placeholder="请输入您的职业"
  39. :customStyle="inputCustomStyle"
  40. ></u--input>
  41. </u-form-item>
  42. <u-form-item label="销售路径 /渠道" prop="saleChannel" required ref="saleChannel" >
  43. <u--textarea
  44. count
  45. maxlength="200"
  46. v-model="form.saleChannel"
  47. border="none"
  48. placeholder="请描述您的销售剧目的渠道或路径"
  49. ></u--textarea>
  50. </u-form-item>
  51. </u--form>
  52. </view>
  53. <u-button
  54. @click="submit"
  55. text="确定"
  56. type="primary"
  57. shape="circle"
  58. :customStyle="{'margin':'60rpx 32rpx',height:'98rpx','box-sizing':'border-box',width:'auto'}"
  59. color="linear-gradient(90deg, #FF7979 0%, #ED0000 100%)">
  60. </u-button>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. backUrl:'',
  68. form:{
  69. name:'',
  70. mobile:'',
  71. careerName:'',
  72. saleChannel:''
  73. },
  74. rules: {
  75. name: {
  76. type: 'string',
  77. required: true,
  78. message: '请输入姓名',
  79. trigger: ['blur', 'change']
  80. },
  81. mobile: [
  82. {
  83. type: 'string',
  84. required: true,
  85. message: '请输入联系电话',
  86. trigger: ['blur', 'change']
  87. },
  88. {
  89. // 自定义验证函数,见上说明
  90. validator: (rule, value, callback) => {
  91. // 上面有说,返回true表示校验通过,返回false表示不通过
  92. // uni.$u.test.mobile()就是返回true或者false的
  93. return uni.$u.test.mobile(value);
  94. },
  95. message: '手机号码不正确',
  96. // 触发器可以同时用blur和change
  97. trigger: ['change','blur'],
  98. }
  99. ],
  100. careerName: [
  101. {
  102. type: 'string',
  103. required: true,
  104. message: '请输入您的职业',
  105. trigger: ['blur', 'change']
  106. }
  107. ],
  108. saleChannel: [
  109. {
  110. type: 'string',
  111. required: true,
  112. message: '请描述您的销售剧目的渠道或路径',
  113. trigger: ['blur', 'change']
  114. }
  115. ],
  116. },
  117. inputCustomStyle:{
  118. background:'#fff',
  119. 'padding-left':'30rpx',
  120. 'box-sizing':'border-box',
  121. }
  122. }
  123. },
  124. onShow() {
  125. },
  126. onReady() {
  127. this.$refs.uForm.setRules(this.rules)
  128. },
  129. onLoad(page) {
  130. this.backUrl = decodeURIComponent(page.backUrl)||'/center/center';
  131. },
  132. methods: {
  133. leftClick(){
  134. let pages = getCurrentPages();
  135. if(pages.length==1){
  136. uni.$u.route('/pages/index/index')
  137. }else{
  138. uni.navigateBack()
  139. };
  140. },
  141. chekPass(){
  142. console.log('chekPass---',this.form);
  143. return new Promise((resolve, reject)=>{
  144. if(!password){
  145. reject('needAuth');
  146. }
  147. })
  148. },
  149. async submit(){
  150. let that = this;
  151. // console.log('form',this.form);
  152. this.$refs.uForm.validate().then(res => {
  153. // let chekPassResult = await this.chekPass();
  154. // return
  155. // uni.$u.toast('校验通过')
  156. this.$u.api.applyshare(this.form).then(res=>{
  157. // console.log('res',res.data);
  158. uni.showToast({
  159. title:res.msg,
  160. icon:'success'
  161. })
  162. setTimeout(()=>{
  163. uni.$u.route('/center/applysharesuccess')
  164. // that.leftClick();
  165. },2000)
  166. // uni.reLaunch({url: this.backUrl});
  167. }).catch(err=>{
  168. console.log('login',err);
  169. })
  170. }).catch(errors => {
  171. uni.$u.toast('请正确填写表单')
  172. })
  173. },
  174. }
  175. }
  176. </script>
  177. <style>
  178. page{
  179. background-color: #F4F5F7;
  180. }
  181. </style>
  182. <style lang="scss" scoped>
  183. .title{
  184. font-size: 28rpx;
  185. font-weight: 400;
  186. color: #363636;
  187. line-height: 42rpx;
  188. margin: 44rpx 32rpx 0;
  189. }
  190. .form-wrap{
  191. margin: 30rpx 32rpx 40rpx;
  192. padding: 0 40rpx 20rpx;
  193. /deep/ .u-input__content__field-wrapper__field{
  194. height: 68rpx;
  195. }
  196. }
  197. </style>