applyTrial.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <view class="applyTrial-container container">
  3. <view class="tip">请上传您的名片信息,以便工作人员更好地为您服务</view>
  4. <view class="apply-top">
  5. <view class="add_icon upload-ico" v-if="!fileList.length" @click="ChooseFile">
  6. <u-icon name="plus" color="#9C9C9C" size="48"></u-icon>
  7. <text class="add-tip">上传图片</text>
  8. </view>
  9. <view class="add_icon" v-for="(item, index) in fileList" :key="item" v-else>
  10. <image class="img" :src="item" @click="viewImage(item, fileList)"> </image>
  11. <icon type="clear" size="16" class="del-ico" color="#f00" @click.stop="delImg(index)" />
  12. </view>
  13. <view class="card_default_cont">
  14. <image :src="img" mode="" class="card_default" @click="viewImage(img, img.split())"></image>
  15. <text class="tip">名片示例</text>
  16. </view>
  17. </view>
  18. <view class="apply-info-cont">
  19. <view class="ipt-item">
  20. <label class="item-label">姓名</label>
  21. <input type="text" v-model="name" class="ipt" placeholder="请输入姓名" />
  22. </view>
  23. <view class="ipt-item">
  24. <label class="item-label">公司名</label>
  25. <input type="text" v-model="company" class="ipt" placeholder="请输入公司名" />
  26. </view>
  27. <view class="ipt-item">
  28. <label class="item-label">手机号</label>
  29. <input type="number" v-model="mobile" class="ipt" maxlength="11" disabled />
  30. </view>
  31. <view class="btn-cont" @click="applyHandle"> 提交 </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import { uploadurl, Mine, User } from "@/config/api.js";
  37. export default {
  38. data() {
  39. return {
  40. action: "",
  41. name: "",
  42. mobile: "",
  43. company: "",
  44. img: "https://hongze.oss-accelerate.aliyuncs.com/static/images/202102/20210219/gYD8azAtSeVzL8ZMbAu9mCyCxcTF.png",
  45. fileList: [], //名片列表
  46. tryType:'',
  47. detailId:0
  48. };
  49. },
  50. onLoad(op) {
  51. if (this.$db.get("mobile")) {
  52. this.mobile = this.$db.get("mobile");
  53. } else {
  54. this.getPhone();
  55. }
  56. this.tryType= op.tryType || ''
  57. this.detailId = op.detailId || 0
  58. },
  59. methods: {
  60. /* 获取手机号 */
  61. getPhone() {
  62. Mine.getInfo().then((res) => {
  63. if (res.Ret === 200) {
  64. this.mobile = res.Data.Mobile;
  65. res.Data.Mobile && this.$db.set("mobile", res.Data.Mobile);
  66. }
  67. });
  68. },
  69. /* 上传图片 */
  70. ChooseFile() {
  71. this.$util.upload.Single(uploadurl, (res) => {
  72. //console.log(res)
  73. let data = JSON.parse(res.data);
  74. if (data.Ret === 200) {
  75. this.fileList = data.Data.ResourceUrl.split();
  76. }
  77. });
  78. },
  79. /* 提交 */
  80. applyHandle() {
  81. if (this.name && this.company && this.fileList.length) {
  82. User.applyTry({
  83. ApplyMethod: 2,
  84. BusinessCardUrl: this.fileList.join(","),
  85. CompanyName: this.company,
  86. RealName: this.name,
  87. TryType : this.tryType,
  88. DetailId: this.detailId > 0 ? Number(this.detailId) : 0,
  89. }).then((res) => {
  90. if (res.Ret === 200) {
  91. uni.redirectTo({
  92. url: "/pageMy/applyResult/applyResult",
  93. });
  94. }
  95. });
  96. } else {
  97. this.$util.toast(`请${!this.fileList.length ? "上传名片" : !this.name ? "输入姓名" : !this.company ? "输入公司名" : ""}`);
  98. }
  99. },
  100. //预览图片
  101. viewImage(path, imgList) {
  102. uni.previewImage({
  103. current: path, // 当前显示图片的http链接
  104. urls: imgList, // 需要预览的图片http链接列表
  105. });
  106. },
  107. // 删除图片
  108. delImg(index) {
  109. uni.showModal({
  110. title: "",
  111. content: "确定要删除图片吗 ?",
  112. success: (res) => {
  113. if (res.confirm) {
  114. this.fileList.splice(index, 1);
  115. }
  116. },
  117. });
  118. },
  119. },
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. .applyTrial-container {
  124. background-color: #fff;
  125. .tip {
  126. padding: 11rpx 32rpx;
  127. background: #f7f7f7;
  128. color: #b2b2b2;
  129. font-size: 24rpx;
  130. }
  131. .apply-top {
  132. padding: 30rpx 32rpx;
  133. display: flex;
  134. justify-content: space-between;
  135. align-items: center;
  136. .add_icon {
  137. width: 330rpx;
  138. height: 200rpx;
  139. position: relative;
  140. .del-ico {
  141. position: absolute;
  142. right: 20rpx;
  143. top: 20rpx;
  144. }
  145. .img {
  146. width: 330rpx;
  147. height: 200rpx;
  148. }
  149. &.upload-ico {
  150. padding-top: 50rpx;
  151. text-align: center;
  152. background-color: #f7f7f7;
  153. color: #4a4a4a;
  154. .add-tip {
  155. margin-top: 10rpx;
  156. }
  157. }
  158. }
  159. .card_default_cont {
  160. position: relative;
  161. .card_default {
  162. width: 330rpx;
  163. height: 200rpx;
  164. display: block;
  165. }
  166. .tip {
  167. background-color: rgba($color: #000000, $alpha: 0.5);
  168. border-radius: 8rpx;
  169. padding: 12rpx 22rpx;
  170. color: #fff;
  171. font-size: 24rpx;
  172. position: absolute;
  173. right: 0;
  174. bottom: 0;
  175. z-index: 1;
  176. }
  177. }
  178. }
  179. .apply-info-cont {
  180. border-top: 10rpx solid #f7f7f7;
  181. .ipt-item {
  182. padding: 33rpx 32rpx;
  183. border-bottom: 1rpx solid #e5e5e5;
  184. display: flex;
  185. align-items: center;
  186. font-size: 34rpx;
  187. .item-label {
  188. text-align: justify;
  189. text-align-last: justify;
  190. display: inline-block;
  191. width: 106rpx;
  192. margin-right: 40rpx;
  193. }
  194. .ipt {
  195. width: 500rpx;
  196. font-size: 32rpx;
  197. color: #666;
  198. }
  199. }
  200. .btn-cont {
  201. width: 368rpx;
  202. height: 80rpx;
  203. background: linear-gradient(268deg, #2ddbff 0%, #1599ff 49%, #005eff 100%);
  204. color: #fff;
  205. font-size: 34rpx;
  206. margin: 120rpx auto 0;
  207. text-align: center;
  208. line-height: 80rpx;
  209. .btn_bg {
  210. width: 100%;
  211. height: 80rpx;
  212. position: absolute;
  213. left: 0;
  214. top: 0;
  215. }
  216. .btn-txt {
  217. width: 100%;
  218. position: absolute;
  219. z-index: 1;
  220. }
  221. }
  222. }
  223. }
  224. </style>