Browse Source

[新增] 屏蔽正式console

[完善] 个人中心页面
[接接口] 客服落地页
[修改] 商品详情页UI
[新增] 常见问题页UI
master
邓平艺 4 years ago
parent
commit
f58f694a38
  1. 10
      App.vue
  2. 3
      common/api.js
  3. 15
      common/http.interceptor.js
  4. 6
      components/my-nocontent/my-nocontent.vue
  5. 8
      pages.json
  6. 25
      pages/FQA/index.vue
  7. 132
      pages/center/index.vue
  8. 1
      pages/collect/index.vue
  9. 17
      pages/contactService/index.vue
  10. 40
      pages/goodsDetail/index.vue
  11. 4
      pages/index/index.vue
  12. 20
      pages/login/index.vue
  13. BIN
      static/center/collect-active.png
  14. BIN
      static/center/order.png
  15. BIN
      static/center/scan.png
  16. BIN
      static/images/empty.png
  17. BIN
      static/logo.png

10
App.vue

@ -4,6 +4,7 @@
wxlogin: () => {}
},
onLaunch: function() {
this.disableConsole();
this.getUserInfo();
},
onShow: function() {
@ -25,6 +26,7 @@
this.globalData.wxlogin();
},
wxlogin(){
return new Promise((resolve, rejecj) => {
uni.login({
complete: result => {
if(result.errMsg == 'login:ok'){
@ -32,10 +34,12 @@
this.$http(this.API.API_WXLOGIN, { code }).then(res => {
console.log("获得用户信息", res);
uni.setStorageSync('userinfo', res.data);
resolve(res.data);
})
}
}
})
})
},
//
getUpdateWexin(){
@ -74,6 +78,12 @@
}
});
});
},
// console
disableConsole(){
if(this.API.DEV == 'prod'){
console.log = () => {};
}
}
}
}

3
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'; // 扫码核销

15
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 用户信息
}
}

6
components/my-nocontent/my-nocontent.vue

@ -2,7 +2,7 @@
<!-- 暂无内容-->
<view class="padding-xl margin-top-xl">
<view class="flex justify-center">
<image src="@/static/images/mescroll-empty.png" mode="widthFix" class="no-content-img"></image>
<image src="@/static/images/empty.png" mode="widthFix" class="no-content-img"></image>
</view>
<text class="block text-center margin-top">暂无数据</text>
</view>
@ -21,7 +21,7 @@
<style lang="scss" scoped>
.no-content-img{
width: 300rpx;
height: 300rpx;
width: 440rpx;
height: 380rpx;
}
</style>

8
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",

25
pages/FQA/index.vue

@ -0,0 +1,25 @@
<template>
<view>
<text>常见的一些问题</text>
</view>
</template>
<script>
export default {
data(){
return {
}
},
onLoad(){
},
methods: {
}
}
</script>
<style lang="scss" scoped="scoped">
</style>

132
pages/center/index.vue

