This commit is contained in:
2023-10-05 00:57:32 +08:00
339 changed files with 14635 additions and 430 deletions

1
.idea/vcs.xml generated
View File

@@ -3,5 +3,6 @@
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/mina" vcs="Git" />
<mapping directory="$PROJECT_DIR$/native" vcs="Git" />
</component>
</project>

855
.idea/workspace.xml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,10 @@
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String
from sqlalchemy.schema import FetchedValue
from application import app,db
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Member(db.Model):
@@ -17,17 +20,3 @@ class Member(db.Model):
status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
updated_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
created_time = db.Column(db.DateTime, nullable=False, server_default=db.FetchedValue())
@property
def status_desc(self):
return app.config['STATUS_MAPPING'][ str( self.status ) ]
@property
def sex_desc(self):
sex_mapping = {
"0":"未知",
"1":"",
"2":""
}
return sex_mapping[str(self.sex)]

View File

@@ -44,7 +44,12 @@ UPLOAD = {
APP = {
# 'domain':'http://106.52.204.179:8999'
<<<<<<< HEAD
'domain':'https://python815.cn'
=======
>>>>>>> 86554b9ce9fff07f8fcb5b67a271976c08d3b684
}
@@ -61,4 +66,4 @@ PAY_STATUS_DISPLAY_MAPPING = {
"-7":"待发货",
"-6":"待确认",
"-5":"待评价"
}
}

View File

@@ -1,13 +1,14 @@
# -*- coding: utf-8 -*-
DEBUG = True
QLALCHEMY_ECHO = True
SQLALCHEMY_DATABASE_URI = 'mysql://root:~renjianbo0118mysql*&;@127.0.0.1/food_db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ENCODING = "utf8mb4"
APP = {
'domain': 'http://106.52.204.179:8999'
# 'domain':'https://python815.cn'
}
RELEASE_VERSION="2019822001"
# -*- coding: utf-8 -*-
DEBUG = True
QLALCHEMY_ECHO = True
SQLALCHEMY_DATABASE_URI = 'mysql://root:~renjianbo0118mysql*&;@127.0.0.1/food_db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
SQLALCHEMY_ENCODING = "utf8mb4"
APP = {
'domain': 'http://106.52.204.179:8999'
# 'domain':'https://python815.cn'
}
RELEASE_VERSION="2019822001"

11
helloo.py Normal file
View File

@@ -0,0 +1,11 @@
from flask import Flask,url_for
from imooc import route_imooc
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__) # 创建1个Flask实例
@app.route("/")
def hello_world():
return "Hello World"
if __name__ == '__main__':
app.run(host='0.0.0.0')

2
mina

Submodule mina updated: eb95198360...556449ab50

201
native/LICENSE Normal file
View File

@@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

79
native/app.js Normal file
View File

@@ -0,0 +1,79 @@
const WXAPI = require('apifm-wxapi')
const CONFIG = require('config.js')
const AUTH = require('utils/auth')
App({
onLaunch: function() {
WXAPI.init(CONFIG.subDomain) // 从根目录的 config.js 文件中读取
const that = this;
// 检测新版本
const updateManager = wx.getUpdateManager()
updateManager.onUpdateReady(function () {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
}
}
})
})
/**
* 初次加载判断网络情况
* 无网络状态下根据实际情况进行调整
*/
wx.getNetworkType({
success(res) {
const networkType = res.networkType
if (networkType === 'none') {
that.globalData.isConnected = false
wx.showToast({
title: '当前无网络',
icon: 'loading',
duration: 2000
})
}
}
});
/**
* 监听网络状态变化
* 可根据业务需求进行调整
*/
wx.onNetworkStatusChange(function(res) {
if (!res.isConnected) {
that.globalData.isConnected = false
wx.showToast({
title: '网络已断开',
icon: 'loading'
})
} else {
that.globalData.isConnected = true
wx.hideToast()
}
});
// 获取所有的文章分类
WXAPI.cmsCategories().then(res => {
if (res.code === 0) {
res.data.forEach(category => {
wx.setStorageSync('news_category_' + category.key, category)
})
}
})
},
onShow (e) {
if (e && e.query && e.query.cardUid) {
wx.setStorageSync('cardUid', e.query.cardUid)
wx.setStorageSync('referrer', e.query.cardUid)
}
// 自动登录
AUTH.checkHasLogined().then(isLogined => {
if (!isLogined) {
AUTH.login()
}
})
},
globalData: {
isConnected: true
}
})

47
native/app.json Normal file
View File

@@ -0,0 +1,47 @@
{
"pages": [
"pages/card/main",
"pages/cardposter/main",
"pages/index/main",
"pages/news/main",
"pages/products/main",
"pages/news-detail/main"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "WeChat",
"navigationBarTextStyle": "black",
"onReachBottomDistance": 50
},
"tabBar": {
"color": "#6e6d6b",
"selectedColor": "#1296db",
"borderStyle": "white",
"backgroundColor": "#fff",
"list": [
{
"pagePath": "pages/card/main",
"iconPath": "/images/mp/mp.png",
"selectedIconPath": "/images/mp/mpa.png",
"text": "名片"
},
{
"pagePath": "pages/products/main",
"iconPath": "/images/mp/pro.png",
"selectedIconPath": "/images/mp/proa.png",
"text": "产品"
},
{
"pagePath": "pages/news/main",
"iconPath": "/images/mp/dt.png",
"selectedIconPath": "/images/mp/dta.png",
"text": "动态"
}
]
},
"navigateToMiniProgramAppIdList": [
"wxaae03bb4c7273f06"
],
"sitemapLocation": "sitemap.json"
}

30
native/app.wxss Normal file
View File

@@ -0,0 +1,30 @@
@import 'weui/weui.wxss';
.container {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
}
.wxParse-img {
display: block !important;
}
.space {
height:20rpx;
background-color: #F2f2f2;
}
.safeAreaOldPaddingBttom {
padding-bottom: env(safe-area-inset-bottom);
}
.safeAreaNewPaddingBttom{
padding-bottom: constant(safe-area-inset-bottom);
}
.safeAreaOldMarginBttom {
margin-bottom: env(safe-area-inset-bottom);
}
.safeAreaNewMarginBttom{
margin-bottom: constant(safe-area-inset-bottom);
}

7
native/config.js Normal file
View File

@@ -0,0 +1,7 @@
module.exports = {
version: "2.1.0",
note: '优化了名片二维码的生成效率,减少图片空间存储',
// subDomain: "aicard", // 根据教程 https://www.yuque.com/apifm/doc/qr6l4m 查看你自己的 subDomain
subDomain: "hcms", // 根据教程 https://www.yuque.com/apifm/doc/qr6l4m 查看你自己的 subDomain
// subDomain: "", // 根据教程 https://www.yuque.com/apifm/doc/qr6l4m 查看你自己的 subDomain
}

