Commit ce2ba538596b2979a854c7e1f5313ae4cde884ad

Authored by wangfan
1 parent ed182e88

customer

1 { 1 {
2 - "pages":[  
3 -  
4 - "pages/book/b_index",  
5 - "pages/book/b_detail",  
6 - "pages/book/b_add",  
7 - "pages/book/b_info",  
8 - "pages/book/b_desk"  
9 -  
10 - ],  
11 - "window":{  
12 - "backgroundTextStyle":"light",  
13 - "navigationBarBackgroundColor": "#199095",  
14 - "navigationBarTitleText": "点餐商户端",  
15 - "navigationBarTextStyle":"light"  
16 - },  
17 - "networkTimeout": {  
18 - "request": 10000,  
19 - "downloadFile": 10000  
20 - },  
21 - "debug": true  
22 - 2 + "pages": [
  3 + "pages/book/b_index",
  4 + "pages/book/b_detail",
  5 + "pages/book/b_add",
  6 + "pages/book/b_info",
  7 + "pages/book/b_desk",
  8 + "pages/customer/index"
  9 + ],
  10 + "window": {
  11 + "backgroundTextStyle": "light",
  12 + "navigationBarBackgroundColor": "#199095",
  13 + "navigationBarTitleText": "点餐商户端",
  14 + "navigationBarTextStyle": "light"
  15 + },
  16 + "networkTimeout": {
  17 + "request": 10000,
  18 + "downloadFile": 10000
  19 + },
  20 + "debug": true
23 } 21 }
  1 +// component/menu/addDelete.js
  2 +var util = require('../../utils/util.js')
  3 +Component({
  4 + /**
  5 + * 组件的属性列表
  6 + */
  7 + properties: {
  8 + // talkImage: {
  9 + // type: String, // 类型(必填),目前接受的类型包括:String, Number, Boolean, Object, Array, null(表示任意类型)
  10 + // value: '/pages/image/menu-fixed-taomei.png'
  11 + // },
  12 + },
  13 +
  14 + /**
  15 + * 组件的初始数据
  16 + */
  17 + data: {
  18 + msg:"当前网络不给力,请检查好网络后重试",
  19 + network:true,
  20 + debug:[],
  21 + },
  22 + ready () {
  23 + this.network().then(res=>{
  24 + console.log(res);
  25 + this.setData({
  26 + network:true,
  27 + })
  28 + }).catch(res=>{
  29 + this.setData({
  30 + network:false,
  31 + msg:res.msg
  32 + })
  33 + })
  34 + },
  35 + detached(){
  36 +
  37 + },
  38 + /**
  39 + * 组件的方法列表
  40 + */
  41 + methods: {
  42 + network(){
  43 + return new Promise(function(success,fail) {
  44 + wx.getNetworkType({
  45 + success: function (res) {
  46 + var title = ''
  47 + if (res.networkType == '2g' || res.networkType == '3g' || res.networkType == 'unknown') {
  48 + fail({type:res.networkType,msg:'当前网络不给力,请稍后重试'});
  49 + } else if (res.networkType == 'none') {
  50 + fail({type:res.networkType,msg:'当前暂未连接任何网络,请稍候重试'});
  51 + } else {
  52 + success({type:res.networkType});
  53 + }
  54 + }
  55 + });
  56 + })
  57 + },
  58 + refresh(){
  59 + this.network().then(res=>{
  60 + //刷新当前页面
  61 + let pages=getCurrentPages();
  62 +
  63 + let p=pages[pages.length-1];
  64 + let param=[];
  65 + console.log('network-refresh',p);
  66 + if(p.options){
  67 + for(let key in p.options){
  68 + param.push(key+'='+(p.options[key]
  69 + .replace(/=/,'%3D').replace(/&/,'%26')))
  70 + }
  71 + }
  72 + this.debug('/'+p.route+'?'+param.join('&'),'reLaunch')
  73 + wx.reLaunch({
  74 + url: '/'+p.route+'?'+param.join('&')
  75 + })
  76 + })
  77 + },
  78 + show(msg=''){
  79 + console.log('network-show');
  80 + this.setData({
  81 + network:false,
  82 + msg:msg
  83 + })
  84 + },
  85 + hide(){
  86 + this.setData({
  87 + network:true
  88 + })
  89 + },
  90 + debug(msg,title=""){
  91 + return false;
  92 + let debug=this.data.debug;
  93 + debug.push({title:title,msg:JSON.stringify(msg)});
  94 + this.setData({debug:debug});
  95 + },
  96 +
  97 + }
  98 +})
  1 +{
  2 + "component": true,
  3 + "usingComponents": {}
  4 +}
  1 +<view wx:if="{{!network}}" class="no-network">
  2 + <view class="no-network-box flex-vc" style="background:#fff;width:100%;height:500px;">
  3 + <image src="http://qn.colorcun.com/custom/lite/image/reminder.png" class="network-image"></image>
  4 + <view style="font-size:30rpx;margin-top:10rpx;color:#666;">网络不给力呀~</view>
  5 + <button type="warn" bindtap="refresh" style="margin-top:120px; width: 70%; background-color: #E14553; font-size: 34rpx; height: 80rpx;">
  6 + 再试一次
  7 + </button>
  8 + </view>
  9 +</view>
  10 +<view wx:if="{{debug.length>0}}" style="position: fixed;top: 0;color:#fff;background: #000; padding: 1%;width:98%;">
  11 + <view wx:for="{{debug}}" wx:key="debug-key" style="word-wrap:break-word;white-space:normal">
  12 + {{item.title?(item.title+' => '):""}}{{item.msg}}
  13 + </view>
  14 +</view>
  1 +.no-network{
  2 + position: fixed;
  3 + left:0;
  4 + bottom:0;
  5 + width: 100%;
  6 + height: 5000px;
  7 + z-index: 9998;
  8 + background: #fff;
  9 +}
  10 +.no-network-box{
  11 + position: fixed;
  12 + top:50px;
  13 +}
  14 +.no-network .flex-vc{
  15 + display: flex;
  16 + display: -webkit-flex;
  17 + justify-content: center;
  18 + align-items: center;
  19 + flex-direction: column;
  20 + -webkit-flex-direction: column;
  21 +}
  22 +
  23 +.no-network .network-image{
  24 + width:428rpx;
  25 + height:298rpx;
  26 + position:relative;
  27 + top:-60rpx;
  28 +}
  29 +.no-network .refresh-button{
  30 + padding:0 30rpx;
  31 + height:60rpx;
  32 + border:1px solid #ccc;
  33 + background:#efeef3;
  34 + color:#353535;
  35 +}
  1 +/**
  2 + * Copyright (c) 2014-present, Facebook, Inc.
  3 + *
  4 + * This source code is licensed under the MIT license found in the
  5 + * LICENSE file in the root directory of this source tree.
  6 + */
  7 +
  8 +// This method of obtaining a reference to the global object needs to be
  9 +// kept identical to the way it is obtained in runtime.js
  10 +var g = (function() { return this })() || Function("return this")();
  11 +
  12 +// Use `getOwnPropertyNames` because not all browsers support calling
  13 +// `hasOwnProperty` on the global `self` object in a worker. See #183.
  14 +var hadRuntime = g.regeneratorRuntime &&
  15 + Object.getOwnPropertyNames(g).indexOf("regeneratorRuntime") >= 0;
  16 +
  17 +// Save the old regeneratorRuntime in case it needs to be restored later.
  18 +var oldRuntime = hadRuntime && g.regeneratorRuntime;
  19 +
  20 +// Force reevalutation of runtime.js.
  21 +g.regeneratorRuntime = undefined;
  22 +
  23 +module.exports = require("./runtime");
  24 +
  25 +if (hadRuntime) {
  26 + // Restore the original runtime.
  27 + g.regeneratorRuntime = oldRuntime;
  28 +} else {
  29 + // Remove the global property added by runtime.js.
  30 + try {
  31 + delete g.regeneratorRuntime;
  32 + } catch(e) {
  33 + g.regeneratorRuntime = undefined;
  34 + }
  35 +}
  1 +/**
  2 + * Copyright (c) 2014-present, Facebook, Inc.
  3 + *
  4 + * This source code is licensed under the MIT license found in the
  5 + * LICENSE file in the root directory of this source tree.
  6 + */
  7 +
  8 +!(function(global) {
  9 + "use strict";
  10 +
  11 + var Op = Object.prototype;
  12 + var hasOwn = Op.hasOwnProperty;
  13 + var undefined; // More compressible than void 0.
  14 + var $Symbol = typeof Symbol === "function" ? Symbol : {};
  15 + var iteratorSymbol = $Symbol.iterator || "@@iterator";
  16 + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
  17 + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
  18 +
  19 + var inModule = typeof module === "object";
  20 + var runtime = global.regeneratorRuntime;
  21 + if (runtime) {
  22 + if (inModule) {
  23 + // If regeneratorRuntime is defined globally and we're in a module,
  24 + // make the exports object identical to regeneratorRuntime.
  25 + module.exports = runtime;
  26 + }
  27 + // Don't bother evaluating the rest of this file if the runtime was
  28 + // already defined globally.
  29 + return;
  30 + }
  31 +
  32 + // Define the runtime globally (as expected by generated code) as either
  33 + // module.exports (if we're in a module) or a new, empty object.
  34 + runtime = global.regeneratorRuntime = inModule ? module.exports : {};
  35 +
  36 + function wrap(innerFn, outerFn, self, tryLocsList) {
  37 + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
  38 + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
  39 + var generator = Object.create(protoGenerator.prototype);
  40 + var context = new Context(tryLocsList || []);
  41 +
  42 + // The ._invoke method unifies the implementations of the .next,
  43 + // .throw, and .return methods.
  44 + generator._invoke = makeInvokeMethod(innerFn, self, context);
  45 +
  46 + return generator;
  47 + }
  48 + runtime.wrap = wrap;
  49 +
  50 + // Try/catch helper to minimize deoptimizations. Returns a completion
  51 + // record like context.tryEntries[i].completion. This interface could
  52 + // have been (and was previously) designed to take a closure to be
  53 + // invoked without arguments, but in all the cases we care about we
  54 + // already have an existing method we want to call, so there's no need
  55 + // to create a new function object. We can even get away with assuming
  56 + // the method takes exactly one argument, since that happens to be true
  57 + // in every case, so we don't have to touch the arguments object. The
  58 + // only additional allocation required is the completion record, which
  59 + // has a stable shape and so hopefully should be cheap to allocate.
  60 + function tryCatch(fn, obj, arg) {
  61 + try {
  62 + return { type: "normal", arg: fn.call(obj, arg) };
  63 + } catch (err) {
  64 + return { type: "throw", arg: err };
  65 + }
  66 + }
  67 +
  68 + var GenStateSuspendedStart = "suspendedStart";
  69 + var GenStateSuspendedYield = "suspendedYield";
  70 + var GenStateExecuting = "executing";
  71 + var GenStateCompleted = "completed";
  72 +
  73 + // Returning this object from the innerFn has the same effect as
  74 + // breaking out of the dispatch switch statement.
  75 + var ContinueSentinel = {};
  76 +
  77 + // Dummy constructor functions that we use as the .constructor and
  78 + // .constructor.prototype properties for functions that return Generator
  79 + // objects. For full spec compliance, you may wish to configure your
  80 + // minifier not to mangle the names of these two functions.
  81 + function Generator() {}
  82 + function GeneratorFunction() {}
  83 + function GeneratorFunctionPrototype() {}
  84 +
  85 + // This is a polyfill for %IteratorPrototype% for environments that
  86 + // don't natively support it.
  87 + var IteratorPrototype = {};
  88 + IteratorPrototype[iteratorSymbol] = function () {
  89 + return this;
  90 + };
  91 +
  92 + var getProto = Object.getPrototypeOf;
  93 + var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
  94 + if (NativeIteratorPrototype &&
  95 + NativeIteratorPrototype !== Op &&
  96 + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
  97 + // This environment has a native %IteratorPrototype%; use it instead
  98 + // of the polyfill.
  99 + IteratorPrototype = NativeIteratorPrototype;
  100 + }
  101 +
  102 + var Gp = GeneratorFunctionPrototype.prototype =
  103 + Generator.prototype = Object.create(IteratorPrototype);
  104 + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
  105 + GeneratorFunctionPrototype.constructor = GeneratorFunction;
  106 + GeneratorFunctionPrototype[toStringTagSymbol] =
  107 + GeneratorFunction.displayName = "GeneratorFunction";
  108 +
  109 + // Helper for defining the .next, .throw, and .return methods of the
  110 + // Iterator interface in terms of a single ._invoke method.
  111 + function defineIteratorMethods(prototype) {
  112 + ["next", "throw", "return"].forEach(function(method) {
  113 + prototype[method] = function(arg) {
  114 + return this._invoke(method, arg);
  115 + };
  116 + });
  117 + }
  118 +
  119 + runtime.isGeneratorFunction = function(genFun) {
  120 + var ctor = typeof genFun === "function" && genFun.constructor;
  121 + return ctor
  122 + ? ctor === GeneratorFunction ||
  123 + // For the native GeneratorFunction constructor, the best we can
  124 + // do is to check its .name property.
  125 + (ctor.displayName || ctor.name) === "GeneratorFunction"
  126 + : false;
  127 + };
  128 +
  129 + runtime.mark = function(genFun) {
  130 + if (Object.setPrototypeOf) {
  131 + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
  132 + } else {
  133 + genFun.__proto__ = GeneratorFunctionPrototype;
  134 + if (!(toStringTagSymbol in genFun)) {
  135 + genFun[toStringTagSymbol] = "GeneratorFunction";
  136 + }
  137 + }
  138 + genFun.prototype = Object.create(Gp);
  139 + return genFun;
  140 + };
  141 +
  142 + // Within the body of any async function, `await x` is transformed to
  143 + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
  144 + // `hasOwn.call(value, "__await")` to determine if the yielded value is
  145 + // meant to be awaited.
  146 + runtime.awrap = function(arg) {
  147 + return { __await: arg };
  148 + };
  149 +
  150 + function AsyncIterator(generator) {
  151 + function invoke(method, arg, resolve, reject) {
  152 + var record = tryCatch(generator[method], generator, arg);
  153 + if (record.type === "throw") {
  154 + reject(record.arg);
  155 + } else {
  156 + var result = record.arg;
  157 + var value = result.value;
  158 + if (value &&
  159 + typeof value === "object" &&
  160 + hasOwn.call(value, "__await")) {
  161 + return Promise.resolve(value.__await).then(function(value) {
  162 + invoke("next", value, resolve, reject);
  163 + }, function(err) {
  164 + invoke("throw", err, resolve, reject);
  165 + });
  166 + }
  167 +
  168 + return Promise.resolve(value).then(function(unwrapped) {
  169 + // When a yielded Promise is resolved, its final value becomes
  170 + // the .value of the Promise<{value,done}> result for the
  171 + // current iteration.
  172 + result.value = unwrapped;
  173 + resolve(result);
  174 + }, function(error) {
  175 + // If a rejected Promise was yielded, throw the rejection back
  176 + // into the async generator function so it can be handled there.
  177 + return invoke("throw", error, resolve, reject);
  178 + });
  179 + }
  180 + }
  181 +
  182 + var previousPromise;
  183 +
  184 + function enqueue(method, arg) {
  185 + function callInvokeWithMethodAndArg() {
  186 + return new Promise(function(resolve, reject) {
  187 + invoke(method, arg, resolve, reject);
  188 + });
  189 + }
  190 +
  191 + return previousPromise =
  192 + // If enqueue has been called before, then we want to wait until
  193 + // all previous Promises have been resolved before calling invoke,
  194 + // so that results are always delivered in the correct order. If
  195 + // enqueue has not been called before, then it is important to
  196 + // call invoke immediately, without waiting on a callback to fire,
  197 + // so that the async generator function has the opportunity to do
  198 + // any necessary setup in a predictable way. This predictability
  199 + // is why the Promise constructor synchronously invokes its
  200 + // executor callback, and why async functions synchronously
  201 + // execute code before the first await. Since we implement simple
  202 + // async functions in terms of async generators, it is especially
  203 + // important to get this right, even though it requires care.
  204 + previousPromise ? previousPromise.then(
  205 + callInvokeWithMethodAndArg,
  206 + // Avoid propagating failures to Promises returned by later
  207 + // invocations of the iterator.
  208 + callInvokeWithMethodAndArg
  209 + ) : callInvokeWithMethodAndArg();
  210 + }
  211 +
  212 + // Define the unified helper method that is used to implement .next,
  213 + // .throw, and .return (see defineIteratorMethods).
  214 + this._invoke = enqueue;
  215 + }
  216 +
  217 + defineIteratorMethods(AsyncIterator.prototype);
  218 + AsyncIterator.prototype[asyncIteratorSymbol] = function () {
  219 + return this;
  220 + };
  221 + runtime.AsyncIterator = AsyncIterator;
  222 +
  223 + // Note that simple async functions are implemented on top of
  224 + // AsyncIterator objects; they just return a Promise for the value of
  225 + // the final result produced by the iterator.
  226 + runtime.async = function(innerFn, outerFn, self, tryLocsList) {
  227 + var iter = new AsyncIterator(
  228 + wrap(innerFn, outerFn, self, tryLocsList)
  229 + );
  230 +
  231 + return runtime.isGeneratorFunction(outerFn)
  232 + ? iter // If outerFn is a generator, return the full iterator.
  233 + : iter.next().then(function(result) {
  234 + return result.done ? result.value : iter.next();
  235 + });
  236 + };
  237 +
  238 + function makeInvokeMethod(innerFn, self, context) {
  239 + var state = GenStateSuspendedStart;
  240 +
  241 + return function invoke(method, arg) {
  242 + if (state === GenStateExecuting) {
  243 + throw new Error("Generator is already running");
  244 + }
  245 +
  246 + if (state === GenStateCompleted) {
  247 + if (method === "throw") {
  248 + throw arg;
  249 + }
  250 +
  251 + // Be forgiving, per 25.3.3.3.3 of the spec:
  252 + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
  253 + return doneResult();
  254 + }
  255 +
  256 + context.method = method;
  257 + context.arg = arg;
  258 +
  259 + while (true) {
  260 + var delegate = context.delegate;
  261 + if (delegate) {
  262 + var delegateResult = maybeInvokeDelegate(delegate, context);
  263 + if (delegateResult) {
  264 + if (delegateResult === ContinueSentinel) continue;
  265 + return delegateResult;
  266 + }
  267 + }
  268 +
  269 + if (context.method === "next") {
  270 + // Setting context._sent for legacy support of Babel's
  271 + // function.sent implementation.
  272 + context.sent = context._sent = context.arg;
  273 +
  274 + } else if (context.method === "throw") {
  275 + if (state === GenStateSuspendedStart) {
  276 + state = GenStateCompleted;
  277 + throw context.arg;
  278 + }
  279 +
  280 + context.dispatchException(context.arg);
  281 +
  282 + } else if (context.method === "return") {
  283 + context.abrupt("return", context.arg);
  284 + }
  285 +
  286 + state = GenStateExecuting;
  287 +
  288 + var record = tryCatch(innerFn, self, context);
  289 + if (record.type === "normal") {
  290 + // If an exception is thrown from innerFn, we leave state ===
  291 + // GenStateExecuting and loop back for another invocation.
  292 + state = context.done
  293 + ? GenStateCompleted
  294 + : GenStateSuspendedYield;
  295 +
  296 + if (record.arg === ContinueSentinel) {
  297 + continue;
  298 + }
  299 +
  300 + return {
  301 + value: record.arg,
  302 + done: context.done
  303 + };
  304 +
  305 + } else if (record.type === "throw") {
  306 + state = GenStateCompleted;
  307 + // Dispatch the exception by looping back around to the
  308 + // context.dispatchException(context.arg) call above.
  309 + context.method = "throw";
  310 + context.arg = record.arg;
  311 + }
  312 + }
  313 + };
  314 + }
  315 +
  316 + // Call delegate.iterator[context.method](context.arg) and handle the
  317 + // result, either by returning a { value, done } result from the
  318 + // delegate iterator, or by modifying context.method and context.arg,
  319 + // setting context.delegate to null, and returning the ContinueSentinel.
  320 + function maybeInvokeDelegate(delegate, context) {
  321 + var method = delegate.iterator[context.method];
  322 + if (method === undefined) {
  323 + // A .throw or .return when the delegate iterator has no .throw
  324 + // method always terminates the yield* loop.
  325 + context.delegate = null;
  326 +
  327 + if (context.method === "throw") {
  328 + if (delegate.iterator.return) {
  329 + // If the delegate iterator has a return method, give it a
  330 + // chance to clean up.
  331 + context.method = "return";
  332 + context.arg = undefined;
  333 + maybeInvokeDelegate(delegate, context);
  334 +
  335 + if (context.method === "throw") {
  336 + // If maybeInvokeDelegate(context) changed context.method from
  337 + // "return" to "throw", let that override the TypeError below.
  338 + return ContinueSentinel;
  339 + }
  340 + }
  341 +
  342 + context.method = "throw";
  343 + context.arg = new TypeError(
  344 + "The iterator does not provide a 'throw' method");
  345 + }
  346 +
  347 + return ContinueSentinel;
  348 + }
  349 +
  350 + var record = tryCatch(method, delegate.iterator, context.arg);
  351 +
  352 + if (record.type === "throw") {
  353 + context.method = "throw";
  354 + context.arg = record.arg;
  355 + context.delegate = null;
  356 + return ContinueSentinel;
  357 + }
  358 +
  359 + var info = record.arg;
  360 +
  361 + if (! info) {
  362 + context.method = "throw";
  363 + context.arg = new TypeError("iterator result is not an object");
  364 + context.delegate = null;
  365 + return ContinueSentinel;
  366 + }
  367 +
  368 + if (info.done) {
  369 + // Assign the result of the finished delegate to the temporary
  370 + // variable specified by delegate.resultName (see delegateYield).
  371 + context[delegate.resultName] = info.value;
  372 +
  373 + // Resume execution at the desired location (see delegateYield).
  374 + context.next = delegate.nextLoc;
  375 +
  376 + // If context.method was "throw" but the delegate handled the
  377 + // exception, let the outer generator proceed normally. If
  378 + // context.method was "next", forget context.arg since it has been
  379 + // "consumed" by the delegate iterator. If context.method was
  380 + // "return", allow the original .return call to continue in the
  381 + // outer generator.
  382 + if (context.method !== "return") {
  383 + context.method = "next";
  384 + context.arg = undefined;
  385 + }
  386 +
  387 + } else {
  388 + // Re-yield the result returned by the delegate method.
  389 + return info;
  390 + }
  391 +
  392 + // The delegate iterator is finished, so forget it and continue with
  393 + // the outer generator.
  394 + context.delegate = null;
  395 + return ContinueSentinel;
  396 + }
  397 +
  398 + // Define Generator.prototype.{next,throw,return} in terms of the
  399 + // unified ._invoke helper method.
  400 + defineIteratorMethods(Gp);
  401 +
  402 + Gp[toStringTagSymbol] = "Generator";
  403 +
  404 + // A Generator should always return itself as the iterator object when the
  405 + // @@iterator function is called on it. Some browsers' implementations of the
  406 + // iterator prototype chain incorrectly implement this, causing the Generator
  407 + // object to not be returned from this call. This ensures that doesn't happen.
  408 + // See https://github.com/facebook/regenerator/issues/274 for more details.
  409 + Gp[iteratorSymbol] = function() {
  410 + return this;
  411 + };
  412 +
  413 + Gp.toString = function() {
  414 + return "[object Generator]";
  415 + };
  416 +
  417 + function pushTryEntry(locs) {
  418 + var entry = { tryLoc: locs[0] };
  419 +
  420 + if (1 in locs) {
  421 + entry.catchLoc = locs[1];
  422 + }
  423 +
  424 + if (2 in locs) {
  425 + entry.finallyLoc = locs[2];
  426 + entry.afterLoc = locs[3];
  427 + }
  428 +
  429 + this.tryEntries.push(entry);
  430 + }
  431 +
  432 + function resetTryEntry(entry) {
  433 + var record = entry.completion || {};
  434 + record.type = "normal";
  435 + delete record.arg;
  436 + entry.completion = record;
  437 + }
  438 +
  439 + function Context(tryLocsList) {
  440 + // The root entry object (effectively a try statement without a catch
  441 + // or a finally block) gives us a place to store values thrown from
  442 + // locations where there is no enclosing try statement.
  443 + this.tryEntries = [{ tryLoc: "root" }];
  444 + tryLocsList.forEach(pushTryEntry, this);
  445 + this.reset(true);
  446 + }
  447 +
  448 + runtime.keys = function(object) {
  449 + var keys = [];
  450 + for (var key in object) {
  451 + keys.push(key);
  452 + }
  453 + keys.reverse();
  454 +
  455 + // Rather than returning an object with a next method, we keep
  456 + // things simple and return the next function itself.
  457 + return function next() {
  458 + while (keys.length) {
  459 + var key = keys.pop();
  460 + if (key in object) {
  461 + next.value = key;
  462 + next.done = false;
  463 + return next;
  464 + }
  465 + }
  466 +
  467 + // To avoid creating an additional object, we just hang the .value
  468 + // and .done properties off the next function object itself. This
  469 + // also ensures that the minifier will not anonymize the function.
  470 + next.done = true;
  471 + return next;
  472 + };
  473 + };
  474 +
  475 + function values(iterable) {
  476 + if (iterable) {
  477 + var iteratorMethod = iterable[iteratorSymbol];
  478 + if (iteratorMethod) {
  479 + return iteratorMethod.call(iterable);
  480 + }
  481 +
  482 + if (typeof iterable.next === "function") {
  483 + return iterable;
  484 + }
  485 +
  486 + if (!isNaN(iterable.length)) {
  487 + var i = -1, next = function next() {
  488 + while (++i < iterable.length) {
  489 + if (hasOwn.call(iterable, i)) {
  490 + next.value = iterable[i];
  491 + next.done = false;
  492 + return next;
  493 + }
  494 + }
  495 +
  496 + next.value = undefined;
  497 + next.done = true;
  498 +
  499 + return next;
  500 + };
  501 +
  502 + return next.next = next;
  503 + }
  504 + }
  505 +
  506 + // Return an iterator with no values.
  507 + return { next: doneResult };
  508 + }
  509 + runtime.values = values;
  510 +
  511 + function doneResult() {
  512 + return { value: undefined, done: true };
  513 + }
  514 +
  515 + Context.prototype = {
  516 + constructor: Context,
  517 +
  518 + reset: function(skipTempReset) {
  519 + this.prev = 0;
  520 + this.next = 0;
  521 + // Resetting context._sent for legacy support of Babel's
  522 + // function.sent implementation.
  523 + this.sent = this._sent = undefined;
  524 + this.done = false;
  525 + this.delegate = null;
  526 +
  527 + this.method = "next";
  528 + this.arg = undefined;
  529 +
  530 + this.tryEntries.forEach(resetTryEntry);
  531 +
  532 + if (!skipTempReset) {
  533 + for (var name in this) {
  534 + // Not sure about the optimal order of these conditions:
  535 + if (name.charAt(0) === "t" &&
  536 + hasOwn.call(this, name) &&
  537 + !isNaN(+name.slice(1))) {
  538 + this[name] = undefined;
  539 + }
  540 + }
  541 + }
  542 + },
  543 +
  544 + stop: function() {
  545 + this.done = true;
  546 +
  547 + var rootEntry = this.tryEntries[0];
  548 + var rootRecord = rootEntry.completion;
  549 + if (rootRecord.type === "throw") {
  550 + throw rootRecord.arg;
  551 + }
  552 +
  553 + return this.rval;
  554 + },
  555 +
  556 + dispatchException: function(exception) {
  557 + if (this.done) {
  558 + throw exception;
  559 + }
  560 +
  561 + var context = this;
  562 + function handle(loc, caught) {
  563 + record.type = "throw";
  564 + record.arg = exception;
  565 + context.next = loc;
  566 +
  567 + if (caught) {
  568 + // If the dispatched exception was caught by a catch block,
  569 + // then let that catch block handle the exception normally.
  570 + context.method = "next";
  571 + context.arg = undefined;
  572 + }
  573 +
  574 + return !! caught;
  575 + }
  576 +
  577 + for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  578 + var entry = this.tryEntries[i];
  579 + var record = entry.completion;
  580 +
  581 + if (entry.tryLoc === "root") {
  582 + // Exception thrown outside of any try block that could handle
  583 + // it, so set the completion value of the entire function to
  584 + // throw the exception.
  585 + return handle("end");
  586 + }
  587 +
  588 + if (entry.tryLoc <= this.prev) {
  589 + var hasCatch = hasOwn.call(entry, "catchLoc");
  590 + var hasFinally = hasOwn.call(entry, "finallyLoc");
  591 +
  592 + if (hasCatch && hasFinally) {
  593 + if (this.prev < entry.catchLoc) {
  594 + return handle(entry.catchLoc, true);
  595 + } else if (this.prev < entry.finallyLoc) {
  596 + return handle(entry.finallyLoc);
  597 + }
  598 +
  599 + } else if (hasCatch) {
  600 + if (this.prev < entry.catchLoc) {
  601 + return handle(entry.catchLoc, true);
  602 + }
  603 +
  604 + } else if (hasFinally) {
  605 + if (this.prev < entry.finallyLoc) {
  606 + return handle(entry.finallyLoc);
  607 + }
  608 +
  609 + } else {
  610 + throw new Error("try statement without catch or finally");
  611 + }
  612 + }
  613 + }
  614 + },
  615 +
  616 + abrupt: function(type, arg) {
  617 + for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  618 + var entry = this.tryEntries[i];
  619 + if (entry.tryLoc <= this.prev &&
  620 + hasOwn.call(entry, "finallyLoc") &&
  621 + this.prev < entry.finallyLoc) {
  622 + var finallyEntry = entry;
  623 + break;
  624 + }
  625 + }
  626 +
  627 + if (finallyEntry &&
  628 + (type === "break" ||
  629 + type === "continue") &&
  630 + finallyEntry.tryLoc <= arg &&
  631 + arg <= finallyEntry.finallyLoc) {
  632 + // Ignore the finally entry if control is not jumping to a
  633 + // location outside the try/catch block.
  634 + finallyEntry = null;
  635 + }
  636 +
  637 + var record = finallyEntry ? finallyEntry.completion : {};
  638 + record.type = type;
  639 + record.arg = arg;
  640 +
  641 + if (finallyEntry) {
  642 + this.method = "next";
  643 + this.next = finallyEntry.finallyLoc;
  644 + return ContinueSentinel;
  645 + }
  646 +
  647 + return this.complete(record);
  648 + },
  649 +
  650 + complete: function(record, afterLoc) {
  651 + if (record.type === "throw") {
  652 + throw record.arg;
  653 + }
  654 +
  655 + if (record.type === "break" ||
  656 + record.type === "continue") {
  657 + this.next = record.arg;
  658 + } else if (record.type === "return") {
  659 + this.rval = this.arg = record.arg;
  660 + this.method = "return";
  661 + this.next = "end";
  662 + } else if (record.type === "normal" && afterLoc) {
  663 + this.next = afterLoc;
  664 + }
  665 +
  666 + return ContinueSentinel;
  667 + },
  668 +
  669 + finish: function(finallyLoc) {
  670 + for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  671 + var entry = this.tryEntries[i];
  672 + if (entry.finallyLoc === finallyLoc) {
  673 + this.complete(entry.completion, entry.afterLoc);
  674 + resetTryEntry(entry);
  675 + return ContinueSentinel;
  676 + }
  677 + }
  678 + },
  679 +
  680 + "catch": function(tryLoc) {
  681 + for (var i = this.tryEntries.length - 1; i >= 0; --i) {
  682 + var entry = this.tryEntries[i];
  683 + if (entry.tryLoc === tryLoc) {
  684 + var record = entry.completion;
  685 + if (record.type === "throw") {
  686 + var thrown = record.arg;
  687 + resetTryEntry(entry);
  688 + }
  689 + return thrown;
  690 + }
  691 + }
  692 +
  693 + // The context.catch method must only be called with a location
  694 + // argument that corresponds to a known catch block.
  695 + throw new Error("illegal catch attempt");
  696 + },
  697 +
  698 + delegateYield: function(iterable, resultName, nextLoc) {
  699 + this.delegate = {
  700 + iterator: values(iterable),
  701 + resultName: resultName,
  702 + nextLoc: nextLoc
  703 + };
  704 +
  705 + if (this.method === "next") {
  706 + // Deliberately forget the last sent value so that we don't
  707 + // accidentally pass it on to the delegate.
  708 + this.arg = undefined;
  709 + }
  710 +
  711 + return ContinueSentinel;
  712 + }
  713 + };
  714 +})(
  715 + // In sloppy mode, unbound `this` refers to the global object, fallback to
  716 + // Function constructor if we're in global strict mode. That is sadly a form
  717 + // of indirect eval which violates Content Security Policy.
  718 + (function() { return this })() || Function("return this")()
  719 +);
  1 +// pages/customer/index.js
  2 +const { regeneratorRuntime } = global
  3 +Page({
  4 +
  5 + /**
  6 + * 页面的初始数据
  7 + */
  8 + data: {
  9 +
  10 + },
  11 +
  12 + /**
  13 + * 生命周期函数--监听页面加载
  14 + */
  15 + async onLoad(opt) {
  16 + console.log('onLoad',opt);
  17 + //转化场景值到opt
  18 + this.selectComponent("#network").debug(opt,'opt');
  19 + if(opt.scene){//扫码进入
  20 + let query=decodeURIComponent(opt.scene);
  21 + query.split('&').forEach(q=>{
  22 + let _q=q.split('=');
  23 + opt[_q[0]]=_q[1];
  24 + })
  25 + this.selectComponent("#network").debug(opt,'scene');
  26 + }
  27 +
  28 + opt.openid=await this.getOpenid();
  29 + if(!opt.openid){
  30 + console.log('App.Orders.CheckOrder no openid');
  31 + this.selectComponent("#network").refresh();
  32 + return;
  33 + }
  34 + },
  35 +
  36 + /**
  37 + * 生命周期函数--监听页面初次渲染完成
  38 + */
  39 + onReady: function () {
  40 +
  41 + },
  42 +
  43 + /**
  44 + * 生命周期函数--监听页面显示
  45 + */
  46 + onShow: function () {
  47 +
  48 + },
  49 +
  50 + /**
  51 + * 生命周期函数--监听页面隐藏
  52 + */
  53 + onHide: function () {
  54 +
  55 + },
  56 +
  57 + /**
  58 + * 生命周期函数--监听页面卸载
  59 + */
  60 + onUnload: function () {
  61 +
  62 + },
  63 +
  64 + /**
  65 + * 页面相关事件处理函数--监听用户下拉动作
  66 + */
  67 + onPullDownRefresh: function () {
  68 +
  69 + },
  70 +
  71 + /**
  72 + * 页面上拉触底事件的处理函数
  73 + */
  74 + onReachBottom: function () {
  75 +
  76 + },
  77 +
  78 + /**
  79 + * 用户点击右上角分享
  80 + */
  81 + onShareAppMessage: function () {
  82 +
  83 + },
  84 + async getOpenid(){
  85 + let openid=getApp().openid;
  86 + return openid;
  87 + },
  88 +})
  1 +{
  2 + "backgroundTextStyle": "light",
  3 + "navigationBarBackgroundColor": "#4c4e4f",
  4 + "navigationBarTextStyle": "white",
  5 + "usingComponents": {
  6 + "network": "/component/network/network"
  7 + }
  8 +}
  1 +<view class="page">
  2 + <loading>数据加载中</loading>
  3 +</view>
  4 +<network id="network"></network>
  1 +/* pages/customer/index.wxss */