From 782b6846f9ddf81c45f08a39083f4913f342fa40 Mon Sep 17 00:00:00 2001 From: tangmingyou <234767776@qq.com> Date: Wed, 11 Jan 2023 17:52:25 +0800 Subject: [PATCH] protobufjs --- package.json | 1 + src/app.config.js | 3 + src/compiled.js | 1086 +++++++++++++++++++++++++++++++++++++ src/pages/login/login.jsx | 8 + yarn.lock | 78 ++- 5 files changed, 1175 insertions(+), 1 deletion(-) create mode 100644 src/compiled.js diff --git a/package.json b/package.json index 0e9bb8f..ccc9955 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@tarojs/shared": "3.5.11", "@tarojs/taro": "3.5.11", "@tarojs/taro-h5": "3.5.11", + "protobufjs": "^7.1.2", "react": "^18.0.0", "react-dom": "^18.0.0", "sr-sdk-h5": "^1.3.1" diff --git a/src/app.config.js b/src/app.config.js index d6b0f2f..9453080 100644 --- a/src/app.config.js +++ b/src/app.config.js @@ -2,6 +2,9 @@ export default { pages: [ 'pages/index/index', 'pages/login/login', + 'pages/lobby/lobby', + 'pages/new_table/new_table', + 'pages/table/table', ], window: { backgroundTextStyle: 'light', diff --git a/src/compiled.js b/src/compiled.js new file mode 100644 index 0000000..87baa58 --- /dev/null +++ b/src/compiled.js @@ -0,0 +1,1086 @@ +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +"use strict"; + +var $protobuf = require("protobufjs/minimal"); + +// Common aliases +var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + +// Exported root namespace +var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {}); + +$root.message = (function() { + + /** + * Namespace message. + * @exports message + * @namespace + */ + var message = {}; + + message.Proto = (function() { + + /** + * Properties of a Proto. + * @memberof message + * @interface IProto + * @property {number|null} [ver] Proto ver + * @property {number|null} [op] Proto op + * @property {number|null} [seq] Proto seq + * @property {Uint8Array|null} [body] Proto body + */ + + /** + * Constructs a new Proto. + * @memberof message + * @classdesc Represents a Proto. + * @implements IProto + * @constructor + * @param {message.IProto=} [properties] Properties to set + */ + function Proto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Proto ver. + * @member {number} ver + * @memberof message.Proto + * @instance + */ + Proto.prototype.ver = 0; + + /** + * Proto op. + * @member {number} op + * @memberof message.Proto + * @instance + */ + Proto.prototype.op = 0; + + /** + * Proto seq. + * @member {number} seq + * @memberof message.Proto + * @instance + */ + Proto.prototype.seq = 0; + + /** + * Proto body. + * @member {Uint8Array} body + * @memberof message.Proto + * @instance + */ + Proto.prototype.body = $util.newBuffer([]); + + /** + * Creates a new Proto instance using the specified properties. + * @function create + * @memberof message.Proto + * @static + * @param {message.IProto=} [properties] Properties to set + * @returns {message.Proto} Proto instance + */ + Proto.create = function create(properties) { + return new Proto(properties); + }; + + /** + * Encodes the specified Proto message. Does not implicitly {@link message.Proto.verify|verify} messages. + * @function encode + * @memberof message.Proto + * @static + * @param {message.IProto} message Proto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ver != null && Object.hasOwnProperty.call(message, "ver")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ver); + if (message.op != null && Object.hasOwnProperty.call(message, "op")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.op); + if (message.seq != null && Object.hasOwnProperty.call(message, "seq")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.seq); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 4, wireType 2 =*/34).bytes(message.body); + return writer; + }; + + /** + * Encodes the specified Proto message, length delimited. Does not implicitly {@link message.Proto.verify|verify} messages. + * @function encodeDelimited + * @memberof message.Proto + * @static + * @param {message.IProto} message Proto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Proto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Proto message from the specified reader or buffer. + * @function decode + * @memberof message.Proto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {message.Proto} Proto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proto.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.message.Proto(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.ver = reader.int32(); + break; + } + case 2: { + message.op = reader.int32(); + break; + } + case 3: { + message.seq = reader.int32(); + break; + } + case 4: { + message.body = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Proto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof message.Proto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {message.Proto} Proto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Proto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Proto message. + * @function verify + * @memberof message.Proto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Proto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ver != null && message.hasOwnProperty("ver")) + if (!$util.isInteger(message.ver)) + return "ver: integer expected"; + if (message.op != null && message.hasOwnProperty("op")) + if (!$util.isInteger(message.op)) + return "op: integer expected"; + if (message.seq != null && message.hasOwnProperty("seq")) + if (!$util.isInteger(message.seq)) + return "seq: integer expected"; + if (message.body != null && message.hasOwnProperty("body")) + if (!(message.body && typeof message.body.length === "number" || $util.isString(message.body))) + return "body: buffer expected"; + return null; + }; + + /** + * Creates a Proto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof message.Proto + * @static + * @param {Object.} object Plain object + * @returns {message.Proto} Proto + */ + Proto.fromObject = function fromObject(object) { + if (object instanceof $root.message.Proto) + return object; + var message = new $root.message.Proto(); + if (object.ver != null) + message.ver = object.ver | 0; + if (object.op != null) + message.op = object.op | 0; + if (object.seq != null) + message.seq = object.seq | 0; + if (object.body != null) + if (typeof object.body === "string") + $util.base64.decode(object.body, message.body = $util.newBuffer($util.base64.length(object.body)), 0); + else if (object.body.length >= 0) + message.body = object.body; + return message; + }; + + /** + * Creates a plain object from a Proto message. Also converts values to other types if specified. + * @function toObject + * @memberof message.Proto + * @static + * @param {message.Proto} message Proto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Proto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.ver = 0; + object.op = 0; + object.seq = 0; + if (options.bytes === String) + object.body = ""; + else { + object.body = []; + if (options.bytes !== Array) + object.body = $util.newBuffer(object.body); + } + } + if (message.ver != null && message.hasOwnProperty("ver")) + object.ver = message.ver; + if (message.op != null && message.hasOwnProperty("op")) + object.op = message.op; + if (message.seq != null && message.hasOwnProperty("seq")) + object.seq = message.seq; + if (message.body != null && message.hasOwnProperty("body")) + object.body = options.bytes === String ? $util.base64.encode(message.body, 0, message.body.length) : options.bytes === Array ? Array.prototype.slice.call(message.body) : message.body; + return object; + }; + + /** + * Converts this Proto to JSON. + * @function toJSON + * @memberof message.Proto + * @instance + * @returns {Object.} JSON object + */ + Proto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Proto + * @function getTypeUrl + * @memberof message.Proto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Proto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/message.Proto"; + }; + + return Proto; + })(); + + message.Ping = (function() { + + /** + * Properties of a Ping. + * @memberof message + * @interface IPing + */ + + /** + * Constructs a new Ping. + * @memberof message + * @classdesc Represents a Ping. + * @implements IPing + * @constructor + * @param {message.IPing=} [properties] Properties to set + */ + function Ping(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Ping instance using the specified properties. + * @function create + * @memberof message.Ping + * @static + * @param {message.IPing=} [properties] Properties to set + * @returns {message.Ping} Ping instance + */ + Ping.create = function create(properties) { + return new Ping(properties); + }; + + /** + * Encodes the specified Ping message. Does not implicitly {@link message.Ping.verify|verify} messages. + * @function encode + * @memberof message.Ping + * @static + * @param {message.IPing} message Ping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Ping.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Ping message, length delimited. Does not implicitly {@link message.Ping.verify|verify} messages. + * @function encodeDelimited + * @memberof message.Ping + * @static + * @param {message.IPing} message Ping message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Ping.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Ping message from the specified reader or buffer. + * @function decode + * @memberof message.Ping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {message.Ping} Ping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Ping.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.message.Ping(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Ping message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof message.Ping + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {message.Ping} Ping + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Ping.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Ping message. + * @function verify + * @memberof message.Ping + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Ping.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a Ping message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof message.Ping + * @static + * @param {Object.} object Plain object + * @returns {message.Ping} Ping + */ + Ping.fromObject = function fromObject(object) { + if (object instanceof $root.message.Ping) + return object; + return new $root.message.Ping(); + }; + + /** + * Creates a plain object from a Ping message. Also converts values to other types if specified. + * @function toObject + * @memberof message.Ping + * @static + * @param {message.Ping} message Ping + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Ping.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Ping to JSON. + * @function toJSON + * @memberof message.Ping + * @instance + * @returns {Object.} JSON object + */ + Ping.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Ping + * @function getTypeUrl + * @memberof message.Ping + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Ping.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/message.Ping"; + }; + + return Ping; + })(); + + message.Pong = (function() { + + /** + * Properties of a Pong. + * @memberof message + * @interface IPong + */ + + /** + * Constructs a new Pong. + * @memberof message + * @classdesc Represents a Pong. + * @implements IPong + * @constructor + * @param {message.IPong=} [properties] Properties to set + */ + function Pong(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Pong instance using the specified properties. + * @function create + * @memberof message.Pong + * @static + * @param {message.IPong=} [properties] Properties to set + * @returns {message.Pong} Pong instance + */ + Pong.create = function create(properties) { + return new Pong(properties); + }; + + /** + * Encodes the specified Pong message. Does not implicitly {@link message.Pong.verify|verify} messages. + * @function encode + * @memberof message.Pong + * @static + * @param {message.IPong} message Pong message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pong.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Pong message, length delimited. Does not implicitly {@link message.Pong.verify|verify} messages. + * @function encodeDelimited + * @memberof message.Pong + * @static + * @param {message.IPong} message Pong message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Pong.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Pong message from the specified reader or buffer. + * @function decode + * @memberof message.Pong + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {message.Pong} Pong + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pong.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.message.Pong(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Pong message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof message.Pong + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {message.Pong} Pong + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Pong.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Pong message. + * @function verify + * @memberof message.Pong + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Pong.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a Pong message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof message.Pong + * @static + * @param {Object.} object Plain object + * @returns {message.Pong} Pong + */ + Pong.fromObject = function fromObject(object) { + if (object instanceof $root.message.Pong) + return object; + return new $root.message.Pong(); + }; + + /** + * Creates a plain object from a Pong message. Also converts values to other types if specified. + * @function toObject + * @memberof message.Pong + * @static + * @param {message.Pong} message Pong + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Pong.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Pong to JSON. + * @function toJSON + * @memberof message.Pong + * @instance + * @returns {Object.} JSON object + */ + Pong.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Pong + * @function getTypeUrl + * @memberof message.Pong + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Pong.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/message.Pong"; + }; + + return Pong; + })(); + + message.ReqIdentity = (function() { + + /** + * Properties of a ReqIdentity. + * @memberof message + * @interface IReqIdentity + * @property {string|null} [token] ReqIdentity token + */ + + /** + * Constructs a new ReqIdentity. + * @memberof message + * @classdesc Represents a ReqIdentity. + * @implements IReqIdentity + * @constructor + * @param {message.IReqIdentity=} [properties] Properties to set + */ + function ReqIdentity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReqIdentity token. + * @member {string} token + * @memberof message.ReqIdentity + * @instance + */ + ReqIdentity.prototype.token = ""; + + /** + * Creates a new ReqIdentity instance using the specified properties. + * @function create + * @memberof message.ReqIdentity + * @static + * @param {message.IReqIdentity=} [properties] Properties to set + * @returns {message.ReqIdentity} ReqIdentity instance + */ + ReqIdentity.create = function create(properties) { + return new ReqIdentity(properties); + }; + + /** + * Encodes the specified ReqIdentity message. Does not implicitly {@link message.ReqIdentity.verify|verify} messages. + * @function encode + * @memberof message.ReqIdentity + * @static + * @param {message.IReqIdentity} message ReqIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReqIdentity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.token != null && Object.hasOwnProperty.call(message, "token")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.token); + return writer; + }; + + /** + * Encodes the specified ReqIdentity message, length delimited. Does not implicitly {@link message.ReqIdentity.verify|verify} messages. + * @function encodeDelimited + * @memberof message.ReqIdentity + * @static + * @param {message.IReqIdentity} message ReqIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReqIdentity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReqIdentity message from the specified reader or buffer. + * @function decode + * @memberof message.ReqIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {message.ReqIdentity} ReqIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReqIdentity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.message.ReqIdentity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.token = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReqIdentity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof message.ReqIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {message.ReqIdentity} ReqIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReqIdentity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReqIdentity message. + * @function verify + * @memberof message.ReqIdentity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReqIdentity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.token != null && message.hasOwnProperty("token")) + if (!$util.isString(message.token)) + return "token: string expected"; + return null; + }; + + /** + * Creates a ReqIdentity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof message.ReqIdentity + * @static + * @param {Object.} object Plain object + * @returns {message.ReqIdentity} ReqIdentity + */ + ReqIdentity.fromObject = function fromObject(object) { + if (object instanceof $root.message.ReqIdentity) + return object; + var message = new $root.message.ReqIdentity(); + if (object.token != null) + message.token = String(object.token); + return message; + }; + + /** + * Creates a plain object from a ReqIdentity message. Also converts values to other types if specified. + * @function toObject + * @memberof message.ReqIdentity + * @static + * @param {message.ReqIdentity} message ReqIdentity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReqIdentity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.token = ""; + if (message.token != null && message.hasOwnProperty("token")) + object.token = message.token; + return object; + }; + + /** + * Converts this ReqIdentity to JSON. + * @function toJSON + * @memberof message.ReqIdentity + * @instance + * @returns {Object.} JSON object + */ + ReqIdentity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReqIdentity + * @function getTypeUrl + * @memberof message.ReqIdentity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReqIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/message.ReqIdentity"; + }; + + return ReqIdentity; + })(); + + message.ResIdentity = (function() { + + /** + * Properties of a ResIdentity. + * @memberof message + * @interface IResIdentity + * @property {number|null} [status] ResIdentity status + * @property {string|null} [msg] ResIdentity msg + */ + + /** + * Constructs a new ResIdentity. + * @memberof message + * @classdesc Represents a ResIdentity. + * @implements IResIdentity + * @constructor + * @param {message.IResIdentity=} [properties] Properties to set + */ + function ResIdentity(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResIdentity status. + * @member {number} status + * @memberof message.ResIdentity + * @instance + */ + ResIdentity.prototype.status = 0; + + /** + * ResIdentity msg. + * @member {string} msg + * @memberof message.ResIdentity + * @instance + */ + ResIdentity.prototype.msg = ""; + + /** + * Creates a new ResIdentity instance using the specified properties. + * @function create + * @memberof message.ResIdentity + * @static + * @param {message.IResIdentity=} [properties] Properties to set + * @returns {message.ResIdentity} ResIdentity instance + */ + ResIdentity.create = function create(properties) { + return new ResIdentity(properties); + }; + + /** + * Encodes the specified ResIdentity message. Does not implicitly {@link message.ResIdentity.verify|verify} messages. + * @function encode + * @memberof message.ResIdentity + * @static + * @param {message.IResIdentity} message ResIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResIdentity.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.status); + if (message.msg != null && Object.hasOwnProperty.call(message, "msg")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.msg); + return writer; + }; + + /** + * Encodes the specified ResIdentity message, length delimited. Does not implicitly {@link message.ResIdentity.verify|verify} messages. + * @function encodeDelimited + * @memberof message.ResIdentity + * @static + * @param {message.IResIdentity} message ResIdentity message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResIdentity.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResIdentity message from the specified reader or buffer. + * @function decode + * @memberof message.ResIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {message.ResIdentity} ResIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResIdentity.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.message.ResIdentity(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.status = reader.int32(); + break; + } + case 2: { + message.msg = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResIdentity message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof message.ResIdentity + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {message.ResIdentity} ResIdentity + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResIdentity.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResIdentity message. + * @function verify + * @memberof message.ResIdentity + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResIdentity.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.status != null && message.hasOwnProperty("status")) + if (!$util.isInteger(message.status)) + return "status: integer expected"; + if (message.msg != null && message.hasOwnProperty("msg")) + if (!$util.isString(message.msg)) + return "msg: string expected"; + return null; + }; + + /** + * Creates a ResIdentity message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof message.ResIdentity + * @static + * @param {Object.} object Plain object + * @returns {message.ResIdentity} ResIdentity + */ + ResIdentity.fromObject = function fromObject(object) { + if (object instanceof $root.message.ResIdentity) + return object; + var message = new $root.message.ResIdentity(); + if (object.status != null) + message.status = object.status | 0; + if (object.msg != null) + message.msg = String(object.msg); + return message; + }; + + /** + * Creates a plain object from a ResIdentity message. Also converts values to other types if specified. + * @function toObject + * @memberof message.ResIdentity + * @static + * @param {message.ResIdentity} message ResIdentity + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResIdentity.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.status = 0; + object.msg = ""; + } + if (message.status != null && message.hasOwnProperty("status")) + object.status = message.status; + if (message.msg != null && message.hasOwnProperty("msg")) + object.msg = message.msg; + return object; + }; + + /** + * Converts this ResIdentity to JSON. + * @function toJSON + * @memberof message.ResIdentity + * @instance + * @returns {Object.} JSON object + */ + ResIdentity.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResIdentity + * @function getTypeUrl + * @memberof message.ResIdentity + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResIdentity.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/message.ResIdentity"; + }; + + return ResIdentity; + })(); + + return message; +})(); + +module.exports = $root; diff --git a/src/pages/login/login.jsx b/src/pages/login/login.jsx index 6ea4100..cdbf21e 100644 --- a/src/pages/login/login.jsx +++ b/src/pages/login/login.jsx @@ -2,6 +2,7 @@ import React, { Component, useState } from 'react' import {View, Text} from '@tarojs/components' import { Progress } from '@nutui/nutui-react-taro'; import { Form, Input, TextArea, Cell, Button, Row, Col, Image } from '@nutui/nutui-react-taro'; +import { message } from '../../compiled' import './login.scss' @@ -9,6 +10,13 @@ import './login.scss' 登录 -> 大厅 -> 新桌面 -> 进桌面 -> profile(弹窗) */ function Login(props, ref) { + // protobuf + // let msg = message.Proto.create({ver:1, seq:1, op: 1}); + // let buffer = message.Proto.encode(msg).finish(); + // console.log(buffer) + // let decoded = message.Proto.decode(buffer); + // console.log(decoded) + // console.log(message) const [state, setState] = useState({ username: '', diff --git a/yarn.lock b/yarn.lock index a3c5122..3f8f2d4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1349,6 +1349,59 @@ schema-utils "^3.0.0" source-map "^0.7.3" +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.npmmirror.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.npmmirror.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.npmmirror.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.npmmirror.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.npmmirror.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.npmmirror.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.npmmirror.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.npmmirror.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.npmmirror.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.npmmirror.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + "@react-spring/animated@~9.6.1": version "9.6.1" resolved "https://registry.npmmirror.com/@react-spring/animated/-/animated-9.6.1.tgz#ccc626d847cbe346f5f8815d0928183c647eb425" @@ -2054,7 +2107,7 @@ resolved "https://registry.npmmirror.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/node@*": +"@types/node@*", "@types/node@>=13.7.0": version "18.11.18" resolved "https://registry.npmmirror.com/@types/node/-/node-18.11.18.tgz#8dfb97f0da23c2293e554c5a50d61ef134d7697f" integrity sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA== @@ -8268,6 +8321,11 @@ loglevel@^1.6.6: resolved "https://registry.npmmirror.com/loglevel/-/loglevel-1.8.1.tgz#5c621f83d5b48c54ae93b6156353f555963377b4" integrity sha512-tCRIJM51SHjAayKwC+QAg8hT8vg6z7GSgLJKGvzuPb1Wc+hLzqtuVLxp6/HzSPOozuK+8ErAhy7U/sVzw8Dgfg== +long@^5.0.0: + version "5.2.1" + resolved "https://registry.npmmirror.com/long/-/long-5.2.1.tgz#e27595d0083d103d2fa2c20c7699f8e0c92b897f" + integrity sha512-GKSNGeNAtw8IryjjkhZxuKB3JzlcLTwjtiQCHKvqQet81I93kXslhDQruGI/QsddO83mcDToBVy7GqGS/zYf/A== + longest-streak@^2.0.1: version "2.0.4" resolved "https://registry.npmmirror.com/longest-streak/-/longest-streak-2.0.4.tgz#b8599957da5b5dab64dee3fe316fa774597d90e4" @@ -10198,6 +10256,24 @@ proto-list@~1.2.1: resolved "https://registry.npmmirror.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" integrity sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA== +protobufjs@^7.1.2: + version "7.1.2" + resolved "https://registry.npmmirror.com/protobufjs/-/protobufjs-7.1.2.tgz#a0cf6aeaf82f5625bffcf5a38b7cd2a7de05890c" + integrity sha512-4ZPTPkXCdel3+L81yw3dG6+Kq3umdWKh7Dc7GW/CpNk4SX3hK58iPCWeCyhVTDrbkNeKrYNZ7EojM5WDaEWTLQ== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/node" ">=13.7.0" + long "^5.0.0" + proxy-addr@~2.0.7: version "2.0.7" resolved "https://registry.npmmirror.com/proxy-addr/-/proxy-addr-2.0.7.tgz#f19fe69ceab311eeb94b42e70e8c2070f9ba1025"