|
@@ -0,0 +1,262 @@
|
|
|
+<!doctype html>
|
|
|
+<html lang="zh">
|
|
|
+<head>
|
|
|
+ <meta charset="UTF-8">
|
|
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
+ <title>afaa</title>
|
|
|
+ <link rel="stylesheet" type="text/css" href="css/normalize.css"/>
|
|
|
+ <link rel="stylesheet" type="text/css" href="css/default.css">
|
|
|
+ <link rel="stylesheet" href="css/style.css">
|
|
|
+ <link href="http://cdn.bootcss.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
|
|
|
+ <link href="css/bootstrap.min.css" rel="stylesheet">
|
|
|
+ <script src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js"></script>
|
|
|
+ <script src="js/jquery.min.js"></script>
|
|
|
+ <script src="js/bootstrap.min.js"></script>
|
|
|
+ <script src="js/jquery_cookie_min.js"></script>
|
|
|
+ <script src="js/scripts.js"></script>
|
|
|
+ <script src="js/jqhttpsdk.js"></script>
|
|
|
+ <script src="js/jkcor.js"></script>
|
|
|
+ <script src="js/pages.js"></script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<div class="clear-backend">
|
|
|
+ <div class="avatar">
|
|
|
+ <div>
|
|
|
+ <a href="#" target="_blank">
|
|
|
+ <img src="img/admin.png" alt="">
|
|
|
+ </a>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <input type="radio" class="tab-1" name="tab" onclick="location.href='index.html'">
|
|
|
+ <span>Home</span><i class="fa fa-home"></i>
|
|
|
+
|
|
|
+ <input type="radio" class="tab-2" name="tab" checked="checked">
|
|
|
+ <span>Lang</span><i class="fa fa-medium"></i>
|
|
|
+ <!-- tab-top-bar -->
|
|
|
+ <div class="top-bar">
|
|
|
+ <ul>
|
|
|
+ <li>
|
|
|
+ <a href="" title="Log Out">
|
|
|
+ <i class="fa fa-sign-out"></i>
|
|
|
+ </a>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <a href="" title="Messages">
|
|
|
+ <i class="fa fa-envelope"></i>
|
|
|
+ </a>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <a href="" title="Edit">
|
|
|
+ <i class="fa fa-edit"></i>
|
|
|
+ </a>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <!-- tab-content -->
|
|
|
+ <div class="tab-content">
|
|
|
+ <section class="tab-item-2">
|
|
|
+ <div class="container-fluid">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <form role="form">
|
|
|
+ <div class="form-group">
|
|
|
+
|
|
|
+ <label for="InputLangArea">
|
|
|
+ 语种
|
|
|
+ </label>
|
|
|
+ <input type="text" class="form-control" id="InputLangArea"/>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <button type="submit" class="btn btn-primary" onclick="subLangAre();return false;">
|
|
|
+ 添加语种
|
|
|
+ </button>
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <hr>
|
|
|
+ <div class="container-fluid">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <table class="table table-bordered table-hover">
|
|
|
+ <thead id="tabLangHead">
|
|
|
+ <th>编号</th>
|
|
|
+ <th>语言</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </thead>
|
|
|
+ <tbody id="tabLangBody"></tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!--模态框start-->
|
|
|
+ <div class="container-fluid">
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-md-12">
|
|
|
+ <div class="modal fade" id="modal-container-edit-lang" role="dialog"
|
|
|
+ aria-labelledby="myModalLabel"
|
|
|
+ aria-hidden="true">
|
|
|
+ <div class="modal-dialog" role="document">
|
|
|
+ <div class="modal-content">
|
|
|
+ <div class="modal-header">
|
|
|
+ <h5 class="modal-title" id="myModalLabel">
|
|
|
+ EDIT
|
|
|
+ </h5>
|
|
|
+ <button type="button" class="close" data-dismiss="modal">
|
|
|
+ <span aria-hidden="true">×</span>
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ <div class="modal-body">
|
|
|
+ <div class="form-group" id="edit_model_form">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="modal-footer">
|
|
|
+
|
|
|
+ <button type="button" class="btn btn-primary editRowSaveBtn"
|
|
|
+ onclick="editRow(this);return false;">
|
|
|
+ Save changes
|
|
|
+ </button>
|
|
|
+ <button type="button" class="btn btn-secondary" data-dismiss="modal">
|
|
|
+ Close
|
|
|
+ </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <!--模态框end-->
|
|
|
+ </section>
|
|
|
+ </div>
|
|
|
+</div>
|
|
|
+
|
|
|
+<script type="text/javascript">
|
|
|
+ let lang_data
|
|
|
+ $(function () {
|
|
|
+ let post_data = {
|
|
|
+ 'token': $.cookie('access_token'),
|
|
|
+ };
|
|
|
+ $.postJSON(
|
|
|
+ http_ip_prot + 'langArea/query', JSON.stringify(post_data),
|
|
|
+ function (data) {
|
|
|
+ if (data['code'] == 0) {
|
|
|
+ console.log(data)
|
|
|
+ lang_data = data['res']
|
|
|
+ addLangAreaTable(data['res'])
|
|
|
+ } else {
|
|
|
+ alert(data['msg'])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+
|
|
|
+ function addLangAreaTable(data) {
|
|
|
+ let body_html = ''
|
|
|
+ $.each(data, function (idx, obj) {
|
|
|
+ let edit_btn = '<a href="#" title="Edit" onclick="editFunc(\'' + obj['id'] + '\')"><i class="fa fa-edit"></i></a>';
|
|
|
+ let del_btn = '<a href="#" title="Delete" onclick="delArea(\'' + obj['id'] + '\')"><i class="fa fa-ban"></i></a>';
|
|
|
+ body_html += '<tr><td>' + obj['id'] + '</td><td>' + obj['lang'] + '</td><td>' + edit_btn + ' ' + del_btn + '</td></tr>'
|
|
|
+ })
|
|
|
+ $('#tabLangBody').html(body_html)
|
|
|
+ }
|
|
|
+
|
|
|
+ function subLangAre() {
|
|
|
+ let access_token = $.cookie('access_token')
|
|
|
+ let langArea = $('#InputLangArea').val()
|
|
|
+ let post_data = {
|
|
|
+ 'token': access_token,
|
|
|
+ 'lang': langArea,
|
|
|
+ }
|
|
|
+ console.log(post_data)
|
|
|
+ $.postJSON(
|
|
|
+ http_ip_prot + 'langArea/add',
|
|
|
+ JSON.stringify(post_data),
|
|
|
+ function (data) {
|
|
|
+ if (data['code'] == 0) {
|
|
|
+ alert(data['msg'])
|
|
|
+ window.location.reload();
|
|
|
+ } else {
|
|
|
+ alert(data['msg'])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ function delArea(id) {
|
|
|
+ let post_data = {
|
|
|
+ 'token': $.cookie('access_token'),
|
|
|
+ 'id': id
|
|
|
+ }
|
|
|
+ let cr = confirm('delete it ?')
|
|
|
+ if (cr) {
|
|
|
+ $.postJSON(
|
|
|
+ http_ip_prot + 'langArea/delete', JSON.stringify(post_data),
|
|
|
+ function (data) {
|
|
|
+ if (data['code'] == 0) {
|
|
|
+ console.log(data)
|
|
|
+ // alert(data['msg'])
|
|
|
+ window.location.reload()
|
|
|
+ } else {
|
|
|
+ alert(data['msg'])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function editFunc(lang_id) {
|
|
|
+ // alert(langKey)
|
|
|
+ console.log(lang_data)
|
|
|
+ $('#modal-container-edit-lang').modal('show')
|
|
|
+ let html_edit = ''
|
|
|
+ $.each(lang_data, function (idx, obj) {
|
|
|
+ if (lang_id == obj['id']) {
|
|
|
+ html_edit = '<input type="text" class="form-control" id="editDataInput" value="' + obj['lang'] + '" lid="' + lang_id + '">'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ $('#edit_model_form').html(html_edit)
|
|
|
+ return
|
|
|
+ // let post_data = {'token': $.cookie('access_token')};
|
|
|
+ // let html_per = '<label for="lang_key_edit">KEY</label><input class="form-control" type="text" id="lang_key_edit" oldkey="' + langKey + '" value="' + langKey + '"> '
|
|
|
+ // $.each(la_list, function (idx, obj) {
|
|
|
+ // console.log(obj);
|
|
|
+ // html_per += ('<label for="InputLangArea">' + obj['lang'] + ':</label>' +
|
|
|
+ // '<input type="text" class="form-control" lang="' + obj['lang'] + '" value="' + (lw_data[langKey][obj['lang']] ? lw_data[langKey][obj['lang']] : '') + '"/>')
|
|
|
+ // });
|
|
|
+ // // console.log(html_per)
|
|
|
+ // $('#edit_model_form').html(html_per)
|
|
|
+ }
|
|
|
+
|
|
|
+ function editRow() {
|
|
|
+ let lang_id = $('#editDataInput').attr('lid')
|
|
|
+ let lang_area = $('#editDataInput').val()
|
|
|
+ if (lang_id && lang_area) {
|
|
|
+ let post_data = {
|
|
|
+ 'token': $.cookie('access_token'),
|
|
|
+ 'id': lang_id,
|
|
|
+ 'lang': lang_area
|
|
|
+ }
|
|
|
+ $.postJSON(
|
|
|
+ http_ip_prot + 'langArea/update', JSON.stringify(post_data),
|
|
|
+ function (data) {
|
|
|
+ if (data['code'] == 0) {
|
|
|
+ console.log(data)
|
|
|
+ // alert(data['msg'])
|
|
|
+ window.location.reload()
|
|
|
+ } else {
|
|
|
+ alert(data['msg'])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ alert('none')
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|