addProject.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806
  1. <template>
  2. <view class="content">
  3. <view class="param">
  4. <view class="all-text">创建项目需求</view>
  5. <view class="proName">项目标题</view>
  6. <input class="proINname" v-model="pName" placeholder="请输入项目标题"/>
  7. <view class="proMiao">项目描述</view>
  8. <textarea class="proINname proIMi" v-model="projectContent" placeholder="请选择项目描述"/>
  9. <view class="proMiao">附件</view>
  10. <view class="upload-img">
  11. <uni-file-picker limit="3" :maxMb="2"
  12. @select='selectUpload'
  13. @delete="deleteHandle"
  14. :auto-upload='false'
  15. file-extname='pdf,docx,jpg,png,jpeg,doc,docm,dot,dotm,dotx,xlsx,xls,csv,xlsm,slxb,xlt,xltx'
  16. file-mediatype="all"
  17. @success='uploadSuccess'
  18. @fail='uploadFail'
  19. :list-styles='listStyles'
  20. v-model='fileList'
  21. ></uni-file-picker>
  22. </view>
  23. <span style="margin: 20rpx 0 0 20rpx;width: 700rpx;">支持pdf,docx,jpg,png,jpeg,doc,docm,dot,dotm,dotx,xlsx,xls,csv,xlsm,slxb,xlt,xltx格式,单个文件大小不超过2MB</span>
  24. <view class="proMiao">主办单位/主办人</view>
  25. <uni-data-picker placeholder="请选择主办单位" popup-title="请选择主办人" :localdata="range" v-model="value"
  26. @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened" @popupclosed="onpopupclosed">
  27. </uni-data-picker>
  28. <view class="proINname" style="height: 100%;">
  29. <view class="tag-view" v-for="(value,key) in userListSelect1" :key="key" @click="clearTagAdmin1(value)">
  30. <uni-tag :text="value.parent_value.organize+'/'+value.text" type="primary" ></uni-tag>
  31. <!-- {{value.parent_value.organize}}/{{value.text}} -->
  32. <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
  33. </view>
  34. </view>
  35. <!-- <uni-data-select class="proINname"
  36. v-model="value" placeholder="请选择主办单位"
  37. :localdata="range"
  38. @change="change1"
  39. ></uni-data-select>
  40. <view class="proMiao">主办人</view>
  41. <uni-data-select class="proINname"
  42. v-model="peopleValue" placeholder="请选择主办人"
  43. :localdata="rangePeople"
  44. @change="change"
  45. ></uni-data-select> -->
  46. <view class="proMiao">协办单位/协办人</view>
  47. <uni-data-picker placeholder="请选择协办单位" popup-title="请选择协办人" :showSearch= "true" :localdata="range" v-model="value2"
  48. @change="onchange2" @nodeclick="onnodeclick2" @popupopened="onpopupopened2" @popupclosed="onpopupclosed2">
  49. </uni-data-picker>
  50. <view class="proINname" style="height: 100%;">
  51. <view class="tag-view" v-for="(value,key) in userListSelect" :key="key" @click="clearTagAdmin(value)">
  52. <uni-tag :text="value.parent_value.organize+'/'+value.text" type="primary" ></uni-tag>
  53. <!-- {{value.parent_value.organize}}/{{value.text}} -->
  54. <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
  55. </view>
  56. </view>
  57. <!-- <mySelectCheckbox class="proINname" placeholder="请选择协办单位" v-model="value2" multiple dataKey="label" dataValue="value" :localdata="data"
  58. @change="changeXie"></mySelectCheckbox>
  59. <view class="proMiao">协办人</view>
  60. <mySelectCheckbox class="proINname" placeholder="请选择协办人" v-model="peopleValue2" multiple dataKey="label" dataValue="value" :localdata="dataPeople"
  61. @change="changeXiePeo"></mySelectCheckbox> -->
  62. <view class="proMiao">项目级别</view>
  63. <uni-data-select class="proINname"
  64. v-model="jibieValue" placeholder="请选择项目级别"
  65. :localdata="jibie"
  66. @change="change"
  67. ></uni-data-select>
  68. <!-- <view class="proMiao">关联流程</view>
  69. <uni-data-select class="proINname"
  70. v-model="value" placeholder="请选择关联流程"
  71. :localdata="range"
  72. @change="change"
  73. ></uni-data-select> -->
  74. <view class="proMiao">项目来源</view>
  75. <uni-data-select class="proINname"
  76. v-model="fromValue" placeholder="请选择项目来源"
  77. :localdata="from"
  78. @change="change"
  79. ></uni-data-select>
  80. <!-- <view class="proMiao jindu">完成进度</view>
  81. <view class="weidu">维度权重40%</view>
  82. <view class="addRen" @click="addRen">新增任务</view> -->
  83. <!-- 任务列表 -->
  84. <!-- <view style="width: 100%;margin: 50rpx 0 0 20rpx;">
  85. <view class="renwu" v-for="(item,index) in renwu" :key="index" @click="clickRenwu">
  86. <view>{{item.name}}</view>
  87. <view>{{item.time}}</view>
  88. <view style="display: flex;">
  89. <view class="renwu-bu bianji">编辑</view>
  90. <view class="renwu-bu delete">删除</view>
  91. </view>
  92. </view>
  93. </view> -->
  94. <view class="proMiao">项目评分人</view>
  95. <uni-combox class="proINname"
  96. :scorePeople="scorePeople" labelKey="label" valueKey="value"
  97. placeholder="请选择项目评分人"
  98. v-model="peoplescore"
  99. @input="comboxInput"
  100. ></uni-combox>
  101. </uni-forms-item>
  102. <!-- <mySelectCheckbox class="proINname" placeholder="请选择项目评分人" v-model="peoplescore" multiple dataKey="label" dataValue="value" :localdata="scorePeople"
  103. @change="changeScore"></mySelectCheckbox> -->
  104. <view class="proINname" style="height: 100%;">
  105. <view class="tag-view" v-for="(value,key) in scorePeople22" :key="key" @click="clearTagAdminP(value)">
  106. <uni-tag :text="value" type="primary" ></uni-tag>
  107. <!-- {{value.parent_value.organize}}/{{value.text}} -->
  108. <uni-icons class="clearBtn" type="clear" size="15" color="#ccc" />
  109. </view>
  110. </view>
  111. <view class="project">
  112. <view class="butt quxiao" @click="quxiao">取消</view>
  113. <view class="butt queren" @click="addProject">确认创建</view>
  114. </view>
  115. <view style="width: 100%;height: 60rpx;"></view>
  116. </view>
  117. <!-- 图片压缩 -->
  118. <Compress ref="Compress" />
  119. </view>
  120. </template>
  121. <script>
  122. import configdata from '@/common/config.js'
  123. import mySelectCheckbox from '../../components/my-selectCheckbox.vue'
  124. // 引入压缩组件
  125. import Compress from '@/components/compress/compress.vue'
  126. export default {
  127. components:{
  128. mySelectCheckbox,
  129. Compress
  130. },
  131. data() {
  132. return {
  133. pName:'',//项目标题
  134. projectContent:'',//项目描述
  135. //主办单位
  136. value: '',
  137. range: [],
  138. userListSelect1:[],
  139. zhuban:[],//主办传入值数组
  140. zhuValue:[],//主办传入id
  141. //主办人
  142. peopleValue:'',
  143. rangePeople:[],
  144. //协办
  145. userListSelect:[],
  146. value2:'',
  147. data: [],
  148. xieban:[],//协办传入值数组
  149. xieValue:[],//协办传入id
  150. //协办人
  151. peopleValue2:[],
  152. dataPeople: [],
  153. xiebanPeople:[],//协办传入值数组
  154. xieValuePeople:[],//协办传入id
  155. //评分人
  156. peoplescore:[],
  157. scorePeople: [],
  158. scorePeople22:[],//协办传入值数组
  159. scoreValuePeople:[],//协办传入id
  160. // 项目级别
  161. jibieValue:0,
  162. jibie:[
  163. { value: 0, text: "正常" },
  164. { value: 1, text: "紧急" },
  165. ],
  166. // 项目来源
  167. fromValue:0,
  168. from:[
  169. { value: 0, text: "涉内" },
  170. { value: 1, text: "涉外" },
  171. ],
  172. fileList: [],
  173. fileList2: [],
  174. fileList22:'',
  175. listStyles: {
  176. "borderStyle": {
  177. "width": "0", // 边框宽度
  178. },
  179. "border": false, // 是否显示边框
  180. "dividline": false
  181. },
  182. renwu:[
  183. {name:'xxx任务',time:'2024-04-11'},
  184. {name:'xxx任务',time:'2024-04-11'},
  185. {name:'xxx任务',time:'2024-04-11'},
  186. ],
  187. }
  188. },
  189. onShow() {
  190. // this.getDanwei()
  191. this.getPeopleZhu()
  192. },
  193. methods: {
  194. // 主办单位
  195. change1(e) {
  196. console.log("e:", e);
  197. // this.getPeopleZhu(e)
  198. },
  199. onnodeclick(data) {
  200. console.log(data);
  201. if(data.parent_value){//存在父级
  202. let dataId = data.value;
  203. this.userListSelect1.push(data);
  204. this.userListSelect1 = [...new Set(this.userListSelect1)]//es6数组去重
  205. }
  206. },
  207. onpopupopened(e) {
  208. console.log('popupopened');
  209. },
  210. onpopupclosed(e) {
  211. console.log('popupclosed');
  212. },
  213. onchange(e) {
  214. console.log('---------onchange:', e);
  215. var acc=e.detail.value[0].text
  216. this.getPeople(acc)
  217. },
  218. clearTagAdmin1(value){
  219. this.userListSelect1 = this.userListSelect1.filter(item => item != value);
  220. },
  221. clearTagAdmin(value){
  222. this.userListSelect = this.userListSelect.filter(item => item != value);
  223. },
  224. onnodeclick2(data) {
  225. console.log(data);
  226. if(data.parent_value){//存在父级
  227. let dataId = data.value;
  228. this.userListSelect.push(data);
  229. this.userListSelect = [...new Set(this.userListSelect)]//es6数组去重
  230. }
  231. console.log('多选',this.userListSelect)
  232. },
  233. onpopupopened2(e) {
  234. console.log('popupopened');
  235. },
  236. onpopupclosed2(e) {
  237. console.log('popupclosed');
  238. },
  239. onchange2(e) {
  240. console.log('---------onchange:', e);
  241. },
  242. //评分人选择
  243. changeScore(e){
  244. this.scorePeople22=[]
  245. this.scoreValuePeople=[]
  246. console.log('e:', e);
  247. e.map(item =>{
  248. this.scorePeople22.push(item.label)
  249. this.scoreValuePeople.push(item.value)
  250. })
  251. },
  252. // @input combox输入事件 返回combox值
  253. comboxInput(e) {
  254. console.log('e:', e);
  255. // this.peoplescore=e
  256. // this.scorePeople22=[]
  257. // this.scoreValuePeople=[]
  258. for(var i=0;i<this.scorePeople.length;i++){
  259. if(e==this.scorePeople[i].value){
  260. this.scorePeople22.push(this.scorePeople[i].label)
  261. this.scoreValuePeople.push(this.scorePeople[i].value)
  262. }
  263. }
  264. console.log(this.scorePeople22)
  265. },
  266. clearTagAdminP(value){
  267. this.scorePeople22 = this.scorePeople22.filter(item => item != value);
  268. },
  269. //获取单位
  270. getDanwei(){
  271. this.range=[]
  272. this.data=[]
  273. uni.showLoading({
  274. title: '加载中',
  275. mask: true, // 是否显示透明蒙层,防止触摸穿透
  276. });
  277. this.$Request.postT('/api/Organize/query').then(res => {
  278. if (res.code==200&&res.data) {
  279. // this.range =res.data.map(item =>{
  280. // return {
  281. // value: item.id,
  282. // text: item.oname,
  283. // }
  284. // })
  285. this.data =res.data.map(item =>{
  286. return {
  287. value: item.id,
  288. label: item.oname,
  289. }
  290. })
  291. console.log(this.range)
  292. }
  293. uni.hideLoading();
  294. });
  295. },
  296. //获取主办协办人,评分人
  297. getPeopleZhu(){
  298. this.range=[]
  299. this.rangePeople=[]
  300. uni.showLoading({
  301. title: '加载中',
  302. mask: true, // 是否显示透明蒙层,防止触摸穿透
  303. });
  304. this.$Request.postJson('/api/sysProject/queryCoUsers',{}).then(res => {
  305. if (res.code==200) {
  306. var lianji=[]
  307. for(var i=0;i<res.data.length;i++){
  308. if(res.data[i].userList.length>0){
  309. lianji.push(res.data[i])
  310. }
  311. }
  312. this.range =lianji.map(item =>{
  313. return {
  314. value: item,
  315. text: item.organize,
  316. children:item.userList.map(item =>{
  317. return{
  318. value: item.id,
  319. text: item.userName,
  320. }
  321. })
  322. }
  323. })
  324. console.log(this.range,'人')
  325. }else{
  326. var ii=JSON.stringify(res)
  327. console.log(res,res.data)
  328. console.log(JSON.parse(res))
  329. console.log(JSON.parse(ii))
  330. }
  331. uni.hideLoading();
  332. });
  333. },
  334. //根据单位获取人员(评分人)
  335. getPeople(acc){
  336. console.log(this.userListSelect1)
  337. this.scorePeople=[]
  338. uni.showLoading({
  339. title: '加载中',
  340. mask: true, // 是否显示透明蒙层,防止触摸穿透
  341. });
  342. this.$Request.postT('/api/sysUser/queryScorer',{
  343. organizes:acc
  344. }).then(res => {
  345. if (res.code==200) {
  346. console.log(res,'评分')
  347. this.scorePeople =res.data.map(item =>{
  348. return {
  349. value: item.id,
  350. label: item.userName,
  351. }
  352. })
  353. console.log(this.scorePeople,'人')
  354. }else{
  355. var ii=JSON.stringify(res)
  356. console.log(res,res.data)
  357. console.log(JSON.parse(res))
  358. console.log(JSON.parse(ii))
  359. }
  360. uni.hideLoading();
  361. });
  362. },
  363. //取消
  364. quxiao(){
  365. uni.switchTab({
  366. url:'/pages/project/index'
  367. })
  368. },
  369. //新增项目
  370. addProject(){
  371. console.log('协办',this.userListSelect1,this.value2,this.userListSelect)
  372. console.log('评分人',this.scoreValuePeople)
  373. console.log(this.jibie[this.jibieValue].text)
  374. var zhuban=[]
  375. var zhubanValue=[]
  376. this.userListSelect1.map(item =>{
  377. zhuban.push(item.parent_value.organize)
  378. zhubanValue.push(item.value)
  379. })
  380. console.log(zhuban,zhubanValue)
  381. if(this.userListSelect==[]){
  382. var xie=null
  383. var xieValue=null
  384. }else {
  385. var xieban=[]
  386. var xiebanValue=[]
  387. this.userListSelect.map(item =>{
  388. xieban.push(item.parent_value.organize)
  389. xiebanValue.push(item.value)
  390. })
  391. console.log(xieban,xiebanValue)
  392. var xie=xieban.join(",")
  393. var xieValue=xiebanValue.join(",")
  394. }
  395. let that = this
  396. if (!that.pName) {
  397. that.$queue.showToast("请输入项目标题");
  398. }else if (!that.projectContent) {
  399. that.$queue.showToast("请输入项目描述");
  400. }else {
  401. uni.showLoading({
  402. title: '加载中',
  403. mask: true, // 是否显示透明蒙层,防止触摸穿透
  404. });
  405. var data={
  406. "projectName": that.pName, // 项目名称
  407. "projectFrom": that.from[that.fromValue].text, // 项目来源
  408. "projectLevel": that.jibie[that.jibieValue].text, // 项目等级
  409. "projectContent": that.projectContent, // 项目描述
  410. "fileUrl": that.fileList22, // 附件
  411. "organize": zhuban.join(","), // 主办单位-多选
  412. "sposoner": zhubanValue.join(","), // 主办人ID-多选
  413. "coOrganize": xie, // 协办单位-多选
  414. "coSposoner": xieValue, // 协办人ID-多选
  415. "scorer": that.scoreValuePeople.join(",") // 评分人ID-多选
  416. }
  417. that.$Request.postJson('/api/sysProject/add',data).then(res => {
  418. if (res.code==200) {
  419. uni.showToast({
  420. title: '添加成功',
  421. icon: 'none',
  422. duration:800
  423. });
  424. uni.hideLoading()
  425. setTimeout(function() {
  426. uni.switchTab({
  427. url:'/pages/project/index'
  428. })
  429. }, 1000)
  430. } else {
  431. uni.hideLoading();
  432. uni.showToast({
  433. title: res.message,
  434. icon: 'none',
  435. duration:800
  436. });
  437. }
  438. });
  439. }
  440. },
  441. //新增任务
  442. addRen(){
  443. uni.navigateTo({
  444. url:'/pages/project/addRenwu'
  445. })
  446. },
  447. //任务详情
  448. clickRenwu(){
  449. uni.navigateTo({
  450. url:'/pages/project/renwuX'
  451. })
  452. },
  453. // 上传附件
  454. uploadSuccess(e) {
  455. console.log('上传成功', e)
  456. },
  457. uploadFail(e) {
  458. console.log('上传失败:', e)
  459. },
  460. //删除文件
  461. deleteHandle(index){
  462. console.log(index)
  463. this.fileList2.splice(index.index,1)
  464. // console.log(this.fileList2)
  465. this.fileList22=this.fileList2.join(",")
  466. },
  467. async selectUpload(e) {
  468. console.log('上传:', e)
  469. // console.log((e.tempFiles[0].size / 1024 > 1024 * 2),'大小')
  470. if(e.tempFiles.length>0){
  471. for (let i = 0; i < e.tempFilePaths.length; i++) {
  472. if ((e.tempFiles[i].size / 1024 > 1024 * 2)) {
  473. console.log('过大',e.tempFiles[i].extname)
  474. if(e.tempFiles[i].extname=='jpg' || e.tempFiles[i].extname=='png'||e.tempFiles[i].extname=='jpeg'){
  475. this.yaimg(e.tempFilePaths[i])
  476. }else{
  477. uni.showModal({
  478. title: '提示',
  479. content: '文件大于2M,无法上传',
  480. showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
  481. success: function(res) {
  482. if (res.confirm) {
  483. }
  484. }
  485. });
  486. }
  487. }else{
  488. this.imgUpload(e.tempFiles[i].file);
  489. }
  490. }
  491. }
  492. },
  493. //上传图片
  494. async imgUpload(result){
  495. uni.showLoading({
  496. title: '上传中',
  497. mask: true, // 是否显示透明蒙层,防止触摸穿透
  498. });
  499. let data = new FormData();
  500.   data.set("file", result);
  501.   let res = await this.$axios({
  502.     method: "post",
  503.     url: this.config('APIHOST1') + "/api/sysFile/upload",
  504.     headers: {
  505. tokenW: sessionStorage.getItem("token"),
  506. "Content-Type": "multipart/form-data"
  507.     },
  508.     data: data,
  509.   });
  510. // return res
  511.   console.log(res, "图片上传成功");
  512.   if (res.data.code == 200) {
  513. console.log(this.fileList)
  514.     this.fileList2.push(res.data.data);
  515. this.fileList22=this.fileList2.join(",")
  516. // console.log(this.fileList2.join(","))
  517. uni.hideLoading();
  518.   } else if(res.message=="登录凭证已过去,请重新登录"){
  519. sessionStorage.removeItem("token")
  520. sessionStorage.removeItem("roleId")
  521. uni.showModal({
  522. title: '提示',
  523. content: '用户信息失效,请重新登录!',
  524. showCancel: false, // 是否显示取消按钮,默认为 true // 是否显示取消按钮,默认为 true
  525. success: function(res) {
  526. if (res.confirm) {
  527. }
  528. }
  529. });
  530. uni.hideLoading();
  531. }else {
  532.     uni.showToast({
  533. title: res.message,
  534. icon: 'none',
  535. duration:800
  536. });
  537. uni.hideLoading();
  538.   }
  539. },
  540. /**
  541. * 压缩图片
  542. * @description 由组件处理,只需传入临时路径
  543. * @param {Object} url - 临时路径
  544. * @return void
  545. */
  546. yaimg(url) {
  547. uni.showLoading({
  548. title: '压缩中',
  549. mask: true, // 是否显示透明蒙层,防止触摸穿透
  550. });
  551. // 组件参数也有文档,详见文章的最底部!
  552. // const config = {
  553. // src: url,//要压缩的临时路径
  554. // maxSize: 800,//压缩后的最大尺寸
  555. // fileType: 'png',//压缩后的文件类型,可选值 jpg、png
  556. // quality: 0.6,//压缩后的质量(仅jpg类型有效,原因可自行阅读官方canvas文档),可选值 0 ~ 1,值越大越清晰(图片也越大)
  557. // }
  558. // console.log(config)
  559. // 调用压缩方法
  560. this.$refs.Compress.compress({
  561. src: url,//要压缩的临时路径
  562. maxSize: 800,//压缩后的最大尺寸
  563. fileType: '',//压缩后的文件类型,可选值 jpg、png
  564. quality: 0.6,//压缩后的质量(仅jpg类型有效,原因可自行阅读官方canvas文档),可选值 0 ~ 1,值越大越清晰(图片也越大)
  565. }).then((res) => {
  566. // console.log('返回的base64编码', res)
  567. this.base = res
  568. // 时间戳 + 随机数, 防止文件名重复
  569. let timestamp = new Date().getTime();
  570. let sunumber = Math.floor(Math.random()*999);
  571. // H5需要将base64转为file对象进行上传
  572. // 第一个参数是base64编码, 第二个是文件名
  573. var file = this.base64ToFile(res, timestamp + sunumber)
  574. // 最终压缩完毕的file对象
  575. console.log('压缩后的图片(File对象)', file)
  576. this.upload(file)
  577. this.file = file
  578. uni.hideLoading();
  579. //上传到服务器
  580. // this.upload(file)
  581. }).catch((err) => {
  582. console.log('压缩失败',err)
  583. uni.hideLoading();
  584. })
  585. },
  586. /**
  587. * 压缩后上传到服务器
  588. * @description 这块需要您自行处理
  589. * @param {Object} file - 要上传的file对象
  590. * @return void
  591. */
  592. async upload(file){
  593. uni.showLoading({
  594. title: '上传中',
  595. mask: true, // 是否显示透明蒙层,防止触摸穿透
  596. });
  597. let data = new FormData();
  598.   data.set("file", file);
  599. console.log(data)
  600.   let res = await this.$axios({
  601.     method: "post",
  602.     url: this.config('APIHOST1') + "/api/sysFile/upload",
  603.     headers: {
  604. tokenW: sessionStorage.getItem("token"),
  605. "Content-Type": "multipart/form-data"
  606.     },
  607.     data: data,
  608.   });
  609. // return res
  610.   console.log(res, "图片上传成功",res.data.code == 200);
  611.   if (res.data.success) {
  612.     this.fileList2.push(res.data.data);
  613. this.fileList22=this.fileList2.join(",")
  614. console.log(this.fileList22)
  615. uni.hideLoading();
  616.   }else {
  617.     uni.showToast({
  618. title: res.message,
  619. icon: 'none',
  620. duration:800
  621. });
  622. uni.hideLoading();
  623.   }
  624. },
  625. /**
  626. * base64 → File
  627. * @description 转换函数
  628. * @param {String} base64- base64完整字符串
  629. * @param {String} name - 文件名
  630. * @return Object
  631. */
  632. base64ToFile(base64, name) {
  633. if (typeof base64 != 'string') { return; }
  634. var arr = base64.split(',')
  635. var type = arr[0].match(/:(.*?);/)[1]
  636. var fileExt = type.split('/')[1]
  637. var bstr = atob(arr[1])
  638. var n = bstr.length
  639. var u8arr = new Uint8Array(n)
  640. while (n--) {
  641. u8arr[n] = bstr.charCodeAt(n)
  642. }
  643. return new File([u8arr], `${name}.` + fileExt, {
  644. type: type
  645. })
  646. },
  647. config: function (name) {
  648. var info = null
  649. if (name) {
  650. var name2 = name.split('.') //字符分割
  651. if (name2.length > 1) {
  652. info = configdata[name2[0]][name2[1]] || null
  653. } else {
  654. info = configdata[name] || null
  655. }
  656. if (info == null) {
  657. let web_config = cache.get('web_config')
  658. if (web_config) {
  659. if (name2.length > 1) {
  660. info = web_config[name2[0]][name2[1]] || null
  661. } else {
  662. info = web_config[name] || null
  663. }
  664. }
  665. }
  666. }
  667. return info
  668. },
  669. }
  670. }
  671. </script>
  672. <style>
  673. .content {
  674. display: flex;
  675. flex-direction: column;
  676. align-items: center;
  677. justify-content: center;
  678. }
  679. .param{
  680. margin: 20rpx 0 0 0;
  681. width: 100%;
  682. background-color: rgba(255, 255, 255, 1);
  683. font-size: 28rpx;
  684. font-weight: 400;
  685. line-height: 41rpx;
  686. color: rgba(0, 0, 0, 1);
  687. }
  688. .all-text{
  689. margin: 22rpx 0 0 20rpx;
  690. font-size: 32rpx;
  691. font-weight: 500;
  692. color: rgba(0, 0, 0, 1);
  693. }
  694. .proName{
  695. margin: 23rpx 0 0 20rpx;
  696. }
  697. .proINname{
  698. margin: 25rpx 0 0 21rpx;
  699. width: 709rpx;
  700. height: 90rpx;
  701. border-radius: 13rpx;
  702. background: rgba(245, 248, 252, 1);
  703. border: 1rpx solid rgba(229, 229, 229, 1);
  704. font-size: 28rpx;
  705. line-height: 90rpx;
  706. /* color: rgba(179, 179, 179, 1); */
  707. }
  708. .proIMi{
  709. height: 315rpx;
  710. }
  711. .proMiao{
  712. margin: 31rpx 0 0 20rpx;
  713. }
  714. /* 上传附件 */
  715. .upload-img{
  716. /* margin: 25rpx 0 0 21rpx;
  717. width: 200rpx;
  718. opacity: 1;
  719. border-radius: 13rpx;
  720. background: rgba(0, 97, 255, 0.1);
  721. border: 1rpx solid rgba(0, 97, 255, 1); */
  722. }
  723. .jindu{
  724. font-size: 32rpx;
  725. font-weight: 500;
  726. line-height: 46rpx;
  727. }
  728. .weidu{
  729. margin: 7rpx 0 0 20rpx;
  730. font-size: 24rpx;
  731. line-height: 35rpx;
  732. color: rgba(128, 128, 128, 1);
  733. }
  734. .addRen{
  735. margin: -80rpx 0 0 581rpx;
  736. width: 149rpx;
  737. height: 59rpx;
  738. border-radius: 92rpx;
  739. background: rgba(0, 97, 255, 1);
  740. font-size: 28rpx;
  741. line-height: 59rpx;
  742. color: rgba(255, 255, 255, 1);
  743. text-align: center;
  744. }
  745. /* 任务列表 */
  746. .renwu{
  747. display: flex;
  748. margin-top: 6rpx;
  749. width: 709rpx;
  750. height: 90rpx;
  751. border-radius: 13rpx;
  752. background: rgba(245, 248, 252, 1);
  753. border: 1rpx solid rgba(229, 229, 229, 1);
  754. font-size: 28rpx;
  755. justify-content: space-evenly;
  756. align-items: center;
  757. }
  758. .renwu-bu{
  759. width: 105rpx;
  760. height: 50rpx;
  761. border-radius: 110rpx;
  762. line-height:50rpx;
  763. text-align: center;
  764. }
  765. .bianji{
  766. border: 1rpx solid rgba(0, 97, 255, 1);
  767. color: rgba(0, 97, 255, 1);
  768. }
  769. .delete{
  770. margin-left: 20rpx;
  771. border: 1rpx solid rgba(212, 48, 48, 1);
  772. color: rgba(212, 48, 48, 1);
  773. }
  774. .project{
  775. display: flex;
  776. margin: 61rpx 0 0 0;
  777. justify-content: space-evenly;
  778. }
  779. .butt{
  780. width: 330rpx;
  781. height: 90rpx;
  782. border-radius: 117rpx;
  783. font-size: 32rpx;
  784. line-height: 90rpx;
  785. text-align: center;
  786. }
  787. .quxiao{
  788. border: 1rpx solid rgba(0, 97, 255, 1);
  789. color: rgba(0, 97, 255, 1);
  790. }
  791. .queren{
  792. background: rgba(0, 97, 255, 1);
  793. color: rgba(255, 255, 255, 1);
  794. }
  795. </style>