cooperation.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. title="合作加盟"
  5. :placeholder="true"
  6. :autoBack="true"
  7. :safeAreaInsetTop="true"
  8. >
  9. </u-navbar>
  10. <view class="page-bg">
  11. <img class="img" :src="staticUrl+'/img/cooperation-bg.png'" alt="">
  12. </view>
  13. <view class="page-wrap">
  14. <view class="video-wrap">
  15. <video
  16. id="video"
  17. :src="pageData.jiVideo"
  18. controls playsinline loop>
  19. </video>
  20. </view>
  21. <view class="u-content" style="margin-top: 20rpx;">
  22. <u-parse :content="pageData.jiIntro"></u-parse>
  23. </view>
  24. <!-- <view class="center-img" >
  25. <img :src="staticUrl+'/img/index-nav-3.png'" alt="">
  26. </view> -->
  27. <view class="form-wrap">
  28. <view class="form">
  29. <img :src="staticUrl+'/img/shopContact.png'" alt="">
  30. <view class="title">
  31. <text>免费咨询</text><text class="sub-title">Free consultation</text>
  32. </view>
  33. <u--form :model="form"
  34. labelPosition="top"
  35. labelWidth="200rpx"
  36. :labelStyle="{color:'#fff'}"
  37. ref="uForm">
  38. <u-form-item label="您的姓名" prop="name">
  39. <u-input v-model="form.name" shape="circle" color="#fff" placeholder="请输入您的姓名" />
  40. </u-form-item>
  41. <u-form-item label="您的电话" prop="mobile">
  42. <u-input v-model="form.mobile" shape="circle" color="#fff" placeholder="请输入您的电话" />
  43. </u-form-item>
  44. </u--form>
  45. </view>
  46. <view class="full-btn" @click="submit">提交咨询</view>
  47. <view class="tip">投资有风险 加盟需谨慎</view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. export default {
  54. data() {
  55. return {
  56. staticUrl:this.$commonConfig.staticUrl,
  57. pageData:{},
  58. form:{
  59. name:'',
  60. mobile:''
  61. },
  62. rules: {
  63. name:
  64. // 必填规则
  65. {
  66. required: true,
  67. message: '请输入您的姓名',
  68. // blur和change事件触发检验
  69. trigger: ['blur', 'change'],
  70. },
  71. // 字段名称
  72. mobile: [
  73. {
  74. required: true,
  75. message: '请输入您的电话',
  76. trigger: ['change','blur'],
  77. },
  78. {
  79. // 自定义验证函数,见上说明
  80. validator: (rule, value, callback) => {
  81. // 上面有说,返回true表示校验通过,返回false表示不通过
  82. // uni.$u.test.mobile()就是返回true或者false的
  83. return uni.$u.test.mobile(value);
  84. },
  85. message: '手机号码不正确',
  86. // 触发器可以同时用blur和change
  87. trigger: ['change','blur'],
  88. }
  89. ]
  90. }
  91. }
  92. },
  93. onReady() {
  94. //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
  95. this.$refs.uForm.setRules(this.rules)
  96. },
  97. onShow() {
  98. this.getIntro()
  99. },
  100. onLoad() {
  101. },
  102. methods: {
  103. getIntro(){
  104. this.$u.api.xsGetIntro().then(res=>{
  105. this.pageData = res.data;
  106. // console.log('res',res);
  107. }).catch(err=>{
  108. console.log('xsGetIntro',err);
  109. })
  110. },
  111. submit() {
  112. this.$refs.uForm.validate().then(res => {
  113. // uni.$u.toast('校验通过')
  114. // console.log('form',this.form);
  115. this.$u.api.shopContact(this.form).then(res=>{
  116. uni.showToast({
  117. title:'提交成功,工作人员将在3个工作日内联系您!',
  118. icon:'none',
  119. duration:5000
  120. });
  121. this.form={
  122. name:'',
  123. mobile:''
  124. };
  125. // uni.navigateBack()
  126. // console.log('res',res.msg);
  127. }).catch(err=>{
  128. console.log('shopContact',err);
  129. })
  130. }).catch(errors => {
  131. uni.$u.toast('请正确填写表单')
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .video-wrap{
  139. overflow: hidden;
  140. border-radius: 20rpx;
  141. text-align: center;
  142. margin-bottom: 50rpx;
  143. #video{
  144. width: 100%;
  145. }
  146. }
  147. .center-img{
  148. text-align: center;
  149. margin-bottom: 40rpx;
  150. }
  151. .form-wrap{
  152. margin-top: 20rpx;
  153. .form{
  154. position: relative;
  155. min-height: 390rpx;
  156. box-sizing: border-box;
  157. padding: 40rpx;
  158. color: #fff;
  159. margin-bottom: 40rpx;
  160. img{
  161. position: absolute;
  162. left: 0;
  163. right: 0;
  164. top: 0;
  165. bottom: 0;
  166. width: 100%;
  167. height: 100%;
  168. z-index: -1;
  169. }
  170. .title{
  171. font-size: 36rpx;
  172. font-weight: 600;
  173. color: rgba(255,255,255,0.99);
  174. line-height: 50rpx;
  175. margin-bottom: 16rpx;
  176. .sub-title{
  177. margin-left: 16rpx;
  178. font-size: 24rpx;
  179. font-weight: 400;
  180. color: rgba(255,255,255,0.5);
  181. line-height: 33rpx;
  182. text-transform: uppercase
  183. }
  184. }
  185. }
  186. .full-btn{
  187. background-color: #FFB100;
  188. margin-bottom: 37rpx;
  189. }
  190. .tip{
  191. font-size: 30rpx;
  192. font-weight: 400;
  193. color: rgba(51,51,51,0.99);
  194. line-height: 42rpx;
  195. padding-bottom: 60rpx;
  196. text-align: center;
  197. }
  198. }
  199. </style>