| | |
| | | <template>
|
| | | <view class="contaier">
|
| | | <view class="top-bg">
|
| | | <view class="text-white text-bold text-xxxl">智能中草药干燥小程序系统</view>
|
| | | <view class="text-white text-bold text-xxxl">智能中草药干燥设备配套系统</view>
|
| | | <view class="margin-top-xs text-white">欢迎使用,请先登录</view>
|
| | | </view>
|
| | | <u-form labelPosition="left" :model="model" ref="form">
|
| | |
| | | data() {
|
| | | return {
|
| | | model: {
|
| | | username: "",
|
| | | password: ""
|
| | | username: "tongjitang",
|
| | | password: "123456"
|
| | | },
|
| | | rules: {
|
| | | 'username': {
|
| | |
| | | if (account) {
|
| | | this.model = account
|
| | | }
|
| | | let _that = this
|
| | | // uni-app客户端获取push客户端标记
|
| | | // uni.getPushClientId({
|
| | | // success: (res) => {
|
| | | // let push_clientid = res.cid
|
| | | // _that.model.username = push_clientid
|
| | | // console.log('客户端推送标识:', push_clientid)
|
| | | // },
|
| | | // fail(err) {
|
| | | // _that.model.username = err
|
| | | // console.log(err)
|
| | | // }
|
| | | // })
|
| | |
|
| | | // uni.onPushMessage((res) => {
|
| | | // _that.model.username = JSON.stringify(res)
|
| | | // console.log("收到推送消息:", res) //监听推送消息
|
| | | // })
|
| | |
|
| | |
|
| | |
|
| | | },
|
| | |
|
| | | computed: {
|
| | | cid() {
|
| | | return this.$store.getters.getCid; // 使用 getter 获取 cid
|
| | | },
|
| | | },
|
| | | methods: {
|
| | |
|
| | | forget() {
|
| | | uni.navigateTo({
|
| | | url: "/pages/tabBar/demo"
|
| | | })
|
| | | },
|
| | | submit() {
|
| | |
|
| | | if (this.model.username.startsWith("http")) {
|
| | | uni.setStorageSync('baseurl', this.model.username);
|
| | | this.model.username = null
|
| | |
| | | this.$api.login(this.model).then((res) => {
|
| | | if (res.success) {
|
| | |
|
| | |
|
| | | console.log('request success', res)
|
| | | uni.showToast({
|
| | | title: '登录成功',
|
| | |
| | | uni.setStorageSync('userinfo', res.result.userInfo);
|
| | | uni.setStorageSync('token', res.result.token);
|
| | |
|
| | |
|
| | |
|
| | | uni.switchTab({
|
| | | url: '/pages/tabBar/general'
|
| | | })
|