diff --git a/e_shop/app.json b/e_shop/app.json index 9cc89d3863048cd048d2fcadf007ed8cab2ab300..d0d962e39aec3893aa71cd5f85de96e242c76ab6 100644 --- a/e_shop/app.json +++ b/e_shop/app.json @@ -27,8 +27,8 @@ "iconPath": "images/index.png", "selectedIconPath": "images/index_select.png" }, { - "pagePath": "pages/category/category", - "text": "活动", + "pagePath": "pages/search/search", + "text": "搜索", "iconPath": "images/category.png", "selectedIconPath": "images/category_select.png" }, { diff --git a/e_shop/components/123.txt b/e_shop/components/123.txt deleted file mode 100644 index d800886d9c86731ae5c4a62b0b77c437015e00d2..0000000000000000000000000000000000000000 --- a/e_shop/components/123.txt +++ /dev/null @@ -1 +0,0 @@ -123 \ No newline at end of file diff --git a/e_shop/images/redpacket.png b/e_shop/images/redpacket.png new file mode 100644 index 0000000000000000000000000000000000000000..b464d58508176e8dd8955900e15768513eb90b76 Binary files /dev/null and b/e_shop/images/redpacket.png differ diff --git a/e_shop/lib/456.txt b/e_shop/lib/456.txt deleted file mode 100644 index abc4eff6ac83026669840d289fce80cc9a42baaa..0000000000000000000000000000000000000000 --- a/e_shop/lib/456.txt +++ /dev/null @@ -1 +0,0 @@ -46 \ No newline at end of file diff --git a/e_shop/lib/runtime/runtime.js b/e_shop/lib/runtime/runtime.js new file mode 100644 index 0000000000000000000000000000000000000000..9db5e1271884a9c1e702884ca2e742d90fcd0c41 --- /dev/null +++ b/e_shop/lib/runtime/runtime.js @@ -0,0 +1,710 @@ +/** + * Copyright (c) 2014-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +var regeneratorRuntime = (function (exports) { + "use strict"; + + var Op = Object.prototype; + var hasOwn = Op.hasOwnProperty; + var undefined; // More compressible than void 0. + var $Symbol = typeof Symbol === "function" ? Symbol : {}; + var iteratorSymbol = $Symbol.iterator || "@@iterator"; + var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; + var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; + + function wrap(innerFn, outerFn, self, tryLocsList) { + // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. + var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; + var generator = Object.create(protoGenerator.prototype); + var context = new Context(tryLocsList || []); + + // The ._invoke method unifies the implementations of the .next, + // .throw, and .return methods. + generator._invoke = makeInvokeMethod(innerFn, self, context); + + return generator; + } + exports.wrap = wrap; + + // Try/catch helper to minimize deoptimizations. Returns a completion + // record like context.tryEntries[i].completion. This interface could + // have been (and was previously) designed to take a closure to be + // invoked without arguments, but in all the cases we care about we + // already have an existing method we want to call, so there's no need + // to create a new function object. We can even get away with assuming + // the method takes exactly one argument, since that happens to be true + // in every case, so we don't have to touch the arguments object. The + // only additional allocation required is the completion record, which + // has a stable shape and so hopefully should be cheap to allocate. + function tryCatch(fn, obj, arg) { + try { + return { type: "normal", arg: fn.call(obj, arg) }; + } catch (err) { + return { type: "throw", arg: err }; + } + } + + var GenStateSuspendedStart = "suspendedStart"; + var GenStateSuspendedYield = "suspendedYield"; + var GenStateExecuting = "executing"; + var GenStateCompleted = "completed"; + + // Returning this object from the innerFn has the same effect as + // breaking out of the dispatch switch statement. + var ContinueSentinel = {}; + + // Dummy constructor functions that we use as the .constructor and + // .constructor.prototype properties for functions that return Generator + // objects. For full spec compliance, you may wish to configure your + // minifier not to mangle the names of these two functions. + function Generator() {} + function GeneratorFunction() {} + function GeneratorFunctionPrototype() {} + + // This is a polyfill for %IteratorPrototype% for environments that + // don't natively support it. + var IteratorPrototype = {}; + IteratorPrototype[iteratorSymbol] = function () { + return this; + }; + + var getProto = Object.getPrototypeOf; + var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); + if (NativeIteratorPrototype && + NativeIteratorPrototype !== Op && + hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { + // This environment has a native %IteratorPrototype%; use it instead + // of the polyfill. + IteratorPrototype = NativeIteratorPrototype; + } + + var Gp = GeneratorFunctionPrototype.prototype = + Generator.prototype = Object.create(IteratorPrototype); + GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; + GeneratorFunctionPrototype.constructor = GeneratorFunction; + GeneratorFunctionPrototype[toStringTagSymbol] = + GeneratorFunction.displayName = "GeneratorFunction"; + + // Helper for defining the .next, .throw, and .return methods of the + // Iterator interface in terms of a single ._invoke method. + function defineIteratorMethods(prototype) { + ["next", "throw", "return"].forEach(function(method) { + prototype[method] = function(arg) { + return this._invoke(method, arg); + }; + }); + } + + exports.isGeneratorFunction = function(genFun) { + var ctor = typeof genFun === "function" && genFun.constructor; + return ctor + ? ctor === GeneratorFunction || + // For the native GeneratorFunction constructor, the best we can + // do is to check its .name property. + (ctor.displayName || ctor.name) === "GeneratorFunction" + : false; + }; + + exports.mark = function(genFun) { + if (Object.setPrototypeOf) { + Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); + } else { + genFun.__proto__ = GeneratorFunctionPrototype; + if (!(toStringTagSymbol in genFun)) { + genFun[toStringTagSymbol] = "GeneratorFunction"; + } + } + genFun.prototype = Object.create(Gp); + return genFun; + }; + + // Within the body of any async function, `await x` is transformed to + // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test + // `hasOwn.call(value, "__await")` to determine if the yielded value is + // meant to be awaited. + exports.awrap = function(arg) { + return { __await: arg }; + }; + + function AsyncIterator(generator) { + function invoke(method, arg, resolve, reject) { + var record = tryCatch(generator[method], generator, arg); + if (record.type === "throw") { + reject(record.arg); + } else { + var result = record.arg; + var value = result.value; + if (value && + typeof value === "object" && + hasOwn.call(value, "__await")) { + return Promise.resolve(value.__await).then(function(value) { + invoke("next", value, resolve, reject); + }, function(err) { + invoke("throw", err, resolve, reject); + }); + } + + return Promise.resolve(value).then(function(unwrapped) { + // When a yielded Promise is resolved, its final value becomes + // the .value of the Promise<{value,done}> result for the + // current iteration. + result.value = unwrapped; + resolve(result); + }, function(error) { + // If a rejected Promise was yielded, throw the rejection back + // into the async generator function so it can be handled there. + return invoke("throw", error, resolve, reject); + }); + } + } + + var previousPromise; + + function enqueue(method, arg) { + function callInvokeWithMethodAndArg() { + return new Promise(function(resolve, reject) { + invoke(method, arg, resolve, reject); + }); + } + + return previousPromise = + // If enqueue has been called before, then we want to wait until + // all previous Promises have been resolved before calling invoke, + // so that results are always delivered in the correct order. If + // enqueue has not been called before, then it is important to + // call invoke immediately, without waiting on a callback to fire, + // so that the async generator function has the opportunity to do + // any necessary setup in a predictable way. This predictability + // is why the Promise constructor synchronously invokes its + // executor callback, and why async functions synchronously + // execute code before the first await. Since we implement simple + // async functions in terms of async generators, it is especially + // important to get this right, even though it requires care. + previousPromise ? previousPromise.then( + callInvokeWithMethodAndArg, + // Avoid propagating failures to Promises returned by later + // invocations of the iterator. + callInvokeWithMethodAndArg + ) : callInvokeWithMethodAndArg(); + } + + // Define the unified helper method that is used to implement .next, + // .throw, and .return (see defineIteratorMethods). + this._invoke = enqueue; + } + + defineIteratorMethods(AsyncIterator.prototype); + AsyncIterator.prototype[asyncIteratorSymbol] = function () { + return this; + }; + exports.AsyncIterator = AsyncIterator; + + // Note that simple async functions are implemented on top of + // AsyncIterator objects; they just return a Promise for the value of + // the final result produced by the iterator. + exports.async = function(innerFn, outerFn, self, tryLocsList) { + var iter = new AsyncIterator( + wrap(innerFn, outerFn, self, tryLocsList) + ); + + return exports.isGeneratorFunction(outerFn) + ? iter // If outerFn is a generator, return the full iterator. + : iter.next().then(function(result) { + return result.done ? result.value : iter.next(); + }); + }; + + function makeInvokeMethod(innerFn, self, context) { + var state = GenStateSuspendedStart; + + return function invoke(method, arg) { + if (state === GenStateExecuting) { + throw new Error("Generator is already running"); + } + + if (state === GenStateCompleted) { + if (method === "throw") { + throw arg; + } + + // Be forgiving, per 25.3.3.3.3 of the spec: + // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume + return doneResult(); + } + + context.method = method; + context.arg = arg; + + while (true) { + var delegate = context.delegate; + if (delegate) { + var delegateResult = maybeInvokeDelegate(delegate, context); + if (delegateResult) { + if (delegateResult === ContinueSentinel) continue; + return delegateResult; + } + } + + if (context.method === "next") { + // Setting context._sent for legacy support of Babel's + // function.sent implementation. + context.sent = context._sent = context.arg; + + } else if (context.method === "throw") { + if (state === GenStateSuspendedStart) { + state = GenStateCompleted; + throw context.arg; + } + + context.dispatchException(context.arg); + + } else if (context.method === "return") { + context.abrupt("return", context.arg); + } + + state = GenStateExecuting; + + var record = tryCatch(innerFn, self, context); + if (record.type === "normal") { + // If an exception is thrown from innerFn, we leave state === + // GenStateExecuting and loop back for another invocation. + state = context.done + ? GenStateCompleted + : GenStateSuspendedYield; + + if (record.arg === ContinueSentinel) { + continue; + } + + return { + value: record.arg, + done: context.done + }; + + } else if (record.type === "throw") { + state = GenStateCompleted; + // Dispatch the exception by looping back around to the + // context.dispatchException(context.arg) call above. + context.method = "throw"; + context.arg = record.arg; + } + } + }; + } + + // Call delegate.iterator[context.method](context.arg) and handle the + // result, either by returning a { value, done } result from the + // delegate iterator, or by modifying context.method and context.arg, + // setting context.delegate to null, and returning the ContinueSentinel. + function maybeInvokeDelegate(delegate, context) { + var method = delegate.iterator[context.method]; + if (method === undefined) { + // A .throw or .return when the delegate iterator has no .throw + // method always terminates the yield* loop. + context.delegate = null; + + if (context.method === "throw") { + if (delegate.iterator.return) { + // If the delegate iterator has a return method, give it a + // chance to clean up. + context.method = "return"; + context.arg = undefined; + maybeInvokeDelegate(delegate, context); + + if (context.method === "throw") { + // If maybeInvokeDelegate(context) changed context.method from + // "return" to "throw", let that override the TypeError below. + return ContinueSentinel; + } + } + + context.method = "throw"; + context.arg = new TypeError( + "The iterator does not provide a 'throw' method"); + } + + return ContinueSentinel; + } + + var record = tryCatch(method, delegate.iterator, context.arg); + + if (record.type === "throw") { + context.method = "throw"; + context.arg = record.arg; + context.delegate = null; + return ContinueSentinel; + } + + var info = record.arg; + + if (! info) { + context.method = "throw"; + context.arg = new TypeError("iterator result is not an object"); + context.delegate = null; + return ContinueSentinel; + } + + if (info.done) { + // Assign the result of the finished delegate to the temporary + // variable specified by delegate.resultName (see delegateYield). + context[delegate.resultName] = info.value; + + // Resume execution at the desired location (see delegateYield). + context.next = delegate.nextLoc; + + // If context.method was "throw" but the delegate handled the + // exception, let the outer generator proceed normally. If + // context.method was "next", forget context.arg since it has been + // "consumed" by the delegate iterator. If context.method was + // "return", allow the original .return call to continue in the + // outer generator. + if (context.method !== "return") { + context.method = "next"; + context.arg = undefined; + } + + } else { + // Re-yield the result returned by the delegate method. + return info; + } + + // The delegate iterator is finished, so forget it and continue with + // the outer generator. + context.delegate = null; + return ContinueSentinel; + } + + // Define Generator.prototype.{next,throw,return} in terms of the + // unified ._invoke helper method. + defineIteratorMethods(Gp); + + Gp[toStringTagSymbol] = "Generator"; + + // A Generator should always return itself as the iterator object when the + // @@iterator function is called on it. Some browsers' implementations of the + // iterator prototype chain incorrectly implement this, causing the Generator + // object to not be returned from this call. This ensures that doesn't happen. + // See https://github.com/facebook/regenerator/issues/274 for more details. + Gp[iteratorSymbol] = function() { + return this; + }; + + Gp.toString = function() { + return "[object Generator]"; + }; + + function pushTryEntry(locs) { + var entry = { tryLoc: locs[0] }; + + if (1 in locs) { + entry.catchLoc = locs[1]; + } + + if (2 in locs) { + entry.finallyLoc = locs[2]; + entry.afterLoc = locs[3]; + } + + this.tryEntries.push(entry); + } + + function resetTryEntry(entry) { + var record = entry.completion || {}; + record.type = "normal"; + delete record.arg; + entry.completion = record; + } + + function Context(tryLocsList) { + // The root entry object (effectively a try statement without a catch + // or a finally block) gives us a place to store values thrown from + // locations where there is no enclosing try statement. + this.tryEntries = [{ tryLoc: "root" }]; + tryLocsList.forEach(pushTryEntry, this); + this.reset(true); + } + + exports.keys = function(object) { + var keys = []; + for (var key in object) { + keys.push(key); + } + keys.reverse(); + + // Rather than returning an object with a next method, we keep + // things simple and return the next function itself. + return function next() { + while (keys.length) { + var key = keys.pop(); + if (key in object) { + next.value = key; + next.done = false; + return next; + } + } + + // To avoid creating an additional object, we just hang the .value + // and .done properties off the next function object itself. This + // also ensures that the minifier will not anonymize the function. + next.done = true; + return next; + }; + }; + + function values(iterable) { + if (iterable) { + var iteratorMethod = iterable[iteratorSymbol]; + if (iteratorMethod) { + return iteratorMethod.call(iterable); + } + + if (typeof iterable.next === "function") { + return iterable; + } + + if (!isNaN(iterable.length)) { + var i = -1, next = function next() { + while (++i < iterable.length) { + if (hasOwn.call(iterable, i)) { + next.value = iterable[i]; + next.done = false; + return next; + } + } + + next.value = undefined; + next.done = true; + + return next; + }; + + return next.next = next; + } + } + + // Return an iterator with no values. + return { next: doneResult }; + } + exports.values = values; + + function doneResult() { + return { value: undefined, done: true }; + } + + Context.prototype = { + constructor: Context, + + reset: function(skipTempReset) { + this.prev = 0; + this.next = 0; + // Resetting context._sent for legacy support of Babel's + // function.sent implementation. + this.sent = this._sent = undefined; + this.done = false; + this.delegate = null; + + this.method = "next"; + this.arg = undefined; + + this.tryEntries.forEach(resetTryEntry); + + if (!skipTempReset) { + for (var name in this) { + // Not sure about the optimal order of these conditions: + if (name.charAt(0) === "t" && + hasOwn.call(this, name) && + !isNaN(+name.slice(1))) { + this[name] = undefined; + } + } + } + }, + + stop: function() { + this.done = true; + + var rootEntry = this.tryEntries[0]; + var rootRecord = rootEntry.completion; + if (rootRecord.type === "throw") { + throw rootRecord.arg; + } + + return this.rval; + }, + + dispatchException: function(exception) { + if (this.done) { + throw exception; + } + + var context = this; + function handle(loc, caught) { + record.type = "throw"; + record.arg = exception; + context.next = loc; + + if (caught) { + // If the dispatched exception was caught by a catch block, + // then let that catch block handle the exception normally. + context.method = "next"; + context.arg = undefined; + } + + return !! caught; + } + + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + var record = entry.completion; + + if (entry.tryLoc === "root") { + // Exception thrown outside of any try block that could handle + // it, so set the completion value of the entire function to + // throw the exception. + return handle("end"); + } + + if (entry.tryLoc <= this.prev) { + var hasCatch = hasOwn.call(entry, "catchLoc"); + var hasFinally = hasOwn.call(entry, "finallyLoc"); + + if (hasCatch && hasFinally) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } else if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else if (hasCatch) { + if (this.prev < entry.catchLoc) { + return handle(entry.catchLoc, true); + } + + } else if (hasFinally) { + if (this.prev < entry.finallyLoc) { + return handle(entry.finallyLoc); + } + + } else { + throw new Error("try statement without catch or finally"); + } + } + } + }, + + abrupt: function(type, arg) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc <= this.prev && + hasOwn.call(entry, "finallyLoc") && + this.prev < entry.finallyLoc) { + var finallyEntry = entry; + break; + } + } + + if (finallyEntry && + (type === "break" || + type === "continue") && + finallyEntry.tryLoc <= arg && + arg <= finallyEntry.finallyLoc) { + // Ignore the finally entry if control is not jumping to a + // location outside the try/catch block. + finallyEntry = null; + } + + var record = finallyEntry ? finallyEntry.completion : {}; + record.type = type; + record.arg = arg; + + if (finallyEntry) { + this.method = "next"; + this.next = finallyEntry.finallyLoc; + return ContinueSentinel; + } + + return this.complete(record); + }, + + complete: function(record, afterLoc) { + if (record.type === "throw") { + throw record.arg; + } + + if (record.type === "break" || + record.type === "continue") { + this.next = record.arg; + } else if (record.type === "return") { + this.rval = this.arg = record.arg; + this.method = "return"; + this.next = "end"; + } else if (record.type === "normal" && afterLoc) { + this.next = afterLoc; + } + + return ContinueSentinel; + }, + + finish: function(finallyLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.finallyLoc === finallyLoc) { + this.complete(entry.completion, entry.afterLoc); + resetTryEntry(entry); + return ContinueSentinel; + } + } + }, + + "catch": function(tryLoc) { + for (var i = this.tryEntries.length - 1; i >= 0; --i) { + var entry = this.tryEntries[i]; + if (entry.tryLoc === tryLoc) { + var record = entry.completion; + if (record.type === "throw") { + var thrown = record.arg; + resetTryEntry(entry); + } + return thrown; + } + } + + // The context.catch method must only be called with a location + // argument that corresponds to a known catch block. + throw new Error("illegal catch attempt"); + }, + + delegateYield: function(iterable, resultName, nextLoc) { + this.delegate = { + iterator: values(iterable), + resultName: resultName, + nextLoc: nextLoc + }; + + if (this.method === "next") { + // Deliberately forget the last sent value so that we don't + // accidentally pass it on to the delegate. + this.arg = undefined; + } + + return ContinueSentinel; + } + }; + + // Regardless of whether this script is executing as a CommonJS module + // or not, return the runtime object so that we can declare the variable + // regeneratorRuntime in the outer scope, which allows this module to be + // injected easily by `bin/regenerator --include-runtime script.js`. + return exports; + +}( + // If this script is executing as a CommonJS module, use module.exports + // as the regeneratorRuntime namespace. Otherwise create a new empty + // object. Either way, the resulting object will be used to initialize + // the regeneratorRuntime variable at the top of this file. + typeof module === "object" ? module.exports : {} +)); \ No newline at end of file diff --git a/e_shop/pages/act_jf/act_jf.js b/e_shop/pages/act_jf/act_jf.js new file mode 100644 index 0000000000000000000000000000000000000000..e525dbf4380e85a4fb08c8985735e09f68bc13a7 --- /dev/null +++ b/e_shop/pages/act_jf/act_jf.js @@ -0,0 +1,66 @@ +// pages/act_jf/act_jf.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/e_shop/pages/act_jf/act_jf.json b/e_shop/pages/act_jf/act_jf.json new file mode 100644 index 0000000000000000000000000000000000000000..8835af0699ccec004cbe685ef938cd2d63ea7037 --- /dev/null +++ b/e_shop/pages/act_jf/act_jf.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/e_shop/pages/act_jf/act_jf.wxml b/e_shop/pages/act_jf/act_jf.wxml new file mode 100644 index 0000000000000000000000000000000000000000..186583a120008bb710851ed9a5e4c6eab93a96de --- /dev/null +++ b/e_shop/pages/act_jf/act_jf.wxml @@ -0,0 +1,2 @@ + +pages/act_jf/act_jf.wxml diff --git a/e_shop/pages/act_jf/act_jf.wxss b/e_shop/pages/act_jf/act_jf.wxss new file mode 100644 index 0000000000000000000000000000000000000000..9fbb991fa32934c303b0487158a97be6727ff52c --- /dev/null +++ b/e_shop/pages/act_jf/act_jf.wxss @@ -0,0 +1 @@ +/* pages/act_jf/act_jf.wxss */ \ No newline at end of file diff --git a/e_shop/pages/act_kj/act_kj.js b/e_shop/pages/act_kj/act_kj.js new file mode 100644 index 0000000000000000000000000000000000000000..a358dcc1a812e7fb5ddf337428151e9a9937c9cd --- /dev/null +++ b/e_shop/pages/act_kj/act_kj.js @@ -0,0 +1,66 @@ +// pages/act_kj/act_kj.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/e_shop/pages/act_kj/act_kj.json b/e_shop/pages/act_kj/act_kj.json new file mode 100644 index 0000000000000000000000000000000000000000..8835af0699ccec004cbe685ef938cd2d63ea7037 --- /dev/null +++ b/e_shop/pages/act_kj/act_kj.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/e_shop/pages/act_kj/act_kj.wxml b/e_shop/pages/act_kj/act_kj.wxml new file mode 100644 index 0000000000000000000000000000000000000000..5fbbc18389374f3a9e4bc93f55eb62fc39ad24be --- /dev/null +++ b/e_shop/pages/act_kj/act_kj.wxml @@ -0,0 +1,2 @@ + +pages/act_kj/act_kj.wxml diff --git a/e_shop/pages/act_kj/act_kj.wxss b/e_shop/pages/act_kj/act_kj.wxss new file mode 100644 index 0000000000000000000000000000000000000000..6b8a6c8ec95a17c00accf434838fc48b8aed7acc --- /dev/null +++ b/e_shop/pages/act_kj/act_kj.wxss @@ -0,0 +1 @@ +/* pages/act_kj/act_kj.wxss */ \ No newline at end of file diff --git a/e_shop/pages/act_lj/act_lj.js b/e_shop/pages/act_lj/act_lj.js new file mode 100644 index 0000000000000000000000000000000000000000..d53fdf8e9c9e5da4a803abf97fae0236f7890bc3 --- /dev/null +++ b/e_shop/pages/act_lj/act_lj.js @@ -0,0 +1,66 @@ +// pages/act_lj/act_lj.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/e_shop/pages/act_lj/act_lj.json b/e_shop/pages/act_lj/act_lj.json new file mode 100644 index 0000000000000000000000000000000000000000..8835af0699ccec004cbe685ef938cd2d63ea7037 --- /dev/null +++ b/e_shop/pages/act_lj/act_lj.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/e_shop/pages/act_lj/act_lj.wxml b/e_shop/pages/act_lj/act_lj.wxml new file mode 100644 index 0000000000000000000000000000000000000000..61c402207df5cf9ee029a742d23abce31aff1871 --- /dev/null +++ b/e_shop/pages/act_lj/act_lj.wxml @@ -0,0 +1,2 @@ + +pages/act_lj/act_lj.wxml diff --git a/e_shop/pages/act_lj/act_lj.wxss b/e_shop/pages/act_lj/act_lj.wxss new file mode 100644 index 0000000000000000000000000000000000000000..4c0b7c8f572ffcfc1b9292468f610f123ee9e6e6 --- /dev/null +++ b/e_shop/pages/act_lj/act_lj.wxss @@ -0,0 +1 @@ +/* pages/act_lj/act_lj.wxss */ \ No newline at end of file diff --git a/e_shop/pages/act_pt/act_pt.js b/e_shop/pages/act_pt/act_pt.js new file mode 100644 index 0000000000000000000000000000000000000000..d2831428dd27d1a7dd95bfb55ebd690f71f8a3e7 --- /dev/null +++ b/e_shop/pages/act_pt/act_pt.js @@ -0,0 +1,66 @@ +// pages/act_pt/act_pt.js +Page({ + + /** + * 页面的初始数据 + */ + data: { + + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function () { + + } +}) \ No newline at end of file diff --git a/e_shop/pages/act_pt/act_pt.json b/e_shop/pages/act_pt/act_pt.json new file mode 100644 index 0000000000000000000000000000000000000000..8835af0699ccec004cbe685ef938cd2d63ea7037 --- /dev/null +++ b/e_shop/pages/act_pt/act_pt.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/e_shop/pages/act_pt/act_pt.wxml b/e_shop/pages/act_pt/act_pt.wxml new file mode 100644 index 0000000000000000000000000000000000000000..3f77c02199ccb9ae5d05253c445a8089aef8aabb --- /dev/null +++ b/e_shop/pages/act_pt/act_pt.wxml @@ -0,0 +1,2 @@ + +pages/act_pt/act_pt.wxml diff --git a/e_shop/pages/act_pt/act_pt.wxss b/e_shop/pages/act_pt/act_pt.wxss new file mode 100644 index 0000000000000000000000000000000000000000..74279786c0daf8e73a1d1101dab3728698dd071d --- /dev/null +++ b/e_shop/pages/act_pt/act_pt.wxss @@ -0,0 +1 @@ +/* pages/act_pt/act_pt.wxss */ \ No newline at end of file diff --git a/e_shop/pages/act_sk/act_sk.js b/e_shop/pages/act_sk/act_sk.js index 59ab8b0cda53f925886e52d6dd48fcd53778e9c7..794498b39a79a30f42a8594dbf7a1fb5f3676fef 100644 --- a/e_shop/pages/act_sk/act_sk.js +++ b/e_shop/pages/act_sk/act_sk.js @@ -1,12 +1,16 @@ const db = wx.cloud.database(); const list = db.collection('eshop_goods'); - +var goodsTime = [{ + actEndTime: '2021/12/12 24:00:00' +}, ] Page({ data: { item: 0, tab: 0, goods_list: [], + countDownList: [], + actEndTimeList: [], }, // 引用数据库 @@ -31,25 +35,70 @@ Page({ var _this = this _this.conn(); + // 秒杀倒计时 + var endTimeList = []; + goodsTime.forEach(o => { + endTimeList.push(o.actEndTime) + }) + this.setData({ + actEndTimeList: endTimeList + }) + this.countDown() + // 查询商品列表 list.get({ success: res => { - console.log(res.data), - this.setData({ - goods_list: res.data - }) + // console.log(res.data), + this.setData({ + goods_list: res.data + }) } }) - }, - - onReady: function () { - + // 格式化时间 + timeFormat(param) { + return param < 10 ? '0' + param : param; }, - onShow: function () { + // 倒计时方法 + countDown() { + var newTime = new Date().getTime(); + var endTimeList = this.data.actEndTimeList; + var countDownArr = []; + // 遍历结束时间 + endTimeList.forEach(o => { + var endTime = new Date(o).getTime(); + var obj = null; + // 如果活动未结束,对时间处理 + if (endTime - newTime > 0) { + var time = (endTime - newTime) / 1000; + var day = parseInt(time / (60 * 60 * 24)); + var hou = parseInt(time % (60 * 60 * 24) / 3600); + var min = parseInt(time % (60 * 60 * 24) % 3600 / 60); + var sec = parseInt(time % (60 * 60 * 24) % 3600 % 60); + obj = { + day: this.timeFormat(day), + hou: this.timeFormat(hou), + min: this.timeFormat(min), + sec: this.timeFormat(sec), + } + } else { + //活动结束,时间设为零 + obj = { + day: '00', + hou: '00', + min: '00', + sec: '00', + } + } + countDownArr.push(obj); + }) + this.setData({ + countDownList: countDownArr + }) + setTimeout(this.countDown, 1000); }, }) \ No newline at end of file diff --git a/e_shop/pages/act_sk/act_sk.json b/e_shop/pages/act_sk/act_sk.json index 8835af0699ccec004cbe685ef938cd2d63ea7037..c5a3a1a20ba6721bbd6e6f25f35faeb0db8b63fe 100644 --- a/e_shop/pages/act_sk/act_sk.json +++ b/e_shop/pages/act_sk/act_sk.json @@ -1,3 +1,5 @@ { - "usingComponents": {} + "usingComponents": {}, + + "navigationBarTitleText": "秒杀" } \ No newline at end of file diff --git a/e_shop/pages/act_sk/act_sk.wxml b/e_shop/pages/act_sk/act_sk.wxml index 8963ee4f56a8f86caf7be93b6715ff09fefa2133..7061da8fcc7a7d83a1ff3d5d7668732769e5ecc5 100644 --- a/e_shop/pages/act_sk/act_sk.wxml +++ b/e_shop/pages/act_sk/act_sk.wxml @@ -5,7 +5,15 @@ 999.9元 -123456 + + 抢购中 数量有限下单先得哦! + + 距结束 + {{item.hou}}: + {{item.min}}: + {{item.sec}} + + diff --git a/e_shop/pages/act_sk/act_sk.wxss b/e_shop/pages/act_sk/act_sk.wxss index 6d0c8caa1f50d722fb03799992a61c3c51ee89b2..74c68cdc8111adbee3d494381f969cdc30bfd16b 100644 --- a/e_shop/pages/act_sk/act_sk.wxss +++ b/e_shop/pages/act_sk/act_sk.wxss @@ -1,5 +1,5 @@ page { - background-color: pink; + background-color: WhiteSmoke; display: flex; flex-direction: column; height: 100%; @@ -7,6 +7,7 @@ page { .tab { display: flex; + background-color: #FFF; } .tab .tab-item { @@ -14,7 +15,7 @@ page { line-height: 60rpx; text-align: center; font-size: 17px; - border-bottom: 10rpx solid #eeeeee; + border-bottom: 8rpx solid #eeeeee; } .tab-item.active { @@ -22,10 +23,49 @@ page { border-bottom-color: red; } +/* 倒计时 */ +.sk_time { + height: 100rpx; + display: flex; + background-color: LightPink; + border-radius: 20rpx; +} + +.time_text { + flex: 6; + font-size: 12px; + height: 100rpx; + line-height: 100rpx; + padding: 0; + padding-left: 20rpx; +} + +.active_time { + flex: 5; + height: 100rpx; + line-height: 100rpx; + font-size: 13px; +} + +.time_box { + height: 26rpx; + width: 26rpx; + line-height: 26rpx; + text-align: center; + background-color: #000000; + color: #fff; + margin: 0 5px; +} + +.time_box_bg { + background-color: Crimson; +} + /* 秒杀商品列表 */ .content { flex: 1; height: 1290px; + border-radius: 50%; } .content>swiper { @@ -33,7 +73,8 @@ page { } .lt { - background-color: #fff; + background-color: #FFF; + border-radius: 30rpx; } .goods_item { diff --git a/e_shop/pages/cart/cart.js b/e_shop/pages/cart/cart.js index 3a78dc5359d75828f58a66a78378d6780e4f3326..36b04b22e01f4c3f85211de3e53d6e4e385be396 100644 --- a/e_shop/pages/cart/cart.js +++ b/e_shop/pages/cart/cart.js @@ -1,3 +1,11 @@ +import { + getSetting, + chooseAddress, + openSetting, + showModal, + showToast +} from "../../utils/asyncWx.js"; +import regeneratorRuntime from '../../lib/runtime/runtime'; Page({ /** * 页面的初始数据 diff --git a/e_shop/pages/order/order.js b/e_shop/pages/order/order.js index 8e1eeaba66449e2369e87aec87762fcf76acc9bc..3c8ede00f472cb94bdaa2ce7688202e77a242c37 100644 --- a/e_shop/pages/order/order.js +++ b/e_shop/pages/order/order.js @@ -5,15 +5,50 @@ Page({ * 页面的初始数据 */ data: { - + list: [], + value: "确认收货" }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + var list = wx.getStorageSync('pay') || [] + console.log(list[0]) + this.setData({ + list: list[0] + }) }, + setValue: function () { + let value = "确认收货" + if (value === "确认收货") { + this.setData({ + value: "反馈评价" + }) + console.log(this.data.value) + } + if (this.data.value === "反馈评价") { + wx.showModal({ + title: '提示', + content: '即将进入评价页面', + success: function (res) { + if (res.confirm) { //这里是点击了确定以后 + console.log('yes') + wx.navigateTo({ + url: '/pages/goods_list/goods_list', + }) + wx.redirectTo({ + url: '/pages/goods_list/goods_list', + }) + } else { //这里是点击了取消以后 + console.log('no') + } + } + }) + + } + }, + /** * 生命周期函数--监听页面初次渲染完成 diff --git a/e_shop/pages/order/order.json b/e_shop/pages/order/order.json index 8835af0699ccec004cbe685ef938cd2d63ea7037..781f718c949f7159eddc581a3a2c3d12fb074e9b 100644 --- a/e_shop/pages/order/order.json +++ b/e_shop/pages/order/order.json @@ -1,3 +1,4 @@ { - "usingComponents": {} + "usingComponents": {}, + "navigationBarTitleText": "订单详情" } \ No newline at end of file diff --git a/e_shop/pages/order/order.wxml b/e_shop/pages/order/order.wxml index 072f20afd1d997401b206ae560ac0570dae36900..c3183386b3672601853ab56bd5f5255b5196d271 100644 --- a/e_shop/pages/order/order.wxml +++ b/e_shop/pages/order/order.wxml @@ -1,2 +1,42 @@ - -pages/order/order.wxml + + + + + + + 已签收 + + 234564774122222345647741222222222211111115544444444442222221111111554444444444 + + 查看物流 + + + + + + + + + + + + {{item.title}} + + + 规格:{{item.pro_name}} + + + ¥{{item.price}} + + + + + + + 订单编号:123456789 + 快递单号:75836082881288 + 交易时间:{{tools.dateFormat()}} + + + +{{value}} \ No newline at end of file diff --git a/e_shop/pages/order/order.wxss b/e_shop/pages/order/order.wxss index c258673e5b2be13a47279683aab6d3db1de82658..e59bee80cf46bdfce863e53c7edd1085f98d884d 100644 --- a/e_shop/pages/order/order.wxss +++ b/e_shop/pages/order/order.wxss @@ -1 +1,139 @@ -/* pages/order/order.wxss */ \ No newline at end of file +page { + background-color: #e0e0e0; +} + +.order_logistics { + height: 200rpx; + text-align: left; + background-color: #fff; + width: 96%; + margin: 10rpx auto 0; + border-radius: 20rpx; + display: flex; +} + +.order_logistics .iconfont { + margin: auto; +} + +.order_logistics .iconfont image { + background-color: var(--themeColor); + width: 80rpx; + height: 80rpx; + padding: 10rpx; + border-radius: 50%; +} + +.order_logistics_detail { + width: 50%; + margin-top: 20rpx; + font-size: 36rpx; +} + +.order_logistics_detail .new_order_logistics_detail { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 3; + overflow: hidden; + word-break: break-all; + text-align: left; + margin: 10rpx 0; + font-size: 30rpx; +} + +.search_order_logistics { + width: 26%; + border: 1rpx solid #cccccc; + background-color: #fff; + height: 60rpx; + text-align: center; + line-height: 60rpx; + border-radius: 30rpx; + margin: 70rpx 20rpx; +} + +.order_content { + background-color: #fff; + margin-bottom: 20rpx; +} + +.order_content .order { + height: 220rpx; + margin: 28rpx; + border-radius: 4rpx; + display: flex; + align-items: center; +} + +.order_content .order_img { + width: 180rpx; + height: 180rpx; +} + +.order_content .order_img image { + width: 100%; + height: 100%; + display: block; +} + +.order_content .order_text { + margin-left: 20rpx; + width: 70%; + height: 180rpx; +} + +.order_content .order_text .text_top { + display: flex; + justify-content: space-between; + align-items: center; +} + +.order_content .order_text .text_top .title { + font-size: 28rpx; + color: #4b5248; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 1; + overflow: hidden; +} + +.order_content .order_text .size { + font-size: 24rpx; + color: #a8ada6; +} + +.order_content .order_text .text_bottom { + display: flex; + margin-top: 50rpx; + align-items: center; + justify-content: space-between; +} + +.order_content .order_text .money { + font-size: 30rpx; + color: #a5937f; +} + +.order_main{ + background-color: #fff; +} + +.order_main .order_num,.order_log_num,.order_time{ + padding: 10rpx; + border-radius: 4rpx; + display: flex; + align-items: center; +} + +.order_evaluate { + width: 26%; + border: 1rpx solid #cccccc; + background-color: #fff; + color: #ff0000; + height: 60rpx; + text-align: center; + line-height: 60rpx; + border-radius: 30rpx; + float: right; + margin: 20rpx; +} \ No newline at end of file diff --git a/e_shop/pages/order/tools.wxs b/e_shop/pages/order/tools.wxs new file mode 100644 index 0000000000000000000000000000000000000000..ed8e173171fe11ef09d7a6618827ce50c1ccf4c2 --- /dev/null +++ b/e_shop/pages/order/tools.wxs @@ -0,0 +1,23 @@ +var dateFormat = function(){ + var now = getDate(); + year = now.getFullYear() + month = now.getMonth() + 1 + day = now.getDate() + hh = now.getHours(); + mm = now.getMinutes(); + ss = now.getSeconds(); + if(ss < 10){ + ss = '0' + ss + } + if(month < 10){ + month = '0' + month + } + if(day < 10){ + day = '0' + day + } + dateStr = year + '/' + month + '/' + day + ' ' + hh + ':' + mm + ':' + ss + ' ' + return dateStr; +} +module.exports = { + dateFormat : dateFormat +} diff --git a/e_shop/pages/person/.keep b/e_shop/pages/person/.keep new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/e_shop/pages/person/person.js b/e_shop/pages/person/person.js new file mode 100644 index 0000000000000000000000000000000000000000..0c73e8cfafee3009c2c7cc5e674f052670f5fafe --- /dev/null +++ b/e_shop/pages/person/person.js @@ -0,0 +1,78 @@ +const app = getApp() +Page({ + login(){ + wx.getUserProfile({ + desc: '授权所需', + success:(res) =>{ + console.log('授权成功',res.userInfo) + this.setData({ + touxiang:res.userInfo.avatarUrl, + nickName:res.userInfo.nickName, + isLogin:false, + }) + } + }) + }, + /** + * 页面的初始数据 + */ + data: { + nickName:'', + isLogin:'true', + }, + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function() { + +}, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function() { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function() { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function() { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function() { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function() { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function() { + + }, + + /** + * 用户点击右上角分享 + */ + onShareAppMessage: function() { + + } +}) \ No newline at end of file diff --git a/e_shop/pages/person/person.json b/e_shop/pages/person/person.json new file mode 100644 index 0000000000000000000000000000000000000000..6f5247b050d616d1d9ab35b9dec4da0b673757b8 --- /dev/null +++ b/e_shop/pages/person/person.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/e_shop/pages/person/person.wxml b/e_shop/pages/person/person.wxml new file mode 100644 index 0000000000000000000000000000000000000000..4c3961a58809ca07068ae10efd8b847cca5e4139 --- /dev/null +++ b/e_shop/pages/person/person.wxml @@ -0,0 +1,64 @@ + + + + + {{nickName}} + + + + + + 我的订单 + 查看全部订单 + + + + + + + {{item.name}} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/e_shop/pages/person/person.wxss b/e_shop/pages/person/person.wxss new file mode 100644 index 0000000000000000000000000000000000000000..08472ed549e7ccf4cdff19d06d82763b1883dbca --- /dev/null +++ b/e_shop/pages/person/person.wxss @@ -0,0 +1,188 @@ +/* pages/person/person.wxss */ +.userinfo-avatar { + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} +.header { + margin: 90rpx 0 90rpx 50rpx; + border-bottom: 1px solid #ccc; + text-align: center; + width: 650rpx; + height: 300rpx; + line-height: 450rpx; +} + +.header image { + width: 200rpx; + height: 200rpx; +} + +.content { + margin-left: 50rpx; + margin-bottom: 90rpx; +} + +.content text { + display: block; + color: #9d9d9d; + margin-top: 40rpx; +} + +.bottom { + border-radius: 80rpx; + margin: 70rpx 50rpx; + font-size: 35rpx; +} + +/* 用户中心 */ + +.userinfo { + display: flex; + flex-direction: column; + align-items: center; + background: skyblue; + width: 100%; + height: 300rpx; +} + +.userinfo-btn { + margin-top: 50rpx; + background: none !important; + color: #fff !important; + font-size: 40rpx; +} + +.account-bg { + width: 100%; + height: 150rpx; +} + +.userinfo-avatar { + width: 108rpx; + height: 108rpx; + margin: 40rpx; + border-radius: 50%; +} + +.userinfo-nickname { + color: #fff; +} + +/* 订单 */ +.line { + width: 100%; + height: 2rpx; + background: lightgray; +} +.order { + display: flex; + flex-direction: row; + align-items: center; + width: 100%; + height: 90rpx; +} + +.myorder-text { + font-size: 34rpx; + color: gray; + margin: 20rpx; + width: 40%; +} + +.myorderlook-text { + font-size: 32rpx; + color: gray; + position: relative; + right: 20rpx; + width: 60%; + text-align: right; +} + +.next-image { + width: 20rpx; + height: 25rpx; + position: relative; + right: 10rpx; +} + +.navs { + display: flex; +} + +.nav-item { + width: 25%; + display: flex; + align-items: center; + flex-direction: column; + padding: 20rpx; +} + +.nav-item .nav-image { + width: 55rpx; + height: 55rpx; + margin: 5rpx; +} + +.nav-item text { + margin-top: 20rpx; + font-size: 28rpx; + color: gray; +} + +/* 列表 */ + +.person-list { + display: flex; + flex-direction: column; + align-items: left; +} + +.list-item { + display: flex; + flex-direction: row; + align-items: center; + height: 80rpx; +} + +.item-image { + width: 40rpx; + height: 40rpx; + margin: 20rpx; +} + +.item-text { + color: gray; + width: 100%; + background-color: white; + border: none; + text-align: left; + padding: 0px; + margin: 0px; + line-height: 1.2; + font-size: 12px; +} + + +.person-line { + width: 80%; + height: 2rpx; + background: lightgray; + margin-left: 90rpx; +} +.cz{ + font-size: 20rpx +} + +.btn_login{ + background-color: white; + border: none; + text-align: center; + line-height: 1.2; +} + +.item-text::after{ + border: none; + border-radius: 0; +} \ No newline at end of file diff --git a/e_shop/pages/search/search.js b/e_shop/pages/search/search.js index ede280cc90a9418e4252957daa420e8a382a0698..700728a5271e75a03caaf900ff36a23d234bdc07 100644 --- a/e_shop/pages/search/search.js +++ b/e_shop/pages/search/search.js @@ -1,18 +1,36 @@ // pages/search/search.js +const db = wx.cloud.database(); +const list = db.collection('eshop_goods') Page({ /** * 页面的初始数据 */ data: { - + list: [] + }, + handleInput(e) { + console.log(e.detail.value) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + const db = wx.cloud.database({ + //这个是环境ID不是环境名称 + env: 'abccaonima-8guke6aa4c97445c' + }) + //开始查询数据 + db.collection('eshop_goods').get({ + //如果查询成功的话 + success: res => { + console.log(res.data) + this.setData({ + list: res.data + }) + } + }) }, /** diff --git a/e_shop/pages/search/search.wxml b/e_shop/pages/search/search.wxml index a8d892f3592878386103575e919feda179947a85..e4dd261307361c56fb5cade023ea94971f6f538a 100644 --- a/e_shop/pages/search/search.wxml +++ b/e_shop/pages/search/search.wxml @@ -1,2 +1,7 @@ - -pages/search/search.wxml + + + + + {{item.title}} + + \ No newline at end of file diff --git a/e_shop/request/789.txt b/e_shop/request/789.txt deleted file mode 100644 index be2fb0a390d694f75a1e5957254c29d7957fa3a2..0000000000000000000000000000000000000000 --- a/e_shop/request/789.txt +++ /dev/null @@ -1 +0,0 @@ -789 \ No newline at end of file diff --git a/e_shop/request/index.js b/e_shop/request/index.js new file mode 100644 index 0000000000000000000000000000000000000000..48eb9f31f028033d4257dc5bab1521582583e0ff --- /dev/null +++ b/e_shop/request/index.js @@ -0,0 +1,44 @@ +// 同时发送异步代码的次数 +let ajaxTimes = 0; +export const request = (params) => { + // 判断 url中是否带有 /my/ 请求的是私有的路径 带上header token + let header = { + ...params.header + }; + if (params.url.includes("/my/")) { + // 拼接header 带上token + header["Authorization"] = wx.getStorageSync("token"); + } + + + ajaxTimes++; + // 显示加载中 效果 + wx.showLoading({ + title: "加载中", + mask: true + }); + + + // 定义公共的url + const baseUrl = "https://api-hmugo-web.itheima.net/api/public/v1"; + return new Promise((resolve, reject) => { + wx.request({ + ...params, + header: header, + url: baseUrl + params.url, + success: (result) => { + resolve(result.data.message); + }, + fail: (err) => { + reject(err); + }, + complete: () => { + ajaxTimes--; + if (ajaxTimes === 0) { + // 关闭正在等待的图标 + wx.hideLoading(); + } + } + }); + }) +} \ No newline at end of file diff --git a/e_shop/utils/asyncWx.js b/e_shop/utils/asyncWx.js new file mode 100644 index 0000000000000000000000000000000000000000..26ee8051c1ea56e7124753dd2a729ac0b4e4caa9 --- /dev/null +++ b/e_shop/utils/asyncWx.js @@ -0,0 +1,122 @@ +/** + * promise 形式 getSetting + */ +export const getSetting=()=>{ + return new Promise((resolve,reject)=>{ + wx.getSetting({ + success: (result) => { + resolve(result); + }, + fail: (err) => { + reject(err); + } + }); + }) +} +/** + * promise 形式 chooseAddress + */ +export const chooseAddress=()=>{ + return new Promise((resolve,reject)=>{ + wx.chooseAddress({ + success: (result) => { + resolve(result); + }, + fail: (err) => { + reject(err); + } + }); + }) +} + +/** + * promise 形式 openSetting + */ +export const openSetting=()=>{ + return new Promise((resolve,reject)=>{ + wx.openSetting({ + success: (result) => { + resolve(result); + }, + fail: (err) => { + reject(err); + } + }); + }) +} + +/** + * promise 形式 showModal + * @param {object} param0 参数 + */ +export const showModal=({content})=>{ + return new Promise((resolve,reject)=>{ + wx.showModal({ + title: '提示', + content: content, + success :(res) =>{ + resolve(res); + }, + fail:(err)=>{ + reject(err); + } + }) + }) +} + + +/** + * promise 形式 showToast + * @param {object} param0 参数 + */ +export const showToast=({title})=>{ + return new Promise((resolve,reject)=>{ + wx.showToast({ + title: title, + icon: 'none', + success :(res) =>{ + resolve(res); + }, + fail:(err)=>{ + reject(err); + } + }) + }) +} + +/** + * promise 形式 login + */ +export const login=()=>{ + return new Promise((resolve,reject)=>{ + wx.login({ + timeout:10000, + success: (result) => { + resolve(result); + }, + fail: (err) => { + reject(err); + } + }); + }) +} + +/** + * promise 形式的 小程序的微信支付 + * @param {object} pay 支付所必要的参数 + */ +export const requestPayment=(pay)=>{ + return new Promise((resolve,reject)=>{ + wx.requestPayment({ + ...pay, + success: (result) => { + resolve(result) + }, + fail: (err) => { + reject(err); + } + }); + + }) +} +