Examples of code I've written in PHP, Javascript, SCSS, etc.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

vor 3 Jahren
vor 3 Jahren
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <template v-if="!loading">
  3. <sidebar :role="user.role" :active="active"></sidebar>
  4. <transition name="fade" mode="out-in">
  5. <div v-if="active === ''" id="main">
  6. <section class="welcome-pane"><h3>Welcome, {{user.name}}!</h3></section>
  7. <section class="credits-pane"><img src="../../images/coin-stack.svg"
  8. alt="wallet" class="icon"/><p>Credits:
  9. {{(user.credits/100).toLocaleString('en')}}</p></section>
  10. <section class="alerts-pane"><h4>News and Announcements</h4>
  11. <p>We've just launched. Thanks for joining us! Some features are still
  12. being tested. If you experience a delay in credits being added to your
  13. account, please wait 24 hours before contacting support@trendplays.com.</p>
  14. </section>
  15. <section class="recent-pane"><h4>Recent Activity</h4>
  16. <table>
  17. <thead><th>Date</th><th>Name</th><th>Status</th></thead>
  18. <tbody>
  19. <tr v-bind:key='order.id' v-for='order in orders.slice(0, 10)'>
  20. <template v-if="order.status != 'pending'">
  21. <td>{{order.updated_at}}</td>
  22. <td>{{order.service.name}}</td>
  23. <td :class="order.status"
  24. class="status"><span>{{order.status.charAt(0).toUpperCase() +
  25. order.status.slice(1)}}</span></td>
  26. </template>
  27. </tr>
  28. </tbody>
  29. </table>
  30. </section>
  31. </div>
  32. <past-orders :token="token" :orders="orders" v-else-if="active === '#orders'"
  33. id="main">
  34. </past-orders>
  35. <new-order :preferred="user.payment_method" :token="token" :active="active"
  36. :credits="user.credits" v-else-if="active ===
  37. '#new-order' || active === '#credits'" id="main" @update-user='getUser'
  38. @update-orders='getOrders'>
  39. </new-order>
  40. <div id="main" v-else-if="active === '#exit'">
  41. <section class="logout-pane">
  42. <h3>Are you sure you want to logout?</h3>
  43. <a href="/logout">Logout</a>
  44. </section>
  45. </div>
  46. <settings :token="token" :user="user" class="settings-page" id="main"
  47. v-else-if="active === '#settings'">
  48. </settings>
  49. <transaction-end @purchase-complete="getUser" :token="token" :user="user"
  50. :active="active" v-else-if="active ==
  51. '#transaction-complete' || active == '#transaction-failed'">
  52. </transaction-end>
  53. <support v-else-if="active == '#support'" :user="user" :token="token"></support>
  54. </transition>
  55. </template>
  56. </template>
  57. <script>
  58. import Sidebar from './sidebar.vue'
  59. import Settings from './settings.vue'
  60. import PastOrders from './orders.vue'
  61. import NewOrder from './services.vue'
  62. import TransactionEnd from './transaction-endpoint.vue'
  63. import Support from './support.vue'
  64. function getServices() {
  65. return fetch("/panel/services", {
  66. method: 'GET',
  67. headers: {'Content-Type': 'application/json',
  68. 'Accept': 'application/json',
  69. 'X-XSRF-TOKEN': this.token}
  70. }).then(response => {
  71. response.json().then(data => {this.services = data})
  72. })
  73. }
  74. function getUser() {
  75. return fetch("/panel/user", {
  76. method: 'GET',
  77. headers: {'Content-Type': 'application/json',
  78. 'Accept': 'application/json',
  79. 'X-XSRF-TOKEN': this.token},
  80. }).then(response => {
  81. return response.json()
  82. }).then(data => {
  83. this.user = data
  84. })
  85. }
  86. function getOrders() {
  87. return fetch("/panel/orders", {
  88. method: 'GET',
  89. headers: {'Content-Type': 'application/json',
  90. 'Accept': 'application/json',
  91. 'X-XSRF-TOKEN': this.token},
  92. }).then(response => {
  93. return response.json()
  94. }).then(data => {
  95. this.orders = data
  96. })
  97. }
  98. export default {
  99. components: {
  100. Sidebar, Settings, PastOrders, NewOrder,
  101. TransactionEnd, Support
  102. },
  103. data() {
  104. return {active: window.location.hash, user: null,
  105. token: null, orders: null, loading: true,}
  106. },
  107. methods: {getUser, getServices, getOrders, },
  108. created() {
  109. let loaders = []
  110. loaders.push(this.getUser())
  111. loaders.push(this.getServices())
  112. loaders.push(this.getOrders())
  113. Promise.all(loaders).then(() => {
  114. this.loading = false
  115. })
  116. }
  117. }
  118. </script>