About.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432
  1. <template>
  2. <div class="container-fluid no-padding box-cards">
  3. <el-card class="box-card col-lg-6" shadow="never">
  4. <div slot="header" class="clearfix">
  5. <div class="col-md-12 no-padding">
  6. <h3>信令服务</h3>
  7. </div>
  8. </div>
  9. <div class="server-info">
  10. <div class="box box-widget">
  11. <div class="box-header">
  12. <h4> <i class="fa fa-support"></i> 版本信息</h4>
  13. </div>
  14. <div class="box-body table-responsive no-padding">
  15. <table class="table table-striped">
  16. <tbody>
  17. <tr>
  18. <td style="width:20%;">硬件信息</td>
  19. <td><span>{{serverInfo.Hardware}}</span></td>
  20. </tr>
  21. <tr>
  22. <td>接口版本</td>
  23. <td><span id="interface-info">{{serverInfo.InterfaceVersion}}</span></td>
  24. </tr>
  25. <tr>
  26. <td>运行时间</td>
  27. <td>
  28. <span id="running-time-info">{{runningTime || serverInfo.RunningTime}}
  29. <small v-if="userInfo">
  30. &nbsp;<a href="#" @click.prevent="restart" class="text-orange">重启</a>
  31. </small>
  32. </span>
  33. </td>
  34. </tr>
  35. <tr>
  36. <td>软件信息</td>
  37. <td><span id="software-info">{{serverInfo.Server}}</span></td>
  38. </tr>
  39. </tbody>
  40. </table>
  41. </div>
  42. </div>
  43. <div class="box box-widget">
  44. <div class="box-header">
  45. <h4>
  46. <i class="fa fa-key"></i> 授权信息 <span v-if="serverInfo.VersionType">({{serverInfo.VersionType}})</span>
  47. &nbsp;&nbsp;
  48. <small v-show="canExpand && !expanded">
  49. <a href="#" @click.prevent="expand" class="fa fa-plus" style="color:#afa9a9;" title="显示激活码入口"></a>
  50. </small>
  51. </h4>
  52. </div>
  53. <div class="box-body table-responsive no-padding">
  54. <table class="table table-striped">
  55. <tbody>
  56. <tr>
  57. <td style="width:20%;">授权对象</td>
  58. <td>{{serverInfo.Authorization}}</td>
  59. </tr>
  60. <tr>
  61. <td>授权时间</td>
  62. <td v-if="!actived">剩余期限{{serverInfo.RemainDays}}天</td>
  63. <td v-else>永久授权</td>
  64. </tr>
  65. <tr v-if="actived && serverInfo.ChannelCount && serverInfo.ChannelCount >= 0 && serverInfo.ChannelCount != 1000">
  66. <td>通道数</td>
  67. <td>{{serverInfo.ChannelCount}}</td>
  68. </tr>
  69. <tr v-if="!actived || expanded">
  70. <td>机器码</td>
  71. <td>
  72. <span id="key-info">CMS{{(serverInfo.Server||"").indexOf("Linux") >= 0 ? "L":"W"}}{{requestkey}}</span>
  73. <br>
  74. <span style="color:#bbb">(通过邮箱:support@liveqing.com 向商务人员咨询永久授权信息)</span>
  75. </td>
  76. </tr>
  77. <tr v-if="!actived || expanded">
  78. <td>提交激活码</td>
  79. <td>
  80. <el-input type="textarea" :rows="1" placeholder="输入申请到的激活码" v-model.trim="activationCode" ref="activationCode" :autosize="{minRows:1, maxRows:5}" style="margin-bottom:10px;"></el-input>
  81. <div>
  82. <button type="button" class="btn btn-sm btn-primary" @click.prevent="checkCode" :disabled="bSubmitting"> 提交 </button>
  83. </div>
  84. </td>
  85. </tr>
  86. </tbody>
  87. </table>
  88. </div>
  89. </div>
  90. </div>
  91. </el-card>
  92. <el-card class="box-card col-lg-6" shadow="never">
  93. <div slot="header" class="clearfix">
  94. <div class="col-md-6 no-padding">
  95. <h3>流媒体服务</h3>
  96. </div>
  97. <div class="col-md-6 no-padding" v-if="sms.Load">
  98. <select style="margin-top: 23px;width:100%" v-model.trim="smsserial" @change="smschange">
  99. <option v-for="(c, idx) in smss" :value="c.Serial" :key="idx"> SMS-{{c.Serial}}</option>
  100. </select>
  101. </div>
  102. </div>
  103. <div class="server-info">
  104. <h4 style="text-align:center;" v-if="!smsserverinfo.Hardware"> SMS 流媒体服务尚未启动 </h4>
  105. <div class="box box-widget" v-if="smsserverinfo.Hardware">
  106. <div class="box-header">
  107. <h4> <i class="fa fa-support"></i> 版本信息</h4>
  108. </div>
  109. <div class="box-body table-responsive no-padding">
  110. <table class="table table-striped">
  111. <tbody>
  112. <tr>
  113. <td style="width:20%;">硬件信息</td>
  114. <td><span>{{smsserverinfo.Hardware}}</span></td>
  115. </tr>
  116. <tr>
  117. <td style="width:20%;">负载</td>
  118. <td><span>{{sms.Load}}</span></td>
  119. </tr>
  120. <tr v-if="sms.HWDecodeLoad">
  121. <td style="width:20%;">硬解负载</td>
  122. <td><span>{{sms.HWDecodeLoad}}</span></td>
  123. </tr>
  124. <tr v-if="sms.HWEncodeLoad">
  125. <td style="width:20%;">硬编负载</td>
  126. <td><span>{{sms.HWEncodeLoad}}</span></td>
  127. </tr>
  128. <tr>
  129. <td>运行时间</td>
  130. <td>
  131. <span id="running-time-info">{{runningSMSTime || smsserverinfo.RunningTime}}
  132. <small v-if="userInfo">
  133. &nbsp;<a href="#" @click.prevent="restartSMS" class="text-orange">重启</a>
  134. </small>
  135. </span>
  136. </td>
  137. </tr>
  138. <tr>
  139. <td>软件信息</td>
  140. <td><span id="software-info">{{smsserverinfo.Server}}</span></td>
  141. </tr>
  142. </tbody>
  143. </table>
  144. </div>
  145. </div>
  146. <div class="box box-widget" v-if="smsrequestkey.RequestKey && smsserverinfo.Authorization">
  147. <div class="box-header">
  148. <h4> <i class="fa fa-key"></i> 授权信息 <span v-if="smsserverinfo.VersionType">({{smsserverinfo.VersionType}})</span></h4>
  149. </div>
  150. <div class="box-body table-responsive no-padding">
  151. <table class="table table-striped">
  152. <tbody>
  153. <tr>
  154. <td style="width:20%;">授权对象</td>
  155. <td>{{smsserverinfo.Authorization}}</td>
  156. </tr>
  157. <tr>
  158. <td>授权时间</td>
  159. <td v-if="!activedsms">剩余期限{{smsserverinfo.RemainDays}}天</td>
  160. <td v-else>永久授权</td>
  161. </tr>
  162. <tr v-if="(activedsms||expanded) && smsserverinfo.ChannelCount && smsserverinfo.ChannelCount >= 0 && smsserverinfo.ChannelCount != 1000">
  163. <td>通道数</td>
  164. <td>{{smsserverinfo.ChannelCount}}</td>
  165. </tr>
  166. <tr v-if="!activedsms||expanded">
  167. <td>机器码</td>
  168. <td>
  169. <span id="key-info">SMS{{(smsserverinfo.Server||"").indexOf("Linux") >= 0 ? "L":"W"}}{{smsrequestkey.RequestKey}}</span>
  170. <br>
  171. <span style="color:#bbb">(通过邮箱:support@liveqing.com 向商务人员咨询永久授权信息)</span>
  172. </td>
  173. </tr>
  174. <tr v-if="!activedsms||expanded">
  175. <td>提交激活码</td>
  176. <td>
  177. <el-input type="textarea" :rows="1" placeholder="输入申请到的激活码" v-model.trim="activationCodeSMS" ref="activationCodeSMS" :autosize="{minRows:1, maxRows:5}" style="margin-bottom:10px;"></el-input>
  178. <div>
  179. <button type="button" class="btn btn-sm btn-primary" @click.prevent="checkCodeSMS" :disabled="bSubmittingSMS"> 提交 </button>
  180. </div>
  181. </td>
  182. </tr>
  183. </tbody>
  184. </table>
  185. </div>
  186. </div>
  187. </div>
  188. </el-card>
  189. </div>
  190. </template>
  191. <script>
  192. import {
  193. mapState,
  194. mapActions
  195. } from "vuex";
  196. import moment from 'moment'
  197. export default {
  198. data() {
  199. return {
  200. timer: 0,
  201. requestkey: "",
  202. activationCode: "",
  203. activationCodeSMS: "",
  204. bSubmitting: false,
  205. bSubmittingSMS: false,
  206. runningTime: "",
  207. runningSMSTime: "",
  208. smsserial: "",
  209. smss: [],
  210. sms: {},
  211. smsrequestkey: {},
  212. smsserverinfo: {},
  213. expanded:false,
  214. };
  215. },
  216. computed: {
  217. ...mapState(["userInfo", "serverInfo"]),
  218. actived() {
  219. return this.serverInfo.RemainDays == 9999;
  220. },
  221. activedsms() {
  222. return this.smsserverinfo.RemainDays == 9999;
  223. },
  224. canExpand() {
  225. if (this.actived && this.serverInfo.VersionType && this.serverInfo.VersionType.indexOf("旗舰版") < 0) {
  226. return true;
  227. }
  228. if (this.actived && this.serverInfo.ChannelCount && this.serverInfo.ChannelCount >= 0 && this.serverInfo.ChannelCount != 1000) {
  229. return true;
  230. }
  231. return false;
  232. },
  233. },
  234. mounted() {
  235. // this.getServerInfo();
  236. this.timer = setInterval(() => {
  237. if (this.serverInfo && this.serverInfo.StartUpTime) {
  238. var start = moment(this.serverInfo.StartUpTime, "YYYY-MM-DD HH:mm:ss");
  239. var now = moment();
  240. var d = moment.duration(now.diff(start));
  241. if (this.serverInfo.DiffDuration) {
  242. d = d.add(this.serverInfo.DiffDuration);
  243. }
  244. this.runningTime = `${parseInt(d.asDays())} Days ${d.hours()} Hours ${d.minutes()} Mins ${d.seconds()} Secs`;
  245. }
  246. if (this.smsserverinfo && this.smsserverinfo.StartUpTime) {
  247. var start = moment(this.smsserverinfo.StartUpTime, "YYYY-MM-DD HH:mm:ss");
  248. var now = moment();
  249. var d = moment.duration(now.diff(start));
  250. if (this.smsserverinfo.DiffDuration) {
  251. d = d.add(this.smsserverinfo.DiffDuration);
  252. }
  253. this.runningSMSTime = `${parseInt(d.asDays())} Days ${d.hours()} Hours ${d.minutes()} Mins ${d.seconds()} Secs`;
  254. }
  255. }, 1000)
  256. $.get("/api/v1/getrequestkey").then(ret => {
  257. this.requestkey = ret.RequestKey;
  258. });
  259. this.getSMSList()
  260. },
  261. beforeDestroy() {
  262. if (this.timer) {
  263. clearInterval(this.timer);
  264. this.timer = 0;
  265. }
  266. },
  267. methods: {
  268. ...mapActions([
  269. "getServerInfo"
  270. ]),
  271. restart() {
  272. this.$confirm('此操作将重启信令服务, 是否继续?', '提示', {
  273. confirmButtonText: '确定',
  274. cancelButtonText: '取消',
  275. type: 'warning'
  276. }).then(() => {
  277. $.get("/api/v1/restart").then(ret => {
  278. this.$message({
  279. type: 'success',
  280. message: '重启成功!'
  281. });
  282. setTimeout(() => {
  283. this.getServerInfo();
  284. }, 2000);
  285. }).fail(() => {
  286. this.$message({
  287. type: 'error',
  288. message: '重启失败!'
  289. });
  290. })
  291. }).catch(() => {});
  292. },
  293. restartSMS() {
  294. this.$confirm('此操作将重启流媒体服务, 是否继续?', '提示', {
  295. confirmButtonText: '确定',
  296. cancelButtonText: '取消',
  297. type: 'warning'
  298. }).then(() => {
  299. $.get("/api/v1/sms/restart", {
  300. serial: this.smsserial
  301. }).then(ret => {
  302. this.$message({
  303. type: 'success',
  304. message: '重启成功!'
  305. });
  306. setTimeout(() => {
  307. this.getSMSInfo();
  308. }, 2000);
  309. }).fail(() => {
  310. this.$message({
  311. type: 'error',
  312. message: '重启失败!'
  313. });
  314. })
  315. }).catch(() => {});
  316. },
  317. checkCode() {
  318. if (this.activationCode == "") {
  319. this.$message({
  320. type: "error",
  321. message: "请输入激活码"
  322. });
  323. } else {
  324. this.bSubmitting = true;
  325. $.get("/api/v1/verifyproductcode", {
  326. productcode: this.activationCode
  327. }).then(ret => {
  328. if (ret.State == 1) {
  329. this.$message({
  330. type: "success",
  331. message: "授权成功!"
  332. });
  333. this.getServerInfo();
  334. } else {
  335. this.$message({
  336. type: "error",
  337. message: "输入有效激活码"
  338. })
  339. }
  340. }).always(() => {
  341. this.bSubmitting = false;
  342. })
  343. }
  344. },
  345. getSMSList() {
  346. if (this.smsserial == "") {
  347. $.get("/api/v1/sms/list").then(ret => {
  348. this.smss = ret
  349. if (ret.length > 0) {
  350. this.sms = ret[0]
  351. this.smsserial = ret[0].Serial
  352. }
  353. this.getSMSInfo();
  354. })
  355. }
  356. },
  357. getSMSInfo() {
  358. if (this.smsserial != "") {
  359. $.get("/api/v1/sms/getrequestkey", {
  360. serial: this.smsserial
  361. }).then(ret => {
  362. this.smsrequestkey = ret;
  363. })
  364. $.get("/api/v1/sms/getserverinfo", {
  365. serial: this.smsserial
  366. }).then(ret => {
  367. this.smsserverinfo = ret;
  368. })
  369. }
  370. },
  371. smschange() {
  372. this.getSMSInfo()
  373. $.get("/api/v1/sms/list").then(ret => {
  374. this.smss = ret
  375. for (var i = 0; i < this.smss.length; i++) {
  376. if (this.smss[i].Serial == this.smsserial) {
  377. this.sms = this.smss[i]
  378. break
  379. }
  380. }
  381. })
  382. },
  383. checkCodeSMS() {
  384. if (this.activationCodeSMS == "") {
  385. this.$message({
  386. type: "error",
  387. message: "请输入激活码"
  388. });
  389. } else {
  390. this.bSubmittingSMS = true;
  391. $.get("/api/v1/sms/verifyproductcode", {
  392. serial: this.smsserial,
  393. productcode: this.activationCodeSMS
  394. }).then(ret => {
  395. if (ret.State == 1) {
  396. this.$message({
  397. type: "success",
  398. message: "授权成功!"
  399. });
  400. this.getSMSInfo();
  401. } else {
  402. this.$message({
  403. type: "error",
  404. message: "输入有效激活码"
  405. })
  406. }
  407. }).always(() => {
  408. this.bSubmittingSMS = false;
  409. })
  410. }
  411. },
  412. expand() {
  413. this.expanded = true;
  414. }
  415. }
  416. }
  417. </script>
  418. <style lang="less" scoped>
  419. .container-fluid.no-padding.box-cards {
  420. overflow: hidden;
  421. .box-card {
  422. &[class*="col-"] {
  423. margin-bottom: -99999px;
  424. padding-bottom: 99999px;
  425. }
  426. }
  427. }
  428. </style>