• 微信小程序源码合集8(iOS计算器+备忘录+仿今日头条+仿腾讯视频+艺术)


     
    哈喽!大家好,我是HappyGirl快乐女孩,最爱海贼王💞💞💞
    是一位爱好技术的【技术Fans】!😜😜😜


    💞💞💞 如果有对技术感兴趣的宅友,欢迎关注💞💞💞
    ❤️❤️❤️感谢各位❤️❤️❤️
    ————————————————

     🎒  🎒  🎒 文章目录 🎒  🎒  🎒

    目录

    🏳️‍🌈 iOS计算器微信小程序源码

    🍁 备忘录微信小程序

    📣 仿今日头条微信小程序

    💞 仿腾讯视频小程序

    🎉 艺术微信小程序源码

    💊 资源链接



    🏳️‍🌈 iOS计算器微信小程序源码

    在“计算器”可以使用标准计算器进行基本的算术计算。不光界面跟苹果一样,功能也齐全都是一样的哦。让你的安卓机也是跟苹果机的风格一模一样。

     

    1. Page({
    2. data: {
    3. value: null, // 上次计算后的结果,null表示没有上次计算的结果
    4. displayValue: '0', // 显示数值
    5. operator: null, // 上次计算符号,null表示没有未完成的计算
    6. waitingForOperand: false // 前一按键是否为计算符号
    7. },
    8. onLoad: function(options) {
    9. this.calculatorOperations = {
    10. 'key-divide': (prevValue, nextValue) => prevValue / nextValue,
    11. 'key-multiply': (prevValue, nextValue) => prevValue * nextValue,
    12. 'key-add': (prevValue, nextValue) => prevValue + nextValue,
    13. 'key-subtract': (prevValue, nextValue) => prevValue - nextValue,
    14. 'key-equals': (prevValue, nextValue) => nextValue
    15. }
    16. },
    17. /* AC操作,一下回到解放前 */
    18. clearAll() {
    19. this.setData({
    20. value: null,
    21. displayValue: '0',
    22. operator: null,
    23. waitingForOperand: false
    24. })
    25. },
    26. /* 仅清空当前显示的输入值 */
    27. clearDisplay() {
    28. this.setData({
    29. displayValue: '0'
    30. })
    31. },
    32. onTapFunction: function(event) {
    33. const key = event.target.dataset.key;
    34. switch(key) {
    35. case 'key-clear':
    36. if (this.data.displayValue !== '0') {
    37. this.clearDisplay();
    38. } else {
    39. this.clearAll();
    40. }
    41. break;
    42. case 'key-sign':
    43. var newValue = parseFloat(this.data.displayValue) * -1
    44. this.setData({
    45. displayValue: String(newValue)
    46. })
    47. break;
    48. case 'key-percent':
    49. const fixedDigits = this.data.displayValue.replace(/^-?\d*\.?/, '')
    50. var newValue = parseFloat(this.data.displayValue) / 100
    51. this.setData({
    52. displayValue: String(newValue.toFixed(fixedDigits.length + 2))
    53. });
    54. break;
    55. default:
    56. break;
    57. }
    58. },
    59. onTapOperator: function(event) {
    60. const nextOperator = event.target.dataset.key;
    61. const inputValue = parseFloat(this.data.displayValue);
    62. if (this.data.value == null) {
    63. this.setData({
    64. value: inputValue
    65. });
    66. } else if (this.data.operator) {
    67. const currentValue = this.data.value || 0;
    68. const newValue = this.calculatorOperations[this.data.operator](currentValue, inputValue);
    69. this.setData({
    70. value: newValue,
    71. displayValue: String(newValue)
    72. });
    73. }
    74. this.setData({
    75. waitingForOperand: true,
    76. operator: nextOperator
    77. });
    78. },
    79. onTapDigit: function(event) {
    80. const key = event.target.dataset.key; // 根据data-key标记按键
    81. if(key == 'key-dot') {
    82. // 按下点号
    83. if (!(/\./).test(this.data.displayValue)) {
    84. this.setData({
    85. displayValue: this.data.displayValue + '.',
    86. waitingForOperand: false
    87. })
    88. }
    89. } else {
    90. // 按下数字键
    91. const digit = key[key.length-1];
    92. if (this.data.waitingForOperand) {
    93. this.setData({
    94. displayValue: String(digit),
    95. waitingForOperand: false
    96. })
    97. } else {
    98. this.setData({
    99. displayValue: this.data.displayValue === '0' ? String(digit) : this.data.displayValue + digit
    100. })
    101. }
    102. }
    103. }
    104. })

    🍁 备忘录微信小程序

     

    1. //index.js
    2. var dataUrl = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
    3. var util = require("../../utils/util.js");
    4. //更改数组 第三个参数是对象
    5. function editArr(arr,i,editCnt){
    6. let newArr = arr,editingObj = newArr[i];
    7. for (var x in editCnt){
    8. editingObj[x]= editCnt[x];
    9. }
    10. return newArr;
    11. }
    12. //获取应用实例
    13. var app = getApp()
    14. Page({
    15. data: {
    16. userInfo: {},
    17. curIpt:'',
    18. showAll:true,
    19. lists:[],
    20. curRange:[],
    21. curBegin:0,
    22. curFinish:1,
    23. remind:[]
    24. },
    25. //事件处理函数
    26. bindViewTap: function() {
    27. wx.navigateTo({
    28. url: '../logs/logs'
    29. })
    30. },
    31. onLoad: function () {
    32. var that = this;
    33. //获取之前保留在缓存里的数据
    34. wx.getStorage({
    35. key: 'todolist',
    36. success: function(res) {
    37. if(res.data){
    38. that.setData({
    39. lists:res.data
    40. })
    41. }
    42. }
    43. })
    44. //获取用户信息
    45. app.getUserInfo(function(userInfo){
    46. that.setData({
    47. userInfo:userInfo
    48. })
    49. })
    50. },
    51. iptChange(e){
    52. let timeArr = util.setTimeHalf();
    53. this.setData({
    54. curIpt:e.detail.value,
    55. curRange:timeArr
    56. })
    57. },
    58. formReset(){
    59. this.setData({
    60. curIpt:'',
    61. curRange:[]
    62. })
    63. },
    64. formSubmit(){
    65. let cnt = this.data.curIpt,newLists = this.data.lists,i = newLists.length,begin=this.data.curRange[this.data.curBegin],finish = this.data.curRange[this.data.curFinish];
    66. if (cnt){
    67. newLists.push({id:i,content:cnt,done:false,beginTime:begin,finishTime:finish,editing:false});
    68. this.setData({
    69. lists:newLists,
    70. curIpt:''
    71. })
    72. }
    73. },
    74. beginChange(e){
    75. this.setData({
    76. curBegin: e.detail.value,
    77. curFinish: Number(e.detail.value)+1
    78. })
    79. },
    80. finishChange(e){
    81. this.setData({
    82. curFinish: e.detail.value
    83. })
    84. },
    85. //修改备忘录
    86. toChange(e){
    87. let i = e.target.dataset.id;
    88. this.setData({
    89. lists:editArr(this.data.lists,i,{editing:true})
    90. })
    91. },
    92. iptEdit(e){
    93. let i = e.target.dataset.id;
    94. this.setData({
    95. lists:editArr(this.data.lists,i,{curVal:e.detail.value})
    96. })
    97. },
    98. saveEdit(e){
    99. let i = e.target.dataset.id;
    100. this.setData({
    101. lists:editArr(this.data.lists,i,{content:this.data.lists[i].curVal,editing:false})
    102. })
    103. },
    104. setDone(e){
    105. let i = e.target.dataset.id,originalDone = this.data.lists[i].done;
    106. this.setData({
    107. lists:editArr(this.data.lists,i,{done:!originalDone})
    108. })
    109. },
    110. toDelete(e){
    111. let i = e.target.dataset.id,newLists = this.data.lists;
    112. newLists.map(function(l,index){
    113. if (l.id == i){
    114. newLists.splice(index,1);
    115. }
    116. })
    117. this.setData({
    118. lists:newLists
    119. })
    120. },
    121. doneAll(){
    122. let newLists = this.data.lists;
    123. newLists.map(function(l){
    124. l.done = true;
    125. })
    126. this.setData({
    127. lists:newLists
    128. })
    129. },
    130. deleteAll(){
    131. this.setData({
    132. lists:[],
    133. remind:[]
    134. })
    135. },
    136. showUnfinished (){
    137. this.setData({
    138. showAll:false
    139. })
    140. },
    141. showAll(){
    142. //显示全部事项
    143. this.setData({
    144. showAll:true
    145. })
    146. },
    147. saveData(){
    148. let listsArr = this.data.lists;
    149. wx.setStorage({
    150. key:'todolist',
    151. data:listsArr
    152. })
    153. }
    154. })

    📣 仿今日头条微信小程序

     

    1. //index.js
    2. //获取应用实例
    3. var net = require("../common/netLoad.js");
    4. var app = getApp();
    5. let params = {"device_id":60926495334,"category":"__all__","iid":5034850950};
    6. import {fetchHeadName,loadHomeCategoryNewsFeed,loadHomeCategoryMoreNewsFeed} from "../common/netTool.js"
    7. // var net1 = require("../common/netTool.js");
    8. import dateTimeStamp from '../common/datamissing.js';
    9. Page({
    10. data: {
    11. motto: 'Hello World',
    12. userInfo: {},
    13. selData:[],
    14. ishidden:true,
    15. curpage:0,
    16. detaildata:[],
    17. timePublic:[],
    18. loading:false
    19. },
    20. onReady:function(){
    21. this.animation = wx.createAnimation({
    22. duration:1000,
    23. timingFunction:"ease",
    24. })
    25. },
    26. //排列数据
    27. listdata(resp){
    28. // var jsonstr = resp.data.data[0].content;
    29. var dataArr = [],timepublic = [];
    30. for (var index of resp.data.data){
    31. //转换Json字符串=》Json对象
    32. dataArr.push(JSON.parse(index.content));
    33. }
    34. for (var data of dataArr){
    35. var time = dateTimeStamp(data.publish_time);
    36. data.publish_time = time;
    37. }
    38. console.log(dataArr);
    39. this.setData({
    40. detaildata:dataArr,
    41. loading:true
    42. });
    43. },
    44. onLoad: function () {
    45. console.log('onLoad');
    46. wx.showNavigationBarLoading();
    47. let dataArr = [],topname = [];
    48. fetchHeadName().then(resp=>{
    49. //此时给头部
    50. // console.log(resp.data.data.data[0].name);
    51. wx.hideNavigationBarLoading();
    52. dataArr = resp.data.data.data;
    53. console.log(dataArr);
    54. this.setData({
    55. selData:dataArr
    56. })
    57. })
    58. loadHomeCategoryNewsFeed("__all__").then(resp=>{
    59. this.listdata(resp);
    60. })
    61. },
    62. listClick(e){
    63. this.setData({
    64. loading:false
    65. })
    66. var idx = e.currentTarget.dataset.idx;
    67. console.log(idx);
    68. var selLength = this.data.selData.length;
    69. for (var i=0; i<selLength; i++){
    70. if(i == e.target.id){
    71. this.setData({
    72. ishidden:false,
    73. curpage:e.target.id
    74. });
    75. break;
    76. }
    77. }
    78. //此时得到刷新列表的数据
    79. loadHomeCategoryNewsFeed(idx).then(resp=>{
    80. console.log(resp);
    81. this.listdata(resp);
    82. })
    83. },
    84. //添加数据
    85. addData(e){
    86. wx.showNavigationBarLoading();
    87. var now = new Date().getTime()/1000;
    88. var curdata = this.data.detaildata;
    89. loadHomeCategoryMoreNewsFeed("__all__",now).then(resp=>{
    90. var arr = resp.data.data;
    91. var dataArr = [];
    92. for (var index of arr){
    93. //转换Json字符串=》Json对象
    94. dataArr.push(JSON.parse(index.content));
    95. }
    96. curdata = curdata.concat(dataArr);
    97. console.log(curdata);
    98. wx.hideNavigationBarLoading();
    99. this.setData({
    100. detaildata:curdata,
    101. });
    102. })
    103. }
    104. })

    💞 仿腾讯视频小程序

     

    1. //index.js
    2. //获取应用实例
    3. var app = getApp()
    4. Page({
    5. data: {
    6. scrollId : 'red',
    7. isScrollX: true,
    8. bannerList : [
    9. {
    10. url : "../../images/hu_1.png"
    11. },{
    12. url : "../../images/huang_1.jpg"
    13. },{
    14. url : "../../images/zhao_1.jpg"
    15. }
    16. ],
    17. activeBannerIndex : 0,
    18. userInfo: {}
    19. },
    20. search:function(event){
    21. wx.navigateTo({
    22. url:"../search/search"
    23. });
    24. },
    25. //事件处理函数
    26. bindViewTap: function() {
    27. wx.navigateTo({
    28. url: '../logs/logs'
    29. })
    30. },
    31. bindChange : function(e){
    32. this.setData({activeBannerIndex : e.detail.current});
    33. },
    34. onLoad: function () {
    35. wx.showToast({
    36. title:"加载中...",
    37. icon:"loading",
    38. duration:10000,
    39. });
    40. wx.hideToast();
    41. console.log('onLoad')
    42. var that = this
    43. //调用应用实例的方法获取全局数据
    44. app.getUserInfo(function(userInfo){
    45. //更新数据
    46. that.setData({
    47. userInfo:userInfo
    48. })
    49. })
    50. console.log(app.globalData);
    51. this.setData({'windowWidth' : app.globalData.windowWidth});
    52. }
    53. })

    🎉 艺术微信小程序源码

     

     

     

     

     

    1. //app.js
    2. App({
    3. onLaunch: function () {
    4. //调用API从本地缓存中获取数据
    5. var logs = wx.getStorageSync('logs') || []
    6. logs.unshift(Date.now())
    7. wx.setStorageSync('logs', logs)
    8. },
    9. getUserInfo: function(cb){
    10. var that = this
    11. if(this.globalData.userInfo){
    12. typeof cb == "function" && cb(this.globalData.userInfo)
    13. }else{
    14. //调用登录接口
    15. wx.login({
    16. success: function () {
    17. wx.getUserInfo({
    18. success: function (res) {
    19. that.globalData.userInfo = res.userInfo
    20. typeof cb == "function" && cb(that.globalData.userInfo)
    21. }
    22. })
    23. }
    24. })
    25. }
    26. },
    27. getSystemInfo: function (cb) {
    28. var that = this
    29. if(that.globalData.systemInfo){
    30. typeof cb == "function" && cb(that.globalData.systemInfo)
    31. }else{
    32. wx.getSystemInfo({
    33. success: function(res) {
    34. that.globalData.systemInfo = res
    35. typeof cb == "function" && cb(that.globalData.systemInfo)
    36. }
    37. })
    38. }
    39. },
    40. globalData:{
    41. userInfo: null,
    42. systemInfo: null
    43. }
    44. })

    💊 资源链接

    微信小程序源码合集8(iOS计算器+备忘录+仿今日头条+仿腾讯视频+艺术).rar-小程序文档类资源-CSDN文库

    各位走过路过,不要错过,记得关注我哦

     

  • 相关阅读:
    【常用代码14】el-input输入框内判断正则,只能输入数字,过滤汉字+字母。
    ssm网上书城系统毕业设计-附源码180919
    【附源码】Python计算机毕业设计网络教育平台设计
    可以 DIY 装修的商城系统,你也能拥有!
    【华为OD机试真题 JAVA】贪吃蛇
    D. Meta-set #824 div2
    台达DOP-B07S410触摸屏出现HMI no response无法上传的解决办法
    Java中Date实现比较大小
    汽车以太网简史
    使用Portman、Postman和Newman自动化API测试
  • 原文地址:https://blog.csdn.net/weixin_67336587/article/details/125507052