Skip to content

Commit d02937f

Browse files
committed
init
0 parents  commit d02937f

File tree

3,514 files changed

+366817
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,514 files changed

+366817
-0
lines changed

App.vue

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
<script>
2+
export default {
3+
globalData: {
4+
subDomain: 'tz',
5+
version: '0.0.1',
6+
sysconfigkeys: 'mallName,shopMod'
7+
},
8+
onLaunch: function() {
9+
// https://www.yuque.com/apifm/nu0f75/cdqz1n
10+
this.$wxapi.init(this.globalData.subDomain)
11+
const _this = this
12+
// 1.1.0版本之前关于http拦截器代码,已平滑移动到/common/http.interceptor.js中
13+
// 注意,需要在/main.js中实例化Vue之后引入如下(详见文档说明):
14+
// import httpInterceptor from '@/common/http.interceptor.js'
15+
// Vue.use(httpInterceptor, app)
16+
// process.env.VUE_APP_PLATFORM 为通过js判断平台名称的方法,结果分别如下:
17+
/**
18+
* h5,app-plus(nvue下也为app-plus),mp-weixin,mp-alipay......
19+
*/
20+
this.checkForUpdate(); // 检查新版本
21+
this.queryConfigBatch();
22+
},
23+
onShow(e) {
24+
if (e && e.query && e.query.inviter_id) {
25+
this.$u.vuex('referrer', e.query.inviter_id)
26+
}
27+
this.autoLogin()
28+
},
29+
onHide: function() {
30+
// console.log('App Hide,app不再展现在前台')
31+
},
32+
onPageNotFound(e) {
33+
// 页面不存在 {path: '/1212', query: {a: '123'}, isEntryPage: true}
34+
console.error(e)
35+
},
36+
methods: {
37+
async queryConfigBatch() {
38+
const sysconfigkeys = this.globalData.sysconfigkeys
39+
if (!sysconfigkeys) {
40+
return
41+
}
42+
// https://www.yuque.com/apifm/nu0f75/dis5tl
43+
const res = await this.$wxapi.queryConfigBatch(sysconfigkeys)
44+
if (res.code == 0) {
45+
const sysconfigMap = {}
46+
res.data.forEach(config => {
47+
sysconfigMap[config.key] = config.value
48+
})
49+
this.$u.vuex('sysconfigMap', sysconfigMap)
50+
}
51+
},
52+
checkForUpdate() {
53+
// #ifdef MP
54+
const updateManager = uni.getUpdateManager();
55+
updateManager.onCheckForUpdate(function(res) {
56+
// 请求完新版本信息的回调
57+
console.log(res.hasUpdate);
58+
});
59+
updateManager.onUpdateReady(function(res) {
60+
uni.showModal({
61+
title: '更新提示',
62+
content: '新版本已经准备好,是否重启应用?',
63+
success(res) {
64+
if (res.confirm) {
65+
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
66+
updateManager.applyUpdate();
67+
}
68+
}
69+
});
70+
71+
});
72+
updateManager.onUpdateFailed(function(res) {
73+
// 新的版本下载失败
74+
});
75+
// #endif
76+
// #ifdef APP-PLUS
77+
// APP 自动更新
78+
// #endif
79+
},
80+
async autoLogin() {
81+
// 自动登陆
82+
// #ifdef MP-WEIXIN
83+
const isLogined = await WXAUTH.checkHasLogined()
84+
if(!isLogined) {
85+
await WXAUTH.authorize()
86+
await WXAUTH.bindSeller()
87+
}
88+
// #endif
89+
setTimeout(() => {
90+
uni.$emit('loginOK', {})
91+
}, 500)
92+
},
93+
}
94+
}
95+
</script>
96+
97+
<style lang="scss">
98+
/*每个页面公共css */
99+
@import "@/uni_modules/uview-ui/index.scss";
100+
</style>

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 www.uviewui.com
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# uni-app商城
2+
3+
本项目是纯uni-app原生项目,同时也是一个纯前端项目。本项目用到的演示数据,接口都是直接对接的 “api工厂” 的中台,使得前端开发人员可以更加专注于前端开发本身,而不用去关心后端的实现。
4+
5+
本项目的界面、功能,直接参考的开源微信小程序商城“天使童装”,所以如果希望体验完整版本功能的话,可以前往其开源主页进行体验
6+
7+
我希望可以持续的将本项目一直开源维护下去,但是毕竟个人精力有限,所以非常希望大家可以一同加入到开发工作中来,群策群力,一起把这个项目真正的长期做下去
8+
9+
# 天使童装项目
10+
11+
- [ GitHub地址 https://github.com/EastWorld/wechat-app-mall ](https://github.com/EastWorld/wechat-app-mall)
12+
- [ 码云地址 https://gitee.com/javazj/wechat-app-mall ](https://gitee.com/javazj/wechat-app-mall)
13+
14+
# 特别感谢
15+
16+
- [uni-app 使得多端开发更简单](hhttps://uniapp.dcloud.io/)
17+
- [uview2.0 全面的组件和便捷的工具会让您信手拈来,如鱼得水](https://www.uviewui.com/)
18+
- [api工厂 前端大中台 更加专注前端开发](https://www.it120.cc/)
19+
20+
# 开发配置
21+
22+
1. `main.js` 中的代码 `WXAPI.init('tz')``tz` 修改为你自己的专属域名(登陆api工厂的后台,在后台首页即可查看你自己的专属域名)
23+
2. 后台左侧菜单“工厂设置” -> “数据克隆” -> “将别人的数据克隆给我”,填写 `951` 克隆一份测试数据
24+
25+
# QQ交流群
26+
27+
<img src="https://7.s2m.cc/2021/12/28/ec609c83-6adb-49bf-96b2-002b7dbdcf01.png">
28+
29+
# 诚邀请一起来开发
30+
31+
1. 右上角 “Star” 点击鼓励
32+
2. 右上角 “Fork” ,将代码复制一个副本到你自己的 Git 账号下
33+
3. git clone 你自己的git仓库地址,完成开发及测试
34+
4. 通过 “Pull Request” 将你修改的代码提交合并请求
35+
36+
## 打赏
37+
38+
如果觉得本项目对你有帮助,欢迎打赏~
39+
40+
| 微信 | 支付宝 |
41+
| :------: | :------: |
42+
| <img src="https://7.s2m.cc/2021/12/28/19e8851d-9a53-49bc-a4e6-055994b7876f.jpeg" height="250px"> | <img src="https://7.s2m.cc/2021/12/28/8e373db9-f468-43fb-8ca7-63a997439010.jpeg" height="250px"> |

common/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
baseUrl: 'https://api.youzixy.com'
3+
}

0 commit comments

Comments
 (0)