1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- var $body = $('.yjk-body');
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var userAgent = JSON.parse(window.localStorage.getItem(agentName));
- var cache = window.localStorage.getItem("threeStep"+userAgent.uid);
- var Request = GetRequest();
- var going = Request["isContinue"];
- $(function(){
- //先判断是否有缓存
- if(cache && going){
- var cacheObj = JSON.parse(cache)
- showPage(cacheObj)
- }else if(cache){
- dialog({
- content: '<div><div class="c-f16 c-333 c-t-left mb10">检测到有未提交信息,是否继续填写?</div></div>',
- okValue: '继续',
- cancelValue: '清空',
- cancel: function () {
- window.localStorage.removeItem("threeStep"+userAgent.uid)
- showPage({})
- },
- ok: function() {
- var cacheObj = JSON.parse(cache)
- showPage(cacheObj)
- }
- }).showModal()
- }else{
- showPage({})
- }
- //显示页面
- function showPage(data){
- var html = template('msg_tmp',{data:data})
- $body.html(html)
- baseInfoInit()
- }
- })
- //初始化
- function baseInfoInit() {
- var opt = {
- theme: 'ios',
- lang:'zh',
- customWheels:true,
- wheels: [
- [
- {
- keys: ['1', '0'],
- values: ['是', '否']
- }
- ]
- ],
- onSelect: function(valueText, inst){
- var dd = eval("[" + valueText + "]");
- $(this).val(dd[0].values);
- $(this).attr('data-key',dd[0].keys);
- }
- }
- $('#folicacid').mobiscroll(opt);
- $('#contrapills').mobiscroll(opt);
- $('#smoke').mobiscroll(opt);
- $('#drink').mobiscroll(opt);
- //点击
- $('#page3_next').on('tap',function(){
- commit(function(){
- window.location.href = "yjk-step4.html"
- })
- })
- $('#page3_submit').on('tap',function(){
- commit(function(){
- window.location.href = "yjk-preview.html"
- })
- })
- }
- //保存数据到缓存
- function commit(fun){
- var params={}
- params.folicacid = $("#folicacid").val();
- params.folicacidCode = $("#folicacid").attr('data-key');
- params.contrapills = $("#contrapills").val();
- params.contrapillsCode = $("#contrapills").attr('data-key');
- params.smoke = $("#smoke").val();
- params.smokeCode = $("#smoke").attr('data-key');
- params.drink = $("#drink").val();
- params.drinkCode = $("#drink").attr('data-key');
- params.otherPills = $('#otherPills').val().trim()
-
- window.localStorage.setItem("threeStep"+userAgent.uid,JSON.stringify(params))
- fun&&fun.call(this)
- }
|