cooperation.vue 4.5 KB

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