authorization.vue 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button style="float:right;" type="primary" size="small" :disabled="resetSubmit" icon="el-icon-refresh" @click="resetPage">刷新</el-button>
  6. </div>
  7. <div class="app-container" id="winxin-auth-box">
  8. <div class="filter-container" style="margin-top: 10px;margin-left: 5px ">
  9. <div v-if="authData.authorizer_status==1">
  10. <div class="bind-title-box">
  11. <span class="bind-title">您已绑定公众号,如需更换绑定公众号,请点击下面按钮</span>
  12. </div>
  13. <el-button type="warning" @click="getAuthUrl" >更换绑定公众号</el-button>
  14. <div class="bind-massage-box">
  15. <span>
  16. 授权公众号:{{authData.authorizer_nick_name}}
  17. <!--授权方公众号类型,0代表订阅号,1代表由历史老帐号升级后的订阅号,2代表服务号-->
  18. <!-- authorizer_service_type_info -->
  19. </span>
  20. </div>
  21. </div>
  22. <div v-else>
  23. <div class="bind-title-box">
  24. <span class="bind-title">您尚未绑定公众号</span>
  25. </div>
  26. <el-button type="warning" @click="getAuthUrl" >已有公众号,立刻绑定</el-button>
  27. <div class="bind-massage-box">
  28. <span>
  29. 如果还没有公众号,需要先在微信公众号平台进行申请。 去
  30. <a href="https://mp.weixin.qq.com/" title="申请微信公众号">申请>></a>
  31. </span>
  32. </div>
  33. </div>
  34. </div>
  35. <div style="height:20px">&nbsp;</div>
  36. <div class="dataTitle title-15">授权公众号后可以使用什么功能?</div>
  37. <div class="dataBody">
  38. <p>1.微信公众号的菜单设置</p>
  39. <p>2.微网站分享功能</p>
  40. </div>
  41. <div style="height:20px">&nbsp;</div>
  42. <div class="dataTitle title-7">授权有风险吗?</div>
  43. <div class="dataBody">
  44. <p>没有,酷医云使用了微信平台提供的官方授权接口,是非常安全的。</p>
  45. </div>
  46. <div style="height:20px">&nbsp;</div>
  47. <div class="dataTitle title-23">我的公众号已经授权了其它的第三方平台,怎么办?</div>
  48. <div class="dataBody">
  49. <p>没问题,秀米的授权不会影响任何第三方平台,也不影响现有的任何自定义菜单、开发模式、自定义回复等功能。</p>
  50. </div>
  51. <div style="height:20px">&nbsp;</div>
  52. <div class="dataTitle title-12">如何取消给酷医云的授权?</div>
  53. <div class="dataBody">
  54. <p>公众号取消授权,进入微信后台,点击“设置-公众号设置-授权管理”,就可以看到酷医云的授权,并且解除授权了。</p>
  55. </div>
  56. </div>
  57. <el-dialog
  58. title="授权二维码"
  59. :visible.sync="centerDialogVisible"
  60. width="30%"
  61. center>
  62. <div style="text-align:center;">
  63. <div><span>请用微信扫描下方二维码</span></div>
  64. <div id="mpwechat-auth-qrcode" ref="qrcode" ></div>
  65. <div><span>在手机完成授权后,点击右上角的刷新按钮</span></div>
  66. </div>
  67. </el-dialog>
  68. </div>
  69. </template>
  70. <script>
  71. import BreadCrumb from "../components/bread-crumb";
  72. import QRCode from 'qrcodejs2' // 引入qrcode
  73. import {GetAuthorizationInfo,GetAuthUrl} from "@/api/mpwechat/mpwechat";
  74. export default {
  75. name: "authorization",
  76. components: {
  77. BreadCrumb,
  78. QRCode,
  79. },
  80. data() {
  81. return {
  82. crumbs: [
  83. { path: false, name: "系统设置" },
  84. { path: false, name: "公众号授权" }
  85. ],
  86. showAuthButton:true,
  87. centerDialogVisible:false,
  88. resetSubmit:false,
  89. authData: {
  90. id: 0,
  91. user_org_id: 0,
  92. authorizer_appid: "",
  93. authorizer_access_token: "",
  94. authorizer_refresh_token: "",
  95. authorizer_jsapi_ticket: "",
  96. authorizer_funcscope_category: "",
  97. authorizer_nick_name: "",
  98. authorizer_head_img: "",
  99. authorizer_service_type_info: 0,
  100. authorizer_verify_type_info: 0,
  101. authorizer_user_name: "",
  102. authorizer_principal_name: "",
  103. authorizer_business_info: "",
  104. authorizer_qrcode_url: "",
  105. created_time: "",
  106. updated_time: "",
  107. authorizer_status: 1
  108. }
  109. };
  110. },
  111. methods: {
  112. getAuthUrl:function(){
  113. // this.showAuthButton = false;
  114. GetAuthUrl().then(response=>{
  115. var res = response.data;
  116. if (res.state===1) {
  117. var url = res.data.url;
  118. this.centerDialogVisible = true;
  119. this.$nextTick (function () {
  120. this.qrcode(url);
  121. })
  122. }else {
  123. this.$message.error(res.msg);
  124. }
  125. }).catch(e=>{
  126. // this.showAuthButton = true;
  127. });
  128. },
  129. qrcode(url) {
  130. document.getElementById('mpwechat-auth-qrcode').innerHTML = ''
  131. let qrcode = new QRCode('mpwechat-auth-qrcode', {
  132. width: 150,
  133. height: 150,
  134. text: url,
  135. colorDark : "#000",
  136. colorLight : "#fff",
  137. })
  138. },
  139. resetPage(){
  140. this.GetAuthorizationInfo();
  141. },
  142. GetAuthorizationInfo:function(){
  143. GetAuthorizationInfo().then(response=>{
  144. var res = response.data;
  145. if(res.state===1) {
  146. if(res.data.authorization) {
  147. this.authData = res.data.authorization;
  148. }
  149. }else {
  150. this.$message.error(res.msg);
  151. }
  152. }).catch(e=>{});
  153. },
  154. },
  155. created() {
  156. this.GetAuthorizationInfo();
  157. },
  158. computed:{
  159. mpTypeName:function(){
  160. return 'xx';
  161. }
  162. },
  163. };
  164. </script>
  165. <style scoped>
  166. #winxin-auth-box .bind-title-box {
  167. margin-bottom: 20px;
  168. }
  169. #winxin-auth-box .bind-title {
  170. color: #000;
  171. font-size: 24px;
  172. }
  173. #winxin-auth-box .bind-massage-box {
  174. margin-top: 10px;
  175. color: #303133;
  176. font-size: 14px;
  177. }
  178. #winxin-auth-box .bind-massage-box a,#winxin-auth-box .bind-massage-box a:visited,#winxin-auth-box .bind-massage-box a:active {
  179. color: #409eff;
  180. }
  181. #winxin-auth-box .bind-massage-box a:hover {
  182. color: #409eff;
  183. text-decoration: underline;
  184. }
  185. #winxin-auth-box .dataTitle {
  186. color: #303133;
  187. font-size: 14px;
  188. border-bottom: 1px #409eff solid;
  189. height: 36px;
  190. line-height: 36px;
  191. margin: 0 0 20px 0;
  192. position: relative;
  193. }
  194. #winxin-auth-box .dataTitle::before {
  195. position: absolute;
  196. left: 0;
  197. bottom: -1px;
  198. content: "";
  199. height: 3px;
  200. background: #409eff;
  201. }
  202. #winxin-auth-box .title-15::before {
  203. width: 200px;
  204. }
  205. #winxin-auth-box .title-12::before {
  206. width: 158px;
  207. }
  208. #winxin-auth-box .title-7::before {
  209. width: 88px;
  210. }
  211. #winxin-auth-box .title-23::before {
  212. width: 312px;
  213. }
  214. #winxin-auth-box .dataBody {
  215. color: #303133;
  216. font-size: 14px;
  217. line-height: 18px;
  218. }
  219. #mpwechat-auth-qrcode{
  220. width: 150px;
  221. margin: 5px auto;
  222. }
  223. /*.app-container .cell.clearfix .time ul li {*/
  224. /*float: left;*/
  225. /*list-style: none;*/
  226. /*cursor: pointer;*/
  227. /*padding: 6px 20px;*/
  228. /*color: #606266;*/
  229. /*border-radius: 4px;*/
  230. /*margin: 0 8px 0 0;*/
  231. /*font-size: 14px;*/
  232. /*text-align: center;*/
  233. /*}*/
  234. </style>