Commit 5554009d by yanju

动态,话题发布

parent 10495d71
......@@ -6,5 +6,58 @@ export default {
normalZIndex:1000,
primaryColor:(opacity=1)=>{
return `rgba(0,170,230,${opacity})`
},
routes:{
login:'/users/login',
register:'users/register',
reset:'users/reset',
home:'/',
project:{
index:'/project',
detail:'/project/detail/',
},
blog:{
index:'/blog',
detail:'/blog/detail/',
},
news:{
index:'/news',
detail:'/news/detail/',
},
answer:{
index:'/answer',
detail:'/answer/detail/',
},
dynamic:{
index:'/dynamic',
release:'/dynamic/release',
},
topic:{
index:'/topic',
detail:'/topic/detail/',
rank:'/topic/rank',
},
personalCenter:{
index:'/personal-center',
message:'/personal-center/message',
like:'/personal-center/like',
project:'/personal-center/project',
blog:'/personal-center/blog',
answer:'/personal-center/answer',
question:'/personal-center/question',
topic:'/personal-center/topic',
dynamic:'/personal-center/dynamic',
person:{
fans:'/personal-center/person/fans',
following:'/personal-center/person/following',
blackList:'/personal-center/person/black-list'
}
},
homePage:'/u/_id/'
}
}
No preview for this file type
......@@ -6,9 +6,65 @@
"description": "",
"glyphs": [
{
"icon_id": "13476732",
"name": "logo_download",
"font_class": "yun-icon--logo_download",
"unicode": "e638",
"unicode_decimal": 58936
},
{
"icon_id": "13476730",
"name": "logo_news",
"font_class": "yun-icon--logo_news",
"unicode": "e637",
"unicode_decimal": 58935
},
{
"icon_id": "13476728",
"name": "logo_answer",
"font_class": "yun-icon--logo_answer",
"unicode": "e636",
"unicode_decimal": 58934
},
{
"icon_id": "13476726",
"name": "logo_topic",
"font_class": "yun-icon--logo_topic",
"unicode": "e635",
"unicode_decimal": 58933
},
{
"icon_id": "13476725",
"name": "logo_dynamic",
"font_class": "yun-icon--logo_dynamic",
"unicode": "e634",
"unicode_decimal": 58932
},
{
"icon_id": "13476724",
"name": "logo_blog",
"font_class": "yun-icon--logo_blog",
"unicode": "e633",
"unicode_decimal": 58931
},
{
"icon_id": "13476723",
"name": "logo_home",
"font_class": "yun-icon--logo_home",
"unicode": "e632",
"unicode_decimal": 58930
},
{
"icon_id": "13476722",
"name": "logo_project",
"font_class": "yun-icon--logo_project",
"unicode": "e631",
"unicode_decimal": 58929
},
{
"icon_id": "13453039",
"name": "ellipsis",
"font_class": "icon-yun--menu2",
"font_class": "yun-icon--menu2",
"unicode": "e62e",
"unicode_decimal": 58926
},
......
No preview for this file type
......@@ -84,8 +84,7 @@ table {
border-spacing: 0
}
body, html {
touch-action:manipulation;
font-size:1px;
max-width:750px;
margin:0 auto;
......@@ -95,6 +94,7 @@ body, html {
body{
overflow-x:hidden ;
overflow-y: auto;
//touch-action: pan-y;
}
a {
......
......@@ -233,6 +233,7 @@
/*flex-shrink: 0;*/
overflow: hidden;
position: relative;
touch-action:pan-y;
/*cursor:pointer;*/
}
</style>
......
<template>
<div
:style="{fontSize: fontSize*heightRate+'px' , lineHeight: lineHeight*heightRate+'px', height: 'auto'}"
:style="{fontSize: fontSize*heightRate+'px' , lineHeight: lineHeight*heightRate+'px', minHeight: '100%'}"
class="auto-textarea-wrapper"
>
<pre
......@@ -11,6 +11,8 @@
ref="vTextarea"
:autofocus="s_autofocus"
@keyup="change" spellcheck="false"
@focus="focus"
@blur="blur"
:placeholder="placeholder"
v-model="temp_value"
:style="{fontSize: fontSize*heightRate+'px' ,
......@@ -45,6 +47,7 @@
}
},
props: {
fullHeight: {
type: Boolean,
......@@ -92,10 +95,26 @@
}
},
methods: {
refsFocus(){
this.$refs.vTextarea.focus()
},
refsBlur(){
this.$refs.vTextarea.blur()
},
change($event) {
if (this.onchange) {
this.onchange(this.temp_value , $event)
}
},
focus(){
this.$emit('focus' , 1)
},
blur(){
this.$emit('blur' , 1)
}
},
watch: {
......@@ -104,7 +123,7 @@
},
temp_value: function (val, oldVal) {
this.$emit('input' , val)
}
},
}
}
......
......@@ -121,6 +121,7 @@
<style lang="scss" scoped>
i{
font-family: sans-serif;
&:before{}
}
......
......@@ -4,12 +4,16 @@
:width-v="widthV"
:bg-color-v="bgColorV"
:border-r="borderR"
:border-v="borderV"
>
<yun-div
:border-r="borderR"
:border-v="borderV"
:height-v="heightV"
:flex-v="['row','flex-start','center']"
:extend-style="{
boxSizing:'border-box'
}"
>
<yun-div
v-if="leftWord"
......@@ -65,14 +69,14 @@
:show-ske="false"
:font-style="[16,36,500,'#00AAE6','center']"
:bg-color-v="commonReturnPrimaryColor(0.2)"
v-if="value &&showClose"
v-if="showClose&&value"
>
<yun-icon name="close1" v-tap="tapClose" :size="16" color="#00AAE6"></yun-icon>
</yun-div>
</yun-div>
<yun-div
v-if="leftWord"
v-if="leftWord&&showAlert"
:height-v="46"
:flex-v="['row','flex-start','center']"
:border-v="[1,'solid',borderColor,'top']"
......@@ -134,6 +138,10 @@
type:Boolean,
default:false,
},
showAlert:{
type:Boolean,
default:true,
},
value: [String, Number],
placeholder:String,
validate:{
......
......@@ -9,17 +9,10 @@ function TouchEvent(el,binding,type) {
this.vueCallBack = typeof (binding.value)==="object"?binding.value:binding.value;
this.obj.addEventListener('touchstart',function (e) {
_this.start(e);
},false);
this.obj.addEventListener("touchend",function(e){
_this.end(e);
},false);
this.obj.addEventListener("touchmove",function(e){
_this.move(e);
},false);
}
}, {passive: false});
TouchEvent.prototype = {
start:function (e) {
_this.start =function(e){
let _this = this;
this.vueMoves=true;
this.vueLeave=true;
this.longTouch=true;
......@@ -30,51 +23,50 @@ TouchEvent.prototype = {
this.longTouch=false;
};
}.bind(this),1000);
},
end:function (e) {
var disX=e.changedTouches[0]?e.changedTouches[0].pageX-this.vueTouches.x:0;
var disY=e.changedTouches[0]?e.changedTouches[0].pageY-this.vueTouches.y:0;
clearTimeout(this.time);
_this.obj.addEventListener("touchend",
_this.end,{passive:false});
_this.obj.addEventListener("touchmove",
_this.move,{passive:false});
};
_this.end =function (e) {
var disX=e.changedTouches[0]?e.changedTouches[0].pageX-_this.vueTouches.x:0;
var disY=e.changedTouches[0]?e.changedTouches[0].pageY-_this.vueTouches.y:0;
clearTimeout(_this.time);
if(Math.abs(disX)>10||Math.abs(disY)>100) {//当横向位移大于10,纵向位移大于100,则判定为滑动事件
this.touchType=="swipe"&&this.vueCallBack(this.binding.value,e);//若为滑动事件则返回
_this.touchType=="swipe"&&_this.vueCallBack(_this.binding.value,e);//若为滑动事件则返回
if(Math.abs(disX)>Math.abs(disY)){//判断是横向滑动还是纵向滑动
if(disX>10){
e.preventDefault && e.preventDefault();
e.returnValue=false;
e.stopPropagation && e.stopPropagation();
this.touchType=="swiperight"&&this.vueCallBack(this.binding.value,e);//右滑
_this.touchType=="swiperight"&&_this.vueCallBack(_this.binding.value,e);//右滑
return false
};
if(disX<-10){
e.preventDefault && e.preventDefault();
e.returnValue=false;
e.stopPropagation && e.stopPropagation();
e.preventDefault();
this.touchType=="swipeleft"&&this.vueCallBack(this.binding.value,e);//左滑
_this.touchType=="swipeleft"&&_this.vueCallBack(_this.binding.value,e);//左滑
return false
};
}else{
if(disY>10){
this.touchType=="swipedown"&&this.vueCallBack(this.binding.value,e);//下滑
_this.touchType=="swipedown"&&_this.vueCallBack(_this.binding.value,e);//下滑
};
if(disY<-10){
this.touchType=="swipeup"&&this.vueCallBack(this.binding.value,e);//上滑
_this.touchType=="swipeup"&&_this.vueCallBack(_this.binding.value,e);//上滑
};
};
}else{
if(this.longTouch&&this.vueMoves){
this.touchType=="tap"&&this.vueCallBack(this.binding.value,e);
this.vueLeave=false
if(_this.longTouch&&_this.vueMoves){
_this.touchType=="tap"&&_this.vueCallBack(_this.binding.value,e);
_this.vueLeave=false
};
}
},
move:function(e){//监听touchmove事件
_this.obj.removeEventListener("touchend",
_this.end, {passive: false});
_this.obj.removeEventListener("touchmove",
_this.move, {passive: false});
};
this.vueMoves=false;
_this.move =function(e){//监听touchmove事件
_this.vueMoves=false;
}
}
export default TouchEvent
......@@ -70,7 +70,7 @@
position:'fixed',
maxWidth:'750px',
boxSizing:'border-box',
zIndex:headerZIndex
zIndex:fullScreenZIndex
}"
v-if="showMenu"
......@@ -92,17 +92,28 @@
v-for="(val,index) in menuArr"
:key="val.name"
>
<yun-img
<yun-div
:width-v="72"
:height-v="72"
:border-r="[36]"
:border-v="[1,'solid',commonReturnPrimaryColor(0.2)]"
:ske-h="72"
:ske-w="72"
:src="val.icon"
:font-style="[24,72,undefined,undefined,'center']"
:show-ske="false"
:extend-style="{
boxSizing:'border-box'
}"
>
<yun-icon
:name="val.icon"
:color="commonReturnPrimaryColor(1)"
:size="30"
>
</yun-icon>
</yun-div>
</yun-img>
<yun-div
:font-style="[26,35,500,'#666','center']"
......@@ -210,14 +221,14 @@
return{
showMenu:false,
menuArr:[
{name:'首页',icon:'',route:''},
{name:'项目',icon:'',route:''},
{name:'博客',icon:'',route:''},
{name:'动态',icon:'',route:''},
{name:'话题',icon:'',route:''},
{name:'问答',icon:'',route:''},
{name:'资讯',icon:'',route:''},
{name:'下载',icon:'',route:''},
{name:'首页',icon:'logo_home',route:''},
{name:'项目',icon:'logo_project',route:''},
{name:'博客',icon:'logo_blog',route:''},
{name:'动态',icon:'logo_dynamic',route:''},
{name:'话题',icon:'logo_topic',route:''},
{name:'问答',icon:'logo_answer',route:''},
{name:'资讯',icon:'logo_news',route:''},
{name:'下载',icon:'logo_download',route:''},
],
searchValue:'',
route:'home',
......
......@@ -20,7 +20,9 @@
mounted() {
if(process.browser){
this.fontSelfAdaption()
this.fontSelfAdaption();
this.preventTouchDefault();
}
},
......@@ -41,6 +43,27 @@
};
functionName();
window.addEventListener(eventName, functionName, !1);
},
preventTouchDefault(){
//取得当前滑动开始值
var startX,startY;
document.addEventListener("touchstart",function(e){
startX = e.targetTouches[0].pageX;
startY = e.targetTouches[0].pageY;
});
document.addEventListener("touchmove",function(e){
var moveX = e.targetTouches[0].pageX;
var moveY = e.targetTouches[0].pageY;
if(Math.abs(moveX-startX)>Math.abs(moveY-startY)){
e.preventDefault();
}
},{passive:false});
}
},
}
......
......@@ -12,7 +12,7 @@ module.exports = {
title: process.env.npm_package_name || '',
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no' },
{ hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
],
link: [
......
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