index.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view>
  3. <view class="hehuo_view" v-if="XCXIsSelect == '是'">
  4. <image src="https://mxys.chuanghai-tech.com/wmfile/20260413/82f8fa0d183f4bd3bfdab908ae8247d2.png"></image>
  5. <view class="text_view">
  6. <view class="item_view">
  7. <view class="item_title">意向代理城市</view>
  8. <input @click="goCity" type="text" disabled v-model="city" placeholder="请输入代理城市" />
  9. <view class="xian"></view>
  10. </view>
  11. <view class="item_view">
  12. <view class="item_title">姓名</view>
  13. <input type="text" v-model="userName" placeholder="请输入姓名" />
  14. <view class="xian"></view>
  15. </view>
  16. <view class="item_view">
  17. <view class="item_title">联系电话</view>
  18. <input type="number" v-model="phone" maxlength="11" placeholder="请输入联系电话" />
  19. <view class="xian"></view>
  20. </view>
  21. <view class="item_view">
  22. <view class="item_title">年龄</view>
  23. <input type="number" v-model="age" maxlength="11" placeholder="请输入年龄" />
  24. <view class="xian"></view>
  25. </view>
  26. <view class="item_view">
  27. <view class="item_title">头像上传</view>
  28. <view class="flex" style="overflow: hidden; flex-direction: initial">
  29. <view v-if="headImg.length">
  30. <view class="margin-top flex margin-right-sm">
  31. <view class="flex" style="width: 150upx; height: 150upx; margin-right: 10rpx; position: relative">
  32. <image :src="headImg" style="width: 100%; height: 100%"></image>
  33. <view style="z-index: 9; position: absolute; top: -15rpx; right: -15rpx" @click="headImgremove(index)">
  34. <u-icon name="close-circle-fill" color="#2979ff" size="50rpx"></u-icon>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="margin-top" @click="addImage()" v-if="headImg.length <= 0">
  40. <view style="width: 150upx; height: 150upx; background: #f5f5f5" class="flex justify-center align-center">
  41. <view>
  42. <view class="text-center">
  43. <image src="../../static/images/my/add.png" style="width: 54upx; height: 47upx; position: relative"></image>
  44. </view>
  45. <view class="text-center text-xs margin-top-xs">上传图片</view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- <view class="audit_message" v-if="auditContent != '' && bb == 3">拒绝原因:{{auditContent}}</view> -->
  52. <view class="save_btn" @tap="save" v-if="bb != 0">提交申请</view>
  53. <!-- <view class="save_btn" v-if="status == 0">审核中</view> -->
  54. </view>
  55. </view>
  56. <!-- 用于图片压缩的canvas画布 -->
  57. <canvas
  58. :style="{
  59. width: cw + 'px',
  60. height: cw + 'px',
  61. position: 'absolute',
  62. zIndex: -1,
  63. left: '-10000rpx',
  64. top: '-10000rpx'
  65. }"
  66. canvas-id="zipCanvas"
  67. ></canvas>
  68. <!--画布结束-->
  69. </view>
  70. </template>
  71. <script>
  72. import configdata from '@/common/config.js'
  73. import getLessLimitSizeImage from '@/utils/imageCompress.js'
  74. export default {
  75. data() {
  76. return {
  77. hotCitys: ['杭州', '天津', '北京', '上海', '深圳', '广州', '成都', '重庆', '厦门'],
  78. locationValue: '正在定位...',
  79. // auditContent: '',
  80. city: '',
  81. money: '',
  82. teamNumber: '',
  83. userName: '',
  84. phone: '',
  85. age: '',
  86. headImg: [],
  87. bb: true,
  88. XCXIsSelect: '是',
  89. //画板边长默认是屏幕宽度,正方形画布
  90. cw: uni.getSystemInfoSync().windowWidth
  91. }
  92. },
  93. onLoad() {
  94. this.XCXIsSelect = this.$queue.getData('XCXIsSelect')
  95. if (this.XCXIsSelect == '否') {
  96. uni.setNavigationBarTitle({
  97. title: '隐私政策'
  98. })
  99. } else {
  100. uni.setNavigationBarTitle({
  101. title: '骑手招募'
  102. })
  103. }
  104. this.getChannel()
  105. },
  106. methods: {
  107. // 头像删除
  108. headImgremove(index) {
  109. this.headImg = ''
  110. },
  111. getChannel() {
  112. let userId = this.$queue.getData('userId')
  113. let data = {
  114. userId: userId
  115. }
  116. this.$Request.getT('/app/artificer/selectAgencyById', data).then((res) => {
  117. if (res.code == 0) {
  118. if (res.data == null) {
  119. this.bb = 1
  120. } else {
  121. this.bb = res.data.status
  122. this.city = res.data.city
  123. this.age = res.data.age
  124. this.headImg = res.data.img
  125. this.userName = res.data.name
  126. this.phone = res.data.phone
  127. }
  128. console.log(this.bb)
  129. // this.auditContent = res.data.auditContent;
  130. }
  131. })
  132. },
  133. //获取省市区
  134. Getcity(latitude, longitude) {
  135. this.$Request
  136. .get('/app/Login/selectCity', {
  137. lat: latitude,
  138. lng: longitude
  139. })
  140. .then((res) => {
  141. console.log(res)
  142. this.city = res.data.city
  143. console.log(this.address)
  144. })
  145. },
  146. goCity() {
  147. let that = this
  148. uni.chooseLocation({
  149. success: function (res) {
  150. console.log('位置名称:' + res.name)
  151. console.log('详细地址:' + res.address)
  152. console.log('纬度:' + res.latitude)
  153. console.log('经度:' + res.longitude)
  154. // that.city = res.address || '郑州'
  155. that.Getcity(res.latitude, res.longitude)
  156. }
  157. })
  158. // uni.getLocation({
  159. // type: 'gcj02',
  160. // geocode: true,
  161. // success: function(res) {
  162. // console.log('当前位置:' + res.address.city);
  163. // that.city = res.address.city || '郑州'
  164. // }
  165. // });
  166. },
  167. save() {
  168. // let isStudent = this.$queue.getData("isStudent");
  169. // if (isStudent != 2) {
  170. // uni.showModal({
  171. // title: '温馨提示',
  172. // content: '您还没有进行实名认证,请认证完成之后再来操作吧!',
  173. // showCancel: true,
  174. // cancelText: '取消',
  175. // confirmText: '确认',
  176. // success: res => {
  177. // if (res.confirm) {
  178. // uni.navigateTo({
  179. // url: '/offlinetask/pages/public/authentication'
  180. // });
  181. // }
  182. // }
  183. // });
  184. // return;
  185. // }
  186. // this.form.headImg = this.headImg
  187. // this.headImg = this.headImg.toString();
  188. if (this.city === '') {
  189. this.$queue.showToast('请输入代理城市')
  190. return
  191. }
  192. if (this.userName === '') {
  193. this.$queue.showToast('请输入姓名')
  194. return
  195. }
  196. if (this.phone === '' || this.phone.length != 11) {
  197. this.$queue.showToast('请输入正确的手机号!')
  198. return
  199. }
  200. if (this.age === '') {
  201. this.$queue.showToast('请输入年龄')
  202. return
  203. }
  204. if (this.headImg == '') {
  205. this.$queue.showToast('请上传头像')
  206. return
  207. }
  208. let userId = this.$queue.getData('userId')
  209. let data = {
  210. userId: userId,
  211. name: this.userName,
  212. phone: this.phone,
  213. age: this.age,
  214. city: this.city,
  215. img: this.headImg
  216. }
  217. this.$Request.postJson('/app/artificer/insertAgency', data).then((res) => {
  218. if (res.code == 0) {
  219. uni.hideLoading()
  220. this.$queue.showToast('提交成功!')
  221. setTimeout((d) => {
  222. uni.navigateBack()
  223. }, 1000)
  224. } else {
  225. uni.hideLoading()
  226. this.$queue.showToast(res.msg)
  227. }
  228. })
  229. },
  230. addImage() {
  231. let that = this
  232. uni.chooseImage({
  233. count: 1,
  234. sourceType: ['album', 'camera'],
  235. success: (res) => {
  236. for (let i = 0; i < 1; i++) {
  237. //这里的id和页面中写的html代码的canvas的id要一致
  238. let canvasId = 'zipCanvas'
  239. //原图的路径
  240. let imagePath = res.tempFiles[i].path
  241. //大小限制
  242. let limitSize = 1024 * 2
  243. //初始绘画区域是画布自身的宽度也就是屏幕宽度
  244. let drawWidth = uni.getSystemInfoSync().windowWidth
  245. let that = this
  246. let token = uni.getStorageSync('token')
  247. getLessLimitSizeImage(canvasId, imagePath, limitSize, drawWidth, that, (resPath) => {
  248. uni.showLoading({
  249. title: '上传中'
  250. })
  251. uni.uploadFile({
  252. url: that.config('APIHOST1') + '/app/new-file/upload',
  253. filePath: resPath,
  254. header: {
  255. token: token
  256. },
  257. name: 'file',
  258. success: (uploadFileRes) => {
  259. console.log(uploadFileRes.data)
  260. that.headImg = JSON.parse(uploadFileRes.data).data
  261. console.log(that.headImg)
  262. uni.hideLoading()
  263. },
  264. fail: () => {
  265. uni.showToast({
  266. title: '上传失败',
  267. icon: 'error'
  268. })
  269. }
  270. })
  271. })
  272. }
  273. }
  274. })
  275. },
  276. config: function (name) {
  277. var info = null
  278. if (name) {
  279. var name2 = name.split('.') //字符分割
  280. if (name2.length > 1) {
  281. info = configdata[name2[0]][name2[1]] || null
  282. } else {
  283. info = configdata[name] || null
  284. }
  285. if (info == null) {
  286. let web_config = cache.get('web_config')
  287. if (web_config) {
  288. if (name2.length > 1) {
  289. info = web_config[name2[0]][name2[1]] || null
  290. } else {
  291. info = web_config[name] || null
  292. }
  293. }
  294. }
  295. }
  296. return info
  297. }
  298. }
  299. }
  300. </script>
  301. <style lang="less">
  302. // @import '../../static/less/index.less';
  303. // @import '../../static/css/index.css';
  304. .hehuo_view {
  305. width: 750rpx;
  306. height: 1830upx;
  307. image {
  308. width: 750rpx;
  309. height: 1830upx;
  310. background-size: 100%;
  311. position: absolute;
  312. }
  313. .text_view {
  314. position: absolute;
  315. z-index: 1;
  316. width: 84%;
  317. margin: 660rpx 50rpx 30rpx;
  318. .audit_message {
  319. color: red;
  320. width: 650rpx;
  321. height: 50rpx;
  322. margin-top: 50rpx;
  323. }
  324. .save_btn {
  325. width: 650rpx;
  326. height: 88rpx;
  327. background: #ffffff;
  328. border-radius: 10rpx;
  329. text-align: center;
  330. line-height: 88rpx;
  331. /* #ifdef MP-WEIXIN */
  332. margin-top: 150rpx;
  333. /* #endif */
  334. /* #ifdef H5 */
  335. margin-top: 100rpx;
  336. /* #endif */
  337. /* #ifdef APP-PLUS */
  338. margin-top: 180rpx;
  339. /* #endif */
  340. }
  341. .save_btn1 {
  342. width: 650rpx;
  343. height: 88rpx;
  344. background: #ffffff;
  345. border-radius: 10rpx;
  346. margin-top: 100rpx;
  347. text-align: center;
  348. line-height: 88rpx;
  349. }
  350. .item_view {
  351. margin-top: 30rpx;
  352. .item_title {
  353. font-size: 28rpx;
  354. font-family: PingFang SC Heavy, PingFang SC Heavy-Heavy;
  355. font-weight: 800;
  356. color: #333333;
  357. }
  358. input {
  359. margin-top: 20rpx;
  360. height: 40rpx;
  361. font-size: 24rpx;
  362. font-family: PingFang SC Regular, PingFang SC Regular-Regular;
  363. font-weight: 400;
  364. color: #333333;
  365. }
  366. .xian {
  367. width: 630rpx;
  368. height: 1rpx;
  369. border: 1rpx solid #77d7b0;
  370. margin-top: 10rpx;
  371. }
  372. }
  373. }
  374. }
  375. </style>