重庆迈尖科技有限公司
2020-05-20 8b87de31af48eddeb7a17d863fd89dfb128ba5ac
AppInside/dataPreview/myPreview.html
@@ -3,7 +3,7 @@
   <head>
      <meta charset="utf-8">
      <title>我的预览</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
      <meta name="viewport" content="width=device-width, viewport-fit=cover,initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
      <link rel="stylesheet" type="text/css" href="./css/base.css" />
      <link rel="stylesheet" type="text/css" href="./css/myPreview.css" />
      <script>
@@ -19,24 +19,13 @@
   <body>
      <div id="root">
         <div class="div_reivedData_list1">
            <!-- 头像 -->
            <div class="div_item" @click="updateNickName_headerImg(1)">
               <div class="div_item_top">
                  <div class="title">头像</div>
                  <div class="content">
                     <img src="img/icon_right_arrow.png" class="arrow">
                     <img class="div_hedaerImg">
                  </div>
               </div>
               <div style="height: 1px; background-color: #E0E0E0; margin-left: 0.3rem;"></div>
            </div>
            <!-- 昵称 -->
            <!-- ID -->
            <div class="div_item" @click="updateNickName_headerImg(2)">
               <div class="div_item_top">
                  <div class="title">昵称</div>
                  <div class="title">ID</div>
                  <div class="content">
                     <img src="img/icon_right_arrow.png" class="arrow">
                     <div class="name">杰拉斯</div>
                     <div id="name_id" class="name">{{dataParms.preUid}}</div>
                  </div>
               </div>
               <div style="height: 1px; background-color: #E0E0E0; margin-left: 0.3rem;"></div>
@@ -47,7 +36,7 @@
                  <div class="title">选择会员等级</div>
                  <div class="content">
                     <img src="img/icon_right_arrow.png" class="arrow">
                     <div class="name">高级会员</div>
                     <div class="name">{{showLevel}}</div>
                  </div>
               </div>
               <div style="height: 1px; background-color: #E0E0E0; margin-left: 0.3rem;"></div>
@@ -56,20 +45,11 @@
            <div class="div_item">
               <div class="div_item_top">
                  <div class="title">账户余额</div>
                  <input id="inpunt_id" class="input" type="text" placeholder="不要超过7位数,支持小数点后两位" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')"
                   maxlength="10">
                  <input id="inpunt_balance" class="input" type="text" v-model="dataParms.balance" placeholder="不要超过7位数,支持小数点后两位"
                   onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')" maxlength="10" @focus="focus()"
                   @blur="blur()">
               </div>
               <div style="height: 1px; background-color: #E0E0E0; margin-left: 0.3rem;"></div>
            </div>
            <!-- 选择会员等级 -->
            <div class="div_item" @click="updateDate">
               <div class="div_item_top">
                  <div class="title">预览时间</div>
                  <div class="content">
                     <img src="img/icon_right_arrow.png" class="arrow">
                     <div class="name">今日</div>
                  </div>
               </div>
            </div>
         </div>
         <div class="div_reivedData_list2">
@@ -77,8 +57,9 @@
            <div class="div_item">
               <div class="div_item_top">
                  <div class="title">自购返利</div>
                  <input id="inpunt_id" class="input" type="text" placeholder="不要超过5位数,支持小数点后两位" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')"
                   maxlength="8">
                  <input id="inpunt_selfRebate" class="input" type="text" v-model="dataParms.selfRebate" placeholder="不要超过5位数,支持小数点后两位"
                   onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')" maxlength="8" @focus="focus()"
                   @blur="blur()">
               </div>
               <div style="height: 1px; background-color: #E0E0E0; margin-left: 0.3rem;"></div>
            </div>
@@ -86,8 +67,9 @@
            <div class="div_item">
               <div class="div_item_top">
                  <div class="title">分享奖金</div>
                  <input id="inpunt_id" class="input" type="text" placeholder="不要超过5位数,支持小数点后两位" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')"
                   maxlength="8">
                  <input id="inpunt_shareBonus" class="input" type="text" v-model="dataParms.shareBonus" placeholder="不要超过5位数,支持小数点后两位"
                   onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')" maxlength="8" @focus="focus()"
                   @blur="blur()">
               </div>
               <div style="height: 1px; background-color: #E0E0E0; margin-left: 0.3rem;"></div>
            </div>