@ -1,80 +1,90 @@
<template>
<view>
<view class="lf-flex head">
<image class="user-img"></image>
<image class="user-img" :src="info.avatar" @click="lookImg(info.avatar)" v-if="info.avatar"></image>
<image class="user-img" src="../../static/logo.png" v-else></image>
<view class="user-info">
<view class="lf-font-40 lf-font-bold" style="width: 500rpx;">
<text>时空网的忠实网友</text>
<text class="user-label">商户</text>
<text class="user-label">管理员</text>
<text>{{ info.nickname }}</text>
<text class="user-label" v-for="(item, index) in info.tags" :key="index">{{ item }}</text>
</view>
<view class="lf-m-t-20 lf-font-28">
<text>ID 78873</text>
<text class="lf-m-l-30">135****7547</text>
<text>ID {{ info.id }}</text>
<text class="lf-m-l-30">{{ hidePhone(info.tel) }}</text>
</view>
</view>
</view>
<view class="list">
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/collect/index')">
<view>
<u-icon name="heart" size="50" class="lf-text-vertical"></u-icon>
<text class="lf-text-vertical lf-m-l-16 lf-font-32">我的收藏</text>
<view class="lf-row-center">
<image class="icon-img" src="../../static/center/collect.png"></image>
<text class="lf-text-vertical lf-m-l-20 lf-font-32">我的收藏</text>
</view>
<view>
<u-icon name="arrow-right" size="40" color="#777777"></u-icon>
<text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/contactService/index')">
<view>
<u-icon name="heart" size="50" class="lf-text-vertical"></u-icon>
<view class="lf-row-center">
<image class="icon-img" src="../../static/center/service.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-32">联系客服</text>
</view>
<view>
<u-icon name="arrow-right" size="40" color="#777777"></u-icon>
<text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity">
<view>
<u-icon name="heart" size="50" class="lf-text-vertical"></u-icon>
<view class="lf-row-center">
<image class="icon-img" src="../../static/center/suggestion.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-32">意见反馈</text>
</view>
<view>
<u-icon name="arrow-right" size="40" color="#777777"></u-icon>
<text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
</view>
<button class="feedback-btn" open-type="feedback"></button>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity">
<view>
<u-icon name="heart" size="50" class="lf-text-vertical"></u-icon>
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="$url('/pages/FQA/index')">
<view class="lf-row-center">
<image class="icon-img" src="../../static/center/problem.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-32">常见问题</text>
</view>
<view>
<u-icon name="arrow-right" size="40" color="#777777"></u-icon>
<text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
</view>
</view>
<!-- TODO 退出登录逻辑 -->
<view class="lf-row-between list-item" hover-class="lf-opacity">
<view>
<u-icon name="heart" size="50" class="lf-text-vertical"></u-icon>
<view class="lf-row-center">
<image class="icon-img" src="../../static/center/loginout.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-32">退出登录</text>
</view>
<view>
<u-icon name="arrow-right" size="40" color="#777777"></u-icon>
<text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
</view>
</view>
</view>
<!-- 商家工具 -->
<view class="shop-list">
<view class="lf-m-b-20 shop-list" v-if="isRight(info.store)">
<view class="lf-row-between lf-m-b-20">
<view class="lf-font-36 lf-font-bold">商家工具</view>
<view class="lf-font-28" style="color: #555555;">李大叔家的店</view>
<view class="lf-font-28" style="color: #555555;">{{ info.store.name }}</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity">
<view class="lf-row-center">
<image class="icon-img" src="../../static/center/order.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-32">商家订单</text>
</view>
<view>
<u-icon name="heart" size="50" class="lf-text-vertical"></u-icon>
<text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
</view>
</view>
<view class="lf-row-between list-item" hover-class="lf-opacity" @click="chargeOff">
<view class="lf-row-center">
<image class="icon-img" src="../../static/center/scan.png"></image>
<text class="lf-text-vertical lf-m-l-16 lf-font-32">卡券核销</text>
</view>
<view>
<u-icon name="arrow-right" size="40" color="#777777"></u-icon>
<text class="lf-iconfont lf-icon-xiangyou-copy lf-color-gray lf-font-40"></text>
</view>
</view>
</view>
@ -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);
});
}
}
})
}
}
}
</script>
@ -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%;

1
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 => {

17
pages/contactService/index.vue

@ -7,20 +7,20 @@
<view class="lf-row-between item">
<view class="lf-color-gray">服务时间</view>
<view>10:0020:00</view>
<view>{{ info.service_period }}</view>
</view>
<view class="lf-row-between item" @click="makePhoneCall">
<view class="lf-color-gray">客服电话</view>
<view>13278683790</view>
<view>{{ info.phone }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">联系地址</view>
<view>南宁市青秀区汇东国际F座6楼</view>
<view>{{ info.address }}</view>
</view>
<view class="lf-row-between item">
<view class="lf-color-gray">客服微信</view>
<view>
<text>whhu8798</text>
<text>{{ info.wechat }}</text>
<text class="lf-m-l-20 lf-color-primary" @click="copy">复制</text>
</view>
</view>
@ -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
})
}
}

