Commit 0fc82f7d by huahua

修改自定义页面

parent 44af7cee
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
num:0 num:0
}, },
onLaunch: function() { onLaunch: function() {
// 字体列表 //字体列表
homeservice.queryList({ homeservice.queryList({
s: 'Material.fontFamilyList' s: 'Material.fontFamilyList'
}).then(result => { }).then(result => {
......
...@@ -19,7 +19,6 @@ Vue.prototype.$AppContext = AppContext ...@@ -19,7 +19,6 @@ Vue.prototype.$AppContext = AppContext
Vue.prototype.$Env = Env Vue.prototype.$Env = Env
Vue.prototype.$base = base Vue.prototype.$base = base
Vue.prototype.$http = http Vue.prototype.$http = http
App.mpType = 'app' App.mpType = 'app'
const app = new Vue({ const app = new Vue({
......
...@@ -47,6 +47,17 @@ ...@@ -47,6 +47,17 @@
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"navigationStyle": "custom" "navigationStyle": "custom"
} }
},
{
"path": "size",
"style": {
"navigationBarTitleText": "自定义尺寸",
"enablePullDownRefresh": false,
"navigationBarTextStyle": "#ffffff",
"navigationBarBackgroundColor": "#101014",
"backgroundColor": "#101014"
//"navigationStyle": "custom"
}
} }
] ]
}, },
......
<template>
<view class="m-slider" ref="slider" :style="{width: width + 'px'}">
<view class="u-slider-rail"></view>
<view class="u-slider-track" :style="{left: left +'px', width: (right - left) +'px'}"></view>
<view style=" transform: translateX(-50%); " class="u-slider-handle" ref="right"
@touchstart.stop.prevent="onRightMouseDown" @touchmove.stop.prevent="onRightMouseMove"
:style="{left: right +'px'}">
<view style="color: #F29F3D; font-size: 30upx;"> {{defalutFilletData}} </view>
</view>
</view>
</template>
<script>
export default {
name: 'NumSlider',
props: {
min: { // 滑动输入条最小值
type: Number,
default: 0
},
max: { // 滑动输入条最大值
type: Number,
default: 100
},
initialMin: { // 滑动输入条初始最小值,默认在最左侧
type: Number,
default: 0
},
width: { // 滑动输入条在页面中的宽度
type: Number,
default: 600
},
disabled: { // 是否禁用
type: Boolean,
default: false
},
range: { // 是否双滑块模式
type: Boolean,
default: false
},
leftX: {
type: Number,
default: 120
},
defalutFillet: {
type: Number,
default: 0
},
},
data() {
return {
left: '', // 左滑块距离滑动条左端的距离
right: '', // 右滑动距离滑动条左端的距离
defalutFilletData: 0,
initialMax: 0,
filletScale: 1,
}
},
computed: {
scale() {
return this.width / (this.max - this.min)
},
low() {
return Math.round(this.left / this.scale + this.min)
},
high() {
return Math.round(this.right / this.scale + this.min)
}
},
watch: {
low(to) {
this.$emit('lowChange', to) // 左滑块对应数字回调
},
high(to) {
//右滑块对应数字回调
this.defalutFilletData = Math.floor(to * this.filletScale);
this.$emit('highChange', to)
}
},
mounted() {
this.left = this.range ? (this.initialMin - this.min) * this.scale : 0
this.right = (this.initialMax - this.min) * this.scale
},
methods: {
//初始化默认圆角
initFilletRadius(filletRadius, filletScale) {
//console.log("filletScale="+filletScale);
this.initialMax = filletRadius
this.filletScale = filletScale
this.left = this.range ? (this.initialMin - this.min) * this.scale : 0
this.right = (this.initialMax - this.min) * this.scale
this.defalutFilletData = Math.floor(filletRadius * filletScale)
},
onRightMouseMove(e) {
var moveX = e.changedTouches[0].pageX - this.leftX
if (moveX > this.width) {
this.right = this.width
} else if (moveX <= this.left) {
this.right = this.left
} else {
this.right = moveX
}
},
onRightMouseDown(e) { // 在滚动条上拖动右滑块
e.preventDefault();
var moveX = e.changedTouches[0].pageX - this.leftX
if (moveX > this.width) {
this.right = this.width
} else if (moveX <= this.left) {
this.right = this.left
} else {
this.right = moveX
}
},
init() {
this.left = this.range ? (this.initialMin - this.min) * this.scale : 0
this.right = (this.initialMax - this.min) * this.scale
},
},
}
</script>
<style lang="less" scoped>
@themeColor: #F29F3D;
.m-slider {
display: inline-block;
height: 4px;
padding: 6px 0;
position: relative;
z-index: 9;
.u-slider-rail {
position: absolute;
z-index: 99;
height: 4px;
width: 100%;
background: #f5f5f5;
border-radius: 2px;
}
.u-slider-track {
position: absolute;
z-index: 99;
background: #F29F3D;
border-radius: 4px;
height: 4px;
}
.u-slider-handle {
// 滑块
position: absolute;
z-index: 999;
width: 25px;
height: 25px;
line-height: 27px;
text-align: center;
top: -8px;
background: #fff;
border: 4px solid #F29F3D;
border-radius: 50%;
}
}
.disabled {}
</style>
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
}; };
}, },
mounted() { mounted() {
}, },
methods: { methods: {
bgColorAssembly(item){ bgColorAssembly(item){
......
...@@ -581,10 +581,12 @@ const drag = { ...@@ -581,10 +581,12 @@ const drag = {
}, },
/** /**
* 图片拖动中事件 * 图片拖动中事件
*/ */
dragMove(e, item, data, editor_top, allLineListData, margin_left, editory) { dragMove(e, item, data, editor_top) {
item.isShowLineV = false; item.isShowLineV = false;
item.isShowLineH = false; item.isShowLineH = false;
......
<template> <template>
<view class="full-width full-height"> <view class="full-width full-height">
<!-- 自定义头部 --> <!-- 自定义头部 -->
<myhead :worksid="worksid" :title="myheadtext" :color="'#fff'" :titleShow="true" :backShow="true" :isBack ="true" <myhead :worksid="worksid" :title="myheadtext" :color="'#fff'" :titleShow="true" :backShow="true" :isBack="true"
:background="'none'"></myhead> :background="'none'"></myhead>
<view style="position: relative;width: 100%; height: 100%; z-index: 2;"> <view style="position: relative;width: 100%; height: 100%; z-index: 2;">
...@@ -30,7 +30,9 @@ ...@@ -30,7 +30,9 @@
background: linear-gradient(92deg, #E6B01A, #F29F3D); background: linear-gradient(92deg, #E6B01A, #F29F3D);
box-shadow: 0px 19px 48px 1px rgba(20, 31, 62, 0.35); box-shadow: 0px 19px 48px 1px rgba(20, 31, 62, 0.35);
border-radius: 40px;"> border-radius: 40px;">
<view style=" text-align: center; line-height: 100upx; font-size: 36upx; font-weight: 500; color: #FFFFFF;">立即定制</view> <view
style=" text-align: center; line-height: 100upx; font-size: 36upx; font-weight: 500; color: #FFFFFF;">
立即定制</view>
</view> </view>
</view> </view>
...@@ -57,6 +59,7 @@ ...@@ -57,6 +59,7 @@
<text style="font-size: 22upx;">深圳市瑞丰彩科技有限公司</text> <text style="font-size: 22upx;">深圳市瑞丰彩科技有限公司</text>
</view> </view>
</view> </view>
<!-- 登录弹框 --> <!-- 登录弹框 -->
<Signin ref="Signin"></Signin> <Signin ref="Signin"></Signin>
...@@ -65,7 +68,7 @@ ...@@ -65,7 +68,7 @@
<image src="../../static/liebiao.png" mode="" style="width: 243upx; height: 123upx;"></image> <image src="../../static/liebiao.png" mode="" style="width: 243upx; height: 123upx;"></image>
</view> </view>
<switchGoods ref="switchGoods" @selectGoodItem="selectGoodItem"></switchGoods> <switchGoods ref="switchGoods" @selectGoodItem="selectGoodItem" @toCustomSize="toCustomSize"></switchGoods>
<!--//商品弹框 --> <!--//商品弹框 -->
</view> </view>
...@@ -108,6 +111,17 @@ ...@@ -108,6 +111,17 @@
methods: { methods: {
//自定义尺寸
toCustomSize() {
uni.navigateTo({
url: '../mall/size?machine_id=' + this.machine_id +
// + "&title=" + item.title + "&real_width=" + item.key +
"&machineDetail=" + JSON.stringify(this.list)
// url: '../index/size?machine_id=' + this.machine_id +
// '&key=' + this.key;
})
},
//去排队列表 //去排队列表
toLineList() { toLineList() {
if (!this.$AppContext.checkLogin()) { if (!this.$AppContext.checkLogin()) {
...@@ -121,11 +135,14 @@ ...@@ -121,11 +135,14 @@
//选择商品进来 //选择商品进来
selectGoodItem(item) { selectGoodItem(item) {
uni.navigateTo({ uni.navigateTo({
url: '../index/index?machine_id=' + this.machine_id + "&good_id=" + item.id + "&title=" + item.title + "&real_width=" + item.key, url: '../index/index?machine_id=' + this.machine_id +
"&good_id=" + item.id +
"&title=" + item.title +
"&real_width=" + item.key +
"&machineDetail=" + JSON.stringify(this.list) +
"&type = 1"
}) })
}, },
//立即定制 //立即定制
...@@ -134,7 +151,8 @@ ...@@ -134,7 +151,8 @@
if (!this.$AppContext.checkLogin()) { if (!this.$AppContext.checkLogin()) {
this.tologo(1) this.tologo(1)
} else { } else {
this.$refs['switchGoods'].open(this.machine_id); let isShowCustomizeData = this.list.customize_size == 1 ? true : false
this.$refs['switchGoods'].open(this.machine_id,isShowCustomizeData);
} }
}, },
...@@ -171,8 +189,6 @@ ...@@ -171,8 +189,6 @@
s: 'Init.init', s: 'Init.init',
code: res.code code: res.code
}).then(r => { }).then(r => {
//console.log("进来")
//that.getDetail();
if (type == 1) { if (type == 1) {
that.$refs['switchGoods'].open(that.machine_id); that.$refs['switchGoods'].open(that.machine_id);
} else { } else {
...@@ -247,18 +263,18 @@ ...@@ -247,18 +263,18 @@
//上拉刷新 //上拉刷新
onReachBottom() { onReachBottom() {
}, },
//下拉加载 //下拉加载
onPullDownRefresh() { onPullDownRefresh() {
this.getDetail() //获取数据 this.getDetail() //获取数据
}, },
//分享转发 //分享转发
onShareAppMessage(options) { onShareAppMessage(options) {
var that = this; var that = this;
// 设置转发内容 //设置转发内容
var shareObj = { var shareObj = {
title: this.$Env.getmalltext(), title: this.$Env.getmalltext(),
path: '/pages/mall/machineDetail?machine_id=' + this.machine_id, // 默认是当前页面,必须是以‘/’开头的完整路径 path: '/pages/mall/machineDetail?machine_id=' + this.machine_id, // 默认是当前页面,必须是以‘/’开头的完整路径
...@@ -278,13 +294,17 @@ ...@@ -278,13 +294,17 @@
this.$base.machine_id = this.machine_id this.$base.machine_id = this.machine_id
this.statusloading = 1; this.statusloading = 1;
this.Adlist() // 轮播图 this.Adlist() // 轮播图
//this.getDetail(); this.getDetail();
},
onShow() {
this.getDetail();
}, },
onShow() {}, onHide() {
onHide() {} }
}; };
</script> </script>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
width: 100upx; height: 88upx; background: #F29F3D; border-radius: 44upx 0px 0px 44upx;"> width: 100upx; height: 88upx; background: #F29F3D; border-radius: 44upx 0px 0px 44upx;">
<view style="font-size: 24upx; font-weight: 800; color: #FFFFFF;"> <view style="font-size: 24upx; font-weight: 800; color: #FFFFFF;">
<view>定制</view> <view>定制</view>
<view>体验</view> <view>体验</view>
</view> </view>
</view> </view>
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
success: function(res) { success: function(res) {
console.log(res) console.log(res)
if (res.scanType == 'QR_CODE') { if (res.scanType == 'QR_CODE') {
if (that.getQueryString(res.result, 'machine_id') && that.getQueryString(res.path, 'machine_id') != "" && that.getQueryString(res.result, 'machine_id') != null && that.getQueryString(res.result,'machine_id') != "null") { if (that.getQueryString(res.result, 'machine_id') && that.getQueryString(res.result, 'machine_id') != "" && that.getQueryString(res.result, 'machine_id') != null && that.getQueryString(res.result,'machine_id') != "null") {
uni.navigateTo({ uni.navigateTo({
url: '../index/machineDetail?machine_id=' + that url: '../index/machineDetail?machine_id=' + that
.getQueryString( .getQueryString(
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
} else { } else {
if (res.path) { if (res.path) {
if (that.getQueryString(res.path, 'machine_id') && that.getQueryString(res.path, 'machine_id') != "" && that.getQueryString(res if (that.getQueryString(res.path, 'machine_id') && that.getQueryString(res.path, 'machine_id') != "" && that.getQueryString(res
.result, 'machine_id') != null && that.getQueryString(res.result,'machine_id') != "null") { .path, 'machine_id') != null && that.getQueryString(res.path,'machine_id') != "null") {
uni.navigateTo({ uni.navigateTo({
url: '../index/machineDetail?machine_id=' + that url: '../index/machineDetail?machine_id=' + that
.getQueryString(res.path, 'machine_id') .getQueryString(res.path, 'machine_id')
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
</view> </view>
<view <view
style=" width: 562upx; border-radius: 20upx; height: 742upx; z-index: 998; position: absolute ;margin:auto; top:0; right: 0; left: 0; bottom: 0;flex-direction: column"> style=" width: 562upx; border-radius: 20upx; height: 900upx; z-index: 998; position: absolute ;margin:auto; top:0; right: 0; left: 0; bottom: 0;flex-direction: column">
<image src="../../static/icon_home_good_back.png" style="width: 562upx; border-radius: 20upx; <image src="../../static/icon_home_good_back.png" style="width: 562upx; border-radius: 20upx;
height: 720upx; height: 720upx;
...@@ -36,9 +36,9 @@ ...@@ -36,9 +36,9 @@
border-radius: 15upx; border-radius: 15upx;
position: relative; position: relative;
width: 180upx"> width: 180upx">
<image mode="center" <image mode="widthFix"
:class="[goodCurrentIndexTop == index? 'good-item-select':'good-item-no-select' ]" :class="[goodCurrentIndexTop == index? 'good-item-select':'good-item-no-select' ]"
:src="item.goods_pic + '?x-oss-process=image/resize,lfit,w_210'"></image> :src="item.goods_pic + '?x-oss-process=image/resize,lfit,w_180'"></image>
<view style="text-align: center; font-size: 30upx; width: 100%; <view style="text-align: center; font-size: 30upx; width: 100%;
color:#000; margin-top: 30upx;"> color:#000; margin-top: 30upx;">
{{item !=null ? item.name : ''}} {{item !=null ? item.name : ''}}
...@@ -70,8 +70,16 @@ ...@@ -70,8 +70,16 @@
margin: 0 auto; margin: 0 auto;
line-height: 84upx; line-height: 84upx;
margin-top:60upx; margin-top:60upx;
text-align: center;"> 确定</view> text-align: center;">确定</view>
<view @click="toCustomSize()" style="width: 289upx;
height: 84upx;
color: #F29F3D;
font-size: 32upx;
margin: 0 auto;
line-height: 84upx;
margin-top:20upx;
text-align: center;"> 自定义</view>
</view> </view>
</view> </view>
...@@ -90,12 +98,20 @@ ...@@ -90,12 +98,20 @@
goodCurrentIndexTop: 0, //上面商品选中 goodCurrentIndexTop: 0, //上面商品选中
sizeCurrentIndexTop: 0, //下面尺寸选中 sizeCurrentIndexTop: 0, //下面尺寸选中
selectGoodSize: null, //选中商品尺寸 selectGoodSize: null, //选中商品尺寸
isShowCustomize: true, //是否自定义选中
}; };
}, },
mounted() {}, mounted() {},
methods: { methods: {
//自定义尺寸
toCustomSize() {
this.isShow = false;
this.$emit('toCustomSize');
},
//保存商品 //保存商品
saveGood() { saveGood() {
if (this.selectGood == null) { if (this.selectGood == null) {
...@@ -106,7 +122,6 @@ ...@@ -106,7 +122,6 @@
} }
this.isShow = false; this.isShow = false;
this.goodtext = this.selectGoodSize.title //选择商品名 this.goodtext = this.selectGoodSize.title //选择商品名
//console.log("this.goodtext="+this.goodtext);
this.$emit('selectGoodItem', { this.$emit('selectGoodItem', {
id: this.selectGood.id, id: this.selectGood.id,
title: this.goodtext, title: this.goodtext,
...@@ -136,7 +151,12 @@ ...@@ -136,7 +151,12 @@
}, },
//打开页面 //打开页面
open(machineId) { open(machineId, isShowCustomize) {
if (isShowCustomize) {
this.isShowCustomize = isShowCustomize
} else {
this.isShowCustomize = false
}
this.machine_id = machineId; this.machine_id = machineId;
this.getGooods(); this.getGooods();
}, },
...@@ -151,9 +171,11 @@ ...@@ -151,9 +171,11 @@
this.goods = result.goods; this.goods = result.goods;
if (this.goods != null && this.goods.length > 0) { if (this.goods != null && this.goods.length > 0) {
this.selectGood = this.goods[0]; this.selectGood = this.goods[0];
this.goodCurrentIndexTop = 0; //上面商品选中
} }
if (this.selectGood.attribute && this.selectGood.attribute.length > 0) { if (this.selectGood.attribute && this.selectGood.attribute.length > 0) {
this.selectGoodSize = this.selectGood.attribute[0]; this.selectGoodSize = this.selectGood.attribute[0];
this.sizeCurrentIndexTop = 0; //下面尺寸选中
} }
if (this.goods == null || this.goods.length == 0) { if (this.goods == null || this.goods.length == 0) {
this.isShow = false; this.isShow = false;
......
...@@ -48,14 +48,6 @@ const service = { ...@@ -48,14 +48,6 @@ const service = {
service.setUserInfo(data); service.setUserInfo(data);
service.cacheUserInfo(service.getUserInfo()); service.cacheUserInfo(service.getUserInfo());
}}), }}),
// queryUser: (id = null) => _query({api: _queryUser, params: id, callBack: (data = {}) => {
// service.setUserInfo(data);
// service.cacheUserInfo(service.getUserInfo());
// }}),
// refreshToken: (oldToken = null) => _query({api: _refreshToken, params: oldToken, callBack: (data = {}) => {
// service.setToken(service.getAppUser().tokenHead + data);
// service.cacheAppUser(service.getAppUser());
// }}),
} }
export default service export default service
......
...@@ -21,19 +21,19 @@ const service = { ...@@ -21,19 +21,19 @@ const service = {
getStock: () => _getters('stock', []), getStock: () => _getters('stock', []),
// Ad.list 获取广告 // Ad.list 获取广告
// Account.newOrder 个人最新消费记录 // Account.newOrder 个人最新消费记录
// Machine.shopList 获取附件店铺 // Machine.shopList 获取附件店铺
// User.recommendUser 推荐设计师 // User.recommendUser 推荐设计师
// Works.category 作品分类 // Works.category 作品分类
// Material.category 贴图分类 // Material.category 贴图分类
queryList: (user = {}) => _queryList({api: route, params: user, callBack: (data = {}) => { queryList: (user = {}) => _queryList({api: route, params: user, callBack: (data = {}) => {
}}), }}),
// 作品 Works.list// 我的作品 Works.mylist// 作品详情 Works.detail 作品分类 Works.category //作品 Works.list// 我的作品 Works.mylist// 作品详情 Works.detail 作品分类 Works.category
WorksList: (user = {}) => _queryList({api: route, params: user, callBack: (data = {}) => { WorksList: (user = {}) => _queryList({api: route, params: user, callBack: (data = {}) => {
}}), }}),
cheshi: (user = {}) => _queryList({api: route_timeout, params: user, callBack: (data = {}) => { cheshi: (user = {}) => _queryList({api: route_timeout, params: user, callBack: (data = {}) => {
}}), }}),
// 贴头 Material.list// 我的贴头 Material.mylist// 贴头详情 Material.detail 贴头分类 Material.category //贴头 Material.list// 我的贴头 Material.mylist// 贴头详情 Material.detail 贴头分类 Material.category
// 更新状态 Material.updateStatus off:下架,on:上架, publish:发布,del:删除 //更新状态 Material.updateStatus off:下架,on:上架, publish:发布,del:删除
MaterialList: (user = {}) => _queryList({api: route, params: user, callBack: (data = {}) => { MaterialList: (user = {}) => _queryList({api: route, params: user, callBack: (data = {}) => {
}}), }}),
newqueryList: (user = {}) => _queryList({api: newroute, params: user, callBack: (data = {}) => { newqueryList: (user = {}) => _queryList({api: newroute, params: user, callBack: (data = {}) => {
...@@ -44,7 +44,6 @@ export default service ...@@ -44,7 +44,6 @@ export default service
/** /**
* url:/lite/index * url:/lite/index
*
* 获取附件店铺 * 获取附件店铺
* query:{s: 'Machine.shopList',longitude: ,latitude: ,distance:} * query:{s: 'Machine.shopList',longitude: ,latitude: ,distance:}
* 个人最新消费记录 * 个人最新消费记录
......
...@@ -64,7 +64,7 @@ export default { ...@@ -64,7 +64,7 @@ export default {
StringStyle, StringStyle,
DataType, DataType,
ContentType, ContentType,
// 公共枚举值 //公共枚举值
TRUE: true, TRUE: true,
FALSE: false, FALSE: false,
STR_TRUE: '1', STR_TRUE: '1',
......
const accountInfo = wx.getAccountInfoSync();// 获取当前帐号信息 const accountInfo = wx.getAccountInfoSync();// 获取当前帐号信息
if(!accountInfo.miniProgram.envVersion){ if(!accountInfo.miniProgram.envVersion){
console.error("获取运行环境失败!"); //console.error("获取运行环境失败!");
} }
const baseApi = { const baseApi = {
// 开发版 // 开发版
develop: "https://tprint.refinecolor.com", develop: "https://tprint.refinecolor.com",
//develop: "https://tprint.colorpark.cn", //develop: "https://tprint.colorpark.cn",
// 体验版 // 体验版
trial: "https://tprint.refinecolor.com", trial: "https://tprint.refinecolor.com",
...@@ -13,7 +13,6 @@ const baseApi = { ...@@ -13,7 +13,6 @@ const baseApi = {
release: "https://tprint.colorpark.cn", release: "https://tprint.colorpark.cn",
}; };
const baseURL = baseApi[accountInfo.miniProgram.envVersion] const baseURL = baseApi[accountInfo.miniProgram.envVersion]
//console.log(accountInfo.miniProgram.envVersion)
//console.log(baseURL) //console.log(baseURL)
const Env = { const Env = {
getDevBaseURL: () => baseURL, getDevBaseURL: () => baseURL,
...@@ -27,6 +26,5 @@ const Env = { ...@@ -27,6 +26,5 @@ const Env = {
getappId: () => "wx55b5b6d95c648041", getappId: () => "wx55b5b6d95c648041",
//getenvVersion: () => "trial", //getenvVersion: () => "trial",
getenvVersion: () => "release", getenvVersion: () => "release",
} }
export default Env export default Env
\ No newline at end of file
...@@ -3,9 +3,9 @@ import store from '../store' ...@@ -3,9 +3,9 @@ import store from '../store'
const baseUrl = Env.getBaseURL(); const baseUrl = Env.getBaseURL();
const http = ({ url = '', param = {}, ...other } = {}) => { const http = ({ url = '', param = {}, ...other } = {}) => {
// wx.showLoading({ //wx.showLoading({
// title: '啊嘞,色彩正在绘制' // title: '啊嘞,色彩正在绘制'
// }); //});
let timeStart = Date.now(); let timeStart = Date.now();
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
wx.request({ wx.request({
......
...@@ -8,16 +8,15 @@ const request = new Fly ...@@ -8,16 +8,15 @@ const request = new Fly
*/ */
request.interceptors.request.use((config, promise) => { request.interceptors.request.use((config, promise) => {
//超时设置 //超时设置
if (config._timeout) config.timeout = 60000; if (config._timeout) config.timeout = 60000;
//从环境变量中取 BASE_UR //从环境变量中取 BASE_UR
console.log(process)
if (process.env.NODE_ENV === 'development') config.baseURL = Env.getDevBaseURL() if (process.env.NODE_ENV === 'development') config.baseURL = Env.getDevBaseURL()
else config.baseURL = Env.getBaseURL() else config.baseURL = Env.getBaseURL()
//JSON格式化,未指定时,默认true //JSON格式化,未指定时,默认true
config.parseJson = $n._isNotNull(config.parseJson) ? config.parseJson : true config.parseJson = $n._isNotNull(config.parseJson) ? config.parseJson : true
// 如指定_token == true,则在headers中跟上相关token信息 //如指定_token == true,则在headers中跟上相关token信息
if (config._token) config.headers['token'] = store.getters.appUser.token; if (config._token) config.headers['token'] = store.getters.appUser.token;
console.warn('####### API Request: ', config) //console.warn('####### API Request: ', config)
return config return config
}) })
...@@ -41,7 +40,7 @@ request.interceptors.response.use( ...@@ -41,7 +40,7 @@ request.interceptors.response.use(
}, },
(error, promise) => { (error, promise) => {
let msg = $n._caseValue(error.code, 0, '网络连接异常', 1, '网络连接超时', 401, '请求服务未授权', error.msg) let msg = $n._caseValue(error.code, 0, '网络连接异常', 1, '网络连接超时', 401, '请求服务未授权', error.msg)
console.error('####### API Response error: ', error) //console.error('####### API Response error: ', error)
if (error.status == 401 ) { if (error.status == 401 ) {
uni.showModal({ uni.showModal({
title: '', title: '',
...@@ -56,12 +55,9 @@ request.interceptors.response.use( ...@@ -56,12 +55,9 @@ request.interceptors.response.use(
title: '', title: '',
content: '服务器异常,状态=500' , content: '服务器异常,状态=500' ,
showCancel: false, showCancel: false,
}) })
} else return promise.reject(msg) } else return promise.reject(msg)
}, },
) )
export default request export default request
\ No newline at end of file
...@@ -59,7 +59,7 @@ App({ ...@@ -59,7 +59,7 @@ App({
updateManager.applyUpdate() updateManager.applyUpdate()
}) })
updateManager.onUpdateFailed(function () { updateManager.onUpdateFailed(function () {
// 新的版本下载失败 //新的版本下载失败
wx.showModal({ wx.showModal({
title: '已经有新版本了哟~', title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~', content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
......
...@@ -7,7 +7,6 @@ import Env from './Env' ...@@ -7,7 +7,6 @@ import Env from './Env'
const wechat = { const wechat = {
oauth2: ({appid, redirectUri, responseType = 'code', scope = 'snsapi_base', state = 'WECHAT'} = {}) => { oauth2: ({appid, redirectUri, responseType = 'code', scope = 'snsapi_base', state = 'WECHAT'} = {}) => {
let oauth2URL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appid + '&redirect_uri=' + redirectUri + '&response_type=' + responseType + '&scope=' + scope + '&state=' + state + '#wechat_redirect' let oauth2URL = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + appid + '&redirect_uri=' + redirectUri + '&response_type=' + responseType + '&scope=' + scope + '&state=' + state + '#wechat_redirect'
//console.warn('### oauth2URL ###', oauth2URL)
window.location.href = oauth2URL window.location.href = oauth2URL
}, },
hashSHA1: (str) => { hashSHA1: (str) => {
...@@ -28,26 +27,26 @@ const wechat = { ...@@ -28,26 +27,26 @@ const wechat = {
let signatureStr = 'jsapi_ticket=' + jssdkUser.ticket + '&noncestr=' + nonceStr + '&timestamp=' + timestamp + '&url=' + url let signatureStr = 'jsapi_ticket=' + jssdkUser.ticket + '&noncestr=' + nonceStr + '&timestamp=' + timestamp + '&url=' + url
let signature = this.hashSHA1(signatureStr) let signature = this.hashSHA1(signatureStr)
jweixin.ready(res => { jweixin.ready(res => {
wechatService.setWxConfigInitStatus(true) wechatService.setWxConfigInitStatus(true)
//console.warn('#### wx.ready ####', res) //console.warn('#### wx.ready ####', res)
//alert('wx.ready: ' + JSON.stringify(res)) //alert('wx.ready: ' + JSON.stringify(res))
}) })
jweixin.error(res => { jweixin.error(res => {
//console.warn('#### wx.error ####', res) //console.warn('#### wx.error ####', res)
//alert('wx.error: ' + JSON.stringify(res)) //alert('wx.error: ' + JSON.stringify(res))
}) })
let configData = { let configData = {
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 //debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: jssdkUser.appid, // 必填,公众号的唯一标识 appId: jssdkUser.appid, // 必填,公众号的唯一标识
timestamp, // 必填,生成签名的时间戳 timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串 nonceStr, // 必填,生成签名的随机串
signature, // 必填,签名 signature, // 必填,签名
jsApiList: [] // 必填,需要使用的JS接口列表 jsApiList: [] // 必填,需要使用的JS接口列表
}
console.log('signatureStr', signatureStr)
console.log('configData', JSON.stringify(configData))
jweixin.config(configData)
} }
console.log('signatureStr', signatureStr)
console.log('configData', JSON.stringify(configData))
jweixin.config(configData)
}
} }
export default wechat export default wechat
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
* Created by zhengqiguang on 2017/4/30. * Created by zhengqiguang on 2017/4/30.
*/ */
class WxTouchEvent { class WxTouchEvent {
constructor() { constructor() {
this.preV = {x: null, y: null}; this.preV = {x: null, y: null};
...@@ -83,14 +82,12 @@ class WxTouchEvent { ...@@ -83,14 +82,12 @@ class WxTouchEvent {
let otx = evt.touches[1].pageX == null ? evt.touches[1].x : evt.touches[1].pageX; let otx = evt.touches[1].pageX == null ? evt.touches[1].x : evt.touches[1].pageX;
let oty = evt.touches[1].pageY == null ? evt.touches[1].y : evt.touches[1].pageY; let oty = evt.touches[1].pageY == null ? evt.touches[1].y : evt.touches[1].pageY;
let v = { x: otx - currentX, y: oty - currentY}; let v = { x: otx - currentX, y: oty - currentY};
if (preV.x !== null) { if (preV.x !== null) {
if (this.pinchStartLen > 0) { if (this.pinchStartLen > 0) {
evt.scale = getLen(v) / this.pinchStartLen; evt.scale = getLen(v) / this.pinchStartLen;
evt.type = "pinch"; evt.type = "pinch";
this.pinch.dispatch(evt); this.pinch.dispatch(evt);
} }
evt.angle = getRotateAngle(v, preV); evt.angle = getRotateAngle(v, preV);
evt.type = "rotate"; evt.type = "rotate";
this.rotate.dispatch(evt); this.rotate.dispatch(evt);
...@@ -108,9 +105,7 @@ class WxTouchEvent { ...@@ -108,9 +105,7 @@ class WxTouchEvent {
} }
this.pressMove.dispatch(evt); this.pressMove.dispatch(evt);
} }
this.touchMove.dispatch(evt); this.touchMove.dispatch(evt);
this._cancelLongTap(); this._cancelLongTap();
this.x2 = currentX; this.x2 = currentX;
this.y2 = currentY; this.y2 = currentY;
...@@ -149,14 +144,12 @@ class WxTouchEvent { ...@@ -149,14 +144,12 @@ class WxTouchEvent {
self.isDoubleTap = false; self.isDoubleTap = false;
} }
}, 0) }, 0)
if (!self.isDoubleTap) { if (!self.isDoubleTap) {
self.singleTapTimeout = setTimeout(function () { self.singleTapTimeout = setTimeout(function () {
self.singleTap.dispatch(evt); self.singleTap.dispatch(evt);
}, 250); }, 250);
} }
} }
this.preV.x = 0; this.preV.x = 0;
this.preV.y = 0; this.preV.y = 0;
this.scale = 1; this.scale = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment