Examples of code I've written in PHP, Javascript, SCSS, etc.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

72 lignes
2.0 KiB

  1. <template>
  2. <div id="overlay" v-if="selected">
  3. <img @click="$emit('close')" class="cancel icon"
  4. src="../../images/cancel-icon2.svg" alt=""/>
  5. <div class="overlay-item">
  6. <img v-if="selected.service.site == 'youtube'" class="icon"
  7. src="../../images/youtube-icon.svg" alt=""/>
  8. <img v-if="selected.service.site == 'instagram'" class="icon"
  9. src="../../images/instagram-icon.svg" alt=""/>
  10. <img v-if="selected.service.site == 'twitter'" class="icon"
  11. src="../../images/twitter.svg" alt=""/>
  12. <img v-if="selected.service.site == 'tiktok'" class="icon"
  13. src="../../images/tik-tok.svg" alt=""/>
  14. <h3>{{selected.service.name}}</h3>
  15. <div class="details">
  16. <ul>
  17. <li><b>Status:</b> <span>{{selected.status.charAt(0).toUpperCase() +
  18. selected.status.slice(1)}}</span></li>
  19. <li><b>Quantity:</b> <span>{{selected.quantity}}</span></li>
  20. <li><b>Remaining:</b> <span>{{selected.remaining}}</span></li>
  21. <li><b>URL:</b> <span>{{selected.url}}</span></li>
  22. </ul>
  23. </div>
  24. <div v-if="selected.status == 'processing' || selected.status ==
  25. 'error'" class="change-url">
  26. <h4>URL</h4>
  27. <div><input v-model="url" type="url" id="url"></div>
  28. <button @click="saveURL" :disabled="loading">Save
  29. <loading-icon v-if="loading"></loading-icon></button>
  30. <p id="overlay-error">{{errorMessage}}</p>
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import LoadingIcon from '../icons/loading.vue'
  37. function saveURL() {
  38. fetch('/panel/save-url', {
  39. method: 'POST',
  40. headers: {'Content-Type': 'application/json',
  41. 'Accept': 'application/json',
  42. 'X-XSRF-TOKEN': this.token},
  43. body: JSON.stringify({'url': this.url, 'order': this.selected.id})
  44. }).then(response => {
  45. if (response.ok) {
  46. this.errorMessage = 'Saved'
  47. this.$emit('changeUrl', this.url)
  48. } else {
  49. this.errorMessage = 'An error occured'
  50. }
  51. })
  52. }
  53. export default {
  54. data() {
  55. return {loading: false, errorMessage: '', url: this.selected.url}
  56. },
  57. components: {LoadingIcon},
  58. methods: {saveURL},
  59. props: ['selected', 'token'],
  60. emits: ['changeUrl', 'close']
  61. }
  62. </script>