Browse Source

新桌面消息

master
tangmingyou 3 years ago
parent
commit
e5ec9cecf9
  1. 4
      config/dev.js
  2. 203
      src/api/proto.js
  3. 13
      src/pages/lobby/lobby.jsx
  4. 8
      src/pages/login/login.jsx
  5. 6
      src/pages/new_table/new_table.jsx

4
config/dev.js

@ -10,8 +10,8 @@ module.exports = {
h5: { h5: {
devServer: { devServer: {
//host: '0.0.0.0', //host: '0.0.0.0',
// host: '192.168.110.53', host: '192.168.110.53',
host: '192.168.3.102', // host: '192.168.3.102',
port: 10086, port: 10086,
// 设置代理来解决 H5 请求的跨域问题 // 设置代理来解决 H5 请求的跨域问题
proxy: { proxy: {

203
src/api/proto.js

@ -2135,6 +2135,209 @@ export const api = $root.api = (() => {
return ResLobbyView; return ResLobbyView;
})(); })();
api.ResLobbyFresh = (function() {
/**
* Properties of a ResLobbyFresh.
* @memberof api
* @interface IResLobbyFresh
* @property {number|null} [tableNo] ResLobbyFresh tableNo
*/
/**
* Constructs a new ResLobbyFresh.
* @memberof api
* @classdesc Represents a ResLobbyFresh.
* @implements IResLobbyFresh
* @constructor
* @param {api.IResLobbyFresh=} [properties] Properties to set
*/
function ResLobbyFresh(properties) {
if (properties)
for (let keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ResLobbyFresh tableNo.
* @member {number} tableNo
* @memberof api.ResLobbyFresh
* @instance
*/
ResLobbyFresh.prototype.tableNo = 0;
/**
* Creates a new ResLobbyFresh instance using the specified properties.
* @function create
* @memberof api.ResLobbyFresh
* @static
* @param {api.IResLobbyFresh=} [properties] Properties to set
* @returns {api.ResLobbyFresh} ResLobbyFresh instance
*/
ResLobbyFresh.create = function create(properties) {
return new ResLobbyFresh(properties);
};
/**
* Encodes the specified ResLobbyFresh message. Does not implicitly {@link api.ResLobbyFresh.verify|verify} messages.
* @function encode
* @memberof api.ResLobbyFresh
* @static
* @param {api.IResLobbyFresh} message ResLobbyFresh message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ResLobbyFresh.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.tableNo != null && Object.hasOwnProperty.call(message, "tableNo"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.tableNo);
return writer;
};
/**
* Encodes the specified ResLobbyFresh message, length delimited. Does not implicitly {@link api.ResLobbyFresh.verify|verify} messages.
* @function encodeDelimited
* @memberof api.ResLobbyFresh
* @static
* @param {api.IResLobbyFresh} message ResLobbyFresh message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
ResLobbyFresh.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a ResLobbyFresh message from the specified reader or buffer.
* @function decode
* @memberof api.ResLobbyFresh
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {api.ResLobbyFresh} ResLobbyFresh
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ResLobbyFresh.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
let end = length === undefined ? reader.len : reader.pos + length, message = new $root.api.ResLobbyFresh();
while (reader.pos < end) {
let tag = reader.uint32();
switch (tag >>> 3) {
case 1: {
message.tableNo = reader.int32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a ResLobbyFresh message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof api.ResLobbyFresh
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {api.ResLobbyFresh} ResLobbyFresh
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
ResLobbyFresh.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a ResLobbyFresh message.
* @function verify
* @memberof api.ResLobbyFresh
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
ResLobbyFresh.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.tableNo != null && message.hasOwnProperty("tableNo"))
if (!$util.isInteger(message.tableNo))
return "tableNo: integer expected";
return null;
};
/**
* Creates a ResLobbyFresh message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof api.ResLobbyFresh
* @static
* @param {Object.<string,*>} object Plain object
* @returns {api.ResLobbyFresh} ResLobbyFresh
*/
ResLobbyFresh.fromObject = function fromObject(object) {
if (object instanceof $root.api.ResLobbyFresh)
return object;
let message = new $root.api.ResLobbyFresh();
if (object.tableNo != null)
message.tableNo = object.tableNo | 0;
return message;
};
/**
* Creates a plain object from a ResLobbyFresh message. Also converts values to other types if specified.
* @function toObject
* @memberof api.ResLobbyFresh
* @static
* @param {api.ResLobbyFresh} message ResLobbyFresh
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
ResLobbyFresh.toObject = function toObject(message, options) {
if (!options)
options = {};
let object = {};
if (options.defaults)
object.tableNo = 0;
if (message.tableNo != null && message.hasOwnProperty("tableNo"))
object.tableNo = message.tableNo;
return object;
};
/**
* Converts this ResLobbyFresh to JSON.
* @function toJSON
* @memberof api.ResLobbyFresh
* @instance
* @returns {Object.<string,*>} JSON object
*/
ResLobbyFresh.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for ResLobbyFresh
* @function getTypeUrl
* @memberof api.ResLobbyFresh
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
ResLobbyFresh.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/api.ResLobbyFresh";
};
return ResLobbyFresh;
})();
api.LobbyTable = (function() { api.LobbyTable = (function() {
/** /**

13
src/pages/lobby/lobby.jsx

@ -7,6 +7,7 @@ import { setBalance } from '@/store/user';
import './lobby.scss' import './lobby.scss'
import { navigateTo, redirectTo, showToast } from '@/utils/application' import { navigateTo, redirectTo, showToast } from '@/utils/application'
import { reqLobbyView, reqJoinTable, reqAccountBalance } from '@/api/wsapi' import { reqLobbyView, reqJoinTable, reqAccountBalance } from '@/api/wsapi'
import { addMsgListen, removeMsgListener } from '@/api/websocket'
import Title from '@/components/title' import Title from '@/components/title'
import coin1 from '@/assets/coin-1.png' import coin1 from '@/assets/coin-1.png'
import robotIcon from '@/assets/icon/robot-1.svg' import robotIcon from '@/assets/icon/robot-1.svg'
@ -31,7 +32,16 @@ class Lobby extends Component {
this.circleElePos = [{x:16,y:8},{x:70,y:-3},{x:110,y:28},{x:115,y:70},{x:80,y:105},{x:20,y:100},{x:-2,y:60}]; this.circleElePos = [{x:16,y:8},{x:70,y:-3},{x:110,y:28},{x:115,y:70},{x:80,y:105},{x:20,y:100},{x:-2,y:60}];
} }
componentWillUnmount() {
//
removeMsgListener('api.ResLobbyFresh');
}
componentDidMount() { componentDidMount() {
//
addMsgListen('api.ResLobbyFresh', this.handleReqLobbyView);
// setTimeout(() => { // setTimeout(() => {
this.handleReqLobbyView(); this.handleReqLobbyView();
// }, 1500) // }, 1500)
@ -87,6 +97,7 @@ class Lobby extends Component {
// console.log('join res...', res) // console.log('join res...', res)
}catch(err) { }catch(err) {
showToast({title: err}) showToast({title: err})
this.handleReqLobbyView();
} }
} }
@ -135,7 +146,7 @@ class Lobby extends Component {
<View key="tab-wrap" className="tab-wrap"></View> <View key="tab-wrap" className="tab-wrap"></View>
</View> </View>
<View className="bottom-btn-wrap"> <View className="bottom-btn-wrap">
<Button className="bottom-btn" onClick={() => navigateTo({url: '/pages/new_table/new_table'})}>Create New Table</Button> <Button className="bottom-btn" onClick={() => navigateTo({url: '/pages/new_table/new_table'})}>创建新牌桌</Button>
</View> </View>
</View> </View>
) )

8
src/pages/login/login.jsx

@ -67,7 +67,7 @@ function Login() {
<Input className='input-1' name="password" type="password" password={true} defaultValue={state.password} placeholder="password" <Input className='input-1' name="password" type="password" password={true} defaultValue={state.password} placeholder="password"
onChange={e => setState({...state, password: e.target.value})}/> onChange={e => setState({...state, password: e.target.value})}/>
</View> </View>
<View className='input-wrap'> <View className='input-wrap' style={{display: 'none'}}>
<Image className='input-icon' src={abIcon} /> <Image className='input-icon' src={abIcon} />
<Input className='input-2' name="captcha" type="text" defaultValue={state.password} placeholder="captcha" <Input className='input-2' name="captcha" type="text" defaultValue={state.password} placeholder="captcha"
onChange={e => setState({...state, captcha: e.target.value})}/> onChange={e => setState({...state, captcha: e.target.value})}/>
@ -77,6 +77,12 @@ function Login() {
<View> <View>
<Button className='submit-btn' loading={submitLoding} onClick={handleSubmit}>START</Button> <Button className='submit-btn' loading={submitLoding} onClick={handleSubmit}>START</Button>
</View> </View>
<View className='title-line' style={{
'textAlign': 'center',
'marginTop': Taro.pxTransform(12),
'color': '#3d3d3d',
}}
><Text className='title-2'>新用户自动注册</Text></View>
<View style={{display: 'none'}}> <View style={{display: 'none'}}>
<Button type="primary" style={{width: '160px'}} onClick={handleSubmit}>提交</Button> <Button type="primary" style={{width: '160px'}} onClick={handleSubmit}>提交</Button>
<Button type="primary" style={{width: '160px'}} onClick={() => {Taro.navigateTo({url:'/pages/lobby/lobby'})}}>跳转</Button> <Button type="primary" style={{width: '160px'}} onClick={() => {Taro.navigateTo({url:'/pages/lobby/lobby'})}}>跳转</Button>

6
src/pages/new_table/new_table.jsx

@ -63,8 +63,8 @@ function NewTable() {
<View className="prop-v"> <View className="prop-v">
<Radio.RadioGroup value={texasType} direction="horizontal" onChange={setTexasType}> <Radio.RadioGroup value={texasType} direction="horizontal" onChange={setTexasType}>
<Radio value={1} iconSize={Taro.pxTransform(16)}>限注德州扑克</Radio> <Radio value={1} iconSize={Taro.pxTransform(16)}>限注德州扑克</Radio>
<Radio disabled value={2} iconSize={Taro.pxTransform(16)}>底池限德州扑克</Radio> <Radio disabled value={2} iconSize={Taro.pxTransform(16)}>底池限德州扑克</Radio>
<Radio disabled value={3} iconSize={Taro.pxTransform(16)}>无限德州扑克</Radio> <Radio disabled value={3} iconSize={Taro.pxTransform(16)}>无限德州扑克</Radio>
</Radio.RadioGroup> </Radio.RadioGroup>
</View> </View>
</View> </View>
@ -111,7 +111,7 @@ function NewTable() {
<View className="self-wrap"> <View className="self-wrap">
<View className="self"> <View className="self">
<View className="avatar-wrap"><Image className="avatar" src={avatar} /></View> <View className="avatar-wrap"><Image className="avatar" src={avatar} /></View>
<View className="nickname"><Text>{nickname}</Text></View> <View className="nickname"><Text>{username}</Text></View>
</View> </View>
</View> </View>
<View className='submit-btn-wrap'> <View className='submit-btn-wrap'>

Loading…
Cancel
Save