抖音小程序发布平台
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

712 linhas
20 KiB

  1. <template>
  2. <div class="layout">
  3. <div class="title">
  4. <h3>授权链接</h3>
  5. </div>
  6. <div class="content">
  7. <a href="/T/wt_auth/goto_auth_url" target="_blank">获取授权(1)</a>
  8. </div>
  9. <div class="layout-content">
  10. <el-form :inline="true" :model="ruleForm" ref="ruleForm" class="demo-form-inline" label-position="right">
  11. <el-form-item label="授权状态" prop="authorizationStatus" class="fx_send">
  12. <el-select v-model="ruleForm.authorizationStatus" placeholder="请选择" clearable>
  13. <el-option v-for="(item,index) in authorizationStatus" :key="index" :value="item.value" :label="item.name"></el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="小程序名称" prop="name" class="fx_title">
  17. <el-input v-model="ruleForm.name" placeholder="请输入" clearable></el-input>
  18. </el-form-item>
  19. <el-form-item label="小程序类型" prop="type" class="fx_send">
  20. <el-select v-model="ruleForm.type" placeholder="请选择" clearable>
  21. <el-option v-for="(item,index) in appType" :key="index" :value="item.value" :label="item.name"></el-option>
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item>
  25. <el-button class="hoverBtn" type="primary" icon="el-icon-search" size="medium" @click.stop="search"></el-button>
  26. </el-form-item>
  27. <el-form-item>
  28. <el-button class="hoverBtn" type="primary" @click.stop="batchBasicSet">批量基础配置(2)</el-button>
  29. </el-form-item>
  30. <el-form-item>
  31. <el-button class="hoverBtn" type="primary" @click.stop="batchExtendSet">批量扩展配置</el-button>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-button class="hoverBtn" type="primary" @click.stop="getAuthorizerList">拉取已授权帐号信息</el-button>
  35. </el-form-item>
  36. </el-form>
  37. </div>
  38. <table-list :ref="tk" :options="optionsTable"></table-list>
  39. <choose-app :ref="tKey" :t-key="tKey" :cb="getShopCb"></choose-app>
  40. <extend :ref="tKey1" :t-key="tKey1"></extend>
  41. <getcategory :ref="tKey2" :t-key="tKey2"></getcategory>
  42. <template-msg :ref="tKey3" :t-key="tKey3"></template-msg>
  43. </div>
  44. </template>
  45. <script>
  46. import { mapState, mapActions } from "vuex";
  47. import TableList from "../../core/comps/table/tableList.vue";
  48. import { CacheData } from "./../../service/couponData/data.js";
  49. import { configUrl } from "./../../utils/config.js";
  50. import alertDialog from "../../core/comps/input/alertDialog.vue";
  51. import extend from "./../../components/marketing/businessComp/extend.vue";
  52. import templateMsg from "./../../components/marketing/businessComp/templateMsg.vue";
  53. import chooseApp from "./../../components/marketing/businessComp/chooseApp.vue";
  54. import getcategory from "./../../components/marketing/businessComp/getcategory.vue";
  55. export default {
  56. name: "HomePage",
  57. components: {
  58. TableList,
  59. alertDialog,
  60. extend,
  61. chooseApp,
  62. getcategory,
  63. templateMsg
  64. },
  65. data() {
  66. return {
  67. listNavKey: "homePageNavKey",
  68. tk: "homePageKey",
  69. tKey: "extendApp",
  70. tKey1: "extend",
  71. tKey2: "getcategory",
  72. tKey3: "templateMsgList",
  73. dialogVisible: false,
  74. privacySetting:"",
  75. latestAuditstatus:"",
  76. ruleForm: {
  77. authorizationStatus: "",
  78. type: "",
  79. name: ""
  80. },
  81. optionsTable: {
  82. actions: [
  83. {
  84. key: "edit",
  85. val: "找回授权码",
  86. action: this.getBack,
  87. }
  88. // {
  89. // key: "edit",
  90. // val: "配置隐私保护指引",
  91. // action: this.setprivacysetting,
  92. // show: item => {
  93. // return (item.type == 1 || item.type == 2)&&item.privacySettingStatus!=0 ? true : false;
  94. // }
  95. // },
  96. // {
  97. // key: "edit",
  98. // val: "查询隐私保护指引",
  99. // action: this.getPrivacySetting,
  100. // show: item => {
  101. // return (item.type == 1 || item.type == 2)&&item.privacySettingStatus==0 ? true : false;
  102. // }
  103. // },
  104. // // {
  105. // // key: "edit",
  106. // // val: "查询最新审核状态",
  107. // // action: this.getLatestAuditstatus,
  108. // // },
  109. // {
  110. // key: "edit",
  111. // val: "基础",
  112. // action: this.searchFigure,
  113. // show: item => {
  114. // return item.type == 1 || item.type == 2 ? true : false;
  115. // }
  116. // },
  117. // {
  118. // key: "edit",
  119. // val: "扩展(3)",
  120. // action: this.conFigure,
  121. // show: item => {
  122. // return item.type == 1 || item.type == 2 ? true : false;
  123. // }
  124. // },
  125. // {
  126. // key: "edit",
  127. // val: "类目",
  128. // action: this.getCategory,
  129. // show: item => {
  130. // return item.type == 1 || item.type == 2 ? true : false;
  131. // }
  132. // },
  133. // {
  134. // key: "delete",
  135. // val: "模板列表",
  136. // action: this.templateList,
  137. // show: item => {
  138. // return item.type == 1 || item.type == 2 ? true : false;
  139. // }
  140. // },
  141. // {
  142. // key: "edit",
  143. // val: "创建O",
  144. // action: this.createPlatform,
  145. // show: item => {
  146. // return (item.type == 3)&&(!item.openAppid) || (item.type == 4)&&(!item.openAppid) ? true : false;
  147. // }
  148. // },
  149. // {
  150. // key: "bind",
  151. // val: "绑定O",
  152. // action: this.bindPlatform,
  153. // show: item => {
  154. // return (item.type == 1)&&(!item.openAppid) || (item.type == 2)&&(!item.openAppid) ? true : false;
  155. // }
  156. // },
  157. // {
  158. // key: "unbind",
  159. // val: "解绑O",
  160. // action: this.unbindPlatform,
  161. // show: item => {
  162. // return item.type == 1 || item.type == 2 ? true : false;
  163. // }
  164. // },
  165. // {
  166. // key: "edit",
  167. // val: "获取O",
  168. // action: this.getPlatform,
  169. // show: item => {
  170. // return (item.type == 1)&&(!item.openAppid) || (item.type == 2)&&(!item.openAppid) ? true : false;
  171. // }
  172. // },
  173. // {
  174. // key: "edit",
  175. // val: "重置Quota",
  176. // action: this.clearQuota,
  177. // show: item => {
  178. // return item.type == 3 || item.type == 4 ? true : false;
  179. // }
  180. // }
  181. ],
  182. map: [
  183. { key: "headImg", val: "小程序图标", etype: "img" },
  184. { key: "name", val: "小程序名称" },
  185. { key: "type", val: "类型", convert: this.cAppType },
  186. { key: "currentVersion", val: "当前发布版本" },
  187. { key: "authorizerAppid", val: "appid" },
  188. {
  189. key: "authorizationStatus",
  190. val: "授权状态",
  191. convert: this.authStatus
  192. },
  193. { key: "baseStatus", val: "基础版本状态", convert: this.baseStatus },
  194. {
  195. key: "domainStatus",
  196. val: "服务器域名状态",
  197. convert: this.domainStatus
  198. },
  199. {
  200. key: "webdomainStatus",
  201. val: "业务域名状态",
  202. convert: this.webdomainStatus
  203. },
  204. {
  205. key: "templateStatus",
  206. val: "模板消息状态",
  207. convert: this.templateStatus
  208. },
  209. {
  210. key: "privacySettingStatus",
  211. val: "用户隐私状态",
  212. convert: this.setPrivacySettingStatus
  213. },
  214. {
  215. key: "openAppid",
  216. val: "开放平台AppId"
  217. }
  218. ],
  219. getUrl: () => {
  220. let type = this.ruleForm.type;
  221. let authorizationStatus = this.ruleForm.authorizationStatus;
  222. let name = this.ruleForm.name;
  223. return (
  224. configUrl.weappList +
  225. "?type=" +
  226. type +
  227. "&authorizationStatus=" +
  228. authorizationStatus +
  229. "&name=" +
  230. name
  231. );
  232. },
  233. pageOption: {
  234. sizeKey: "pageSize",
  235. indexKey: "pageNum",
  236. index: 1,
  237. size: 10
  238. },
  239. analysis: res => {
  240. return {
  241. data: res.data.list,
  242. count: res.data.total
  243. };
  244. }
  245. }
  246. };
  247. },
  248. computed: {
  249. appType: () => {
  250. return CacheData.appType;
  251. },
  252. authorizationStatus: () => {
  253. return CacheData.authorizationStatus;
  254. },
  255. ...mapState({
  256. topNav: state => state.topNav.data, //将 this.topNav 映射为 this.$store.topNav.data
  257. channels: state => state.couponStore.channels,
  258. navigationInfo: state => state.topNav.navigationInfo
  259. })
  260. },
  261. methods: {
  262. //找回授权码
  263. getBack(item){
  264. this.getFetch(`T/wt_auth/retrieve?appId=${item.authorizerAppid}`).then(res=>{
  265. this.$message.success("找回成功!")
  266. }).catch(err=>{
  267. this.$message.error(err.message?err.message:err.data)
  268. })
  269. },
  270. //
  271. setprivacysetting(item){
  272. console.log(item);
  273. this.postFetch("/O/weappSet/setprivacysetting",{appId:item.authorizerAppid}).then(res=>{
  274. console.log(res,"res");
  275. this.search()
  276. }).catch(error => {
  277. this.$message({
  278. type: "error",
  279. message: error.data
  280. });
  281. });
  282. },
  283. getPrivacySetting(item){
  284. this.getFetch(`/O/weappSet/getPrivacySetting?appId=${item.authorizerAppid}`).then(res=>{
  285. this.privacySetting = JSON.stringify(res.data)
  286. this.$confirm( this.privacySetting,"查询隐私保护指引",{
  287. confirmButtonText: '确定',
  288. cancelButtonText: '取消',
  289. type: 'warning'
  290. }).then(() => {
  291. this.$message({
  292. type: 'success',
  293. message: '确定'
  294. });
  295. }).catch(() => {
  296. this.$message({
  297. type: 'info',
  298. message: '取消'
  299. });
  300. });
  301. }).catch(error => {
  302. this.$message({
  303. type: "error",
  304. message: error.data
  305. });
  306. });
  307. },
  308. getLatestAuditstatus(item){
  309. this.getFetch(`/O/weappCode/getLatestAuditstatus?appId=${item.authorizerAppid}`).then(res=>{
  310. this.latestAuditstatus = JSON.stringify(res.data)
  311. this.$confirm( this.latestAuditstatus,"查询隐私保护指引",{
  312. confirmButtonText: '确定',
  313. cancelButtonText: '取消',
  314. type: 'warning'
  315. }).then(() => {
  316. this.$message({
  317. type: 'success',
  318. message: '确定'
  319. });
  320. }).catch(() => {
  321. this.$message({
  322. type: 'info',
  323. message: '取消'
  324. });
  325. });
  326. }).catch(error => {
  327. this.$message({
  328. type: "error",
  329. message: error.data
  330. });
  331. });
  332. },
  333. //拉取当前所有已授权的帐号基本信息
  334. getAuthorizerList: function() {
  335. this.getFetch(configUrl.getAuthorizerList)
  336. .then(res => {
  337. console.log(res);
  338. this.$message({
  339. type: "success",
  340. message: "拉取当前所有已授权的帐号基本信息成功"
  341. });
  342. })
  343. .catch(error => {
  344. this.$message({
  345. type: "error",
  346. message: error.data
  347. });
  348. });
  349. },
  350. //获得模板列表
  351. templateList(item) {
  352. console.log(item);
  353. let parmers = JSON.stringify({
  354. appId: item.authorizerAppid
  355. });
  356. this.$refs[this.tKey3].openDialog(parmers);
  357. },
  358. //批量扩展配置
  359. batchExtendSet() {
  360. let parmers = JSON.stringify({
  361. flag: "extendJSON"
  362. });
  363. this.$refs[this.tKey1].openDialog(parmers);
  364. },
  365. //小程序的类型
  366. cAppType(col, item) {
  367. let res = CacheData.appType.filter(e => {
  368. return e.value == item.type;
  369. })[0];
  370. if (res) {
  371. return res.name;
  372. } else {
  373. return "小程序类型无效";
  374. }
  375. return res.name;
  376. },
  377. search: function() {
  378. let tk = this.$refs[this.tk];
  379. tk.search(tk.getParams().index);
  380. },
  381. /***
  382. * createPlatform 创建开放平台
  383. * bindPlatform 绑定开放平台
  384. * unbindPlatform 解绑开放平台
  385. */
  386. createPlatform(item) {
  387. let appId = item.authorizerAppid;
  388. this.getFetch(configUrl.createOpenPlatform + "?appId=" + appId)
  389. .then(res => {
  390. console.log(res);
  391. this.$message({
  392. type: "success",
  393. message: "创建微信开放平台成功"
  394. });
  395. })
  396. .catch(error => {
  397. this.$message({
  398. type: "error",
  399. message: error.data
  400. });
  401. });
  402. },
  403. // 绑定开放平台
  404. bindPlatform(item) {
  405. console.log(item);
  406. this.$prompt("请输入openAppId", "提示", {
  407. confirmButtonText: "确定",
  408. cancelButtonText: "取消",
  409. inputPattern: /\S/,
  410. inputErrorMessage: "openAppId不能为空"
  411. })
  412. .then(({ value }) => {
  413. console.log(value);
  414. let appId = item.authorizerAppid;
  415. let openAppId = value;
  416. this.getFetch(
  417. configUrl.bindOpenPlatform +
  418. "?appId=" +
  419. appId +
  420. "&openAppId=" +
  421. openAppId
  422. )
  423. .then(res => {
  424. console.log(res);
  425. this.$message({
  426. type: "success",
  427. message: "绑定微信开放平台成功"
  428. });
  429. })
  430. .catch(error => {
  431. console.log(error);
  432. this.$message({
  433. type: "error",
  434. message: error.data
  435. });
  436. });
  437. })
  438. .catch(() => {
  439. this.$message({
  440. type: "error",
  441. message: "取消输入"
  442. });
  443. });
  444. },
  445. //解绑开放平台
  446. unbindPlatform(item) {
  447. console.log(item);
  448. this.$prompt("请输入openAppId", "提示", {
  449. confirmButtonText: "确定",
  450. cancelButtonText: "取消",
  451. inputPattern: /\S/,
  452. inputErrorMessage: "openAppId不能为空"
  453. })
  454. .then(({ value }) => {
  455. console.log(value);
  456. let appId = item.authorizerAppid;
  457. let openAppId = value;
  458. this.getFetch(
  459. configUrl.unbindOpenPlatform +
  460. "?appId=" +
  461. appId +
  462. "&openAppId=" +
  463. openAppId
  464. )
  465. .then(res => {
  466. console.log(res);
  467. this.$message({
  468. type: "success",
  469. message: "解绑微信开放平台成功"
  470. });
  471. })
  472. .catch(error => {
  473. console.log(error);
  474. this.$message({
  475. type: "error",
  476. message: error.data
  477. });
  478. });
  479. })
  480. .catch(() => {
  481. this.$message({
  482. type: "error",
  483. message: "取消输入"
  484. });
  485. });
  486. },
  487. getPlatform(item) {
  488. let appId = item.authorizerAppid;
  489. let openAppId = "";
  490. this.getFetch(configUrl.getOpenPlatform + "?appId=" + appId)
  491. .then(res => {
  492. console.log(res);
  493. this.$message({
  494. type: "success",
  495. message: "获取微信开放平台Appid成功"
  496. });
  497. })
  498. .catch(error => {
  499. this.$message({
  500. type: "error",
  501. message: error.data
  502. });
  503. });
  504. },
  505. clearQuota(item) {
  506. let appId = item.authorizerAppid;
  507. let openAppId = "";
  508. this.getFetch(configUrl.clearQuota + "?appId=" + appId)
  509. .then(res => {
  510. console.log(res);
  511. this.$message({
  512. type: "success",
  513. message: "重置公众号Quota成功"
  514. });
  515. })
  516. .catch(error => {
  517. this.$message({
  518. type: "error",
  519. message: error.data
  520. });
  521. });
  522. },
  523. //选择小程序
  524. batchBasicSet(item) {
  525. let parmers = {
  526. type: this.ruleForm.type,
  527. from: "fromHomePage"
  528. };
  529. this.$refs[this.tKey].openDialog(JSON.stringify(parmers));
  530. },
  531. //选择小程序
  532. getShopCb(items) {
  533. this.shopTableData = [];
  534. items.data.map((item, index) => {
  535. let haveIf = false;
  536. this.shopTableData.map((item01, index01) => {
  537. if (item.id == item01.id) {
  538. haveIf = true;
  539. }
  540. });
  541. if (haveIf == false) {
  542. item.merchantName = item.name;
  543. item.merchantLinkPhone = item.linkPhone;
  544. this.shopTableData.push(item);
  545. }
  546. });
  547. },
  548. //小程序授权状态
  549. authStatus(col, item) {
  550. let res = CacheData.authorizationStatus.filter(e => {
  551. return e.value == item.authorizationStatus;
  552. })[0];
  553. if (res) {
  554. return res.name;
  555. } else {
  556. return "小程序授权状态无效";
  557. }
  558. return res.name;
  559. },
  560. //基础配置
  561. baseStatus(col, item) {
  562. let res = CacheData.baseStatus.filter(e => {
  563. return e.value == item.baseStatus;
  564. })[0];
  565. if (res) {
  566. return res.name;
  567. } else {
  568. return "暂无基础配置";
  569. }
  570. return res.name;
  571. },
  572. //服务器域名配置
  573. domainStatus(col, item) {
  574. let res = CacheData.domainStatus.filter(e => {
  575. return e.value == item.domainStatus;
  576. })[0];
  577. if (res) {
  578. return res.name;
  579. } else {
  580. return "暂无配置服务器域名";
  581. }
  582. return res.name;
  583. },
  584. //配置业务域名
  585. webdomainStatus(col, item) {
  586. let res = CacheData.webdomainStatus.filter(e => {
  587. return e.value == item.webdomainStatus;
  588. })[0];
  589. if (res) {
  590. return res.name;
  591. } else {
  592. return "暂无配置业务域名";
  593. }
  594. return res.name;
  595. },
  596. //小程序用户隐私状态
  597. setPrivacySettingStatus(col,item){
  598. let sing = ""
  599. if(!item.privacySettingStatus&&item.privacySettingStatus!=0){
  600. sing = "暂无配置信息"
  601. }else if(item.privacySettingStatus===0){
  602. sing = "已设置"
  603. }else{
  604. sing = "设置失败"
  605. };
  606. return sing
  607. },
  608. //小程序模板消息
  609. templateStatus(col, item) {
  610. let res = CacheData.templateStatus.filter(e => {
  611. return e.value == item.templateStatus;
  612. })[0];
  613. if (res) {
  614. return res.name;
  615. } else {
  616. return "暂无配置模板消息";
  617. }
  618. return res.name;
  619. },
  620. //查看基础配置
  621. searchFigure(item) {
  622. let parmers = JSON.stringify({
  623. flag: "basicFigure",
  624. appId: item.authorizerAppid
  625. });
  626. this.$refs[this.tKey1].openDialog(parmers);
  627. },
  628. //查看小程序类目
  629. getCategory(item) {
  630. console.log(item);
  631. let parmers = JSON.stringify({
  632. appId: item.authorizerAppid
  633. });
  634. this.$refs[this.tKey2].openDialog(parmers);
  635. },
  636. //扩展配置
  637. conFigure(item) {
  638. let parmers = JSON.stringify({
  639. flag: "conFigure",
  640. appId: item.authorizerAppid
  641. });
  642. this.$refs[this.tKey1].openDialog(parmers);
  643. }
  644. }
  645. };
  646. </script>
  647. <style scoped>
  648. .tableContainer {
  649. width: 100%;
  650. margin-top: 30px;
  651. }
  652. .title {
  653. margin-bottom: 10px;
  654. }
  655. .title h3 {
  656. font-size: 18px;
  657. font-weight: bold;
  658. }
  659. .content span {
  660. font-size: 15px;
  661. }
  662. .content span:nth-of-type(1) {
  663. color: #19ce00;
  664. font-weight: bold;
  665. margin-right: 20px;
  666. }
  667. .content span:nth-of-type(2) {
  668. margin-right: 20px;
  669. cursor: pointer;
  670. }
  671. .layout-content {
  672. margin-top: 20px;
  673. background: #f6f6f6;
  674. padding: 29px 20px 0;
  675. border-radius: 6px;
  676. }
  677. .el-select-dropdown__item {
  678. display: block;
  679. }
  680. </style>
  681. <style>
  682. .el-message-box {
  683. width: 1000px;
  684. padding: 0 0 20px;
  685. }
  686. .el-message-box img {
  687. width: 200px;
  688. display: block;
  689. margin: 0 auto;
  690. }
  691. .el-message-box__header {
  692. text-align: center;
  693. font-size: 14px !important;
  694. }
  695. .el-message-box__btns button {
  696. width: 100px !important;
  697. }
  698. .el-message-box__title {
  699. font-size: 16px;
  700. }
  701. </style>