40
pages/goodsDetail/index.vue

@ -2,7 +2,7 @@
<view>
<block v-if="isRight(goods_detail)">
<!-- 商品图片轮播 -->
<swiper :current="current" :indicator-dots="true" :circular="true" class="swiper-box">
<swiper :current="current" :indicator-dots="true" :circular="true" class="swiper-box" indicator-active-color="#FE9903">
<swiper-item v-for="item in goods_detail.banners" :key="item.id">
<image :src="item.cover" style="width: 100%; height: 100%;"></image>
<!-- <image :src="item.cover" mode="aspectFit"></image> -->
@ -17,7 +17,7 @@
<view>¥{{ goods_detail.specs[0].original_price }}</view>
<view v-if="goods_detail.specs[0].cost">{{ goods_detail.specs[0].cost }}</view>
</view>
<view>
<view class="lf-font-24">
<view class="lf-color-gray">{{ goods_detail.specs[0].sold_stock_text }}</view>
<view class="lf-color-primary">{{ goods_detail.specs[0].stock_text }}</view>
</view>
@ -35,12 +35,15 @@
<view class="lf-font-32 lf-m-l-20" style="max-width: 512rpx;">{{ goods_detail.store.name }}</view>
</view>
<view @click="makePhoneCall(goods_detail.store.tel)">
<u-icon name="phone" color="#3A62FF" size="46"></u-icon>
<text class="lf-iconfont lf-icon-dianhua lf-font-40" style="color: #3A62FF;"></text>
</view>
</view>
<view class="lf-flex lf-m-t-20" @click="openMap">
<u-icon name="map-fill" size="60"></u-icon>
<view class="lf-m-l-20 lf-font-32">{{ goods_detail.store.address }}</view>
<!-- <u-icon name="map-fill" size="60"></u-icon> -->
<view style="width: 60rpx; height: 60rpx;" class="lf-row-center">
<text class="lf-iconfont lf-icon-dizhi lf-font-40" style="color: #000000;"></text>
</view>
<view class="lf-m-l-20 lf-font-28">{{ goods_detail.store.address }}</view>
</view>
</view>
<!-- 商品详情 -->
@ -54,20 +57,27 @@
<view class="lf-row-between fixed-bottom">
<view class="lf-flex lf-p-t-10 lf-p-b-10">
<view class="lf-flex-column lf-row-center icon-item" @click="$url('/pages/index/index', {type: 'switch'})">
<u-icon name="home" size="50"></u-icon>
<!-- <u-icon name="home" size="50"></u-icon> -->
<image class="icon-img" src="../../static/tabbar/home.png"></image>
<view class="lf-m-t-1">首页</view>
</view>
<view class="lf-flex-column lf-row-center icon-item" @click="$url('/pages/contactService/index')">
<u-icon name="server-fill" size="50"></u-icon>
<!-- <u-icon name="server-fill" size="50"></u-icon> -->
<image class="icon-img" src="../../static/center/service.png"></image>
<view class="lf-m-t-1">客服</view>
</view>
<view class="lf-flex-column lf-row-center icon-item" @click="switchCollect">
<u-icon name="heart-fill" size="50" color="#FF0000" v-if="is_collect"></u-icon>
<u-icon name="heart" size="50" v-else></u-icon>
<!-- <u-icon name="heart-fill" size="50" color="#FF0000" v-if="is_collect"></u-icon>
<u-icon name="heart" size="50" v-else></u-icon> -->
<image class="icon-img" src="../../static/center/collect-active.png" v-if="is_collect"></image>
<image class="icon-img" src="../../static/center/collect.png" v-else></image>
<view class="lf-m-t-1">{{ is_collect ? '已收藏' : '收藏' }}</view>
</view>
<button class="lf-flex-column lf-row-center icon-item" open-type="share">
<u-icon name="share" size="50"></u-icon>
<!-- <u-icon name="share" size="50"></u-icon> -->
<view class="icon-img lf-row-center">
<text class="lf-iconfont lf-icon-fenxiangzhuanfa lf-font-32"></text>
</view>
<view class="lf-m-t-1">分享</view>
</button>
</view>
@ -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;

