htc 1 тиждень тому
батько
коміт
39271893c8

+ 21 - 0
node_modules/event-source-polyfill/LICENSE

@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2012 vic99999@yandex.ru
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 21 - 0
node_modules/event-source-polyfill/LICENSE.md

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Viktor
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 277 - 0
node_modules/event-source-polyfill/README.md

@@ -0,0 +1,277 @@
+EventSource polyfill - https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events
+========================================================
+
+Пожалуйста не используйте эту обосранную библиотеку!
+
+Installing:
+-----------
+
+You can get the code from npm or bower:
+
+```
+npm install event-source-polyfill
+```
+
+```
+bower install event-source-polyfill
+```
+
+Just include `src/eventsource.js` or `src/eventsource.min.js` in your page to use the polyfill.
+
+
+Ionic2/Angular2 Installation:
+-----------------------------
+
+Unless a typescript definition file is created for this polyfill, this is how you would use it in an Ionic2 project.  It should (in theory) be very similar in an Angular2 project.
+
+```
+npm install event-source-polyfill
+```
+
+Add to (or create) src/app/polyfills.ts (path is relative to where polyfills.ts is) :
+```
+import 'path/to/event-source-polyfill/src/eventsource.min.js'
+```
+
+Add anywhere you need access to EventSourcePolyfill class : 
+
+```
+declare var EventSourcePolyfill: any;
+```
+
+Usage with webpack/browserify:
+------------------------------
+
+```javascript
+import { NativeEventSource, EventSourcePolyfill } from 'event-source-polyfill';
+
+const EventSource = NativeEventSource || EventSourcePolyfill;
+// OR: may also need to set as global property
+global.EventSource =  NativeEventSource || EventSourcePolyfill;
+```
+
+Browser support:
+----------------
+
+* IE 10+, Firefox 3.5+, Chrome 3+, Safari 4+, Opera 12+
+* IE 8 - IE 9: XDomainRequest is used internally, which has some limitations (2KB padding in the beginning is required, no way to send cookies, no way to use client certificates)
+* It works on Mobile Safari, Opera Mobile, Chrome for Android, Firefox for Android
+* It does not work on: Android Browser(requires 4 KB padding after every chunk), Opera Mini
+
+Advantages:
+-----------
+
+* Simple server-side code
+* Cross-domain requests support
+
+Server-side requirements:
+-------------------------
+
+* "Last-Event-ID" is sent in a query string (CORS + "Last-Event-ID" header is not supported by all browsers)
+* It is required to send 2 KB padding for IE < 10 and Chrome < 13 at the top of the response stream (the polyfill sends `padding=true` query argument)
+* You need to send "comment" messages each 15-30 seconds, these messages will be used as heartbeat to detect disconnects - see https://bugzilla.mozilla.org/show_bug.cgi?id=444328
+
+Specification:
+--------------
+
+* http://www.w3.org/TR/eventsource/
+
+Build:
+------
+
+* To build EventSource, just install npm modules (`npm install`) and then run the build (`npm run build`). It should generate a new version of `src/eventsource.min.js`.
+
+Notes:
+-----
+ * If you are using HTTP Basic Authentication, you can embed credentials into the URL - `http://username:password@github.com`.
+
+Custom Headers:
+---------------
+```
+var es = new EventSourcePolyfill('/events', {
+  headers: {
+    'X-Custom-Header': 'value'
+  }
+});
+```
+
+Custom query parameter name for the last event id:
+---------------
+ * Some server require a special query parameter name for last-event-id, you can change that via option
+ * The default is `lastEventId`
+ * Example for mercure-hub (https://mercure.rocks/)
+  
+```
+var es = new EventSourcePolyfill(hubUrl, {
+  lastEventIdQueryParameterName: 'Last-Event-Id'
+});
+```
+
+Other EventSource polyfills:
+----------------------------
+
+* https://github.com/remy/polyfills/blob/master/EventSource.js by Remy Sharp
+* https://github.com/rwldrn/jquery.eventsource by Rick Waldron
+* https://github.com/amvtek/EventSource by AmvTek
+
+EXAMPLE
+-------
+
+
+
+server-side (node.js)
+---------------------
+
+```javascript
+var PORT = 8081;
+
+var http = require("http");
+var fs = require("fs");
+var url = require("url");
+
+http.createServer(function (request, response) {
+  var parsedURL = url.parse(request.url, true);
+  var pathname = parsedURL.pathname;
+  if (pathname === "/events.php") {
+
+    response.writeHead(200, {
+      "Content-Type": "text/event-stream",
+      "Cache-Control": "no-store",
+      "Access-Control-Allow-Origin": "*"
+    });
+
+    var padding = new Array(2049);
+    response.write(":" + padding.join(" ") + "\n"); // 2kB padding for IE
+    response.write("retry: 2000\n");
+
+    var lastEventId = Number(request.headers["last-event-id"]) || Number(parsedURL.query.lastEventId) || 0;
+
+    var timeoutId = 0;
+    var i = lastEventId;
+    var c = i + 100;
+    var f = function () {
+      if (++i < c) {
+        response.write("id: " + i + "\n");
+        response.write("data: " + i + "\n\n");
+        timeoutId = setTimeout(f, 1000);
+      } else {
+        response.end();
+      }
+    };
+
+    f();
+
+    response.on("close", function () {
+      clearTimeout(timeoutId);
+    });
+
+  } else {
+    if (pathname === "/") {
+      pathname = "/index.html";
+    }
+    if (pathname === "/index.html" || pathname === "../src/eventsource.js") {
+      response.writeHead(200, {
+        "Content-Type": pathname === "/index.html" ? "text/html" : "text/javascript"
+      });
+      response.write(fs.readFileSync(__dirname + pathname));
+    }
+    response.end();
+  }
+}).listen(PORT);
+```
+
+or use PHP (see php/events.php)
+-------------------------------
+```php
+<?php
+
+  header("Content-Type: text/event-stream");
+  header("Cache-Control: no-store");
+  header("Access-Control-Allow-Origin: *");
+
+  $lastEventId = floatval(isset($_SERVER["HTTP_LAST_EVENT_ID"]) ? $_SERVER["HTTP_LAST_EVENT_ID"] : 0);
+  if ($lastEventId == 0) {
+    $lastEventId = floatval(isset($_GET["lastEventId"]) ? $_GET["lastEventId"] : 0);
+  }
+
+  echo ":" . str_repeat(" ", 2048) . "\n"; // 2 kB padding for IE
+  echo "retry: 2000\n";
+
+  // event-stream
+  $i = $lastEventId;
+  $c = $i + 100;
+  while (++$i < $c) {
+    echo "id: " . $i . "\n";
+    echo "data: " . $i . ";\n\n";
+    ob_flush();
+    flush();
+    sleep(1);
+  }
+
+?>
+```
+
+index.html (php/index.html):
+----------------------------
+```html
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8" />
+    <title>EventSource example</title>
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <script src="../src/eventsource.js"></script>
+    <script>
+      var es = new EventSource("events.php");
+      var listener = function (event) {
+        var div = document.createElement("div");
+        var type = event.type;
+        div.appendChild(document.createTextNode(type + ": " + (type === "message" ? event.data : es.url)));
+        document.body.appendChild(div);
+      };
+      es.addEventListener("open", listener);
+      es.addEventListener("message", listener);
+      es.addEventListener("error", listener);
+    </script>
+</head>
+<body>
+</body>
+</html>
+```
+
+Usage in node.js:
+=================
+With some dynamic imports it may work in node.js:
+
+Install the library and the dependency:
+`npm install @titelmedia/node-fetch`
+`npm install event-source-polyfill`
+
+x.js:
+```javascript
+// The @titelmedia/node-fetch is used instead of node-fetch as it supports ReadableStream Web API
+import('@titelmedia/node-fetch').then(function (fetch) {
+  globalThis.fetch = fetch.default;
+  globalThis.Response = fetch.default.Response;
+  import('event-source-polyfill').then(function (x) {
+    var es = new x.default.EventSourcePolyfill('http://localhost:8004/events');
+    es.onerror = es.onopen = es.onmessage = function (event) {
+      console.log(event.type + ': ' + event.data);
+    };
+  });
+});
+```
+
+`node --experimental-modules ./x.js`
+
+License
+-------
+The MIT License (MIT)
+
+Copyright (c) 2012 vic99999@yandex.ru
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 34 - 0
node_modules/event-source-polyfill/package.json

@@ -0,0 +1,34 @@
+{
+  "name": "event-source-polyfill",
+  "version": "1.0.31",
+  "description": "A polyfill for http://www.w3.org/TR/eventsource/ ",
+  "main": "src/eventsource.js",
+  "scripts": {
+    "build": "grunt"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/Yaffle/EventSource.git"
+  },
+  "keywords": [
+    "sse",
+    "server sent events",
+    "eventsource",
+    "event-source",
+    "polyfill"
+  ],
+  "files": [
+    "src/*"
+  ],
+  "author": "Yaffle (https://github.com/Yaffle)",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/Yaffle/EventSource/issues"
+  },
+  "homepage": "https://github.com/Yaffle/EventSource",
+  "devDependencies": {
+    "grunt": "^1.4.1",
+    "grunt-cli": "^1.4.3",
+    "grunt-contrib-uglify": "^5.0.1"
+  }
+}

