askbot-dragon 0.6.31 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "askbot-dragon",
3
- "version": "0.6.31",
3
+ "version": "0.7.1",
4
4
  "scripts": {
5
5
  "serve": "vue-cli-service serve",
6
6
  "build": "vue-cli-service build",
package/src/App.vue CHANGED
@@ -1,15 +1,18 @@
1
1
  <template>
2
2
  <div id="app">
3
3
  <ConversationContainer msg="Welcome to Your Vue.js App"/>
4
+ <load-more-mess></load-more-mess>
4
5
  </div>
5
6
  </template>
6
7
 
7
8
  <script>
8
9
  import ConversationContainer from './components/ConversationContainer.vue'
9
10
 
11
+ import LoadMoreMess from "./components/loadMoreMess";
10
12
  export default {
11
13
  name: 'App',
12
14
  components: {
15
+ LoadMoreMess,
13
16
  ConversationContainer
14
17
  }
15
18
  }
@@ -12,7 +12,7 @@
12
12
  :src="src"
13
13
  controls="controls"
14
14
  x5-video-player-type="h5-page"
15
- style="object-fit: contain;width: 240px;height: 160px;background-color: black;border-radius: 17px"
15
+ style="object-fit: contain;width: calc(100vw - 139px);height: 160px;background-color: black;border-radius: 17px;max-width: 230px;"
16
16
  class="video-player vjs-custom-skin"
17
17
  :id="msg.keyId"/>
18
18
  </div>
@@ -21,7 +21,7 @@
21
21
  <!-- LPY 原生宽度适配有bug,弃用 -->
22
22
  <img
23
23
  :src="msg.content.url"
24
- style="height: auto; width: auto;max-width: 240px;border-radius: 17px"
24
+ style="height: auto; width: calc(100vw - 137px);border-radius: 17px;max-width: 230px"
25
25
  @click="onImageClick(msg.content.url)"
26
26
  class="img-class"
27
27
  />
@@ -0,0 +1,199 @@
1
+ <template>
2
+ <div class="container" ref="container">
3
+ <div class="item">{{loadText+"第"+pageNum+"页"}}</div>
4
+ <div v-for="(item, index) in list" :key="index" class="item">{{item}}</div>
5
+ </div>
6
+ <!-- <div
7
+ class="container"
8
+ @touchstart="touchStart($event)"
9
+ @touchmove="touchMove($event)"
10
+ @touchend="touchEnd($event)"
11
+ :style="{transform: 'translate3d(0,' + top + 'px, 0)'}"
12
+ >
13
+ <p class="drop" v-if="dropDownState == 2">松开立即刷新</p>
14
+ <p class="drop" v-if="dropDownState == 3">正在刷新数据...</p>
15
+ <div class="histroy" id="list">
16
+ <li v-for="(item,index) in list" :key="index">第{{ item }}条数据</li>
17
+ </div>
18
+ </div>-->
19
+ </template>
20
+
21
+ <script>
22
+ export default {
23
+ name: "loadMoreMess",
24
+ data() {
25
+ return {
26
+ scrollHeight: 0,
27
+ list: [],
28
+ loadText: "加载中...",
29
+ pageSize: 20,
30
+ pageNum: 1,
31
+ index: 0,
32
+ defaultOffset: 50,
33
+ top: 0,
34
+ scrollIsToTop: 0,
35
+ startY: 0,
36
+ isDropDown: false,
37
+ isRefreshing: false,
38
+ dropDownState: 1
39
+ }
40
+ },
41
+ mounted() {
42
+ this.initData();
43
+ const container = this.$refs.container;
44
+ //这里的定时是为了列表首次渲染后获取scrollHeight并滑动到底部。
45
+ setTimeout(() => {
46
+ this.scrollHeight = container.scrollHeight;
47
+ container.scrollTo(0, this.scrollHeight);
48
+ }, 10);
49
+ container.addEventListener('scroll', (e) => {
50
+ //这里的2秒钟定时是为了避免滑动频繁,节流
51
+ setTimeout(() => {
52
+ if (this.list.length >= 90) {
53
+ this.loadText = "加载完成";
54
+ return;
55
+ }
56
+ //滑到顶部时触发下次数据加载
57
+ if (e.target.scrollTop == 0) {
58
+ //将scrollTop置为10以便下次滑到顶部
59
+ e.target.scrollTop = 10;
60
+ //加载数据
61
+ this.initData();
62
+ //这里的定时是为了在列表渲染之后才使用scrollTo。
63
+ setTimeout(() => {
64
+ e.target.scrollTo(0, this.scrollHeight - 30);//-30是为了露出最新加载的一行数据
65
+ }, 100);
66
+ }
67
+ }, 2000);
68
+ });
69
+ },
70
+ methods: {
71
+ //初始数据
72
+ initData() {
73
+ for (var i = 20; i > 0; i--) {
74
+ this.list.unshift(i)
75
+ }
76
+ this.pageNum++;
77
+ },
78
+ // 加载历史记录
79
+ getHistory() {
80
+
81
+ setTimeout(() => {
82
+ let result = new Array();
83
+ for (var i = 0; i < 10; i++) {
84
+ let value = this.index < 1 ? i : this.index + "" + i;
85
+ result.unshift(value);
86
+ }
87
+ this.list = result.concat(this.list);
88
+ this.isRefreshing = false;
89
+ this.isDropDown = false;
90
+ this.dropDownState = 1;
91
+ this.top = 0;
92
+ this.$nextTick(() => {
93
+ var container = this.$el.querySelector("#list");
94
+ container.scrollTop = container.scrollHeight - this.scrollHeight;
95
+ });
96
+ }, 1200);
97
+ },
98
+
99
+ // 开始
100
+ touchStart(e) {
101
+ this.startY = e.targetTouches[0].pageY;
102
+ var container = this.$el.querySelector("#list");
103
+ this.scrollHeight = container.scrollHeight;
104
+ },
105
+ // 滑动
106
+ touchMove(e) {
107
+ this.scrollIsToTop =
108
+ document.documentElement.scrollTop ||
109
+ window.pageYOffset ||
110
+ document.body.scrollTop;
111
+ var container = this.$el.querySelector("#list");
112
+ if (e.targetTouches[0].pageY > this.startY && container.scrollTop === 0) {
113
+ this.isDropDown = true;
114
+ if (this.scrollIsToTop === 0 && !this.isRefreshing) {
115
+ let diff =
116
+ e.targetTouches[0].pageY - this.startY - this.scrollIsToTop;
117
+ this.top =
118
+ Math.pow(diff, 0.8) +
119
+ (this.dropDownState === 3 ? this.defaultOffset : 0);
120
+ if (this.top >= this.defaultOffset) {
121
+ this.dropDownState = 2;
122
+ e.preventDefault();
123
+ } else {
124
+ this.dropDownState = 1;
125
+ e.preventDefault();
126
+ }
127
+ }
128
+ } else {
129
+ this.isDropDown = false;
130
+ this.dropDownState = 1;
131
+ }
132
+ },
133
+
134
+ // 触摸结束
135
+ touchEnd() {
136
+ if (this.isDropDown && !this.isRefreshing) {
137
+ if (this.top >= this.defaultOffset) {
138
+ this.refresh();
139
+ this.isRefreshing = true;
140
+ } else {
141
+ this.isRefreshing = false;
142
+ this.isDropDown = false;
143
+ this.dropDownState = 1;
144
+ this.top = 0;
145
+ }
146
+ }
147
+ },
148
+
149
+ // 刷新
150
+ refresh() {
151
+ this.dropDownState = 3;
152
+ this.top = this.defaultOffset;
153
+ this.index++;
154
+ this.getHistory();
155
+ }
156
+ }
157
+ }
158
+ </script>
159
+
160
+ <style scoped lang="less">
161
+ .container {
162
+ width: 300px;
163
+ height: 300px;
164
+ overflow: auto;
165
+ border: 1px solid;
166
+ margin: 100px auto;
167
+ }
168
+
169
+ .item {
170
+ height: 29px;
171
+ line-height: 30px;
172
+ text-align: center;
173
+ border-bottom: 1px solid #aaa;
174
+ }
175
+ .drop {
176
+ height: 5rem;
177
+ display: flex;
178
+ align-items: center;
179
+ justify-content: center;
180
+ }
181
+ /*.container {
182
+ height: 100%;
183
+ overflow: hidden;
184
+ }
185
+
186
+ .histroy {
187
+ padding: 0 1rem;
188
+ height: 100%;
189
+ overflow-y: auto;
190
+ }
191
+ .histroy li {
192
+ font-size: 1.4rem;
193
+ height: 10vh;
194
+ display: flex;
195
+ align-items: center;
196
+ justify-content: center;
197
+ border-bottom: 1px dashed #dddddd;
198
+ }*/
199
+ </style>
@@ -62,16 +62,6 @@
62
62
  /* this.increaseNumber(display, dec, 'dec');*/
63
63
  })
64
64
  },1000)
65
- /* const displays = document.querySelectorAll('.note-display');
66
- displays.forEach(display => {
67
- let note = parseFloat(display.dataset.note);
68
- let [int, dec] = display.dataset.note.split('.');
69
- [int, dec] = [Number(int), Number(dec)];
70
- this.strokeTransition(display, note);
71
- this.increaseNumber(display, this.dataNote, 'int');
72
- /!* this.increaseNumber(display, dec, 'dec');*!/
73
- })*/
74
-
75
65
  },
76
66
  watch:{
77
67
  dataNote:{
@@ -101,7 +91,6 @@
101
91
  #loading-process{
102
92
  height: 100px;
103
93
  width: 100px;
104
- position: relative;
105
94
  .bg-color{
106
95
  background-color:#000000 ;
107
96
  opacity: 0.4;
@@ -11,11 +11,11 @@
11
11
  <el-button plain size="small" @click="submitClick" :disabled="disableds" >{{submitValue}}</el-button>
12
12
  </div>
13
13
  <div v-if="isCompany">
14
- <div v-if="single === true" style="border-top: 1px dashed #ebebeb;display: flex;justify-content: space-between" class="editMessage">
14
+ <div v-if="single === true" class="editMessage">
15
15
  <el-input v-model="input" placeholder="请输入内容" class="inputClass" @input="testClick" @blur="inputBlur"></el-input>
16
16
  <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
17
17
  --> </div>
18
- <div v-if="date" style="border-top: 1px dashed #ebebeb;display: flex;justify-content: space-between" class="editMessage">
18
+ <div v-if="date" class="editMessage">
19
19
  <el-date-picker
20
20
  v-model="dateValue"
21
21
  type="date"
@@ -28,7 +28,7 @@
28
28
  </el-date-picker>
29
29
  <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
30
30
  --> </div>
31
- <div v-if="time" style="border-top: 1px dashed #ebebeb;display: flex;justify-content: space-between" class="editMessage">
31
+ <div v-if="time" class="editMessage">
32
32
  <el-time-picker
33
33
  v-model="timeValue"
34
34
  placeholder="任意时间点"
@@ -39,7 +39,7 @@
39
39
  </el-time-picker>
40
40
  <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
41
41
  --> </div>
42
- <div v-if="dateTime" style="border-top: 1px dashed #ebebeb;" class="editMessage">
42
+ <div v-if="dateTime" class="editMessage">
43
43
  <el-date-picker
44
44
  v-model="dateTimeValue"
45
45
  type="datetime"
@@ -91,7 +91,7 @@
91
91
  </div>-->
92
92
  </div>
93
93
  <div v-if="isPhone">
94
- <div v-if="single" style="border-top: 1px dashed #ebebeb;" class="editMessage">
94
+ <div v-if="single" class="editMessage">
95
95
  <el-input v-model="input" placeholder="请输入内容" class="inputClass" @input="testClick" @blur="inputBlur"></el-input>
96
96
  <!-- <span @click="quedingClick" style="display: flex;align-items: center"><i class="el-icon-success" style="color: #4C61E1;font-size: 32px;cursor: pointer"></i></span>
97
97
  --> </div>
@@ -845,6 +845,13 @@ export default {
845
845
  <style lang="less">
846
846
  @import "../../assets/less/common.css";
847
847
  #textMessage{
848
+ min-width: 200px;
849
+ .editMessage{
850
+ display: flex;
851
+ justify-content: space-between;
852
+ margin-top: 10px;
853
+ border-top: 1px dashed #ebebeb;
854
+ }
848
855
  #submit{
849
856
  margin-top: 10px;
850
857
  display: flex;
@@ -903,10 +910,7 @@ export default {
903
910
  }
904
911
  }
905
912
 
906
- .editMessage{
907
- display: flex;
908
- justify-content: space-between;
909
- }
913
+
910
914
  }
911
915
  .van-cell::after{
912
916
  content: none!important;