Commit 0fc82f7d by huahua

修改自定义页面

parent 44af7cee
......@@ -7,7 +7,7 @@
num:0
},
onLaunch: function() {
// 字体列表
//字体列表
homeservice.queryList({
s: 'Material.fontFamilyList'
}).then(result => {
......
......@@ -19,7 +19,6 @@ Vue.prototype.$AppContext = AppContext
Vue.prototype.$Env = Env
Vue.prototype.$base = base
Vue.prototype.$http = http
App.mpType = 'app'
const app = new Vue({
......
......@@ -47,6 +47,17 @@
"enablePullDownRefresh": true,
"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 @@
};
},
mounted() {
},
methods: {
bgColorAssembly(item){
......
......@@ -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.isShowLineH = false;
......
<template>
<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>
<view style="position: relative;width: 100%; height: 100%; z-index: 2;">
......@@ -30,7 +30,9 @@
background: linear-gradient(92deg, #E6B01A, #F29F3D);
box-shadow: 0px 19px 48px 1px rgba(20, 31, 62, 0.35);
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>
......@@ -57,6 +59,7 @@
<text style="font-size: 22upx;">深圳市瑞丰彩科技有限公司</text>
</view>
</view>
<!-- 登录弹框 -->
<Signin ref="Signin"></Signin>
......@@ -65,7 +68,7 @@
<image src="../../static/liebiao.png" mode="" style="width: 243upx; height: 123upx;"></image>
</view>
<switchGoods ref="switchGoods" @selectGoodItem="selectGoodItem"></switchGoods>
<switchGoods ref="switchGoods" @selectGoodItem="selectGoodItem" @toCustomSize="toCustomSize"></switchGoods>
<!--//商品弹框 -->
</view>
......@@ -108,6 +111,17 @@
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() {
if (!this.$AppContext.checkLogin()) {
......@@ -121,11 +135,14 @@
//选择商品进来
selectGoodItem(item) {
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 @@
if (!this.$AppContext.checkLogin()) {
this.tologo(1)
} 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 @@
s: 'Init.init',
code: res.code
}).then(r => {
//console.log("进来")
//that.getDetail();
if (type == 1) {
that.$refs['switchGoods'].open(that.machine_id);
} else {
......@@ -258,7 +274,7 @@
//分享转发
onShareAppMessage(options) {
var that = this;
// 设置转发内容
//设置转发内容
var shareObj = {
title: this.$Env.getmalltext(),
path: '/pages/mall/machineDetail?machine_id=' + this.machine_id, // 默认是当前页面,必须是以‘/’开头的完整路径
......@@ -278,12 +294,16 @@
this.$base.machine_id = this.machine_id
this.statusloading = 1;
this.Adlist() // 轮播图
//this.getDetail();
this.getDetail();
},
onShow() {},
onShow() {
this.getDetail();
},
onHide() {}
onHide() {
}
};
</script>
......
......@@ -81,7 +81,7 @@
success: function(res) {
console.log(res)
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({
url: '../index/machineDetail?machine_id=' + that
.getQueryString(
......@@ -97,7 +97,7 @@
} else {
if (res.path) {
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({
url: '../index/machineDetail?machine_id=' + that
.getQueryString(res.path, 'machine_id')
......
......@@ -7,7 +7,7 @@
</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;
height: 720upx;
......@@ -36,9 +36,9 @@
border-radius: 15upx;
position: relative;
width: 180upx">
<image mode="center"
<image mode="widthFix"
: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%;
color:#000; margin-top: 30upx;">
{{item !=null ? item.name : ''}}
......@@ -70,8 +70,16 @@
margin: 0 auto;
line-height: 84upx;
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>
......@@ -90,12 +98,20 @@
goodCurrentIndexTop: 0, //上面商品选中
sizeCurrentIndexTop: 0, //下面尺寸选中
selectGoodSize: null, //选中商品尺寸
isShowCustomize: true, //是否自定义选中
};
},
mounted() {},
methods: {
//自定义尺寸
toCustomSize() {
this.isShow = false;
this.$emit('toCustomSize');
},
//保存商品
saveGood() {
if (this.selectGood == null) {
......@@ -106,7 +122,6 @@
}
this.isShow = false;
this.goodtext = this.selectGoodSize.title //选择商品名
//console.log("this.goodtext="+this.goodtext);
this.$emit('selectGoodItem', {
id: this.selectGood.id,
title: this.goodtext,
......@@ -136,7 +151,12 @@
},
//打开页面
open(machineId) {
open(machineId, isShowCustomize) {
if (isShowCustomize) {
this.isShowCustomize = isShowCustomize
} else {
this.isShowCustomize = false
}
this.machine_id = machineId;
this.getGooods();
},
......@@ -151,9 +171,11 @@
this.goods = result.goods;
if (this.goods != null && this.goods.length > 0) {
this.selectGood = this.goods[0];
this.goodCurrentIndexTop = 0; //上面商品选中
}
if (this.selectGood.attribute && this.selectGood.attribute.length > 0) {
this.selectGoodSize = this.selectGood.attribute[0];
this.sizeCurrentIndexTop = 0; //下面尺寸选中
}
if (this.goods == null || this.goods.length == 0) {
this.isShow = false;
......
......@@ -48,14 +48,6 @@ const service = {
service.setUserInfo(data);
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
......
......@@ -27,13 +27,13 @@ const service = {
// Material.category 贴图分类
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 = {}) => {
}}),
cheshi: (user = {}) => _queryList({api: route_timeout, params: user, callBack: (data = {}) => {
}}),
// 贴头 Material.list// 我的贴头 Material.mylist// 贴头详情 Material.detail 贴头分类 Material.category
// 更新状态 Material.updateStatus off:下架,on:上架, publish:发布,del:删除
//贴头 Material.list// 我的贴头 Material.mylist// 贴头详情 Material.detail 贴头分类 Material.category
//更新状态 Material.updateStatus off:下架,on:上架, publish:发布,del:删除
MaterialList: (user = {}) => _queryList({api: route, params: user, callBack: (data = {}) => {
}}),
newqueryList: (user = {}) => _queryList({api: newroute, params: user, callBack: (data = {}) => {
......@@ -44,7 +44,6 @@ export default service
/**
* url:/lite/index
*
* 获取附件店铺
* query:{s: 'Machine.shopList',longitude: ,latitude: ,distance:}
* 个人最新消费记录
......
......@@ -64,7 +64,7 @@ export default {
StringStyle,
DataType,
ContentType,
// 公共枚举值
//公共枚举值
TRUE: true,
FALSE: false,
STR_TRUE: '1',
......
const accountInfo = wx.getAccountInfoSync();// 获取当前帐号信息
if(!accountInfo.miniProgram.envVersion){
console.error("获取运行环境失败!");
//console.error("获取运行环境失败!");
}
const baseApi = {
// 开发版
......@@ -13,7 +13,6 @@ const baseApi = {
release: "https://tprint.colorpark.cn",
};
const baseURL = baseApi[accountInfo.miniProgram.envVersion]
//console.log(accountInfo.miniProgram.envVersion)
//console.log(baseURL)
const Env = {
getDevBaseURL: () => baseURL,
......@@ -27,6 +26,5 @@ const Env = {
getappId: () => "wx55b5b6d95c648041",
//getenvVersion: () => "trial",
getenvVersion: () => "release",
}
export default Env
\ No newline at end of file
......@@ -3,9 +3,9 @@ import store from '../store'
const baseUrl = Env.getBaseURL();
const http = ({ url = '', param = {}, ...other } = {}) => {
// wx.showLoading({
//wx.showLoading({
// title: '啊嘞,色彩正在绘制'
// });
//});
let timeStart = Date.now();
return new Promise((resolve, reject) => {
wx.request({
......
......@@ -10,14 +10,13 @@ request.interceptors.request.use((config, promise) => {
//超时设置
if (config._timeout) config.timeout = 60000;
//从环境变量中取 BASE_UR
console.log(process)
if (process.env.NODE_ENV === 'development') config.baseURL = Env.getDevBaseURL()
else config.baseURL = Env.getBaseURL()
//JSON格式化,未指定时,默认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;
console.warn('####### API Request: ', config)
//console.warn('####### API Request: ', config)
return config
})
......@@ -41,7 +40,7 @@ request.interceptors.response.use(
},
(error, promise) => {
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 ) {
uni.showModal({
title: '',
......@@ -56,12 +55,9 @@ request.interceptors.response.use(
title: '',
content: '服务器异常,状态=500' ,
showCancel: false,
})
} else return promise.reject(msg)
},
)
export default request
\ No newline at end of file
......@@ -59,7 +59,7 @@ App({
updateManager.applyUpdate()
})
updateManager.onUpdateFailed(function () {
// 新的版本下载失败
//新的版本下载失败
wx.showModal({
title: '已经有新版本了哟~',
content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~',
......
......@@ -7,7 +7,6 @@ import Env from './Env'
const 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'
//console.warn('### oauth2URL ###', oauth2URL)
window.location.href = oauth2URL
},
hashSHA1: (str) => {
......@@ -37,7 +36,7 @@ const wechat = {
//alert('wx.error: ' + JSON.stringify(res))
})
let configData = {
// debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
//debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
appId: jssdkUser.appid, // 必填,公众号的唯一标识
timestamp, // 必填,生成签名的时间戳
nonceStr, // 必填,生成签名的随机串
......
......@@ -2,7 +2,6 @@
* Created by zhengqiguang on 2017/4/30.
*/
class WxTouchEvent {
constructor() {
this.preV = {x: null, y: null};
......@@ -83,14 +82,12 @@ class WxTouchEvent {
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 v = { x: otx - currentX, y: oty - currentY};
if (preV.x !== null) {
if (this.pinchStartLen > 0) {
evt.scale = getLen(v) / this.pinchStartLen;
evt.type = "pinch";
this.pinch.dispatch(evt);
}
evt.angle = getRotateAngle(v, preV);
evt.type = "rotate";
this.rotate.dispatch(evt);
......@@ -108,9 +105,7 @@ class WxTouchEvent {
}
this.pressMove.dispatch(evt);
}
this.touchMove.dispatch(evt);
this._cancelLongTap();
this.x2 = currentX;
this.y2 = currentY;
......@@ -149,14 +144,12 @@ class WxTouchEvent {
self.isDoubleTap = false;
}
}, 0)
if (!self.isDoubleTap) {
self.singleTapTimeout = setTimeout(function () {
self.singleTap.dispatch(evt);
}, 250);
}
}
this.preV.x = 0;
this.preV.y = 0;
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