workerform.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view>
  3. <image class="echo-workerformpic" mode="widthFix" :src="param.workerformpic"></image>
  4. <view class="padding-xl"></view>
  5. <view class="cu-bar bg-white tabbar border shop foot">
  6. <view class="btn-group">
  7. <button class="cu-btn bg-red round shadow-blur" @tap="tabModal" style="width: 80%;">工厂招聘信息</button>
  8. </view>
  9. </view>
  10. <view class="cu-modal" :class="showform">
  11. <view class="cu-dialog">
  12. <view class="cu-bar bg-white justify-end">
  13. <view class="content">信息内容</view>
  14. <view class="action" @tap="tabModal">
  15. <text class="cuIcon-close text-red"></text>
  16. </view>
  17. </view>
  18. <view class="bg-white margin-top-xs echo-workerform">
  19. <form>
  20. <view class="cu-form-group">
  21. <view class="title">企业名称</view>
  22. <input placeholder="请输入..." @input="bindInput" data-val="comname" :value="forminfo.comname"></input>
  23. </view>
  24. <view class="cu-form-group">
  25. <view class="title">企业住址</view>
  26. <input placeholder="请输入..." @input="bindInput" data-val="address" :value="forminfo.address"></input>
  27. </view>
  28. <view class="cu-form-group align-start">
  29. <view class="title">企业简介</view>
  30. <textarea maxlength="-1" placeholder="请输入..." data-val="details" name="details" :value="forminfo.details"
  31. @input="bindInput"></textarea>
  32. </view>
  33. <view class="cu-form-group align-start">
  34. <view class="title">招聘岗位</view>
  35. <textarea maxlength="-1" placeholder="请输入..." data-val="comjobs" name="comjobs" :value="forminfo.comjobs"
  36. @input="bindInput"></textarea>
  37. </view>
  38. <view class="cu-form-group">
  39. <view class="title">姓名</view>
  40. <input placeholder="请输入..." @input="bindInput" data-val="realname" :value="forminfo.realname"></input>
  41. </view>
  42. <view class="cu-form-group solids-bottom">
  43. <view class="title">手机号</view>
  44. <input placeholder="请输入..." @input="bindInput" data-val="mobile" :value="forminfo.mobile"></input>
  45. </view>
  46. <view class="padding-lr padding-top flex flex-direction">
  47. <button class="cu-btn bg-orange margin-tb-sm lg" @tap="addWorker">确认提交</button>
  48. </view>
  49. </form>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </template>
  55. <script>
  56. var _this;
  57. export default {
  58. data() {
  59. return {
  60. userinfo: false,
  61. workerinfo: false,
  62. showform: '',
  63. param: {},
  64. isRotate: false,
  65. forminfo: {
  66. comname: "",
  67. address: "",
  68. details: "",
  69. realname: "",
  70. mobile: "",
  71. comjobs: ""
  72. }
  73. };
  74. },
  75. onLoad: function(){
  76. _this = this;
  77. _this.userinfo = _this.checkLogin("/pages/my/my");
  78. _this.workerinfo = uni.getStorageSync('workerinfo') || false;
  79. if (_this.userinfo === false || _this.workerinfo === false) {
  80. uni.reLaunch({
  81. url: "/pages/my/my"
  82. });
  83. return false;
  84. }
  85. _this.$req.ajax({
  86. path: "worker/pageform",
  87. data: {}
  88. }).then((data) => {
  89. _this.param = data.param;
  90. }).catch((err) => {
  91. uni.showModal({
  92. title: '信息提示',
  93. content: err,
  94. showCancel: false
  95. });
  96. });
  97. },
  98. methods: {
  99. addWorker: function() {
  100. if(_this.isRotate){
  101. return false;
  102. }
  103. _this.isRotate = true;
  104. _this.$req.ajax({
  105. path: "worker/addworker",
  106. data: {
  107. workerid: _this.workerinfo.id,
  108. comname: _this.forminfo.comname,
  109. address: _this.forminfo.address,
  110. details: _this.forminfo.details,
  111. realname: _this.forminfo.realname,
  112. mobile: _this.forminfo.mobile,
  113. comjobs: _this.forminfo.comjobs
  114. }
  115. }).then((data) => {
  116. uni.showModal({
  117. title: '信息提示',
  118. content: "信息提交成功。",
  119. showCancel: false,
  120. success: function(res) {
  121. if (res.confirm) {
  122. _this.forminfo = {
  123. comname: "",
  124. address: "",
  125. details: "",
  126. realname: "",
  127. mobile: "",
  128. comjobs: ""
  129. };
  130. _this.tabModal();
  131. }
  132. }
  133. });
  134. _this.isRotate = false;
  135. }).catch((err) => {
  136. uni.showModal({
  137. title: '信息提示',
  138. content: err,
  139. showCancel: false
  140. });
  141. _this.isRotate = false;
  142. });
  143. },
  144. bindInput: function(e) {
  145. var dataval = e.currentTarget.dataset.val;
  146. _this.forminfo[dataval] = e.detail.value;
  147. },
  148. tabModal: function() {
  149. _this.showform = _this.showform=="show" ? "" : "show";
  150. }
  151. }
  152. }
  153. </script>
  154. <style>
  155. .echo-workerformpic{ width: 100%; display: block; }
  156. .echo-workerform view.title{ text-align: left !important; width: 25%; }
  157. .echo-workerform input{ text-align: left !important; width: 75%; }
  158. .echo-workerform textarea{ text-align: left !important; width: 75%; }
  159. </style>