index.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <!DOCTYPE HTML>
  2. <html lang="zh-CN">
  3. <head>
  4. <title>进制转换工具</title>
  5. <meta charset="UTF-8">
  6. <link rel="shortcut icon" href="../static/img/favicon.ico">
  7. <link rel="stylesheet" href="index.css" />
  8. <script type="text/javascript" src="../static/vendor/evalCore.min.js"></script>
  9. <script type="text/javascript" src="../static/vendor/vue/vue.js"></script>
  10. </head>
  11. <body>
  12. <div class="wrapper" id="pageContainer">
  13. <div class="panel panel-default" style="margin-bottom: 0px;">
  14. <div class="panel-heading">
  15. <h3 class="panel-title">
  16. <a href="https://fehelper.com" target="_blank" class="x-a-high">
  17. <img src="../static/img/fe-16.png" alt="fehelper"/> FeHelper</a>:进制转换工具
  18. <a href="#" class="x-donate-link" @click="openDonateModal($event)"><i class="nav-icon">❤&nbsp;</i>打赏鼓励</a>
  19. <a class="x-other-tools" @click="openOptionsPage($event)"><i class="icon-plus-circle"></i> 探索更多实用工具 <span class="tool-market-badge">工具市场</span></a>
  20. </h3>
  21. </div>
  22. </div>
  23. <div class="panel-body">
  24. <div class="row x-tips ui-mt-10">
  25. // 这里的进制转换的原理比较简单,其实就一行代码 <br/>
  26. let radixConvert = (num, fromRadix, toRadix) => parseInt(num, fromRadix).toString(toRadix);
  27. </div>
  28. <div class="row mod-radios">
  29. <template v-for="item in fromArray">
  30. <input type="radio" name="from" :id="getId('from',item)" :value="item"
  31. :checked="item===fromSelected" @click="radixRadioClicked(1,item)">
  32. <label :for="getId('from',item)">{{item}}进制</label>
  33. </template>
  34. <select class="form-control x-select" v-model="fromSelected" @change="radixConvert">
  35. <option v-for="n in 36" v-if="n>1" :value="n" >{{n}}进制</option>
  36. </select>
  37. </div>
  38. <div class="row ui-mt-10 mod-value">
  39. <label for="srcValue">原始数字:</label>
  40. <input type="text" id="srcValue" class="form-control x-input" maxlength="32" v-model="srcValue"
  41. @input="radixConvert" placeholder="number here...">
  42. </div>
  43. <div class="ui-mt-20">
  44. <span class="radix-tips" @click="switchInput">↑↓交换</span>
  45. </div>
  46. <div class="row mod-radios ui-mt-20">
  47. <template v-for="item in toArray">
  48. <input type="radio" name="to" :id="getId('to',item)" :value="item"
  49. :checked="item==toSelected" @click="radixRadioClicked(2,item)">
  50. <label :for="getId('to',item)">{{item}}进制</label>
  51. </template>
  52. <select class="form-control x-select" v-model="toSelected" @change="radixConvert">
  53. <option v-for="n in 36" v-if="n>1" :value="n">{{n}}进制</option>
  54. </select>
  55. </div>
  56. <div class="row ui-mt-10 mod-value">
  57. <label for="rstValue">结果数字:</label>
  58. <input type="text" id="rstValue" class="form-control x-input" v-model="rstValue" readonly>
  59. </div>
  60. </div>
  61. </div>
  62. <script src="../static/vendor/jquery/jquery-3.3.1.min.js"></script>
  63. <script type="text/javascript" src="index.js"></script>
  64. </body>
  65. </html>