Versioning.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <template>
  2. <view class="pages" @click="openExpers">
  3. <view class="step">
  4. <uni-steps active-color="#07c160" :options="options" :active="5"></uni-steps>
  5. </view>
  6. <view style="height: 130rpx;"></view>
  7. <view class="version">
  8. <view class="versionTip">
  9. Tip:如审核失败,请先将看审核失败的详情,根据详情修改完成之后,再重新提交审核,审核通过直接发布即可
  10. </view>
  11. <view class="versionOnline" v-if="release_obj.user_version">
  12. <view class="versionOnlineTitle box-pack-between">
  13. <text>线上版本</text>
  14. <view class="flex-y-center por">
  15. <view class="versionOnlineTitle-btn flex-center" @click.stop="versionBack()">
  16. 版本回退
  17. </view>
  18. </view>
  19. </view>
  20. <view class="versionOnlineTitleBg ">
  21. <view class="versionOnlineTitleNum ft32">
  22. {{release_obj.user_version}}
  23. </view>
  24. <view class="versionOnlineTitleTime ft24">
  25. 在 {{release_obj.tijiao_time}} 提交上传
  26. </view>
  27. <view class="versionOnlineTitleTime ft24">
  28. 在 {{release_obj.fabu_time}} 提交发布
  29. </view>
  30. </view>
  31. </view>
  32. <view class="versionOnline" v-if="shen_obj.user_version">
  33. <view class="versionOnlineTitle box-pack-between">
  34. <text>审核版本 <text style="color: red;">({{shen_obj.status==2?'审核中':shen_obj.status==1?'审核被拒绝':
  35. shen_obj.status==0?'审核通过':''}})</text></text>
  36. <view class="flex-y-center" style="font-weight: 400;" @click.stop="bindWithdraw(shen_obj.id)">
  37. <text>{{shen_obj.status==2?'撤回审核':shen_obj.status==1?'失败详情':shen_obj.status==0?'发布上线':''}}
  38. </text>
  39. <text class="iconfont icongengduo"></text>
  40. </view>
  41. </view>
  42. <view class="versionOnlineTitleBgShen"
  43. :style="{backgroundColor:shen_obj.status==1?'#f73131':'#4395ff'}">
  44. <view class="versionOnlineTitleNum ft32 box-pack-between" @click.stop="bindRefuse(shen_obj.id)">
  45. <text>{{shen_obj.user_version}}</text>
  46. <text v-if="shen_obj.status==1" class="ft24">失败详情 <text
  47. style="font-size: 24rpx;padding-left: 10rpx;" class="iconfont icontishi"></text></text>
  48. </view>
  49. <view class="versionOnlineTitleTime ft24">
  50. 在 {{shen_obj.tijiao_time}} 提交上传
  51. </view>
  52. <view class="versionOnlineTitleTime ft24">
  53. 在 {{shen_obj.tijiao_time}} 审核时间
  54. 项目备注:{{tiyan_obj.user_desc}}
  55. </view>
  56. </view>
  57. </view>
  58. <view class="versionOnline" v-if="tiyan_obj.user_version">
  59. <view class="versionOnlineTitle box-pack-between">
  60. <text>体验版本</text>
  61. <view class="flex-y-center por">
  62. <view class="versionOnlineTitle-btn flex-center" @click.stop="open(3)">
  63. 提交审核
  64. </view>
  65. <view class="versionOnlineTitle-down" @click.stop="openExper">
  66. <view class="iconfont iconiconfontjiantou"></view>
  67. </view>
  68. <view class="poa Experience" v-if="is_experience" @click.stop="bindPreview(tiyan_obj.id)">
  69. 生成体验版
  70. </view>
  71. </view>
  72. </view>
  73. <view class="versionOnlineTitleBg " style="background-color: #42b983;">
  74. <view class="versionOnlineTitleNum ft32 box-pack-between">
  75. <text>{{tiyan_obj.user_version}}</text>
  76. </view>
  77. <view class="versionOnlineTitleTime ft24">
  78. 在 {{tiyan_obj.create_time}} 提交上传
  79. </view>
  80. <view class="versionOnlineTitleTime ft24">
  81. 项目备注:{{tiyan_obj.user_desc}}
  82. </view>
  83. </view>
  84. </view>
  85. </view>
  86. <uni-popup ref="popup" type="center">
  87. <view class="popup-content" v-if="type==1">
  88. <image :src="qrcodeImg"></image>
  89. <view class="save-btn flex-center" @click.stop="upCode">
  90. 保存图片
  91. </view>
  92. </view>
  93. <view v-if="type==2" class="popup-content-desc">
  94. <scroll-view scroll-y="true" style="height: 100%;">
  95. <!-- {{desc}} -->
  96. <rich-text :nodes="desc"></rich-text>
  97. <image v-for="(item,index) in imgAudit" :src="item" @click="bindImg(item)" mode="widthFix"
  98. class="imgAudit"></image>
  99. </scroll-view>
  100. </view>
  101. <block v-if="type==3">
  102. <view class="model">
  103. <form @submit="bindSubmit">
  104. <view class="model-refund-title ft28">
  105. 提交审核
  106. </view>
  107. <view style="padding: 20rpx;">
  108. <view class="amount-input">
  109. <textarea type="text" placeholder-style="font-size:26rpx" maxlength="60"
  110. auto-height="true" name="tag" placeholder="版本描述" />
  111. </view>
  112. </view>
  113. <view class="flex-y-center model-refund-btn">
  114. <view class="flex-grow-1 flex-center cancel ft26" @click.stop="cancel">
  115. 取消
  116. </view>
  117. <button hover-class="none" form-type="submit" class="flex-grow-1 flex-center submit ft28">
  118. 确定
  119. </button>
  120. </view>
  121. </form>
  122. </view>
  123. </block>
  124. </uni-popup>
  125. </view>
  126. </template>
  127. <script>
  128. import optionsData from './data.js'
  129. // #ifdef MP-WEIXIN
  130. import saveImgToPhotosAlbum from "@/static/js/saveImgToPhotosAlbum.js";
  131. // #endif
  132. export default {
  133. data() {
  134. return {
  135. release_obj: {},
  136. tiyan_obj: {},
  137. shen_obj: {},
  138. qrcodeImg: '',
  139. type: 1,
  140. desc: '',
  141. is_experience: false,
  142. URL: getApp().globalData.URL,
  143. imgAudit: [],
  144. options:optionsData.options
  145. }
  146. },
  147. onLoad() {
  148. this.releaseVenson();
  149. this.tiyanVenson();
  150. this.shenVenson();
  151. },
  152. methods: {
  153. // 版本回退
  154. versionBack() {
  155. //
  156. uni.showModal({
  157. content:"确定要版本回退",
  158. success: (r) => {
  159. if(r.confirm){
  160. this.request({
  161. url:'setting/revertcoderelease',
  162. data: {
  163. admin_id: uni.getStorageSync("admin_id"),
  164. }
  165. }).then(res=>{
  166. if (res.code == 200) {
  167. uni.showModal({
  168. content:res.message,
  169. showCancel:false,
  170. success: (r) => {
  171. this.releaseVenson();
  172. this.tiyanVenson();
  173. this.shenVenson();
  174. }
  175. })
  176. }
  177. })
  178. }
  179. }
  180. })
  181. },
  182. cancel() {
  183. this.$refs.popup.close();
  184. },
  185. openExpers(e) {
  186. this.is_experience = false;
  187. },
  188. openExper(e) {
  189. this.is_experience = !this.is_experience;
  190. },
  191. //撤回审核2、失败详情1、发布上线0
  192. bindWithdraw(id) {
  193. if (this.shen_obj.status == 0) {
  194. this.request({
  195. url: 'setting/release',
  196. data: {
  197. admin_id: uni.getStorageSync("admin_id"),
  198. id: id,
  199. }
  200. }).then(res => {
  201. if (res.code == 200) {
  202. uni.showToast({
  203. title: res.message
  204. })
  205. setTimeout(() => {
  206. this.releaseVenson();
  207. this.tiyanVenson();
  208. this.shenVenson();
  209. }, 2000)
  210. }
  211. })
  212. }
  213. if (this.shen_obj.status == 1) {
  214. this.request({
  215. url: 'setting/getLastAudit',
  216. data: {
  217. admin_id: uni.getStorageSync("admin_id"),
  218. // id,
  219. }
  220. }).then(res => {
  221. if (res.code == 200) {
  222. this.desc = res.data.reason;
  223. this.imgAudit = res.data.screenshot;
  224. this.type = 2;
  225. this.$refs.popup.open();
  226. }
  227. })
  228. }
  229. if (this.shen_obj.status == 2) {
  230. uni.showModal({
  231. title: '提示',
  232. content: "是否要撤回审核?",
  233. showCancel: true,
  234. cancelText: '取消',
  235. confirmText: '确定',
  236. success: r => {
  237. if (r.confirm) {
  238. this.request({
  239. url: 'setting/unDoCodeAudit',
  240. data: {
  241. admin_id: uni.getStorageSync("admin_id"),
  242. id: id,
  243. }
  244. }).then(res => {
  245. if (res.code == 200) {
  246. uni.showToast({
  247. title: "撤回成功"
  248. })
  249. setTimeout(() => {
  250. this.shenVenson();
  251. }, 2000)
  252. }
  253. })
  254. }
  255. },
  256. fail: () => {},
  257. complete: () => {}
  258. });
  259. }
  260. },
  261. open() {
  262. this.type = 3;
  263. this.$refs.popup.open();
  264. },
  265. // 体验版二维码
  266. bindPreview(id) {
  267. this.request({
  268. url: 'setting/getExpVersion',
  269. data: {
  270. admin_id: uni.getStorageSync("admin_id"),
  271. id,
  272. }
  273. }).then(res => {
  274. if (res.code == 200) {
  275. this.qrcodeImg = getApp().globalData.URL + res.data;
  276. this.type = 1;
  277. this.is_experience = false;
  278. this.$refs.popup.open();
  279. }
  280. })
  281. },
  282. // 提交审核
  283. bindSubmit(e) {
  284. this.request({
  285. url: 'setting/submitReview',
  286. data: {
  287. admin_id: uni.getStorageSync("admin_id"),
  288. tag: e.detail.value.tag,
  289. },
  290. hide:true
  291. }).then(res => {
  292. if (res.code == 200 || res.code == '200') {
  293. uni.showToast({
  294. title: res.message,
  295. })
  296. this.shenVenson();
  297. this.$refs.popup.close();
  298. }
  299. }).catch((err)=>{
  300. uni.showModal({
  301. title: '提示',
  302. content: err.message,
  303. showCancel: false,
  304. cancelText: '取消',
  305. confirmText: '确定',
  306. success: r => {
  307. }
  308. })
  309. })
  310. },
  311. // 失败详情
  312. bindRefuse(id) {
  313. this.request({
  314. url: 'setting/getLastAudit',
  315. data: {
  316. admin_id: uni.getStorageSync("admin_id"),
  317. // id,
  318. }
  319. }).then(res => {
  320. if (res.code == 200) {
  321. this.desc = res.data.reason;
  322. this.imgAudit = res.data.screenshot;
  323. this.type = 2;
  324. this.$refs.popup.open();
  325. }
  326. })
  327. },
  328. bindImg(url) {
  329. uni.previewImage({
  330. urls: [url],
  331. });
  332. },
  333. // 线上版本
  334. releaseVenson(e) {
  335. this.request({
  336. url: 'setting/wechat_release',
  337. data: {
  338. admin_id: uni.getStorageSync("admin_id"),
  339. }
  340. }).then(res => {
  341. if (res.code == 200) {
  342. this.release_obj = res.data;
  343. }
  344. })
  345. },
  346. // 体验版本
  347. tiyanVenson(e) {
  348. this.request({
  349. url: 'setting/wechat_tiyan',
  350. data: {
  351. admin_id: uni.getStorageSync("admin_id"),
  352. }
  353. }).then(res => {
  354. if (res.code == 200) {
  355. this.tiyan_obj = res.data;
  356. }
  357. })
  358. },
  359. // 审核版本
  360. shenVenson(e) {
  361. this.request({
  362. url: 'setting/wechat_shen',
  363. data: {
  364. admin_id: uni.getStorageSync("admin_id"),
  365. }
  366. }).then(res => {
  367. if (res.code == 200) {
  368. this.shen_obj = res.data;
  369. }
  370. })
  371. },
  372. upCode(e) {
  373. // #ifdef H5
  374. uni.showModal({
  375. title: '提示',
  376. content: '请长按二维码图片进行保存',
  377. showCancel: false,
  378. confirmText: '好的',
  379. });
  380. // #endif
  381. // #ifdef MP-WEIXIN
  382. var url = this.qrcodeImg;
  383. console.log(url, "url")
  384. saveImgToPhotosAlbum.saveImgToPhotosAlbum(url).then((res) => {
  385. //成功的逻辑
  386. console.log(res, "保存成功")
  387. wx.showToast({
  388. title: '保存成功',
  389. icon: 'none',
  390. mask: true,
  391. })
  392. setTimeout(() => {
  393. this.$refs.popup.close();
  394. }, 2000)
  395. }).catch((err) => {
  396. console.log(err, "保存失败")
  397. if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" ||
  398. err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg ===
  399. "saveImageToPhotosAlbum:fail authorize no response") {
  400. // 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用
  401. uni.showModal({
  402. title: '提示',
  403. content: '需要您设置授权保存相册',
  404. showCancel: false,
  405. success: modalSuccess => {
  406. uni.openSetting({
  407. success(settingdata) {
  408. console.log("settingdata", settingdata)
  409. if (settingdata.authSetting[
  410. 'scope.writePhotosAlbum']) {
  411. uni.showModal({
  412. title: '提示',
  413. content: '获取权限成功,再次点击图片即可保存',
  414. showCancel: false,
  415. })
  416. } else {
  417. uni.showModal({
  418. title: '提示',
  419. content: '获取权限失败,将无法保存到相册哦~',
  420. showCancel: false,
  421. })
  422. }
  423. },
  424. fail(failData) {
  425. console.log("failData", failData)
  426. },
  427. complete(finishData) {
  428. console.log("finishData", finishData)
  429. }
  430. })
  431. }
  432. })
  433. }
  434. // 失败后的逻辑
  435. })
  436. // #endif
  437. },
  438. }
  439. }
  440. </script>
  441. <style>
  442. page {
  443. height: 100%;
  444. }
  445. .pages {
  446. height: 100%;
  447. }
  448. .versionTip {
  449. color: red;
  450. font-size: 26rpx;
  451. padding-bottom: 20rpx;
  452. }
  453. .imgAudit {
  454. display: block;
  455. width: 100%;
  456. }
  457. .Experience {
  458. position: absolute;
  459. bottom: -80rpx;
  460. min-width: 180rpx;
  461. left: auto;
  462. right: 0;
  463. margin: 0;
  464. line-height: 36px;
  465. background-color: #fff;
  466. background: #fff;
  467. box-shadow: 0 1px 20px 0 rgb(0 0 0 0.5);
  468. border-radius: 8rpx;
  469. z-index: 4000;
  470. font-weight: 400;
  471. text-align: center;
  472. font-size: 26rpx;
  473. }
  474. .versionOnlineTitle-btn {
  475. background-color: #42b983;
  476. color: #ffffff;
  477. font-weight: normal;
  478. line-height: 60rpx;
  479. /* padding: 0 32rpx; */
  480. min-width: 180rpx;
  481. font-size: 26rpx;
  482. letter-spacing: 0;
  483. border-radius: 6rpx;
  484. box-sizing: border-box;
  485. border: none;
  486. cursor: pointer;
  487. text-align: center;
  488. margin-right: 20rpx;
  489. }
  490. .versionOnlineTitle-down {
  491. line-height: 58rpx;
  492. background-color: #42b983;
  493. color: #ffffff;
  494. padding: 0 15rpx;
  495. border-radius: 6rpx;
  496. }
  497. .versionOnlineTitle-down .iconiconfontjiantou {
  498. font-size: 26rpx;
  499. }
  500. .version {
  501. padding: 0 30rpx;
  502. }
  503. .versionOnline {
  504. padding-bottom: 50rpx;
  505. }
  506. .versionOnlineTitle {
  507. font-size: 30rpx;
  508. font-weight: 600;
  509. padding-bottom: 20rpx;
  510. }
  511. .versionOnlineTitleBg {
  512. background-color: #42b983;
  513. color: #FFFFFF;
  514. padding: 20rpx;
  515. border-radius: 10rpx;
  516. }
  517. .versionOnlineTitleBgShen {
  518. background-color: #4395ff;
  519. color: #FFFFFF;
  520. padding: 20rpx;
  521. border-radius: 10rpx;
  522. }
  523. .versionOnlineTitleNum {
  524. padding-bottom: 10rpx;
  525. font-weight: 600;
  526. }
  527. .versionOnlineTitleTime {
  528. padding-bottom: 10rpx;
  529. }
  530. .versionCode {
  531. width: 50rpx;
  532. height: 50rpx;
  533. }
  534. .popup-content-desc {
  535. background: #fff;
  536. text-align: center;
  537. width: 600rpx;
  538. height: 500rpx;
  539. word-break: break-all;
  540. padding: 25rpx;
  541. }
  542. .popup-content image {
  543. width: 350rpx;
  544. height: 350rpx;
  545. background: #fff;
  546. }
  547. .save-btn {
  548. width: 330rpx;
  549. height: 90rpx;
  550. background: linear-gradient(315deg, #42b983 2%, #42b983 99%);
  551. opacity: 1;
  552. border-radius: 6rpx;
  553. margin: 0 auto;
  554. color: #FFFFFF;
  555. font-size: 30rpx;
  556. font-family: Source Han Sans CN;
  557. font-weight: 500;
  558. opacity: 1;
  559. margin-top: 30rpx;
  560. }
  561. .amount-input {
  562. padding: 20rpx;
  563. border: 1rpx solid #F1F1F1;
  564. }
  565. .amount-input textarea {
  566. width: 100%;
  567. }
  568. .model {
  569. background: #FFFFFF;
  570. border-radius: 10rpx;
  571. width: 600rpx;
  572. overflow: hidden;
  573. }
  574. .model-refund-title {
  575. text-align: center;
  576. padding: 20rpx 0;
  577. }
  578. .model-refund-btn {
  579. border-top-color: #f5f5f5;
  580. border-top-style: solid;
  581. border-top-width: 1px;
  582. }
  583. .model-refund-btn .cancel {
  584. height: 90rpx;
  585. }
  586. .model-refund-btn .submit {
  587. height: 90rpx;
  588. border-left: 1rpx solid #f1f1f1;
  589. border-radius: 0;
  590. }
  591. button {
  592. background-color: #fff;
  593. padding: 0;
  594. margin: 0;
  595. line-height: 1rpx;
  596. min-height: 0;
  597. font-size: 28rpx;
  598. background: #fff;
  599. border-radius: none;
  600. }
  601. button::after {
  602. border: none;
  603. }
  604. </style>