Browse Source

合并

master
vee 2 years ago
parent
commit
c107c79f75
  1. BIN
      .DS_Store
  2. 7
      components/kline/kline.vue
  3. 2
      components/kline/tradingView/chartConfig.js
  4. 1841
      components/kline/tradingView/contract.js
  5. 46
      components/kline/tradingView/datafeed2.js
  6. 106
      components/kline/tradingView/websocket2.js
  7. 7
      manifest.json
  8. 6
      pages.json
  9. 290
      pages/home/caringwomen.vue
  10. 4
      pages/subscription/details.vue
  11. BIN
      static/home/img_People.png
  12. 4
      utils/language/en_US.js
  13. 4
      utils/language/vi_VN.js
  14. 4
      utils/language/zh_TW.js

BIN
.DS_Store

Binary file not shown.

7
components/kline/kline.vue

@ -20,7 +20,7 @@
</view>
<view id="kline" :windowWidth="width" :change:windowWidth="KlineJs.setWidth" :windowHeight="height"
:change:windowHeight="KlineJs.setHeight" :symbol="symbol"
:change:symbol="KlineJs.setSymbol" :language="lang" :change:language="KlineJs.changlanguage" :index_activeCycle="index_activeCycle" :change:index_activeCycle="KlineJs.changindex_activeCycle"></view>
:change:symbol="KlineJs.setSymbol" :language="language" :change:language="KlineJs.changlanguage" :index_activeCycle="index_activeCycle" :change:index_activeCycle="KlineJs.changindex_activeCycle"></view>
</view>
</template>
@ -132,7 +132,7 @@
this.initChart(index_activeCycle)
},
changlanguage(language){
chartConfig.locale=language
this.language=language
}
,
initChart(index_activeCycle) {
@ -185,8 +185,6 @@
.tab {
display: flex;
background: #000000;
position: absolute;
width:100%;
.item {
height: 64rpx;
line-height: 64rpx;
@ -205,4 +203,3 @@
}
</style>

2
components/kline/tradingView/chartConfig.js

@ -39,7 +39,7 @@ var chartConfig = {
"header_resolutions",
"left_toolbar",
"header_screenshot",
"header_chart_type",
//"header_chart_type",
"header_settings",
"header_fullscreen_button",
"header_undo_redo",

1841
components/kline/tradingView/contract.js

File diff suppressed because it is too large

46
components/kline/tradingView/datafeed1.js → components/kline/tradingView/datafeed2.js

@ -15,7 +15,7 @@ import {
// 历史数据 第一条数据的 时间撮 因为k线图一次性历史数据只拿一部分,用户吧图往前滑动,就会用这个时间撮去请求更早的 历史数据
var detafeed_historyTime = 0
var detafeed_historyTime = null
// 上一次的 K线周期 切换产品的时候 需要从websock 取消订阅这个
var detafeed_lastResolution = null
// 上一次的产品 切换产品的时候 需要从websock 取消订阅这个
@ -46,9 +46,14 @@ FeedBase.prototype.resolveSymbol = function(symbolName, onResolve, onError) {
"type": "bitcoin",
"volume_precision": 10,
"has_intraday": true,
"intraday_multipliers": ['1', '5', '15', '30', '60', '240', '1440'], // 时间
"has_weekly_and_monthly": false,
"has_no_volume": false,
"seconds_multipliers":['1', '5', '15', '30', '60', '1D', '1W','1M'],
"intraday_multipliers": ['1', '5', '15', '30', '60', '1D', '1W','1M'],
"has_seconds":true,
"supports_marks": true,
"supports_timescale_marks": true,
"supported_time": true,
"has_weekly_and_monthly": true,
"has_no_volume": true,
"regular_session": "24x7",
})
@ -65,7 +70,7 @@ FeedBase.prototype.resolveSymbol = function(symbolName, onResolve, onError) {
const resolutionFormat = (resolution, name, to) => {
let req = `market.${name}.kline.${resolution}min`;
let minutes = resolution;
console.log(resolution)
if (resolution.includes('D')) {
if (resolution.length < 2) resolution = '1' + resolution;
req = `market.${name}.kline.${parseInt(resolution)}day`;
@ -86,11 +91,12 @@ const resolutionFormat = (resolution, name, to) => {
let from = null;
if (to) {
from = to - 50 * minutes * 60;
from = to - 50 * minutes * 500;
if (resolution.includes('M') || resolution.includes('W')) { // 周线月线控制条数,时间超出火币规定范围, ws报错
from = to - 50 * minutes * 60;
from = to - 50 * minutes * 500;
}
}
return {
minutes,
req,
@ -100,11 +106,13 @@ const resolutionFormat = (resolution, name, to) => {
};
FeedBase.prototype.getBars = function(symbolInfo, resolution, periodParams, onHistoryCallback, onErrorCallback) {
console.log("获取历史数据")
console.log("获取历史数据",periodParams)
// 切换产品周期 或者 切换产品 会执行这个函数
let reso = resolutionFormat(resolution, symbolInfo.name, periodParams.to > detafeed_historyTime ? periodParams
.to :
detafeed_historyTime)
let reso = resolutionFormat(resolution, symbolInfo.name, periodParams.to)
// if (resolution.includes('M') || resolution.includes('W')|| resolution.includes('D')) { // 周线月线控制条数,时间超出火币规定范围, ws报错
// reso = resolutionFormat(resolution, symbolInfo.name, periodParams.to)
// }
// 是历史数据
var history = true
/*
@ -128,15 +136,18 @@ FeedBase.prototype.getBars = function(symbolInfo, resolution, periodParams, onHi
第三个参数 是否是历史数据
*/
socket.sendData({
req: reso.req,
id: "id10",
from: reso.from,
to: reso.to,
event: "req",
type: "kline",
channel: [reso.req],
fromDate:reso.from,
toDate:reso.to
}, reso.req, history)
Event.off('data')
Event.on('data', data => {
if (data && Array.isArray(data)) {
// 记录这次请求的时间周期
detafeed_lastResolution = resolution
@ -152,12 +163,13 @@ FeedBase.prototype.getBars = function(symbolInfo, resolution, periodParams, onHi
datas.push(i)
}
} else {
console.log('进来')
meta = {
noData: true,
noData: 'no_data',
nextTime: detafeed_historyTime
}
}
onHistoryCallback(datas, meta)
onHistoryCallback(datas, {noData:data.length==0})
}
})
}

106
components/kline/tradingView/websocket1.js → components/kline/tradingView/websocket2.js

@ -1,45 +1,47 @@
import
constant
from '@/utils/constant.js'
import {
Event
} from './event.js'
import pakoJs from './pako.js'
var pako = pakoJs
var socket = {
socket: null, // socket name
id:null,
realTimeData: null, // 请求实时数据的参数
intervalObj: null, // 定时器的名字
lastRealTimeData: null, // 上一次请求的产品
sendData(historyData, realTimeDatas, history) {
// 储存历史数据
this.historyData = historyData
this.realTimeData = realTimeDatas
// 如果上一次订阅过产品
if (this.lastRealTimeData) {
// 如果不是订阅历史产品 那么肯定就是切换周期咯 或者 切换产品
// 那么就取消订阅上一次的产品实时数据
if (!history) {
console.log('取消订阅' + this.lastRealTimeData)
this.sendWsRequest({
"unsub": this.lastRealTimeData,
"id": "id1"
})
}
// 请求这一次的历史
this.historyData.id=this.id
this.sendWsRequest(this.historyData)
console.log(111111,realTimeDatas)
// 如果不是订阅历史产品 那么肯定就是切换周期咯 或者切换产品咯
// 那么就订阅一下 这次产品的或者周期的 实时数据
if (!history) {
console.log('订阅新的' + realTimeDatas)
//console.log('订阅新的' + realTimeDatas)
//console.log(111111,realTimeDatas)
this.sendWsRequest({
"sub": realTimeDatas,
"id": "id1"
event: 'un_sub',
type: 'kline',
id: this.id,
channel:[this.lastRealTimeData],
})
this.lastRealTimeData = this.realTimeData
}
} else {
// 如果是第一次订阅,就是说刚进入交易所,
// 先存起来这一次请求的产品 作为历史产品
this.lastRealTimeData = this.realTimeData
@ -48,13 +50,9 @@ var socket = {
}
},
initWs() {
this.socket = new WebSocket('wss://api.huobi.pro/ws')
this.socket = new WebSocket(constant.WSSURL)
this.socket.onopen = () => {
this.sendWsRequest(this.historyData)
this.sendWsRequest({
"sub": this.historyData.req,
"id": "id1"
})
}
this.socket.onmessage = resp => {
this.message(resp)
@ -67,46 +65,52 @@ var socket = {
}
},
error(err) {
console.log(err, 'depth-socket::error')
//console.log(err, 'depth-socket::error')
},
close() {
// 如果websocket关闭的话,就从新打开一下。
this.initWs()
console.log('depth-socket::close')
//console.log('depth-socket::close')
},
message(resp) {
//console.log(resp)
let this_ = this
let reader = new FileReader()
reader.onload = function(e) {
// 对数据进行解压
let msg = JSON.parse(pako.ungzip(reader.result, {
to: 'string'
}))
// console.log(msg)
// 如果是实时数据触发Event('realTime') 喂数据
if (msg.tick) {
Event.emit('realTime', msg.tick)
}
resp=JSON.parse(resp.data)
if (resp.channel === 'conn') {
this.id = resp.data
//响应服务器,避免断开连接
if (msg.ping) {
this_.socket.send(JSON.stringify({
pong: msg.ping
}));
this_.hasCheck = true
this.historyData.id=this.id
this.sendWsRequest(this.historyData)
}else {
if(resp.event === 'req'){
//Event.emit('data', resp.data)
if (resp.data && Array.isArray(resp.data)) {
Event.emit('data', resp.data)
}
this.sendWsRequest({
event: 'un_sub',
type: 'kline',
id: this.id,
channel:[this.lastRealTimeData],
})
this.sendWsRequest({
event: 'sub',
type: 'kline',
id: this.id,
channel:[this.lastRealTimeData],
})
}else{
Event.emit('realTime', resp.data)
this_.lastRealTimeData = this_.realTimeData
// 如果是历史数据触发Event('data') 绘制数据
if (msg.data && Array.isArray(msg.data)) {
console.log(msg.data)
Event.emit('data', msg.data)
}
}
// //将返回的数据解析为字符串格式
reader.readAsArrayBuffer(resp.data);
},
checkSendMessage(options) {
// 这里处理websocket 连接不上的问题
@ -122,7 +126,7 @@ var socket = {
}
if (i >= checkTimes) {
clearInterval(this.intervalObj)
console.log('send post_data_str timeout.')
//console.log('send post_data_str timeout.')
}
}, 500)
},
@ -135,13 +139,13 @@ var socket = {
this.socket.send(JSON.stringify(options))
break
case 2:
console.log('ws关闭状态')
//console.log('ws关闭状态')
break
case 3:
this.initWs()
break
default:
console.log('ws未知错误')
//console.log('ws未知错误')
}
}
}

7
manifest.json

@ -2,8 +2,8 @@
"name" : "Same home",
"appid" : "__UNI__C4028F6",
"description" : "",
"versionName" : "1.0.1",
"versionCode" : 101,
"versionName" : "1.0.4",
"versionCode" : 104,
"transformPx" : false,
/* 5+App */
"app-plus" : {
@ -16,6 +16,9 @@
"autoclose" : true,
"delay" : 0
},
"compatible" : {
"ignoreVersion" : true //trueHBuilderX1.9.0
},
/* */
"modules" : {
"VideoPlayer" : {}

6
pages.json

@ -10,6 +10,12 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/home/caringwomen",
"style": {
"navigationStyle": "custom"
}
},
//
{
"path": "pages/login/index",

290
pages/home/caringwomen.vue

@ -0,0 +1,290 @@
<template>
<view class="main">
<navigation>{{ content.title }}</navigation>
<!-- #ifdef APP-PLUS -->
<view class="body-app">
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="body">
<!-- #endif -->
<view class="content" v-html="content.content">
</view>
</view>
</view>
</template>
<script>
import UButton from '../../uview-ui/components/u-button/u-button.vue'
import api from '@/utils/api'
import md5 from 'js-md5'
export default {
name: "caringwomen",
data() {
return {
content:{}
};
},
computed: {
i18n() {
return this.$t("login");
},
},
onLoad() {
this.agreement()
},
watch: {
},
onShow() {},
methods: {
//
agreement() {
api.agreement({
type:'caringwomen'
}).then(res => {
this.content=res
})
},
},
}
</script>
<style lang="scss" scoped>
.content{
margin-top: 50rpx;
text-align: left;
padding-bottom: 60rpx;
// HTML+CSS
/* 这两个在技术上是一样的, 为了兼容了浏览器两个都加上 */
overflow-wrap: break-word;
word-wrap: break-word;
-ms-word-break: break-all;
/* 这个的使用在web-kit中有些危险,他可能会阶段所有东西 */
word-break: break-all;
/* Instead use this non-standard one: */
word-break: break-word;
/* 如果浏览器支持的话增加一个连接符(Blink不支持) */
-ms-hyphens: auto;
-moz-hyphens: auto;
-webkit-hyphens: auto;
hyphens: auto;
}
.main {
.body {
margin-top: 204rpx;
padding: 0 40rpx;
overflow: hidden;
.welcomeText {
margin-top: 48rpx;
font-size: 48rpx;
font-weight: 800;
text-align: center;
}
.signInText {
font-size: 32rpx;
text-align: center;
color: #A2A0A8;
}
.form {
font-size: 32rpx;
margin-top: 48rpx;
.input-item {
height: 112rpx;
line-height: 112rpx;
background: #211F32;
margin-bottom: 48rpx;
border-radius: 32rpx;
.icon {
margin: 0 24rpx;
}
/deep/.u-form-item__body {
padding: 0;
}
.input {
height: 112rpx;
}
}
.vCode {
.getVCodeBtn {
// position: absolute;
width: 154rpx;
height: 56rpx;
right: 28rpx;
// top: 14px;
border-radius: 8px;
line-height: 56rpx;
font-size: 24rpx;
color: #00E8A2 !important;
padding: 0;
}
}
}
.agree {
font-size: 28rpx;
.check {
display: inline-block;
vertical-align: top;
margin-right: 32rpx;
}
.text {
display: inline-block;
width: 542rpx;
}
span {
cursor: pointer;
color: #00E8A2;
padding: 0 10rpx;
}
}
.button {
margin-top: 64rpx;
height: 112rpx;
line-height: 112rpx;
border-radius: 32rpx;
font-size: 32rpx;
color: #15141F !important;
}
.signUp {
margin: 48rpx 0;
text-align: center;
font-size: 32rpx;
.navigator {
display: inline;
color: #00E8A2;
padding: 0 10rpx;
}
}
}
.body-app{
margin-top: 204rpx !important;
padding: 0 40rpx;
overflow: hidden;
.welcomeText {
margin-top: 48rpx;
font-size: 48rpx;
font-weight: 800;
text-align: center;
}
.signInText {
font-size: 32rpx;
text-align: center;
color: #A2A0A8;
}
.form {
font-size: 32rpx;
margin-top: 48rpx;
.input-item {
height: 112rpx;
line-height: 112rpx;
background: #211F32;
margin-bottom: 48rpx;
border-radius: 32rpx;
.icon {
margin: 0 24rpx;
}
/deep/.u-form-item__body {
padding: 0;
}
.input {
height: 112rpx;
}
}
.vCode {
.getVCodeBtn {
// position: absolute;
width: 154rpx;
height: 56rpx;
right: 28rpx;
// top: 14px;
border-radius: 8px;
line-height: 56rpx;
font-size: 24rpx;
color: #00E8A2 !important;
padding: 0;
}
}
}
.agree {
font-size: 28rpx;
.check {
display: inline-block;
vertical-align: top;
margin-right: 32rpx;
}
.text {
display: inline-block;
width: 542rpx;
}
span {
cursor: pointer;
color: #00E8A2;
padding: 0 10rpx;
}
}
.button {
margin-top: 64rpx;
height: 112rpx;
line-height: 112rpx;
border-radius: 32rpx;
font-size: 32rpx;
color: #15141F !important;
}
.signUp {
margin: 48rpx 0;
text-align: center;
font-size: 32rpx;
.navigator {
display: inline;
color: #00E8A2;
padding: 0 10rpx;
}
}
}
}
</style>

4
pages/subscription/details.vue

@ -54,8 +54,8 @@
<!-- ProjectDetails -->
<view class="contentTitle">
<view class="ProjectDetails">{{ i18n.ProjectDetails }}</view>
<view class="videoBtn" @click="playVideo(deinfo.sysCoinInfo.videoWebsite)">{{ i18n.Video }}</view>
<view class="whiteBook" @click="getContact('book')">{{ i18n.WhiteBook }}</view>
<view class="videoBtn" v-show="deinfo.sysCoinInfo.videoWebsite!=''" @click="playVideo(deinfo.sysCoinInfo.videoWebsite)">{{ i18n.Video }}</view>
<view class="whiteBook" v-show="deinfo.sysCoinInfo.whitePaperWebsite!=''" @click="getContact('book')">{{ i18n.WhiteBook }}</view>
</view>
<!-- 文字内容 -->

BIN
static/home/img_People.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 254 KiB

After

Width:  |  Height:  |  Size: 70 KiB

4
utils/language/en_US.js

@ -95,6 +95,10 @@ export default {
WarmTipsText: 'Are you sure to receive?',
Cancel: 'Cancel',
Confirm: 'Confirm',
CaringForWomen:'Caring for women, respecting feminism',
LoveFeminist:'——Love Feminist Fund',
LoveFeminist1:'Support Program',
checkTheDetails:'check the details',
},
// 合约页面相关

4
utils/language/vi_VN.js

@ -93,6 +93,10 @@ export default {
WarmTipsText: 'Bạn có chắc chắn nhận được nó?',
Cancel: 'Hủy bỏ',
Confirm: 'xác nhận',
CaringForWomen:'Quan tâm đến phụ nữ, tôn trọng quyền của phụ nữ',
LoveFeminist:'—Chương trình Hỗ trợ Quỹ',
LoveFeminist1:'Quyền lợi Phụ nữ Tình yêu',
checkTheDetails:'kiểm tra các chi tiết',
},
// 合约页面相关

4
utils/language/zh_TW.js

@ -95,6 +95,10 @@ export default {
WarmTipsText: '您確定領取嗎?',
Cancel: '取消',
Confirm: '確認',
CaringForWomen:'關愛女性,尊重女權',
LoveFeminist:'——愛心女權',
LoveFeminist1:'基金扶植計劃',
checkTheDetails:'查看詳情',
},
// 合约页面相关

Loading…
Cancel
Save