Versioning.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. <template>
  2. <view class="">
  3. <view class="step">
  4. <uni-steps active-color="#3387FF" :options="[{title: '扫码授权',url:'./qrCode'}, {title: '小程序配置',url:'./deploy'},
  5. {title: '提交版本',url:'./addVersion'},
  6. {title: '提交审核',url:'./addExamine'},{title: '版本管理',url:'./Versioning'} ]" :active="4"></uni-steps>
  7. </view>
  8. <view style="height: 130rpx;"></view>
  9. <view class="version">
  10. <view class="versionTip">
  11. Tip:如审核失败,请先将审核失败的版本退回开发,再返回上一步重新提交,如审核通过直接发布即可
  12. </view>
  13. <view class="versionOnline" v-if="release_obj.user_version">
  14. <view class="versionOnlineTitle box-pack-between">
  15. <text>线上版本</text>
  16. <view class="flex-y-center por">
  17. <view class="versionOnlineTitle-btn flex-center" @click.stop="versionBack()">
  18. 版本回退
  19. </view>
  20. </view>
  21. </view>
  22. <view class="versionOnlineTitleBg ">
  23. <view class="versionOnlineTitleNum ft32">
  24. {{release_obj.user_version}}
  25. </view>
  26. <view class="versionOnlineTitleTime ft24">
  27. 在 {{release_obj.tijiao_time}} 提交上传
  28. </view>
  29. <view class="versionOnlineTitleTime ft24">
  30. 在 {{release_obj.fabu_time}} 提交发布
  31. </view>
  32. </view>
  33. </view>
  34. <view class="versionOnline" v-if="shen_obj.user_version">
  35. <view class="versionOnlineTitle box-pack-between">
  36. <text>审核版本 <text
  37. style="color: red;">({{shen_obj.status==2?'审核中':shen_obj.status==1?'审核被拒绝':shen_obj.status==0?'审核通过':''}})</text></text>
  38. <view class="flex-y-center" style="font-weight: 400;" @click="bindWithdraw(shen_obj.id)">
  39. <text>{{shen_obj.status==2?'撤回审核':shen_obj.status==1?'撤回开发':shen_obj.status==0?'发布上线':''}}
  40. </text>
  41. <text class="iconfont icongengduo"></text>
  42. </view>
  43. </view>
  44. <view class="versionOnlineTitleBgShen"
  45. :style="{backgroundColor:shen_obj.status==1?'#f73131':'#4395ff'}">
  46. <view class="versionOnlineTitleNum ft32 box-pack-between" @click="bindRefuse(shen_obj.id)">
  47. <text>{{shen_obj.user_version}}</text>
  48. <text v-if="shen_obj.status==1" class="ft24">失败详情 <text
  49. style="font-size: 24rpx;padding-left: 10rpx;" class="iconfont icontishi"></text></text>
  50. </view>
  51. <view class="versionOnlineTitleTime ft24">
  52. 在 {{shen_obj.create_time}} 提交上传
  53. </view>
  54. <view class="versionOnlineTitleTime ft24">
  55. 在 {{shen_obj.tijiao_time}} 审核时间
  56. </view>
  57. </view>
  58. </view>
  59. <view class="versionOnline" v-if="tiyan_obj.user_version">
  60. <view class="versionOnlineTitle box-pack-between">
  61. <text>体验版本</text>
  62. <view class="flex-y-center" style="font-weight: 400;" @click="bindPreview(tiyan_obj.id)">
  63. <text>预览</text>
  64. <text class="iconfont icongengduo"></text>
  65. </view>
  66. </view>
  67. <view class="versionOnlineTitleBg " style="background-color: #4395ff;">
  68. <view class="versionOnlineTitleNum ft32 box-pack-between">
  69. <text>{{tiyan_obj.user_version}}</text>
  70. <image class="versionCode" src="../../static/images/ali.png"></image>
  71. </view>
  72. <view class="versionOnlineTitleTime ft24">
  73. 在 {{tiyan_obj.create_time}} 提交上传
  74. </view>
  75. <view class="versionOnlineTitleTime ft24">
  76. 在 {{tiyan_obj.create_time}} 提交
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <uni-popup ref="popup" type="center">
  82. <view class="popup-content" v-if="type==1">
  83. <image :src="qrcodeImg"></image>
  84. <view class="save-btn flex-center" @click="upCode">
  85. 保存图片
  86. </view>
  87. </view>
  88. <view v-if="type==2" class="popup-content-desc">
  89. <scroll-view scroll-y="true" style="height: 100%;">
  90. {{desc}}
  91. </scroll-view>
  92. </view>
  93. </uni-popup>
  94. </view>
  95. </template>
  96. <script>
  97. // #ifdef MP-WEIXIN
  98. import saveImgToPhotosAlbum from "@/static/js/saveImgToPhotosAlbum.js";
  99. // #endif
  100. export default {
  101. data() {
  102. return {
  103. release_obj: {},
  104. tiyan_obj: {},
  105. shen_obj: {},
  106. qrcodeImg: '',
  107. type: 1,
  108. desc: ''
  109. }
  110. },
  111. onLoad() {
  112. this.releaseVenson();
  113. this.tiyanVenson();
  114. this.shenVenson();
  115. },
  116. methods: {
  117. // 版本回退
  118. versionBack() {
  119. //
  120. uni.showModal({
  121. content: "确定要版本回退",
  122. success: (r) => {
  123. if (r.confirm) {
  124. this.request({
  125. url: 'setting/rollback',
  126. data: {
  127. admin_id: uni.getStorageSync("admin_id"),
  128. }
  129. }).then(res => {
  130. if (res.code == 200) {
  131. uni.showModal({
  132. content: res.message,
  133. showCancel: false,
  134. success: (r) => {
  135. this.releaseVenson();
  136. this.tiyanVenson();
  137. this.shenVenson();
  138. }
  139. })
  140. }
  141. })
  142. }
  143. }
  144. })
  145. },
  146. //撤回审核2、撤回开发1、发布上线0
  147. bindWithdraw(id) {
  148. if (this.shen_obj.status == 0) {
  149. this.request({
  150. url: 'setting/onlineMiniVersion',
  151. data: {
  152. admin_id: uni.getStorageSync("admin_id"),
  153. id: id,
  154. }
  155. }).then(res => {
  156. if (res.code == 200) {
  157. uni.showToast({
  158. title: res.message
  159. })
  160. setTimeout(() => {
  161. this.shenVenson();
  162. }, 2000)
  163. }
  164. })
  165. }
  166. if (this.shen_obj.status == 1) {
  167. this.request({
  168. url: 'setting/cancelMiniVersion',
  169. data: {
  170. admin_id: uni.getStorageSync("admin_id"),
  171. id: id,
  172. }
  173. }).then(res => {
  174. if (res.code == 200) {
  175. uni.showToast({
  176. title: res.message
  177. })
  178. setTimeout(() => {
  179. this.shenVenson();
  180. }, 2000)
  181. }
  182. })
  183. }
  184. if (this.shen_obj.status == 2) {
  185. uni.showModal({
  186. title: '提示',
  187. content: "是否要撤回审核?",
  188. showCancel: true,
  189. cancelText: '取消',
  190. confirmText: '确定',
  191. success: r => {
  192. if (r.confirm) {
  193. this.request({
  194. url: 'setting/withdrawMiniVersion',
  195. data: {
  196. admin_id: uni.getStorageSync("admin_id"),
  197. id: id,
  198. }
  199. }).then(res => {
  200. if (res.code == 200) {
  201. uni.showToast({
  202. title: res.message
  203. })
  204. setTimeout(() => {
  205. this.shenVenson();
  206. }, 2000)
  207. }
  208. })
  209. }
  210. },
  211. fail: () => {},
  212. complete: () => {}
  213. });
  214. }
  215. },
  216. bindPreview(id) {
  217. this.request({
  218. url: 'setting/createMiniExperience',
  219. data: {
  220. admin_id: uni.getStorageSync("admin_id"),
  221. id,
  222. }
  223. }).then(res => {
  224. if (res.code == 200) {
  225. this.qrcodeImg = res.data.exp_qr_code_url;
  226. this.type = 1;
  227. this.$refs.popup.open();
  228. }
  229. })
  230. },
  231. bindRefuse(id) {
  232. this.request({
  233. url: 'setting/alipayjujue',
  234. data: {
  235. admin_id: uni.getStorageSync("admin_id"),
  236. id,
  237. }
  238. }).then(res => {
  239. if (res.code == 200) {
  240. this.desc = res.message;
  241. // uni.showModal({
  242. // title: '失败详情',
  243. // content:res.data.message,
  244. // showCancel: false,
  245. // cancelText: '',
  246. // confirmText: '',
  247. // success: res => {},
  248. // fail: () => {},
  249. // complete: () => {}
  250. // });
  251. this.type = 2;
  252. this.$refs.popup.open();
  253. }
  254. })
  255. },
  256. // 线上版本
  257. releaseVenson(e) {
  258. this.request({
  259. url: 'setting/release_venson',
  260. data: {
  261. admin_id: uni.getStorageSync("admin_id"),
  262. }
  263. }).then(res => {
  264. if (res.code == 200) {
  265. this.release_obj = res.data;
  266. }
  267. })
  268. },
  269. // 体验版本
  270. tiyanVenson(e) {
  271. this.request({
  272. url: 'setting/tiyan_venson',
  273. data: {
  274. admin_id: uni.getStorageSync("admin_id"),
  275. }
  276. }).then(res => {
  277. if (res.code == 200) {
  278. this.tiyan_obj = res.data;
  279. }
  280. })
  281. },
  282. // 审核版本
  283. shenVenson(e) {
  284. this.request({
  285. url: 'setting/shen_venson',
  286. data: {
  287. admin_id: uni.getStorageSync("admin_id"),
  288. }
  289. }).then(res => {
  290. if (res.code == 200) {
  291. this.shen_obj = res.data;
  292. }
  293. })
  294. },
  295. upCode(e) {
  296. // #ifdef H5
  297. uni.showModal({
  298. title: '提示',
  299. content: '请长按二维码图片进行保存',
  300. showCancel: false,
  301. confirmText: '好的',
  302. });
  303. // #endif
  304. // #ifdef MP-WEIXIN
  305. var url = this.qrcodeImg;
  306. console.log(url, "url")
  307. saveImgToPhotosAlbum.saveImgToPhotosAlbum(url).then((res) => {
  308. //成功的逻辑
  309. console.log(res, "保存成功")
  310. wx.showToast({
  311. title: '保存成功',
  312. icon: 'none',
  313. mask: true,
  314. })
  315. setTimeout(() => {
  316. this.$refs.popup.close();
  317. }, 2000)
  318. }).catch((err) => {
  319. console.log(err, "保存失败")
  320. if (err.errMsg === "saveImageToPhotosAlbum:fail:auth denied" ||
  321. err.errMsg === "saveImageToPhotosAlbum:fail auth deny" || err.errMsg ===
  322. "saveImageToPhotosAlbum:fail authorize no response") {
  323. // 这边微信做过调整,必须要在按钮中触发,因此需要在弹框回调中进行调用
  324. uni.showModal({
  325. title: '提示',
  326. content: '需要您设置授权保存相册',
  327. showCancel: false,
  328. success: modalSuccess => {
  329. uni.openSetting({
  330. success(settingdata) {
  331. console.log("settingdata", settingdata)
  332. if (settingdata.authSetting[
  333. 'scope.writePhotosAlbum']) {
  334. uni.showModal({
  335. title: '提示',
  336. content: '获取权限成功,再次点击图片即可保存',
  337. showCancel: false,
  338. })
  339. } else {
  340. uni.showModal({
  341. title: '提示',
  342. content: '获取权限失败,将无法保存到相册哦~',
  343. showCancel: false,
  344. })
  345. }
  346. },
  347. fail(failData) {
  348. console.log("failData", failData)
  349. },
  350. complete(finishData) {
  351. console.log("finishData", finishData)
  352. }
  353. })
  354. }
  355. })
  356. }
  357. // 失败后的逻辑
  358. })
  359. // #endif
  360. },
  361. }
  362. }
  363. </script>
  364. <style>
  365. .versionTip {
  366. color: red;
  367. font-size: 26rpx;
  368. padding-bottom: 20rpx;
  369. }
  370. .version {
  371. padding: 0 30rpx;
  372. }
  373. .versionOnline {
  374. padding-bottom: 50rpx;
  375. }
  376. .versionOnlineTitle {
  377. font-size: 30rpx;
  378. font-weight: 600;
  379. padding-bottom: 20rpx;
  380. }
  381. .versionOnlineTitleBg {
  382. background-color: #42b983;
  383. color: #FFFFFF;
  384. padding: 20rpx;
  385. border-radius: 10rpx;
  386. }
  387. .versionOnlineTitleBgShen {
  388. background-color: #4395ff;
  389. color: #FFFFFF;
  390. padding: 20rpx;
  391. border-radius: 10rpx;
  392. }
  393. .versionOnlineTitleNum {
  394. padding-bottom: 10rpx;
  395. font-weight: 600;
  396. }
  397. .versionOnlineTitleTime {
  398. padding-bottom: 10rpx;
  399. }
  400. .versionCode {
  401. width: 50rpx;
  402. height: 50rpx;
  403. }
  404. .popup-content-desc {
  405. background: #fff;
  406. text-align: center;
  407. width: 500rpx;
  408. height: 500rpx;
  409. word-break: break-all;
  410. padding: 25rpx;
  411. }
  412. .popup-content image {
  413. width: 350rpx;
  414. height: 350rpx;
  415. background: #fff;
  416. }
  417. .save-btn {
  418. width: 330rpx;
  419. height: 90rpx;
  420. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  421. opacity: 1;
  422. border-radius: 6rpx;
  423. margin: 0 auto;
  424. color: #FFFFFF;
  425. font-size: 30rpx;
  426. font-family: Source Han Sans CN;
  427. font-weight: 500;
  428. opacity: 1;
  429. margin-top: 30rpx;
  430. }
  431. .versionOnlineTitle-btn {
  432. background-color: #42b983;
  433. color: #ffffff;
  434. font-weight: normal;
  435. line-height: 60rpx;
  436. /* padding: 0 32rpx; */
  437. min-width: 180rpx;
  438. font-size: 26rpx;
  439. letter-spacing: 0;
  440. border-radius: 6rpx;
  441. box-sizing: border-box;
  442. border: none;
  443. cursor: pointer;
  444. text-align: center;
  445. margin-right: 20rpx;
  446. }
  447. </style>