Різницю між файлами не показано, бо вона завелика
+ 1048 - 0
node_modules/event-source-polyfill/src/eventsource.js


Різницю між файлами не показано, бо вона завелика
+ 6 - 0
node_modules/event-source-polyfill/src/eventsource.min.js


+ 30 - 30
pages.json

@@ -1,35 +1,35 @@
 {
 	"pages": [
-		{
-			"path": "pages/login",
-			"style": {
-				"navigationStyle": "custom"
-			}
-		},
-		{
-			"path": "pages/dialog",
-			"style": {
-				"navigationStyle": "custom"
-			}
-		},
-		{
-			"path": "pages/questionnaire",
-			"style": {
-				"navigationStyle": "custom"
-			}
-		},
-		{
-			"path": "pages/questionnaireFill",
-			"style": {
-				"navigationStyle": "custom"
-			}
-		},
-		{
-			"path": "pages/questionnaireResult",
-			"style": {
-				"navigationStyle": "custom"
-			}
-		},
+		// {
+		// 	"path": "pages/login",
+		// 	"style": {
+		// 		"navigationStyle": "custom"
+		// 	}
+		// },
+		// {
+		// 	"path": "pages/dialog",
+		// 	"style": {
+		// 		"navigationStyle": "custom"
+		// 	}
+		// },
+		// {
+		// 	"path": "pages/questionnaire",
+		// 	"style": {
+		// 		"navigationStyle": "custom"
+		// 	}
+		// },
+		// {
+		// 	"path": "pages/questionnaireFill",
+		// 	"style": {
+		// 		"navigationStyle": "custom"
+		// 	}
+		// },
+		// {
+		// 	"path": "pages/questionnaireResult",
+		// 	"style": {
+		// 		"navigationStyle": "custom"
+		// 	}
+		// },
 		{
 			"path": "pages/my",
 			"style": {

+ 4 - 5
pages/dialog.vue

@@ -6,7 +6,7 @@
 				<image src="@/static/new_dialog.png" style="width: 42rpx;height: 42rpx;margin-left: 40rpx;" @tap="startNewDialog"></image>
 			</view>
 		</u-navbar>
-		<div class="dialogs">
+		<div class="dialogs container" ref="myContainer">
 			<div class="d_answer init">
 				<div class="da_top adfac">
 					<image src="@/static/logo.png"></image>
@@ -34,7 +34,7 @@
 								<image :src="item.comment?require('@/static/comment_active.png'):require('@/static/comment.png')" @tap="toComment(item,index)"></image>
 							</div>
 							<div class="db_r">
-								<image :src="item.share?require('@/static/share.png'):require('@/static/share.png')" @tap="toShare(item,index)"></image>
+								<image :src="item.share?require('@/static/share_active.png'):require('@/static/share.png')" @tap="toShare(item,index)"></image>
 							</div>
 						</div>
 					</div>
@@ -45,7 +45,7 @@
 			<div class="a_l">
 				<input type="text" v-model="question" placeholder="请输入您的问题" @confirm="sendQuestion">
 			</div>
-			<div class="a_r" @tap="sendQuestion"></div>
+			<image class="a_r" src="@/static/send.png" @tap="sendQuestion"></image>
 		</div>
 		<u-modal :show="commentShow" title="评论" @confirm="commentConfirm" @cancel="commentCancel" @close="commentCancel" :showCancelButton="true">
 			<u-textarea v-model="content" placeholder="对于我们的回答您是否不满意,您有更好的答案建议吗?"></u-textarea>
@@ -159,7 +159,7 @@
 				this.commentShow = true;
 			},
 			toShare(item,index){
-				
+				this.$set(this.dialogList[index],'share',!this.dialogList[index].share);
 			},
 			commentConfirm(){
 				this.$set(this.dialogList[this.cindex],'comment',this.content);
@@ -317,7 +317,6 @@
 			.a_r{
 				width: 72rpx;
 				height: 72rpx;
-				background: #833478;
 				border-radius: 36rpx;
 			}
 		}

+ 155 - 4
pages/my.vue

@@ -1,6 +1,43 @@
 <template>
-	<view class="tabPage" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
-		
+	<view class="page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
+		<cus-header title='我的' bgColor="transparent" :showback="false"></cus-header>
+		<div class="info adffcacjc">
+			<div class="i_avatar"></div>
+			<div class="i_name">{{'龙傲天'}}</div>
+			<div class="i_phone">手机号:{{'18888888888'}}</div>
+		</div>
+		<div class="box">
+			<div class="tabs adf">
+				<div class="pre" :class="{'active':tidx===1}" @tap="changeTab(1)">收藏</div>
+				<div class="pre" :class="{'active':tidx===2}" @tap="changeTab(2)">评论</div>
+			</div>
+			<div class="list" :style="{'height':'calc(100vh - '+(356+mt)+'px)'}">
+				<block v-if="tidx===1">
+					<u-list @scrolltolower="stCollect">
+						<u-list-item v-for="(item, index) in collectList" :key="index">
+							<div class="l_item adfacjb">
+								<div class="li_l">
+									<div class="title">{{'撰写企业管理方案'}}</div>
+									<div class="intro">{{'帮我写一篇关于企业管理的方案'}}</div>
+									<div class="date">{{'4/25'}}</div>
+								</div>
+								<div class="li_r"></div>
+							</div>
+						</u-list-item>
+					</u-list>
+				</block>
+				<block v-else-if="tidx===2">
+					<div class="l_item" v-for="(item,index) in commentList" :key="index">
+						
+					</div>
+					<u-list @scrolltolower="stComment">
+						<u-list-item v-for="(item, index) in commentList" :key="index">
+							
+						</u-list-item>
+					</u-list>
+				</block>
+			</div>
+		</div>
 		<Tabbar :tabbarIndex="2"></Tabbar>
 	</view>
 </template>
@@ -11,15 +48,129 @@
 		components:{ Tabbar },
 		data(){
 			return {
-				
+				tidx:1,
+				collectList:[1],
+				commentList:[1]
 			}
 		},
 		methods:{
-			
+			changeTab(index){
+				this.tidx = index;
+			}
 		}
 	}
 </script>
 
 <style scoped lang="less">
+	.page{
+		box-sizing: border-box;
+		background: linear-gradient( 270deg, #EEEFF8 0%, #F6ECF4 100%, #F6ECF4 100%);
+		.info{
+			width: 100%;
+			height: 410rpx;
+			box-sizing: border-box;
+			padding-bottom: 64rpx;
+			.i_avatar{
+				width: 188rpx;
+				height: 188rpx;
+				border-radius: 50%;
+				background: #FFFFFF;
+				margin-top: 30rpx;
+			}
+			.i_name{
+				font-family: PingFang-SC, PingFang-SC;
+				font-weight: bold;
+				font-size: 40rpx;
+				color: #252525;
+				line-height: 40rpx;
+				margin-top: 40rpx;
+			}
+			.i_phone{
+				font-family: PingFangSC, PingFang SC;
+				font-weight: 400;
+				font-size: 28rpx;
+				color: #6B7280;
+				line-height: 28rpx;
+				margin-top: 20rpx;
+			}
+		}
 	
+		.box{
+			width: 100%;
+			border-radius: 32rpx 32rpx 0 0;
+			background: #FFFFFF;
+			.tabs{
+				padding: 38rpx calc((100% - 500rpx) / 2) 40rpx;
+				border-bottom: 1rpx solid #E5E7EB;
+				.pre{
+					width: 250rpx;
+					font-family: PingFang-SC, PingFang-SC;
+					font-weight: bold;
+					font-size: 32rpx;
+					color: #252525;
+					line-height: 32rpx;
+					text-align: center;
+					position: relative;
+					&.active{
+						color: #761E6A;
+						&::after{
+							content:'';
+							width: 120rpx;
+							height: 4rpx;
+							background: #833478;
+							border-radius: 2rpx;
+							position: absolute;
+							left: 50%;
+							margin-left: -60rpx;
+							bottom: -40rpx;
+						}
+					}
+				}
+			}
+		
+			.list{
+				overflow-y: auto;
+				.l_item{
+					padding: 30rpx 36rpx;
+					border-bottom: 1rpx solid #E5E7EB;
+					.li_l{
+						width: calc(100% - 186rpx);
+						.title{
+							font-family: PingFang-SC, PingFang-SC;
+							font-weight: bold;
+							font-size: 32rpx;
+							color: #252525;
+							line-height: 32rpx;
+							overflow: hidden;
+							white-space: nowrap;
+							text-overflow: ellipsis;
+						}
+						.intro{
+							font-family: PingFangSC, PingFang SC;
+							font-weight: 400;
+							font-size: 28rpx;
+							color: #252525;
+							line-height: 32rpx;
+							margin-top: 20rpx;
+							overflow: hidden;
+							white-space: nowrap;
+							text-overflow: ellipsis;
+						}
+						.date{
+							font-family: PingFangSC, PingFang SC;
+							font-weight: 400;
+							font-size: 26rpx;
+							color: #999999;
+							line-height: 32rpx;
+							margin-top: 28rpx;
+						}
+					}
+					.li_r{
+						width: 166rpx;
+						height: 166rpx;
+					}
+				}
+			}
+		}
+	}
 </style>

BIN
static/down_more.png


BIN
static/send.png


BIN
static/share_active.png