Tanabata show loving new posture! I give this wave of operations is!

I. Introduction

Like every drop of grape wine can not return to the original, I can not go back young. Love is also true, that the original intention was to write a small program used to record the most beautiful and I love her. What is the most beautiful love? It is busy apart of a letter, with the goal of struggle, a moment in the footsteps of tourism, and countless anniversary.

Get on it, take a look at a small program to your first impression. (Screenshot is experience version, on-line versions of some of them are not on the oh)



Page relatively simple, she liked.

Second, talk about the code

1. Frame

Applet front end with a taro framework written with cloud development background (simply the gospel of individual developers).
Posted about the overall architecture diagram:

Other architectures, pages, and so are common, I specifically said, calling it a function of the cloud, mainly operation of the database:

Entrance cloud function (using different methods to achieve TcbRouter call):

Applets end is called:

Call the method parameters:

  let param = {
      method:'get',
      collection:'mail',
      id:auth.user._id,
      bindId:auth.user.bindId,
      start:this.start,
      limit:PAGE.LIMIT
    };

    let res = await commonApi.list(param);

Third, talk about the function

It said the main mailbox that feature, after all, write less and less, where a large degree of reduction of the writing process, you can choose the envelope, stamp selection, and then send you long for.
I have received so many letters of you?

There is a message board function, she said, and micro-channel chat What is the difference (the difference is that no websocket), not repeat it here.

IV Conclusion

Tanabata had to fast and dear to bind the most beautiful love relationship now! Here, you are the director, recorded a better love.
Special note: This small program is written by me personally for girlfriend, for her the need to provide support, Tanabata happy.

/: Heart small eggs /: heart

· Use applet cloud development surprised to see eggs in the following four steps -

In cloudfuntions folder, right-click function to create a new cloud love, and deploy upload,

exports.main = async (event, context) => {
  return {
    timelimit: 10000,
  }
}

Developer tool to add an applet page love, enter the following code in love.wxml

<view>你问我爱你多少年?</view>
<image bindtap="loveFunction" src="{{loveurl}}"></image>
<view wx:if="{{timelimit}}">
  <view><text>我爱你{{timelimit}}年</text></view>
  <view><text>云开发祝所有程序员七夕脱单</text></view>  
</view>

In love.js enter:

  data: {
    timelimit:'',
    loveurl:"https://tcb-1251009918.cos.ap-guangzhou.myqcloud.com/love.png",
  },

  loveFunction() {
    wx.cloud.callFunction({
      name: 'love',
      data: {
      },
      success: res => {
        this.setData({
          timelimit: JSON.stringify(res.result.timelimit)
        })
      }
    })
  },

In love.wxss enter:

view{text-align: center;margin: 20px 0;font-weight: bold;}
text{color: #FFC0CB;}
image{width: 100rpx;height: 100rpx}
button{background-color: #FFC0CB;color:#fff;width: 300rpx}

Source link

https://github.com/TencentCloudBase/Good-practice-tutorial-recommended


如果你有关于使用云开发CloudBase相关的技术故事/技术实战经验想要跟大家分享,欢迎留言联系我们哦~比心!

Guess you like

Origin www.cnblogs.com/CloudBase/p/11318089.html