diff --git a/App.vue b/App.vue
index e8fe4ff..7811e02 100644
--- a/App.vue
+++ b/App.vue
@@ -4,6 +4,7 @@
wxlogin: () => {}
},
onLaunch: function() {
+ this.disableConsole();
this.getUserInfo();
},
onShow: function() {
@@ -25,16 +26,19 @@
this.globalData.wxlogin();
},
wxlogin(){
- uni.login({
- complete: result => {
- if(result.errMsg == 'login:ok'){
- let code = result.code;
- this.$http(this.API.API_WXLOGIN, { code }).then(res => {
- console.log("获得用户信息", res);
- uni.setStorageSync('userinfo', res.data);
- })
+ return new Promise((resolve, rejecj) => {
+ uni.login({
+ complete: result => {
+ if(result.errMsg == 'login:ok'){
+ let code = result.code;
+ this.$http(this.API.API_WXLOGIN, { code }).then(res => {
+ console.log("获得用户信息", res);
+ uni.setStorageSync('userinfo', res.data);
+ resolve(res.data);
+ })
+ }
}
- }
+ })
})
},
// 小程序版本更新检查
@@ -74,6 +78,12 @@
}
});
});
+ },
+ // 判断正式服屏蔽console输出
+ disableConsole(){
+ if(this.API.DEV == 'prod'){
+ console.log = () => {};
+ }
}
}
}
diff --git a/common/api.js b/common/api.js
index b118ef1..ac1f131 100644
--- a/common/api.js
+++ b/common/api.js
@@ -25,6 +25,7 @@ export const API_COLLECT_DEAL = '/api/collect/deal'; // 商品收藏
export const API_PRPAID = '/api/order/deal'
/* 个人中心相关 */
+export const API_USER_CENTER = '/api/user/center'; // 个人中心
export const API_COLLECT_LIST = '/api/collect/list'; // 我的收藏列表
export const API_CONTACT = '/api/contact'; // 客服落地页信息
@@ -33,3 +34,5 @@ export const API_WXLOGIN = '/api/wxlogin'; // 用户登录
export const API_WECHAT_SETPHONE = '/api/wechat/setPhone'; // 用户授权手机号提交
export const API_WECHAT_SETPROFILE = '/api/wechat/setProfile'; // 用户授权微信信息提交(返回用户信息)
+/* 商户相关 */
+export const API_CONFIRM_CODE = '/api/confirm/code'; // 扫码核销
\ No newline at end of file
diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 83b2943..dbf0892 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -23,22 +23,11 @@ const install = (Vue, vm) => {
Vue.prototype.$u.http.interceptor.response = res => {
if(res.code == 0) {
return res;
- } else if(res.code == 201) {
- console.log("其他状态:", res.code)
- return false;
- } else if (res.code == 9999) {
- uni.navigateTo({
- url: '/pages/login/index?type=userinfo'
- })
- return false;
- } else if (res.code == 9998) {
- uni.navigateTo({
- url: '/pages/login/index?type=phone'
- })
- return false;
} else {
+ vm.$msg(res.msg);
return false;
}
+ // res.code == 9998 手机号 res.code == 9999 用户信息
}
}
diff --git a/components/my-nocontent/my-nocontent.vue b/components/my-nocontent/my-nocontent.vue
index e0de312..8f44b37 100644
--- a/components/my-nocontent/my-nocontent.vue
+++ b/components/my-nocontent/my-nocontent.vue
@@ -2,7 +2,7 @@
-
+
暂无数据
@@ -21,7 +21,7 @@
diff --git a/pages.json b/pages.json
index bfab971..1f80e04 100644
--- a/pages.json
+++ b/pages.json
@@ -102,6 +102,12 @@
"style": {
"navigationBarTitleText": "时空网"
}
+ },
+ {
+ "path": "pages/FQA/index",
+ "style": {
+ "navigationBarTitleText": "常见问题"
+ }
}
],
"globalStyle": {
@@ -111,7 +117,7 @@
"backgroundColor": "#fff"
},
"tabBar": {
- "color": "#909399",
+ "color": "#333333",
"selectedColor": "#FE9903",
"borderStyle": "black",
"backgroundColor": "#ffffff",
diff --git a/pages/FQA/index.vue b/pages/FQA/index.vue
new file mode 100644
index 0000000..d88270b
--- /dev/null
+++ b/pages/FQA/index.vue
@@ -0,0 +1,25 @@
+
+
+ 常见的一些问题
+
+
+
+
+
+
diff --git a/pages/center/index.vue b/pages/center/index.vue
index 7620c0b..f81e527 100644
--- a/pages/center/index.vue
+++ b/pages/center/index.vue
@@ -1,80 +1,90 @@
-
+
+
- 时空网的忠实网友
- 商户
- 管理员
+ {{ info.nickname }}
+ {{ item }}
- ID 78873
- 135****7547
+ ID {{ info.id }}
+ {{ hidePhone(info.tel) }}
-
-
- 我的收藏
+
+
+ 我的收藏
-
+
-
-
+
+
联系客服
-
+
-
-
+
+
意见反馈
-
+
-
-
-
+
+
+
常见问题
-
+
+
-
-
+
+
退出登录
-
+
-
+
商家工具
- 李大叔家的店
+ {{ info.store.name }}
+
+
+ 商家订单
+
-
+
+
+
+
+
+
卡券核销
-
+
@@ -85,14 +95,70 @@
export default {
data() {
return {
-
+ info: {
+ avatar: '',
+ nickname: '',
+ id: '',
+ tel: '',
+ tags: []
+ }
+ }
+ },
+ computed: {
+ hidePhone(){
+ return function(tel){
+ if(tel.length == 11){
+ var reg = /^(\d{3})\d{4}(\d{4})$/;
+ var new_phone = tel.replace(reg, "$1****$2");
+ return new_phone;
+ }else{
+ return tel;
+ }
+ }
+ },
+ isRight(){
+ return function(val){
+ return this.$shared.isRight(val);
+ }
}
},
onLoad() {
-
+ this.verifyUserInfo();
+ this.getData();
},
methods: {
-
+ verifyUserInfo(){
+ let userInfo = uni.getStorageSync('userinfo') || {};
+ if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){
+ this.$url('/pages/login/index?type=userinfo');
+ }
+ },
+ getData(){
+ this.$http(this.API.API_USER_CENTER).then(res => {
+ console.log("res" , res);
+ this.info = res.data;
+ })
+ },
+ // 预览图片
+ lookImg(img){
+ uni.previewImage({
+ urls: [img]
+ })
+ },
+ // 卡券核销
+ chargeOff(){
+ uni.scanCode({
+ complete: result => {
+ console.log("resuly", result)
+ if(result.errMsg == 'scanCode:ok'){
+ let content = result.result; // 核销码
+ this.$http(this.API.API_CONFIRM_CODE, {confirm_code: content}).then(res => {
+ this.$msg(res.msg);
+ });
+ }
+ }
+ })
+ }
}
}
@@ -115,7 +181,7 @@
width: 150rpx;
height: 150rpx;
border-radius: 50%;
- background-color: #EEEEEE;
+ // background-color: #EEEEEE;
margin-right: 20rpx;
}
.user-info{
@@ -145,6 +211,10 @@
height: 110rpx;
box-sizing: border-box;
position: relative;
+ .icon-img{
+ width: 42rpx;
+ height: 42rpx;
+ }
.feedback-btn{
position: absolute;
width: 100%;
diff --git a/pages/collect/index.vue b/pages/collect/index.vue
index 036b647..c92a556 100644
--- a/pages/collect/index.vue
+++ b/pages/collect/index.vue
@@ -44,7 +44,6 @@
},
methods: {
getCollectList(){
- // TODO 接口传参
this.$http(this.API.API_COLLECT_LIST).then(res => {
this.isPage = res.data.has_more_page;
let list = res.data.items.map(item => {
diff --git a/pages/contactService/index.vue b/pages/contactService/index.vue
index 8c55ea3..0981268 100644
--- a/pages/contactService/index.vue
+++ b/pages/contactService/index.vue
@@ -7,20 +7,20 @@
服务时间
- 10:00~20:00
+ {{ info.service_period }}
客服电话
- 13278683790
+ {{ info.phone }}
联系地址
- 南宁市青秀区汇东国际F座6楼
+ {{ info.address }}
客服微信
- whhu8798
+ {{ info.wechat }}
复制
@@ -37,7 +37,7 @@
data(){
return {
version: '',
- list: []
+ info: {}
}
},
onLoad(){
@@ -48,20 +48,19 @@
// 获取信息
getInfo(){
this.$http(this.API.API_CONTACT).then(res => {
- console.log("info", res);
- this.list = res.data;
+ this.info = res.data;
})
},
// 拨打电话
makePhoneCall(){
uni.makePhoneCall({
- phoneNumber: ''
+ phoneNumber: this.info.phone
})
},
// 复制
copy(){
uni.setClipboardData({
- data: 'a'
+ data: this.info.wechat
})
}
}
diff --git a/pages/goodsDetail/index.vue b/pages/goodsDetail/index.vue
index 204d58f..e32c7df 100644
--- a/pages/goodsDetail/index.vue
+++ b/pages/goodsDetail/index.vue
@@ -2,7 +2,7 @@
-
+
@@ -17,7 +17,7 @@
¥{{ goods_detail.specs[0].original_price }}
{{ goods_detail.specs[0].cost }}
-
+
{{ goods_detail.specs[0].sold_stock_text }}
{{ goods_detail.specs[0].stock_text }}
@@ -35,12 +35,15 @@
{{ goods_detail.store.name }}
-
+
-
- {{ goods_detail.store.address }}
+
+
+
+
+ {{ goods_detail.store.address }}
@@ -54,20 +57,27 @@
-
+
+
首页
-
+
+
客服
-
-
+
+
+
{{ is_collect ? '已收藏' : '收藏' }}
@@ -108,6 +118,11 @@
},
// 切换商品收藏
switchCollect(){
+ let userInfo = uni.getStorageSync('userinfo') || {};
+ if(!userInfo.id || !userInfo.nickname || !userInfo.avatar){
+ this.$url('/pages/login/index?type=userinfo');
+ return;
+ }
this.$http(this.API.API_COLLECT_DEAL, {goods_id: this.goods_id}).then(res => {
console.log("res", res);
this.is_collect = Boolean(res.data.user.is_collect);
@@ -174,6 +189,7 @@
color: #FF0000;
font-size: 40rpx;
margin-right: 22rpx;
+ font-weight: bold;
}
.price>view:nth-of-type(2){
text-decoration: line-through;
@@ -271,6 +287,10 @@
&:first-child{
padding-left: 0;
}
+ .icon-img{
+ height: 44rpx;
+ width: 50rpx;
+ }
}
.btn{
margin: 0;
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 90f4058..f2c4ae8 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -6,7 +6,7 @@
-
+
{{ item.name }}
@@ -258,7 +258,7 @@
width: 160rpx;
height: 60rpx;
background: #FE9903;
- border-radius: 15px;
+ border-radius: 50px;
font-size: 24rpx;
color: #FFFFFF;
margin: 0rpx 20rpx 0rpx 20rpx;
diff --git a/pages/login/index.vue b/pages/login/index.vue
index 4ef3799..7a143fa 100644
--- a/pages/login/index.vue
+++ b/pages/login/index.vue
@@ -1,26 +1,29 @@
-
- 游客jdsfbuskdnko
+
+
+
+ {{ userInfo.nickname || '游客用户' }}
- 暂不绑定继续操作
+
+
-
+
@@ -47,7 +50,9 @@
},
onLoad(options){
this.type = options.type || this.type;
- getApp().globalData.wxlogin(); // 重新登录
+ getApp().globalData.wxlogin().then(res => {
+ this.userInfo = res;
+ });
},
methods: {
// 进入查看协议
@@ -125,7 +130,6 @@
width: 180rpx;
height: 180rpx;
border-radius: 50%;
- background-color: #EEEEEE;
}
.btn{
background-color: #09BB07;
diff --git a/static/center/collect-active.png b/static/center/collect-active.png
new file mode 100644
index 0000000..a04dac0
Binary files /dev/null and b/static/center/collect-active.png differ
diff --git a/static/center/order.png b/static/center/order.png
new file mode 100644
index 0000000..b8c8429
Binary files /dev/null and b/static/center/order.png differ
diff --git a/static/center/scan.png b/static/center/scan.png
index 91db2c0..f7b20f3 100644
Binary files a/static/center/scan.png and b/static/center/scan.png differ
diff --git a/static/images/empty.png b/static/images/empty.png
new file mode 100644
index 0000000..1c480e2
Binary files /dev/null and b/static/images/empty.png differ
diff --git a/static/logo.png b/static/logo.png
index 05b3aed..ef7df22 100644
Binary files a/static/logo.png and b/static/logo.png differ