新增评论回复功能

This commit is contained in:
Searchstars
2024-08-06 19:57:01 +08:00
parent c6755d21ba
commit a1477a3260
47 changed files with 983 additions and 108 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
},
"scripts": {
"start": "aiot server --watch --open-nuttx --enable-custom-component true",
"build": "aiot build --enable-custom-component",
"build": "aiot build --enable-custom-component --enable-jsc --enable-protobuf",
"release": "aiot release",
"watch": "aiot watch --open-nuttx",
"lint": "eslint --format codeframe --fix --ext .ux,.js src/"
+3 -1
View File
@@ -14,6 +14,8 @@ module.exports = {
},
},
cli: {
"enable-custom-component": true
"enable-custom-component": true,
"enable-jsc": true,
"enable-protobuf": true
}
};
+55 -1
View File
@@ -1,5 +1,6 @@
import { fetch, storage, crypto } from './tsimports';
// wbi签名Tab
const mixinKeyEncTab = [
46, 47, 18, 2, 53, 8, 23, 32, 15, 50, 10, 31, 58, 3, 45, 35, 27, 43, 5, 49,
33, 9, 42, 19, 29, 28, 14, 39, 12, 38, 41, 13, 37, 48, 7, 16, 24, 55, 40,
@@ -15,6 +16,8 @@ const getMixinKey = (orig: string) =>
.join("")
.slice(0, 32);
// 会存储在storage内的AccountData
// 不如说是Cookies
interface AccountData {
sessData: string;
biliJct: string;
@@ -23,18 +26,28 @@ interface AccountData {
}
class BilibiliClient {
public version: string = "2.0"
// 版本号字符串,独立于manifest.json
public version: string = "2.1"
// 扫码登陆时存储的qrcodekey,一般没用,除非在进行扫码登陆
private qrCodeKey: string | null = null;
// B站Cookies
private sessData: string | null = null;
private biliJct: string | null = null;
private dedeUserID: string | null = null;
private sid: string | null = null;
// 账号数据存储(启动时加载)
// 注意:这不是AccountData,而是由B站下发的账号数据
private accountInfo: any | null = null;
// 风控Cookies,不存储,每次登录使用spi刷新(详见updateBUVID函数)
private buvid3: any | null = null;
private buvid4: any | null = null;
// 获取请求头
// 用于模拟正常模拟器环境,降低风控概率
private getHeaders(): { [key: string]: string } {
return {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/jxl,image/webp,image/png,image/svg+xml,*/*;q=0.8',
@@ -95,11 +108,13 @@ class BilibiliClient {
}
}
// 发送使用Wbi签名的GET请求
private async getRequestWbi(url: string, params: any): Promise<any> {
return (await this.getRequest(`${url}?${this.encWbi(params, this.accountInfo.wbi_img.img_url.slice(this.accountInfo.wbi_img.img_url.lastIndexOf('/') + 1, this.accountInfo.wbi_img.img_url.lastIndexOf('.')), this.accountInfo.wbi_img.sub_url.slice(this.accountInfo.wbi_img.sub_url.lastIndexOf('/') + 1, this.accountInfo.wbi_img.sub_url.lastIndexOf('.')))}`))
}
// 发送POST请求的函数
// 注意注意再注意,Content-Type一定要填对,否则会让你抓耳挠腮一晚上(迫真)
private async postRequest(url: string, data: string, content_type: string): Promise<any> {
var headers = this.getHeaders();
headers["Content-Type"] = content_type
@@ -119,6 +134,8 @@ class BilibiliClient {
}
}
// 检查澎湃哔哩是否存在更新
// 这里借用了Gitee
async checkHyperbilibiliUpdates(): Promise<any>{
const latestVerGet = await fetch.fetch({
url: "https://gitee.com/search__stars/hb_ota_info/raw/master/current_ver",
@@ -205,6 +222,7 @@ class BilibiliClient {
setCookieHeaders = setCookieHeaders.split(', ');
}
// 扫Set-Cookie头,拿B站Cookies
setCookieHeaders.forEach(cookie => {
if (cookie.includes('SESSDATA')) {
this.sessData = this.parseCookie(cookie, 'SESSDATA');
@@ -304,6 +322,42 @@ class BilibiliClient {
return response.data.data
}
// 点赞评论
async LikeReply(type: string, oid: string, rpid: string, action: number){
const url = "https://api.bilibili.com/x/v2/reply/action";
const body = `type=${type}&oid=${oid}&rpid=${rpid}&action=${action}&csrf=${this.biliJct}`;
const response = await this.postRequest(url, body, "application/x-www-form-urlencoded");
return response.data.code
}
// 发送评论(基于OID下,例如发送内容至视频评论区、回复动态等)
async GiveReply(type: string, oid: string, message: string){
const url = "https://api.bilibili.com/x/v2/reply/add";
const body = `type=${type}&oid=${oid}&message=${message}&plat=1&csrf=${this.biliJct}`;
const response = await this.postRequest(url, body, "application/x-www-form-urlencoded");
return response.data.code
}
// 回复发送的评论(基于内容下评论RPID,例如给视频评论区里的一条评论发评论,即回复那条评论,称为二级评论)
async GiveSecReply(type: string, oid: string, parent: string, message: string){
const url = "https://api.bilibili.com/x/v2/reply/add";
const body = `type=${type}&oid=${oid}&parent=${parent}&message=${message}&plat=1&csrf=${this.biliJct}`;
const response = await this.postRequest(url, body, "application/x-www-form-urlencoded");
return response.data.code
}
// 回复二级评论(基于内容下评论RPID+内容下评论回复RPID,例如给视频评论区里的一条评论的回复发回复,进入对话树)
async GiveTreeReply(type: string, oid: string, parent: string, root: string, message: string){
const url = "https://api.bilibili.com/x/v2/reply/add";
const body = `type=${type}&oid=${oid}&parent=${parent}&root=${root}&message=${message}&plat=1&csrf=${this.biliJct}`;
const response = await this.postRequest(url, body, "application/x-www-form-urlencoded");
return response.data.code
}
// 获取视频AI摘要
async getVideoAISummaryByBVID(bvid: string, cid: string, up_mid: string){
const url = "https://api.bilibili.com/x/web-interface/view/conclusion/get"
Binary file not shown.

After

Width:  |  Height:  |  Size: 369 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 643 B

@@ -0,0 +1,48 @@
<template>
<div class="pagechanger-container">
<div class="pagechanger">
<div @click="BackPN()" style="width: 40px; height: 40px; align-items: center; justify-content: center">
<image src="/common/changepage_left.png"></image>
</div>
<text style="margin-left: 17px; font-size: 25px; font-weight: 600; color: #9e9e9e">
第{{ current_pn }}页
</text>
<div style="
margin-left: 17px;
width: 40px;
height: 40px;
align-items: center;
justify-content: center;
" @click="NextPN()">
<image src="/common/changepage_right.png"></image>
</div>
</div>
</div>
</template>
<script>
export default {
props: ["current_pn"],
BackPN() {
this.$emit("backpn")
},
NextPN() {
this.$emit("nextpn")
}
}
</script>
<style>
.pagechanger-container {
bottom: 22px;
position: absolute;
background-color: rgba(0, 0, 0, 0.8);
border-radius: 20px;
padding: 5px 10px;
}
.pagechanger {
flex-direction: row;
align-items: center;
}
</style>
+616
View File
@@ -0,0 +1,616 @@
<template>
<div class="page" style="flex-direction: column;">
<div style="width: 480px;height: 321px;background-color:black" if="{{!this.hide}}">
<!-- 全键盘 -->
<div if="{{keyboardtype!='T9'}}" style="width: 480px;height: 321px;" >
<img src="./assets/full/back2.png" style="position: absolute;top:38px;left:7px;width:466px;height:52px;" @click="onBtnClick('switchCn')" if="{{numFlag && lang=='cn'}}" />
<img src="./assets/full/123.png" style="position: absolute;top:266px;left:119px;width:120px;height:48px;" @click="onBtnClick('switchNum')" if="{{downFlag=='' && !numFlag && lang=='cn'}}" />
<img src="./assets/full/bigA.png" style="position: absolute;top:266px;left:119px;width:120px;height:48px;" @click="onBtnClick('switchLow')" if="{{downFlag=='' && upperFlag && lang=='en'}}" />
<img src="./assets/full/A.png" style="position: absolute;top:266px;left:119px;width:120px;height:48px;" @click="onBtnClick('switchUpper')" if="{{downFlag=='' && !upperFlag && lang=='en'}}" />
<div style="position: absolute;top:38px;left:78px;width:324px;height:52px;background-color:rgb(38,38,38);border-radius: 12px;border: 3px solid rgba(255, 255, 255, 0.06);" if="{{downFlag==''&& !numFlag}}"></div>
<img if="{{resultList.length > 0}}" style="position: absolute;top:43px;left:355px;" src="./assets/full/down.png" @click="onBtnClick('down')"/>
<img src="./assets/full/{{lang}}.png" style="position: absolute;top:38px;left:7px;width:67px;height:52px;" @click="onBtnClick('lang')" if="{{downFlag=='' && !numFlag}}" />
<div class="more-info" style="position: absolute;top:-4px;left:78px;width:324px;" if="{{downFlag=='' && !numFlag}}">
<text if="{{cval}}" class="caltext" style="width:296px;">
{{cval}}_
</text>
</div>
<div class="more-info" style="position: absolute;top:38px;left:80px;width:277px" if="{{lang == 'cn'&& !numFlag}}">
<div class="item column center" for="{{cvalList}}">
<input show='{{resultList.length > $idx}}' class="calbtn0" type="button" value="{{resultList[$idx]}}" @click="onRsSelect(resultList[$idx])" />
</div>
</div>
<list class="list3" if="{{downFlag=='down'}}">
<list-item class="item3" for="{{itemArray in resultList2}}" type="listitem3">
<div class="item column center" style="height:52px;" for="{{item in itemArray}}">
<input class="calbtn0" type="button" value="{{item}}" @click="onRsSelect(item)" />
</div>
</list-item>
</list>
<div style="position: absolute;top:95px;left:8px;width:464px;height:52px;" if="{{downFlag==''&&!numFlag}}">
<img src="./assets/full/Q.png" style="width:54px;height:52px;margin-right: 4px;" @click="onSelect('Q')" />
<text class="calbtnfull" @click="onSelect('W')" >W</text>
<text class="calbtnfull" @click="onSelect('E')" >E</text>
<text class="calbtnfull" @click="onSelect('R')" >R</text>
<text class="calbtnfull" @click="onSelect('T')" >T</text>
<text class="calbtnfull" @click="onSelect('Y')" >Y</text>
<text class="calbtnfull" @click="onSelect('U')" >U</text>
<text class="calbtnfull" @click="onSelect('I')" >I</text>
<text class="calbtnfull" @click="onSelect('O')" >O</text>
<img src="./assets/full/P.png" style="width:54px;height:52px;" @click="onSelect('P')" />
</div>
<div style="position: absolute;top:152px;left:23px;width:438px;height:52px;" if="{{downFlag==''&&!numFlag}}">
<img src="./assets/full/btA.png" style="width:60px;height:52px;margin-right: 4px;" @click="onSelect('A')" />
<text class="calbtnfull" @click="onSelect('S')" >S</text>
<text class="calbtnfull" @click="onSelect('D')" >D</text>
<text class="calbtnfull" @click="onSelect('F')" >F</text>
<text class="calbtnfull" @click="onSelect('G')" >G</text>
<text class="calbtnfull" @click="onSelect('H')" >H</text>
<text class="calbtnfull" @click="onSelect('J')" >J</text>
<text class="calbtnfull" @click="onSelect('K')" >K</text>
<img src="./assets/full/L.png" style="width:60px;height:52px;" @click="onSelect('L')" />
</div>
<div style="position: absolute;top:209px;left:56px;width:368px;height:52px;" if="{{downFlag==''&&!numFlag}}">
<img src="./assets/full/Z.png" style="width:72px;height:52px;margin-right: 4px;" @click="onSelect('Z')" />
<text class="calbtnfull" @click="onSelect('X')" >X</text>
<text class="calbtnfull" @click="onSelect('C')" >C</text>
<text class="calbtnfull" @click="onSelect('V')" >V</text>
<text class="calbtnfull" @click="onSelect('B')" >B</text>
<text class="calbtnfull" @click="onSelect('N')" >N</text>
<img src="./assets/full/M.png" style="width:72px;height:52px;" @click="onSelect('M')" />
</div>
<div style="position: absolute;top:95px;left:8px;width:464px;height:52px;" if="{{numFlag}}">
<img src="./assets/full/1.png" style="width:54px;height:52px;margin-right: 4px;" @click="onSelect('1')" />
<text class="calbtnfull" @click="onSelect('2')" >2</text>
<text class="calbtnfull" @click="onSelect('3')" >3</text>
<text class="calbtnfull" @click="onSelect('4')" >4</text>
<text class="calbtnfull" @click="onSelect('5')" >5</text>
<text class="calbtnfull" @click="onSelect('6')" >6</text>
<text class="calbtnfull" @click="onSelect('7')" >7</text>
<text class="calbtnfull" @click="onSelect('8')" >8</text>
<text class="calbtnfull" @click="onSelect('9')" >9</text>
<img src="./assets/full/0.png" style="width:54px;height:52px;" @click="onSelect('0')" />
</div>
<div style="position: absolute;top:152px;left:23px;width:438px;height:52px;" if="{{numFlag}}">
<img src="./assets/full/2-1.png" style="width:60px;height:52px;margin-right: 4px;" @click="onSelect('~')" />
<text class="calbtnfull" @click="onSelect('!')" >!</text>
<text class="calbtnfull" @click="onSelect('@')" >@</text>
<text class="calbtnfull" @click="onSelect('#')" >#</text>
<text class="calbtnfull" @click="onSelect('%')" >%</text>
<text class="calbtnfull" @click="onSelect('“')" >“</text>
<text class="calbtnfull" @click="onSelect('”')" >”</text>
<text class="calbtnfull" @click="onSelect('*')" >*</text>
<img src="./assets/full/2-2.png" style="width:60px;height:52px;" @click="onSelect('?')" />
</div>
<div style="position: absolute;top:209px;left:56px;width:368px;height:52px;" if="{{numFlag}}">
<img src="./assets/full/3-1.png" style="width:72px;height:52px;margin-right: 4px;" @click="onSelect('(')" />
<text class="calbtnfull" @click="onSelect(')')" >)</text>
<text class="calbtnfull" @click="onSelect('-')" >-</text>
<text class="calbtnfull" @click="onSelect('_')" >_</text>
<text class="calbtnfull" @click="onSelect(':')" >:</text>
<text class="calbtnfull" @click="onSelect(';')" >;</text>
<img src="./assets/full/3-2.png" style="width:72px;height:52px;" @click="onSelect('、')" />
</div>
<img src="./assets/full/del.png" style="position: absolute;top:38px;left:406px;width:67px;height:52px;" @click="onBtnClick('D')" if="{{downFlag=='' && !numFlag }}" />
<img src="./assets/full/space.png" style="position: absolute;top:266px;left:242px;width:120px;height:48px;" @click="onBtnClick('space')" if="{{downFlag=='' && !numFlag }}" />
<img src="./assets/full/4-2.png" style="position: absolute;top:266px;left:242px;width:120px;height:48px;" @click="onSelect('。')" if="{{numFlag }}" />
<img src="./assets/full/4-1.png" style="position: absolute;top:266px;left:119px;width:120px;height:48px;" @click="onSelect('')" if="{{numFlag }}" />
<img style="position: absolute;top:204px;left:78px;" src="./assets/full/up.png" @click="onBtnClick('down')" if="{{downFlag=='down'}}"/>
</div>
<!-- 九键 -->
<div else style="width: 480px;height: 321px;" >
<img src="./assets/t9/back2.png" style="position: absolute;top:35px;left:31px;width: 60px;height: 60px;" @click="onBtnClick('switchCn')" if="{{numFlag && lang=='cn'}}" />
<img src="./assets/t9/123.png" style="position: absolute;top:99px;left:31px;width: 60px;height: 60px;" @click="onBtnClick('switchNum')" if="{{downFlag=='' && !numFlag && lang=='cn'}}" />
<img src="./assets/t9/bigA.png" style="position: absolute;top:99px;left:31px;width: 60px;height: 60px;" @click="onBtnClick('switchLow')" if="{{downFlag=='' && upperFlag && lang=='en'}}" />
<img src="./assets/t9/a.png" style="position: absolute;top:99px;left:31px;width: 60px;height: 60px;" @click="onBtnClick('switchUpper')" if="{{downFlag=='' && !upperFlag && lang=='en'}}" />
<div style="position: absolute;top:35px;left:95px;width:290px;height:60px;background-color:rgb(38,38,38);border-radius: 999px;border: 3px solid rgba(255, 255, 255, 0.06);" if="{{downFlag==''&& !numFlag}}"></div>
<img if="{{resultList.length > 0}}" style="position: absolute;top:44px;left:338px;" src="./assets/full/down.png" @click="onBtnClick('down')"/>
<img src="./assets/t9/{{lang}}.png" style="position: absolute;top:35px;left:31px;width: 60px;height: 60px;" @click="onBtnClick('lang')" if="{{downFlag=='' && !numFlag}}" />
<div style="position: absolute;top:-4px;left:95px;width:145px;height:40px;" if="{{downFlag=='' && !numFlag}}">
<text if="{{cval}}" class="caltext" style="width:145px;">
{{cval}}_
</text>
</div>
<div if="{{downFlag=='' && !numFlag}}" style="position: absolute;top:-4px;left:240px;width:145px;height:40px;justify-content:flex-end">
<text if='{{waitingList.length > 0}}' style="color:{{color0}};width:36px;height:40px;text-align: center;" @click="onSelectWaiting(0)" >{{waitingList[0]}}</text>
<text if='{{waitingList.length > 1}}' style="color:{{color1}};width:36px;height:40px;text-align: center;" @click="onSelectWaiting(1)" >{{waitingList[1]}}</text>
<text if='{{waitingList.length > 2}}' style="color:{{color2}};width:36px;height:40px;text-align: center;" @click="onSelectWaiting(2)" >{{waitingList[2]}}</text>
<text if='{{waitingList.length > 3}}' style="color:{{color3}};width:36px;height:40px;text-align: center;" @click="onSelectWaiting(3)" >{{waitingList[3]}}</text>
</div>
<div class="more-info" style="position: absolute;top:39px;left:105px;width:233px" if="{{lang == 'cn'&& !numFlag}}">
<div class="item column center" for="{{cvalList}}">
<input show='{{resultList.length > $idx}}' class="calbtn0" type="button" value="{{resultList[$idx]}}" @click="onRsSelect(resultList[$idx])" />
</div>
</div>
<list class="list3" if="{{downFlag=='down'}}">
<list-item class="item3" for="{{itemArray in resultList2}}" type="listitem3result2">
<div class="item column center" style="height:52px;" for="{{item in itemArray}}">
<input class="calbtn0" type="button" value="{{item}}" @click="onRsSelect(item)" />
</div>
</list-item>
</list>
<div style="position: absolute;top:99px;left:95px;width:294px;height:60px;" if="{{downFlag==''&&!numFlag}}">
<text class="calbtnt9" @click="onSelect('select')" >选择</text>
<text class="calbtnt9" @click="onSelect('abc')" >ABC</text>
<text class="calbtnt9" @click="onSelect('def')" >DEF</text>
</div>
<div style="position: absolute;top:163px;left:95px;width:294px;height:60px;" if="{{downFlag==''&&!numFlag}}">
<text class="calbtnt9" @click="onSelect('ghi')" >GHI</text>
<text class="calbtnt9" @click="onSelect('jkl')" >JKL</text>
<text class="calbtnt9" @click="onSelect('mno')" >MNO</text>
</div>
<div style="position: absolute;top:227px;left:95px;width:294px;height:60px;" if="{{downFlag==''&&!numFlag}}">
<text class="calbtnt9" @click="onSelect('pqrs')" >PQRS</text>
<text class="calbtnt9" @click="onSelect('tuv')" >TUV</text>
<text class="calbtnt9" @click="onSelect('wxyz')" >WXYZ</text>
</div>
<div style="position: absolute;top:35px;left:95px;width:294px;height:60px;" if="{{numFlag}}">
<text class="calbtnt9" @click="onSelect('7')" >7</text>
<text class="calbtnt9" @click="onSelect('8')" >8</text>
<text class="calbtnt9" @click="onSelect('9')" >9</text>
</div>
<div style="position: absolute;top:99px;left:95px;width:294px;height:60px;" if="{{numFlag}}">
<text class="calbtnt9" @click="onSelect('4')" >4</text>
<text class="calbtnt9" @click="onSelect('5')" >5</text>
<text class="calbtnt9" @click="onSelect('6')" >6</text>
</div>
<div style="position: absolute;top:163px;left:95px;width:294px;height:60px;" if="{{numFlag}}">
<text class="calbtnt9" @click="onSelect('1')" >1</text>
<text class="calbtnt9" @click="onSelect('2')" >2</text>
<text class="calbtnt9" @click="onSelect('3')" >3</text>
</div>
<div style="position: absolute;top:227px;left:95px;width:294px;height:60px;" if="{{numFlag}}">
<text class="calbtnt9" @click="onSelect('')" ></text>
<text class="calbtnt9" @click="onSelect('0')" >0</text>
<text class="calbtnt9" @click="onSelect('。')" >。</text>
</div>
<img src="./assets/t9/del.png" style="position: absolute;top:35px;left:389px;width: 60px;height: 60px;" @click="onBtnClick('D')" if="{{downFlag=='' }}" />
<img src="./assets/t9/space.png" style="position: absolute;top:99px;left:389px;width: 60px;height: 60px;" @click="onBtnClick('space')" if="{{downFlag=='' && !numFlag }}" />
<img style="position: absolute;top:204px;left:78px;" src="./assets/full/up.png" @click="onBtnClick('down')" if="{{downFlag=='down'}}"/>
</div>
</div>
</div>
</template>
<script>
import vibrator from "@system.vibrator";
import { SimpleInputMethod } from "./assets/dicUtil.js";
function doSearchDic(word, cb) {
var hanzi = SimpleInputMethod.getHanzi(word);
if (hanzi && hanzi[0]) {
cb(hanzi[0]);
} else {
cb([]);
}
}
function deleteLast(t) {
if (t) {
return t.substr(0, t.length - 1);
}
return "";
}
var blinkFlag = false;
export default {
props: ["hide", "keyboardtype", "maxlength", "vibratemode", "keyboardtype"],
data: {
allTxt: "",
allTxtShow: "",
cval: "",
eqflag: false,
resultList: [],
resultList2: [],
waitingList: [],
waitingIndex: -1,
lastWaitingStr: "",
downFlag: "",
hasDicFile: true,
debug: false,
lang: "cn",
wdTop: 216,
numFlag: false,
upperFlag: false,
gbIndex: 0,
color0: "white",
color1: "white",
color2: "white",
color3: "white",
abc: "test",
vibrate: "",
cvalList: [0, 1, 2, 3, 4],
},
onInit() {
if (this.maxlength) {
const tempCvalList = [];
for (let i = 0; i < this.maxlength; i++) {
tempCvalList.push(i);
}
this.cvalList = tempCvalList;
}
this.$watch("hide", "watchHidePropsChange");
this.$watch("maxlength", "watchMaxLengthPropsChange");
},
resetGbShow() {
var that = this;
if (that.allTxt) {
if (blinkFlag) {
that.allTxtShow =
that.allTxt.substr(0, that.gbIndex) +
"_" +
that.allTxt.substr(that.gbIndex + 1);
} else {
that.allTxtShow =
that.allTxt.substr(0, that.gbIndex) +
" " +
that.allTxt.substr(that.gbIndex + 1);
}
} else {
if (blinkFlag) {
that.allTxtShow = "_";
} else {
that.allTxtShow = " ";
}
}
blinkFlag = !blinkFlag;
},
addAllTxt(txt) {
this.$emit("complete", { content: txt });
},
deleteAllTxt() {
if (this.allTxt) {
if (this.gbIndex == 0) {
this.allTxt = this.allTxt.substr(0, 1);
} else {
this.allTxt =
this.allTxt.substr(0, this.gbIndex - 1) +
this.allTxt.substr(this.gbIndex);
this.gbIndex = this.gbIndex - 1;
}
}
},
onRsSelect(txt) {
this.onVibrate();
this.cval = "";
this.addAllTxt(txt);
this.clearWaiting();
this.resetReslutList();
this.downFlag = "";
},
onBtnClick(sign) {
this.onVibrate();
switch (sign) {
case "AC":
this.cval = "";
this.clearWaiting();
this.resetReslutList();
break;
case "lang":
if (this.lang == "cn") {
this.lang = "en";
this.wdTop = 257;
} else {
this.lang = "cn";
this.wdTop = 216;
}
this.cval = "";
this.clearWaiting();
this.resetReslutList();
break;
case "D":
if (this.waitingIndex >= 0) {
this.clearWaiting();
this.resetReslutList();
} else if (this.cval.length > 0) {
this.cval = deleteLast(this.cval);
this.resetReslutList();
} else {
this.$emit("delete", {});
}
break;
case "space":
this.addAllTxt(" ");
break;
case "down":
this.downFlag = this.downFlag == "down" ? "" : "down";
break;
case "select":
if (this.lastWaitingStr != sign && this.lastWaitingStr) {
if (this.lang == "cn") {
this.cval += this.waitingList[this.waitingIndex];
} else {
if (this.upperFlag) {
this.addAllTxt(this.waitingList[this.waitingIndex].toUpperCase());
} else {
this.addAllTxt(this.waitingList[this.waitingIndex].toLowerCase());
}
}
this.clearWaiting();
this.resetReslutList();
}
break;
case "switchNum":
this.numFlag = true;
this.cval = "";
this.clearWaiting();
this.resetReslutList();
break;
case "switchCn":
this.numFlag = false;
break;
case "switchUpper":
this.upperFlag = true;
break;
case "switchLow":
this.upperFlag = false;
break;
default:
if (sign.length == 1) {
this.addAllTxt(sign);
} else {
if (this.waitingIndex >= 0) {
if (this.lastWaitingStr == sign) {
this.waitingIndex++;
if (this.waitingIndex >= this.lastWaitingStr.length) {
this.waitingIndex = 0;
}
} else {
if (this.lang == "cn") {
this.cval += this.waitingList[this.waitingIndex];
} else {
if (this.upperFlag) {
this.addAllTxt(
this.waitingList[this.waitingIndex].toUpperCase(),
);
} else {
this.addAllTxt(
this.waitingList[this.waitingIndex].toLowerCase(),
);
}
}
this.lastWaitingStr = sign;
this.waitingIndex = 0;
this.waitingList = sign.split("");
}
} else {
this.lastWaitingStr = sign;
this.waitingIndex = 0;
this.waitingList = sign.split("");
}
this.resetReslutList();
}
break;
}
switch (this.waitingIndex) {
case 0:
this.color0 = "rgb(13,132,255)";
this.color1 = "white";
this.color2 = "white";
this.color3 = "white";
break;
case 1:
this.color0 = "white";
this.color1 = "rgb(13,132,255)";
this.color2 = "white";
this.color3 = "white";
break;
case 2:
this.color0 = "white";
this.color1 = "white";
this.color2 = "rgb(13,132,255)";
this.color3 = "white";
break;
default:
this.color0 = "white";
this.color1 = "white";
this.color2 = "white";
this.color3 = "rgb(13,132,255)";
break;
}
},
clearWaiting() {
this.waitingList = [];
this.waitingIndex = -1;
this.lastWaitingStr = "";
},
resetReslutList() {
var watingStr = "";
if (this.lastWaitingStr && this.lastWaitingStr[this.waitingIndex]) {
watingStr = this.lastWaitingStr[this.waitingIndex];
}
if (!(this.cval + watingStr) || this.lang != "cn") {
this.resultList = [];
this.setResultListAll();
return;
}
this.getResultByWord(this.cval + watingStr);
},
setResultListAll() {
this.resultList2 = [];
var array = [];
for (var i = 0; i < this.resultList.length; i++) {
array.push(this.resultList[i]);
if (array.length == 5) {
this.resultList2.push(array);
array = [];
}
}
if (array.length > 0 && array.length < 5) {
this.resultList2.push(array);
}
},
getResultByWord(val) {
var that = this;
doSearchDic(val, function (data) {
that.resultList = data;
that.setResultListAll();
});
},
onSelect(num) {
this.$emit("keyDown", { content: num });
if (this.keyboardtype == "T9") {
this.onBtnClick(num);
return;
}
this.onVibrate();
if (this.lang == "cn" && !this.numFlag) {
this.cval += num.toLowerCase();
} else if (this.lang == "en" && !this.numFlag) {
if (this.upperFlag) {
this.addAllTxt(num.toUpperCase());
} else {
this.addAllTxt(num.toLowerCase());
}
} else {
this.addAllTxt(num);
}
this.resetReslutList();
},
onSelectWaiting(num) {
this.onVibrate();
if (this.lang == "cn") {
this.cval += this.waitingList[num].toString();
} else {
if (this.upperFlag) {
this.addAllTxt(this.waitingList[num].toUpperCase());
} else {
this.addAllTxt(this.waitingList[num].toLowerCase());
}
}
this.clearWaiting();
this.resetReslutList();
},
watchHidePropsChange(newV, oldV) {
this.$emit("visibilityChange", { visible: !newV });
},
watchMaxLengthPropsChange(newV, oldV) {
if (newV) {
const tempCvalList = [];
for (let i = 0; i < newV; i++) {
tempCvalList.push(i);
}
this.cvalList = tempCvalList;
}
},
onVibrate() {
if (this.vibratemode != "") {
vibrator.vibrate({ mode: this.vibratemode });
}
},
};
</script>
<style>
.page {
width: 480px;
position: absolute;
left: 0;
bottom: 0
}
.more-info {
width: 324px
}
.item {
height: 52px;
flex: 1
}
.calbtn0 {
color: #fff;
font-size: 28px;
background-color: rgba(38,38,38,0);
border-radius: 0;
height: 52px;
width: 52px;
text-align: center
}
.calbtnfull {
color: #fff;
font-size: 24px;
font-weight: bold;
background-color: #262626;
border-radius: 12px;
margin-right: 4px;
height: 52px;
width: 40px;
text-align: center;
border: 3px solid rgba(255,255,255,.06)
}
.calbtnt9 {
color: #fff;
font-size: 25px;
font-weight: bold;
background-color: #262626;
border-radius: 999px;
margin-right: 4px;
width: 94px;
height: 60px;
text-align: center;
border: 3px solid rgba(255,255,255,.06)
}
.caltext {
text-align: left;
line-height: 38px;
lines: 1;
text-overflow: ellipsis;
color: #0d84ff;
height: 45px;
font-size: 28px;
text-align: left;
font-weight: bold;
padding-left: 8px
}
.list3 {
position: absolute;
top: 38px;
left: 78px;
width: 324px;
height: 160px;
flex-direction: column;
background-color: #262626;
border-radius: 12px
}
.item3 {
width: 324px;
height: 52px
}
</style>
File diff suppressed because one or more lines are too long
@@ -0,0 +1,72 @@
import { dict } from './dic.js'
var SimpleInputMethod = {
dict: {}
}
SimpleInputMethod.initDict = function(){
this.dict.py2hz = dict;
this.dict.py2hz2 = {};
this.dict.py2hz2['i'] = 'i'; // i比较特殊,没有符合的汉字,所以特殊处理
for(var i=97; i<=123; i++)
{
var ch = String.fromCharCode(i);
if(!this.dict.py2hz[ch])
{
for(var j in this.dict.py2hz)
{
if(j.indexOf(ch) == 0)
{
this.dict.py2hz2[ch] = this.dict.py2hz[j];
break;
}
}
}
}
}
SimpleInputMethod.getSingleHanzi = function(pinyin){
return this.dict.py2hz2[pinyin] || this.dict.py2hz[pinyin] || '';
}
SimpleInputMethod.getHanzi = function(pinyin){
var result = this.getSingleHanzi(pinyin);
if(result) return [result.split(''), pinyin];
var temp = '';
var start = pinyin.length;
if(start > 6){
start = 6
}
for(var i = start;i >= 1;i--){
var str = pinyin.substr(0, i);
var rs = this.getSingleHanzi(str);
if(rs) return [rs.split(''), str];
}
// for(var i=0, len = pinyin.length; i<len; i++)
// {
// temp += pinyin[i];
// result = this.getSingleHanzi(temp);
// if(!result) continue;
// // flag表示如果当前能匹配到结果、并且往后5个字母不能匹配结果,因为最长可能是5个字母,如 zhuang
// var flag = false;
// if((i+1) < pinyin.length)
// {
// for(var j=1, len = pinyin.length; j<=5 && (i+j)<len; j++)
// {
// if(this.getSingleHanzi(pinyin.substr(0, i+j+1)))
// {
// flag = true;
// break;
// }
// }
// }
// if(!flag) return [result.split(''), pinyin.substr(0, i+1) + "'" + pinyin.substr(i+1)];
// }
return [[], '']; // 理论上一般不会出现这种情况
}
SimpleInputMethod.initDict();
export { SimpleInputMethod }
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

+96
View File
@@ -0,0 +1,96 @@
<template>
<div class="reply">
<div class="userinfo" onclick="ShowTools({{reply}})">
<image class="userimg" src="{{reply.member.avatar}}@44w_44h" alt="/common/fullgray.png"></image>
<text class="username" style="margin-left: 10px">{{ reply.member.uname }}</text>
<image style="width: 24px; height: 14px; object-fit: contain; margin-left: 6px"
src="/common/bililevel/lv{{reply.member.level_info.current_level}}.png"></image>
</div>
<div class="replycontentdiv" onclick="ShowTools({{reply}})">
<text class="replycontent">{{ reply.content.message }}</text>
</div>
<div class="reply_replybtn" onclick="Reply({{reply.rpid}})">
<text class="reply_replytext">回复</text>
</div>
</div>
</template>
<script>
export default {
props: ["reply"],
ShowTools(reply){
this.$emit("showTools", {
reply: reply
})
},
Reply(rpid){
this.$emit("reply", {
rpid: rpid
})
}
}
</script>
<style>
.reply {
width: 319px;
height: 200px;
border-radius: 50px;
background-color: #262626;
flex-direction: column;
}
.userinfo {
flex-direction: row;
align-items: center;
margin-left: 25px;
margin-top: 17px;
}
.userimg {
width: 44px;
height: 44px;
border-radius: 50%;
}
.username {
font-size: 20px;
font-weight: 600;
max-width: 180px;
text-overflow: ellipsis;
}
.replycontentdiv {
width: 253px;
height: 82px;
max-height: 82px;
display: flex;
flex-direction: column;
margin-top: 7px;
margin-left: 33px;
justify-content: flex-start; /* 保证内容顶部对齐 */
}
.replycontent {
width: 100%;
font-size: 20px;
font-weight: 600;
text-overflow: ellipsis;
}
.reply_replybtn {
background-color: #343434;
width: 88px;
height: 34px;
border-radius: 10px;
align-items: center;
justify-content: center;
margin-top: 5px;
margin-left: 33px;
}
.reply_replytext {
font-size: 18px;
font-weight: 600;
}
</style>
+1 -1
View File
@@ -1,7 +1,7 @@
{
"package": "com.searchstars.hyperbilibili",
"name": "澎湃哔哩",
"versionName": "2.0.0",
"versionName": "2.1.0",
"versionCode": 2,
"minPlatformVersion": 1000,
"icon": "/common/logo.png",
+74 -102
View File
@@ -1,47 +1,36 @@
<import name="title-bar" src="../../components/TitleBar/TitleBar.ux"></import>
<import name="reply" src="../../components/Reply/Reply.ux"></import>
<import name="input-method" src="../../components/InputMethod/InputMethod.ux"></import>
<import
name="floating-page-changer"
src="../../components/FloatingPageChanger/FloatingPageChanger.ux"
></import>
<template>
<div class="page">
<title-bar title={{titletext}}></title-bar>
<title-bar title="{{titletext}}"></title-bar>
<image style="position: absolute; margin-top: 245px" if="{{show_loading}}" src="{{anims.loading_src.value}}"></image>
<list style="margin-top: 15px" class="replylist">
<list-item type="replies"
style="width: 100%; justify-content: center; margin-top: 10px; height: {{PlaceHolderShowCheck($item.rpid)}}"
for="{{replies}}">
<div class="reply">
<div class="userinfo">
<image class="userimg" src="{{$item.member.avatar}}@44w_44h" alt="/common/fullgray.png"></image>
<text class="username" style="margin-left: 10px">{{ $item.member.uname }}</text>
<image style="width: 24px; height: 14px; object-fit: contain; margin-left: 6px"
src="/common/bililevel/lv{{$item.member.level_info.current_level}}.png"></image>
</div>
<div class="replycontentdiv" onclick="ShowTools({{$item}})">
<text class="replycontent">{{ $item.content.message }}</text>
</div>
<div class="reply_replybtn" show="{{!secmode}}" @click="Reply()">
<text class="reply_replytext">回复</text>
</div>
</div>
<reply reply="{{$item}}" @show-tools="ShowTools" @reply="Reply"></reply>
</list-item>
</list>
<div class="pagechanger-container">
<div class="pagechanger">
<div @click="BackPN()" style="width: 40px; height: 40px; align-items: center; justify-content: center">
<image src="/common/changepage_left.png"></image>
<floating-page-changer current_pn="{{current_pn}}" @backpn="BackPN" @nextpn="NextPN"></floating-page-changer>
<div class="inputpanel" if="{{replymode}}">
<input-method @complete="InputComplete" @delete="InputDelete"></input-method>
<div class="inputactions">
<div style="margin-left: 35px">
<image class="inputaction_img" src="/common/textinput_back.png"></image>
</div>
<text style="margin-left: 17px; font-size: 25px; font-weight: 600; color: #9e9e9e">
第{{ current_pn }}页
</text>
<div style="
margin-left: 17px;
width: 40px;
height: 40px;
align-items: center;
justify-content: center;
" @click="NextPN()">
<image src="/common/changepage_right.png"></image>
<div style="margin-left: 75px" @click="SendReply">
<image class="inputaction_img" src="/common/textinput_finish.png"></image>
</div>
</div>
<div class="inputshow">
<text class="inputshow_text">{{input_text}}</text>
</div>
</div>
</div>
</template>
@@ -66,29 +55,53 @@ export default {
anims: {
loading: null,
loading_src: {value: "/common/seqanims/loadingWhite/icons8-loading_颜色反转-1.png"}
},
replymode: false,
reply_target: null,
input_text: ""
},
async SendReply(){
this.replymode = false
var result = await this.$app.$def.biliclient.GiveSecReply(this.type, this.oid, this.reply_target, this.input_text)
console.log(result)
if(result == 0){
prompt.showToast({
message: "发送成功"
})
}
else{
prompt.showToast({
message: "发送失败,错误代码:" + result.code + " 原因:" + result.message
})
}
},
Reply(){
prompt.showToast({
message: "该功能暂不可用"
})
InputComplete(evt){
this.input_text += evt.detail.content;
},
ShowTools(reply) {
InputDelete() {
this.input_text = this.input_text.slice(0, -1);
},
Reply(evt) {
this.replymode = true
this.input_text = ""
this.reply_target = evt.detail.rpid
},
ShowTools(evt) {
console.log(evt)
if (!this.secmode) {
router.push({
uri: "pages/replytools",
params: {
type: this.type,
oid: this.oid,
reply: reply
reply: evt.detail.reply
}
})
}
else{
} else {
router.push({
uri: "pages/textdetail",
params: {
text: reply.content.message
text: evt.detail.reply.content.message
}
})
}
@@ -145,7 +158,7 @@ export default {
true
)
if(this.secmode){
if (this.secmode) {
this.titletext = "子评论"
}
@@ -171,76 +184,35 @@ export default {
justify-content: center;
}
.reply {
width: 319px;
height: 200px;
border-radius: 50px;
background-color: #262626;
flex-direction: column;
}
.userinfo {
flex-direction: row;
align-items: center;
margin-left: 25px;
margin-top: 17px;
}
.userimg {
width: 44px;
height: 44px;
border-radius: 50%;
}
.username {
font-size: 20px;
font-weight: 600;
}
.replycontentdiv {
width: 253px;
height: 82px;
max-height: 82px;
display: flex;
flex-direction: column;
margin-top: 7px;
margin-left: 33px;
justify-content: flex-start; /* 保证内容顶部对齐 */
}
.replycontent {
width: 100%;
font-size: 20px;
font-weight: 600;
text-overflow: ellipsis;
}
.pagechanger-container {
bottom: 22px;
.inputpanel {
position: absolute;
background-color: rgba(0, 0, 0, 0.8);
border-radius: 20px;
padding: 5px 10px;
width: 100%;
height: 100%;
background-color: black;
justify-content: center;
}
.pagechanger {
.inputactions {
flex-direction: row;
align-items: center;
width: 50%;
position: absolute;
margin-top: 30px;
}
.reply_replybtn {
background-color: #343434;
width: 88px;
height: 34px;
border-radius: 10px;
align-items: center;
justify-content: center;
margin-top: 5px;
margin-left: 33px;
.inputaction_img {
width: 35px;
height: 35px;
object-fit: scale-down;
}
.reply_replytext {
font-size: 18px;
font-weight: 600;
.inputshow {
width: 65%;
position: absolute;
margin-top: 100px;
}
.inputshow_text {
font-size: 24px;
}
</style>
+5 -1
View File
@@ -34,11 +34,14 @@ export default {
oid: "",
reply: null
},
private: {
replymessage: ""
},
ShowDetail() {
router.push({
uri: "pages/textdetail",
params: {
text: this.reply.content.message
text: this.replymessage
}
})
},
@@ -56,6 +59,7 @@ export default {
},
onInit(){
this.reply = JSON.parse(this.reply)
this.replymessage = this.reply.content.message
}
}
</script>
+6 -1
View File
@@ -34,7 +34,7 @@
<text class="vidtooltext">视频总结</text>
</div>
</div>
<div class="featurebtn" style="margin-top: 20px">
<div class="featurebtn" style="margin-top: 20px" @click="GenerateVideoManifest()">
<text class="featurebtn_text">生成视频清单</text>
</div>
<image src="/common/featurebtn_replyarea.png" style="margin-top: 15px" @click="GoReplyArea()"></image>
@@ -58,6 +58,11 @@ export default {
coinsrc: "/common/vidtool_coin.png",
starsrc: "/common/vidtool_star.png"
},
GenerateVideoManifest(){
prompt.showToast({
message: "该功能暂未开放"
})
},
DisabledFeaturesWarning(){
prompt.showToast({
message: "由于B站风控,该功能暂不可用"