4
pages/index/index.vue

@ -6,7 +6,7 @@
<view class="com" v-for="(tab, tabIndex) in tab_list" v-if="tabIndex == current" :key="tab.id">
<view class="lf-row-between list" v-for="(item, index) in tab.list" :key="item.id" @click="toDetail(item)">
<view class="left">
<image :src="item.cover" mode=""></image>
<image :src="item.cover" mode="aspectFit"></image>
</view>
<view class="right">
<view class="lf-line-2 title">{{ item.name }}</view>
@ -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;

20
pages/login/index.vue

@ -1,26 +1,29 @@
<template>
<view>
<view class="lf-row-center lf-flex-column box">
<image class="img"></image>
<view class="lf-m-t-10 lf-font-32" v-if="type == 'phone'">游客jdsfbuskdnko</view>
<!-- <image class="img" :src="userInfo.avatar" v-if="userInfo.avatar"></image> -->
<!-- <image class="img" src="../../static/logo.png" v-else></image> -->
<image class="img" src="../../static/logo.png" ></image>
<view class="lf-m-t-30 lf-font-32" v-if="type == 'phone'">{{ userInfo.nickname || '游客用户' }}</view>
<block v-if="type == 'userinfo'">
<button class="btn" @click="getUserProfile">
<u-icon name="weixin-fill" color="#ffffff" size="60" class="lf-text-vertical"></u-icon>
<text class="lf-m-l-20">绑定微信</text>
<text class="lf-m-l-20">微信快捷登录</text>
</button>
<view class="lf-m-t-40 lf-font-28" @click="$toBack()">暂不绑定继续操作</view>
<!-- <view class="lf-m-t-40 lf-font-28" @click="$toBack()">暂不绑定继续操作</view> -->
<view class="mask" v-if="!checked" @click="$msg('您未同意协议条款')"></view>
</block>
<block v-else-if="type == 'phone'">
<button class="btn" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
<u-icon name="weixin-fill" color="#ffffff" size="60" class="lf-text-vertical"></u-icon>
<text class="lf-m-l-20">微信快捷登录</text>
<text class="lf-m-l-20">绑定手机号</text>
</button>
<!-- <view class="lf-m-t-40 lf-font-28" @click="$url('/pages/login/accountLogin')">使用手机号登录</view> -->
<view class="mask" v-if="!checked" @click="$msg('您未同意协议条款')"></view>
</block>
</view>
<!-- 服务条款 -->
<view class="fixed-bottom" v-if="type == 'phone'">
<view class="fixed-bottom">
<checkbox-group @change="checkboxChange" style="display: inline-block;">
<checkbox class="lf-text-vertical" :checked="checked"></checkbox>
</checkbox-group>
@ -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;

BIN
static/center/collect-active.png

After

Width: 75  |  Height: 75  |  Size: 1.4 KiB

BIN
static/center/order.png

After

Width: 75  |  Height: 75  |  Size: 1.4 KiB

BIN
static/center/scan.png

Before

Width: 60  |  Height: 60  |  Size: 904 B

After

Width: 75  |  Height: 75  |  Size: 1.0 KiB

BIN
static/images/empty.png

After

Width: 990  |  Height: 852  |  Size: 295 KiB

BIN
static/logo.png

Before

Width: 120  |  Height: 120  |  Size: 15 KiB

After

Width: 8335  |  Height: 8335  |  Size: 450 KiB

Loading…
Cancel
Save