BIN
native/images/add-addr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
native/images/addr-edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
native/images/addr-line.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

BIN
native/images/cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
native/images/fl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
native/images/fx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
native/images/fxad.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
native/images/gift.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

BIN
native/images/gou-red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
native/images/gou.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
native/images/ico-addr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
native/images/icon-cart.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
native/images/kefu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
native/images/more/wave.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
native/images/mp/about.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
native/images/mp/abouta.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

BIN
native/images/mp/dt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

BIN
native/images/mp/dta.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

BIN
native/images/mp/kf.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
native/images/mp/mp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
native/images/mp/mpa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
native/images/mp/mpj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

BIN
native/images/mp/pro.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 850 B

BIN
native/images/mp/proa.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

BIN
native/images/mp/pyq.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
native/images/mp/share.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

BIN
native/images/mp/txl.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

BIN
native/images/mp/wx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
native/images/nav/my-on.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

BIN
native/images/no-order.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
native/images/nologin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
native/images/notice.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
native/images/order/pj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
native/images/qd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
native/images/share.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

6
native/jsconfig.json Normal file
View File

@@ -0,0 +1,6 @@
{
"compilerOptions": {
"target": "es2015",
"module": "commonjs"
}
}

View File

@@ -0,0 +1,964 @@
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* eslint-disable */
// 小程序开发api接口工具包https://github.com/gooking/wxapi
//var API_BASE_URL = 'https://api.it120.cc';
var API_BASE_URL = 'http://www.ruilaizipj.com';
var subDomain = 'tz';
var request = function request(url, needSubDomain, method, data) {
var _url = API_BASE_URL + (needSubDomain ? '/' + subDomain : '') + url;
// var _url = API_BASE_URL + (needSubDomain ? '' + subDomain : '') + url;
return new Promise(function (resolve, reject) {
wx.request({
url: _url,
method: method,
data: data,
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function success(request) {
resolve(request.data);
},
fail: function fail(error) {
reject(error);
},
complete: function complete(aaa) {
// 加载完成
}
});
});
};
/**
* 小程序的promise没有finally方法自己扩展下
*/
Promise.prototype.finally = function (callback) {
var Promise = this.constructor;
return this.then(function (value) {
Promise.resolve(callback()).then(function () {
return value;
});
}, function (reason) {
Promise.resolve(callback()).then(function () {
throw reason;
});
});
};
module.exports = {
init2: function init2(a, b) {
API_BASE_URL = a;
subDomain = b;
},
init: function init(b) {
subDomain = b;
},
request: request,
queryMobileLocation: function queryMobileLocation() {
var mobile = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/common/mobile-segment/location', false, 'get', { mobile: mobile });
},
nextMobileSegment: function nextMobileSegment(data) {
return request('/common/mobile-segment/next', false, 'post', data);
},
queryConfigValue: function queryConfigValue(key) {
return request('/config/value', true, 'get', { key: key });
},
queryConfigBatch: function queryConfigBatch(keys) {
return request('/config/values', true, 'get', { keys: keys });
},
scoreRules: function scoreRules(data) {
return request('/score/send/rule', true, 'post', data);
},
scoreSignRules: function scoreSignRules() {
return request('/score/sign/rules', true, 'get', {});
},
scoreSign: function scoreSign(token) {
return request('/score/sign', true, 'post', {
token: token
});
},
scoreSignLogs: function scoreSignLogs(data) {
return request('/score/sign/logs', true, 'post', data);
},
scoreTodaySignedInfo: function scoreTodaySignedInfo(token) {
return request('/score/today-signed', true, 'get', {
token: token
});
},
scoreExchange: function scoreExchange(token, number) {
return request('/score/exchange', true, 'post', {
number: number,
token: token
});
},
scoreLogs: function scoreLogs(data) {
return request('/score/logs', true, 'post', data);
},
shareGroupGetScore: function shareGroupGetScore(referrer, encryptedData, iv) {
return request('/score/share/wxa/group', true, 'post', {
referrer: referrer,
encryptedData: encryptedData,
iv: iv
});
},
kanjiaSet: function kanjiaSet(goodsId) {
return request('/shop/goods/kanjia/set', true, 'get', { goodsId: goodsId });
},
kanjiaJoin: function kanjiaJoin(token, kjid) {
return request('/shop/goods/kanjia/join', true, 'post', {
kjid: kjid,
token: token
});
},
kanjiaDetail: function kanjiaDetail(kjid, joiner) {
return request('/shop/goods/kanjia/info', true, 'get', {
kjid: kjid,
joiner: joiner
});
},
kanjiaHelp: function kanjiaHelp(token, kjid, joiner) {
var remark = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/shop/goods/kanjia/help', true, 'post', {
kjid: kjid,
joinerUser: joiner,
token: token,
remark: remark
});
},
kanjiaClear: function kanjiaClear(token, kjid) {
return request('/shop/goods/kanjia/clear', true, 'post', {
kjid: kjid,
token: token
});
},
kanjiaMyJoinInfo: function kanjiaMyJoinInfo(token, kjid) {
return request('/shop/goods/kanjia/my', true, 'get', {
kjid: kjid,
token: token
});
},
kanjiaHelpDetail: function kanjiaHelpDetail(token, kjid, joiner) {
return request('/shop/goods/kanjia/myHelp', true, 'get', {
kjid: kjid,
joinerUser: joiner,
token: token
});
},
checkToken: function checkToken(token) {
return request('/user/check-token', true, 'get', {
token: token
});
},
addTempleMsgFormid: function addTempleMsgFormid(token, type, formId) {
return request('/template-msg/wxa/formId', true, 'post', {
token: token, type: type, formId: formId
});
},
sendTempleMsg: function sendTempleMsg(data) {
return request('/template-msg/put', true, 'post', data);
},
wxpay: function wxpay(data) {
return request('/pay/wx/wxapp', true, 'post', data);
},
wxpaySaobei: function wxpaySaobei(data) {
return request('/pay/lcsw/wxapp', true, 'post', data);
},
wxpayWepayez: function wxpayWepayez(data) {
return request('/pay/wepayez/wxapp', true, 'post', data);
},
alipay: function alipay(data) {
return request('/pay/alipay/semiAutomatic/payurl', true, 'post', data);
},
login_wx: function login_wx(code,nickName,avatarUrl,gender,province,city,country) {
return request('/wxlogin/login', true, 'post', {
code: code,
nickName: nickName,
avatarUrl: avatarUrl,
gender: gender,
province: province,
city: city,
country: country,
});
},
// login_wx: function login_wx(data) {
// return request('/wxlogin/login', true, 'post', data);
// },
register_complex: function register_complex(data) {
return request('/user/wxapp/register/complex', true, 'post', data);
},
register_simple: function register_simple(data) {
return request('/user/wxapp/register/simple', true, 'post', data);
},
register_username: function register_username(data) {
return request('/user/username/register', true, 'post', data);
},
register_mobile: function register_mobile(data) {
return request('/user/m/register', true, 'post', data);
},
banners: function banners(data) {
return request('/banner/list', true, 'get', data);
},
goodsCategory: function goodsCategory() {
return request('/shop/goods/category/all', true, 'get');
},
goods: function goods(data) {
return request('/shop/goods/list', true, 'post', data);
},
goodsDetail: function goodsDetail(id) {
return request('/shop/goods/detail', true, 'get', {
id: id
});
},
goodsLimitations: function goodsLimitations(goodsId) {
var priceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shop/goods/limitation', true, 'get', {
goodsId: goodsId, priceId: priceId
});
},
goodsPrice: function goodsPrice(goodsId, propertyChildIds) {
return request('/shop/goods/price', true, 'post', {
goodsId: goodsId, propertyChildIds: propertyChildIds
});
},
goodsPriceDaily: function goodsPriceDaily(goodsId) {
var priceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/shop/goods/price/day', true, 'get', {
goodsId: goodsId, priceId: priceId
});
},
goodsPriceFreight: function goodsPriceFreight(data) {
return request('/shop/goods/price/freight', true, 'get', data);
},
goodsRebate: function goodsRebate(token, goodsId) {
return request('/shop/goods/rebate', true, 'get', {
token: token, goodsId: goodsId
});
},
goodsReputation: function goodsReputation(data) {
return request('/shop/goods/reputation', true, 'post', data);
},
goodsFavList: function goodsFavList(data) {
return request('/shop/goods/fav/list', true, 'post', data);
},
goodsFavPut: function goodsFavPut(token, goodsId) {
return request('/shop/goods/fav/add', true, 'post', {
token: token, goodsId: goodsId
});
},
goodsFavCheck: function goodsFavCheck(token, goodsId) {
return request('/shop/goods/fav/check', true, 'get', {
token: token, goodsId: goodsId
});
},
goodsFavDelete: function goodsFavDelete(token) {
var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var goodsId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/shop/goods/fav/delete', true, 'post', {
token: token, id: id, goodsId: goodsId
});
},
coupons: function coupons(data) {
return request('/discounts/coupons', true, 'get', data);
},
couponDetail: function couponDetail(id) {
return request('/discounts/detail', true, 'get', {
id: id
});
},
myCoupons: function myCoupons(data) {
return request('/discounts/my', true, 'get', data);
},
fetchCoupons: function fetchCoupons(data) {
return request('/discounts/fetch', true, 'post', data);
},
sendCoupons: function sendCoupons(data) {
return request('/discounts/send', true, 'post', data);
},
exchangeCoupons: function exchangeCoupons(token, number, pwd) {
return request('/discounts/exchange', true, 'post', {
token: token, number: number, pwd: pwd
});
},
noticeList: function noticeList(data) {
return request('/notice/list', true, 'post', data);
},
noticeLastOne: function noticeLastOne() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/notice/last-one', true, 'get', {
type: type
});
},
noticeDetail: function noticeDetail(id) {
return request('/notice/detail', true, 'get', {
id: id
});
},
addAddress: function addAddress(data) {
return request('/user/shipping-address/add', true, 'post', data);
},
updateAddress: function updateAddress(data) {
return request('/user/shipping-address/update', true, 'post', data);
},
deleteAddress: function deleteAddress(token, id) {
return request('/user/shipping-address/delete', true, 'post', {
id: id,
token: token
});
},
queryAddress: function queryAddress(token) {
return request('/user/shipping-address/list', true, 'get', {
token: token
});
},
defaultAddress: function defaultAddress(token) {
return request('/user/shipping-address/default/v2', true, 'get', {
token: token
});
},
addressDetail: function addressDetail(token, id) {
return request('/user/shipping-address/detail/v2', true, 'get', {
id: id,
token: token
});
},
pingtuanSet: function pingtuanSet(goodsId) {
return request('/shop/goods/pingtuan/set', true, 'get', {
goodsId: goodsId
});
},
pingtuanSets: function pingtuanSets(goodsIdArray) {
return request('/shop/goods/pingtuan/sets', true, 'get', {
goodsId: goodsIdArray.join()
});
},
pingtuanOpen: function pingtuanOpen(token, goodsId) {
return request('/shop/goods/pingtuan/open', true, 'post', {
goodsId: goodsId,
token: token
});
},
pingtuanList: function pingtuanList(data) {
return request('/shop/goods/pingtuan/list/v2', true, 'post', data);
},
pingtuanJoinUsers: function pingtuanJoinUsers(tuanId) {
return request('/shop/goods/pingtuan/joiner', true, 'get', { tuanId: tuanId });
},
pingtuanMyJoined: function pingtuanMyJoined(data) {
return request('/shop/goods/pingtuan/my-join-list', true, 'post', data);
},
friendlyPartnerList: function friendlyPartnerList() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/friendly-partner/list', true, 'post', {
type: type
});
},
friendList: function friendList(data) {
return request('/user/friend/list', true, 'post', data);
},
addFriend: function addFriend(token, uid) {
return request('/user/friend/add', true, 'post', { token: token, uid: uid });
},
friendUserDetail: function friendUserDetail(token, uid) {
return request('/user/friend/detail', true, 'get', { token: token, uid: uid });
},
// friendUserDetail: function friendUserDetail(token, uid) {
// return request('/wxlogin/login', true, 'get', { token: token, uid: uid });
// },
videoDetail: function videoDetail(videoId) {
return request('/media/video/detail', true, 'get', {
videoId: videoId
});
},
bindMobileWxa: function bindMobileWxa(token, encryptedData, iv) {
var pwd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/wxapp/bindMobile', true, 'post', {
token: token, encryptedData: encryptedData, iv: iv, pwd: pwd
});
},
bindMobileSms: function bindMobileSms(token, mobile, code) {
var pwd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/m/bind-mobile', true, 'post', {
token: token, mobile: mobile, code: code, pwd: pwd
});
},
userDetail: function userDetail(token) {
return request('/user/detail', true, 'get', {
token: token
});
},
userWxinfo: function userWxinfo(token) {
return request('/user/wxinfo', true, 'get', {
token: token
});
},
userAmount: function userAmount(token) {
return request('/user/amount', true, 'get', {
token: token
});
},
orderCreate: function orderCreate(data) {
return request('/order/create', true, 'post', data);
},
orderList: function orderList(data) {
return request('/order/list', true, 'post', data);
},
orderDetail: function orderDetail(token, id) {
return request('/order/detail', true, 'get', {
id: id,
token: token
});
},
orderDelivery: function orderDelivery(token, orderId) {
return request('/order/delivery', true, 'post', {
orderId: orderId,
token: token
});
},
orderReputation: function orderReputation(data) {
return request('/order/reputation', true, 'post', data);
},
orderClose: function orderClose(token, orderId) {
return request('/order/close', true, 'post', {
orderId: orderId,
token: token
});
},
orderDelete: function orderDelete(token, orderId) {
return request('/order/delete', true, 'post', {
orderId: orderId,
token: token
});
},
orderPay: function orderPay(token, orderId) {
return request('/order/pay', true, 'post', {
orderId: orderId,
token: token
});
},
orderHX: function orderHX(hxNumber) {
return request('/order/hx', true, 'post', {
hxNumber: hxNumber
});
},
orderStatistics: function orderStatistics(token) {
return request('/order/statistics', true, 'get', {
token: token
});
},
orderRefunds: function orderRefunds(token, orderId) {
return request('/order/refund', true, 'get', {
token: token,
orderId: orderId
});
},
withDrawApply: function withDrawApply(token, money) {
return request('/user/withDraw/apply', true, 'post', {
money: money,
token: token
});
},
withDrawDetail: function withDrawDetail(token, id) {
return request('/user/withDraw/detail', true, 'get', {
token: token,
id: id
});
},
withDrawLogs: function withDrawLogs(data) {
return request('/user/withDraw/list', true, 'post', data);
},
province: function province() {
return request('/common/region/v2/province', false, 'get');
},
nextRegion: function nextRegion(pid) {
return request('/common/region/v2/child', false, 'get', {
pid: pid
});
},
cashLogs: function cashLogs(data) {
return request('/user/cashLog', true, 'post', data);
},
payLogs: function payLogs(data) {
return request('/user/payLogs', true, 'post', data);
},
rechargeSendRules: function rechargeSendRules() {
return request('/user/recharge/send/rule', true, 'get');
},
payBillDiscounts: function payBillDiscounts() {
return request('/payBill/discounts', true, 'get');
},
payBill: function payBill(token, money) {
return request('/payBill/pay', true, 'post', { token: token, money: money });
},
vipLevel: function vipLevel() {
return request('/config/vipLevel', true, 'get');
},
fxApply: function fxApply(token, name, mobile) {
return request('/saleDistribution/apply', true, 'post', { token: token, name: name, mobile: mobile });
},
fxApplyProgress: function fxApplyProgress(token) {
return request('/saleDistribution/apply/progress', true, 'get', { token: token });
},
fxMembers: function fxMembers(data) {
return request('/saleDistribution/members', true, 'post', data);
},
fxCommisionLog: function fxCommisionLog(data) {
return request('/saleDistribution/commision/log', true, 'post', data);
},
wxaQrcode: function wxaQrcode(data) {
return request('/qrcode/wxa/unlimit', true, 'post', data);
},
uploadFile: function uploadFile(token, tempFilePath) {
var uploadUrl = API_BASE_URL + '/' + subDomain + '/dfs/upload/file';
return new Promise(function (resolve, reject) {
wx.uploadFile({
url: uploadUrl,
filePath: tempFilePath,
name: 'upfile',
formData: {
'token': token
},
success: function success(res) {
resolve(JSON.parse(res.data));
},
fail: function fail(error) {
reject(error);
},
complete: function complete(aaa) {
// 加载完成
}
});
});
},
uploadFileFromUrl: function uploadFileFromUrl() {
var remoteFileUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var ext = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return request('/dfs/upload/url', true, 'post', { remoteFileUrl: remoteFileUrl, ext: ext });
},
uploadFileList: function uploadFileList() {
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/dfs/upload/list', true, 'post', { path: path });
},
refundApply: function refundApply(data) {
return request('/order/refundApply/apply', true, 'post', data);
},
refundApplyDetail: function refundApplyDetail(token, orderId) {
return request('/order/refundApply/info', true, 'get', {
token: token,
orderId: orderId
});
},
refundApplyCancel: function refundApplyCancel(token, orderId) {
return request('/order/refundApply/cancel', true, 'post', {
token: token,
orderId: orderId
});
},
cmsCategories: function cmsCategories() {
return request('/cms/category/list', true, 'get', {});
},
cmsCategoryDetail: function cmsCategoryDetail(id) {
return request('/cms/category/detail', true, 'get', { id: id });
},
cmsArticles: function cmsArticles(data) {
return request('/cms/news/list', true, 'post', data);
},
cmsArticleUsefulLogs: function cmsArticleUsefulLogs(data) {
return request('/cms/news/useful/logs', true, 'post', data);
},
cmsArticleDetail: function cmsArticleDetail(id) {
return request('/cms/news/detail', true, 'get', { id: id });
},
cmsArticlePreNext: function cmsArticlePreNext(id) {
return request('/cms/news/preNext', true, 'get', { id: id });
},
cmsArticleCreate: function cmsArticleCreate(data) {
return request('/cms/news/put', true, 'post', data);
},
cmsArticleDelete: function cmsArticleDelete(token, id) {
return request('/cms/news/del', true, 'post', { token: token, id: id });
},
cmsArticleUseless: function cmsArticleUseless(data) {
return request('/cms/news/useful', true, 'post', data);
},
cmsPage: function cmsPage(key) {
return request('/cms/page/info/v2', true, 'get', { key: key });
},
cmsTags: function cmsTags() {
return request('/cms/tags/list', true, 'get', {});
},
invoiceList: function invoiceList(data) {
return request('/invoice/list', true, 'post', data);
},
invoiceApply: function invoiceApply(data) {
return request('/invoice/apply', true, 'post', data);
},
invoiceDetail: function invoiceDetail(token, id) {
return request('/invoice/info', true, 'get', { token: token, id: id });
},
depositList: function depositList(data) {
return request('/deposit/list', true, 'post', data);
},
payDeposit: function payDeposit(data) {
return request('/deposit/pay', true, 'post', data);
},
depositInfo: function depositInfo(token, id) {
return request('/deposit/info', true, 'get', { token: token, id: id });
},
depositBackApply: function depositBackApply(token, id) {
return request('/deposit/back/apply', true, 'post', { token: token, id: id });
},
fetchShops: function fetchShops(data) {
return request('/shop/subshop/list', true, 'post', data);
},
shopSubdetail: function shopSubdetail(id) {
return request('/shop/subshop/detail/v2', true, 'get', { id: id });
},
addComment: function addComment(data) {
return request('/comment/add', true, 'post', data);
},
commentList: function commentList(data) {
return request('/comment/list', true, 'post', data);
},
modifyUserInfo: function modifyUserInfo(data) {
return request('/user/modify', true, 'post', data);
},
uniqueId: function uniqueId() {
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/uniqueId/get', true, 'get', { type: type });
},
queryBarcode: function queryBarcode() {
var barcode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/barcode/info', true, 'get', { barcode: barcode });
},
luckyInfo: function luckyInfo(id) {
return request('/luckyInfo/info', true, 'get', { id: id });
},
luckyInfoJoin: function luckyInfoJoin(id, token) {
return request('/luckyInfo/join', true, 'post', { id: id, token: token });
},
luckyInfoJoinMy: function luckyInfoJoinMy(id, token) {
return request('/luckyInfo/join/my', true, 'get', { id: id, token: token });
},
luckyInfoJoinLogs: function luckyInfoJoinLogs(data) {
return request('/luckyInfo/join/logs', true, 'post', data);
},
jsonList: function jsonList(data) {
return request('/json/list', true, 'post', data);
},
jsonSet: function jsonSet(data) {
return request('/json/set', true, 'post', data);
},
jsonDelete: function jsonDelete() {
var token = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var id = arguments[1];
return request('/json/delete', true, 'post', { token: token, id: id });
},
graphValidateCodeUrl: function graphValidateCodeUrl() {
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Math.random();
var _url = API_BASE_URL + '/' + subDomain + '/verification/pic/get?key=' + key;
return _url;
},
graphValidateCodeCheck: function graphValidateCodeCheck() {
var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Math.random();
var code = arguments[1];
return request('/verification/pic/check', true, 'post', { key: key, code: code });
},
shortUrl: function shortUrl() {
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/common/short-url/shorten', false, 'post', { url: url });
},
smsValidateCode: function smsValidateCode(mobile) {
var key = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var picCode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/verification/sms/get', true, 'get', { mobile: mobile, key: key, picCode: picCode });
},
smsValidateCodeCheck: function smsValidateCodeCheck(mobile, code) {
return request('/verification/sms/check', true, 'post', { mobile: mobile, code: code });
},
mailValidateCode: function mailValidateCode(mail) {
return request('/verification/mail/get', true, 'get', { mail: mail });
},
mailValidateCodeCheck: function mailValidateCodeCheck(mail, code) {
return request('/verification/mail/check', true, 'post', { mail: mail, code: code });
},
mapDistance: function mapDistance(lat1, lng1, lat2, lng2) {
return request('/common/map/distance', false, 'get', { lat1: lat1, lng1: lng1, lat2: lat2, lng2: lng2 });
},
mapQQAddress: function mapQQAddress() {
var location = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var coord_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '5';
return request('/common/map/qq/address', false, 'get', { location: location, coord_type: coord_type });
},
mapQQSearch: function mapQQSearch(data) {
return request('/common/map/qq/search', false, 'post', data);
},
virtualTraderList: function virtualTraderList(data) {
return request('/virtualTrader/list', true, 'post', data);
},
virtualTraderDetail: function virtualTraderDetail(token, id) {
return request('/virtualTrader/info', true, 'get', { token: token, id: id });
},
virtualTraderBuy: function virtualTraderBuy(token, id) {
return request('/virtualTrader/buy', true, 'post', { token: token, id: id });
},
virtualTraderMyBuyLogs: function virtualTraderMyBuyLogs(data) {
return request('/virtualTrader/buy/logs', true, 'post', data);
},
queuingTypes: function queuingTypes() {
var status = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
return request('/queuing/types', true, 'get', { status: status });
},
queuingGet: function queuingGet(token, typeId) {
var mobile = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/queuing/get', true, 'post', { token: token, typeId: typeId, mobile: mobile });
},
queuingMy: function queuingMy(token) {
var typeId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var status = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return request('/queuing/my', true, 'get', { token: token, typeId: typeId, status: status });
},
idcardCheck: function idcardCheck(token, name, idCardNo) {
return request('/user/idcard', true, 'post', { token: token, name: name, idCardNo: idCardNo });
},
loginout: function loginout(token) {
return request('/user/loginout', true, 'get', { token: token });
},
userLevelList: function userLevelList(data) {
return request('/user/level/list', true, 'post', data);
},
userLevelDetail: function userLevelDetail(levelId) {
return request('/user/level/info', true, 'get', { id: levelId });
},
userLevelPrices: function userLevelPrices(levelId) {
return request('/user/level/prices', true, 'get', { levelId: levelId });
},
userLevelBuy: function userLevelBuy(token, priceId) {
var isAutoRenew = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var remark = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/level/buy', true, 'post', {
token: token,
userLevelPriceId: priceId,
isAutoRenew: isAutoRenew,
remark: remark
});
},
userLevelBuyLogs: function userLevelBuyLogs(data) {
return request('/user/level/buyLogs', true, 'post', data);
},
messageList: function messageList(data) {
return request('/user/message/list', true, 'post', data);
},
messageRead: function messageRead(token, id) {
return request('/user/message/read', true, 'post', { token: token, id: id });
},
messageDelete: function messageDelete(token, id) {
return request('/user/message/del', true, 'post', { token: token, id: id });
},
bindOpenid: function bindOpenid(token, code) {
return request('/user/wxapp/bindOpenid', true, 'post', {
token: token, code: code,
type: 2
});
},
encryptedData: function encryptedData(code, _encryptedData, iv) {
return request('/user/wxapp/decode/encryptedData', true, 'post', {
code: code, encryptedData: _encryptedData, iv: iv
});
},
scoreDeductionRules: function scoreDeductionRules() {
return request('/score/deduction/rules', true, 'get', {});
},
voteItems: function voteItems(data) {
return request('/vote/items', true, 'post', data);
},
voteItemDetail: function voteItemDetail(id) {
return request('/vote/info', true, 'get', { id: id });
},
vote: function vote(token, voteId, items, remark) {
return request('/vote/vote', true, 'post', {
token: token, voteId: voteId,
items: items.join(),
remark: remark
});
},
myVote: function myVote(token, voteId) {
return request('/vote/vote/info', true, 'get', {
token: token, voteId: voteId
});
},
voteLogs: function voteLogs(data) {
return request('/vote/vote/list', true, 'post', data);
},
yuyueItems: function yuyueItems(data) {
return request('/yuyue/items', true, 'post', data);
},
yuyueItemDetail: function yuyueItemDetail(id) {
return request('/yuyue/info', true, 'get', { id: id });
},
yuyueJoin: function yuyueJoin(data) {
return request('/yuyue/join', true, 'post', data);
},
yuyueJoinPay: function yuyueJoinPay(token, joinId) {
return request('/yuyue/pay', true, 'post', {
token: token, joinId: joinId
});
},
yuyueJoinUpdate: function yuyueJoinUpdate(token, joinId, extJsonStr) {
return request('/yuyue/join/update', true, 'post', {
token: token, joinId: joinId, extJsonStr: extJsonStr
});
},
yuyueMyJoinInfo: function yuyueMyJoinInfo(token, joinId) {
return request('/yuyue/join/info', true, 'post', {
token: token, joinId: joinId
});
},
yuyueMyJoinLogs: function yuyueMyJoinLogs(data) {
return request('/yuyue/join/list', true, 'post', data);
},
yuyueTeams: function yuyueTeams(data) {
return request('/yuyue/info/teams', true, 'post', data);
},
yuyueTeamDetail: function yuyueTeamDetail(teamId) {
return request('/yuyue/info/team', true, 'get', { teamId: teamId });
},
yuyueTeamMembers: function yuyueTeamMembers(data) {
return request('/yuyue/info/team/members', true, 'post', data);
},
yuyueTeamDeleteMember: function yuyueTeamDeleteMember(token, joinId) {
return request('/yuyue/info/team/members/del', true, 'post', data);
},
register_email: function register_email(data) {
return request('/user/email/register', true, 'post', data);
},
login_email: function login_email(data) {
return request('/user/email/login', true, 'post', data);
},
bindEmail: function bindEmail(token, email, code) {
var pwd = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
return request('/user/email/bindUsername', true, 'post', {
token: token, email: email, code: code, pwd: pwd
});
}
};
/***/ })
/******/ ]);

