index.php 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. {include file="public/head"}
  5. <link href="/system/frame/css/bootstrap.min.css?v=3.4.0" rel="stylesheet">
  6. <link href="/system/frame/css/style.min.css?v=3.0.0" rel="stylesheet">
  7. <title>{$title|default=''}</title>
  8. <style>
  9. .check {
  10. color: #f00
  11. }
  12. .demo-upload {
  13. display: block;
  14. height: 33px;
  15. text-align: center;
  16. border: 1px solid transparent;
  17. border-radius: 4px;
  18. overflow: hidden;
  19. background: #fff;
  20. position: relative;
  21. box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
  22. margin-right: 4px;
  23. }
  24. .demo-upload img {
  25. width: 100%;
  26. height: 100%;
  27. display: block;
  28. }
  29. .demo-upload-cover {
  30. display: none;
  31. position: absolute;
  32. top: 0;
  33. bottom: 0;
  34. left: 0;
  35. right: 0;
  36. background: rgba(0, 0, 0, .6);
  37. }
  38. .demo-upload:hover .demo-upload-cover {
  39. display: block;
  40. }
  41. .demo-upload-cover i {
  42. color: #fff;
  43. font-size: 20px;
  44. cursor: pointer;
  45. margin: 0 2px;
  46. }
  47. .code-send {
  48. cursor: pointer;
  49. }
  50. </style>
  51. <script>
  52. window.test = 1;
  53. </script>
  54. </head>
  55. <body>
  56. <div class="wrapper wrapper-content">
  57. <div class="row">
  58. <div class="col-sm-12">
  59. <div class="ibox float-e-margins">
  60. <div class="ibox-title">
  61. <h5>短信账号注册</h5>
  62. <a style="margin-left: 10px;display: inline-block;" href="{:Url('sms.smsConfig/index')}?type=4&tab_id=18">返回</a>
  63. </div>
  64. <div id="store-attr" class="mp-form" v-cloak="">
  65. <i-Form :label-width="80" style="width: 100%">
  66. <template>
  67. <template>
  68. <Form-Item>
  69. <Row>
  70. <i-Col span="13">
  71. <span>账&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;号:</span>
  72. <i-Input placeholder="短信平台账号" v-model="form.account" style="width: 80%"
  73. type="text"></i-Input>
  74. </i-Col>
  75. </Row>
  76. </Form-Item>
  77. <Form-Item>
  78. <Row>
  79. <i-Col span="13">
  80. <span>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码:</span>
  81. <i-Input placeholder="短信平台密码/token" v-model="form.password"
  82. style="width: 80%" type="password"></i-Input>
  83. </i-Col>
  84. </Row>
  85. </Form-Item>
  86. <Form-Item>
  87. <Row>
  88. <i-Col span="13">
  89. <span>域&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名:</span>
  90. <i-Input placeholder="网址域名" v-model="form.url" style="width: 80%"></i-Input>
  91. </i-Col>
  92. </Row>
  93. </Form-Item>
  94. <Form-Item>
  95. <Row>
  96. <i-Col span="13">
  97. <span>&nbsp;&nbsp;&nbsp;&nbsp;手机号:</span>
  98. <i-Input placeholder="注册手机号" v-model="form.phone"
  99. style="width: 80%"></i-Input>
  100. </i-Col>
  101. </Row>
  102. </Form-Item>
  103. <Form-Item>
  104. <Row>
  105. <i-Col span="13">
  106. <span>短信签名:</span>
  107. <i-Input placeholder="短信签名 例如:CRMEB" v-model="form.sign"
  108. style="width: 80%"></i-Input>
  109. </i-Col>
  110. </Row>
  111. </Form-Item>
  112. <Form-Item>
  113. <Row>
  114. <i-Col span="13">
  115. <span style="float: left">&nbsp;&nbsp;&nbsp;&nbsp;验证码:</span>
  116. <i-Input placeholder="验证码" v-model="form.code" style="width: 80%">
  117. <span slot="append" @click="sendCode" v-text="codeMsg"
  118. class="code-send"></span>
  119. </i-Input>
  120. </i-Col>
  121. </Row>
  122. </Form-Item>
  123. </template>
  124. <Form-Item>
  125. <Row>
  126. <i-Col span="8" offset="6">
  127. <i-Button type="primary" @click="submit">提交</i-Button>
  128. </i-Col>
  129. </Row>
  130. </Form-Item>
  131. </template>
  132. </i-Form>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <script>
  139. var _vm;
  140. mpFrame.start(function (Vue) {
  141. new Vue({
  142. data() {
  143. return {
  144. codeUrl: "{:Url('captcha')}",
  145. codeMsg: "发送验证码",
  146. form: {
  147. account: '',
  148. password: '',
  149. url: '',
  150. sign: '',
  151. phone: '',
  152. code: '',
  153. },
  154. isSend: true,
  155. }
  156. },
  157. methods: {
  158. isPhone: function (test) {
  159. var reg = /^1[3456789]\d{9}$/;
  160. return reg.test(test);
  161. },
  162. sendCode: function () {
  163. var that = this;
  164. if (!that.isSend) return;
  165. if (!that.form.phone.length) {
  166. $eb.message('error', '请填写手机号');
  167. return false;
  168. }
  169. if (!that.form.sign || !that.form.sign.length) {
  170. $eb.message('error', '请填写短信签名');
  171. return false;
  172. }
  173. if (!that.isPhone(that.form.phone)) {
  174. $eb.message('error', '手机号格式错误');
  175. return false;
  176. }
  177. that.isSend = false;
  178. $eb.axios.post(that.codeUrl, {phone: that.form.phone}).then(function (res) {
  179. if (res.data.code == 200) {
  180. var cd = 60;
  181. var timeClone = setInterval(function () {
  182. cd--;
  183. if (cd <= 0) {
  184. that.codeMsg = '重新发送';
  185. clearInterval(timeClone);
  186. that.isSend = true;
  187. } else {
  188. that.isSend = false;
  189. that.codeMsg = '剩余' + cd + 's';
  190. }
  191. }, 1000);
  192. $eb.message('success', res.data.msg || '发送成功');
  193. } else {
  194. $eb.message('error', res.data.msg || '发送失败');
  195. }
  196. return false;
  197. }).catch(function (err) {
  198. that.isSend = false;
  199. $eb.message('error', err);
  200. })
  201. },
  202. submit() {
  203. var that = this;
  204. $eb.axios.post("{:Url('save')}", that.form).then(function (res) {
  205. if (res.status == 200 && res.data.code == 200) {
  206. $eb.message('success', res.data.msg || '提交成功!');
  207. $eb.closeModalFrame(window.name);
  208. location.href = "{:url('sms.smsConfig/index', array('type'=>4, 'tab_id'=>18))}";
  209. } else {
  210. $eb.message('error', res.data.msg || '请求失败!');
  211. }
  212. }).catch(function (err) {
  213. $eb.message('error', err);
  214. })
  215. },
  216. },
  217. mounted() {
  218. }
  219. }).$mount(document.getElementById('store-attr'));
  220. });
  221. </script>
  222. </body>