circle.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782
  1. <template>
  2. <view class="template-edit tn-safe-area-inset-bottom">
  3. <!-- 顶部自定义导航 -->
  4. <tn-nav-bar fixed customBack>
  5. <view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
  6. <text class='icon tn-icon-left'></text>
  7. </view>
  8. <view slot="default" style="display: flex;">
  9. <view style="flex:1;margin-left:25px">
  10. <text :style="{fontSize:(wxFontSize)+'px'}">发布需求</text>
  11. </view>
  12. <view>
  13. <button v-if="!canSave" :disabled="!canSave" plain="true" style="margin-right: 4px;border-radius: 24px;height:32px;line-height: 32px;font-size:15px;margin-top:4px;color:#0003;border-color:#0003;" @click="saveForm(1)" :style="{fontSize:(wxFontSize-3)+'px'}">暂存</button>
  14. <button v-if="canSave" plain="true" :disabled="!canSave" style="margin-right: 4px;border-radius: 24px;height:32px;line-height: 32px;font-size:15px;margin-top:4px;color:#1d60b1;border-color:#1d60b1;" @click="saveForm(1)" :style="{fontSize:(wxFontSize-3)+'px'}">暂存</button>
  15. </view>
  16. </view>
  17. </tn-nav-bar>
  18. <view class="tn-safe-area-inset-bottom" style="background: #f7f7f7;" :style="{paddingTop: vuex_custom_bar_height + 'px'}">
  19. <view style="display: flex;padding: 16px 80px;">
  20. <view style="position: relative;">
  21. <image style="width: 40px;height: 40px;" src="../static/tu/step1.png"></image>
  22. <view style="position: absolute;width: max-content;margin-left: -50%;" :style="{color:stepIndex==1?'#333':'#777'}">填写需求</view>
  23. </view>
  24. <view style="flex:1;height: 0px;border: 1px dashed #005DA6;align-self: center;"></view>
  25. <view style="position: relative;">
  26. <image v-if="stepIndex==1" style="width: 40px;height: 40px;" src="../static/tu/step2.png"></image>
  27. <image v-if="stepIndex==2" style="width: 40px;height: 40px;" src="../static/tu/step22.png"></image>
  28. <view style="position: absolute;width: max-content;margin-left: -50%;" :style="{color:stepIndex==1?'#777':'#333'}">填写联系方式</view>
  29. </view>
  30. </view>
  31. <!-- <tn-steps style="pointer-events:none;" :list="stepList" :current="stepIndex" mode="dotIcon" :fontSize="(wxFontSize-3)+'px'"></tn-steps>
  32. -->
  33. <view v-show="stepIndex==1">
  34. <view style="margin-top: 24px;background: #e187301a;border-radius: 5px 5px 5px 5px;margin-left: 16px;margin-right: 16px;padding: 8px 0 7px 10px;">
  35. <image src="../static/tu/tip.png" style="width: 20px;height: 20px;vertical-align: bottom;"></image>
  36. <text style="color:#E18730">以下三种方式可任选其一,若有可都输入</text>
  37. </view>
  38. <!-- <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-top tn-margin">
  39. <view class="tn-flex justify-content-item">
  40. <view class="tn-text-lg tn-padding-right-xs tn-text-bold" style="font-size: 16px;" :style="{fontSize:(wxFontSize-1)+'px'}">以下三种方式可任选其一,若有可都输入</view>
  41. </view>
  42. </view> -->
  43. <view style="padding: 16px;color:#333;" :style="{fontSize:(fontSize-1)+'px'}">
  44. 需求
  45. </view>
  46. <view class="tn-margin tn-padding" style="border-radius: 10rpx;background: #fff;margin-top: 0;">
  47. <textarea maxlength="500" v-model="content" placeholder="请描述您的需求..." :style="{fontSize:(wxFontSize-3)+'px',width:'100%'}" :placeholder-style="styleString"></textarea>
  48. </view>
  49. <!-- <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin" style="margin-top:40px;margin-bottom: 0;">
  50. <view class="tn-flex justify-content-item">
  51. <view class=" tn-text-center"
  52. style="border-radius: 100rpx;margin-right: 8rpx;width: 45rpx;height: 45rpx;line-height: 45rpx;">
  53. <text class="tn-icon-image" style="font-size: 20px;" :style="{fontSize:(wxFontSize+3)+'px'}"></text>
  54. </view>
  55. <view class="tn-padding-right-xs tn-text-bold" style="font-size: 16px;" :style="{fontSize:(wxFontSize-1)+'px'}">上传图片</view>
  56. </view>
  57. </view> -->
  58. <!-- <view class="justify-content-item tn-text-df tn-color-grey" @tap="clear">
  59. <text class="tn-padding-xs">清空上传</text>
  60. <text class="tn-icon-delete"></text>
  61. </view> -->
  62. <view style="padding: 16px;color:#333;" :style="{fontSize:(fontSize-1)+'px'}">
  63. 上传图片
  64. </view>
  65. <view class="tn-margin-left tn-padding-top-xs">
  66. <uni-file-picker
  67. v-model="imgList" :limit="6" @delete="deleteFile" :auto-upload="false" @select="select" @success="success">
  68. </uni-file-picker>
  69. <view style="margin-top: 8px;">
  70. <image src="../static/tu/help.png" style="width: 16px;height: 16px;margin-right:4px;vertical-align: bottom;"></image>
  71. <text style="color: #aaa;font-size: 12px;" :style="{fontSize:(wxFontSize-5)+'px'}">一次只能上传<text style="color: #E18730;display: inline;">六张图片</text></text>
  72. </view>
  73. </view>
  74. <view style="padding: 16px;color:#333;" :style="{fontSize:(fontSize-1)+'px'}">
  75. 上传文件
  76. </view>
  77. <!-- <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-padding-top-xl tn-margin" style="margin-bottom: 0;">
  78. <view class="tn-flex justify-content-item">
  79. <view class=" tn-text-center"
  80. style="border-radius: 100rpx;margin-right: 8rpx;width: 45rpx;height: 45rpx;line-height: 45rpx;">
  81. <text class="tn-icon-link" style="font-size: 20px;" :style="{fontSize:(wxFontSize+3)+'px'}"></text>
  82. </view>
  83. <view class="tn-padding-right-xs tn-text-bold" style="font-size: 16px;" :style="{fontSize:(wxFontSize-1)+'px'}">上传文件</view>
  84. </view>
  85. </view> -->
  86. <view style="background: #fff;margin-left: 16px;margin-right: 16px;padding: 12px;border-radius: 6px;">
  87. <uni-file-picker
  88. v-model="fileList" :limit="3" mode="grid" @delete="deleteFile" file-mediatype="all" file-extname="pdf,docx,doc,xls,xlsx" :auto-upload="false" @select="select" @success="success">
  89. <!-- <button size="default">上传文件</button> -->
  90. <view style="text-align: left;">
  91. <button size="mini" style="color:#fff;background-color:#005DA6;border: none;" plain="true" :style="{fontSize:(wxFontSize-5)+'px'}">
  92. <image src="../static/tu/up.png" style="width: 20px;height: 20px;vertical-align: middle;margin-right: 4px;"></image>
  93. 上传文件</button>
  94. </view>
  95. <!-- <tn-button shadow shape="round" fontColor="tn-color-white" size="lg" backgroundColor="tn-bg-blue" :fontSize="24" height="auto" padding="20rpx 36rpx">上传文件</tn-button>
  96. -->
  97. </uni-file-picker>
  98. <view style="margin-top: 4px;">
  99. <text style="color: #999;font-size: 12px;" :style="{fontSize:(wxFontSize-5)+'px'}">一次只能上传<text style="color: #E18730;">三个</text>文件,支持格式<text style="color: #E18730;"> pdf .doc .xls</text>,不超过<text style="color: #E18730;">5MB</text>。</text>
  100. </view>
  101. </view>
  102. <view style="margin-top:20px;padding: 16px">
  103. <view style="padding: 16px 0;color:#333;" :style="{fontSize:(fontSize-1)+'px'}">
  104. 需求有效期
  105. </view>
  106. <uni-data-select
  107. v-model="selectValue"
  108. :localdata="selectList"
  109. @change="changeSelect"
  110. placement="top"
  111. placeholder="请选择"
  112. :fontSize="(wxFontSize-3)+'px'"
  113. ></uni-data-select>
  114. </view>
  115. <!-- 悬浮按钮-->
  116. <view class="tn-flex tn-footerfixed">
  117. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  118. <button type="default" plain="true" style="border-radius: 8px 8px 8px 8px;background: #005DA6;color: #f7f7f7;border: none;" :disabled="!canNext"
  119. @click="nextStep()" :style="{fontSize:(wxFontSize-2)+'px'}">
  120. 下一步
  121. </button>
  122. </view>
  123. </view>
  124. </view>
  125. <view v-show="stepIndex==2">
  126. <view style="padding:16px">
  127. <uni-forms :modelValue="formData" label-width="0">
  128. <view style="margin:16px 0" :style="{fontSize:(wxFontSize-3)+'px'}">
  129. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;" >*</text><text>公司名称:</text>
  130. <w-select
  131. style="width: 100%;"
  132. v-model='searchValue'
  133. :list='items'
  134. valueName='name'
  135. keyName="regNumber"
  136. @change='selectChange'
  137. :filterable="true"
  138. :fontSize="(wxFontSize-3)+'px'"
  139. >
  140. </w-select>
  141. </view>
  142. <!-- <uni-forms-item label="公司名称" name="name">
  143. <uni-easyinput type="text" v-model="userInfo.company" placeholder="请输入所在公司名称" />
  144. </uni-forms-item> -->
  145. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;" :style="{fontSize:(wxFontSize-3)+'px'}">*</text><text :style="{fontSize:(wxFontSize-3)+'px'}">您的职称:</text>
  146. <uni-forms-item label="" name="realName" label-width="0">
  147. <uni-easyinput type="text" v-model="formInfo.jobTitle" :inputSize="wxFontSize-3" :placeholder-style="styleString" :clearable="false" placeholder="请输入您的职称" />
  148. </uni-forms-item>
  149. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;" :style="{fontSize:(wxFontSize-3)+'px'}">*</text><text :style="{fontSize:(wxFontSize-3)+'px'}">联系人姓名:</text>
  150. <uni-forms-item label="联系人姓名" name="contactMethod">
  151. <uni-easyinput type="text" v-model="formInfo.contactPerson" :inputSize="wxFontSize-3" :placeholder-style="styleString" :clearable="false" placeholder="请输入联系人姓名" />
  152. </uni-forms-item>
  153. <text style="color: red;line-height: 30px;vertical-align: middle;margin-right: 4px;" :style="{fontSize:(wxFontSize-3)+'px'}">*</text><text :style="{fontSize:(wxFontSize-3)+'px'}">联系方式:</text>
  154. <uni-forms-item label="联系方式" name="phone">
  155. <uni-easyinput type="text" v-model="formInfo.contactMethod" :inputSize="wxFontSize-3" :placeholder-style="styleString" :clearable="false" placeholder="请输入联系手机/微信/邮箱" />
  156. </uni-forms-item>
  157. <uni-forms-item label="11" name="check">
  158. <tn-checkbox v-model="formInfo.agree" activeColor="#45c05d" :size="wxFontSize+17" name="选项1">
  159. <text :style="{fontSize:(wxFontSize-4)+'px',color:formInfo.agree?'#45c05d':'#666666'}">同意平台核查所填信息的真实性</text>
  160. </tn-checkbox>
  161. <text :style="{fontSize:(wxFontSize-4)+'px',color:'#888',paddingTop:'8px',display:'block'}">系统将短信通知您审核结果。如需关闭通知功能,请前往我的页面自行关闭</text>
  162. </uni-forms-item>
  163. </uni-forms>
  164. </view>
  165. <view class="tn-flex tn-footerfixed">
  166. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  167. <button type="default" plain="true" style="border-radius: 24px;"
  168. @click="preStep()" :disabled="!canSave" :style="{fontSize:(wxFontSize-2)+'px'}">
  169. 上一步
  170. </button>
  171. </view>
  172. <view class="tn-flex-1 justify-content-item tn-margin-sm tn-text-center">
  173. <button v-if="canSave&&canNext" type="primary" style="background-color:#1d60b1;border-radius: 23px" @click="saveForm()" :style="{fontSize:(wxFontSize-2)+'px'}">提交审核</button>
  174. <button v-if="!canSave||!canNext" type="primary" :disabled="!canSave||!canNext" style="background-color:#0003;border-radius: 23px" @click="saveForm()" :style="{fontSize:(wxFontSize-2)+'px'}">提交审核</button>
  175. </view>
  176. </view>
  177. </view>
  178. </view>
  179. <view class='tn-tabbar-height'></view>
  180. </view>
  181. </template>
  182. <script>
  183. import template_page_mixin from '@/libs/mixin/template_page_mixin.js';
  184. import request from '../utils/request';
  185. export default {
  186. name: 'TemplateEdit',
  187. mixins: [template_page_mixin],
  188. data() {
  189. return {
  190. wxFontSize:17,
  191. canSave: true,
  192. selectValue: '',
  193. //非常紧急/两周/一月/长期
  194. selectList: [{
  195. value: '一周',
  196. text: '一周'
  197. },
  198. {
  199. value: '两周',
  200. text: '两周'
  201. },
  202. {
  203. value: '一月',
  204. text: '一月'
  205. }
  206. ],
  207. content:'',
  208. formInfo:{
  209. jobTitle:'',
  210. agree:false,
  211. contactPerson:JSON.parse(uni.getStorageSync('userInfo')).contactNickName,
  212. contactMethod:JSON.parse(uni.getStorageSync('userInfo')).contactMethod||JSON.parse(uni.getStorageSync('userInfo')).userName
  213. },
  214. imgList:[],
  215. fileDetailList:[],
  216. stepIndex:1,
  217. stepList: [{
  218. name: '填写需求',
  219. icon: 'circle',
  220. selectIcon: 'circle-fill'
  221. },
  222. {
  223. name: '填写联系方式',
  224. icon: 'trusty',
  225. selectIcon: 'trusty-fill'
  226. }
  227. ],
  228. formData: {
  229. apiType: 'this,ali',
  230. token: 'dffc1e06e636cff0fdf7d877b6ae6a2e',
  231. image: null
  232. },
  233. fileList: [],
  234. showUploadList: true,
  235. customBtn: false,
  236. autoUpload: true,
  237. showProgress: false,
  238. deleteable: true,
  239. customStyle: false,
  240. maxCount: 9,
  241. disabled: false,
  242. searchValue: '',
  243. items: [],
  244. org:{
  245. name:'',
  246. regNumber:''
  247. },
  248. editItem:{},
  249. styleString:'font-size:'+14+'px',
  250. canNext:true
  251. }
  252. },
  253. watch: {
  254. searchValue(val, oldval) {
  255. console.error(val,this.org.name);
  256. if(val!==this.org.name){
  257. this.current = null;
  258. }
  259. if(this.stepIndex==2){
  260. this.search(val)
  261. }
  262. }
  263. },
  264. onLoad(props) {
  265. const appBaseInfo = wx.getAppBaseInfo();
  266. this.wxFontSize = uni.getStorageSync('fontSize')||appBaseInfo.fontSizeSetting||17;
  267. this.styleString='font-size:'+(this.wxFontSize-3)+'px';
  268. if(props.sid){
  269. this.isEdit = true;
  270. this.editItem = JSON.parse(uni.getStorageSync(props.sid)||'{}');
  271. this.content = this.editItem.content;
  272. this.fileDetailList = this.editItem.fileDetailList;
  273. for(let i=0;i<this.fileDetailList.length;i++){
  274. this.fileDetailList[i].path = this.fileDetailList[i].ftpUrl
  275. if(this.isImage(this.fileDetailList[i].fileName)){
  276. this.imgList.push({
  277. name: this.fileDetailList[i].fileName,
  278. url: this.fileDetailList[i].ftpUrl,
  279. path: this.fileDetailList[i].path
  280. })
  281. }else{
  282. this.fileList.push({
  283. name: this.fileDetailList[i].fileName,
  284. url: this.fileDetailList[i].ftpUrl,
  285. path: this.fileDetailList[i].path
  286. })
  287. }
  288. }
  289. this.org.name = this.editItem.company;
  290. this.formInfo.jobTitle = this.editItem.jobTitle;
  291. this.formInfo.contactPerson = this.editItem.contactPerson;
  292. this.formInfo.contactMethod = this.editItem.contactMethod;
  293. }
  294. this.getCompany();
  295. },
  296. methods: {
  297. isImage(fileName) {
  298. const imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'ico']
  299. const extension = fileName.split('.').pop().toLowerCase();
  300. return imageExtensions.includes(extension);
  301. },
  302. getCompany(){
  303. let that = this;
  304. request.post('/slbUserCompanyRel/show/my', {
  305. userNo: uni.getStorageSync('userNo')
  306. }).then(res => {
  307. if (res.success) {
  308. let list = res.list || [];
  309. for(let i=0;i<list.length;i++){
  310. list[i].name = list[i].company;
  311. list[i].regNumber= list[i].company;
  312. if(!that.isEdit&&list[i].isDefault=='1'){
  313. that.searchValue = list[i].name
  314. that.current = list[i].name;
  315. that.org = list[i];
  316. if(list[i].jobTitle){
  317. that.formInfo.jobTitle = list[i].jobTitle
  318. }
  319. if(list[i].contactPerson){
  320. that.formInfo.contactPerson = list[i].contactPerson
  321. }
  322. if(list[i].contactMethod){
  323. that.formInfo.contactMethod = list[i].contactMethod;
  324. }
  325. that.getAddress(list[i].name);
  326. }
  327. if(that.isEdit&&list[i].name==that.editItem.company){
  328. that.searchValue = list[i].name
  329. that.current = list[i].name;
  330. that.formInfo.jobTitle = list[i].jobTitle;
  331. that.formInfo.contactPerson = list[i].contactPerson;
  332. that.formInfo.contactMethod = list[i].contactMethod;
  333. that.org = list[i];
  334. that.getAddress(list[i].name);
  335. }
  336. }
  337. that.items = list;
  338. }else{
  339. if(res._redirect){
  340. uni.showToast({
  341. title: '操作过期,请重试',
  342. duration: 2000,
  343. icon:'none'
  344. });
  345. that.goBack();
  346. }
  347. }
  348. })
  349. },
  350. preStep(){
  351. this.stepIndex = 1;
  352. },
  353. nextStep(){
  354. console.warn(this.searchValue);
  355. if(this.content==''&&this.fileDetailList.length===0){
  356. uni.showToast({
  357. title:'请输入您的需求或上传图片/文件',
  358. icon:'none'
  359. })
  360. this.stepIndex = 1;
  361. return false;
  362. }
  363. this.stepIndex = 2;
  364. },
  365. changeSelect(e) {
  366. this.selectValue = e;
  367. },
  368. saveForm(status){
  369. if(!this.canSave){
  370. return false;
  371. }
  372. let that = this;
  373. let params = {
  374. };
  375. if(status!=1&&!this.org.name){
  376. uni.showToast({
  377. title: '请输入公司名称',
  378. duration: 2000,
  379. icon:'none'
  380. });
  381. return false;
  382. }
  383. if(status!=1&&this.formInfo.jobTitle.length<1){
  384. uni.showToast({
  385. title: '请输入您的职称',
  386. duration: 2000,
  387. icon:'none'
  388. });
  389. return false;
  390. }
  391. if(status!=1&&this.formInfo.contactPerson.length<1){
  392. uni.showToast({
  393. title: '请输入联系人姓名',
  394. duration: 2000,
  395. icon:'none'
  396. });
  397. return false;
  398. }
  399. if(status!=1&&this.formInfo.contactMethod.length<1){
  400. uni.showToast({
  401. title: '请输入联系方式',
  402. duration: 2000,
  403. icon:'none'
  404. });
  405. return false;
  406. }
  407. if(status!=1&&!this.formInfo.agree){
  408. uni.showToast({
  409. title: '请勾选同意平台核查所填信息的真实性',
  410. duration: 2000,
  411. icon:'none'
  412. });
  413. return false;
  414. }
  415. if(!that.canNext){
  416. uni.showToast({
  417. title: '照片/文件正在上传中,请耐心等待',
  418. duration: 2000,
  419. icon:'none'
  420. });
  421. return false;
  422. }
  423. uni.showToast({
  424. title: '提交中...',
  425. icon:'none'
  426. });
  427. that.canSave = false;
  428. params.slbResourceDemand = {
  429. type:'3',
  430. company:this.org.name,
  431. jobTitle:this.formInfo.jobTitle,
  432. contactPerson:this.formInfo.contactPerson,
  433. contactMethod:this.formInfo.contactMethod,
  434. content:that.content,
  435. userNo:uni.getStorageSync('userNo'),
  436. validDate:this.selectValue,
  437. status: status==1?status:3,
  438. showFlag:'是',
  439. id: that.isEdit?that.editItem.id:undefined,
  440. bisNo: that.isEdit?that.editItem.bisNo:undefined,
  441. version: that.isEdit?that.editItem.version:undefined
  442. };
  443. params.slbResourceDemand.companyEntity = {};
  444. params.slbResourceDemand.companyEntity.company = params.slbResourceDemand.company;
  445. params.slbResourceDemand.companyEntity.jobTitle = params.slbResourceDemand.jobTitle;
  446. params.slbResourceDemand.companyEntity.creditCode = this.org.creditCode;
  447. params.slbResourceDemand.companyEntity.address = this.org.base;
  448. params.slbResourceDemand.companyEntity.regStatus = this.org.regStatus;
  449. params.slbResourceDemand.companyEntity.contactPerson = params.slbResourceDemand.contactPerson;
  450. params.slbResourceDemand.companyEntity.contactMethod = params.slbResourceDemand.contactMethod;
  451. params.slbResourceDemand.slbUserExt = {
  452. contactPerson:params.slbResourceDemand.contactPerson,
  453. contactMethod:params.slbResourceDemand.contactMethod,
  454. userNo:uni.getStorageSync('userNo'),
  455. };
  456. params.slbResourceDemand = JSON.stringify(params.slbResourceDemand);
  457. // params.slbResourceDemand.companyEntity.contactNickName = params.slbResourceDemand.contactNickName;
  458. // params.slbUserExt = JSON.stringify({
  459. // jobTitle:this.formInfo.jobTitle,
  460. // contactPerson:this.formInfo.contactPerson,
  461. // contactMethod:this.formInfo.contactMethod,
  462. // userNo:uni.getStorageSync('userNo'),
  463. // });
  464. params.fileDetailList = JSON.stringify(this.fileDetailList);
  465. request.post(that.isEdit?'/slbResourceDemand/update':'/slbResourceDemand/add', params).then(res => {
  466. if(res.success){
  467. uni.showToast({
  468. title:status==1?'信息已暂存,请在我的需求中查看暂存信息':'发布已提交,请在我的需求中查看进度',
  469. icon:'none',
  470. success:()=>{
  471. setTimeout(()=>{
  472. uni.redirectTo({
  473. url: "/pages/mine/need?tab="+(status==1?2:1)
  474. });
  475. },1500)
  476. }
  477. })
  478. }else{
  479. uni.showToast({
  480. title:res.msg,
  481. icon:'none'
  482. })
  483. that.canSave = true;
  484. }
  485. console.warn(res);
  486. })
  487. },
  488. // 跳转
  489. tn(e) {
  490. uni.navigateTo({
  491. url: e,
  492. });
  493. },
  494. // 手动上传文件
  495. upload() {
  496. console.warn(121212);
  497. },
  498. // 手动清空列表
  499. clear() {
  500. this.$refs.imageUpload.clear()
  501. },
  502. // 图片拖拽重新排序
  503. onSortList(list) {
  504. console.log(list);
  505. },
  506. select(e) {
  507. console.log('选择文件:', e)
  508. let tempFiles = e.tempFiles;
  509. for (let i in tempFiles) {
  510. this.upfile(tempFiles[i])
  511. }
  512. },
  513. deleteFile(e, index) {
  514. if(!this.canNext){
  515. uni.showToast({
  516. title: '照片/文件正在上传中,请耐心等待',
  517. icon:'none'
  518. });
  519. return false;
  520. }
  521. for(let i=0;i<this.fileDetailList.length;i++){
  522. if(e.tempFile.path===this.fileDetailList[i].path){
  523. this.fileDetailList.splice(i, 1);
  524. }
  525. }
  526. },
  527. upfile(file) {
  528. let that = this;
  529. console.warn(file);
  530. this.canNext = false;
  531. uni.showToast({
  532. title: '照片/文件正在上传中,请耐心等待',
  533. icon:'none'
  534. });
  535. uni.uploadFile({
  536. url: 'https://slb-m.lx-device.com/oss/upload/userFeedback', //仅为示例,非真实的接口地址
  537. filePath: file.url,
  538. name: 'file',
  539. success: (uploadFileRes) => {
  540. that.canNext = true;
  541. uni.hideToast();
  542. console.warn(JSON.parse(uploadFileRes.data));
  543. if(JSON.parse(uploadFileRes.data).success){
  544. let resultMap = JSON.parse(uploadFileRes.data).resultMap;
  545. that.fileDetailList.push({
  546. name: file.name,
  547. fileName: file.name, // 原始文件名
  548. ftpUrl: resultMap.uploadUrl, // 文件访问url
  549. path: file.path
  550. })
  551. }else{
  552. uni.showToast({
  553. title: JSON.parse(uploadFileRes.data).msg+',请删除后重试',
  554. icon:'none'
  555. });
  556. }
  557. },
  558. fail:(err)=>{
  559. uni.showToast({
  560. title: '上传失败,请删除后重试',
  561. icon:'none'
  562. });
  563. }
  564. });
  565. },
  566. // 上传成功
  567. success(e) {
  568. console.log('上传成功')
  569. },
  570. selectChange(e){
  571. console.error(e);
  572. this.searchValue = e.name
  573. this.current = e.regNumber;
  574. if(e.jobTitle){
  575. this.formInfo.jobTitle = e.jobTitle;
  576. }
  577. this.org = e;
  578. this.getAddress(e.name);
  579. },
  580. getAddress(name){
  581. let that = this;
  582. request.post('/member/getEnterPriseInfo', {
  583. keyWord: name
  584. }).then(res => {
  585. if(res&&res.success&&res.resultMap.data){
  586. if( res.resultMap.data.creditCode){
  587. that.org.creditCode = res.resultMap.data.creditCode
  588. }
  589. if( res.resultMap.data.regStatus){
  590. that.org.regStatus = res.resultMap.data.regStatus
  591. }
  592. if( res.resultMap.data.regLocation){
  593. that.org.base = res.resultMap.data.regLocation
  594. }
  595. }
  596. })
  597. },
  598. search: function(val) {
  599. let that = this;
  600. if (val && val.length > 3) {
  601. request.post('/member/searchCompys', {
  602. keyWord: val
  603. }).then(res => {
  604. if(res&&res.success){
  605. let list = res.resultMap.data || [];
  606. that.items = list;
  607. }else{
  608. if(res._redirect){
  609. uni.showToast({
  610. title: '操作过期,请重试',
  611. duration: 2000,
  612. icon:'none'
  613. });
  614. that.goBack();
  615. }
  616. }
  617. })
  618. }else{
  619. that.items = [];
  620. that.org = {};
  621. }
  622. },
  623. goBack() {
  624. const pages = getCurrentPages()
  625. // 有可返回的页面则直接返回,uni.navigateBack 默认返回失败之后会自动刷新页面 ,无法继续返回
  626. if (pages.length > 1) {
  627. uni.navigateBack()
  628. return;
  629. }else{
  630. uni.navigateTo({
  631. url: '/pages/index/index'
  632. })
  633. }
  634. },
  635. }
  636. }
  637. </script>
  638. <style lang="scss" scoped>
  639. .template-edit {}
  640. /* 胶囊*/
  641. .tn-custom-nav-bar__back {
  642. width: 60%;
  643. height: 100%;
  644. position: relative;
  645. display: flex;
  646. justify-content: space-evenly;
  647. align-items: center;
  648. box-sizing: border-box;
  649. // background-color: rgba(0, 0, 0, 0.15);
  650. border-radius: 1000rpx;
  651. border: 1rpx solid rgba(255, 255, 255, 0.5);
  652. // color: #FFFFFF;
  653. font-size: 18px;
  654. .icon {
  655. display: block;
  656. flex: 1;
  657. margin: auto;
  658. text-align: center;
  659. }
  660. &:before {
  661. content: " ";
  662. width: 1rpx;
  663. height: 110%;
  664. position: absolute;
  665. top: 22.5%;
  666. left: 0;
  667. right: 0;
  668. margin: auto;
  669. transform: scale(0.5);
  670. transform-origin: 0 0;
  671. pointer-events: none;
  672. box-sizing: border-box;
  673. opacity: 0.7;
  674. background-color: #FFFFFF;
  675. }
  676. }
  677. /* 底部悬浮按钮 start*/
  678. .tn-tabbar-height {
  679. min-height: 100rpx;
  680. height: calc(120rpx + env(safe-area-inset-bottom) / 2);
  681. }
  682. .tn-footerfixed {
  683. position: fixed;
  684. width: 100%;
  685. bottom: calc(env(safe-area-inset-bottom));
  686. z-index: 1024;
  687. box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0);
  688. background: #fff;
  689. }
  690. /* 底部悬浮按钮 end*/
  691. /* 标签内容 start*/
  692. .tn-tag-content {
  693. &__item {
  694. display: inline-block;
  695. line-height: 45rpx;
  696. padding: 10rpx 30rpx;
  697. margin: 20rpx 20rpx 5rpx 0rpx;
  698. &--prefix {
  699. padding-right: 10rpx;
  700. }
  701. }
  702. }
  703. /deep/ .uni-forms-item__label {
  704. display: none;
  705. }
  706. /deep/ .uni-stat__select .uni-select__input-placeholder {
  707. font-size: 14px;
  708. }
  709. /* 标签内容 end*/
  710. </style>