13
native/package-lock.json generated Normal file
View File

@@ -0,0 +1,13 @@
{
"name": "wechat-app-mall",
"version": "7.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"apifm-wxapi": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/apifm-wxapi/-/apifm-wxapi-2.0.0.tgz",
"integrity": "sha512-I8B8KbQ/zb43SYlWWKsE9qFeqG344OkfYuC4dZvHExAa4FbRC0Hna6Z2sehGXqkN3ILEbt5r7gjK5m1uC++1kQ=="
}
}
}

28
native/package.json Normal file
View File

@@ -0,0 +1,28 @@
{
"name": "wechat-app-mall",
"version": "7.0.0",
"description": "微信小程序商城,微信小程序微店",
"main": "app.js",
"dependencies": {
"apifm-wxapi": "^2.0.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/EastWorld/wechat-app-mall.git"
},
"keywords": [
"微店",
"小店",
"微商城"
],
"author": "gooking",
"license": "ISC",
"bugs": {
"url": "https://github.com/EastWorld/wechat-app-mall/issues"
},
"homepage": "https://github.com/EastWorld/wechat-app-mall#readme"
}

226
native/pages/card/main.js Normal file
View File

@@ -0,0 +1,226 @@
const WXAPI = require('apifm-wxapi')
const AUTH = require('../../utils/auth')
const APP = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
wxlogin: true,
showMpjbutton: false,
openShare: false,
cardUserInfo: undefined,
kActionType: {},
content: '...',
qrcode: undefined
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (e) {
if (e.scene) { // 扫码
const scene = decodeURIComponent(e.scene)
wx.setStorageSync('referrer', scene)
wx.setStorageSync('cardUid', scene)
}
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
async onShow () {
AUTH.checkHasLogined().then(isLogined => {
this.setData({
wxlogin: isLogined
})
})
await WXAPI.queryConfigBatch('mallName,DEFAULT_FRIEND_UID').then(function (res) {
if (res.code == 0) {
res.data.forEach(config => {
wx.setStorageSync(config.key, config.value);
})
}
})
const cardUid = await this.getCardUid()
this.getCardInfo(cardUid)
const qrcode = APP.globalData._haibaoimg_qrcode
if (!qrcode) {
// 获取二维码
WXAPI.wxaQrcode({
scene: cardUid,
page: 'pages/card/main',
is_hyaline: false,
expireHours: 1
}).then(res => {
if(res.code == 0){
APP.globalData._haibaoimg_qrcode = res.data
this.setData({
qrcode: res.data
})
}
})
} else {
this.setData({
qrcode
})
}
},
async getCardUid(){
let cardUid = wx.getStorageSync('cardUid')
const uid = wx.getStorageSync('uid')
if (!cardUid) {
// 没有通过链接或者扫码进来
if (uid) {
// 当前用户已登录
const res = await WXAPI.userDetail(wx.getStorageSync('token'))
if (res.code == 0 && res.data.userLevel && res.data.userLevel.name === 'aicard') {
return uid
}
}
// 读取默认设置
cardUid = wx.getStorageSync('DEFAULT_FRIEND_UID')
}
return cardUid
},
async getCardInfo(cardUid){
const uid = wx.getStorageSync('uid')
const token = wx.getStorageSync('token')
if (uid) {
// 添加到我的名片夹
WXAPI.addFriend(token, cardUid)
}
// 读取名片详情信息
const res = await WXAPI.friendUserDetail(token, cardUid)
if (res.code == 0) {
const _data = {
kActionType: {}
}
if (res.data.userLevel && res.data.userLevel.maxUser && res.data.userLevel.maxUser > 1) {
_data.showMpjbutton = true
}
_data.cardUserInfo = res.data
if (_data.cardUserInfo.ext) {
Object.keys(_data.cardUserInfo.ext).forEach(k => {
// kActionType
const v = _data.cardUserInfo.ext[k]
_data.kActionType[k] = v
})
}
wx.setNavigationBarTitle({
title: _data.cardUserInfo.base.nick + ' - ' + wx.getStorageSync('mallName')
})
this.setData(_data)
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
return {
title: '您好,我是 ' + wx.getStorageSync('mallName') + ' 的' + this.data.cardUserInfo.base.nick + ',请惠存我的名片。',
path: '/pages/card/main?cardUid=' + this.data.cardUserInfo.base.id,
imageUrl: this.data.cardUserInfo.base.avatarUrl
}
},
callPhone(){
wx.makePhoneCall({
phoneNumber: this.data.cardUserInfo.base.mobile
})
},
copyData(e){
const v = e.currentTarget.dataset.v
wx.setClipboardData({
data: v,
success: (res) => {
wx.showToast({
title: '复制成功',
icon: 'success'
})
}
})
},
goIndex(){
wx.navigateTo({
url: '/pages/index/main'
})
},
createHaibao() { // 生成海报
wx.chooseImage({
count: 1,
success: (res) => {
console.log(res)
wx.setStorageSync('_haibaoimg', res.tempFilePaths[0])
this.cardposter()
}
})
},
cardposter() {
wx.navigateTo({
url: '/pages/cardposter/main?cardUid=' + this.data.cardUserInfo.base.id
})
},
addPhoneContact() {
// 调用登录接口
wx.addPhoneContact({
photoFilePath: this.data.cardUserInfo.base.avatarUrl,
organization: wx.getStorageSync('mallName'),
title: this.data.cardUserInfo.ext['职位'],
firstName: this.data.cardUserInfo.base.nick,
mobilePhoneNumber: this.data.cardUserInfo.base.mobile
})
},
cancelLogin() {
this.setData({
wxlogin: true
})
},
processLogin(e) {
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,51 @@
<view class="container">
<view class="max-width">
<image class="userinfo-avatar" src="{{cardUserInfo.base.avatarUrl}}" mode="widthFix" />
</view>
<view class="profile-box">
<view class="profile">
<view class="name">{{ cardUserInfo.base.nick }}</view>
<view class="position">{{ cardUserInfo.ext ? cardUserInfo.ext['职位'] : '-' }}</view>
</view>
<view class="profile2">
<view class="name">手机</view>
<view class="position">{{cardUserInfo.base.mobile}}</view>
<view class="action">
<button class="action" bindtap="callPhone">拨打</button>
</view>
</view>
<view wx:for="{{cardUserInfo.ext}}" wx:for-index='k' wx:key="index" class="profile2">
<view class="name">{{k}}</view>
<view class="position">{{item}}</view>
<view class="action">
<button class="action" data-v="{{item}}" bindtap="copyData">复制</button>
</view>
</view>
</view>
<view class="action-buttons">
<view class="button" bindtap="createHaibao">
<image class="img" src="/images/mp/posters.png" />
<view class="txt">生成海报</view>
</view>
<view class="button" bindtap="addPhoneContact">
<image class="img" src="/images/mp/txl.png" />
<view class="txt">存入通讯录</view>
</view>
<view class="button">
<button open-type="share" plain="true" style="border:none;">
<image class="img" style="margin-left:0;" src="/images/mp/share.png" />
</button>
<view class="txt">分享好友</view>
</view>
</view>
<view>
<image wx:if="{{ qrcode }}" class="qrcode" src="{{qrcode}}" />
</view>
<view wx:if="{{showMpjbutton}}" class="sharempj" bindtap="goIndex">
<image class="shareimg" src="/images/mp/mpj.png" />
</view>
</view>
<import src="/template/login/index.wxml" />
<template is="apifmLogin" data="{{wxlogin: wxlogin}}" />

140
native/pages/card/main.wxss Normal file
View File

@@ -0,0 +1,140 @@
@import "/template/login/index.wxss";
.container {
width: 750rpx;
background-color: #faf9f9;
}
.max-width {
width: 750rpx;
background-color: #ffffff;
}
.userinfo-avatar {
width: 750rpx;
}
.profile-box {
position: relative;
width:650rpx;
background-color: #ffffff;
bottom:100rpx;
}
.action-buttons {
width: 750rpx;
display: flex;
text-align: center;
}
.action-buttons .button {
width: 250rpx;
text-align: center;
}
.action-buttons .button .img {
width: 180rpx;
height: 180rpx;
margin-left: 35rpx;
display: block;
}
.action-buttons .button .txt {
font-size: 12px;
display: block;
}
.profile {
text-align: left;
padding: 20rpx;
color:#555555;
display: flex;
flex-direction: row;
align-items:flex-end;
}
.profile .name {
font-size: 20px;
}
.profile .position {
font-size: 12px;
margin-left: 30rpx;
}
.phone {
text-align: left;
padding: 20rpx;
font-size: 14px;
}
.profile2 {
text-align: left;
padding: 20rpx;
color:#555555;
display: flex;
flex-direction: row;
justify-content:space-between;
align-items:flex-end;
}
.profile2 .name {
font-size: 16px;
width:120rpx;
}
.profile2 .position {
font-size: 14px;
width:400rpx;
}
.profile2 .action {
font-size: 12px;
width:120rpx;
}
.share {
position:fixed;
right:0rpx;
top: 600rpx;
}
.sharempj {
position:fixed;
left:0rpx;
top: 60rpx;
}
.share .shareimg {
width:110rpx;
height:110rpx;
}
.sharempj .shareimg {
width:90rpx;
height:60rpx;
}
.shareFloatDiv1 {
position:fixed;
width:100%;
height:100%;
background-color:#555;filter:Alpha(Opacity=60);opacity:0.6;
}
.shareFloatDiv2 {
position:fixed;
width:100%;
height:400rpx;
background-color: #ffffff;
bottom: 0rpx;
}
.shareFloatDiv2 .p1 {
height:260rpx;
display: flex;
flex-direction: row;
}
.shareFloatDiv2 .p1 .wx {
font-size: 14px;
width:375rpx;
text-align: center;
padding-top: 50rpx;
}
.shareFloatDiv2 .p1 .wx .shareimg {
width:150rpx;
height:150rpx;
}
.shareFloatDiv2 .p2 {
height:20rpx;
background-color: #EEEEEE;
}
.shareFloatDiv2 .p3 {
height:100rpx;
line-height: 100rpx;
text-align: center;
color:#555555;
font-size: 14px;
}
.qrcode {
width:300rpx;
height:300rpx;
margin-top: 50rpx;
}

View File

@@ -0,0 +1,133 @@
const WXAPI = require('apifm-wxapi')
const APP = getApp()
import imageUtil from '../../utils/image.js'
let ctx
Page({
/**
* 页面的初始数据
*/
data: {
canvasstyle: '',
cardUid: undefined,
cardUserInfo: undefined
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (e) {
if (e && e.cardUid) {
this.setData({
cardUid: e.cardUid
})
}
wx.showLoading({
title: ''
})
this.downLoadTouxiang()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
downLoadTouxiang() {
let _this = this
wx.getImageInfo({
src: wx.getStorageSync('_haibaoimg'),
success: (res) => {
const imageSize = imageUtil(res.width, res.height)
const additionHeight = 50
const qrcodeWidth = imageSize.windowWidth / 3
_this.setData({
canvasstyle: 'height:' + (imageSize.imageHeight + additionHeight + qrcodeWidth) + 'px'
})
ctx = wx.createCanvasContext('firstCanvas')
ctx.setFillStyle('#fff')
ctx.fillRect(0, 0, imageSize.windowWidth, imageSize.imageHeight + additionHeight + qrcodeWidth)
ctx.drawImage(res.path, imageSize.x, imageSize.y, imageSize.imageWidth, imageSize.imageHeight)
// 画二维码
const left = (imageSize.imageWidth - qrcodeWidth) / 2
const top = imageSize.imageHeight + additionHeight / 2
wx.getImageInfo({
src: APP.globalData._haibaoimg_qrcode,
success: (res) => {
ctx.drawImage(res.path, left, top, qrcodeWidth, qrcodeWidth)
setTimeout(function () {
wx.hideLoading()
ctx.draw()
}, 1000)
}
})
}
})
},
saveToMobile() {
wx.canvasToTempFilePath({
canvasId: 'firstCanvas',
success: function (res) {
let tempFilePath = res.tempFilePath
wx.saveImageToPhotosAlbum({
filePath: tempFilePath,
success: (res) => {
wx.showModal({
content: '名片海报已保存到手机相册',
showCancel: false,
confirmText: '知道了',
confirmColor: '#333'
})
},
fail: (res) => {
wx.showToast({
title: res.errMsg,
icon: 'none',
duration: 2000
})
}
})
}
})
},
})

View File

@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "生成海报"
}

View File

@@ -0,0 +1,4 @@
<view class="container">
<canvas class="canvas" style="{{canvasstyle}}" canvas-id="firstCanvas"></canvas>
<button class="button" type="primary" bindtap="saveToMobile">保存到手机相册</button>
</view>

View File

@@ -0,0 +1,8 @@
.canvas {
width:750rpx;
}
.button {
width: 700rpx;
margin-top: 30rpx;
margin-bottom: 30rpx;
}

118
native/pages/index/main.js Normal file
View File

@@ -0,0 +1,118 @@
const AUTH = require('../../utils/auth')
const WXAPI = require('apifm-wxapi')
Page({
/**
* 页面的初始数据
*/
data: {
wxlogin: true,
cardList: [],
cardUid: undefined
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: '名片夹 - ' + wx.getStorageSync('mallName')
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
AUTH.checkHasLogined().then(isLogined => {
this.setData({
wxlogin: isLogined
})
if (isLogined) {
this.fetchFriends();
}
})
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
goCard(e) {
const uid = e.currentTarget.dataset.id
wx.setStorageSync('cardUid', uid)
wx.switchTab({
url: '/pages/card/main'
})
},
async fetchFriends() {
// 判断自己是不是名片
const token = wx.getStorageSync('token')
const cardList = []
let res = await WXAPI.userDetail(token)
if (res.code == 0 && res.data.userLevel && res.data.userLevel.name === 'aicard') {
cardList.push(res.data)
}
res = await WXAPI.friendList({
token: token
})
if (res.code == 0) {
for (let i = 0; i < res.data.result.length; i++){
const element = res.data.result[i]
const _res = await WXAPI.friendUserDetail(token, element.uids)
if (_res.code === 0) {
cardList.push(_res.data)
}
}
}
this.setData({
cardList
})
},
cancelLogin() {
wx.switchTab({
url: '/pages/card/main'
})
},
processLogin(e) {
if (!e.detail.userInfo) {
wx.showToast({
title: '已取消',
icon: 'none',
})
return;
}
AUTH.register(this);
},
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,17 @@
<import src="/template/login/index.wxml" />
<view class="container">
<view wx:if="{{item.ext}}" wx:for="{{cardList}}" wx:key="id" class="card" data-id="{{item.base.id}}" bindtap="goCard">
<view class="profile">
<view class="name">{{ item.base.nick }}</view>
<view class="position">{{ item.ext['职位'] }}</view>
<view class="phone">{{ item.base.mobile }}</view>
<view class="mail">{{ item.ext['邮箱'] }}</view>
</view>
<view class="photo">
<image class="userinfo-avatar" src="{{item.base.avatarUrl}}" mode="widthFix" />
</view>
</view>
</view>
<template is="apifmLogin" data="{{wxlogin: wxlogin}}" />

View File

@@ -0,0 +1,38 @@
@import "/template/login/index.wxss";
.card {
display: flex;
flex-direction: row;
width: 680rpx;
height: 300rpx;
background-color: #ffffff;
border-radius:10px;
margin-top: 30rpx;
}
.card .profile {
width: 400rpx;
color:#555555;
padding-left: 20rpx;
}
.card .profile .name {
font-size: 30px;
}
.card .profile .position {
font-size: 20px;
}
.card .profile .phone {
margin-top: 60rpx;
font-size: 15px;
}
.card .profile .mail {
font-size: 15px;
}
.card .photo {
width: 280rpx;
height: 300rpx;
overflow: hidden;
}
.card .photo .userinfo-avatar {
width: 280rpx;
border-radius: 10px;
}

View File

@@ -0,0 +1,81 @@
const WxParse = require('../../wxParse/wxParse.js');
const WXAPI = require('apifm-wxapi')
Page({
/**
* 页面的初始数据
*/
data: {
newsId: undefined,
newsObject: {
title: undefined,
content: undefined
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (e) {
this.setData({
newsId: e.newsId
})
this.fetchNewsContent()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
fetchNewsContent() {
WXAPI.cmsArticleDetail(this.data.newsId).then(res => {
if (res.code === 0) {
this.setData({
newsObject: res.data
})
wx.setNavigationBarTitle({
title: res.data.title + ' - ' + wx.getStorageSync('mallName')
})
WxParse.wxParse('article', 'html', res.data.content, this, 5);
}
})
}
})

View File

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

View File

@@ -0,0 +1,9 @@
<import src="../../wxParse/wxParse.wxml" />
<div class="container" style="background-color: #fff">
<div class="title">{{newsObject.title}}</div>
<div class="datetime">{{newsObject.dateAdd}}</div>
<div class="wxparse-content">
<template is="wxParse" data="{{wxParseData:article.nodes}}"/>
</div>
</div>

View File

@@ -0,0 +1,17 @@
@import "/wxParse/wxParse.wxss";
.title {
text-align: left;
width:700rpx;
}
.datetime {
width:700rpx;
font-size: 12px;
margin-top: 10px;
color:#aaa;
}
.wxparse-content {
width: 700rpx;
text-align: left;
font-size: 14px;
}

82
native/pages/news/main.js Normal file
View File

@@ -0,0 +1,82 @@
const WXAPI = require('apifm-wxapi')
Page({
/**
* 页面的初始数据
*/
data: {
newsList: undefined,
content: '...'
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.setNavigationBarTitle({
title: wx.getStorageSync('mallName')
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.fetchNews()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
fetchNews() {
WXAPI.cmsArticles({
categoryId: wx.getStorageSync('news_category_dt').id
}).then(res => {
if (res.code === 0) {
this.setData({
newsList: res.data
})
} else {
this.setData({
newsList: []
})
}
})
},
goDetail(e) {
wx.navigateTo({
url: '/pages/news-detail/main?newsId=' + e.currentTarget.dataset.id
})
}
})

Some files were not shown because too many files have changed in this diff Show More