@@ -95,11 +77,15 @@
            <div class="div_item">
               <div class="div_item_top">
                  <div class="title">团队奖金</div>
                  <input id="inpunt_id" class="input" type="text" placeholder="不要超过5位数,支持小数点后两位" onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')"
                   maxlength="8">
                  <input id="inpunt_teamBonus" class="input" type="text" v-model="dataParms.teamBonus" placeholder="不要超过5位数,支持小数点后两位"
                   onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1').replace(/^0{1,}/g,'')" maxlength="8" @focus="focus()"
                   @blur="blur()">
               </div>
            </div>
         </div>
         <!-- <div style="height: 4rem;">   </div> -->
         <!-- 重要提示  -->
         <div class="div_tips">
            <div class="div_tips_title">重要提示</div>
@@ -117,15 +103,15 @@
            <div class="commitInfo" @click="commitInfo">{{buttonName}}</div>
         </div>
         <!--弹框(修改昵称、头像) -->
         <!--弹框(获取ID) -->
         <div class="dialogmask_updateNickName">
            <div class="dialog_updateNickName">
               <img src="img/icon_close.png" class="closeImg" @click="hiddenDialog()">
               <div class="dialog_title">修改昵称</div>
               <div class="dialog_title">输入快省ID </div>
               <div class="">
                  <input id="inpunt_nickName" class="input_other" type="text" placeholder="最多支持16个字符">
                  <input id="inpunt_preUid" class="input_other" type="text" placeholder="最多支持16个字符" @focus="focus()" @blur="blur()">
               </div>
               <div class="dialog_commit_updateNickName" @click="commitUpdateNickName">确认</div>
               <div class="dialog_commit_updateNickName" @click="commitUpdateID">确认</div>
            </div>
         </div>
@@ -135,7 +121,7 @@
               <img src="img/icon_close.png" class="closeImg" @click="hiddenDialog()">
               <div class="dialog_title">选择会员等级</div>
               <div class="div_fantypes_bg">
                  <div class="div_fantypes" v-for="(item, index) in vipList" :class="{checked:index==n}" @click="changeList(index)">
                  <div class="div_fantypes" v-for="(item, index) in vipList" :class="{checked:index==n}" @click="changeVipList(index)">
                     {{item}}
                     <img class="div_selcet" :class="{checked:index==n}" src="img/icon_select.png">
                  </div>
