bindinfo.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view class="home">
  7. <view style="margin: 0 20rpx;">
  8. <uni-forms :value="formData" ref="form" :rules="rules" validate-trigger="bind"
  9. err-show-type="undertext">
  10. <view class="title">
  11. <p>个人资料</p>
  12. </view>
  13. <uni-forms-item name="age" label="年龄区间">
  14. <picker @change="bindPickerChange" :value="index" :range="array"
  15. range-key="age_bracket_discribe">
  16. <view>{{ Xage }}</view>
  17. </picker>
  18. </uni-forms-item>
  19. <uni-forms-item name="skintype" label="国籍">
  20. <picker @change="bindPickerChange1" :value="index1" :range="array1" range-key="name">
  21. <view>{{ array1[index1].name }}</view>
  22. </picker>
  23. </uni-forms-item>
  24. <uni-forms-item name="vregion" label="探店地区">
  25. <picker class="picker" mode="multiSelector" :range="region" range-key="name"
  26. :value="regionIndex" @change="pickerChange" @columnchange="pickerColumnchange">
  27. <view class="pbox" :class="{'pbox_hover':regionStr != '请选择省市区'}">
  28. <view>{{regionStr}}</view>
  29. <text class="iconfont icon-you"></text>
  30. </view>
  31. </picker>
  32. </uni-forms-item>
  33. <uni-forms-item name="phone" required label="联系电话">
  34. <uni-easyinput type="number" maxlength="11" :inputBorder="true" v-model="formData.phone"
  35. placeholder="请输入联系电话">
  36. </uni-easyinput>
  37. </uni-forms-item>
  38. <view class="line"></view>
  39. <view class="title">
  40. <p>收货地址</p>
  41. </view>
  42. <uni-forms-item name="name" required label="收件人">
  43. <uni-easyinput type="text" :inputBorder="true" v-model="formData.name" placeholder="请输入收件人">
  44. </uni-easyinput>
  45. </uni-forms-item>
  46. <uni-forms-item name="tel" required label="联系电话">
  47. <uni-easyinput type="number" maxlength="11" :inputBorder="true" v-model="formData.tel"
  48. placeholder="请输入联系电话">
  49. </uni-easyinput>
  50. </uni-forms-item>
  51. <uni-forms-item name="fregion" required label="所在地区">
  52. <picker class="picker" mode="multiSelector" :range="region" range-key="name"
  53. :value="regionIndex1" @change="pickerChange1" @columnchange="pickerColumnchange1">
  54. <view class="pbox" :class="{'pbox_hover':regionStr1 != '请选择省市区'}">
  55. <view>{{regionStr1}}</view>
  56. <text class="iconfont icon-you"></text>
  57. </view>
  58. </picker>
  59. </uni-forms-item>
  60. <uni-forms-item name="detailregion" required label="详细地址">
  61. <uni-easyinput type="text" :inputBorder="true" v-model="formData.detailregion"
  62. placeholder="请输入详细地址(省/市/县/镇/)">
  63. </uni-easyinput>
  64. </uni-forms-item>
  65. <view class="setdeault">
  66. <view class="setdeault-text">设为默认收货地址</view>
  67. <switch style='zoom:.8;' @change="setDefault" />
  68. </view>
  69. <view class="line"></view>
  70. <view class="title">
  71. <p>{{platform.platform_name}}账号</p>
  72. </view>
  73. <uni-forms-item name="nickname" required label="昵称">
  74. <uni-easyinput type="text" v-model="formData.platform_nickname" style="width:300rpx"
  75. placeholder="请填写账号昵称">
  76. </uni-easyinput>
  77. </uni-forms-item>
  78. <uni-forms-item name="numberfans" required label="粉丝数">
  79. <view class="number-inupt">
  80. <uni-easyinput type="number" v-model="fansCount" placeholder="请填写粉丝数量"
  81. v-if="fansCountInfo === 1" style="width:300rpx" @input="onInput1">
  82. </uni-easyinput>
  83. <uni-easyinput type="digit" v-model="fansCount" style="width:300rpx" placeholder="请填写粉丝数量"
  84. v-else @input="onInput">
  85. </uni-easyinput>
  86. <picker @change="bindPickerChange2" :value="index3" :range="fansRange" range-key="label"
  87. style="z-index: 999;background-color: #fcdf41;padding: 0 10rpx;border-radius: 5rpx;">
  88. <view>{{ fansLabel }}</view>
  89. </picker>
  90. </view>
  91. <!-- <view style="font-size: 24rpx;padding-left: 10px;" @click="hasClicked = true" v-else>
  92. <p>点选数字单位</p>
  93. </view> -->
  94. </uni-forms-item>
  95. <uni-forms-item name="home_link" required label=" " label-width='10'>
  96. <uni-easyinput class="home-link" type="text" v-model="formData.home_page_url"
  97. style="width:650rpx" placeholder="请填写个人主页链接">
  98. </uni-easyinput>
  99. </uni-forms-item>
  100. <view style="margin-top: 40rpx;">
  101. <uni-forms-item name="home_img" required label="主页截图">
  102. <htz-image-upload :max="1" mediaType="image" name="file" :chooseNum="1" v-model="imageData"
  103. @chooseSuccess="ceshiChooseSuccess">
  104. </htz-image-upload>
  105. </uni-forms-item>
  106. </view>
  107. </uni-forms>
  108. </view>
  109. </view>
  110. <button class="btn1" @click="submitForm('form')">保存</button>
  111. </view>
  112. </template>
  113. <script>
  114. import region from '@/components/pca-code.json';
  115. import mvBar from "@/components/mys_navBar/mysNavBar";
  116. import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue';
  117. import getPolicyEncode from '@/components/obs/getPolicy.js';
  118. import getSignature from '@/components/obs/GetSignature.js';
  119. export default {
  120. components: {
  121. mvBar,
  122. htzImageUpload,
  123. },
  124. data() {
  125. return {
  126. navH: getApp().globalData.navHeight,
  127. hasClicked: false,
  128. address: [],
  129. accountId: '',
  130. platform: {
  131. platform_id: '',
  132. platform_name: '',
  133. platform_icon: '',
  134. },
  135. isBind: true,
  136. imageData: [],
  137. ismodify: '',
  138. // 原数组
  139. oldRegion: region,
  140. // 处理后的数组
  141. region: [
  142. [],
  143. [],
  144. []
  145. ],
  146. // 选择省市区的下标Index 传则默认选中传递的
  147. regionIndex: [0, 0, 0],
  148. regionIndex1: [0, 0, 0],
  149. // 省市区字符串
  150. regionStr: '请选择省市区',
  151. regionStr1: '请选择省市区',
  152. formData: {
  153. age: '',
  154. nationality: '',
  155. phone: '',
  156. visitStoreRegion: '',
  157. name: '',
  158. tel: '',
  159. detailregion: '',
  160. fregion: '',
  161. setdefault: false,
  162. platform_nickname: '',
  163. fans_count: '',
  164. home_page_url: '',
  165. },
  166. index3: 0,
  167. fansLabel: "选择单位",
  168. fansCount: null,
  169. fansCountInfo: 1,
  170. fansRange: [{
  171. value: 1,
  172. label: '个'
  173. },
  174. {
  175. value: 10000,
  176. label: '万'
  177. },
  178. {
  179. value: 100000000,
  180. label: '亿'
  181. }
  182. ],
  183. index: 0,
  184. index1: 0,
  185. Xage: '请选择',
  186. Xskintype: '请选择',
  187. array: [{
  188. age_bracket_discribe: '请选择',
  189. age_aid: 0
  190. }, {
  191. age_bracket_discribe: '0~18',
  192. age_aid: 1
  193. }, {
  194. age_bracket_discribe: '18~25',
  195. age_aid: 2
  196. }, {
  197. age_bracket_discribe: '26~30',
  198. age_aid: 3
  199. }, {
  200. age_bracket_discribe: '30~40',
  201. age_aid: 4
  202. }, {
  203. age_bracket_discribe: '40+',
  204. age_aid: 5
  205. }],
  206. array1: [{
  207. name: '请选择',
  208. id: 0
  209. }, {
  210. name: '中国',
  211. id: 1
  212. }, {
  213. name: '外国',
  214. id: 2
  215. }],
  216. data: {},
  217. show: false,
  218. mysNavConfig: {
  219. /* 开启单页显示首页图标 */
  220. isHome: true,
  221. /* 固定导航 */
  222. navFixed: true,
  223. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  224. navTitle: {
  225. text: "个人信息",
  226. color: "",
  227. fontSize: "32rpx", // px upx rpx
  228. fontWeight: "normal", // 100 - 700
  229. },
  230. btnType: "type2",
  231. onLeftClick: '',
  232. /* type2 按钮 */
  233. type2Config: {
  234. // 左图标
  235. leftPath: "/static/img/png2.png",
  236. // 右图标
  237. rightPath: "/static/img/png4.png",
  238. // 圆角
  239. radius: "40rpx",
  240. },
  241. },
  242. rules: {
  243. home_img: {
  244. rules: [{
  245. required: true,
  246. errorMessage: '请上传主页截图'
  247. }, ]
  248. },
  249. home_link: {
  250. rules: [{
  251. required: true,
  252. errorMessage: '请输入主页链接'
  253. }, ]
  254. },
  255. numberfans: {
  256. rules: [{
  257. required: true,
  258. errorMessage: '请输入粉丝量'
  259. }, ]
  260. },
  261. nickname: {
  262. rules: [{
  263. required: true,
  264. errorMessage: '请输入账号昵称'
  265. }, ]
  266. },
  267. detailregion: {
  268. rules: [{
  269. required: true,
  270. errorMessage: '请输入详细地址'
  271. }, ]
  272. },
  273. fregion: {
  274. rules: [{
  275. required: true,
  276. errorMessage: '请输入收货地址'
  277. }, ]
  278. },
  279. tel: {
  280. rules: [{
  281. required: true,
  282. errorMessage: '请输入联系方式'
  283. }, ]
  284. },
  285. name: {
  286. rules: [{
  287. required: true,
  288. errorMessage: '请输入姓名'
  289. }, ]
  290. },
  291. phone: {
  292. rules: [{
  293. required: true,
  294. errorMessage: '请输入联系方式'
  295. }, ]
  296. },
  297. vregion: {
  298. rules: [{
  299. required: false,
  300. errorMessage: '请输入探店地区'
  301. }, ]
  302. },
  303. skintype: {
  304. rules: [{
  305. required: false,
  306. errorMessage: '请输入国籍'
  307. }, ]
  308. },
  309. age: {
  310. rules: [{
  311. required: false,
  312. errorMessage: '请输入年龄'
  313. }, ]
  314. },
  315. },
  316. }
  317. },
  318. onReady() {},
  319. onShow() {},
  320. onLoad(options) {
  321. this.platform.platform_id = parseInt(options.platform_id)
  322. if (options.account_id) {
  323. this.accountId = parseInt(options.account_id)
  324. this.isBind = false
  325. }
  326. this.initRegion()
  327. this.getDefaultAddress()
  328. this.getlist()
  329. },
  330. methods: {
  331. initRegion() {
  332. // 声明城市数组
  333. let cityArr = [];
  334. let countyArr = [];
  335. // 设置下标
  336. this.regionIndex = [0, 0, 0];
  337. // 改变城市列表
  338. this.region[1] = this.oldRegion[0].children.map(item => {
  339. cityArr.push({
  340. name: item.name,
  341. code: item.code
  342. });
  343. })
  344. this.$set(this.region, 1, cityArr);
  345. // 改变县区列表
  346. this.oldRegion[0].children[0].children.map(item => {
  347. countyArr.push({
  348. name: item.name,
  349. code: item.code
  350. });
  351. })
  352. this.$set(this.region, 2, countyArr);
  353. },
  354. // 信息表
  355. getlist() {
  356. this.$https.get('/youngee/c/g/get-info-tables')
  357. .then(res => {
  358. this.array = res.data.data.AgeBracket
  359. let list = res.data.data.ThirdPlatform
  360. for (var i = 0; i < list.length; ++i) {
  361. if (list[i].id == this.platform.platform_id) {
  362. this.platform.platform_icon = list[i].platform_icon
  363. this.platform.platform_name = list[i].platform_name
  364. }
  365. }
  366. this.getlist1()
  367. this.getaccount()
  368. })
  369. },
  370. // 达人详细信息表
  371. getlist1() {
  372. this.$https.get('/youngee/c/t/g/get-talent-info')
  373. .then(res => {
  374. if (res.data.data.talent_wx_number !== null) {
  375. if (res.data.data.talent_age_bracket !== 0) {
  376. for (var i = 0; i < this.array.length; i++) {
  377. if (this.array[i].age_aid == res.data.data.talent_age_bracket) {
  378. this.Xage = this.array[i].age_bracket_discribe
  379. }
  380. this.formData.age = res.data.data.talent_age_bracket
  381. }
  382. }
  383. if (res.data.data.talent_nationality !== 0) {
  384. this.index1 = res.data.data.talent_nationality
  385. this.formData.nationality = res.data.data.talent_nationality
  386. }
  387. if (res.data.data.visit_store_region !== 0) {
  388. let a = res.data.data.visit_store_region.toString().slice(0, 2)
  389. let b = res.data.data.visit_store_region.toString().slice(0, 4)
  390. let c = 0
  391. for (var i = 0; i < region.length; i++) {
  392. if (region[i].code == a) {
  393. a = region[i].name
  394. for (var j = 0; j < region[i].children.length; j++) {
  395. if (region[i].children[j].code == b) {
  396. b = region[i].children[j].name
  397. for (var o = 0; o < region[i].children[j].children
  398. .length; o++) {
  399. if (region[i].children[j].children[o].code == res.data.data
  400. .visit_store_region) {
  401. c = region[i].children[j].children[o].name
  402. }
  403. }
  404. }
  405. }
  406. }
  407. }
  408. this.regionStr = a + ' ' + b + ' ' + c
  409. this.formData.visitStoreRegion = res.data.data.visit_store_region
  410. }
  411. this.formData.phone = res.data.data.is_bind_info === 1 ? res.data.data
  412. .talent_phone_number : this.formData.phone
  413. }
  414. })
  415. },
  416. getaccount() {
  417. if (!this.isBind) {
  418. this.$https.get('/youngee/c/t/g/get-talent-account')
  419. .then(res => {
  420. if (res.data.code !== -3) {
  421. this.account = res.data.data
  422. for (var i = 0; i < this.account.length; i++) {
  423. if (this.platform.platform_id == this.account[i].platform_id) {
  424. this.hasClicked = true
  425. this.formData.platform_nickname = this.account[i].platform_nickname
  426. this.formData.fans_count = this.account[i].fans_count
  427. this.formData.home_page_url = this.account[i].home_page_url
  428. this.imageData.push(this.account[i].home_page_capture_url);
  429. if (this.formData.fans_count >= 100000000) {
  430. this.index3 = 2
  431. this.fansCountInfo = this.fansRange[this.index3].value;
  432. this.fansLabel = this.fansRange[this.index3].label;
  433. this.fansCount = (this.formData.fans_count / 100000000).toFixed(1)
  434. } else if (this.formData.fans_count >= 10000) {
  435. this.index3 = 1
  436. this.fansCountInfo = this.fansRange[this.index3].value;
  437. this.fansLabel = this.fansRange[this.index3].label;
  438. this.fansCount = (this.formData.fans_count / 10000).toFixed(1)
  439. } else {
  440. this.index3 = 0
  441. this.fansCountInfo = this.fansRange[this.index3].value;
  442. this.fansLabel = this.fansRange[this.index3].label;
  443. this.fansCount = this.formData.fans_count
  444. }
  445. }
  446. }
  447. }
  448. })
  449. }
  450. },
  451. setDefault(e) {
  452. if (e.detail.value)
  453. this.formData.setdefault = 1
  454. else
  455. this.formData.setdefault = 0
  456. },
  457. getDefaultAddress() {
  458. this.$https.get('/youngee/c/t/g/get-talent-default-address').then(res => {
  459. this.formData.name = res.data.data.receiver_name
  460. this.formData.tel = res.data.data.phone_number
  461. this.formData.detailregion = res.data.data.detail_addr
  462. this.formData.fregion = res.data.data.region_code
  463. let a = res.data.data.region_code.toString().slice(0, 2)
  464. let b = res.data.data.region_code.toString().slice(0, 4)
  465. let c = 0
  466. for (var i = 0; i < region.length; i++) {
  467. if (region[i].code == a) {
  468. a = region[i].name
  469. for (var j = 0; j < region[i].children.length; j++) {
  470. if (region[i].children[j].code == b) {
  471. b = region[i].children[j].name
  472. for (var o = 0; o < region[i].children[j].children.length; o++) {
  473. if (region[i].children[j].children[o].code == res.data.data.region_code) {
  474. c = region[i].children[j].children[o].name
  475. }
  476. }
  477. }
  478. }
  479. }
  480. }
  481. this.regionStr1 = a + ' ' + b + ' ' + c
  482. })
  483. },
  484. /**
  485. * 手动提交
  486. * @param {Object} form
  487. */
  488. submitForm(form) {
  489. this.$refs.form.validate().then(res => {
  490. const iphoneReg1 = /^1[0-9]{10}$/
  491. const urlReg =
  492. /(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%$#_]*)?/
  493. if (!iphoneReg1.test(this.formData.phone)) {
  494. uni.showToast({
  495. title: '请填写正确的联系方式',
  496. icon: 'none'
  497. })
  498. return
  499. }
  500. if (!iphoneReg1.test(this.formData.tel)) {
  501. uni.showToast({
  502. title: '请填写正确的电话号码',
  503. icon: 'none'
  504. })
  505. return
  506. }
  507. if (!urlReg.test(this.formData.home_page_url)) {
  508. uni.showToast({
  509. title: '主页链接格式不正确',
  510. icon: 'none'
  511. })
  512. return
  513. }
  514. if (this.fansCount == null || this.fansCount * this.fansCountInfo <= 0 || this.fansLabel == "选择单位") {
  515. uni.showToast({
  516. title: '请填写粉丝量数量',
  517. icon: 'none'
  518. })
  519. return
  520. }
  521. this.formData.fans_count = this.fansCount * this.fansCountInfo
  522. if (this.imageData.length === 0) {
  523. uni.showToast({
  524. title: '请上传主页截图',
  525. icon: 'none'
  526. })
  527. return
  528. }
  529. // uni.showToast({
  530. // title: '提交成功'
  531. // })
  532. let nickName = uni.getStorageSync('nickName');
  533. let avatarUrl = uni.getStorageSync('avatarUrl');
  534. this.$https.post('/youngee/c/t/p/talent-info', {
  535. talent_age_bracket: this.formData.age,
  536. talent_nationality: this.formData.nationality,
  537. visit_store_region: this.formData.visitStoreRegion,
  538. talent_phone_number: this.formData.phone,
  539. talent_wx_nickname: nickName,
  540. avatar: avatarUrl,
  541. })
  542. .then(res => {})
  543. this.$https.post('/youngee/c/t/p/add-talent-address', {
  544. region_code: this.formData.fregion,
  545. detail_addr: this.formData.detailregion,
  546. phone_number: this.formData.tel,
  547. receiver_name: this.formData.name,
  548. default_tag: this.formData.setdefault
  549. })
  550. .then(res => {})
  551. this.formData.home_page_capture_url = this.imageData[0]
  552. if (this.isBind) {
  553. this.$https.post('/youngee/c/t/p/add-talent-account', {
  554. platform_id: this.platform.platform_id,
  555. platform_nickname: this.formData.platform_nickname,
  556. home_page_url: this.formData.home_page_url,
  557. fans_count: this.formData.fans_count,
  558. home_page_capture_url: this.formData
  559. .home_page_capture_url,
  560. })
  561. .then(res => {})
  562. } else {
  563. this.$https.post('/youngee/c/t/p/update-talent-account', {
  564. account_id: this.accountId,
  565. platform_id: this.platform.platform_id,
  566. platform_nickname: this.formData.platform_nickname,
  567. home_page_url: this.formData.home_page_url,
  568. fans_count: this.formData.fans_count,
  569. home_page_capture_url: this.formData
  570. .home_page_capture_url,
  571. })
  572. .then(res => {})
  573. }
  574. uni.showToast({
  575. title: '修改成功'
  576. })
  577. uni.navigateBack()
  578. }).catch(err => {
  579. uni.showToast({
  580. title: '请填写所有信息',
  581. icon: 'none'
  582. })
  583. })
  584. },
  585. ceshiChooseSuccess(tempFilePaths, e) { //选择图片返回
  586. if (e == 0) {
  587. this.store = 'talent_upload/' + this.guid() + '.png'
  588. } else if (e == 1) {
  589. this.store = 'talent_upload/' + this.guid() + '.mp4'
  590. }
  591. /****************
  592. 以下代码是自定义上传逻辑,仅供参考
  593. ***************/
  594. this.imgUpload(tempFilePaths);
  595. /*******************************/
  596. },
  597. imgUpload(tempFilePaths) {
  598. let that = this
  599. let config = {
  600. AccessKeyId: 'IVW21DTGIIUBBAGXKK0Y', //AK
  601. SecretKey: 'Y01nEQNcLOATMw7uJwrk3yOdQZ2fqLhSnXcOKVDE', //SK
  602. EndPoint: 'https://horastar.obs.cn-east-3.myhuaweicloud.com', //上传文件的路径
  603. };
  604. let fileName = this.store; //指定上传到OBS桶中的对象名
  605. // let fileName = "talent_upload/icon-arrow-right.png"
  606. let OBSPolicy = { //设定policy内容
  607. "expiration": "2089-12-31T12:00:00.000Z",
  608. "conditions": [{
  609. "bucket": "horastar"
  610. }, //Bucket name
  611. // {"bucket": "goin"},
  612. {
  613. 'key': fileName
  614. }
  615. ]
  616. }
  617. let policyEncoded = getPolicyEncode(OBSPolicy); //计算policy编码值
  618. let signature = getSignature(policyEncoded, config.SecretKey); //计算signature
  619. uni.uploadFile({
  620. //url: config.EndPoint,
  621. url: config.EndPoint,
  622. filePath: tempFilePaths[0],
  623. name: 'file',
  624. formData: {
  625. 'AccessKeyID': config.AccessKeyId,
  626. 'policy': policyEncoded,
  627. 'signature': signature,
  628. 'key': fileName,
  629. },
  630. success: function(res) {
  631. if (res.statusCode == '204') {
  632. that.imageData.push(config.EndPoint + '/' + fileName);
  633. let obs_url = config.EndPoint + '/' + fileName; //用你自己的 bucket 名替换星号
  634. that.formData.home_img = obs_url
  635. uni.showToast({
  636. title: '上传成功',
  637. icon: '成功'
  638. });
  639. } else {
  640. uni.showToast({
  641. title: '上传失败',
  642. icon: '失败'
  643. });
  644. }
  645. },
  646. fail: function(e) {}
  647. })
  648. },
  649. guid() {
  650. return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
  651. var r = Math.random() * 16 | 0,
  652. v = c == 'x' ? r : (r & 0x3 | 0x8);
  653. return v.toString(16);
  654. });
  655. },
  656. // 年龄选择的
  657. bindPickerChange: function(e) {
  658. this.index = e.detail.value;
  659. this.formData.age = this.array[this.index].age_aid
  660. this.Xage = this.array[this.index].age_bracket_discribe
  661. },
  662. //国籍选择
  663. bindPickerChange1: function(e) {
  664. this.index1 = e.detail.value;
  665. this.formData.nationality = this.array1[this.index1].id
  666. },
  667. //城市选择
  668. pickerChange(e) {
  669. this.regionIndex = e.detail.value;
  670. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  671. 1]]
  672. .name + ' ' +
  673. this.region[2][this.regionIndex[2]].name;
  674. // 组件传值
  675. this.$emit('region', [this.region[0][this.regionIndex[0]].code, this.region[1][this.regionIndex[1]]
  676. .code,
  677. this.region[
  678. 2][this.regionIndex[2]].code
  679. ]);
  680. this.formData.visitStoreRegion = this.region[2][this.regionIndex[2]].code;
  681. },
  682. pickerColumnchange(e) {
  683. if (e.detail.column === 0) {
  684. // 声明城市数组
  685. let cityArr = [];
  686. let countyArr = [];
  687. // 设置下标
  688. this.regionIndex = [e.detail.value, 0, 0];
  689. // 改变城市列表
  690. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  691. cityArr.push({
  692. name: item.name,
  693. code: item.code
  694. });
  695. })
  696. this.$set(this.region, 1, cityArr);
  697. // 改变县区列表
  698. this.oldRegion[e.detail.value].children[0].children.map(item => {
  699. countyArr.push({
  700. name: item.name,
  701. code: item.code
  702. });
  703. })
  704. this.$set(this.region, 2, countyArr);
  705. }
  706. if (e.detail.column === 1) {
  707. this.regionIndex[1] = e.detail.value;
  708. this.regionIndex[2] = 0;
  709. let countyArr = [];
  710. this.oldRegion[this.regionIndex[0]].children[this.regionIndex[1]].children.map(item => {
  711. countyArr.push({
  712. name: item.name,
  713. code: item.code
  714. });
  715. })
  716. this.$set(this.region, 2, countyArr);
  717. }
  718. if (e.detail.column === 2) {
  719. this.regionIndex[2] = e.detail.value;
  720. }
  721. },
  722. //城市选择
  723. pickerChange(e) {
  724. this.regionIndex = e.detail.value;
  725. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  726. 1]]
  727. .name + ' ' +
  728. this.region[2][this.regionIndex[2]].name;
  729. // 组件传值
  730. this.$emit('region', [this.region[0][this.regionIndex[0]].code, this.region[1][this.regionIndex[1]]
  731. .code,
  732. this.region[
  733. 2][this.regionIndex[2]].code
  734. ]);
  735. this.formData.visitStoreRegion = this.region[2][this.regionIndex[2]].code;
  736. },
  737. pickerColumnchange(e) {
  738. if (e.detail.column === 0) {
  739. // 声明城市数组
  740. let cityArr = [];
  741. let countyArr = [];
  742. // 设置下标
  743. this.regionIndex = [e.detail.value, 0, 0];
  744. // 改变城市列表
  745. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  746. cityArr.push({
  747. name: item.name,
  748. code: item.code
  749. });
  750. })
  751. this.$set(this.region, 1, cityArr);
  752. // 改变县区列表
  753. this.oldRegion[e.detail.value].children[0].children.map(item => {
  754. countyArr.push({
  755. name: item.name,
  756. code: item.code
  757. });
  758. })
  759. this.$set(this.region, 2, countyArr);
  760. }
  761. if (e.detail.column === 1) {
  762. this.regionIndex[1] = e.detail.value;
  763. this.regionIndex[2] = 0;
  764. let countyArr = [];
  765. this.oldRegion[this.regionIndex[0]].children[this.regionIndex[1]].children.map(item => {
  766. countyArr.push({
  767. name: item.name,
  768. code: item.code
  769. });
  770. })
  771. this.$set(this.region, 2, countyArr);
  772. }
  773. if (e.detail.column === 2) {
  774. this.regionIndex[2] = e.detail.value;
  775. }
  776. },
  777. //城市选择
  778. pickerChange1(e) {
  779. this.regionIndex1 = e.detail.value;
  780. this.regionStr1 = this.region[0][this.regionIndex1[0]].name + ' ' + this.region[1][this.regionIndex1[
  781. 1]]
  782. .name + ' ' +
  783. this.region[2][this.regionIndex1[2]].name;
  784. // 组件传值
  785. this.$emit('region', [this.region[0][this.regionIndex1[0]].code, this.region[1][this.regionIndex1[1]]
  786. .code,
  787. this.region[
  788. 2][this.regionIndex1[2]].code
  789. ]);
  790. this.formData.fregion = this.region[2][this.regionIndex1[2]].code;
  791. },
  792. pickerColumnchange1(e) {
  793. if (e.detail.column === 0) {
  794. // 声明城市数组
  795. let cityArr = [];
  796. let countyArr = [];
  797. // 设置下标
  798. this.regionIndex1 = [e.detail.value, 0, 0];
  799. // 改变城市列表
  800. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  801. cityArr.push({
  802. name: item.name,
  803. code: item.code
  804. });
  805. })
  806. this.$set(this.region, 1, cityArr);
  807. // 改变县区列表
  808. this.oldRegion[e.detail.value].children[0].children.map(item => {
  809. countyArr.push({
  810. name: item.name,
  811. code: item.code
  812. });
  813. })
  814. this.$set(this.region, 2, countyArr);
  815. }
  816. if (e.detail.column === 1) {
  817. this.regionIndex1[1] = e.detail.value;
  818. this.regionIndex1[2] = 0;
  819. let countyArr = [];
  820. this.oldRegion[this.regionIndex1[0]].children[this.regionIndex1[1]].children.map(item => {
  821. countyArr.push({
  822. name: item.name,
  823. code: item.code
  824. });
  825. })
  826. this.$set(this.region, 2, countyArr);
  827. }
  828. if (e.detail.column === 2) {
  829. this.regionIndex1[2] = e.detail.value;
  830. }
  831. },
  832. // 粉丝量量级选择
  833. bindPickerChange2: function(e) {
  834. if (this.index3 !== e.detail.value) {
  835. this.fansCount = null
  836. }
  837. this.index3 = e.detail.value;
  838. this.fansLabel = this.fansRange[this.index3].label
  839. this.fansCountInfo = this.fansRange[this.index3].value
  840. },
  841. onInput(e) {
  842. e = (e.match(/^\d*(\.?\d{0,1})/g)[0]) || null
  843. // //重新赋值给input
  844. if (e < 0 || e > 9999.9) {
  845. uni.showToast({
  846. title: '请输入[1,9999.9]区间内的数',
  847. icon: 'none'
  848. })
  849. }
  850. this.$nextTick(() => {
  851. this.fansCount = (e > 0 && e <= 9999.9) ? e : null
  852. })
  853. },
  854. onInput1(e) {
  855. // 验证是否是纯数字
  856. const isNumber = /^\d*$/.test(e)
  857. // 过滤非数字
  858. e = e.replace(/\D/g, '')
  859. if (!isNumber || e < 0 || e > 9999) {
  860. uni.showToast({
  861. title: '请输入[0,9999]区间的整数',
  862. icon: 'none'
  863. })
  864. }
  865. this.$nextTick(() => {
  866. this.fansCount = (e >= 0 && e <= 9999 && e.match(/^\d*/g)[0]) ? e : null
  867. })
  868. }
  869. },
  870. created() {
  871. let provinceArr = [];
  872. let cityArr = [];
  873. this.oldRegion.map((item, index) => {
  874. this.region[0].push({
  875. name: item.name,
  876. code: item.code
  877. });
  878. })
  879. provinceArr.map((item, index) => {
  880. this.region[1].push({
  881. name: item.name,
  882. code: item.code
  883. });
  884. })
  885. cityArr.map((item, index) => {
  886. this.region[2].push({
  887. name: item.name,
  888. code: item.code
  889. });
  890. })
  891. this.regionStr = '请选择省市区';
  892. }
  893. };
  894. </script>
  895. <style>
  896. picker {
  897. position: relative;
  898. display: block;
  899. cursor: pointer;
  900. padding-left: 20rpx !important;
  901. /* padding-top: 20rpx !important; */
  902. /* color: grey !important; */
  903. }
  904. /deep/.uni-forms-item__inner {
  905. border-bottom: none !important;
  906. margin-bottom: 0 !important;
  907. }
  908. /deep/ .uni-forms-item__content {
  909. display: flex !important;
  910. align-items: center !important;
  911. /* justify-content: space-between; */
  912. }
  913. </style>
  914. <style lang="scss" scoped>
  915. @charset "UTF-8";
  916. /* 头条小程序组件内不能引入字体 */
  917. /* #ifdef MP-TOUTIAO */
  918. @font-face {
  919. font-family: uniicons;
  920. font-weight: normal;
  921. font-style: normal;
  922. src: url("~@/static/uni.ttf") format("truetype");
  923. }
  924. /* #endif */
  925. /* #ifndef APP-NVUE */
  926. page {
  927. display: flex;
  928. flex-direction: column;
  929. box-sizing: border-box;
  930. background-color: #FFFFFF;
  931. min-height: 100%;
  932. height: auto;
  933. }
  934. view {
  935. font-size: 14px;
  936. // line-height: inherit;
  937. }
  938. .line {
  939. width: 96%;
  940. margin: 10rpx 2%;
  941. border-bottom: 1rpx solid #bbbbbb;
  942. }
  943. .title {
  944. height: 80rpx;
  945. display: flex;
  946. align-items: center;
  947. }
  948. .menu {
  949. position: fixed;
  950. top: 180rpx;
  951. background-color: #FFFFFF;
  952. justify-content: space-around;
  953. height: 80rpx;
  954. // height: 5%;
  955. width: 100%;
  956. display: flex;
  957. z-index: 10;
  958. margin-bottom: 10rpx;
  959. }
  960. .menu-item p {
  961. font-weight: 600;
  962. &.lor {
  963. border-bottom: 5rpx solid #F0D232;
  964. color: #F0D232;
  965. padding-bottom: 15rpx;
  966. }
  967. }
  968. .setdeault {
  969. display: flex;
  970. justify-content: space-between;
  971. }
  972. .btn1 {
  973. width: 100%;
  974. margin-top: 30rpx;
  975. font-size: 35rpx;
  976. color: #FFFFFF;
  977. background-color: #F0D232;
  978. border: none;
  979. border-radius: 0;
  980. }
  981. .uni-input-border,
  982. .uni-textarea-border {
  983. flex: 1;
  984. font-size: 14px;
  985. color: #666;
  986. border: 1px #FFFFFF solid;
  987. border-radius: 5px;
  988. /* #ifndef APP-NVUE */
  989. box-sizing: border-box;
  990. /* #endif */
  991. }
  992. .uni-input-border {
  993. padding: 0 10px;
  994. height: 35px;
  995. }
  996. .uni-textarea-border {
  997. padding: 10px;
  998. height: 80px;
  999. }
  1000. .label-box {
  1001. margin-right: 10px;
  1002. }
  1003. .transform-scale {
  1004. transform: scale(0.7);
  1005. }
  1006. .butto {
  1007. text-align: center;
  1008. }
  1009. .option {
  1010. padding: 20rpx;
  1011. }
  1012. .uni-margin-wrap {
  1013. width: 690rpx;
  1014. width: 100%;
  1015. ;
  1016. }
  1017. .swiper {
  1018. height: 300rpx;
  1019. }
  1020. .swiper-item {
  1021. display: block;
  1022. height: 300rpx;
  1023. line-height: 300rpx;
  1024. text-align: center;
  1025. }
  1026. .swiper-list {
  1027. margin-top: 40rpx;
  1028. margin-bottom: 0;
  1029. }
  1030. .uni-common-mt {
  1031. margin-top: 60rpx;
  1032. position: relative;
  1033. }
  1034. .info {
  1035. position: absolute;
  1036. right: 20rpx;
  1037. }
  1038. .uni-padding-wrap {
  1039. width: 550rpx;
  1040. padding: 0 100rpx;
  1041. }
  1042. .signup {
  1043. box-shadow: 0rpx 5rpx 40rpx #ccc;
  1044. width: 100%;
  1045. position: fixed;
  1046. bottom: 0rpx;
  1047. display: flex;
  1048. height: 90rpx;
  1049. padding-top: 2%;
  1050. background-color: #FFFFFF;
  1051. justify-content: space-around;
  1052. }
  1053. .signuptext {
  1054. text-align: center;
  1055. margin-top: 2%;
  1056. }
  1057. .signuptext p {
  1058. font-size: 60%;
  1059. color: #333333;
  1060. }
  1061. .signupbut {
  1062. text-align: center;
  1063. margin-top: 2%;
  1064. }
  1065. .but1 {
  1066. width: 120%;
  1067. text-align: center;
  1068. background-color: #FCCF41;
  1069. border-radius: 10rpx;
  1070. color: #464100;
  1071. font-size: 28rpx;
  1072. line-height: 156%;
  1073. font-weight: 500;
  1074. height: 65%;
  1075. }
  1076. /deep/.uni-searchbar__box {
  1077. border-color: #267CFF !important;
  1078. border-width: 2rpx !important;
  1079. }
  1080. /deep/.uni-searchbar__box {
  1081. background-color: #FFFFFF !important;
  1082. }
  1083. /deep/.uni-searchbar__text-placeholder {
  1084. font-size: 30rpx !important;
  1085. }
  1086. /deep/.segmented-control__text {
  1087. font-size: 34rpx !important;
  1088. }
  1089. /deep/.uni-data-checklist {
  1090. padding-left: 20upx;
  1091. }
  1092. uni-picker {
  1093. position: relative;
  1094. display: block;
  1095. cursor: pointer;
  1096. padding-left: 20rpx !important;
  1097. padding-top: 14rpx !important;
  1098. color: grey !important;
  1099. }
  1100. /deep/.uni-date-x--border {
  1101. border: 0px solid #dcdfe6 !important;
  1102. }
  1103. /deep/.is-input-border {
  1104. border: 0px solid #c8c7cc !important;
  1105. }
  1106. /deep/.uni-progress-info {
  1107. font-size: 25rpx !important;
  1108. }
  1109. /deep/.uni-error-message {
  1110. position: absolute;
  1111. bottom: -20rpx !important;
  1112. left: 20rpx !important;
  1113. text-align: left;
  1114. }
  1115. /deep/.uni-forms-item__inner {
  1116. padding-bottom: 0rpx !important;
  1117. margin-bottom: 30rpx !important;
  1118. border-bottom: 0.5rpx solid #CCCCCC;
  1119. }
  1120. /deep/.uni-group__title {
  1121. background-color: #FFFFFF !important;
  1122. }
  1123. /deep/.uni-list-item__content-title {
  1124. font-size: 30rpx !important;
  1125. color: #111111 !important;
  1126. }
  1127. /deep/.uni-progress-bar {
  1128. border-radius: 10rpx !important;
  1129. }
  1130. /deep/.uni-progress-inner-bar {
  1131. border-radius: 10rpx !important;
  1132. }
  1133. /deep/.is-input-border {
  1134. border-radius: 20px !important;
  1135. background-color: #fff;
  1136. }
  1137. .uni-easyinput__content-input {
  1138. font-size: 30upx !important;
  1139. }
  1140. .content-clear-icon {
  1141. font-size: 40upx !important;
  1142. }
  1143. /deep/.input-box {
  1144. padding: 50upx;
  1145. font-size: 30upx;
  1146. .input-item {
  1147. display: flex;
  1148. border: 1upx solid #F8F8F8;
  1149. line-height: 90upx;
  1150. height: 90upx;
  1151. margin-top: 20upx;
  1152. background: #F8F8F8;
  1153. border-radius: 48upx;
  1154. .input-label {
  1155. width: 150upx;
  1156. text-align: center;
  1157. }
  1158. .input-body {
  1159. position: relative;
  1160. height: 100upx;
  1161. width: calc(100% - 150upx);
  1162. .input {
  1163. line-height: 90upx;
  1164. height: 90upx;
  1165. position: relative;
  1166. font-size: 28upx;
  1167. }
  1168. .eye {
  1169. position: absolute;
  1170. height: 50upx;
  1171. width: 50upx;
  1172. right: 20upx;
  1173. top: 50%;
  1174. transform: translateY(-50%);
  1175. }
  1176. .btn-code {
  1177. position: absolute;
  1178. right: 0upx;
  1179. top: 50%;
  1180. transform: translateY(-50%);
  1181. background: none;
  1182. color: #205592;
  1183. width: 160upx;
  1184. font-size: 24upx;
  1185. box-sizing: border-box;
  1186. text-align: center;
  1187. padding: 0;
  1188. height: 100upx;
  1189. line-height: 100upx;
  1190. }
  1191. }
  1192. }
  1193. .select {
  1194. // padding-top: 40upx;
  1195. display: flex;
  1196. justify-content: space-between;
  1197. color: #003B67;
  1198. }
  1199. }
  1200. /deep/.title-left {
  1201. width: 3px;
  1202. height: 16px;
  1203. background: #267CFF;
  1204. display: inline-block;
  1205. border-radius: 3px;
  1206. margin-top: 3px;
  1207. vertical-align: top;
  1208. margin-right: 10px;
  1209. }
  1210. .card {
  1211. padding: 24rpx;
  1212. margin-top: 30rpx;
  1213. border: 1rpx solid #F0D232;
  1214. background-color: #ffffff;
  1215. margin: 0 10rpx;
  1216. }
  1217. .head {
  1218. padding-top: 5%;
  1219. padding: 0 0 0 1%;
  1220. height: 80rpx;
  1221. margin-top: 2%;
  1222. }
  1223. .head span {
  1224. color: #333333;
  1225. font-size: 80%;
  1226. font-weight: 550;
  1227. text-indent: 2em;
  1228. }
  1229. .head image {
  1230. vertical-align: middle;
  1231. width: 50rpx;
  1232. height: 50rpx;
  1233. display: inline-block;
  1234. padding-right: 14rpx;
  1235. }
  1236. .home-link {
  1237. /deep/.uni-easyinput__content-input {
  1238. background-color: #EBEBEB;
  1239. border-radius: 15rpx;
  1240. }
  1241. }
  1242. .heng-line {
  1243. margin-top: 60rpx;
  1244. margin-bottom: 50rpx;
  1245. border: 1rpx solid #DCDCDC;
  1246. }
  1247. .signupbtn p {
  1248. font-size: 30rpx;
  1249. }
  1250. .exit-btn {
  1251. width: 120%;
  1252. text-align: center;
  1253. background-color: #C0C0C0;
  1254. border-radius: 10rpx;
  1255. color: #FFFFFF;
  1256. font-size: 30rpx;
  1257. line-height: 180%;
  1258. }
  1259. .main-btn {
  1260. width: 300rpx;
  1261. text-align: center;
  1262. background-color: #FCCF41;
  1263. border-radius: 10rpx;
  1264. color: #000000;
  1265. font-size: 30rpx;
  1266. line-height: 180%;
  1267. }
  1268. .uni-input-placeholder {
  1269. font-size: 24rpx !important;
  1270. }
  1271. /deep/.uni-date-x--border {
  1272. border: 0px solid #dcdfe6 !important;
  1273. }
  1274. /deep/.is-input-border {
  1275. border: 0px solid #c8c7cc !important;
  1276. }
  1277. .example {
  1278. padding: 0 15px 15px;
  1279. }
  1280. .example-info {
  1281. padding: 15px;
  1282. color: #3b4144;
  1283. background: #ffffff;
  1284. }
  1285. .example-body {
  1286. /* #ifndef APP-NVUE */
  1287. display: flex;
  1288. /* #endif */
  1289. flex-direction: row;
  1290. flex-wrap: wrap;
  1291. justify-content: center;
  1292. padding: 0;
  1293. font-size: 14px;
  1294. background-color: #ffffff;
  1295. }
  1296. /* #endif */
  1297. .example {
  1298. padding: 0 15px;
  1299. }
  1300. .example-info {
  1301. /* #ifndef APP-NVUE */
  1302. display: block;
  1303. /* #endif */
  1304. padding: 15px;
  1305. color: #3b4144;
  1306. background-color: #ffffff;
  1307. font-size: 14px;
  1308. line-height: 20px;
  1309. }
  1310. .example-info-text {
  1311. font-size: 14px;
  1312. line-height: 20px;
  1313. color: #3b4144;
  1314. }
  1315. .example-body {
  1316. flex-direction: column;
  1317. padding: 15px;
  1318. background-color: #ffffff;
  1319. }
  1320. .number-inupt {
  1321. display: flex !important;
  1322. align-items: center !important;
  1323. }
  1324. </style>