weiChat.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <view class="content">
  3. <image :src="'data:image/jpeg;base64,' + imgUrl" mode="aspectFit" />
  4. </view>
  5. </template>
  6. <script>
  7. export default {
  8. data() {
  9. return {
  10. imgUrl: "",
  11. };
  12. },
  13. created() {
  14. this.getWeiChat();
  15. },
  16. methods: {
  17. getWeiChat() {
  18. uni.request({
  19. url: "https://jtishfw.ncjti.edu.cn/yinxin/ncjtSecurityManagement/getWeichat",
  20. data: "",
  21. header: {
  22. Accept: "text/plain",
  23. },
  24. method: "POST",
  25. sslVerify: true,
  26. success: ({ data, statusCode, header }) => {
  27. if (statusCode == 200) {
  28. // console.log(data);
  29. // console.log(data.replace(/[\r\n]/g, ""));
  30. var url = JSON.parse(data.replace(/[\r\n]/g, ""));
  31. // console.log(url);
  32. this.imgUrl = url.weichat;
  33. // console.log(this.imgUrl);
  34. }
  35. },
  36. fail: (error) => {},
  37. });
  38. },
  39. },
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. .content {
  44. width: 100%;
  45. height: 100%;
  46. image {
  47. width: 750rpx;
  48. height: 1207rpx;
  49. }
  50. }
  51. </style>