@@ -143,27 +129,12 @@
               <div class="dialog_commit_vip" @click="commitSelectVip">确认</div>
            </div>
         </div>
         <!--弹框 (时间)-->
         <div class="dialogmask_date">
            <div class="dialog_date">
               <img src="img/icon_close.png" class="closeImg" @click="hiddenDialog()">
               <div class="dialog_title">预览时间</div>
               <div class="div_fantypes_bg">
                  <div class="div_fantypes" v-for="(item, index) in dateList" :class="{checked:index==n}" @click="changeList(index)">
                     {{item}}
                     <img class="div_selcet" :class="{checked:index==n}" src="img/icon_select.png">
                  </div>
               </div>
               <div class="dialog_commit_vip" @click="commitSelectDate">确认</div>
            </div>
         </div>
      </div>
   </body>
   <script>
      // "http://api.flqapp.com";
      var host = "http://192.168.1.122:8080";
      var host = "http://192.168.1.253:8080";
      $(function() {
         var app = new Vue({
            el: '#root',
@@ -171,21 +142,35 @@
               headerImg: '',
               buttonName: '提交预览',
               n: 0,
               level: '',
               showLevel: '',
               vipList: ['超级会员', '高级会员', '快省达人'],
               dateList: ['今日', '今日', '本月', '本月']
               dataParms: {
                  preUid: '',
                  level: '',
                  balance: '',
                  selfRebate: '',
                  shareBonus: '',
                  teamBonus: ''
               }
            },
            watch: {},
            methods: {
               focus: function() {
                  this.scrollTop = document.scrollingElement.scrollTop;
               },
               blur: function() {
                  document.scrollingElement.scrollTo(0, this.scrollTop);
               },
               // 修改昵称,头像
               updateNickName_headerImg: function(type) {
                  if (type == 1) {
                  if (type == 2) {
                     $(".dialog_title").text('输入快省ID');
                     $("#inpunt_nickName").attr("placeholder", "输入快省ID,系统自动获取头像");
                     $('.dialogmask_updateNickName').css('display', 'block')
                  } else if (type == 2) {
                     $(".dialog_title").text('修改昵称');
                     $("#inpunt_nickName").attr("placeholder", "最多支持16个字符");
                     $("#inpunt_nickName").attr("placeholder", "系统自动获取信息");
                     $('.dialogmask_updateNickName').css('display', 'block')
                  }
               },
@@ -194,38 +179,166 @@
                  $('.dialogmask_vip').css('display', 'block')
               },
               updateDate: function() {
                  $('.dialogmask_date').css('display', 'block')
               },
               changeVipList: function(index) {
               changeList: function(index) {
                  app.n = index; //this指向app
                  if (app.n == index) return;
                  app.n = index;
                  if (index == 0) {
                     app.level = '超级会员'
                  } else if (index == 1) {
                     app.level = '高级会员'
                  } else if (index == 2) {
                     app.level = '快省达人'
                  }
               },
               hiddenDialog: function() {
                  app.n = 0;
                  $('#inpunt_nickName').val('');
                  $('.dialogmask_updateNickName').css('display', 'none')
                  $('.dialogmask_vip').css('display', 'none')
                  $('.dialogmask_date').css('display', 'none')
                  $('.dialogmask_vip').css('display', 'none')
                  app.level == '超级会员'
               },
               commitUpdateNickName: function() {
               commitUpdateID: function() {
                  var preUid = $('#inpunt_preUid').val();
                  app.dataParms.preUid = preUid;
                  $('#name_id').text(preUid)
                  app.hiddenDialog();
               },
               commitSelectVip: function() {
                  if (app.level == '超级会员') {
                     app.dataParms.level = 'vip'
               },
                  } else if (app.level == '高级会员') {
                     app.dataParms.level = 'highVIP'
               commitSelectDate: function() {
                  } else if (app.level == '快省达人') {
                     app.dataParms.level = 'actived'
                  }
                  app.showLevel = app.level;
                  app.hiddenDialog();
               },
               commitInfo: function() {
                  var preUid = $('#inpunt_preUid').val();
                  var balance = $('#inpunt_balance').val();
                  var selfRebate = $('#inpunt_selfRebate').val();
                  var shareBonus = $('#inpunt_shareBonus').val();
                  var teamBonus = $('#inpunt_teamBonus').val();
                  if (preUid.length == 0 || preUid == null ||
                     app.dataParms.level.length == 0 || app.dataParms.level == null ||
                     balance.length == 0 || balance == null ||
                     selfRebate.length == 0 || selfRebate == null ||
                     shareBonus.length == 0 || shareBonus == null ||
                     teamBonus.length == 0 || teamBonus == null) {
                     yesApp.toast('请将信息填写完整');
                     return;
                  }
                  yesApp.showLoading();
                  var uid = yesApp.getUid();
                  var params = {
                     uid: uid,
                     preUid: preUid,
                     level: app.dataParms.level,
                     balance: balance,
                     selfRebate: selfRebate,
                     shareBonus: shareBonus,
                     teamBonus: teamBonus
                  };
                  params = yesApp.getRequestBaseParams(params);
                  $.ajax({
                     type: "GET",
                     data: JSON.parse(params),
                     url: host + "/fanli/api/v2/preview/saveMineInfo",
                     dataType: "jsonp",
                     async: false,
                     success: function(result) {
                        yesApp.hideLoading();
                        if (result.code == 0) {
                           yesApp.toast(result.data);
                        } else {
                           yesApp.toast(result.msg);
                        }
                     },
                     error: function(XMLHttpRequest, textStatus, errorThrown) {
                        yesApp.hideLoading();
                        if (textStatus === 'timeout') {
                           setTimeout(function() {}, 2000);
                        }
                     }
                  });
               },
               fetchMineInfo: function() {
                  var uid = yesApp.getUid();
                  var params = {
                     uid: uid,
                  };
                  params = yesApp.getRequestBaseParams(params);
                  $.ajax({
                     type: "GET",
                     data: JSON.parse(params),
                     url: host + "/fanli/api/v2/preview/getMineInfo",
                     dataType: "jsonp",
                     async: false,
                     success: function(result) {
                        yesApp.hideLoading();
                        if (result.code == 0) {
                           if (result.data.length == 0 || result.data == null || result.data.preUid == null) {
                              app.n = 0;
                              app.level = '超级会员';
                              app.dataParms.preUid = uid;
                              $('#inpunt_preUid').val(uid)
                           } else {
                              app.dataParms = result.data;
                              $('#inpunt_preUid').val(result.data.preUid);
                              if (app.dataParms.level == 'vip') {
                                 app.level == '超级会员'
                                 app.showLevel = '超级会员'
                                 app.n = 0
                              } else if (app.dataParms.level == 'highVIP') {
                                 app.level == '高级会员'
                                 app.showLevel = '高级会员'
                                 app.n = 1
                              } else if (app.dataParms.level == 'actived') {
                                 app.level == '快省达人'
                                 app.showLevel = '快省达人'
                                 app.n = 2
                              }
                           }
                        } else {
                           yesApp.toast(result.msg);
                        }
                     },
                     error: function(XMLHttpRequest, textStatus, errorThrown) {
                        yesApp.hideLoading();
                        if (textStatus === 'timeout') {
                           setTimeout(function() {}, 2000);
                        }
                     }
                  });
               }
            }
         });
         app.fetchMineInfo();
      });
   </script>
</html>